Files
ChronoCCG/chrono.docs/Master of Ceremonies_files/flux.min.js.download
T
2026-06-17 11:01:40 -04:00

132 lines
264 KiB
Plaintext

(()=>{var ui=class extends Event{oldState;newState;constructor(i,{oldState:t="",newState:e="",...s}={}){super(i,s),this.oldState=String(t||""),this.newState=String(e||"")}},Br=new WeakMap;function zr(i,t,e){Br.set(i,setTimeout(()=>{Br.has(i)&&i.dispatchEvent(new ui("toggle",{cancelable:!1,oldState:t,newState:e}))},0))}var as=globalThis.ShadowRoot||function(){},fn=globalThis.HTMLDialogElement||function(){},ri=new WeakMap,Dt=new WeakMap,Ne=new WeakMap;function ai(i){return Ne.get(i)||"hidden"}var ni=new WeakMap;function pn(i){let t=i.popoverTargetElement;if(!(t instanceof HTMLElement))return;let e=ai(t);i.popoverTargetAction==="show"&&e==="showing"||i.popoverTargetAction==="hide"&&e==="hidden"||(e==="showing"?Oe(t,!0,!0):Zt(t,!1)&&(ni.set(t,i),rs(t)))}function Zt(i,t){return!(i.popover!=="auto"&&i.popover!=="manual"||!i.isConnected||t&&ai(i)!=="showing"||!t&&ai(i)!=="hidden"||i instanceof fn&&i.hasAttribute("open")||document.fullscreenElement===i)}function Wr(i){return i?Array.from(Dt.get(i.ownerDocument)||[]).indexOf(i)+1:0}function bn(i){let t=Gr(i),e=mn(i);return Wr(t)>Wr(e)?t:e}function oi(i){let t=Dt.get(i);for(let e of t||[])if(!e.isConnected)t.delete(e);else return e;return null}function pe(i){return typeof i.getRootNode=="function"?i.getRootNode():i.parentNode?pe(i.parentNode):i}function Gr(i){for(;i;){if(i instanceof HTMLElement&&i.popover==="auto"&&Ne.get(i)==="showing")return i;if(i=i instanceof Element&&i.assignedSlot||i.parentElement||pe(i),i instanceof as&&(i=i.host),i instanceof Document)return}}function mn(i){for(;i;){let t=i.popoverTargetElement;if(t instanceof HTMLElement)return t;if(i=i.parentElement||pe(i),i instanceof as&&(i=i.host),i instanceof Document)return}}function gn(i){let t=new Map,e=0;for(let a of Dt.get(i.ownerDocument)||[])t.set(a,e),e+=1;t.set(i,e),e+=1;let s=null;function r(a){let n=Gr(a);if(n===null)return null;let l=t.get(n);(s===null||t.get(s)<l)&&(s=n)}return r(i.parentElement||pe(i)),s}function vn(i){return i.hidden||i instanceof as||(i instanceof HTMLButtonElement||i instanceof HTMLInputElement||i instanceof HTMLSelectElement||i instanceof HTMLTextAreaElement||i instanceof HTMLOptGroupElement||i instanceof HTMLOptionElement||i instanceof HTMLFieldSetElement)&&i.disabled||i instanceof HTMLInputElement&&i.type==="hidden"||i instanceof HTMLAnchorElement&&i.href===""?!1:typeof i.tabIndex=="number"&&i.tabIndex!==-1}function yn(i){if(i.shadowRoot&&i.shadowRoot.delegatesFocus!==!0)return null;let t=i;t.shadowRoot&&(t=t.shadowRoot);let e=t.querySelector("[autofocus]");if(e)return e;{let a=t.querySelectorAll("slot");for(let n of a){let l=n.assignedElements({flatten:!0});for(let o of l){if(o.hasAttribute("autofocus"))return o;if(e=o.querySelector("[autofocus]"),e)return e}}}let s=i.ownerDocument.createTreeWalker(t,NodeFilter.SHOW_ELEMENT),r=s.currentNode;for(;r;){if(vn(r))return r;r=s.nextNode()}}function wn(i){yn(i)?.focus()}var li=new WeakMap;function rs(i){if(!Zt(i,!1))return;let t=i.ownerDocument;if(!i.dispatchEvent(new ui("beforetoggle",{cancelable:!0,oldState:"closed",newState:"open"}))||!Zt(i,!1))return;let e=!1;if(i.popover==="auto"){let r=i.getAttribute("popover"),a=gn(i)||t;if(hi(a,!1,!0),r!==i.getAttribute("popover")||!Zt(i,!1))return}oi(t)||(e=!0),li.delete(i);let s=t.activeElement;i.classList.add(":popover-open"),Ne.set(i,"showing"),ri.has(t)||ri.set(t,new Set),ri.get(t).add(i),wn(i),i.popover==="auto"&&(Dt.has(t)||Dt.set(t,new Set),Dt.get(t).add(i),Kr(ni.get(i),!0)),e&&s&&i.popover==="auto"&&li.set(i,s),zr(i,"closed","open")}function Oe(i,t=!1,e=!1){if(!Zt(i,!0))return;let s=i.ownerDocument;if(i.popover==="auto"&&(hi(i,t,e),!Zt(i,!0))||(Kr(ni.get(i),!1),ni.delete(i),e&&(i.dispatchEvent(new ui("beforetoggle",{oldState:"open",newState:"closed"})),!Zt(i,!0))))return;ri.get(s)?.delete(i),Dt.get(s)?.delete(i),i.classList.remove(":popover-open"),Ne.set(i,"hidden"),e&&zr(i,"open","closed");let r=li.get(i);r&&(li.delete(i),t&&r.focus())}function Hr(i,t=!1,e=!1){let s=oi(i);for(;s;)Oe(s,t,e),s=oi(i)}function hi(i,t,e){let s=i.ownerDocument||i;if(i instanceof Document)return Hr(s,t,e);let r=null,a=!1;for(let n of Dt.get(s)||[])if(n===i)a=!0;else if(a){r=n;break}if(!a)return Hr(s,t,e);for(;r&&ai(r)==="showing"&&Dt.get(s)?.size;)Oe(r,t,e)}var es=new WeakMap;function Ur(i){if(!i.isTrusted)return;let t=i.composedPath()[0];if(!t)return;let e=t.ownerDocument;if(!oi(e))return;let r=bn(t);if(r&&i.type==="pointerdown")es.set(e,r);else if(i.type==="pointerup"){let a=es.get(e)===r;es.delete(e),a&&hi(r||e,!1,!0)}}var is=new WeakMap;function Kr(i,t=!1){if(!i)return;is.has(i)||is.set(i,i.getAttribute("aria-expanded"));let e=i.popoverTargetElement;if(e instanceof HTMLElement&&e.popover==="auto")i.setAttribute("aria-expanded",String(t));else{let s=is.get(i);s?i.setAttribute("aria-expanded",s):i.removeAttribute("aria-expanded")}}var Yr=globalThis.ShadowRoot||function(){};function xn(){return typeof HTMLElement<"u"&&typeof HTMLElement.prototype=="object"&&"popover"in HTMLElement.prototype}function Jt(i,t,e){let s=i[t];Object.defineProperty(i,t,{value(r){return s.call(this,e(r))}})}var An=/(^|[^\\]):popover-open\b/g;function Sn(){return typeof globalThis.CSSLayerBlockRule=="function"}function En(){let i=Sn();return`
${i?"@layer popover-polyfill {":""}
:where([popover]) {
position: fixed;
z-index: 2147483647;
inset: 0;
padding: 0.25em;
width: fit-content;
height: fit-content;
border-width: initial;
border-color: initial;
border-image: initial;
border-style: solid;
background-color: canvas;
color: canvastext;
overflow: auto;
margin: auto;
}
:where([popover]:not(.\\:popover-open)) {
display: none;
}
:where(dialog[popover].\\:popover-open) {
display: block;
}
:where(dialog[popover][open]) {
display: revert;
}
:where([anchor].\\:popover-open) {
inset: auto;
}
:where([anchor]:popover-open) {
inset: auto;
}
@supports not (background-color: canvas) {
:where([popover]) {
background-color: white;
color: black;
}
}
@supports (width: -moz-fit-content) {
:where([popover]) {
width: -moz-fit-content;
height: -moz-fit-content;
}
}
@supports not (inset: 0) {
:where([popover]) {
top: 0;
left: 0;
right: 0;
bottom: 0;
}
}
${i?"}":""}
`}var fe=null;function ss(i){let t=En();if(fe===null)try{fe=new CSSStyleSheet,fe.replaceSync(t)}catch{fe=!1}if(fe===!1){let e=document.createElement("style");e.textContent=t,i instanceof Document?i.head.prepend(e):i.prepend(e)}else i.adoptedStyleSheets=[fe,...i.adoptedStyleSheets]}function _n(){if(typeof window>"u")return;window.ToggleEvent=window.ToggleEvent||ui;function i(o){return o?.includes(":popover-open")&&(o=o.replace(An,"$1.\\:popover-open")),o}Jt(Document.prototype,"querySelector",i),Jt(Document.prototype,"querySelectorAll",i),Jt(Element.prototype,"querySelector",i),Jt(Element.prototype,"querySelectorAll",i),Jt(Element.prototype,"matches",i),Jt(Element.prototype,"closest",i),Jt(DocumentFragment.prototype,"querySelectorAll",i),Object.defineProperties(HTMLElement.prototype,{popover:{enumerable:!0,configurable:!0,get(){if(!this.hasAttribute("popover"))return null;let o=(this.getAttribute("popover")||"").toLowerCase();return o===""||o=="auto"?"auto":"manual"},set(o){o===null?this.removeAttribute("popover"):this.setAttribute("popover",o)}},showPopover:{enumerable:!0,configurable:!0,value(){rs(this)}},hidePopover:{enumerable:!0,configurable:!0,value(){Oe(this,!0,!0)}},togglePopover:{enumerable:!0,configurable:!0,value(o){Ne.get(this)==="showing"&&o===void 0||o===!1?Oe(this,!0,!0):(o===void 0||o===!0)&&rs(this)}}});let t=Element.prototype.attachShadow;t&&Object.defineProperties(Element.prototype,{attachShadow:{enumerable:!0,configurable:!0,writable:!0,value(o){let u=t.call(this,o);return ss(u),u}}});let e=HTMLElement.prototype.attachInternals;e&&Object.defineProperties(HTMLElement.prototype,{attachInternals:{enumerable:!0,configurable:!0,writable:!0,value(){let o=e.call(this);return o.shadowRoot&&ss(o.shadowRoot),o}}});let s=new WeakMap;function r(o){Object.defineProperties(o.prototype,{popoverTargetElement:{enumerable:!0,configurable:!0,set(u){if(u===null)this.removeAttribute("popovertarget"),s.delete(this);else if(u instanceof Element)this.setAttribute("popovertarget",""),s.set(this,u);else throw new TypeError("popoverTargetElement must be an element or null")},get(){if(this.localName!=="button"&&this.localName!=="input"||this.localName==="input"&&this.type!=="reset"&&this.type!=="image"&&this.type!=="button"||this.disabled||this.form&&this.type==="submit")return null;let u=s.get(this);if(u&&u.isConnected)return u;if(u&&!u.isConnected)return s.delete(this),null;let d=pe(this),c=this.getAttribute("popovertarget");return(d instanceof Document||d instanceof Yr)&&c&&d.getElementById(c)||null}},popoverTargetAction:{enumerable:!0,configurable:!0,get(){let u=(this.getAttribute("popovertargetaction")||"").toLowerCase();return u==="show"||u==="hide"?u:"toggle"},set(u){this.setAttribute("popovertargetaction",u)}}})}r(HTMLButtonElement),r(HTMLInputElement);let a=o=>{let u=o.composedPath(),d=u[0];if(!(d instanceof Element)||d?.shadowRoot)return;let c=pe(d);if(!(c instanceof Yr||c instanceof Document))return;let f=u.find(m=>m.matches?.("[popovertargetaction],[popovertarget]"));if(f){pn(f),o.preventDefault();return}},n=o=>{let u=o.key,d=o.target;!o.defaultPrevented&&d&&(u==="Escape"||u==="Esc")&&hi(d.ownerDocument,!0,!0)};(o=>{o.addEventListener("click",a),o.addEventListener("keydown",n),o.addEventListener("pointerdown",Ur),o.addEventListener("pointerup",Ur)})(document),ss(document)}xn()||_n();var mi=class extends Event{oldState;newState;constructor(i,{oldState:t="",newState:e="",...s}={}){super(i,s),this.oldState=String(t||""),this.newState=String(e||"")}},Xr=new WeakMap;function ta(i,t,e){Xr.set(i,setTimeout(()=>{Xr.has(i)&&i.dispatchEvent(new mi("toggle",{cancelable:!1,oldState:t,newState:e}))},0))}var hs=globalThis.ShadowRoot||function(){},kn=globalThis.HTMLDialogElement||function(){},ci=new WeakMap,It=new WeakMap,Fe=new WeakMap;function di(i){return Fe.get(i)||"hidden"}var fi=new WeakMap;function Cn(i){let t=i.popoverTargetElement;if(!(t instanceof HTMLElement))return;let e=di(t);i.popoverTargetAction==="show"&&e==="showing"||i.popoverTargetAction==="hide"&&e==="hidden"||(e==="showing"?Re(t,!0,!0):te(t,!1)&&(fi.set(t,i),us(t)))}function te(i,t){return!(i.popover!=="auto"&&i.popover!=="manual"||!i.isConnected||t&&di(i)!=="showing"||!t&&di(i)!=="hidden"||i instanceof kn&&i.hasAttribute("open")||document.fullscreenElement===i)}function jr(i){return i?Array.from(It.get(i.ownerDocument)||[]).indexOf(i)+1:0}function Tn(i){let t=ea(i),e=Dn(i);return jr(t)>jr(e)?t:e}function pi(i){let t=It.get(i);for(let e of t||[])if(!e.isConnected)t.delete(e);else return e;return null}function me(i){return typeof i.getRootNode=="function"?i.getRootNode():i.parentNode?me(i.parentNode):i}function ea(i){for(;i;){if(i instanceof HTMLElement&&i.popover==="auto"&&Fe.get(i)==="showing")return i;if(i=i instanceof Element&&i.assignedSlot||i.parentElement||me(i),i instanceof hs&&(i=i.host),i instanceof Document)return}}function Dn(i){for(;i;){let t=i.popoverTargetElement;if(t instanceof HTMLElement)return t;if(i=i.parentElement||me(i),i instanceof hs&&(i=i.host),i instanceof Document)return}}function In(i){let t=new Map,e=0;for(let a of It.get(i.ownerDocument)||[])t.set(a,e),e+=1;t.set(i,e),e+=1;let s=null;function r(a){let n=ea(a);if(n===null)return null;let l=t.get(n);(s===null||t.get(s)<l)&&(s=n)}return r(i.parentElement||me(i)),s}function Ln(i){return i.hidden||i instanceof hs||(i instanceof HTMLButtonElement||i instanceof HTMLInputElement||i instanceof HTMLSelectElement||i instanceof HTMLTextAreaElement||i instanceof HTMLOptGroupElement||i instanceof HTMLOptionElement||i instanceof HTMLFieldSetElement)&&i.disabled||i instanceof HTMLInputElement&&i.type==="hidden"||i instanceof HTMLAnchorElement&&i.href===""?!1:typeof i.tabIndex=="number"&&i.tabIndex!==-1}function Mn(i){if(i.shadowRoot&&i.shadowRoot.delegatesFocus!==!0)return null;let t=i;t.shadowRoot&&(t=t.shadowRoot);let e=t.querySelector("[autofocus]");if(e)return e;{let a=t.querySelectorAll("slot");for(let n of a){let l=n.assignedElements({flatten:!0});for(let o of l){if(o.hasAttribute("autofocus"))return o;if(e=o.querySelector("[autofocus]"),e)return e}}}let s=i.ownerDocument.createTreeWalker(t,NodeFilter.SHOW_ELEMENT),r=s.currentNode;for(;r;){if(Ln(r))return r;r=s.nextNode()}}function Pn(i){Mn(i)?.focus()}var bi=new WeakMap;function us(i){if(!te(i,!1))return;let t=i.ownerDocument;if(!i.dispatchEvent(new mi("beforetoggle",{cancelable:!0,oldState:"closed",newState:"open"}))||!te(i,!1))return;let e=!1;if(i.popover==="auto"){let r=i.getAttribute("popover"),a=In(i)||t;if(gi(a,!1,!0),r!==i.getAttribute("popover")||!te(i,!1))return}pi(t)||(e=!0),bi.delete(i);let s=t.activeElement;i.classList.add(":popover-open"),Fe.set(i,"showing"),ci.has(t)||ci.set(t,new Set),ci.get(t).add(i),Pn(i),i.popover==="auto"&&(It.has(t)||It.set(t,new Set),It.get(t).add(i),ia(fi.get(i),!0)),e&&s&&i.popover==="auto"&&bi.set(i,s),ta(i,"closed","open")}function Re(i,t=!1,e=!1){if(!te(i,!0))return;let s=i.ownerDocument;if(i.popover==="auto"&&(gi(i,t,e),!te(i,!0))||(ia(fi.get(i),!1),fi.delete(i),e&&(i.dispatchEvent(new mi("beforetoggle",{oldState:"open",newState:"closed"})),!te(i,!0))))return;ci.get(s)?.delete(i),It.get(s)?.delete(i),i.classList.remove(":popover-open"),Fe.set(i,"hidden"),e&&ta(i,"open","closed");let r=bi.get(i);r&&(bi.delete(i),t&&r.focus())}function Jr(i,t=!1,e=!1){let s=pi(i);for(;s;)Re(s,t,e),s=pi(i)}function gi(i,t,e){let s=i.ownerDocument||i;if(i instanceof Document)return Jr(s,t,e);let r=null,a=!1;for(let n of It.get(s)||[])if(n===i)a=!0;else if(a){r=n;break}if(!a)return Jr(s,t,e);for(;r&&di(r)==="showing"&&It.get(s)?.size;)Re(r,t,e)}var ns=new WeakMap;function Zr(i){if(!i.isTrusted)return;let t=i.composedPath()[0];if(!t)return;let e=t.ownerDocument;if(!pi(e))return;let r=Tn(t);if(r&&i.type==="pointerdown")ns.set(e,r);else if(i.type==="pointerup"){let a=ns.get(e)===r;ns.delete(e),a&&gi(r||e,!1,!0)}}var os=new WeakMap;function ia(i,t=!1){if(!i)return;os.has(i)||os.set(i,i.getAttribute("aria-expanded"));let e=i.popoverTargetElement;if(e instanceof HTMLElement&&e.popover==="auto")i.setAttribute("aria-expanded",String(t));else{let s=os.get(i);s?i.setAttribute("aria-expanded",s):i.removeAttribute("aria-expanded")}}var Qr=globalThis.ShadowRoot||function(){};function sa(){return typeof HTMLElement<"u"&&typeof HTMLElement.prototype=="object"&&"popover"in HTMLElement.prototype}function ra(){return!!(document.body?.showPopover&&!/native code/i.test(document.body.showPopover.toString()))}function Qt(i,t,e){let s=i[t];Object.defineProperty(i,t,{value(r){return s.call(this,e(r))}})}var On=/(^|[^\\]):popover-open\b/g;function Nn(){return typeof globalThis.CSSLayerBlockRule=="function"}function Rn(){let i=Nn();return`
${i?"@layer popover-polyfill {":""}
:where([popover]) {
position: fixed;
z-index: 2147483647;
inset: 0;
padding: 0.25em;
width: fit-content;
height: fit-content;
border-width: initial;
border-color: initial;
border-image: initial;
border-style: solid;
background-color: canvas;
color: canvastext;
overflow: auto;
margin: auto;
}
:where([popover]:not(.\\:popover-open)) {
display: none;
}
:where(dialog[popover].\\:popover-open) {
display: block;
}
:where(dialog[popover][open]) {
display: revert;
}
:where([anchor].\\:popover-open) {
inset: auto;
}
:where([anchor]:popover-open) {
inset: auto;
}
@supports not (background-color: canvas) {
:where([popover]) {
background-color: white;
color: black;
}
}
@supports (width: -moz-fit-content) {
:where([popover]) {
width: -moz-fit-content;
height: -moz-fit-content;
}
}
@supports not (inset: 0) {
:where([popover]) {
top: 0;
left: 0;
right: 0;
bottom: 0;
}
}
${i?"}":""}
`}var be=null;function ls(i){let t=Rn();if(be===null)try{be=new CSSStyleSheet,be.replaceSync(t)}catch{be=!1}if(be===!1){let e=document.createElement("style");e.textContent=t,i instanceof Document?i.head.prepend(e):i.prepend(e)}else i.adoptedStyleSheets=[be,...i.adoptedStyleSheets]}function aa(){if(typeof window>"u")return;window.ToggleEvent=window.ToggleEvent||mi;function i(o){return o?.includes(":popover-open")&&(o=o.replace(On,"$1.\\:popover-open")),o}Qt(Document.prototype,"querySelector",i),Qt(Document.prototype,"querySelectorAll",i),Qt(Element.prototype,"querySelector",i),Qt(Element.prototype,"querySelectorAll",i),Qt(Element.prototype,"matches",i),Qt(Element.prototype,"closest",i),Qt(DocumentFragment.prototype,"querySelectorAll",i),Object.defineProperties(HTMLElement.prototype,{popover:{enumerable:!0,configurable:!0,get(){if(!this.hasAttribute("popover"))return null;let o=(this.getAttribute("popover")||"").toLowerCase();return o===""||o=="auto"?"auto":"manual"},set(o){o===null?this.removeAttribute("popover"):this.setAttribute("popover",o)}},showPopover:{enumerable:!0,configurable:!0,value(){us(this)}},hidePopover:{enumerable:!0,configurable:!0,value(){Re(this,!0,!0)}},togglePopover:{enumerable:!0,configurable:!0,value(o){Fe.get(this)==="showing"&&o===void 0||o===!1?Re(this,!0,!0):(o===void 0||o===!0)&&us(this)}}});let t=Element.prototype.attachShadow;t&&Object.defineProperties(Element.prototype,{attachShadow:{enumerable:!0,configurable:!0,writable:!0,value(o){let u=t.call(this,o);return ls(u),u}}});let e=HTMLElement.prototype.attachInternals;e&&Object.defineProperties(HTMLElement.prototype,{attachInternals:{enumerable:!0,configurable:!0,writable:!0,value(){let o=e.call(this);return o.shadowRoot&&ls(o.shadowRoot),o}}});let s=new WeakMap;function r(o){Object.defineProperties(o.prototype,{popoverTargetElement:{enumerable:!0,configurable:!0,set(u){if(u===null)this.removeAttribute("popovertarget"),s.delete(this);else if(u instanceof Element)this.setAttribute("popovertarget",""),s.set(this,u);else throw new TypeError("popoverTargetElement must be an element or null")},get(){if(this.localName!=="button"&&this.localName!=="input"||this.localName==="input"&&this.type!=="reset"&&this.type!=="image"&&this.type!=="button"||this.disabled||this.form&&this.type==="submit")return null;let u=s.get(this);if(u&&u.isConnected)return u;if(u&&!u.isConnected)return s.delete(this),null;let d=me(this),c=this.getAttribute("popovertarget");return(d instanceof Document||d instanceof Qr)&&c&&d.getElementById(c)||null}},popoverTargetAction:{enumerable:!0,configurable:!0,get(){let u=(this.getAttribute("popovertargetaction")||"").toLowerCase();return u==="show"||u==="hide"?u:"toggle"},set(u){this.setAttribute("popovertargetaction",u)}}})}r(HTMLButtonElement),r(HTMLInputElement);let a=o=>{let u=o.composedPath(),d=u[0];if(!(d instanceof Element)||d?.shadowRoot)return;let c=me(d);if(!(c instanceof Qr||c instanceof Document))return;let f=u.find(m=>m.matches?.("[popovertargetaction],[popovertarget]"));if(f){Cn(f),o.preventDefault();return}},n=o=>{let u=o.key,d=o.target;!o.defaultPrevented&&d&&(u==="Escape"||u==="Esc")&&gi(d.ownerDocument,!0,!0)};(o=>{o.addEventListener("click",a),o.addEventListener("keydown",n),o.addEventListener("pointerdown",Zr),o.addEventListener("pointerup",Zr)})(document),ls(document)}var vi;function Ve(i){let t=i({css:(e,...s)=>`@layer base { ${e.raw[0]+s.join("")} }`});if(document.adoptedStyleSheets===void 0){let e=document.createElement("style");e.textContent=t,document.head.appendChild(e);return}vi===void 0&&(vi=new CSSStyleSheet,document.adoptedStyleSheets=[...document.adoptedStyleSheets,vi]),vi.insertRule(t)}function yi(i,t){let e=i;for(;e;){if(t(e))return e;e=e.parentElement}}function tt(i,t){let e=document.createTreeWalker(i,NodeFilter.SHOW_ELEMENT,t?{acceptNode:s=>{let r,a;return t(s,{skip:()=>r=!0,reject:()=>a=!0}),r?NodeFilter.FILTER_SKIP:a?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}}:{});return new cs(e)}var cs=class{constructor(t){this.walker=t}from(t){return this.walker.currentNode=t,this}first(){return this.walker.firstChild()}last(){return this.walker.lastChild()}next(t){return this.walker.currentNode=t,this.walker.nextSibling()}nextOrFirst(t){let e=this.next(t);return e||(this.walker.currentNode=this.walker.root,this.first())}prev(t){return this.walker.currentNode=t,this.walker.previousSibling()}prevOrLast(t){let e=this.prev(t);return e||(this.walker.currentNode=this.walker.root,this.last())}closest(t,e){let s=this.from(t).walker;for(;s.currentNode;){if(e(s.currentNode))return s.currentNode;s.parentNode()}}contains(t){return this.find(e=>e===t)}find(t){return this.walk((e,s)=>{t(e)&&s(e)})}findOrFirst(t){return this.find(t)||(this.walker.currentNode=this.walker.root),this.first()}each(t){this.walk(e=>t(e))}some(t){return!!this.find(t)}every(t){let e=!0;return this.walk(s=>{t(s)||(e=!1)}),e}map(t){let e=[];return this.walk(s=>e.push(t(s))),e}filter(t){let e=[];return this.walk(s=>t(s)&&e.push(s)),e}walk(t){let e,s=this.walker,r;for(;s.nextNode()&&(e=s.currentNode,t(e,a=>r=a),r===void 0););return r}};function T(i,t){customElements.define(`ui-${i}`,t)}function y(i,t,e,s={}){return i.addEventListener(t,e,s),{off:()=>i.removeEventListener(t,e),pause:r=>{i.removeEventListener(t,e),r(),i.addEventListener(t,e)}}}function oa(i){return["a[href]","area[href]","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","button:not([disabled])","iframe","object","embed","[tabindex]","[contenteditable]"].some(e=>i.matches(e))&&i.tabIndex>=0}function ds(i,t){let e;return function(){let s=this,r=arguments;e||(i.apply(s,r),e=!0,setTimeout(()=>e=!1,t))}}function fs(i,t){let e,s,r=t,a=!1,n={pause:()=>{a&&(clearTimeout(e),r-=Date.now()-s,a=!1)},resume:()=>{a||(s=Date.now(),e=setTimeout(i,r),a=!0)},cancel:()=>{clearTimeout(e),a=!1,r=t}};return n.resume(),n}var qe="pointer";document.addEventListener("keydown",()=>qe="keyboard",{capture:!0});document.addEventListener("pointerdown",i=>{qe=i.pointerType==="mouse"?"mouse":"touch"},{capture:!0});document.addEventListener("pointermove",i=>{qe=i.pointerType==="mouse"?"mouse":"touch"},{capture:!0});function ee(){return qe==="keyboard"}function wi(){return qe==="touch"}function xi(i,t){let e="",s=Un(()=>{e=""},300);i.addEventListener("keydown",r=>{r.key.length===1&&/[a-zA-Z]/.test(r.key)&&(e+=r.key,t(e),r.stopPropagation()),s()})}function Fn(i,t){return"lofi-"+(t?t+"-":"")+Math.random().toString(16).slice(2)}function K(i,t){let e=i.hasAttribute("id")?i.getAttribute("id"):Fn(i,t);return h(i,"id",e),i._x_bindings||(i._x_bindings={}),i._x_bindings.id||(i._x_bindings.id=e),e}function G(){let i=!1;return t=>(...e)=>{if(!i){i=!0;try{t(...e)}finally{i=!1}}}}function ye(i,t,{gain:e,lose:s,focusable:r,useSafeArea:a}){let n=!1,l=A=>{ee()&&(i.contains(A.target)||t.contains(A.target)?(n=!0,e()):(n=!1,s()))};r&&document.addEventListener("focusin",l);let o=()=>{document.removeEventListener("focusin",l)},u=()=>{},d=()=>{},c=()=>{n=!1,s(),u(),d()},f=()=>{n=!1,u(),d()},m=A=>{wi()||n||(n=!0,e(),setTimeout(()=>{let{safeArea:_,redraw:L,remove:O}=a?Vn(i,t,A.clientX,A.clientY):Hn();u=O;let E,b=ds(q=>{let S=t.getBoundingClientRect(),N=i.getBoundingClientRect(),F;switch(_.contains(q.target)&&qn(N,S,q.clientX,q.clientY)?F="safeArea":t.contains(q.target)?F="panel":i.contains(q.target)?F="trigger":F="outside",E&&clearTimeout(E),F){case"outside":c();break;case"trigger":L(q.clientX,q.clientY);break;case"panel":u();break;case"safeArea":L(q.clientX,q.clientY),E=setTimeout(()=>{c()},300);break;default:break}},100);document.addEventListener("pointermove",b),d=()=>document.removeEventListener("pointermove",b)}))};i.addEventListener("pointerenter",m);let p=()=>{i.removeEventListener("pointerenter",m)};return{clear:f,remove:()=>{f(),p(),o()}}}function Vn(i,t,e,s){let r=document.createElement("div"),a=t.getBoundingClientRect(),n=i.getBoundingClientRect();r.style.position="fixed",h(r,"data-safe-area","");let l=(o,u)=>{if(a.top===0&&a.bottom===0)return;let d;a.left<n.left&&(d="left"),a.right>n.right&&(d="right"),a.top<n.top&&a.bottom<u&&(d="up"),a.bottom>n.bottom&&a.top>u&&(d="down"),d===void 0&&(d="right");let c,f,m,p,w,A,_,L,O=10;switch(d){case"left":c=a.right,f=Math.max(a.right,o)+5,m=f-c,p=Math.min(n.top,a.top)-O,w=Math.max(n.bottom,a.bottom)+O,A=w-p,_=u-p,L=`polygon(0% 0%, 100% ${_}px, 0% 100%)`;break;case"right":c=Math.min(a.left,o)-5,f=a.left,m=f-c,p=Math.min(n.top,a.top)-O,w=Math.max(n.bottom,a.bottom)+O,A=w-p,_=u-p,L=`polygon(0% ${_}px, 100% 0%, 100% 100%)`;break;case"up":c=Math.min(o,a.left)-O,f=Math.max(o,a.right)+O,m=f-c,p=a.bottom,w=Math.max(a.bottom,u)+5,A=w-p,_=o-c,L=`polygon(0% 0%, 100% 0%, ${_}px 100%)`;break;case"down":c=Math.min(o,a.left)-O,f=Math.max(o,a.right)+O,m=f-c,p=Math.min(a.top,u)-5,w=a.top,A=w-p,_=o-c,L=`polygon(${_}px 0%, 100% 100%, 0% 100%)`;break}r.style.left=`${c}px`,r.style.top=`${p}px`,r.style.width=`${m}px`,r.style.height=`${A}px`,r.style.clipPath=L};return{safeArea:r,redraw:(o,u)=>{r.isConnected||i.appendChild(r),l(o,u)},remove:()=>{r.remove()}}}function qn(i,t,e,s){return!$n(i,e,s)&&!Bn(t,e,s)}function $n(i,t,e){return i.left<=t&&t<=i.right&&i.top<=e&&e<=i.bottom}function Bn(i,t,e){return i.left<=t&&t<=i.right&&i.top<=e&&e<=i.bottom}function h(i,t,e){i._durableAttributeObserver===void 0&&(i._durableAttributeObserver=la(i,[t])),i._durableAttributeObserver.hasAttribute(t)||i._durableAttributeObserver.addAttribute(t),i._durableAttributeObserver.pause(()=>{i.setAttribute(t,e)})}function dt(i,t){x(i,t),Wn(i,t)}function x(i,t){i._durableAttributeObserver===void 0&&(i._durableAttributeObserver=la(i,[t])),i._durableAttributeObserver.hasAttribute(t)||i._durableAttributeObserver.addAttribute(t),i._durableAttributeObserver.pause(()=>{i.removeAttribute(t)})}function Wn(i,t){i?._durableAttributeObserver?.hasAttribute(t)&&i._durableAttributeObserver.releaseAttribute(t)}function la(i,t){let e=r=>{r.forEach(a=>{a.oldValue===null?i._durableAttributeObserver.pause(()=>x(i,a.attributeName)):i._durableAttributeObserver.pause(()=>h(i,a.attributeName,a.oldValue))})},s=new MutationObserver(r=>e(r));return s.observe(i,{attributeFilter:t,attributeOldValue:!0}),{attributes:t,hasAttribute(r){return this.attributes.includes(r)},addAttribute(r){this.attributes.includes(r)||this.attributes.push(r),s.observe(i,{attributeFilter:this.attributes,attributeOldValue:!0})},releaseAttribute(r){this.hasAttribute(r)&&s.observe(i,{attributeFilter:this.attributes,attributeOldValue:!0})},pause(r){e(s.takeRecords()),s.disconnect(),r(),s.observe(i,{attributeFilter:this.attributes,attributeOldValue:!0})}}}function Hn(){return{safeArea:{contains:()=>!1},redraw:()=>{},remove:()=>{}}}function Un(i,t){let e;return(...s)=>{clearTimeout(e),e=setTimeout(()=>{i(...s)},t)}}var ge=0,ve=!1;Ve(({css:i})=>i`[data-flux-allow-scroll] { pointer-events: auto; }`);function ot(i=null,t=!1,e=[]){if(t)return{lock:()=>{},unlock:()=>{}};let s=(a=!1)=>{na(document.documentElement);let n={overflow:"hidden",...a?{pointerEvents:"none"}:{}};window.CSS&&CSS.supports&&CSS.supports("scrollbar-gutter: stable")?document.documentElement.scrollHeight>document.documentElement.clientHeight&&window.getComputedStyle(document.documentElement).overflowY!=="hidden"&&(n.scrollbarGutter="stable"):n.paddingRight=`calc(${window.innerWidth-document.documentElement.clientWidth}px + ${window.getComputedStyle(document.documentElement).paddingRight})`,Yn(document.documentElement,n),a&&(h(i,"data-flux-allow-scroll",""),e.forEach(l=>{h(l,"data-flux-allow-scroll","")}),ve=!0)},r=(a=!1)=>{na(document.documentElement),a&&(dt(i,"data-flux-allow-scroll"),e.forEach(n=>{x(n,"data-flux-allow-scroll")}),ve=!1)};return{lock(){ge++,!(ge>1&&i!==null&&ve)&&s(i!==null&&!ve)},unlock(){ge=Math.max(0,ge-1),!(ge>0&&i!==null&&!ve)&&(r(i!==null&&ve),ge>0&&s(!1))}}}function Yn(i,t){let e=JSON.parse(i.getAttribute("data-flux-scroll-unlock")||"{}");Object.entries(t).forEach(([s,r])=>{e[s]===void 0&&(e[s]=i.style[s],i.style[s]=r)}),i.setAttribute("data-flux-scroll-unlock",JSON.stringify(e))}function na(i){let t=JSON.parse(i.getAttribute("data-flux-scroll-unlock")||"{}");Object.entries(t).forEach(([e,s])=>{i.style[e]=s}),i.removeAttribute("data-flux-scroll-unlock")}function ps(i,t,e){let s=i.style[t];return i.style[t]=e,()=>{i.style[t]=s}}function we(i,t,e){let s=(n,l)=>o=>{o.key===n&&!t()&&(l(),o.preventDefault(),o.stopPropagation())};h(i,"role","button");let r=()=>{i.hasAttribute("disabled")?(h(i,"aria-disabled","true"),h(i,"tabindex","-1")):(x(i,"aria-disabled"),h(i,"tabindex","0"))};new MutationObserver(()=>r()).observe(i,{attributes:!0,attributeFilter:["disabled"]}),r(),y(i,"click",()=>e()),y(i,"keydown",s("Enter",()=>e())),y(i,"keydown",s(" ",()=>{})),y(i,"keyup",s(" ",()=>e()))}function ua(i,t,e=null){let s=()=>{let n=i.getAttribute(t),l={sm:640,md:768,lg:1024,xl:1280,"2xl":1536};for(let[o,u]of Object.entries(l).reverse()){let d=i.getAttribute(`${o}:${t}`);if(d&&window.innerWidth>=u)return d}return n||e},r=s(),a=[];return new ResizeObserver(()=>{let n=s(),l=JSON.stringify(r);JSON.stringify(n)!==l&&(r=n,a.forEach(o=>o(n)))}).observe(window.document.documentElement),[r,n=>a.push(n)]}function Ai(){return navigator?.language||document.documentElement.lang||"en-US"}function Si(i,t={slots:{},attrs:{}}){let{slots:e={},attrs:s={}}=t,r=i.content.cloneNode(!0).firstElementChild;return Object.entries(e).forEach(([a,n])=>{(a==="default"?r.querySelectorAll("slot:not([name])"):r.querySelectorAll(`slot[name="${a}"]`)).forEach(o=>o.replaceWith(typeof n=="string"?document.createTextNode(n):n))}),r.querySelectorAll("slot").forEach(a=>a.remove()),Object.entries(s).forEach(([a,n])=>{r.setAttribute(a,n)}),r.setAttribute("data-appended",""),r}function bt(i){return getComputedStyle(i).direction==="rtl"}function ha(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)&&!navigator.userAgent.includes("CriOS")&&!navigator.userAgent.includes("FxiOS")}function ca(){return/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream}var Wt=class{constructor(){this.subscribers=[]}subscribe(t,e){this.subscribers.push({reason:t,callback:e})}notify(t,e){this.subscribers.forEach(({reason:s,callback:r})=>{t===s&&r(e)})}};var I=class extends HTMLElement{wasDisconnected=!1;constructor(){super(),this.boot?.()}connectedCallback(){if(this.wasDisconnected){this.wasDisconnected=!1;return}queueMicrotask(()=>{this.mount?.()})}disconnectedCallback(){this.wasDisconnected=!0,queueMicrotask(()=>{this.wasDisconnected&&this.unmount?.(),this.wasDisconnected=!1})}mixin(t,e={}){return new t(this,e)}appendMixin(t,e={}){return new t(this,e)}use(t){let e;return this.mixins.forEach(s=>{s instanceof t&&(e=s)}),e}uses(t){let e;return this.mixins.forEach(s=>{s instanceof t&&(e=!0)}),!!e}on(t,e){return y(this,t,e)}root(t,e={}){if(t===void 0)return this.__root;let s=document.createElement(t);for(let a in e)setAttribute(s,a,e[a]);let r=this.attachShadow({mode:"open"});return s.appendChild(document.createElement("slot")),r.appendChild(s),this.__root=s,this.__root}},Z=class extends I{};var X=class{constructor(t,e={}){this.el=t,this.grouped=e.grouped===void 0,this.el.mixins=this.el.mixins?this.el.mixins:new Map,this.el.mixins.set(this.constructor.name,this),this.el[this.constructor.name]=!0,this.el.use||(this.el.use=I.prototype.use.bind(this.el)),this.opts=e,this.boot?.({options:s=>{let r=s;Object.entries(this.opts).forEach(([a,n])=>{n!==void 0&&(r[a]=n)}),this.opts=r}}),queueMicrotask(()=>{this.mount?.()})}options(){return this.opts}hasGroup(){return!!this.group()}group(){if(this.grouped!==!1)return yi(this.el,t=>t[this.groupedByType.name])?.use(this.groupedByType)}on(t,e){return y(this.el,t,e)}},kt=class extends X{constructor(t,e={}){super(t,e)}walker(){return tt(this.el,(t,{skip:e,reject:s})=>{if(t[this.constructor.name]&&t!==this.el)return s();if(!t[this.groupOfType.name]||!t.mixins.get(this.groupOfType.name).grouped)return e()})}};var U=class extends X{boot({options:t}){t({bubbles:!1}),this.initialState=this.el.value,this.getterFunc=()=>{},this.setterFunc=e=>this.initialState=e,Object.defineProperty(this.el,"value",{get:()=>this.getterFunc(),set:e=>{this.setterFunc(e)}})}initial(t){t(this.initialState)}getter(t){this.getterFunc=t}setter(t){this.setterFunc=t}dispatch(){this.el.dispatchEvent(new Event("input",{bubbles:this.options().bubbles,cancelable:!0})),this.el.dispatchEvent(new Event("change",{bubbles:this.options().bubbles,cancelable:!0}))}};var $e=null;document.addEventListener("mousedown",i=>$e=i);var xe=class extends X{boot({options:t}){t({clickOutside:!0,triggers:[]}),this.onChanges=[],this.state=!1,this.stopDialogFromFocusingTheFirstElement();let e=this.options().triggers;new MutationObserver(r=>{r.forEach(a=>{a.attributeName==="open"&&(this.el.hasAttribute("open")?this.state=!0:this.state=!1)}),this.onChanges.forEach(a=>a())}).observe(this.el,{attributeFilter:["open"]}),this.options().clickOutside&&this.el.addEventListener("click",r=>{if(r.target!==this.el){$e=null;return}$e&&da(this.el,$e)&&da(this.el,r)&&(this.cancel(),r.preventDefault(),r.stopPropagation()),$e=null}),this.el.hasAttribute("open")&&(this.state=!0,this.hide(),this.show())}onChange(t){this.onChanges.push(t)}show(){this.el.isConnected&&this.el.showModal()}hide(){this.el.close()}toggle(){this.state?this.hide():this.show()}cancel(){let t=new Event("cancel",{bubbles:!1,cancelable:!0});this.el.dispatchEvent(t),t.defaultPrevented||this.hide()}getState(){return this.state}setState(t){t?this.show():this.hide()}stopDialogFromFocusingTheFirstElement(){let t=document.createElement("div");t.setAttribute("data-flux-focus-placeholder",""),t.setAttribute("data-appended",""),t.setAttribute("tabindex","0"),this.el.prepend(t),this.onChange(()=>{h(t,"style",this.state?"display: none":"display: block"),this.state&&ha()&&!this.el.hasAttribute("autofocus")&&this.el.querySelectorAll("[autofocus]").length===0&&setTimeout(()=>{this.el.setAttribute("tabindex","-1"),this.el.focus(),this.el.blur()})})}};function da(i,t){let e=i.getBoundingClientRect(),s=t.clientX,r=t.clientY;return!(s>=e.left&&s<=e.right&&r>=e.top&&r<=e.bottom)}var Lt=class extends X{boot(){this.onCloses=[]}onClose(t){this.onCloses.push(t)}close(){this.onCloses.forEach(t=>t())}};var bs=class extends I{boot(){this.querySelectorAll("[data-appended]").forEach(l=>l.remove()),this._controllable=new U(this,{disabled:this.hasAttribute("disabled")});let t=this.button(),e=this.dialog();if(!e)return;e._dialogable=new xe(e,{clickOutside:!this.hasAttribute("disable-click-outside")}),e._closeable=new Lt(e),e._closeable.onClose(()=>e._dialogable.hide()),this._controllable.initial(l=>l&&e._dialogable.show()),this._controllable.getter(()=>e._dialogable.getState());let s=G();this._controllable.setter(s(l=>{e._dialogable.setState(l)})),e._dialogable.onChange(s(()=>{this._controllable.dispatch()}));let r=()=>{e._dialogable.getState()?(h(this,"data-open",""),t?.setAttribute("data-open",""),h(e,"data-open","")):(x(this,"data-open"),t?.removeAttribute("data-open"),x(e,"data-open"))};e._dialogable.onChange(()=>r()),r();let{lock:a,unlock:n}=ot();e._dialogable.onChange(()=>{e._dialogable.getState()?a():n()}),t&&y(t,"click",l=>{e._dialogable.show()})}unmount(){if(this.dialog()?._dialogable?.getState()){let{unlock:t}=ot();t()}}button(){let t=this.querySelector("button,ui-button");if(!this.dialog()?.contains(t))return t}dialog(){return this.querySelector("dialog")}showModal(){let t=this.dialog();t&&t.showModal()}};Ve(({css:i})=>i`dialog, ::backdrop { margin: auto; }`);T("modal",bs);var Mt=class extends kt{groupOfType=et;boot({options:t}){t({wrap:!1,filter:!1}),this.onChanges=[]}onChange(t){this.onChanges.push(t)}activated(t){this.onChanges.forEach(e=>e())}activateFirst(){this.filterAwareWalker().first()?.use(et).activate()}activateBySearch(t){this.filterAwareWalker().find(s=>s.textContent.toLowerCase().trim().startsWith(t.toLowerCase()))?.use(et).activate()}activateSelectedOrFirst(t){if(!t||(s=>s.matches("ui-option, ui-option-create")?getComputedStyle(s).display==="none":!1)(t)){this.filterAwareWalker().first()?.use(et).activate();return}t?.use(et).activate()}activateActiveOrFirst(){let t=this.getActive();if(!t){this.filterAwareWalker().first()?.use(et).activate();return}t?.use(et).activate()}activateActiveOrLast(){let t=this.getActive();if(!t){this.filterAwareWalker().last()?.use(et).activate();return}t?.use(et).activate()}activatePrev(){let t=this.getActive();if(!t){this.filterAwareWalker().last()?.use(et).activate();return}let e;this.options.wrap?e=this.filterAwareWalker().prevOrLast(t):e=this.filterAwareWalker().prev(t),e?.use(et).activate()}activateNext(){let t=this.getActive();if(!t){this.filterAwareWalker().first()?.use(et).activate();return}let e;this.options.wrap?e=this.filterAwareWalker().nextOrFirst(t):e=this.filterAwareWalker().next(t),e?.use(et).activate()}getActive(){return this.walker().find(t=>t.use(et).isActive())}clearActive(){this.getActive()?.use(et).deactivate()}filterAwareWalker(){let t=e=>e.matches("ui-option, ui-option-create")?getComputedStyle(e).display==="none":!1;return tt(this.el,(e,{skip:s,reject:r})=>{if(e[this.constructor.name]&&e!==this.el)return r();if(!e[this.groupOfType.name])return s();if(e.hasAttribute("disabled")||t(e))return r()})}},et=class i extends X{groupedByType=Mt;mount(){this.el.addEventListener("mouseenter",()=>{this.activate()}),this.el.addEventListener("mouseleave",()=>{this.deactivate()})}activate(t=!1){this.group()&&this.group().walker().each(e=>e.use(i).deactivate(!1)),!(this.el.hasAttribute("disabled")&&!t)&&(h(this.el,"data-active",""),ee()&&this.el.scrollIntoView({block:"nearest"}),this.group()&&this.group().activated(this.el))}deactivate(t=!0){x(this.el,"data-active"),t&&this.group()&&this.group().activated(this.el)}isActive(){return this.el.hasAttribute("data-active")}};var ie=class extends kt{groupOfType=Ct;boot({options:t}){t({}),this.onChanges=[],this.lastSearch=""}onChange(t){this.onChanges.push(t)}filter(t){t===""?this.walker().each(e=>{e.use(Ct).unfilter()}):this.walker().each(e=>{this.matches(e,t)?e.use(Ct).unfilter():e.use(Ct).filter()}),this.lastSearch!==t&&this.onChanges.forEach(e=>e()),this.lastSearch=t}matches(t,e){return this.normalize(t.textContent).includes(this.normalize(e))}normalize(t){return t.normalize("NFD").replace(/\p{Diacritic}/gu,"").toLowerCase().trim()}hasResults(){return this.walker().some(t=>!t.use(Ct).isFiltered())}},Ct=class extends X{groupedByType=ie;boot({options:t}){t({mirror:null,keep:!1}),this.onChanges=[]}filter(){this.options().keep||(h(this.el,"data-hidden",""),this.options().mirror&&h(this.options().mirror,"data-hidden",""))}unfilter(){this.options().keep||(x(this.el,"data-hidden"),this.options().mirror&&x(this.options().mirror,"data-hidden",""))}isFiltered(){return this.el.hasAttribute("data-hidden")}};var Pt=new Map,rt=class extends X{boot({options:t}){t({triggers:[],scope:null});let e=this.options().scope||"global";h(this.el,"popover","manual"),this.triggers=this.options().triggers,this.onChanges=[],this.state=!1,y(this.el,"beforetoggle",s=>{let r=this.state;if(this.state=s.newState==="open",this.state){zn(this.el,e);let a=new AbortController,n=document.activeElement,l=[...this.triggers,n];setTimeout(()=>{Gn(this.el,l,a),Kn(this.el,l,a),Xn(this.el,l,a)}),this.el.addEventListener("beforetoggle",o=>{o.newState==="closed"&&(a.abort(),n?.focus())},{signal:a.signal})}r!==this.state&&this.onChanges.forEach(a=>a(this.state,r))}),y(this.el,"toggle",s=>{if(s.newState==="open")Pt.has(e)||Pt.set(e,new Set),Pt.get(e).add(this.el);else if(s.newState==="closed"){if(!Pt.has(e))return;Pt.get(e).delete(this.el),Pt.get(e).size===0&&Pt.delete(e)}})}onChange(t){this.onChanges.push(t)}setState(t){t?this.show():this.hide()}getState(){return this.state}toggle(){this.el.isConnected&&this.el.togglePopover()}show(){this.el.isConnected&&this.el.showPopover()}hide(){this.el.isConnected&&this.el.hidePopover()}};function zn(i,t){Pt.has(t)&&Pt.get(t).forEach(e=>{i.contains(e)||e.contains(i)||e.hidePopover()})}function Gn(i,t,e){document.addEventListener("click",s=>{i.contains(s.target)||t.includes(s.target)||i.hidePopover()},{signal:e.signal})}function Kn(i,t,e){document.addEventListener("focusin",s=>{i.contains(s.target)||t.includes(s.target)||(e.abort(),i.hidePopover())},{capture:!0,signal:e.signal})}function Xn(i,t,e){document.addEventListener("keydown",s=>{s.key==="Escape"&&i.hidePopover()},{signal:e.signal})}var V=class extends X{boot({options:t}){t({disableWithParent:!0}),this.onChanges=[],Object.defineProperty(this.el,"disabled",{get:()=>this.el.hasAttribute("disabled"),set:s=>{s?this.el.setAttribute("disabled",""):this.el.removeAttribute("disabled")}}),this.el.hasAttribute("disabled")?this.el.disabled=!0:this.options().disableWithParent&&this.el.parentElement?.closest("[disabled]")&&(this.el.disabled=!0),new MutationObserver(s=>{this.onChanges.forEach(r=>r(this.el.disabled))}).observe(this.el,{attributeFilter:["disabled"]})}onChange(t){this.onChanges.push(t)}onInitAndChange(t){t(this.el.disabled),this.onChanges.push(t)}enabled(t){return(...e)=>{if(!this.el.disabled)return t(...e)}}disabled(t){return(...e)=>{if(this.el.disabled)return t(...e)}}isDisabled(){return this.el.disabled}};var Ht=Math.min,ft=Math.max,We=Math.round,He=Math.floor,vt=i=>({x:i,y:i}),jn={left:"right",right:"left",bottom:"top",top:"bottom"},Jn={start:"end",end:"start"};function ms(i,t,e){return ft(i,Ht(t,e))}function Ae(i,t){return typeof i=="function"?i(t):i}function Ot(i){return i.split("-")[0]}function Se(i){return i.split("-")[1]}function gs(i){return i==="x"?"y":"x"}function vs(i){return i==="y"?"height":"width"}function Ut(i){return["top","bottom"].includes(Ot(i))?"y":"x"}function ys(i){return gs(Ut(i))}function fa(i,t,e){e===void 0&&(e=!1);let s=Se(i),r=ys(i),a=vs(r),n=r==="x"?s===(e?"end":"start")?"right":"left":s==="start"?"bottom":"top";return t.reference[a]>t.floating[a]&&(n=Be(n)),[n,Be(n)]}function pa(i){let t=Be(i);return[Ei(i),t,Ei(t)]}function Ei(i){return i.replace(/start|end/g,t=>Jn[t])}function Zn(i,t,e){let s=["left","right"],r=["right","left"],a=["top","bottom"],n=["bottom","top"];switch(i){case"top":case"bottom":return e?t?r:s:t?s:r;case"left":case"right":return t?a:n;default:return[]}}function ba(i,t,e,s){let r=Se(i),a=Zn(Ot(i),e==="start",s);return r&&(a=a.map(n=>n+"-"+r),t&&(a=a.concat(a.map(Ei)))),a}function Be(i){return i.replace(/left|right|bottom|top/g,t=>jn[t])}function Qn(i){return{top:0,right:0,bottom:0,left:0,...i}}function ma(i){return typeof i!="number"?Qn(i):{top:i,right:i,bottom:i,left:i}}function se(i){let{x:t,y:e,width:s,height:r}=i;return{width:s,height:r,top:e,left:t,right:t+s,bottom:e+r,x:t,y:e}}function ga(i,t,e){let{reference:s,floating:r}=i,a=Ut(t),n=ys(t),l=vs(n),o=Ot(t),u=a==="y",d=s.x+s.width/2-r.width/2,c=s.y+s.height/2-r.height/2,f=s[l]/2-r[l]/2,m;switch(o){case"top":m={x:d,y:s.y-r.height};break;case"bottom":m={x:d,y:s.y+s.height};break;case"right":m={x:s.x+s.width,y:c};break;case"left":m={x:s.x-r.width,y:c};break;default:m={x:s.x,y:s.y}}switch(Se(t)){case"start":m[n]-=f*(e&&u?-1:1);break;case"end":m[n]+=f*(e&&u?-1:1);break}return m}var va=async(i,t,e)=>{let{placement:s="bottom",strategy:r="absolute",middleware:a=[],platform:n}=e,l=a.filter(Boolean),o=await(n.isRTL==null?void 0:n.isRTL(t)),u=await n.getElementRects({reference:i,floating:t,strategy:r}),{x:d,y:c}=ga(u,s,o),f=s,m={},p=0;for(let w=0;w<l.length;w++){let{name:A,fn:_}=l[w],{x:L,y:O,data:E,reset:b}=await _({x:d,y:c,initialPlacement:s,placement:f,strategy:r,middlewareData:m,rects:u,platform:n,elements:{reference:i,floating:t}});d=L??d,c=O??c,m={...m,[A]:{...m[A],...E}},b&&p<=50&&(p++,typeof b=="object"&&(b.placement&&(f=b.placement),b.rects&&(u=b.rects===!0?await n.getElementRects({reference:i,floating:t,strategy:r}):b.rects),{x:d,y:c}=ga(u,f,o)),w=-1)}return{x:d,y:c,placement:f,strategy:r,middlewareData:m}};async function _i(i,t){var e;t===void 0&&(t={});let{x:s,y:r,platform:a,rects:n,elements:l,strategy:o}=i,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:c="floating",altBoundary:f=!1,padding:m=0}=Ae(t,i),p=ma(m),A=l[f?c==="floating"?"reference":"floating":c],_=se(await a.getClippingRect({element:(e=await(a.isElement==null?void 0:a.isElement(A)))==null||e?A:A.contextElement||await(a.getDocumentElement==null?void 0:a.getDocumentElement(l.floating)),boundary:u,rootBoundary:d,strategy:o})),L=c==="floating"?{x:s,y:r,width:n.floating.width,height:n.floating.height}:n.reference,O=await(a.getOffsetParent==null?void 0:a.getOffsetParent(l.floating)),E=await(a.isElement==null?void 0:a.isElement(O))?await(a.getScale==null?void 0:a.getScale(O))||{x:1,y:1}:{x:1,y:1},b=se(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:L,offsetParent:O,strategy:o}):L);return{top:(_.top-b.top+p.top)/E.y,bottom:(b.bottom-_.bottom+p.bottom)/E.y,left:(_.left-b.left+p.left)/E.x,right:(b.right-_.right+p.right)/E.x}}var ya=function(i){return i===void 0&&(i={}),{name:"flip",options:i,async fn(t){var e,s;let{placement:r,middlewareData:a,rects:n,initialPlacement:l,platform:o,elements:u}=t,{mainAxis:d=!0,crossAxis:c=!0,fallbackPlacements:f,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:w=!0,...A}=Ae(i,t);if((e=a.arrow)!=null&&e.alignmentOffset)return{};let _=Ot(r),L=Ut(l),O=Ot(l)===l,E=await(o.isRTL==null?void 0:o.isRTL(u.floating)),b=f||(O||!w?[Be(l)]:pa(l)),q=p!=="none";!f&&q&&b.push(...ba(l,w,p,E));let S=[l,...b],N=await _i(t,A),F=[],v=((s=a.flip)==null?void 0:s.overflows)||[];if(d&&F.push(N[_]),c){let D=fa(r,n,E);F.push(N[D[0]],N[D[1]])}if(v=[...v,{placement:r,overflows:F}],!F.every(D=>D<=0)){var M,k;let D=(((M=a.flip)==null?void 0:M.index)||0)+1,P=S[D];if(P)return{data:{index:D,overflows:v},reset:{placement:P}};let $=(k=v.filter(W=>W.overflows[0]<=0).sort((W,R)=>W.overflows[1]-R.overflows[1])[0])==null?void 0:k.placement;if(!$)switch(m){case"bestFit":{var C;let W=(C=v.filter(R=>{if(q){let H=Ut(R.placement);return H===L||H==="y"}return!0}).map(R=>[R.placement,R.overflows.filter(H=>H>0).reduce((H,z)=>H+z,0)]).sort((R,H)=>R[1]-H[1])[0])==null?void 0:C[0];W&&($=W);break}case"initialPlacement":$=l;break}if(r!==$)return{reset:{placement:$}}}return{}}}};async function to(i,t){let{placement:e,platform:s,elements:r}=i,a=await(s.isRTL==null?void 0:s.isRTL(r.floating)),n=Ot(e),l=Se(e),o=Ut(e)==="y",u=["left","top"].includes(n)?-1:1,d=a&&o?-1:1,c=Ae(t,i),{mainAxis:f,crossAxis:m,alignmentAxis:p}=typeof c=="number"?{mainAxis:c,crossAxis:0,alignmentAxis:null}:{mainAxis:c.mainAxis||0,crossAxis:c.crossAxis||0,alignmentAxis:c.alignmentAxis};return l&&typeof p=="number"&&(m=l==="end"?p*-1:p),o?{x:m*d,y:f*u}:{x:f*u,y:m*d}}var wa=function(i){return i===void 0&&(i=0),{name:"offset",options:i,async fn(t){var e,s;let{x:r,y:a,placement:n,middlewareData:l}=t,o=await to(t,i);return n===((e=l.offset)==null?void 0:e.placement)&&(s=l.arrow)!=null&&s.alignmentOffset?{}:{x:r+o.x,y:a+o.y,data:{...o,placement:n}}}}},xa=function(i){return i===void 0&&(i={}),{name:"shift",options:i,async fn(t){let{x:e,y:s,placement:r}=t,{mainAxis:a=!0,crossAxis:n=!1,limiter:l={fn:A=>{let{x:_,y:L}=A;return{x:_,y:L}}},...o}=Ae(i,t),u={x:e,y:s},d=await _i(t,o),c=Ut(Ot(r)),f=gs(c),m=u[f],p=u[c];if(a){let A=f==="y"?"top":"left",_=f==="y"?"bottom":"right",L=m+d[A],O=m-d[_];m=ms(L,m,O)}if(n){let A=c==="y"?"top":"left",_=c==="y"?"bottom":"right",L=p+d[A],O=p-d[_];p=ms(L,p,O)}let w=l.fn({...t,[f]:m,[c]:p});return{...w,data:{x:w.x-e,y:w.y-s,enabled:{[f]:a,[c]:n}}}}}};var Aa=function(i){return i===void 0&&(i={}),{name:"size",options:i,async fn(t){var e,s;let{placement:r,rects:a,platform:n,elements:l}=t,{apply:o=()=>{},...u}=Ae(i,t),d=await _i(t,u),c=Ot(r),f=Se(r),m=Ut(r)==="y",{width:p,height:w}=a.floating,A,_;c==="top"||c==="bottom"?(A=c,_=f===(await(n.isRTL==null?void 0:n.isRTL(l.floating))?"start":"end")?"left":"right"):(_=c,A=f==="end"?"top":"bottom");let L=w-d.top-d.bottom,O=p-d.left-d.right,E=Ht(w-d[A],L),b=Ht(p-d[_],O),q=!t.middlewareData.shift,S=E,N=b;if((e=t.middlewareData.shift)!=null&&e.enabled.x&&(N=O),(s=t.middlewareData.shift)!=null&&s.enabled.y&&(S=L),q&&!f){let v=ft(d.left,0),M=ft(d.right,0),k=ft(d.top,0),C=ft(d.bottom,0);m?N=p-2*(v!==0||M!==0?v+M:ft(d.left,d.right)):S=w-2*(k!==0||C!==0?k+C:ft(d.top,d.bottom))}await o({...t,availableWidth:N,availableHeight:S});let F=await n.getDimensions(l.floating);return p!==F.width||w!==F.height?{reset:{rects:!0}}:{}}}};function ki(){return typeof window<"u"}function re(i){return Ea(i)?(i.nodeName||"").toLowerCase():"#document"}function pt(i){var t;return(i==null||(t=i.ownerDocument)==null?void 0:t.defaultView)||window}function yt(i){var t;return(t=(Ea(i)?i.ownerDocument:i.document)||window.document)==null?void 0:t.documentElement}function Ea(i){return ki()?i instanceof Node||i instanceof pt(i).Node:!1}function mt(i){return ki()?i instanceof Element||i instanceof pt(i).Element:!1}function wt(i){return ki()?i instanceof HTMLElement||i instanceof pt(i).HTMLElement:!1}function Sa(i){return!ki()||typeof ShadowRoot>"u"?!1:i instanceof ShadowRoot||i instanceof pt(i).ShadowRoot}function _e(i){let{overflow:t,overflowX:e,overflowY:s,display:r}=gt(i);return/auto|scroll|overlay|hidden|clip/.test(t+s+e)&&!["inline","contents"].includes(r)}function _a(i){return["table","td","th"].includes(re(i))}function Ue(i){return[":popover-open",":modal"].some(t=>{try{return i.matches(t)}catch{return!1}})}function Ci(i){let t=Ti(),e=mt(i)?gt(i):i;return["transform","translate","scale","rotate","perspective"].some(s=>e[s]?e[s]!=="none":!1)||(e.containerType?e.containerType!=="normal":!1)||!t&&(e.backdropFilter?e.backdropFilter!=="none":!1)||!t&&(e.filter?e.filter!=="none":!1)||["transform","translate","scale","rotate","perspective","filter"].some(s=>(e.willChange||"").includes(s))||["paint","layout","strict","content"].some(s=>(e.contain||"").includes(s))}function ka(i){let t=Nt(i);for(;wt(t)&&!ae(t);){if(Ci(t))return t;if(Ue(t))return null;t=Nt(t)}return null}function Ti(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function ae(i){return["html","body","#document"].includes(re(i))}function gt(i){return pt(i).getComputedStyle(i)}function Ye(i){return mt(i)?{scrollLeft:i.scrollLeft,scrollTop:i.scrollTop}:{scrollLeft:i.scrollX,scrollTop:i.scrollY}}function Nt(i){if(re(i)==="html")return i;let t=i.assignedSlot||i.parentNode||Sa(i)&&i.host||yt(i);return Sa(t)?t.host:t}function Ca(i){let t=Nt(i);return ae(t)?i.ownerDocument?i.ownerDocument.body:i.body:wt(t)&&_e(t)?t:Ca(t)}function Ee(i,t,e){var s;t===void 0&&(t=[]),e===void 0&&(e=!0);let r=Ca(i),a=r===((s=i.ownerDocument)==null?void 0:s.body),n=pt(r);if(a){let l=Di(n);return t.concat(n,n.visualViewport||[],_e(r)?r:[],l&&e?Ee(l):[])}return t.concat(r,Ee(r,[],e))}function Di(i){return i.parent&&Object.getPrototypeOf(i.parent)?i.frameElement:null}function Ia(i){let t=gt(i),e=parseFloat(t.width)||0,s=parseFloat(t.height)||0,r=wt(i),a=r?i.offsetWidth:e,n=r?i.offsetHeight:s,l=We(e)!==a||We(s)!==n;return l&&(e=a,s=n),{width:e,height:s,$:l}}function xs(i){return mt(i)?i:i.contextElement}function ke(i){let t=xs(i);if(!wt(t))return vt(1);let e=t.getBoundingClientRect(),{width:s,height:r,$:a}=Ia(t),n=(a?We(e.width):e.width)/s,l=(a?We(e.height):e.height)/r;return(!n||!Number.isFinite(n))&&(n=1),(!l||!Number.isFinite(l))&&(l=1),{x:n,y:l}}var eo=vt(0);function La(i){let t=pt(i);return!Ti()||!t.visualViewport?eo:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function io(i,t,e){return t===void 0&&(t=!1),!e||t&&e!==pt(i)?!1:t}function ne(i,t,e,s){t===void 0&&(t=!1),e===void 0&&(e=!1);let r=i.getBoundingClientRect(),a=xs(i),n=vt(1);t&&(s?mt(s)&&(n=ke(s)):n=ke(i));let l=io(a,e,s)?La(a):vt(0),o=(r.left+l.x)/n.x,u=(r.top+l.y)/n.y,d=r.width/n.x,c=r.height/n.y;if(a){let f=pt(a),m=s&&mt(s)?pt(s):s,p=f,w=Di(p);for(;w&&s&&m!==p;){let A=ke(w),_=w.getBoundingClientRect(),L=gt(w),O=_.left+(w.clientLeft+parseFloat(L.paddingLeft))*A.x,E=_.top+(w.clientTop+parseFloat(L.paddingTop))*A.y;o*=A.x,u*=A.y,d*=A.x,c*=A.y,o+=O,u+=E,p=pt(w),w=Di(p)}}return se({width:d,height:c,x:o,y:u})}function As(i,t){let e=Ye(i).scrollLeft;return t?t.left+e:ne(yt(i)).left+e}function Ma(i,t,e){e===void 0&&(e=!1);let s=i.getBoundingClientRect(),r=s.left+t.scrollLeft-(e?0:As(i,s)),a=s.top+t.scrollTop;return{x:r,y:a}}function so(i){let{elements:t,rect:e,offsetParent:s,strategy:r}=i,a=r==="fixed",n=yt(s),l=t?Ue(t.floating):!1;if(s===n||l&&a)return e;let o={scrollLeft:0,scrollTop:0},u=vt(1),d=vt(0),c=wt(s);if((c||!c&&!a)&&((re(s)!=="body"||_e(n))&&(o=Ye(s)),wt(s))){let m=ne(s);u=ke(s),d.x=m.x+s.clientLeft,d.y=m.y+s.clientTop}let f=n&&!c&&!a?Ma(n,o,!0):vt(0);return{width:e.width*u.x,height:e.height*u.y,x:e.x*u.x-o.scrollLeft*u.x+d.x+f.x,y:e.y*u.y-o.scrollTop*u.y+d.y+f.y}}function ro(i){return Array.from(i.getClientRects())}function ao(i){let t=yt(i),e=Ye(i),s=i.ownerDocument.body,r=ft(t.scrollWidth,t.clientWidth,s.scrollWidth,s.clientWidth),a=ft(t.scrollHeight,t.clientHeight,s.scrollHeight,s.clientHeight),n=-e.scrollLeft+As(i),l=-e.scrollTop;return gt(s).direction==="rtl"&&(n+=ft(t.clientWidth,s.clientWidth)-r),{width:r,height:a,x:n,y:l}}function no(i,t){let e=pt(i),s=yt(i),r=e.visualViewport,a=s.clientWidth,n=s.clientHeight,l=0,o=0;if(r){a=r.width,n=r.height;let u=Ti();(!u||u&&t==="fixed")&&(l=r.offsetLeft,o=r.offsetTop)}return{width:a,height:n,x:l,y:o}}function oo(i,t){let e=ne(i,!0,t==="fixed"),s=e.top+i.clientTop,r=e.left+i.clientLeft,a=wt(i)?ke(i):vt(1),n=i.clientWidth*a.x,l=i.clientHeight*a.y,o=r*a.x,u=s*a.y;return{width:n,height:l,x:o,y:u}}function Ta(i,t,e){let s;if(t==="viewport")s=no(i,e);else if(t==="document")s=ao(yt(i));else if(mt(t))s=oo(t,e);else{let r=La(i);s={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return se(s)}function Pa(i,t){let e=Nt(i);return e===t||!mt(e)||ae(e)?!1:gt(e).position==="fixed"||Pa(e,t)}function lo(i,t){let e=t.get(i);if(e)return e;let s=Ee(i,[],!1).filter(l=>mt(l)&&re(l)!=="body"),r=null,a=gt(i).position==="fixed",n=a?Nt(i):i;for(;mt(n)&&!ae(n);){let l=gt(n),o=Ci(n);!o&&l.position==="fixed"&&(r=null),(a?!o&&!r:!o&&l.position==="static"&&!!r&&["absolute","fixed"].includes(r.position)||_e(n)&&!o&&Pa(i,n))?s=s.filter(d=>d!==n):r=l,n=Nt(n)}return t.set(i,s),s}function uo(i){let{element:t,boundary:e,rootBoundary:s,strategy:r}=i,n=[...e==="clippingAncestors"?Ue(t)?[]:lo(t,this._c):[].concat(e),s],l=n[0],o=n.reduce((u,d)=>{let c=Ta(t,d,r);return u.top=ft(c.top,u.top),u.right=Ht(c.right,u.right),u.bottom=Ht(c.bottom,u.bottom),u.left=ft(c.left,u.left),u},Ta(t,l,r));return{width:o.right-o.left,height:o.bottom-o.top,x:o.left,y:o.top}}function ho(i){let{width:t,height:e}=Ia(i);return{width:t,height:e}}function co(i,t,e){let s=wt(t),r=yt(t),a=e==="fixed",n=ne(i,!0,a,t),l={scrollLeft:0,scrollTop:0},o=vt(0);if(s||!s&&!a)if((re(t)!=="body"||_e(r))&&(l=Ye(t)),s){let f=ne(t,!0,a,t);o.x=f.x+t.clientLeft,o.y=f.y+t.clientTop}else r&&(o.x=As(r));let u=r&&!s&&!a?Ma(r,l):vt(0),d=n.left+l.scrollLeft-o.x-u.x,c=n.top+l.scrollTop-o.y-u.y;return{x:d,y:c,width:n.width,height:n.height}}function ws(i){return gt(i).position==="static"}function Da(i,t){if(!wt(i)||gt(i).position==="fixed")return null;if(t)return t(i);let e=i.offsetParent;return yt(i)===e&&(e=e.ownerDocument.body),e}function Oa(i,t){let e=pt(i);if(Ue(i))return e;if(!wt(i)){let r=Nt(i);for(;r&&!ae(r);){if(mt(r)&&!ws(r))return r;r=Nt(r)}return e}let s=Da(i,t);for(;s&&_a(s)&&ws(s);)s=Da(s,t);return s&&ae(s)&&ws(s)&&!Ci(s)?e:s||ka(i)||e}var fo=async function(i){let t=this.getOffsetParent||Oa,e=this.getDimensions,s=await e(i.floating);return{reference:co(i.reference,await t(i.floating),i.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function po(i){return gt(i).direction==="rtl"}var bo={convertOffsetParentRelativeRectToViewportRelativeRect:so,getDocumentElement:yt,getClippingRect:uo,getOffsetParent:Oa,getElementRects:fo,getClientRects:ro,getDimensions:ho,getScale:ke,isElement:mt,isRTL:po};function Na(i,t){return i.x===t.x&&i.y===t.y&&i.width===t.width&&i.height===t.height}function mo(i,t){let e=null,s,r=yt(i);function a(){var l;clearTimeout(s),(l=e)==null||l.disconnect(),e=null}function n(l,o){l===void 0&&(l=!1),o===void 0&&(o=1),a();let u=i.getBoundingClientRect(),{left:d,top:c,width:f,height:m}=u;if(l||t(),!f||!m)return;let p=He(c),w=He(r.clientWidth-(d+f)),A=He(r.clientHeight-(c+m)),_=He(d),O={rootMargin:-p+"px "+-w+"px "+-A+"px "+-_+"px",threshold:ft(0,Ht(1,o))||1},E=!0;function b(q){let S=q[0].intersectionRatio;if(S!==o){if(!E)return n();S?n(!1,S):s=setTimeout(()=>{n(!1,1e-7)},1e3)}S===1&&!Na(u,i.getBoundingClientRect())&&n(),E=!1}try{e=new IntersectionObserver(b,{...O,root:r.ownerDocument})}catch{e=new IntersectionObserver(b,O)}e.observe(i)}return n(!0),a}function Ra(i,t,e,s){s===void 0&&(s={});let{ancestorScroll:r=!0,ancestorResize:a=!0,elementResize:n=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:o=!1}=s,u=xs(i),d=r||a?[...u?Ee(u):[],...Ee(t)]:[];d.forEach(_=>{r&&_.addEventListener("scroll",e,{passive:!0}),a&&_.addEventListener("resize",e)});let c=u&&l?mo(u,e):null,f=-1,m=null;n&&(m=new ResizeObserver(_=>{let[L]=_;L&&L.target===u&&m&&(m.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var O;(O=m)==null||O.observe(t)})),e()}),u&&!o&&m.observe(u),m.observe(t));let p,w=o?ne(i):null;o&&A();function A(){let _=ne(i);w&&!Na(w,_)&&e(),w=_,p=requestAnimationFrame(A)}return e(),()=>{var _;d.forEach(L=>{r&&L.removeEventListener("scroll",e),a&&L.removeEventListener("resize",e)}),c?.(),(_=m)==null||_.disconnect(),m=null,o&&cancelAnimationFrame(p)}}var Fa=wa;var Va=xa,qa=ya,$a=Aa;var Ba=(i,t,e)=>{let s=new Map,r={platform:bo,...e},a={...r.platform,_c:s};return va(i,t,{...r,platform:a})};var Wa=!(CSS.supports?.("selector(:popover-open)")??!1),it=class extends X{boot({options:t}){if(t({reference:null,auto:!0,position:"bottom start",gap:"5",offset:"0",matchWidth:!1,crossAxis:!1,scrollY:!0}),this.options().reference===null||this.options().position===null)return;let[e,s]=yo(this.el,{scrollY:this.options().scrollY}),r=go(this.el,this.options().reference,e,{position:this.options().position,gap:this.options().gap,offset:this.options().offset,matchWidth:this.options().matchWidth,crossAxis:this.options().crossAxis,scrollY:this.options().scrollY}),a=()=>{};this.reposition=(...n)=>{this.options().auto?a=Ra(this.options().reference,this.el,r):r(null,...n)},this.cleanup=()=>{a(),s()}}};function go(i,t,e,{position:s,offset:r,gap:a,matchWidth:n,crossAxis:l,scrollY:o}){let u=window.getComputedStyle(i).maxHeight;return u=u==="none"?null:parseFloat(u),(d,c,f)=>{Ba(t,i,{strategy:Wa?"fixed":"absolute",placement:vo(s,i),middleware:[Fa({mainAxis:Number(a),alignmentAxis:Number(r)}),qa(),Va({padding:5,crossAxis:l}),$a({padding:5,apply({rects:m,elements:p,availableHeight:w}){n&&Object.assign(p.floating.style,{width:`${m.reference.width}px`});let A=u;A===null&&(A=o?p.floating.scrollHeight:p.floating.offsetHeight),p.floating.style.maxHeight=w>A?"":`${w}px`}})]}).then(({x:m,y:p})=>{e(c||m,f||p)})}}function vo(i,t){let e=i.split(" ");switch(e[0]){case"start":e[0]=bt(t)?"right":"left";break;case"end":e[0]=bt(t)?"left":"right";break}return e.join("-")}function yo(i,{scrollY:t=!0}){let e=(n,l)=>{Object.assign(i.style,{position:Wa?"fixed":"absolute",overflowY:t?"auto":"hidden",left:`${n}px`,top:`${l}px`,right:"auto",bottom:"auto"})},s,r,a=new MutationObserver(()=>e(s,r));return[(n,l)=>{s=n,r=l,a.disconnect(),e(s,r),a.observe(i,{attributeFilter:["style"]})},()=>{a.disconnect()}]}var Ii=class extends I{boot(){if(this.querySelectorAll("[data-appended]").forEach(t=>t.remove()),!this.querySelector("template")){let t=document.createElement("template");t.setAttribute("name","placeholder"),t.innerHTML="<span>"+this.innerHTML+"</span>",this.innerHTML="",this.appendChild(t)}if(!this.querySelector('template[name="options"]')){let t=document.createElement("template");t.setAttribute("name","options"),t.innerHTML="<div><slot></slot></div>",this.appendChild(t)}if(!this.querySelector('template[name="option"]')){let t=document.createElement("template");t.setAttribute("name","option"),t.innerHTML="<div><slot></slot></div>",this.appendChild(t)}this.templates={placeholder:this.querySelector('template[name="placeholder"]'),overflow:this.querySelector('template[name="overflow"]'),options:this.querySelector('template[name="options"]'),option:this.querySelector('template[name="option"]')},this.templates.options.elsByValue=new Map,this.max=this.templates.overflow?.getAttribute("max")?this.templates.overflow.getAttribute("max"):1/0,this.selecteds=new Map,this.picker=this.closest("ui-select,ui-pillbox"),this.multiple=this.picker.hasAttribute("multiple")}mount(){queueMicrotask(()=>{this.picker._selectable.onInitAndChange(()=>{this.render(!0)});let t=this.picker.list();t&&new MutationObserver(e=>{queueMicrotask(()=>this.render())}).observe(t,{childList:!0})})}render(t){if(this.multiple){let e=this.picker.value,s=Array.from(this.selecteds.keys()).filter(n=>!e.includes(n)),r=e.filter(n=>!this.selecteds.has(n));s.forEach(n=>this.selecteds.delete(n));let a=new Map;for(let n of r){let l=this.picker._selectable.findByValue(n);if(!l){if(t)return setTimeout(()=>this.render());throw`Could not find option for value "${n}"`}a.set(n,l)}a.forEach((n,l)=>this.selecteds.set(l,n)),this.templates.placeholder?.clearPlaceholder?.(),this.templates.overflow?.clearOverflow?.(),this.templates.options?.clearOptions?.(),this.selecteds.size>0?this.renderOptions({hasOverflowed:n=>{if(this.max==="auto"){let l=!1;if(this.renderOverflow(this.selecteds.size,this.selecteds.size-n),this.clientWidth<this.scrollWidth&&(l=!0),this.templates.overflow?.clearOverflow?.(),l)return!0}return n>parseInt(this.max)},renderOverflow:n=>{this.templates?.overflow?.getAttribute("mode")!=="append"&&this.templates.options?.clearOptions?.(),this.renderOverflow(this.selecteds.size,n)}}):this.renderPlaceholder()}else{let e=this.picker.value;if(Array.from(this.selecteds.keys()).includes(e))return;this.selecteds.clear();let s=this.picker._selectable.findByValue(e);if(s)this.selecteds.set(e,s);else if(!["",null,void 0].includes(e)){if(t)return setTimeout(()=>{this.render()});throw`Could not find option for value "${e}"`}this.templates.placeholder?.clearPlaceholder?.(),this.templates.option?.clearOption?.(),this.selecteds.size>0?this.renderOption():this.renderPlaceholder()}}renderOptions({hasOverflowed:t,renderOverflow:e}){let s=document.createElement("div");s.style.display="contents";let r=ze(this.templates.options,{default:s});this.templates.options.after(r),this.templates.options.clearOptions=()=>{r.remove(),this.templates.options.clearOptions=()=>{}};let a=0,n=!1;for(let[o,u]of this.selecteds){let d=new DocumentFragment;d.append(...u.el.cloneNode(!0).childNodes);let c=ze(this.templates.option,{text:u.getSelectedLabel()??u.getLabel(),default:u.getSelectedLabel()??d,value:o});if(c.setAttribute("data-value",o),c.setAttribute("data-appended",""),c.deselect=()=>u.deselect(),s.appendChild(c),a++,t(a)){n=!0,s.removeChild(c),a--;break}}let l=new DocumentFragment;l.append(...s.childNodes),s.replaceWith(l),n&&e(this.selecteds.size-a)}renderOption(){for(let[t,e]of this.selecteds){let s=new DocumentFragment;s.append(...e.el.cloneNode(!0).childNodes);let r=ze(this.templates.option,{text:e.getSelectedLabel()??e.getLabel(),default:e.getSelectedLabel()??s,value:t});r.setAttribute("data-value",t),r.setAttribute("data-appended",t),r.deselect=()=>e.deselect(),this.templates.option.after(r),this.templates.option.clearOption=()=>{r.remove(),this.templates.option.clearOption=()=>{}}}}renderPlaceholder(){if(!this.templates.placeholder)return;let t=ze(this.templates.placeholder);t.setAttribute("data-appended",""),this.templates.placeholder.after(t),this.templates.placeholder.clearPlaceholder=()=>{t.remove(),this.templates.placeholder.clearPlaceholder=()=>{}}}renderOverflow(t,e){if(!this.templates.overflow)return;let s=ze(this.templates.overflow,{remainder:e,count:this.selecteds.size});s.setAttribute("data-appended",""),this.templates.overflow.after(s),this.templates.overflow.clearOverflow=()=>{s.remove(),this.templates.placeholder.clearOverflow=()=>{}}}},Li=class extends I{boot(){this.addEventListener("click",t=>{t.stopPropagation();let e=this.closest("[data-value]")?.getAttribute("data-value");if(e===void 0)return;let s=this.closest("ui-pillbox")._selectable,r=s.selectableByValue(e);r?r.deselect():s.deselectByValue(e)})}};function ze(i,t={}){let e=i.content.cloneNode(!0);return Object.entries(t).forEach(([s,r])=>{(s==="default"?e.querySelectorAll("slot:not([name])"):e.querySelectorAll(`slot[name="${s}"]`)).forEach(n=>n.replaceWith(typeof r=="string"?document.createTextNode(r):r))}),e.firstElementChild}var ut=class extends kt{groupOfType=Y;boot({options:t}){t({multiple:!1}),this.state=this.options().multiple?new Set:null,this.onChanges=[]}onInitAndChange(t){t(),this.onChanges.push(t)}onChange(t){this.onChanges.push(t)}changed(t,e=!1){if(t.ungrouped)return;let s=t.value,r=t.isSelected(),a=this.options().multiple;r?a?this.state.add(s):this.state=s:a?this.state.delete(s):this.state=null,e||this.onChanges.forEach(n=>n(t))}deselectByValue(t,e=!1){this.options().multiple?this.state.delete(t):this.state=null,e||this.onChanges.forEach(s=>s())}getState(){return this.options().multiple?Array.from(this.state):this.state}hasValue(t){return this.options().multiple?this.state.has(t):this.state===t}setState(t){(t===null||t==="")&&(t=this.options().multiple?[]:""),this.options().multiple?(Array.isArray(t)||(t=[t]),t=t.map(s=>s+"")):t=t+"",this.state=this.options().multiple?new Set(t):t;let e=this.options().multiple?t:[t];this.walker().each(s=>{let r=s.use(Y);if(r.ungrouped)return;let a=e.includes(r.value);a&&!r.isSelected()?r.surgicallySelect():!a&&r.isSelected()&&r.surgicallyDeselect()}),this.onChanges.forEach(s=>s())}selected(){return this.walker().find(t=>t.use(Y).isSelected()).use(Y)}selecteds(){return this.walker().filter(t=>t.use(Y).isSelected()).map(t=>t.use(Y))}selectFirst(){this.walker().first()?.use(Y).select()}selectAll(){this.walker().filter(t=>!t.use(Y).isSelected()).map(t=>t.use(Y).select())}deselectAll(){this.walker().filter(t=>t.use(Y).isSelected()).map(t=>t.use(Y).deselect())}allAreSelected(){let t=this.walker().filter(e=>!0);return t.length>0&&this.walker().filter(e=>e.use(Y).isSelected()).length===t.length}noneAreSelected(){return this.state===null||this.state?.size===0}isEmpty(){return this.noneAreSelected()}isNotEmpty(){return!this.isEmpty()}selectableByValue(t){return this.walker().find(e=>e.use(Y).value===t)?.use(Y)}deselectOthers(t){this.walker().each(e=>{e!==t&&e.use(Y).surgicallyDeselect()})}selectedTextValue(){return this.options().multiple?Array.from(this.state).map(t=>this.convertValueStringToElementText(t)).join(", "):this.convertValueStringToElementText(this.state)}convertValueStringToElementText(t){let e=this.findByValue(t);return e?e.selectedLabel||e.label||e.value:t}findByValue(t){return this.selecteds().find(e=>e.value===t)}walker(){return tt(this.el,(t,{skip:e,reject:s})=>{if(t[this.constructor.name]&&t!==this.el)return s();if(!t[this.groupOfType.name]||t.mixins.get(this.groupOfType.name).ungrouped)return e()})}},Y=class extends X{boot({options:t}){this.groupedByType=ut,t({ungrouped:!1,togglable:!1,value:void 0,label:void 0,selectedLabel:void 0,selectedInitially:!1,dataAttr:"data-selected",ariaAttr:"aria-selected"}),this.ungrouped=this.options().ungrouped,this.value=this.options().value===void 0?this.el.value:this.options().value,this.value=this.value+"",this.label=this.options().label,this.selectedLabel=this.options().selectedLabel;let e=this.options().selectedInitially;this.onSelects=[],this.onUnselects=[],this.onChanges=[];let s=()=>{this.group()&&this.group().hasValue(this.value)&&(e=!0),this.multiple=this.hasGroup()?this.group().options().multiple:!1,this.toggleable=this.options().toggleable||this.multiple,e?this.select(!0):(this.state=e,this.surgicallyDeselect(!0))};s(),!this.hasGroup()&&!this.el.isConnected&&queueMicrotask(()=>{this.hasGroup()&&s()})}mount(){this.el.hasAttribute(this.options().ariaAttr)||h(this.el,this.options().ariaAttr,"false")}onInitAndChange(t){t(),this.onChanges.push(t)}onChange(t){this.onChanges.push(t)}onSelect(t){this.onSelects.push(t)}onUnselect(t){this.onUnselects.push(t)}setState(t){t?this.select():this.deselect()}getState(){return this.state}press(){this.toggleable?this.toggle():this.select()}trigger(){this.toggleable?this.toggle():this.select()}toggle(){this.isSelected()?this.deselect():this.select()}isSelected(){return this.state}select(t=!1){let e=!this.isSelected();this.toggleable||this.group()?.deselectOthers(this.el),this.state=!0,h(this.el,this.options().ariaAttr,"true"),h(this.el,this.options().dataAttr,""),e&&(t||(this.onSelects.forEach(s=>s()),this.onChanges.forEach(s=>s())),this.group()?.changed(this,t))}surgicallySelect(){let t=!this.isSelected();this.state=!0,h(this.el,this.options().ariaAttr,"true"),h(this.el,this.options().dataAttr,""),t&&(this.onSelects.forEach(e=>e()),this.onChanges.forEach(e=>e()))}deselect(t=!0){let e=this.isSelected();this.state=!1,h(this.el,this.options().ariaAttr,"false"),x(this.el,this.options().dataAttr),e&&(this.onUnselects.forEach(s=>s()),this.onChanges.forEach(s=>s()),t&&this.group()?.changed(this))}surgicallyDeselect(t=!1){let e=this.isSelected();this.state=!1,h(this.el,this.options().ariaAttr,"false"),x(this.el,this.options().dataAttr),e&&!t&&(this.onUnselects.forEach(s=>s()),this.onChanges.forEach(s=>s()))}getValue(){return this.value}getLabel(){return this.label}getSelectedLabel(){return this.selectedLabel}};var Q=class extends X{boot({options:t}){t({name:void 0,value:void 0,includeWhenEmpty:!0,shouldUpdateValue:!0}),this.name=this.options().name,this.value=this.options().value===void 0?this.el.value:this.options().value,this.state=!1,this.observer=new MutationObserver(()=>{this.renderHiddenInputs()}),this.observer.observe(this.el,{childList:!0})}mount(){this.renderHiddenInputs()}update(t){this.options().shouldUpdateValue?this.value=t:this.state=!!t,this.renderHiddenInputs()}valueIsEmpty(){return this.value===void 0||this.value===null||this.value===""}renderHiddenInputs(){if(this.observer.disconnect(),!this.name)return;let t=this.el.children,e=[];for(let r=0;r<t.length;r++){let a=t[r];a.hasAttribute("data-flux-hidden")&&e.push(a)}e.forEach(r=>r.remove());let s;this.options().shouldUpdateValue?s=!this.valueIsEmpty()||this.options().includeWhenEmpty?this.generateInputs(this.name,this.value):[]:s=this.state||this.options().includeWhenEmpty?this.generateInputs(this.name,this.value):[],s.forEach(r=>{this.el.append(r)}),this.observer.observe(this.el,{childList:!0})}generateInputs(t,e,s=[]){if(this.isObjectOrArray(e))for(let r in e)s=s.concat(this.generateInputs(`${t}[${r}]`,e[r]));else{let r=document.createElement("input");return r.setAttribute("type","hidden"),r.setAttribute("name",t),r.setAttribute("value",e===null?"":""+e),r.setAttribute("data-flux-hidden",""),r.setAttribute("data-appended",""),[r]}return s}isObjectOrArray(t){return typeof t=="object"&&t!==null}submitEnclosingForm(){let t=this.getAssociatedForm();t&&t.requestSubmit()}getAssociatedForm(){let t=this.el.getAttribute("form");return t?document.getElementById(t)||null:this.el.closest("form")}};var ce=class extends Z{boot(){let t=this.list();this._controllable=new U(this,{bubbles:!0}),this._selectable=new ut(t,{multiple:this.hasAttribute("multiple")}),this._submittable=new Q(this,{name:this.getAttribute("name"),value:this._selectable.getState()}),this._controllable.initial(s=>s&&this._selectable.setState(s)),this._controllable.getter(()=>this._selectable.getState());let e=G();this._controllable.setter(e(s=>{this._selectable.setState(s)})),this._selectable.onChange(e(()=>{this._controllable.dispatch(),this.dispatchEvent(new CustomEvent("select",{bubbles:!1}))})),this._selectable.onInitAndChange(()=>{this._submittable.update(this._selectable.getState())})}mount(){this._disableable=new V(this),queueMicrotask(()=>{this._submittable.update(this._selectable.getState())});let t=this.input(),e=this.button(),s=this.list(),r=this.hasAttribute("multiple"),a=this.hasAttribute("autocomplete"),n=this.hasAttribute("autocomplete")&&this.getAttribute("autocomplete").trim().split(" ").includes("strict"),l=this.querySelector("ui-options")||this,o=Ss(l,"options",r);this._activatable=new Mt(l,{filter:"data-hidden"}),!t&&!e&&this._disableable.onInitAndChange(p=>{p?this.removeAttribute("tabindex"):this.setAttribute("tabindex","0")}),this.hasAttribute("filter")&&this.getAttribute("filter")!=="manual"&&(this._filterable=new ie(s),this._filterable.onChange(()=>{this._activatable.clearActive(),this._filterable.hasResults()&&this._activatable.activateFirst()}),this.addEventListener("open",()=>{this._filterable&&this._filterable.filter("")}),this.addEventListener("close",()=>{this._filterable&&requestAnimationFrame(()=>{this._filterable.filter("")})}));let u=this.querySelector("[popover]:not(ui-tooltip > [popover])"),d=u?.querySelector('input:not([type="hidden"])'),c=this.querySelector('input:not([type="hidden"])');c=u?.contains(c)?null:c;let f=this.querySelector("button,ui-button");if(f=u?.contains(f)?null:f,!(u||c))xt(this,this._activatable),At(this,this,this._activatable),Ha(this,this._activatable,this._selectable);else if(!u&&c){let p=c;this._disableable.onInitAndChange(w=>{w?p&&h(p,"disabled",""):p&&x(p,"disabled")}),Ie(this,p,this._selectable,this._popoverable),Ha(p,this._activatable,this._selectable),Ua(a,n,this,p,this._selectable,this._popoverable,this._filterable),De(p),Te(p),this._filterable&&Ce(s,p,this._filterable),Gt(p,this._activatable,this._selectable),xt(p,this._activatable),At(this,p,this._activatable),Yt(this,this._activatable)}else if(u&&c){let p=c;h(p,"role","combobox"),h(p,"aria-controls",o);let w=u;this._popoverable=new rt(w),this._anchorable=new it(w,{reference:p,matchWidth:!0,position:this.hasAttribute("position")?this.getAttribute("position"):void 0,gap:this.hasAttribute("gap")?this.getAttribute("gap"):void 0,offset:this.hasAttribute("offset")?this.getAttribute("offset"):void 0}),Ua(a,n,this,p,this._selectable,this._popoverable,this._filterable),this._disableable.onInitAndChange(A=>{A?p&&h(p,"disabled",""):p&&x(p,"disabled")}),this.querySelectorAll("button,ui-button").forEach(A=>{w.contains(A)||(h(A,"tabindex","-1"),h(A,"aria-controls",o),h(A,"aria-haspopup","listbox"),zt(A,this._popoverable),y(A,"click",()=>{this._popoverable.toggle(),wi()||p.focus()}))}),Ie(this,p,this._selectable,this._popoverable),oe(this,p,w,this._popoverable,this._anchorable),he(this,this._popoverable,[p]),zt(p,this._popoverable),De(p),Te(p),this._filterable&&Ce(s,p,this._filterable),Gt(p,this._activatable,this._selectable),_s(p,this._popoverable),Ft(p,this._popoverable,this._activatable,this._selectable),Es(p,this._popoverable),Rt(this,this._popoverable),xt(p,this._activatable),At(this,p,this._activatable),Yt(this,this._activatable),le(this._popoverable,this._activatable,this._selectable),ue(this,this._selectable,this._popoverable,r)}else if(u&&d){let p=f,w=d,A=u;h(p,"role","combobox"),h(w,"role","combobox"),h(p,"aria-controls",o),this._disableable.onInitAndChange(_=>{_?(p&&h(p,"disabled",""),w&&h(w,"disabled","")):(p&&x(p,"disabled"),w&&x(w,"disabled"))}),this._popoverable=new rt(A),this._anchorable=new it(A,{reference:p,matchWidth:!0,position:this.hasAttribute("position")?this.getAttribute("position"):void 0,gap:this.hasAttribute("gap")?this.getAttribute("gap"):void 0,offset:this.hasAttribute("offset")?this.getAttribute("offset"):void 0,scrollY:!1}),De(w),Te(w),this._filterable&&Ce(s,w,this._filterable),Gt(w,this._activatable,this._selectable),Mi(w,this._popoverable),oe(this,p,A,this._popoverable,this._anchorable),he(this,this._popoverable,[w]),zt(p,this._popoverable),Ie(this,w,this._selectable,this._popoverable),Ft(p,this._popoverable,this._activatable,this._selectable),Ge(p,this._popoverable),Rt(this,this._popoverable),xt(w,this._activatable),Kt(p,this._activatable,this._popoverable),At(this,w,this._activatable),Yt(this,this._activatable),le(this._popoverable,this._activatable,this._selectable),ue(this,this._selectable,this._popoverable,r)}else if(u){let p=f,w=u;h(p,"role","combobox"),h(p,"aria-controls",o),this._disableable.onInitAndChange(A=>{A?(p&&h(p,"disabled",""),t&&h(t,"disabled","")):(p&&x(p,"disabled"),t&&x(t,"disabled"))}),this._popoverable=new rt(w),this._anchorable=new it(w,{reference:p,matchWidth:!0,position:this.hasAttribute("position")?this.getAttribute("position"):void 0,gap:this.hasAttribute("gap")?this.getAttribute("gap"):void 0,offset:this.hasAttribute("offset")?this.getAttribute("offset"):void 0}),oe(this,p,w,this._popoverable,this._anchorable),he(this,this._popoverable),zt(p,this._popoverable),Ft(p,this._popoverable,this._activatable,this._selectable),Ge(p,this._popoverable),Gt(p,this._activatable,this._selectable),Rt(this,this._popoverable),xt(p,this._activatable),Kt(p,this._activatable,this._popoverable),At(this,p,this._activatable),Yt(this,this._activatable),le(this._popoverable,this._activatable,this._selectable),ue(this,this._selectable,this._popoverable,r)}new MutationObserver(()=>{requestAnimationFrame(()=>{if(!this._popoverable||this._popoverable.getState()){let p=this._selectable.selecteds().find(w=>!w.el._disableable.isDisabled())?.el;this._activatable.activateSelectedOrFirst(p)}else this._activatable.clearActive()})}).observe(s,{childList:!0})}unmount(){if(this._popoverable?.getState()){let{unlock:t}=ot();t()}}trigger(){return this.button()||this.input()}button(){return Array.from(this.querySelectorAll("button,ui-button")).find(t=>t.nextElementSibling?.matches("[popover]"))||null}input(){return this.querySelector('input:not([type="hidden"])')}list(){return this.querySelector("ui-options")||this}clear(){this._selectable.setState(null),this.dispatchEvent(new CustomEvent("clear",{bubbles:!1}))}open(){this._popoverable.setState(!0)}close(){this._popoverable.setState(!1)}deselectLast(){!this.hasAttribute("multiple")&&this.value!==null&&(this.value=null,this.dispatchEvent(new Event("input",{bubbles:!1})),this.dispatchEvent(new Event("change",{bubbles:!1}))),this.hasAttribute("multiple")&&this.value.length!==0&&(this.value=this.value.slice(0,-1),this.dispatchEvent(new Event("input",{bubbles:!1})),this.dispatchEvent(new Event("change",{bubbles:!1})))}};T("selected-remove",Li);T("selected",Ii);T("select",ce);function xt(i,t){y(i,"keydown",e=>{["ArrowDown","ArrowUp"].includes(e.key)&&(e.key==="ArrowDown"?(t.activateNext(),e.preventDefault(),e.stopPropagation()):e.key==="ArrowUp"&&(t.activatePrev(),e.preventDefault(),e.stopPropagation()))})}function Kt(i,t,e){xi(i,s=>{t.activateBySearch(s),e.getState()||t.getActive()?.click()})}function At(i,t,e){y(t,"keydown",s=>{if(s.key==="Enter"){let r=e.getActive();if(s.preventDefault(),s.stopPropagation(),!r||r._disableable?.isDisabled())return;r.click(),i.dispatchEvent(new CustomEvent("interaction",{bubbles:!1,cancelable:!1,detail:{optionEl:r}})),r.hasAttribute("action")&&i.dispatchEvent(new CustomEvent("action",{bubbles:!1,cancelable:!1,detail:{optionEl:r}}))}})}function Yt(i,t,e=!1){y(i,e?"pointerdown":"click",s=>{if(s.target.closest("ui-option, ui-option-create")){let r=s.target.closest("ui-option, ui-option-create");if(r._disableable.isDisabled())return;r._selectable?.trigger(),i.dispatchEvent(new CustomEvent("interaction",{bubbles:!1,cancelable:!1,detail:{optionEl:r}})),r.hasAttribute("action")&&i.dispatchEvent(new CustomEvent("action",{bubbles:!1,cancelable:!1,detail:{optionEl:r}})),s.preventDefault(),s.stopPropagation()}})}function Ha(i,t,e){y(i,"focus",()=>{let s=e.selecteds().find(r=>!r.el._disableable.isDisabled())?.el;t.activateSelectedOrFirst(s)}),y(i,"blur",()=>{t.clearActive()})}function Ss(i,t){let e=K(i,"options");return h(i,"role","listbox"),h(i,"aria-multiselectable",t?"true":"false"),e}function zt(i,t){h(i,"aria-haspopup","listbox");let e=()=>{h(i,"aria-expanded",t.getState()?"true":"false"),t.getState()?h(i,"data-open",""):x(i,"data-open","")};t.onChange(()=>{e()}),e()}function oe(i,t,e,s,r){let a=()=>{Array.from([i,e]).forEach(n=>{s.getState()?h(n,"data-open",""):x(n,"data-open","")}),s.getState()?r.reposition():r.cleanup()};s.onChange(()=>a()),a(),s.onChange(()=>{s.getState()?i.dispatchEvent(new Event("open",{bubbles:!1,cancelable:!1})):i.dispatchEvent(new Event("close",{bubbles:!1,cancelable:!1}))})}function le(i,t,e){i.onChange(()=>{if(i.getState()){let s=e.selecteds().find(r=>!r.el._disableable.isDisabled())?.el;setTimeout(()=>{t.activateSelectedOrFirst(s)})}else t.clearActive()})}function Rt(i,t){y(i,"keydown",e=>{e.key==="Escape"&&t.getState()&&(t.setState(!1),e.preventDefault(),e.stopImmediatePropagation())})}function Ft(i,t){y(i,"keydown",e=>{["ArrowDown","ArrowUp"].includes(e.key)&&(e.key==="ArrowDown"||e.key==="ArrowUp")&&(t.getState()||(t.setState(!0),e.preventDefault(),e.stopImmediatePropagation()))})}function Es(i,t){y(i,"click",()=>{t.getState()||(t.setState(!0),i.focus())})}function Ge(i,t){y(i,"click",()=>{t.setState(!t.getState()),i.focus()})}function Mi(i,t){t.onChange(()=>{t.getState()&&!wi()&&setTimeout(()=>i.focus())})}function Ce(i,t,e){y(t,"input",r=>{e.filter(r.target.value)}),new MutationObserver(()=>{requestAnimationFrame(()=>{e.filter(t.value)})}).observe(i,{childList:!0})}function Te(i){y(i,"focus",()=>i.select())}function De(i){y(i,"change",t=>t.stopPropagation()),y(i,"input",t=>t.stopPropagation())}function _s(i,t){y(i,"keydown",e=>{(/^[a-zA-Z0-9]$/.test(e.key)||e.key==="Backspace")&&(t.getState()||t.setState(!0))})}function Ie(i,t,e,s){if(!i.hasAttribute("clear"))return;let a=c=>{t.value!==c&&(t.value=c,t.dispatchEvent(new Event("input",{bubbles:!1})))},n=i.getAttribute("clear"),l=n===""||n.split(" ").includes("action"),o=n===""||n.split(" ").includes("select"),u=n===""||n.split(" ").includes("close"),d=n===""||n.split(" ").includes("esc");n==="none"&&(l=o=u=d=!1),l?i.addEventListener("action",c=>{a("")}):o&&e.onChange(()=>{queueMicrotask(()=>a(""))}),u&&s.onChange(()=>{s.getState()||a("")}),d&&y(t,"keydown",c=>{c.key==="Escape"&&a("")})}function ue(i,t,e,s){let r=!s,a=!s,n=!s;if(i.hasAttribute("close")){let l=i.getAttribute("close");if(r=l==="",a=l.split(" ").includes("action"),n=l.split(" ").includes("select"),l==="none")return}r||a?i.addEventListener("interaction",l=>{let o=l.detail.optionEl;if(!o.hasAttribute("action")){e.setState(!1);return}setTimeout(()=>{if(!o.hasAttribute("data-flux-loading")&&!o.hasAttribute("data-loading")){e.setState(!1);return}let u=new MutationObserver(()=>{requestAnimationFrame(()=>{i.querySelector("input[data-invalid]")||e.setState(!1)}),u.disconnect()});u.observe(o,{attributes:!0,attributeFilter:["data-loading","data-flux-loading"]})},10)}):n&&t.onChange(()=>{e.setState(!1)})}function Gt(i,t,e){t.onChange(()=>{let s=t.getActive();s?h(i,"aria-activedescendant",s.id):x(i,"aria-activedescendant")}),e.onChange(s=>{if(!s)return;let r=s.el;r&&h(i,"aria-activedescendant",r.id)})}function Ua(i,t,e,s,r,a,n){if(!i){h(s,"autocomplete","off"),h(s,"aria-autocomplete","none");return}let l=u=>{s.value!==u&&(s.value=u,s.dispatchEvent(new Event("input",{bubbles:!1})))};h(s,"autocomplete","off"),h(s,"aria-autocomplete","list"),s.value!==""&&r.isEmpty()&&r.setState(s.value);let o=()=>{r.isNotEmpty()?requestAnimationFrame(()=>{l(r.selectedTextValue()),t&&h(s,"data-selected",r.selectedTextValue())}):(l(""),x(s,"data-selected"))};queueMicrotask(()=>{r.isEmpty()&&s.value!==""&&r.setState(s.value),r.onInitAndChange(()=>o())}),e.addEventListener("interaction",u=>{u.detail.optionEl._selectable?.isSelected()&&o()}),t&&a.onChange(()=>{a.getState()||requestAnimationFrame(()=>{l(s.getAttribute("data-selected"))})})}function he(i,t,e=[]){let{lock:s,unlock:r}=ot(t.el,!1,e);t.onChange(()=>{t.getState()?s():r()})}var ks=class extends ce{mount(){this._disableable=new V(this),queueMicrotask(()=>{this._submittable.update(this._selectable.getState())});let t=this.input(),e=this.list(),s=this.hasAttribute("multiple"),r=this.querySelector("ui-pillbox-trigger"),a=this.querySelector("ui-options")||this,n=Ss(a,"options",s);this._activatable=new Mt(a,{filter:"data-hidden"}),this.hasAttribute("filter")&&this.getAttribute("filter")!=="manual"&&(this._filterable=new ie(e),this._filterable.onChange(()=>{this._activatable.clearActive(),this._filterable.hasResults()&&this._activatable.activateFirst()}),this.addEventListener("close",()=>{this._filterable&&this._filterable.filter("")}));let l=this.querySelector("[popover]:not(ui-tooltip > [popover])"),o=l?.querySelector('input:not([type="hidden"])'),u=this.querySelector("ui-selected input");if(!l)throw new Error("Popover element not found");if(o){let c=r,f=o,m=l;h(c,"role","button"),h(f,"aria-autocomplete","list"),h(f,"aria-controls",n),h(f,"role","combobox"),this._disableable.onInitAndChange(p=>{p?(c&&h(c,"disabled",""),f&&h(f,"disabled","")):(c&&x(c,"disabled"),f&&x(f,"disabled"))}),this._popoverable=new rt(m),this._anchorable=new it(m,{reference:c,matchWidth:!0,position:this.hasAttribute("position")?this.getAttribute("position"):void 0,gap:this.hasAttribute("gap")?this.getAttribute("gap"):void 0,offset:this.hasAttribute("offset")?this.getAttribute("offset"):void 0,scrollY:!1}),Gt(f,this._activatable,this._selectable),De(f),Te(f),this._filterable&&Ce(e,f,this._filterable),Mi(f,this._popoverable),oe(this,c,m,this._popoverable,this._anchorable),he(this,this._popoverable,[f]),zt(c,this._popoverable),Ie(this,f,this._selectable,this._popoverable),Ft(c,this._popoverable,this._activatable,this._selectable),Ge(c,this._popoverable),Rt(this,this._popoverable),xt(f,this._activatable),Kt(c,this._activatable,this._popoverable),At(this,f,this._activatable),Yt(this,this._activatable),le(this._popoverable,this._activatable,this._selectable),ue(this,this._selectable,this._popoverable,s),Ya(c)}else if(u){let c=r,f=u,m=l;h(c,"role","button"),h(f,"aria-autocomplete","list"),h(f,"aria-controls",n),h(f,"role","combobox"),this._disableable.onInitAndChange(p=>{p?(c&&h(c,"disabled",""),f&&h(f,"disabled","")):(c&&x(c,"disabled"),f&&x(f,"disabled"))}),this._popoverable=new rt(m,{triggers:[f,c]}),this._anchorable=new it(m,{reference:c,matchWidth:!0,position:this.hasAttribute("position")?this.getAttribute("position"):void 0,gap:this.hasAttribute("gap")?this.getAttribute("gap"):void 0,offset:this.hasAttribute("offset")?this.getAttribute("offset"):void 0}),Gt(f,this._activatable,this._selectable),De(f),Te(f),this._filterable&&Ce(e,f,this._filterable),Mi(f,this._popoverable),oe(this,c,m,this._popoverable,this._anchorable),he(this,this._popoverable,[c]),zt(c,this._popoverable),Ie(this,f,this._selectable,this._popoverable),_s(f,this._popoverable),Ft(f,this._popoverable,this._activatable,this._selectable),Es(c,this._popoverable,f),Rt(this,this._popoverable),xt(f,this._activatable),Kt(c,this._activatable,this._popoverable),At(this,f,this._activatable),Yt(this,this._activatable),le(this._popoverable,this._activatable,this._selectable),ue(this,this._selectable,this._popoverable,s),wo(this,this._selectable,f),xo(this._selectable,f),Ao(this._selectable,f),So(this._popoverable,c,f)}else{let c=r,f=l;h(c,"role","combobox"),h(c,"aria-controls",n),h(c,"aria-autocomplete","none"),this._disableable.onInitAndChange(m=>{m?(c&&h(c,"disabled",""),t&&h(t,"disabled","")):(c&&x(c,"disabled"),t&&x(t,"disabled"))}),this._popoverable=new rt(f),this._anchorable=new it(f,{reference:c,matchWidth:!0,position:this.hasAttribute("position")?this.getAttribute("position"):void 0,gap:this.hasAttribute("gap")?this.getAttribute("gap"):void 0,offset:this.hasAttribute("offset")?this.getAttribute("offset"):void 0}),oe(this,c,f,this._popoverable,this._anchorable),he(this,this._popoverable),zt(c,this._popoverable),Ft(c,this._popoverable,this._activatable,this._selectable),Ge(c,this._popoverable),Gt(c,this._activatable,this._selectable),Rt(this,this._popoverable),xt(c,this._activatable),Kt(c,this._activatable,this._popoverable),At(this,c,this._activatable),Yt(this,this._activatable),le(this._popoverable,this._activatable,this._selectable),ue(this,this._selectable,this._popoverable,s),Ya(c)}new MutationObserver(()=>{requestAnimationFrame(()=>{if(!this._popoverable||this._popoverable.getState()){let c=this._selectable.selecteds().find(f=>!f.el._disableable.isDisabled())?.el;this._activatable.activateSelectedOrFirst(c)}else this._activatable.clearActive()})}).observe(e,{childList:!0})}list(){return this.querySelector("ui-options")||this}},Cs=class extends I{boot(){this.querySelector("input")?h(this,"tabindex","-1"):h(this,"tabindex","0"),this._disableable=new V(this);let t=e=>{e.preventDefault(),e.stopImmediatePropagation()};this._disableable.onInitAndChange(e=>{e?this.addEventListener("click",t,!0):this.removeEventListener("click",t,!0)})}mount(){}};T("pillbox-trigger",Cs);T("pillbox",ks);function Ya(i){y(i,"keydown",t=>{t.key===" "&&(t.preventDefault(),t.stopImmediatePropagation(),i.click())})}function wo(i,t,e){t.onChange(()=>{document.activeElement!==e&&document.activeElement.closest("ui-pillbox")===i&&e.focus()})}function xo(i,t){i.onInitAndChange(()=>{i.noneAreSelected()?h(t,"placeholder",t.getAttribute("data-placeholder")):h(t,"placeholder","")})}function Ao(i,t){y(t,"keydown",e=>{t.value==""&&e.key==="Backspace"&&i.findByValue(i.getState().at(-1))?.deselect()})}function So(i,t,e){y(t,"click",s=>{i.getState()&&(e.focus(),s.preventDefault(),s.stopImmediatePropagation())})}var Ke=class extends I{boot(){h(this,"tabindex","-1"),this.hasAttribute("popover")&&this.addEventListener("lofi-close-popovers",()=>{this.hidePopover()}),h(this,"role","listbox")}mount(){let t=this.closest("ui-autocomplete, ui-combobox, ui-select, ui-pillbox"),e=t?.input();e&&Eo(this,e,t._filterable)}},Ds=class extends I{mount(){let t=this;this._disableable=new V(t,{disableWithParent:!1}),this._disableable.onInitAndChange(r=>{r?h(t,"aria-disabled","true"):x(t,"aria-disabled")});let e=K(t,"option");h(t,"role","option"),this._filterable=new Ct(t,{mirror:this,keep:!!this.closest("ui-option-empty, ui-empty")||this.getAttribute("filter")==="manual"}),this._activatable=new et(t),this.hasAttribute("action")||(this._selectable=new Y(t,{value:this._pendingValue??this.getValue(),label:this.getLabel(),selectedLabel:this.getSelectedLabel(),selectedInitially:this.hasAttribute("selected")})),new MutationObserver(r=>{r.forEach(a=>{a.attributeName==="selected"&&(this.hasAttribute("selected")?this._selectable.setState(!0):this._selectable.setState(!1)),a.attributeName==="value"&&this._selectable&&(this._selectable.value=this.getValue())})}).observe(this,{attributeFilter:["selected","value"]})}get value(){return this._selectable?.value??this._pendingValue??this.getValue()}set value(t){if(!this._selectable){this._pendingValue=t+"";return}this._selectable.value=t+""}get selected(){return this?._selectable?this._selectable.isSelected():!1}set selected(t){if(!this?._selectable)return!1;this._selectable.setState(t)}getSelectedLabel(){return this.getAttribute("selected-label")}getLabel(){return this.hasAttribute("label")?this.getAttribute("label"):this.textContent.trim()}getValue(){return this.hasAttribute("value")?this.getAttribute("value"):this.textContent.trim()}},Is=class extends I{mount(){this._activatable=new et(this),this._filterable=new Ct(this,{keep:!0}),this._disableable=new V(this,{disableWithParent:!1}),this._disableable.onInitAndChange(t=>{t?h(this,"aria-disabled","true"):x(this,"aria-disabled")})}},Pi=class extends I{},Ls=class extends Pi{};T("option-create",Is);T("options",Ke);T("option",Ds);T("option-empty",Pi);T("empty",Ls);function Ts(i){return CSS.supports("selector(&)")?i:i.replace("&",":scope")}function Eo(i,t,e){let s=i.querySelector(Ts("& > ui-option-empty, & > ui-empty")),r=i.querySelector(Ts("& > ui-option-create")),a=r?.hasAttribute("min-length")?parseInt(r.getAttribute("min-length")):void 0;h(s,"data-hidden",""),r&&h(r,"data-hidden","");let n=m=>m.hasAttribute("data-hidden"),l=m=>m.textContent.toLowerCase().trim()!==t.value.toLowerCase().trim(),o=()=>Array.from(i.querySelectorAll(Ts("& > ui-option"))),u=()=>{if(s.hasAttribute("when-loading")){let m=s.textContent;s.textContent=s.getAttribute("when-loading"),s.__hideLoading=()=>{s.textContent=m,s.__hideLoading=void 0}}},d,c,f=()=>{if(clearTimeout(d),clearTimeout(c),t.hasAttribute("data-flux-loading")||t.hasAttribute("data-loading"))return;let m=o(),p=m.every(w=>n(w));if(r){a&&t.value.trim().length<a?h(r,"data-hidden",""):m.every(A=>l(A))?x(r,"data-hidden"):h(r,"data-hidden",""),p&&r._activatable.activate(!0);let w=()=>{x(r,"disabled")};e?w():c=setTimeout(w,150)}p&&(!r||n(r))?x(s,"data-hidden"):h(s,"data-hidden",""),s.__hideLoading?.()};if(e)e.onChange(()=>f()),r&&y(t,"input",()=>{a&&t.value.trim().length<a&&h(r,"data-hidden","")});else{let m=new MutationObserver(()=>{requestAnimationFrame(()=>f())});m.observe(i,{childList:!0}),m.observe(t,{attributes:!0,attributeFilter:["data-loading","data-flux-loading"]}),r&&y(t,"input",p=>{clearTimeout(d),clearTimeout(c);let w=o().every(A=>n(A));w&&t.value.trim()===""&&!n(r)?(u(),x(s,"data-hidden"),h(r,"data-hidden","")):t.value.trim()===""&&!n(r)&&h(r,"data-hidden",""),a&&t.value.trim().length>=a&&x(r,"data-hidden"),h(r,"disabled",""),d=setTimeout(()=>{x(r,"disabled"),w&&r._activatable.activate()},200)})}f()}var g=class i{constructor(t,e,s=1){this._date=new Date(Date.UTC(t,e-1,s))}isBetween(t,e){return!t&&!e?!0:t?e?this._date>=t._date&&this._date<=e._date:this._date>=t._date:this._date<=e._date}isSameDay(t){return t?this._date.getUTCDate()===t._date.getUTCDate()&&this._date.getUTCMonth()===t._date.getUTCMonth()&&this._date.getUTCFullYear()===t._date.getUTCFullYear():!1}isBefore(t){return t?this._date<t._date:!1}isAfter(t){return t?this._date>t._date:!1}incrementDays(t){let e=this.getCopy();return e._date.setUTCDate(e._date.getUTCDate()+t),e}addMonths(t){let e=this.getCopy();return e._date.setUTCMonth(e._date.getUTCMonth()+t),e}addDays(t){let e=this.getCopy();return e._date.setUTCDate(e._date.getUTCDate()+t),e}getYear(){return this._date.getUTCFullYear()}getMonth(){return this._date.getUTCMonth()+1}getPaddedMonth(){return String(this.getMonth()).padStart(2,"0")}getDay(){return this._date.getUTCDate()}getPaddedDay(){return String(this.getDay()).padStart(2,"0")}getDate(){return this._date}getCopy(){return new i(this.getYear(),this.getMonth(),this.getDay())}getDayOfWeek(){return this._date.getUTCDay()}getDaysInMonth(){return new i(this.getYear(),this.getMonth()+1,0).getDay()}getFirstDayOfMonth(){return new i(this.getYear(),this.getMonth(),1).getDayOfWeek()}getWeekNumber(){let t=new Date(Date.UTC(this._date.getUTCFullYear(),0,1)),e=new Date(t);e.setUTCDate(1+(11-t.getUTCDay())%7);let s=new Date(this._date);return s.setUTCDate(this._date.getUTCDate()+(11-this._date.getUTCDay())%7),Math.floor((s.getTime()-e.getTime())/(7*24*60*60*1e3))+1}setDay(t){this._date.setUTCDate(t)}setMonth(t){this._date.setUTCMonth(t-1)}setYear(t){this._date.setUTCFullYear(t)}static fromIsoDateString(t){if(!t)return null;let[e,s,r]=t.split("T")[0]?.split("-")?.map(Number);return new i(e,s,r)}static fromLocalDate(t){return t?new i(t.getUTCFullYear(),t.getUTCMonth()+1,t.getUTCDate()):null}static fromDate(t){return t?new i(t.getFullYear(),t.getMonth()+1,t.getDate()):null}static fromParts(t,e,s){return new i(t,e,s)}static today(){return i.fromDate(new Date)}static firstDayOfMonth(t){return new i(t.getYear(),t.getMonth(),1)}toIsoDateString(){return[this.getYear(),this.getPaddedMonth(),this.getPaddedDay()].join("-")}toParts(){return[this.getYear(),this.getMonth(),this.getDay()]}toDate(){return new Date(this.getYear(),this.getMonth()-1,this.getDay())}toFormattedString(t,e){return this.toDate().toLocaleDateString(t,e)}};function za(i,t,e,s){let r=i.querySelector('template[name="heading"]'),a=i.querySelector('template[name="weekday"]'),n=i.querySelector('template[name="week"]');r&&_o(r,t,e),a&&ko(a,t),n&&Co(n,t,e,s)}function _o(i,t,e){at(i,s=>s({slots:{default:new Intl.DateTimeFormat(t.locale,{month:i.hasAttribute("display")?i.getAttribute("display"):"long",year:"numeric",timeZone:"UTC"}).format(new g(e.year,e.month).getDate())}}))}function ko(i,t){let e=r=>i.hasAttribute("display")?new Intl.DateTimeFormat(t.locale,{weekday:i.getAttribute("display")}).format(r):["en","es","de","fr","it","pt"].includes(t.locale.split("-")[0])?new Intl.DateTimeFormat(t.locale,{weekday:"short"}).format(r).slice(0,2):new Intl.DateTimeFormat(t.locale,{weekday:"narrow"}).format(r),s=Array.from({length:7},(r,a)=>{let n=(a+t.startDay)%7,l=new Date(2024,0,n+7);return e(l)});at(i,r=>s.map(a=>r({slots:{default:a}})))}function Co(i,t,e,s){let r=e.month,a=e.year,n=(new g(a,r).getFirstDayOfMonth()-t.startDay+7)%7,l=new g(a,r).getDaysInMonth(),[o,u]=new g(a,r).addMonths(-1).toParts(),d=new g(o,u).getDaysInMonth(),[c,f]=[[],[]];for(let E=0;E<n;E++){c.push(0);let b=d-n+E+1;f.push(new g(o,u,b).toIsoDateString())}for(let E=1;E<=l;E++)c.push(E),f.push(new g(a,r,E).toIsoDateString());let p=(7-(n+l)%7)%7,[w,A]=new g(a,r).addMonths(1).toParts();for(let E=1;E<=p;E++)c.push(0),f.push(new g(w,A,E).toIsoDateString());if(t.fixedWeeks){let E=Math.ceil(c.length/7),b=t.fixedWeeks,q=b-E;if(q>0)for(let S=0;S<q*7;S++)c.push(0),f.push(g.fromIsoDateString(f[f.length-1]).addDays(1).toIsoDateString());else q<0&&(c.length=b*7,f.length=b*7)}let _=E=>Array.from({length:Math.ceil(E.length/7)},(b,q)=>E.slice(q*7,(q+1)*7)),L=_(c),O=_(f);at(i,E=>L.map((b,q)=>{let S=E(),N=O[q],F=S.querySelector('template[name="number"]');if(F){let v=(4-t.startDay+7)%7,M=g.fromIsoDateString(N[v]).getWeekNumber();at(F,k=>k({slots:{default:M}}))}return at(S.querySelector('template[name="day"]'),v=>b.map((M,k)=>{if(M===0){let H=g.fromIsoDateString(N[k]).getDay();return v({slots:{default:H},attrs:{"data-date":N[k],"data-outside":""}})}let C=g.fromIsoDateString(N[k]),D=v({slots:{default:M},attrs:{"data-date":N[k]}}),P=s.subtext(C),$=s.details(C),W=s.variant(C);if([!1,null,void 0].includes(W)||(D.dataset.dateVariant=W),![!1,null,void 0].includes(P)){let R=D.querySelector('template[name="subtext"]');R&&at(R,H=>H({slots:{default:P}}))}if(![!1,null,void 0].includes($)){let R=D.querySelector('template[name="details"]');R&&at(R,H=>H({slots:{default:$}}))}return D})),S}))}function Ga(i,t,e,s,r,a){let l=((o,u)=>r.lowerBound(()=>g.today().getMonth()===o&&g.today().getYear()===u?g.today():new g(u,o)))(s.month,s.year);i.querySelectorAll("[data-date]").forEach(o=>{h(o,"role","gridcell");let u=o.querySelector("button,ui-button"),d=To(o);d&&(u?h(u,"aria-label",d.toFormattedString(e.locale,{day:"numeric",month:"long",year:"numeric",weekday:"long"})):h(o,"aria-label",d.toFormattedString(e.locale,{day:"numeric",month:"long",year:"numeric",weekday:"long"})),a.isValid(d)?t?(h(o,"disabled",""),h(o,"aria-disabled","true"),u&&h(u,"disabled","")):(x(o,"disabled"),x(o,"data-unavailable"),x(o,"aria-disabled"),u&&x(u,"disabled")):(h(o,"disabled",""),h(o,"aria-disabled","true"),u&&h(u,"disabled",""),a.isUnavailable(d)&&h(o,"data-unavailable","")),g.today().isSameDay(d)?h(o,"data-today",""):x(o,"data-today",""),r.attributes(o,d),d.isSameDay(l)?u&&h(u,"tabindex","0"):u&&h(u,"tabindex","-1"))})}function at(i,t){if(!i)return;let e=()=>{let r=i.nextElementSibling;for(;r&&r.hasAttribute("data-appended");){let a=r;r=r.nextElementSibling,a.remove()}};e();let s=t(({slots:r={},attrs:a={}}={})=>{let n=i.content.cloneNode(!0).firstElementChild;return Object.entries(r).forEach(([l,o])=>{(l==="default"?n.querySelectorAll("slot:not([name])"):n.querySelectorAll(`slot[name="${l}"]`)).forEach(d=>d.replaceWith(typeof o=="string"?document.createTextNode(o):o))}),n.querySelectorAll("slot").forEach(l=>l.remove()),Object.entries(a).forEach(([l,o])=>{n.setAttribute(l,o)}),n});return s=Array.isArray(s)?s:[s],s.reverse().forEach(r=>{h(r,"data-appended",""),i.after(r)}),{cleanup:e}}function To(i){return!i||!i.hasAttribute("data-date")?null:g.fromIsoDateString(i.getAttribute("data-date"))}var Vt=class{static SINGLE="single";static MULTIPLE="multiple"},ht=class{static SELECTION="selection";static ACTIVATION="activation";static VIEW_CHANGE="view-change"},Oi=class i{constructor(t,e,s){this.config=e,this.observable=s,this.selection=t}select(t){let e=this.selection;this.selection=this.selection.select(t,this.config),this.selection.shouldNotify(e)?this.observable.notify(ht.SELECTION):this.observable.notify(ht.ACTIVATION)}setValue(t){let e=this.selection;this.selection=i.createSelectionFromValue(t,this.config),this.selection.shouldNotify(e)?this.observable.notify(ht.SELECTION):this.observable.notify(ht.ACTIVATION)}getValue(){return this.selection.value()}isSelectable(t){return this.selection.selectable(t,this.config)}contains(...t){return this.selection.contains(...t)}hasSelection(){return this.selection.hasSelection()}lowerBound(...t){return this.selection.lowerBound(...t)}upperBound(...t){return this.selection.upperBound(...t)}display(...t){return this.selection.display(this.config,...t)}attributes(...t){return this.selection.attributes(...t)}static createSelectionFromValue(t,e){return e.mode===Vt.MULTIPLE?(t??=[],new Ms(t)):t?new Ri(t):new Ni}static createFromValueStringAttribute(t,e,s){let r=i.createSelectionFromValueStringAttribute(t,e);return new i(r,e,s)}static createSelectionFromValueStringAttribute(t,e){return e.mode===Vt.MULTIPLE&&(t=t?t.split(",").map(s=>s.trim()):[]),i.createSelectionFromValue(t,e)}},Xe=class{contains(){}shouldNotify(t){return!0}hasSelection(){return!1}lowerBound(t){return Fi(t)}upperBound(t){return this.lowerBound(t)}selectable(t,e){return!0}display(t){}value(){}attributes(t,e){this.contains(e)?(h(t,"data-selected",""),h(t,"aria-selected","true")):(x(t,"data-selected"),h(t,"aria-selected","false"))}},Ni=class i extends Xe{contains(){return!1}shouldNotify(t){return!(t instanceof i)}hasSelection(){return!1}lowerBound(t){return Fi(t)}select(t){return new Ri(t)}display(t){return""}value(){return null}},Ri=class i extends Xe{constructor(t){super(),this._value=t}contains(t){return this._value===t}shouldNotify(t){return!(t instanceof i&&this._value===t._value)}hasSelection(){return!0}lowerBound(){return this._value}select(t){return this._value===t?new Ni:new i(t)}display(t){return Vi(this._value,t.timeFormat,t.locale)}value(){return this._value}},Ms=class i extends Xe{constructor(t){super(),this._values=t.sort((e,s)=>St(e)<St(s)?-1:1)}contains(t){return this._values.some(e=>e===t)}shouldNotify(t){return!(t instanceof i&&this._values.every(e=>t._values.includes(e))&&t._values.every(e=>this._values.includes(e)))}hasSelection(){return this._values.length>0}lowerBound(t){return this._values.sort((s,r)=>St(s)<St(r)?-1:1)[0]||Fi(t)}upperBound(t){let e=this._values.sort((s,r)=>St(s)<St(r)?-1:1);return e[e.length-1]||Fi(t)}select(t){return this._values.some(s=>s===t)?new i(this._values.filter(s=>s!==t)):new i([...this._values,t])}display(t){return this._values.sort((e,s)=>St(e)<St(s)?-1:1).map(e=>Vi(e,t.timeFormat,t.locale)).join(", ")}value(){return this._values}};function Fi(i=null){return typeof i=="function"?i():i}var qi=class extends I{boot(){this.picker=this.closest("ui-time-picker");let t=this.querySelectorAll("input");this._disableable=new V(this);let e=s=>{s.preventDefault(),s.stopImmediatePropagation()};if(this._disableable.onInitAndChange(s=>{s?this.addEventListener("click",e,!0):this.removeEventListener("click",e,!0)}),t.length!==0){if(t.length<2)throw new Error("Time picker inputs missing");this.hourInput=t[0],this.minuteInput=t[1],this.meridiemInput=t[2]||null,this.meridiemInput&&this.use24HourFormat()&&(this.meridiemInput.style.display="none",this.meridiemInput=null),this._disableable.onInitAndChange(s=>{s?(this.hourInput.setAttribute("disabled",""),this.minuteInput.setAttribute("disabled",""),this.meridiemInput?.setAttribute("disabled","")):(this.hourInput.removeAttribute("disabled"),this.minuteInput.removeAttribute("disabled"),this.meridiemInput?.removeAttribute("disabled"))}),this.clearInputs(),Ps(this.hourInput),Ps(this.minuteInput),this.meridiemInput&&Ps(this.meridiemInput),this.hourInput.addEventListener("keydown",s=>{if(s.key==="ArrowRight")return this.minuteInput.focus()}),this.minuteInput.addEventListener("keydown",s=>{if(s.key==="ArrowLeft")return this.hourInput.focus();if(s.key==="ArrowRight")return this.meridiemInput?.focus()}),this.meridiemInput?.addEventListener("keydown",s=>{if(s.key==="ArrowLeft")return this.minuteInput.focus()}),Os(this.hourInput),Os(this.minuteInput),this.meridiemInput&&Os(this.meridiemInput),this.initHourInputListeners(),this.initMinuteInputListeners(),this.meridiemInput&&this.initMeridiemInputListeners(),this.meridiemInput&&this.setMeridiemWidthBasedOnLocale(),this.picker.observable.subscribe(ht.SELECTION,()=>{this.updateInputsFromSelectable(this.picker.selectable)}),this.updateInputsFromSelectable(this.picker.selectable)}}focus(){if(this.hourInput)return this.hourInput.focus();this.querySelector("button,ui-button")?.focus()}use24HourFormat(){return this.picker.config.timeFormat==="24-hour"?!0:this.picker.config.timeFormat==="12-hour"?!1:Do(this.picker.config.locale)}processTime(){let t=Xa(this.hourInput.value,this.minuteInput.value,this.meridiemInput?.value);t&&(this.updateSelectable(t),this.updateInputsFromSelectable(this.picker.selectable))}updateSelectable(t){this.picker.selectable.setValue(t)}updateInputsFromSelectable(t){let e=t.getValue();this.updateInputs(e)}updateInputs(t){if(!t)return this.clearInputs();x(this.picker,"data-empty");let[e,s]=t.split(":"),r=null;this.meridiemInput&&(e=parseInt(e),r=Ka(e,this.picker.config.locale),e>12?e=e-12:e===0&&(e=12),e=e.toString()),this.hourInput.value=e.padStart(2,"0"),this.minuteInput.value=s.padStart(2,"0"),this.meridiemInput&&(this.meridiemInput.value=r)}clearInputs(){this.hourInput.value="--",this.minuteInput.value="--",this.meridiemInput&&(this.meridiemInput.value="--"),h(this.picker,"data-empty","")}initHourInputListeners(){let t=!1;this.hourInput.addEventListener("keydown",e=>{if(!["ArrowUp","ArrowDown"].includes(e.key))return;e.preventDefault(),e.stopPropagation();let s=parseInt(this.hourInput.value),r=this.picker.selectable.getValue(),[a,n]=r?.split(":")||["00","00"];a=parseInt(a),e.key==="ArrowUp"?r===null||a===23?a=0:a++:e.key==="ArrowDown"&&(r===null||a===0?a=23:a--);let l=Xa(a.toString(),n);this.updateSelectable(l),this.updateInputsFromSelectable(this.picker.selectable),Et(this.hourInput)}),this.hourInput.addEventListener("keydown",e=>{if(!/[0-9]/.test(e.key))return;let s=parseInt(e.key);if(this.hourInput.value===""||this.hourInput.value==="--"||!t){t=!0,this.hourInput.value=`0${s}`,s>2?this.minuteInput.focus():Et(this.hourInput);return}let r=parseInt(this.hourInput.value);if(r===2&&s>=0&&s<=3){this.hourInput.value=`${r}${s}`,this.minuteInput.focus();return}if(r===1||r===0){this.hourInput.value=`${r}${s}`,this.minuteInput.focus();return}this.hourInput.value=`0${s}`,s>2?this.minuteInput.focus():Et(this.hourInput)}),this.hourInput.addEventListener("blur",e=>{t=!1,this.processTime()})}initMinuteInputListeners(){let t=!1;this.minuteInput.addEventListener("keydown",e=>{if(!["ArrowUp","ArrowDown"].includes(e.key))return;e.preventDefault(),e.stopPropagation();let s=parseInt(this.minuteInput.value);e.key==="ArrowUp"?isNaN(s)||s===59?s=0:s=s+1:e.key==="ArrowDown"&&(isNaN(s)||s===0?s=59:s=s-1),this.minuteInput.value=s.toString().padStart(2,"0"),this.processTime(),Et(this.minuteInput)}),this.minuteInput.addEventListener("keydown",e=>{if(!/[0-9]/.test(e.key))return;let s=parseInt(e.key);if(this.minuteInput.value===""||this.minuteInput.value==="--"||!t){t=!0,this.minuteInput.value=`0${s}`,this.processTime(),s>5?this.meridiemInput?.focus():Et(this.minuteInput);return}let r=parseInt(this.minuteInput.value);if(r<=5){this.minuteInput.value=`${r}${s}`,this.processTime(),this.meridiemInput?.focus();return}this.minuteInput.value=`0${s}`,this.processTime(),s>5?this.meridiemInput?.focus():Et(this.minuteInput)}),this.minuteInput.addEventListener("blur",e=>{t=!1,this.processTime()})}initMeridiemInputListeners(){this.meridiemInput?.addEventListener("keydown",t=>{if(!["ArrowUp","ArrowDown"].includes(t.key))return;t.preventDefault(),t.stopPropagation();let e=this.meridiemInput.value;t.key==="ArrowUp"?e===""||e==="AM"?e="PM":e="AM":t.key==="ArrowDown"&&(e===""||e==="PM"?e="AM":e="PM"),this.meridiemInput.value=e,this.processTime(),Et(this.meridiemInput)}),this.meridiemInput?.addEventListener("keydown",t=>{["a","p","A","P"].includes(t.key)&&(t.key==="a"||t.key==="A"?this.meridiemInput.value="AM":(t.key==="p"||t.key==="P")&&(this.meridiemInput.value="PM"),this.processTime(),Et(this.meridiemInput))})}setMeridiemWidthBasedOnLocale(){let t=Ka(12,this.picker.config.locale);t&&(this.meridiemInput.style.width=`calc(${t.length}ch + 2px)`)}};function Ps(i){i.addEventListener("focus",t=>{Et(i)}),i.addEventListener("mousedown",t=>{Et(i)}),i.addEventListener("mouseup",t=>{t.preventDefault(),Et(i)})}function Os(i){i.addEventListener("keydown",t=>{t.ctrlKey||t.metaKey||t.altKey||["Tab"].includes(t.key)||t.preventDefault()})}function Et(i){i.setSelectionRange(0,i.value.length)}function Ka(i,t){let r=new Intl.DateTimeFormat(t,{hour:"numeric",hour12:!0}).formatToParts(new Date(2024,0,1,i,0)).find(a=>a.type==="dayPeriod")?.value;return r||(i>=12?"PM":"AM")}function Xa(i,t,e=null){if(i==="--"&&t==="--"&&(e===null||e==="--"))return null;e==="PM"&&i==="--"&&(i="12"),i==="--"&&(i="00"),t==="--"&&(t="00"),e==="--"&&(e=null),i=i.padStart(2,"0"),t=t.padStart(2,"0");let s=e?i+":"+t+" "+e:i+":"+t;return Io(s)}function Do(i){return new Intl.DateTimeFormat(i,{hour:"numeric"}).format(new Date(2024,0,1,0,0)).startsWith("00")}function Io(i){let t=i.trim().match(/^(\d{1,2}):(\d{2})(?:\s*(am|pm|AM|PM))?$/i);if(!t)throw new Error(`Invalid time string: ${i}`);let e=parseInt(t[1],10),s=parseInt(t[2],10),r=t[3]?.toUpperCase();if(s>59||e>23||r!=="AM"&&r!=="PM"&&r!==void 0)throw new Error(`Invalid time string: ${i}`);return e>=13||e===0?`${String(e).padStart(2,"0")}:${String(s).padStart(2,"0")}`:(r&&(e===12?e=r==="AM"?0:12:r==="PM"&&(e+=12)),`${String(e).padStart(2,"0")}:${String(s).padStart(2,"0")}`)}var Ns=class extends Z{boot(){this.config={timeFormat:this.hasAttribute("time-format")?this.getAttribute("time-format"):"auto",interval:this.interval(),min:this.min(),max:this.max(),unavailable:this.unavailable(),openTo:this.openTo(),locale:this.hasAttribute("locale")?this.getAttribute("locale"):navigator.language,mode:this.hasAttribute("multiple")?Vt.MULTIPLE:Vt.SINGLE,dropdown:!(this.hasAttribute("dropdown")&&this.getAttribute("dropdown")==="false")},this.observable=new Wt,this._controllable=new U(this,{bubbles:!0}),this._submittable=new Q(this,{name:this.getAttribute("name"),value:this.getAttribute("value"),includeWhenEmpty:!1}),this.selectable=Oi.createFromValueStringAttribute(this.getAttribute("value"),this.config,this.observable),this._controllable.getter(()=>this.selectable.getValue());let t=G();if(this._controllable.setter(t(l=>{this.selectable.setValue(l)})),this.observable.subscribe(ht.SELECTION,t(()=>{this._controllable.dispatch(),this.dispatchEvent(new CustomEvent("input",{bubbles:!1}))})),this.observable.subscribe(ht.SELECTION,()=>{this._submittable.update(this.selectable.getValue())}),this._disableable=new V(this),!this.config.dropdown)return;let e=this.querySelector("[popover]");if(!e)return;let s=this.trigger(),r=this.querySelector("ui-time-picker-options"),a=Lo(r,this.config.mode===Vt.MULTIPLE);this._popoverable=new rt(e,{triggers:[s]}),this._anchorable=new it(e,{reference:s,position:this.hasAttribute("position")?this.getAttribute("position"):void 0,gap:this.hasAttribute("gap")?this.getAttribute("gap"):void 0,offset:this.hasAttribute("offset")?this.getAttribute("offset"):void 0,matchWidth:!0}),this._activatable=new Mt(r,{filter:"data-hidden"}),this._disableable.onInitAndChange(l=>{l?(h(s,"disabled",""),s.querySelectorAll("button,ui-button").forEach(o=>h(o,"disabled",""))):(x(s,"disabled"),s.querySelectorAll("button,ui-button").forEach(o=>x(o,"disabled")))}),s.addEventListener("click",l=>{this._popoverable.toggle(),s.focus()}),s.querySelectorAll("button,ui-button").forEach(l=>{Mo(l,this._popoverable,a),Ro(l,this._activatable,this.observable)}),Po(this,e,this._popoverable,this._anchorable),Oo(this,this._popoverable),Ft(s,this._popoverable),Rt(this,this._popoverable),xt(s,this._activatable),Kt(s,this._activatable,this._popoverable),At(this,s,this._activatable),Bo(this._popoverable,this._activatable,this.selectable,this.config.openTo),Fo(this,this.config.mode,this.observable,this.selectable,this._popoverable),new MutationObserver(l=>{l.forEach(o=>{["interval","unavailable","max","min","open-to"].includes(o.attributeName)&&(this.config.interval=this.interval(),this.config.unavailable=this.unavailable(),this.config.min=this.min(),this.config.max=this.max(),this.config.openTo=this.openTo(),this.observable.notify(ht.VIEW_CHANGE))})}).observe(this,{attributes:!0})}trigger(){return this.querySelector("ui-time-picker-trigger")}list(){return this.querySelector("ui-options")||this}clear(){this.selectable.setValue(null),this.dispatchEvent(new CustomEvent("clear",{bubbles:!1}))}interval(){return this.hasAttribute("interval")?parseInt(this.getAttribute("interval")):30}min(){if(this.hasAttribute("min")){let t=this.getAttribute("min");return t==="now"?new Date().toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!1}):je(t)?t:console.warn(`Invalid min attribute: ${t}`)}}max(){if(this.hasAttribute("max")){let t=this.getAttribute("max");return t==="now"?new Date().toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!1}):je(t)?t:console.warn(`Invalid max attribute: ${t}`)}}unavailable(){if(this.hasAttribute("unavailable")){let t=this.getAttribute("unavailable").split(",").map(e=>e.trim());return t.every(e=>e.includes("-")?qo(e):je(e))?t:console.warn(`Invalid unavailable attribute: ${t}`)}return[]}openTo(){if(this.hasAttribute("open-to")){let t=this.getAttribute("open-to");return t==="now"?new Date().toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!1}):je(t)?t:console.warn(`Invalid open-to attribute: ${t}`)}}},Rs=class extends I{boot(){if(this.picker=this.closest("ui-time-picker"),!this.querySelector('template[name="time"]')){let t=document.createElement("template");t.setAttribute("name","time"),t.innerHTML="<div><slot></slot></div>"}this.templates={placeholder:this.querySelector('template[name="placeholder"]'),time:this.querySelector('template[name="time"]')},this.picker.observable.subscribe(ht.SELECTION,()=>{this.render(this.picker)}),this.render(this.picker)}mount(){this.render(this.picker)}render(t){if(this.templates.placeholder?.clearPlaceholder?.(),this.templates.time?.clearTime?.(),t.selectable.hasSelection()){let{cleanup:e}=at(this.templates.time,s=>s({slots:{default:t.selectable.display(t.config.locale)}}));this.templates.time.clearTime=e}else{if(!this.templates.placeholder)return;let{cleanup:e}=at(this.templates.placeholder,s=>s({slots:{}}));this.templates.placeholder.clearPlaceholder=e}}},Fs=class extends I{boot(){this.picker=this.closest("ui-time-picker"),this.render(),this.picker.observable.subscribe(ht.SELECTION,()=>{this.render()}),this.picker.observable.subscribe(ht.VIEW_CHANGE,()=>{this.render()});let{enable:t,disable:e}=Vo(this,this.picker.selectable);this.picker._disableable.onInitAndChange(s=>{s?e():t()})}render(){let t=this.querySelector('template[name="option"]');t&&at(t,e=>Ho(this.picker.config).map(({value:r,label:a})=>{let n=this.picker.config.unavailable.some(u=>$o(r,u)),l={"data-time":r,role:"option"};n&&(l.disabled="");let o=e({attrs:l,slots:{default:a}});return this.picker.selectable.attributes(o,r),o._activatable=new et(o),K(o,"option"),o}))}};T("time-picker",Ns);T("time-picker-trigger",qi);T("selected-time",Rs);T("time-picker-options",Fs);function Lo(i,t){let e=K(i,"options");return h(i,"role","listbox"),h(i,"aria-multiselectable",t?"true":"false"),e}function Mo(i,t,e){h(i,"role","combobox"),h(i,"aria-controls",e),h(i,"aria-haspopup","listbox"),No(i,t),y(i,"click",s=>{s.stopPropagation(),t.setState(!t.getState()),i.focus()})}function Po(i,t,e,s){let r=()=>{Array.from([i,t]).forEach(a=>{e.getState()?h(a,"data-open",""):x(a,"data-open","")}),e.getState()?s.reposition():s.cleanup()};e.onChange(()=>r()),r(),e.onChange(()=>{e.getState()?i.dispatchEvent(new Event("open",{bubbles:!1,cancelable:!1})):i.dispatchEvent(new Event("close",{bubbles:!1,cancelable:!1}))})}function Oo(i,t){let{lock:e,unlock:s}=ot(t.el);t.onChange(()=>{t.getState()?e():s()})}function No(i,t){h(i,"aria-haspopup","listbox");let e=()=>{h(i,"aria-expanded",t.getState()?"true":"false"),t.getState()?h(i,"data-open",""):x(i,"data-open","")};t.onChange(()=>{e()}),e()}function Ro(i,t){t.onChange(()=>{let e=t.getActive();e?h(i,"aria-activedescendant",e.id):x(i,"aria-activedescendant")})}function Fo(i,t,e,s,r){t!==Vt.MULTIPLE&&e.subscribe(ht.SELECTION,()=>{s.hasSelection()&&r.setState(!1)})}function Vo(i,t){let e=!1,s=i.hasAttribute("readonly");return y(i,"click",r=>{if(e||s)return;let a=r.target.closest("[data-time]");if(!a)return;let n=a.getAttribute("data-time");setTimeout(()=>{je(n)&&t.select(n)})}),{enable:()=>{},disable:()=>{}}}function je(i){return new RegExp(`^${Vs()}$`).test(i)}function qo(i){return new RegExp(`^${Vs()}-${Vs()}$`).test(i)}function Vs(){return"([01]?[0-9]|2[0-3]):[0-5][0-9]"}function $o(i,t){let[e,s]=i.split("-").map(n=>{let[l,o]=n.split(":").map(Number);return l*60+o}),[r,a]=t.split("-").map(n=>{let[l,o]=n.split(":").map(Number);return l*60+o});return isNaN(s)&&(s=e),isNaN(a)&&(a=r),!(s<r||e>a)}function Vi(i,t,e){let[s,r]=i.split(":").map(Number),a={"12-hour":!0,"24-hour":!1,auto:void 0};return new Intl.DateTimeFormat(e,{hour:"numeric",minute:"numeric",hour12:a[t]}).format(new Date(2024,0,1,s,r))}function St(i){if(!i)return null;let[t,e]=i.split(":");return isNaN(t)||isNaN(e)?null:parseInt(t)*60+parseInt(e)}function Bo(i,t,e,s=null){i.onChange(()=>{if(i.getState()){let r=e.getValue();Array.isArray(r)||(r=r===null?[]:[r]);let n=t.filterAwareWalker().find(o=>r.includes(o.getAttribute("data-time"))),l=null;!n&&s&&(l=Wo(t,s)),setTimeout(()=>{let o=n||l;t.activateSelectedOrFirst(o),o?.scrollIntoView({block:"nearest"})})}else t.clearActive()})}function Wo(i,t){let e=St(t),s=null,r=null;return i.filterAwareWalker().walk((a,n)=>{let l=a.getAttribute("data-time"),o=St(l);o>e||Math.abs(o-e)<Math.abs(r-e)&&(s=a,r=o)}),s}function Ho({interval:i=30,timeFormat:t="auto",locale:e=navigator.language,min:s,max:r}={}){let a=[],n=0,l=24*60-1;if(s){let o=new Date(2024,0,1),[u,d]=s.split(":");o.setHours(u,d),n=o.getHours()*60+o.getMinutes()}if(r){let o=new Date(2024,0,1,23,59,59),[u,d]=r.split(":");o.setHours(u,d),l=o.getHours()*60+o.getMinutes()}for(let o=n;o<=l;o+=i){let u=Math.floor(o/60),d=o%60,c=`${String(u).padStart(2,"0")}:${String(d).padStart(2,"0")}`,f=Vi(c,t,e);a.push({value:c,label:f})}return a}var $i=class extends X{boot({options:t}){this.onChanges=[],this.state=!1}onChange(t){this.onChanges.push(t)}getState(){return this.state}setState(t){let e=this.state;this.state=!!t,this.state!==e&&this.onChanges.forEach(s=>s())}};var qs=class extends I{boot(){let t=this.button(),e=this.details();if(t){if(!e)return console.warn("ui-disclosure: no panel element found",this)}else return console.warn("ui-disclosure: no trigger element found",this);this._disableable=new V(this),this._disableable.onInitAndChange(a=>{a?t.hasAttribute("disabled")||h(t,"disabled",""):t.hasAttribute("disabled")&&x(t,"disabled")}),this._controllable=new U(this,{disabled:this.disabled}),e._disclosable=new $i(e),this._controllable.initial(a=>a&&e._disclosable.setState(!0)),this._controllable.getter(()=>e._disclosable.getState()),this._controllable.setter(a=>e._disclosable.setState(a)),e._disclosable.onChange(()=>{this.dispatchEvent(new CustomEvent("lofi-disclosable-change",{bubbles:!0})),this._controllable.dispatch()});let s=()=>{e._disclosable.getState()?(h(this,"data-open",""),h(t,"data-open",""),h(e,"data-open","")):(x(this,"data-open"),x(t,"data-open"),x(e,"data-open"))};e._disclosable.onChange(()=>s()),s(),y(t,"click",a=>{this.disabled||e._disclosable.setState(!e._disclosable.getState())});let r=K(e,"disclosure");h(t,"aria-controls",r),h(t,"aria-expanded","false"),e._disclosable.onChange(()=>{e._disclosable.getState()?h(t,"aria-expanded","true"):h(t,"aria-expanded","false")}),this.hasAttribute("open")&&e._disclosable.setState(!0)}button(){return this.querySelector("button,ui-button")}details(){return this.lastElementChild}},$s=class i extends I{boot(){this.exclusive=this.hasAttribute("exclusive"),this.exclusive&&y(this,"lofi-disclosable-change",t=>{t.stopPropagation(),t.target.localName==="ui-disclosure"&&t.target.value&&this.disclosureWalker().each(e=>{e!==t.target&&(e.value=!1)})})}disclosureWalker(){return tt(this,(t,{skip:e,reject:s})=>{if(t instanceof i&&t!==this||t.localName!=="ui-disclosure")return s()})}};T("disclosure",qs);T("disclosure-group",$s);var Bs=class extends I{boot(){}},Ws=class extends I{boot(){let t=this.hasAttribute("resize")?this.getAttribute("resize"):"both",e=this.hasAttribute("shrink"),s=this.closest("ui-resizable"),r,a,n=!1;if(!s)throw"Resizable container not found";this.addEventListener("pointerdown",l=>{n||(r=s.offsetWidth,a=s.offsetHeight,n=!0);let o=l.clientX,u=l.clientY,d=parseInt(getComputedStyle(s).width,10),c=parseInt(getComputedStyle(s).height,10),f=m=>{let p=d+(m.clientX-o),w=c+(m.clientY-u);(t==="width"||t==="both")&&(e?s.style.width=`${Math.min(p,r)}px`:s.style.width=`${p}px`),(t==="height"||t==="both")&&(e?s.style.height=`${Math.min(w,a)}px`:s.style.height=`${w}px`)};document.addEventListener("pointermove",f),document.addEventListener("pointerup",()=>{this.releasePointerCapture(l.pointerId),document.removeEventListener("pointermove",f)},{once:!0}),this.setPointerCapture(l.pointerId)})}};T("resizable",Bs);T("grip",Ws);var Hs=class i extends Z{boot(){this._disableable=new V(this);let t=[];this._disableable.onInitAndChange(e=>{e?this.walker().each(s=>{s.hasAttribute("disabled")||(s.setAttribute("disabled",""),t.push(()=>s.removeAttribute("disabled")))}):(t.forEach(s=>s()),t=[])}),this._selectable=new ut(this,{multiple:!0}),this._controllable=new U(this,{disabled:this._disabled,bubbles:!0}),this.walker().each(e=>{e.addEventListener("input",s=>s.stopPropagation()),e.addEventListener("change",s=>s.stopPropagation())}),this._submittable=new Q(this,{name:this.getAttribute("name"),value:this.getAttribute("value"),includeWhenEmpty:!1}),this._controllable.initial(e=>e&&this._selectable.setState(e)),this._controllable.getter(()=>this._selectable.getState()),this._detangled=G(),this._controllable.setter(this._detangled(e=>{this._selectable.setState(e)})),this._selectable.onChange(this._detangled(()=>{this._controllable.dispatch()})),this._selectable.onInitAndChange(()=>{this._submittable.update(this._selectable.getState())}),h(this,"role","group"),queueMicrotask(()=>{this._submittable.update(this._selectable.getState())})}initCheckAll(t){let e=G();t._selectable.onChange(e(()=>{t.indeterminate?(this.selectAll(),t.checked=!0,t.indeterminate=!1):t.checked?(this.selectAll(),t.checked=!0,t.indeterminate=!1):(this.deselectAll(),t.checked=!1,t.indeterminate=!1)}));let s=()=>{this._selectable.allAreSelected()?(t.indeterminate=!1,t._selectable.select()):this._selectable.noneAreSelected()?(t.indeterminate=!1,t._selectable.deselect()):t.indeterminate=!0};this._selectable.onChange(e(()=>{s()})),s()}selectAll(){this.walker().filter(t=>!t.use(Y).isSelected()).map(t=>t.use(Y).select())}deselectAll(){this.walker().filter(t=>t.use(Y).isSelected()).map(t=>t.use(Y).deselect())}walker(){return tt(this,(t,{skip:e,reject:s})=>{if(t instanceof i)return s();if(t.localName!=="ui-checkbox")return e()})}},Us=class extends Z{boot(){let t=this;this.isIndeterminate=!1,this._disableable=new V(this),this.hasAttribute("all")?(this._selectable=new Y(t,{ungrouped:!0,toggleable:!0,value:this.hasAttribute("value")?this.getAttribute("value"):Math.random().toString(36).substring(2,10),label:this.hasAttribute("label")?this.getAttribute("label"):null,selectedInitially:this.hasAttribute("checked"),dataAttr:"data-checked",ariaAttr:"aria-checked"}),queueMicrotask(()=>{this.closest("ui-checkbox-group")?.initCheckAll(this)})):(this._selectable=new Y(t,{toggleable:!0,dataAttr:"data-checked",ariaAttr:"aria-checked",value:this.hasAttribute("value")?this.getAttribute("value"):Math.random().toString(36).substring(2,10),label:this.hasAttribute("label")?this.getAttribute("label"):null,selectedInitially:this.hasAttribute("checked")}),this._submittable=new Q(this,{name:this.getAttribute("name"),value:this.getAttribute("value")??"on",includeWhenEmpty:!1,shouldUpdateValue:!1}),this._selectable.onChange(()=>{this.indeterminate&&(this.indeterminate=!1)}),this._selectable.onInitAndChange(()=>{this._submittable.update(this._selectable.isSelected())}),queueMicrotask(()=>{this._submittable.update(this._selectable.isSelected())})),this._detangled=G(),this._selectable.onChange(this._detangled(()=>{this.dispatchEvent(new Event("input",{bubbles:!0,cancelable:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,cancelable:!0}))})),h(t,"role","checkbox"),this._disableable.onInitAndChange(e=>{e?x(t,"tabindex","0"):h(t,"tabindex","0")}),y(t,"click",this._disableable.disabled(e=>{e.preventDefault(),e.stopPropagation()}),{capture:!0}),y(t,"click",this._disableable.enabled(e=>{this._selectable.press()})),y(t,"keydown",this._disableable.enabled(e=>{e.key==="Enter"&&this.closest("form")?.requestSubmit()})),y(t,"keydown",this._disableable.enabled(e=>{e.key===" "&&(e.preventDefault(),e.stopPropagation())})),y(t,"keyup",this._disableable.enabled(e=>{e.key===" "&&(this._selectable.press(),e.preventDefault(),e.stopPropagation())})),Uo(t)}get value(){return this._selectable?.getValue()}set value(t){this._selectable&&(this._selectable.value=t+"",this._submittable&&(this._submittable.value=t+""))}get checked(){return this._selectable.isSelected()}set checked(t){let e=this.closest("ui-checkbox-group")?._detangled||(s=>s);this._detangled(e(()=>{t?this._selectable.select():this._selectable.deselect()}))()}get indeterminate(){return this.isIndeterminate}set indeterminate(t){this.isIndeterminate=!!t,this.isIndeterminate?h(this,"data-indeterminate",""):x(this,"data-indeterminate")}};T("checkbox-group",Hs);T("checkbox",Us);function Uo(i){i.closest("label")?.addEventListener("click",t=>{i.contains(t.target)||i._selectable.press()})}var Ys=class extends I{boot(){let t=this.trigger(),e=this.overlay();if(t){if(!e)return console.warn("ui-dropdown: no [popover] overlay found",this)}else return console.warn("ui-dropdown: no trigger element found",this);if(this._disabled=this.hasAttribute("disabled"),this._controllable=new U(this),e._popoverable=new rt(e),e._anchorable=new it(e,{reference:t,position:this.hasAttribute("position")?this.getAttribute("position"):void 0,gap:this.hasAttribute("gap")?this.getAttribute("gap"):void 0,offset:this.hasAttribute("offset")?this.getAttribute("offset"):void 0}),e._popoverable.onChange(()=>{e._popoverable.getState()?e._anchorable.reposition():e._anchorable.cleanup()}),!this.hasAttribute("hover")){let{lock:a,unlock:n}=ot(e._popoverable.el);e._popoverable.onChange(()=>{e._popoverable.getState()?a():n()})}this._controllable.initial(a=>e._popoverable.setState(a)),this._controllable.getter(()=>e._popoverable.getState());let s=G();if(this._controllable.setter(a=>e._popoverable.setState(a)),e._popoverable.onChange(s(()=>this._controllable.dispatch())),this.hasAttribute("hover")){let a=()=>{};ye(t,e,{gain(){e._popoverable.setState(!0),a=y(document,"scroll",()=>{e._popoverable.getState()&&(e._popoverable.setState(!1),a())}).off},lose(){e._popoverable.setState(!1),a()},focusable:!1})}y(t,"click",()=>e._popoverable.toggle()),e._popoverable.getState()?(h(this,"data-open",""),h(t,"data-open",""),h(e,"data-open","")):(x(this,"data-open"),x(t,"data-open"),x(e,"data-open")),e._popoverable.onChange(()=>{e._popoverable.getState()?(h(this,"data-open",""),h(t,"data-open",""),h(e,"data-open","")):(x(this,"data-open"),x(t,"data-open"),x(e,"data-open"))});let r=K(e,"dropdown");h(t,"aria-haspopup","true"),h(t,"aria-controls",r),h(t,"aria-expanded",e._popoverable.getState()?"true":"false"),e._popoverable.onChange(()=>{h(t,"aria-expanded",e._popoverable.getState()?"true":"false")}),e._popoverable.onChange(()=>{setTimeout(()=>e._popoverable.getState()?e.onPopoverShow?.():e.onPopoverHide?.())})}unmount(){if(this.overlay()?._popoverable?.getState()&&!this.hasAttribute("hover")){let{unlock:t}=ot();t()}}trigger(){return this.querySelector("button,ui-button,a")}overlay(){return this.lastElementChild?.matches("[popover]")&&this.lastElementChild}};T("dropdown",Ys);var zs=class extends I{boot(){this.type="file"}mount(){this._disableable=new V(this),this._files=[],this.inputEl=this.querySelector('input[data-slot="receiver"]'),this.inputEl&&(this.forwardAcceptAttribute(),this.configureSRInput()),this.triggerEl=this.findTriggerElement(),this.rootEl=this.closest("ui-file-upload");let t=this.hasAttribute("multiple")||this.rootEl&&this.rootEl.hasAttribute("multiple");t&&h(this.inputEl,"multiple",""),Object.defineProperty(this,"multiple",{get(){return t}}),Object.defineProperty(this,"files",{get(){return this._files},set(e){e===null||e===""?this._files=[]:Array.isArray(e)?this._files=e:e instanceof FileList?this._files=Array.from(e):this._files=[e],this.dispatchEvent(new Event("change",{bubbles:!0}))}}),this.observer=new MutationObserver(()=>{this.ensureInputsExist()}),this.observer.observe(this,{childList:!0}),this.style.setProperty("--flux-file-upload-progress","0%"),this.style.setProperty("--flux-file-upload-progress-as-string","'0%'"),y(this,"livewire-upload-start",()=>{h(this,"data-loading",""),this.disabled=!0,this.style.setProperty("--flux-file-upload-progress","0"),this.style.setProperty("--flux-file-upload-progress-as-string","'0%'")}),y(this,"livewire-upload-finish",()=>{x(this,"data-loading"),this.disabled=!1,this.style.setProperty("--flux-file-upload-progress","100%"),this.style.setProperty("--flux-file-upload-progress-as-string","'100%'")}),y(this,"livewire-upload-cancel",()=>{x(this,"data-loading"),this.disabled=!1,this.style.setProperty("--flux-file-upload-progress","0%"),this.style.setProperty("--flux-file-upload-progress-as-string","'0%'")}),y(this,"livewire-upload-error",()=>{x(this,"data-loading"),this.disabled=!1,this.style.setProperty("--flux-file-upload-progress","0%"),this.style.setProperty("--flux-file-upload-progress-as-string","'0%'")}),y(this,"livewire-upload-progress",e=>{let s=e.detail.progress;this.style.setProperty("--flux-file-upload-progress",`${s}%`),this.style.setProperty("--flux-file-upload-progress-as-string",`'${s}%'`)}),this._disableable.onInitAndChange(e=>{this.inputEl.disabled=e,this.triggerEl&&(e?x(this.triggerEl,"tabindex"):h(this.triggerEl,"tabindex","0"))}),y(this.inputEl,"click",e=>{e.stopPropagation(),this.clear()}),this.initDragListeners(),this.initClickListeners()}addFiles(t){let e=Array.from(t);this.multiple?this._files=[...this._files,...e]:this._files=e.slice(0,1),this.dispatchEvent(new Event("change",{bubbles:!0}))}removeFile(t){this._files=this._files.filter((e,s)=>s!==t),this.dispatchEvent(new Event("change",{bubbles:!0}))}clear(){this.inputEl.value=null,this._files=[]}forwardAcceptAttribute(){this.hasAttribute("accept")&&this.inputEl.setAttribute("accept",this.getAttribute("accept"))}configureSRInput(){this.inputEl.tabIndex=-1,Object.assign(this.inputEl.style,{position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:"0"})}findTriggerElement(){return Array.from(this.children).find(e=>!e.hasAttribute("data-slot"))}ensureInputsExist(){(!this.inputEl||!this.querySelector('input[data-slot="receiver"]'))&&(this.inputEl=this.querySelector('input[data-slot="receiver"]'),this.inputEl&&(this.configureSRInput(),(this.hasAttribute("multiple")||this.rootEl&&this.rootEl.hasAttribute("multiple"))&&h(this.inputEl,"multiple",""),this.inputEl.disabled=this.disabled)),(!this.triggerEl||!this.contains(this.triggerEl))&&(this.triggerEl=this.findTriggerElement(),this.triggerEl&&!this.disabled?h(this.triggerEl,"tabindex","0"):this.triggerEl&&this.disabled&&x(this.triggerEl,"tabindex"))}initDragListeners(){this.triggerEl&&(y(this.triggerEl,"dragenter",this._disableable.enabled(t=>{t.preventDefault(),h(this,"data-dragging",""),this.clear()})),y(this.triggerEl,"dragover",this._disableable.enabled(t=>{t.preventDefault(),h(this,"data-dragging","")})),y(this.triggerEl,"drop",this._disableable.enabled(t=>{t.preventDefault(),x(this,"data-dragging"),t.dataTransfer.files&&t.dataTransfer.files.length>0&&this.addFiles(t.dataTransfer.files)})),y(this.triggerEl,"dragleave",t=>{x(this,"data-dragging")}))}initClickListeners(){this.triggerEl&&(y(this.triggerEl,"click",this._disableable.disabled(t=>{t.preventDefault(),t.stopPropagation()}),{capture:!0}),y(this.triggerEl,"click",this._disableable.enabled(t=>{t.preventDefault(),this.inputEl.click()})),y(this.inputEl,"change",t=>{t.stopPropagation(),this.inputEl.files&&this.inputEl.files.length>0&&!this.disabled&&this.addFiles(this.inputEl.files)}),y(this.triggerEl,"keydown",this._disableable.enabled(t=>{["Enter"," "].includes(t.key)&&t.preventDefault(),["Enter"].includes(t.key)&&this.inputEl.click()})),y(this.triggerEl,"keyup",this._disableable.enabled(t=>{t.key===" "&&(t.preventDefault(),this.inputEl.click())})),y(this.triggerEl,"focus",this._disableable.enabled(()=>{h(this,"data-focus","")})),y(this.triggerEl,"blur",()=>{x(this,"data-focus")}))}};T("file-upload",zs);var B=class{static SELECTION=1;static ACTIVATION=2;static VIEW_CHANGE=3},Le=class{constructor(){this.subscribers=[],this.subscriberTypes=new WeakMap}subscribe(t,e){let s=Array.isArray(t)?t:[t];this.subscribers.push(e),this.subscriberTypes.has(e)||this.subscriberTypes.set(e,[]),this.subscriberTypes.get(e).push(...s)}notify(t){let e=Array.isArray(t)?t:[t];this.subscribers.forEach(s=>{e.length&&!this.subscriberTypes.get(s)?.some(r=>e.includes(r))||s()})}};var lt=class{static SINGLE="single";static MULTIPLE="multiple";static RANGE="range"},Bi=class i{constructor(t,e,s){this.config=e,this.observable=s,this.selection=t,this.active=null,this.displayResolver=r=>r}setDisplayResolver(t){this.displayResolver=t}select(t){let e=this.selection;this.selection=this.selection.select(t,this.config),this.selection.shouldNotify(e)?this.observable.notify(B.SELECTION):this.observable.notify(B.ACTIVATION)}activate(t){let e=this.active;t?this.active=t:this.active=null,this.selection.activate(t),e!==this.active&&this.observable.notify(B.ACTIVATION)}setValue(t){let e=this.selection;this.selection=this.createSelectionFromValue(t,this.config),this.selection.shouldNotify(e)?this.observable.notify(B.SELECTION):this.observable.notify(B.ACTIVATION)}getValue(){return this.selection.value()}isSelectable(t){return this.selection.selectable(t,this.config)}contains(...t){return this.selection.contains(...t)}hasSelection(){return this.selection.hasSelection()}lowerBound(...t){return this.selection.lowerBound(...t)}upperBound(...t){return this.selection.upperBound(...t)}display(...t){return this.displayResolver(this.selection.display(...t))}attributes(...t){return this.selection.attributes(...t)}createSelectionFromValue(t,e){if(e.mode===lt.MULTIPLE){let s=t?t.map(r=>g.fromIsoDateString(r)):[];return new Hi(s)}else if(e.mode===lt.RANGE){let{start:s,end:r,preset:a}=t||{};return a&&Yi[a]&&a!=="custom"?new Ui(a,e):!s&&!r?new Qe:r?new ti(g.fromIsoDateString(s),g.fromIsoDateString(r)):new Xt(g.fromIsoDateString(s))}else return t?new Ze(g.fromIsoDateString(t)):new Je}static createFromValueStringAttribute(t,e,s){let r=i.createSelectionFromValueStringAttribute(t,e);return new i(r,e,s)}static createSelectionFromValueStringAttribute(t,e){if(e.mode===lt.MULTIPLE){let s=t?t.split(",").map(r=>r.trim()).map(r=>g.fromIsoDateString(r)):[];return new Hi(s)}else if(e.mode===lt.RANGE){if(!t)return new Qe;let[s,r]=t.split("/").map(a=>a.trim());return!r&&s&&Yi[s]&&s!=="custom"?new Ui(s,e):(s=g.fromIsoDateString(s),r?(r=g.fromIsoDateString(r),new ti(s,r)):new Xt(s))}else return t?new Ze(g.fromIsoDateString(t)):new Je}},Wi=class{constructor(t,e){this.selectable=t,this.observable=e,this._selection=this.selectable.selection,this.selectable.observable.subscribe(B.SELECTION,()=>{this._blockSync()||this.sync()}),this._blockSync=()=>{}}blockSyncIf(t){this._blockSync=t}sync(){this._selection=this.selectable.selection,this.observable.notify(B.SELECTION)}setValue(t){return this.selectable.setValue(t)}getValue(){return this._selection.value()}isSelectable(t){return this._selection.selectable(t,this.config)}hasSelection(){return this._selection.hasSelection()}display(...t){return this.selectable.displayResolver(this._selection.display(...t))}},qt=class{contains(){}shouldNotify(t){return!0}hasSelection(){return!1}lowerBound(t){return ei(t)}upperBound(t){return this.lowerBound(t)}selectable(t,e){return!0}display(){}value(){}activate(){}attributes(t,e){this.contains(e)?(h(t,"data-selected",""),h(t,"aria-selected","true")):(x(t,"data-selected"),h(t,"aria-selected","false"))}},Je=class i extends qt{shouldNotify(t){return!(t instanceof i)}hasSelection(){return!1}contains(){return!1}select(t){return new Ze(t)}lowerBound(t){return ei(t)}display(t){return""}value(){return null}},Ze=class i extends qt{constructor(t){super(),this._date=t}hasSelection(){return!0}shouldNotify(t){return!(t instanceof i&&this._date.isSameDay(t._date))}select(t){return this._date.isSameDay(t)?new Je:new i(t)}contains(t){return this._date.isSameDay(t)}lowerBound(){return this._date}display(t){return this._date.toFormattedString(t,{day:"numeric",month:"short",year:"numeric"})}value(){return this._date.toIsoDateString()}},Hi=class i extends qt{constructor(t){super(),this._dates=t}hasSelection(){return this._dates.length>0}shouldNotify(t){return!(t instanceof i&&this._dates.every(e=>t._dates.includes(e))&&t._dates.every(e=>this._dates.includes(e)))}select(t){return this._dates.some(s=>s.isSameDay(t))?new i(this._dates.filter(s=>!s.isSameDay(t))):new i([...this._dates,t])}contains(t){return this._dates.some(e=>e.isSameDay(t))}lowerBound(t){return this._dates.sort((s,r)=>s.isBefore(r)?-1:1)[0]||ei(t)}upperBound(t){let e=this._dates.sort((s,r)=>s.isBefore(r)?-1:1);return e[e.length-1]||ei(t)}display(t){return this._dates.map(e=>e.toFormattedString(t,{day:"numeric",month:"short",year:"numeric"})).join(", ")}value(){return this._dates.map(t=>t.toIsoDateString())}},Qe=class i extends qt{constructor(){super()}hasSelection(){return!1}shouldNotify(t){return!(t instanceof i||t instanceof Xt)}select(t){return new Xt(t)}contains(){return!1}lowerBound(t){return ei(t)}display(t){return""}value(){return null}},Xt=class i extends qt{constructor(t){super(),this._start=t,this._endPreview=null}hasSelection(){return!1}shouldNotify(t){return!1}select(t,e){return t.isBefore(this._start)?new i(t):t.isSameDay(this._start)&&e.minRange>1?new Qe:new ti(this._start,t)}activate(t){this._endPreview=t}selectable(t,e){if(e.maxRange&&(t.isBefore(this._start)||this._start.addDays(e.maxRange-1).isBefore(t)))return!1;if(e.minRange){if(this._start.isSameDay(t))return!0;if(t.isBefore(this._start)||this._start.addDays(e.minRange-1).isAfter(t))return!1}let s=e.unavailable.filter(a=>a.isAfter(this._start)).sort((a,n)=>a.toDate()-n.toDate())[0],r=e.unavailable.filter(a=>a.isBefore(this._start)).sort((a,n)=>n.toDate()-a.toDate())[0];return t.isAfter(this._start)?!s||t.isBefore(s):t.isBefore(this._start)?!r||t.isAfter(r):!0}contains(t){return t.isSameDay(this._start)}lowerBound(){return this._start}display(t){return new Intl.DateTimeFormat(t,{day:"numeric",month:"short",year:"numeric",timeZone:"UTC"}).format(this._start.getDate())+" -"}value(){return null}attributes(t,e){this._endPreview&&e.isBetween(this._start,this._endPreview)?(h(t,"data-in-range",""),h(t,"aria-selected","true")):(x(t,"data-in-range"),x(t,"aria-selected")),e.isSameDay(this._start)?h(t,"data-selected",""):x(t,"data-selected"),e.isSameDay(this._start)?h(t,"aria-selected","true"):x(t,"aria-selected"),e.isSameDay(this._start)?h(t,"data-start",""):x(t,"data-start"),e.isSameDay(this._endPreview)?h(t,"data-end-preview",""):x(t,"data-end-preview")}},ti=class i extends qt{constructor(t,e){super(),this._start=t,this._end=e}hasSelection(){return!0}shouldNotify(t){return!(t instanceof i&&this._start.isSameDay(t._start)&&this._end.isSameDay(t._end))}select(t){return new Xt(t)}contains(t){return t.isBetween(this._start,this._end)}lowerBound(){return this._start}upperBound(){return this._end}display(t){return new Intl.DateTimeFormat(t,{day:"numeric",month:"short",year:"numeric",timeZone:"UTC"}).formatRange(this._start.getDate(),this._end.getDate()).replaceAll("\u2009"," ")}value(){return{start:this._start.toIsoDateString(),end:this._end.toIsoDateString()}}attributes(t,e){e.isSameDay(this._start)||e.isSameDay(this._end)?h(t,"data-selected",""):x(t,"data-selected"),e.isSameDay(this._start)?h(t,"data-start",""):x(t,"data-start"),e.isSameDay(this._end)?h(t,"data-end",""):x(t,"data-end"),this.contains(e)?(h(t,"data-in-range",""),h(t,"aria-selected","true")):(x(t,"data-in-range"),x(t,"aria-selected"))}},Ui=class i extends qt{constructor(t,e){super(),this._preset=t,this._config=e}get _start(){let[t]=Yi[this._preset](this._config);return this._config.min&&t.isBefore(this._config.min)?this._config.min:t}get _end(){let[,t]=Yi[this._preset](this._config);return this._config.max&&t.isAfter(this._config.max)?this._config.max:t}hasSelection(){return!0}shouldNotify(t){return!(t instanceof i&&this._preset===t._preset)}select(t){return new Xt(t,this._config)}contains(t){return t.isBetween(this._start,this._end)}lowerBound(){return this._preset==="allTime"?g.today():this._start}upperBound(){return this._preset==="allTime"?g.today():g.today()}display(t){return new Intl.DateTimeFormat(t,{day:"numeric",month:"short",year:"numeric",timeZone:"UTC"}).formatRange(this._start.getDate(),this._end.getDate()).replaceAll("\u2009"," ")}value(){return{start:this._start.toIsoDateString(),end:this._end.toIsoDateString(),preset:this._preset}}attributes(t,e){e.isSameDay(this._start)||e.isSameDay(this._end)?h(t,"data-selected",""):x(t,"data-selected"),e.isSameDay(this._start)?h(t,"data-start",""):x(t,"data-start"),e.isSameDay(this._end)?h(t,"data-end",""):x(t,"data-end"),this.contains(e)?(h(t,"data-in-range",""),h(t,"aria-selected","true")):(x(t,"data-in-range"),x(t,"aria-selected"))}};function ei(i=null){return typeof i=="function"?i():i}var Yi={today:()=>[g.today(),g.today()],yesterday:()=>{let i=g.today().incrementDays(-1);return[i,i]},thisWeek:i=>{let t=g.today().getCopy().incrementDays(i.startDay-g.today().getDayOfWeek()),e=t.incrementDays(6);return[t,e]},lastWeek:i=>{let t=g.today().incrementDays(i.startDay-(g.today().getDayOfWeek()+7)),e=t.incrementDays(6);return[t,e]},last7Days:()=>{let i=g.today();return[g.today().incrementDays(-6),i]},thisMonth:()=>{let i=g.fromParts(g.today().getYear(),g.today().getMonth(),1),t=g.fromParts(g.today().getYear(),g.today().getMonth(),g.today().getDaysInMonth());return[i,t]},lastMonth:()=>{let i=g.today().getMonth()-1,t=g.today().getYear();i<1&&(i+=12,t--);let e=g.fromParts(t,i,1),s=g.fromParts(t,i,e.getDaysInMonth());return[e,s]},thisQuarter:()=>{let t=Math.floor((g.today().getMonth()-1)/3)*3+1,e=t+2,s=g.fromParts(g.today().getYear(),t,1),r=g.fromParts(g.today().getYear(),e,1),a=g.fromParts(g.today().getYear(),e,r.getDaysInMonth());return[s,a]},lastQuarter:()=>{let t=Math.floor((g.today().getMonth()-4)/3)*3+1,e=t+2,s=g.today().getYear();t<1&&(t+=12,e+=12,s--);let r=g.fromParts(s,t,1),a=g.fromParts(s,e,1),n=g.fromParts(s,e,a.getDaysInMonth());return[r,n]},thisYear:()=>{let i=g.fromParts(g.today().getYear(),1,1),t=g.fromParts(g.today().getYear(),12,31);return[i,t]},lastYear:()=>{let i=g.today().getYear()-1,t=g.fromParts(i,1,1),e=g.fromParts(i,12,31);return[t,e]},last14Days:()=>{let i=g.today();return[g.today().incrementDays(-13),i]},last30Days:()=>{let i=g.today();return[g.today().incrementDays(-29),i]},last3Months:()=>{let i=g.today(),t=g.today().getDay()+1,e=g.today().getMonth()-3,s=g.today().getYear();return e<1&&(e+=12,s--),[g.fromParts(s,e,t),i]},last6Months:()=>{let i=g.today(),t=g.today().getDay()+1,e=g.today().getMonth()-6,s=g.today().getYear();return e<1&&(e+=12,s--),[g.fromParts(s,e,t),i]},yearToDate:()=>{let i=g.fromParts(g.today().getYear(),1,1),t=g.today();return[i,t]},tomorrow:()=>{let i=g.today().incrementDays(1);return[i,i]},nextWeek:i=>{let t=g.today().incrementDays(7+i.startDay-g.today().getDayOfWeek()),e=t.incrementDays(6);return[t,e]},next7Days:()=>{let i=g.today(),t=g.today().incrementDays(6);return[i,t]},nextMonth:()=>{let i=g.today().getMonth()+1,t=g.today().getYear();i>12&&(i-=12,t++);let e=g.fromParts(t,i,1),s=g.fromParts(t,i,e.getDaysInMonth());return[e,s]},nextQuarter:()=>{let t=(Math.floor((g.today().getMonth()-1)/3)+1)*3+1,e=g.today().getYear();t>12&&(t-=12,e++);let s=t+2;s>12&&(s-=12,e++);let r=g.fromParts(e,t,1),a=g.fromParts(e,s,1),n=g.fromParts(e,s,a.getDaysInMonth());return[r,n]},nextYear:()=>{let i=g.today().getYear()+1,t=g.fromParts(i,1,1),e=g.fromParts(i,12,31);return[t,e]},next14Days:()=>{let i=g.today(),t=g.today().incrementDays(13);return[i,t]},next30Days:()=>{let i=g.today(),t=g.today().incrementDays(29);return[i,t]},next3Months:()=>{let i=g.today(),t=g.today().getDay(),e=g.today().getMonth()+3,s=g.today().getYear();e>12&&(e-=12,s++);let r=g.fromParts(s,e,t).incrementDays(-1);return[i,r]},next6Months:()=>{let i=g.today(),t=g.today().getDay(),e=g.today().getMonth()+6,s=g.today().getYear();e>12&&(e-=12,s++);let r=g.fromParts(s,e,t).incrementDays(-1);return[i,r]},allTime:i=>{if(!i.min)throw new Error("Min date is required for allTime preset");let t=i.min,e=g.today();return[t,e]}};var zi=class{constructor(t,e,s,r){this.month=t,this.year=e,this.config=s,this.observable=r}generateOffsetState(t){return new Gs(this,t)}canNavigatePrevious(){let[t,e]=new g(this.year,this.month).addMonths(-1).toParts();return!(this.config.min&&g.fromParts(t,e).isBefore(g.firstDayOfMonth(this.config.min)))}canNavigateNext(){let[t,e]=new g(this.year,this.month).addMonths(this.config.months).toParts();return!(this.config.max&&g.fromParts(t,e).isAfter(this.config.max))}nextMonth(){this.canNavigateNext()&&this.adjustMonth(1)}previousMonth(){this.adjustMonth(-1)}setMonth(t){t&&(this.isWithinMinAndMax(t,this.year)&&(this.month=t),this.observable.notify(B.VIEW_CHANGE))}setYear(t){if(!t)return;let e=this.month;this.isWithinMinAndMax(e,t)||(this.config.min&&g.fromParts(t,e).isBefore(g.firstDayOfMonth(this.config.min))?e=this.config.min.getMonth():this.config.max&&g.fromParts(t,e).isAfter(this.config.max)&&(e=this.config.max.getMonth())),this.isWithinMinAndMax(e,t)&&(this.month=e,this.year=t),this.observable.notify(B.VIEW_CHANGE)}setDate(t){t&&(this.isWithinMinAndMax(t.getMonth(),t.getYear())&&(this.month=t.getMonth(),this.year=t.getYear()),this.observable.notify(B.VIEW_CHANGE))}isWithinMinAndMax(t,e){return!(this.config.min&&g.fromParts(e,t).isBefore(g.firstDayOfMonth(this.config.min))||this.config.max&&g.fromParts(e,t).isAfter(this.config.max))}adjustMonth(t){let[e,s]=new g(this.year,this.month).addMonths(t).toParts();this.config.min&&g.fromParts(e,s).isBefore(g.firstDayOfMonth(this.config.min))||this.config.max&&g.fromParts(e,s).isAfter(this.config.max)||([this.month,this.year]=[s,e],this.observable.notify(B.VIEW_CHANGE))}},Gs=class{constructor(t,e=0){this.offset=e,this.viewState=t}get month(){let[,t]=new g(this.viewState.year,this.viewState.month).addMonths(this.offset).toParts();return t}get year(){let[t]=new g(this.viewState.year,this.viewState.month).addMonths(this.offset).toParts();return t}};var Gi=class{constructor(t,e,s){this.min=s.min,this.max=s.max,this.unavailable=s.unavailable,this.selectable=t,this.metadata=e}isBetweenMinMax(t){return t.isBetween(this.min,this.max)}isUnavailable(t){return this.unavailable.some(e=>e.isSameDay(t))||this.metadata.unavailable(t)}isBlocked(t){return!this.selectable.isSelectable(t)}isValid(t){return this.isBetweenMinMax(t)&&!this.isUnavailable(t)&&!this.isBlocked(t)}};var Ki=class{constructor(t){this.metadata={},this.observable=t}resetFromJSON(t){this.reset(JSON.parse(t))}appendFromJSON(t){this.append(JSON.parse(t))}append(t){this.metadata={...this.metadata,...t},this.observable.notify(B.VIEW_CHANGE)}reset(t){this.metadata=t,this.observable.notify(B.VIEW_CHANGE)}get(t){return this.metadata[t.toIsoDateString()]}has(t){return this.metadata[t.toIsoDateString()]!==void 0}subtext(t){return this.metadata[t.toIsoDateString()]?.subtext}details(t){return this.metadata[t.toIsoDateString()]?.details}variant(t){return this.metadata[t.toIsoDateString()]?.variant}unavailable(t){return!!this.metadata[t.toIsoDateString()]?.unavailable}};var Ks=class extends I{boot(){let t=this.closest("ui-date-picker")||this;this.querySelectorAll("[data-appended]").forEach(o=>o.remove());let[e,s]=ua(t,"months",1);this.observable=new Le;let r=t.hasAttribute("locale")?t.getAttribute("locale"):Ai();this.config={mode:t.getAttribute("mode")==="range"?lt.RANGE:t.hasAttribute("multiple")?lt.MULTIPLE:lt.SINGLE,months:parseInt(e),min:this.getMinDate(t),max:this.getMaxDate(t),maxRange:t.hasAttribute("max-range")?parseInt(t.getAttribute("max-range")):null,minRange:t.hasAttribute("min-range")?parseInt(t.getAttribute("min-range")):null,startDay:t.hasAttribute("start-day")?parseInt(t.getAttribute("start-day")):(new Intl.Locale(r).getWeekInfo?.()?.firstDay??new Intl.Locale(r).weekInfo?.firstDay??7)%7,unavailable:this.getUnavailableDates(t),locale:r,fixedWeeks:t.hasAttribute("fixed-weeks")?6:null},s(o=>{this.config.months=parseInt(o),this.observable.notify(B.VIEW_CHANGE)}),this.selectable=Bi.createFromValueStringAttribute(t.getAttribute("value"),this.config,this.observable),this.metadata=new Ki(this.observable),this.validator=new Gi(this.selectable,this.metadata,this.config);let a=t.hasAttribute("open-to")&&(t.hasAttribute("force-open-to")||this.selectable.lowerBound()===null)?this.getOpenTo(t):this.selectable.lowerBound(()=>g.today());if(this.viewState=new zi(a.getMonth(),a.getYear(),this.config,this.observable),this._disableable=new V(this,{disableWithParent:!1}),!this.hasAttribute("static")){let{enable:o,disable:u}=Yo(this,this.selectable,this.viewState,this.validator);this._disableable.onInitAndChange(d=>{d?u():o()})}this._controllable=new U(this,{bubbles:!0}),this._submittable=new Q(this,{name:this.getAttribute("name"),value:this.selectable.getValue()});let n=G();this._controllable.initial(o=>o&&this.selectable.setValue(o)),this._controllable.getter(()=>this.selectable.getValue()),this._controllable.setter(n(o=>{this.selectable.setValue(o)})),this.observable.subscribe(B.SELECTION,n(()=>{this.dispatchEvent(new Event("select",{bubbles:!1,cancelable:!0})),this._controllable.dispatch()})),this.observable.subscribe(B.SELECTION,()=>{this._submittable.update(this.selectable.getValue())}),this.observable.subscribe(B.SELECTION,()=>{this.anchorSelection(t)}),this.observable.subscribe(B.VIEW_CHANGE,()=>{this.dispatchEvent(new Event("navigate",{bubbles:!1,cancelable:!0}))}),queueMicrotask(()=>{this.closest("ui-date-picker")?.bootWithCalendar(this)}),new MutationObserver(o=>{o.forEach(u=>{["unavailable","max","min"].includes(u.attributeName)&&(this.config.unavailable=this.getUnavailableDates(t),this.config.min=this.getMinDate(t),this.config.max=this.getMaxDate(t),this.validator.unavailable=this.config.unavailable,this.validator.min=this.config.min,this.validator.max=this.config.max,this.observable.notify(B.VIEW_CHANGE))})}).observe(t,{attributes:!0})}getOpenTo(t){if(!t.hasAttribute("open-to"))return;let e=t.getAttribute("open-to");return e=e==="today"?g.today():g.fromIsoDateString(e),this.validator.isBetweenMinMax(e)?e:this.config.min}navigateNext(){this.viewState.nextMonth()}navigatePrevious(){this.viewState.previousMonth()}anchorSelection(t){let e=document.activeElement;this.contains(e)&&e.closest("[data-date]")!==null||t.hasAttribute("force-open-to")||this.viewState.setDate(this.selectable.lowerBound(g.today()))}appendMetadata(t){this.metadata.append(t)}resetMetadata(t={}){this.metadata.reset(t)}visibleDateRange(){return[g.fromParts(this.viewState.year,this.viewState.month,1).toIsoDateString(),g.fromParts(this.viewState.year,this.viewState.month+1,0).toIsoDateString()]}getUnavailableDates(t){return t.hasAttribute("unavailable")?t.getAttribute("unavailable").split(",").map(e=>g.fromIsoDateString(e.trim())):[]}getMinDate(t){return t.hasAttribute("min")?t.getAttribute("min")==="today"?g.today():g.fromIsoDateString(t.getAttribute("min")):null}getMaxDate(t){return t.hasAttribute("max")?t.getAttribute("max")==="today"?g.today():g.fromIsoDateString(t.getAttribute("max")):null}},Xs=class extends I{boot(){let t=this.closest("ui-calendar");this._disableable=t._disableable,we(this,()=>this._disableable.isDisabled(),()=>t.navigatePrevious());let e=()=>{t.viewState.canNavigatePrevious()&&!this._disableable.isDisabled()?x(this,"disabled"):h(this,"disabled","")};t.observable.subscribe(B.VIEW_CHANGE,e),this._disableable.onInitAndChange(()=>{e()})}},js=class extends I{boot(){let t=this.closest("ui-calendar");this._disableable=t._disableable,we(this,()=>this._disableable.isDisabled(),()=>t.navigateNext());let e=()=>{t.viewState.canNavigateNext()&&!this._disableable.isDisabled()?x(this,"disabled"):h(this,"disabled","")};t.observable.subscribe(B.VIEW_CHANGE,e),this._disableable.onInitAndChange(()=>{e()})}},Js=class extends I{boot(){let t=this.closest("ui-calendar");this._disableable=t._disableable,this.offset=this.hasAttribute("offset")?parseInt(this.getAttribute("offset")):0,this.config=t.config,this.viewState=t.viewState,this.offsetState=this.viewState.generateOffsetState(this.offset),this.validator=t.validator;let e=this.querySelector("select"),s=this.hasAttribute("display")?this.getAttribute("display"):"long";if(e)this.renderSelectOptions(e,s),e.value=this.viewState.month,e.addEventListener("change",this._disableable.enabled(()=>{this.viewState.setMonth(parseInt(e.value))})),t.observable.subscribe(B.VIEW_CHANGE,()=>{this.renderSelectOptions(e,s),e.value=this.viewState.month}),this._disableable.onInitAndChange(r=>{r?h(e,"disabled",""):x(e,"disabled")});else{let r=()=>this.textContent=new Intl.DateTimeFormat(this.config.locale,{month:this.hasAttribute("display")?this.getAttribute("display"):"long",timeZone:"UTC"}).format(new g(this.offsetState.year,this.offsetState.month).getDate());r(),this.viewState.observable.subscribe(B.VIEW_CHANGE,()=>r())}}renderSelectOptions(t,e){let r=Array.from({length:12},(a,n)=>n+1).map(a=>{let n=new g(this.viewState.year,a),l=new g(this.viewState.year,a+1,0);return!this.validator.isBetweenMinMax(n)&&!this.validator.isBetweenMinMax(l)?null:{month:a,label:new Intl.DateTimeFormat(this.config.locale,{month:e,timeZone:"UTC"}).format(new g(2024,a).getDate())}}).filter(Boolean);at(t.querySelector("template"),a=>{if(r.length===0){let n=this.viewState.month,l=new Intl.DateTimeFormat(this.config.locale,{month:e,timeZone:"UTC"}).format(new g(2024,n).getDate()),o=a({slots:{default:l}});return o.setAttribute("value",n),o}return r.map(n=>{let l=a({slots:{default:n.label}});return l.setAttribute("value",n.month),l})})}},Zs=class extends I{boot(){let t=this.closest("ui-calendar");this._disableable=t._disableable,this.offset=this.hasAttribute("offset")?parseInt(this.getAttribute("offset")):0,this.config=t.config,this.viewState=t.viewState,this.offsetState=this.viewState.generateOffsetState(this.offset),this.numberOfPastYears=100,this.numberOfFutureYears=10,this.validator=t.validator;let e=this.querySelector("select");if(e)this.config.min&&(this.numberOfPastYears=this.viewState.year-this.config.min.getYear()),this.config.max&&(this.numberOfFutureYears=this.config.max.getYear()-this.viewState.year),this.renderSelectOptions(e),e.value=this.viewState.year,e.addEventListener("change",this._disableable.enabled(()=>{this.viewState.setYear(parseInt(e.value))})),t.observable.subscribe(B.VIEW_CHANGE,()=>{this.yearIsLessThanMinimum(this.viewState.year)&&(this.numberOfPastYears+=100,this.renderSelectOptions(e)),this.yearIsGreaterThanMaximum(this.viewState.year)&&(this.numberOfFutureYears+=10,this.renderSelectOptions(e)),e.value=this.viewState.year}),this._disableable.onInitAndChange(s=>{s?h(e,"disabled",""):x(e,"disabled")});else{let s=()=>this.textContent=new Intl.DateTimeFormat(this.config.locale,{year:this.hasAttribute("display")?this.getAttribute("display"):"numeric",timeZone:"UTC"}).format(new g(this.offsetState.year,this.offsetState.month).getDate());s(),this.viewState.observable.subscribe(B.VIEW_CHANGE,()=>s())}}yearIsLessThanMinimum(t){return t<this.minimumYear()}yearIsGreaterThanMaximum(t){return t>this.maximumYear()}minimumYear(){return new Date().getFullYear()-this.numberOfPastYears}maximumYear(){return new Date().getFullYear()+this.numberOfFutureYears}renderSelectOptions(t){let e=new Date().getFullYear(),r=Array.from({length:this.numberOfPastYears+this.numberOfFutureYears+1},(a,n)=>e-this.numberOfPastYears+n).map(a=>{let n=new g(a,1),l=new g(a,12,31);return this.config.min&&l.isBefore(this.config.min)||this.config.max&&n.isAfter(this.config.max)?null:a}).filter(Boolean);at(t.querySelector("template"),a=>{if(r.length===0){let n=this.viewState.year;return a({slots:{default:n}})}return r.map(n=>a({slots:{default:n}}))})}},Qs=class extends I{boot(){let t=this.closest("ui-calendar");this._disableable=t._disableable,this.offset=this.hasAttribute("offset")?parseInt(this.getAttribute("offset")):0,this.config=t.config,this.selectable=t.selectable,this.observable=t.observable,this.metadata=t.metadata,this.validator=t.validator,this.viewState=t.viewState,this.offsetState=this.viewState.generateOffsetState(this.offset),this.monthEls=[],this.renderMonths();let e=()=>this.monthEls.forEach(a=>za(a,this.config,a.offsetState,this.metadata)),s=()=>this.monthEls.forEach(a=>Ga(a,this._disableable.isDisabled(),this.config,a.offsetState,this.selectable,this.validator));e(),s();let r=this.config.months;this.viewState.observable.subscribe(B.VIEW_CHANGE,()=>{r!==this.config.months&&(r=this.config.months,this.renderMonths()),e(),s()}),this.observable.subscribe([B.SELECTION,B.ACTIVATION],()=>{s()}),this._disableable.onChange(()=>s())}renderMonths(){let t=this.querySelector('template:not([name]), template[name="month"]');at(t,e=>{let s=Array.from({length:this.config.months}).map((r,a)=>a);return this.monthEls=s.map(r=>{let a=this.viewState.generateOffsetState(r),n=e({attrs:{"data-month":""}});n.offsetState=a;let l=n.querySelector("thead")?.set;return h(n,"role","grid"),l&&h(l,"aria-hidden","true"),n}),this.monthEls})}},tr=class extends I{boot(){let t=this.closest("ui-calendar, ui-date-picker");this._disableable=t._disableable,this.behavior=this.hasAttribute("behavior")?this.getAttribute("behavior"):"auto",t.hasAttribute("static")&&(this.behavior="none"),we(this,()=>this._disableable.isDisabled(),()=>this.navigateAndSelectToday()),this._disableable.onInitAndChange(s=>{s?h(this,"disabled",""):x(this,"disabled")});let e=this.querySelector("template");e&&at(e,s=>s({slots:{default:g.today().getDay()}}))}navigateAndSelectToday(){let t=this.closest("ui-calendar, ui-date-picker"),e=()=>{let r=t.viewState,a=g.today();return r.year===a.getYear()&&r.month===a.getMonth()};(this.behavior==="select"||this.behavior==="auto"&&e())&&(t.config.mode===lt.RANGE?t.selectable.setValue({start:g.today().toIsoDateString(),end:g.today().toIsoDateString()}):t.config.mode===lt.MULTIPLE?t.selectable.setValue([g.today().toIsoDateString()]):t.selectable.setValue(g.today().toIsoDateString())),t.viewState.setMonth(g.today().getMonth()),t.viewState.setYear(g.today().getYear())}},er=class extends I{boot(){let t=this.closest("ui-calendar");if(this._disableable=t._disableable,this.offset=this.hasAttribute("offset")?parseInt(this.getAttribute("offset")):0,this.selectable=t.selectable,this.observable=t.observable,this.config=t.config,this.viewState=t.viewState,this.offsetState=this.viewState.generateOffsetState(this.offset),this.config.mode!==lt.RANGE)throw"Presets can only be used with range calendars";let e=this.firstElementChild;if(e){let s=r=>{if(e._selectable instanceof ut){let a=e._selectable.findByValue(r);return a?a?.el?.textContent:null}else if(e instanceof HTMLSelectElement)return e.querySelector(`option[value="${r}"]`)?.textContent;return null};this.selectable.setDisplayResolver(r=>{let a=this.selectable.getValue()?.preset||"";if(a){let n=s(a);if(n)return n}return r}),e.value=this.selectable.getValue()?.preset||"custom",e.addEventListener("change",this._disableable.enabled(()=>{if(["","custom"].includes(e.value)){let{start:r,end:a}=this.selectable.getValue()||{};r&&a&&this.selectable.setValue({start:r,end:a})}else this.selectable.setValue({preset:e.value})})),this.observable.subscribe(B.SELECTION,()=>{let r=this.selectable.getValue();e.value=r?.preset||"custom"}),this._disableable.onInitAndChange(r=>{r?h(e,"disabled",""):x(e,"disabled")})}}},ir=class extends I{boot(){let t=this.closest("ui-calendar");this._disableable=t._disableable,this.offset=this.hasAttribute("offset")?parseInt(this.getAttribute("offset")):0,this.selectable=t.selectable,this.observable=t.observable,this.config=t.config,this.viewState=t.viewState,this.offsetState=this.viewState.generateOffsetState(this.offset);let[e,s]=this.querySelectorAll("input");this.config.mode===lt.RANGE?ar(e,s,t):rr(e,t)}};T("calendar",Ks);T("calendar-today",tr);T("calendar-presets",er);T("calendar-previous",Xs);T("calendar-inputs",ir);T("calendar-next",js);T("calendar-months",Qs);T("calendar-month",Js);T("calendar-year",Zs);function Yo(i,t,e,s){let r=!1,a=i.hasAttribute("readonly");return y(i,"click",n=>{if(r||a)return;let l=n.target.closest("[data-date]");if(!l)return;let o=Me(l);s.isValid(o)&&t.select(o)}),y(i,"mouseover",n=>{if(r||a)return;let l=n.target.closest("[data-date]");if(!l)return;let o=Me(l);s.isValid(o)&&t.activate(o)}),y(i,"mouseout",()=>{r||a||t.activate(null)}),y(i,"focusin",n=>{if(r||a)return;let l=n.target.closest("[data-date]");if(!l)return;let o=Me(l);s.isValid(o)&&t.activate(o)}),y(i,"keydown",n=>{if(r)return;let l=n.target.closest("[data-date]");if(!l)return;let o=!0,u,d=Me(l),c=f=>{let m=d.getCopy(),p=Math.sign(f),w=366;for(m.setDay(m.getDay()+f);!s.isValid(m)&&w>0;)m.setDay(m.getDay()+p),w--;d=m};switch(n.key){case"ArrowRight":u="forward",c(1);break;case"ArrowLeft":u="backward",c(-1);break;case"ArrowUp":u="backward",c(-7);break;case"ArrowDown":u="forward",c(7);break;case"Home":e.previousMonth();break;case"End":e.nextMonth();break;case"PageUp":n.shiftKey,e.previousMonth();break;case"PageDown":n.shiftKey,e.nextMonth();break;default:o=!1}if(o){n.preventDefault(),n.stopPropagation();let f=Array.from(i.querySelectorAll("[data-date]")).find(m=>Me(m).isSameDay(d));!f&&u&&(u==="forward"?e.nextMonth():e.previousMonth(),f=Array.from(i.querySelectorAll("[data-date]")).find(m=>Me(m).isSameDay(d))),f?.querySelector("button,ui-button")?.focus()}}),{enable(){r=!1},disable(){r=!0}}}function Me(i){return!i||!i.hasAttribute("data-date")?null:g.fromIsoDateString(i.getAttribute("data-date"))}function rr(i,t){sr(i);let e=G(),s=e(()=>{let r=t.selectable.getValue();i.value=r||""});t.observable.subscribe(B.SELECTION,s),s(),i.addEventListener("change",e(()=>{let r=i.valueAsDate;r?(t.selectable.setValue(g.fromLocalDate(r).toIsoDateString()),t.viewState.setDate(g.fromLocalDate(r))):t.selectable.setValue("")}))}function ar(i,t,e){sr(i),sr(t);let s=G(),r=s(()=>{let{start:n,end:l}=e.selectable.getValue()||{};i.value=n||"",t.value=l||""}),a=s(()=>{let n=i.valueAsDate,l=t.valueAsDate;n&&l?e.selectable.setValue({start:g.fromLocalDate(n).toIsoDateString(),end:g.fromLocalDate(l).toIsoDateString()}):n?e.selectable.setValue({start:g.fromLocalDate(n).toIsoDateString(),end:null}):e.selectable.setValue({start:null,end:null})});e.observable.subscribe(B.SELECTION,r),r(),i.addEventListener("change",a),t.addEventListener("change",a)}function sr(i){y(i,"change",t=>t.stopPropagation()),y(i,"input",t=>t.stopPropagation())}var or=class extends Z{bootWithCalendar(t){let e=t.config.mode===lt.RANGE;this.calendar=t,this._disableable=new V(this),this._disableable.onInitAndChange(u=>{this.calendar.disabled=u}),this.observable=new Le,this.selectable=new Wi(this.calendar.selectable,this.observable),this.viewState=this.calendar.viewState,this.querySelector("ui-selected-date")?.bootWithCalendar(),this.querySelector("ui-date-picker-select")?.bootWithCalendar();let s=this.querySelector("dialog");if(!s)return;let r=this.querySelector("input");r=s?.contains(r)?null:r;let a=Array.from(this.querySelectorAll("input")).find(u=>u!==r);a=s?.contains(a)?null:a,r&&r.addEventListener("click",u=>u.preventDefault()),a&&a.addEventListener("click",u=>u.preventDefault());let n=this.querySelector("button,ui-button");n=s?.contains(n)?null:n;let l=K(this.calendar,"calendar");if(this.triggerEl=r||n,!this.triggerEl)return;if(h(this.triggerEl,"role","combobox"),h(this.triggerEl,"aria-controls",l),this._disableable.onInitAndChange(u=>{u?h(this.triggerEl,"disabled",""):x(this.triggerEl,"disabled")}),this._dialogable=new xe(s,{clickOutside:!this.hasAttribute("disable-click-outside"),triggers:[n,r,a].filter(Boolean)}),this._closeable=new Lt(this),this._closeable.onClose(()=>this._dialogable.hide()),this._anchorable=new it(s,{reference:this.triggerEl,position:this.hasAttribute("position")?this.getAttribute("position"):void 0,gap:this.hasAttribute("gap")?this.getAttribute("gap"):void 0,offset:this.hasAttribute("offset")?this.getAttribute("offset"):void 0}),ca()&&(r&&this.showIOSOverlay(r),a&&this.showIOSOverlay(a)),this.querySelectorAll("button,ui-button").forEach(u=>{u!==this.triggerEl&&(s.contains(u)||(h(u,"aria-controls",l),h(u,"aria-haspopup","combobox"),ja(u,this._dialogable),y(u,"click",()=>this._dialogable.toggle())))}),zo(this,this.triggerEl,s,this._dialogable,this._anchorable),ja(this.triggerEl,this._dialogable),Xo(this,this._dialogable),Go(this.triggerEl,this._dialogable),jo(this,this.calendar.config.mode,this.observable,this.selectable,this._dialogable),e&&s&&r&&a)nr(r),nr(a),ar(r,a,this);else if(s&&r){let u=r;nr(u),rr(u,this)}else s&&Ko(n,this._dialogable);this._controllable=new U(this,{bubbles:!0}),this.calendar.addEventListener("change",u=>u.stopPropagation()),this.calendar.addEventListener("input",u=>u.stopPropagation()),this._submittable=new Q(this,{name:this.getAttribute("name"),value:this.selectable.getValue()});let o=G();this._controllable.initial(u=>u&&this.selectable.setValue(u)),this._controllable.getter(()=>this.selectable.getValue()),this._controllable.setter(o(u=>this.selectable.setValue(u))),this.observable.subscribe(B.SELECTION,o(()=>{this.dispatchEvent(new Event("select",{bubbles:!1,cancelable:!0})),this._controllable.dispatch()})),this.observable.subscribe(B.SELECTION,()=>{this._submittable.update(this.selectable.getValue())}),this.observable.subscribe(B.VIEW_CHANGE,()=>{this.dispatchEvent(new Event("navigate",{bubbles:!1,cancelable:!0}))})}unmount(){if(this._dialogable?.getState()){let{unlock:t}=ot();t()}}showIOSOverlay(t){let e=document.createElement("button");e.setAttribute("data-flux-ios-overlay",""),e.setAttribute("data-appended",""),e.classList.add("absolute","inset-0"),t.after(e)}input(){return this.querySelector("input")}clear(){this.selectable.setValue(null),this.dispatchEvent(new CustomEvent("clear",{bubbles:!1}))}open(){this._dialogable.setState(!0)}close(){this._dialogable.setState(!1)}trigger(){return this.triggerEl}},lr=class extends I{bootWithCalendar(){if(this.picker=this.closest("ui-date-picker"),this.querySelectorAll("[data-appended]").forEach(t=>t.remove()),!this.querySelector('template[name="date"]')){let t=document.createElement("template");t.setAttribute("name","date"),t.innerHTML="<div><slot></slot></div>",this.appendChild(t)}this.templates={placeholder:this.querySelector('template[name="placeholder"]'),date:this.querySelector('template[name="date"]')},this.picker.observable.subscribe(B.SELECTION,()=>{this.render(this.picker)}),this.render(this.picker)}render(t){if(this.templates.placeholder?.clearPlaceholder?.(),this.templates.date?.clearDate?.(),t.selectable.hasSelection()){let{cleanup:e}=at(this.templates.date,s=>s({slots:{default:t.selectable.display(this.picker.calendar.config.locale)}}));this.templates.date.clearDate=e}else{if(!this.templates.placeholder)return;let{cleanup:e}=at(this.templates.placeholder,s=>s({slots:{}}));this.templates.placeholder.clearPlaceholder=e}}},ur=class extends I{bootWithCalendar(){this.picker=this.closest("ui-date-picker"),this.picker.selectable.blockSyncIf(()=>this.getBoundingClientRect().width>0),we(this,()=>this.picker._disableable.isDisabled(),()=>{this.picker.selectable.sync(),this.picker._dialogable.setState(!1)})}};T("date-picker",or);T("date-picker-select",ur);T("selected-date",lr);Ve(({css:i})=>i`
/* For Chrome, Safari, Edge */
ui-date-picker input[type="date"]::-webkit-calendar-picker-indicator {
display: none;
-webkit-appearance: none;
}
`);function ja(i,t){h(i,"aria-haspopup","listbox");let e=()=>{h(i,"aria-expanded",t.getState()?"true":"false"),t.getState()?h(i,"data-open",""):x(i,"data-open","")};t.onChange(()=>{e()}),e()}function zo(i,t,e,s,r){let a=()=>{Array.from([i,e]).forEach(n=>{s.getState()?h(n,"data-open",""):x(n,"data-open","")}),s.getState()&&r.reposition()};s.onChange(()=>a()),a(),s.onChange(()=>{s.getState()?i.dispatchEvent(new Event("open",{bubbles:!1,cancelable:!1})):i.dispatchEvent(new Event("close",{bubbles:!1,cancelable:!1}))})}function Go(i,t){y(i,"keydown",e=>{["ArrowDown","ArrowUp","Escape"].includes(e.key)&&(e.key==="ArrowDown"||e.key==="ArrowUp"?t.getState()||(t.setState(!0),e.preventDefault(),e.stopImmediatePropagation()):e.key==="Escape"&&t.getState()&&t.setState(!1))})}function Ko(i,t){y(i,"click",()=>{t.setState(!t.getState())})}function nr(i){y(i,"focus",()=>i.select())}function Xo(i,t){let{lock:e,unlock:s}=ot(t.el);t.onChange(()=>{t.getState()?e():s()})}function jo(i,t,e,s,r){let a=t!==lt.MULTIPLE;if(i.hasAttribute("close")){let n=i.getAttribute("close");a=n.split(" ").includes("auto"),n==="manual"&&(a=!1)}a&&e.subscribe(B.SELECTION,()=>{s.hasSelection()&&r.setState(!1)})}var hr=class extends Z{boot(){h(this,"role","group"),this.config={submit:this.getAttribute("submit")||"cmd-enter",rows:Number(this.getAttribute("rows"))||2,maxRows:Number(this.getAttribute("max-rows"))||10};let t=this.querySelector("textarea"),e=this.querySelector("ui-editor");t?(this._inputEl=t,this._initTextarea()):(this._inputEl=e,this._initEditor()),this.state={onChanges:[],getValue:()=>this._inputEl.value,setValue:r=>{this._inputEl.value=r,this.state.onChanges.forEach(a=>a(this.state.getValue()))},onChange:r=>{this.state.onChanges.push(r)}},this._controllable=new U(this),this._disableable=new V(this),this._submittable=new Q(this,{name:this.getAttribute("name"),value:this.state.getValue()}),this.state.onChange(r=>{this._submittable.update(r)}),this._controllable.initial(r=>r&&this.state.setValue(r)),this._controllable.getter(()=>this.state.getValue()),this._controllable.setter(r=>this.state.setValue(r));let s=()=>{};this._disableable.onInitAndChange(r=>{r?(s=this._disableActions(),h(this._inputEl,"disabled","")):(s(),s=()=>{},x(this._inputEl,"disabled"))}),y(this._inputEl,"input",r=>{this._controllable.dispatch(),r.stopPropagation()})}_resizeTextarea(){h(this._inputEl,"style","height: auto");let t=window.getComputedStyle(this._inputEl),e=this._inputEl.scrollHeight,s=parseFloat(t.lineHeight);isNaN(s)&&(s=parseFloat(t.fontSize)*1.2);let r=parseFloat(t.borderTopWidth),a=parseFloat(t.borderBottomWidth),n=parseFloat(t.paddingTop),l=parseFloat(t.paddingBottom),o=this.config.rows*s,u=this.config.maxRows*s;t.boxSizing==="border-box"?(e+=r+a,o+=n+l+r+a,u+=n+l+r+a):e-=n+l,e<o&&(e=o);let d="hidden";e>u&&(e=u,d="auto"),h(this._inputEl,"style",`height: ${e}px; overflow-y: ${d}`)}focusInput(){this._inputEl.focus()}_resizeEditor(){let t=this._inputEl.querySelector('[data-slot="content"]');if(!t)return;let e=window.getComputedStyle(t),s=parseFloat(e.lineHeight);isNaN(s)&&(s=parseFloat(e.fontSize)*1.2);let r=parseFloat(e.borderTopWidth),a=parseFloat(e.borderBottomWidth),n=parseFloat(e.paddingTop),l=parseFloat(e.paddingBottom),o=this.config.rows*s,u=this.config.maxRows*s;e.boxSizing==="border-box"&&(o+=n+l+r+a,u+=n+l+r+a),h(t,"style",`min-height: ${o}px; max-height: ${u}px; height: auto; overflow-y: auto;`)}_initTextarea(){this._inputEl.hasAttribute("rows")||h(this._inputEl,"rows",this.config.rows),this.hasAttribute("placeholder")&&h(this._inputEl,"placeholder",this.getAttribute("placeholder")),this._inputEl.addEventListener("input",()=>this._resizeTextarea()),this._resizeTextarea(),y(this._inputEl,"keydown",t=>this._handleSubmitKeydown(t))}_initEditor(){this.hasAttribute("placeholder")&&h(this._inputEl,"placeholder",this.getAttribute("placeholder")),this.addEventListener("flux:editor:ready",()=>{this._resizeEditor()}),y(this._inputEl,"keydown",t=>this._handleSubmitKeydown(t),{capture:!0})}_handleSubmitKeydown(t){["cmd-enter","super-enter","ctrl-enter"].includes(this.config.submit)&&(t.metaKey||t.ctrlKey)&&t.key==="Enter"?(t.preventDefault(),t.stopPropagation(),this._submittable.submitEnclosingForm()):this.config.submit==="enter"&&t.key==="Enter"&&!t.shiftKey?(t.preventDefault(),t.stopPropagation(),this._submittable.submitEnclosingForm()):this.config.submit==="shift-enter"&&t.key==="Enter"&&t.shiftKey&&(t.preventDefault(),t.stopPropagation(),this._submittable.submitEnclosingForm())}_disableActions(){let t=[];return this.querySelectorAll("button").forEach(s=>{s.hasAttribute("disabled")||(h(s,"disabled",""),t.push(()=>{dt(s,"disabled")}))}),()=>{t.forEach(s=>s()),t=[]}}};T("composer",hr);var cr=class extends I{boot(){this._controllable=new U(this),this._controllable.initial(t=>t!=null&&this.setValue(parseFloat(t))),this._controllable.getter(()=>this.currentValue),this._controllable.setter(t=>this.setValue(parseFloat(t))),h(this,"role","progressbar"),h(this,"aria-valuemin",0),this.currentValue===void 0&&this.setValue(this.hasAttribute("value")?parseFloat(this.getAttribute("value")):0),new MutationObserver(()=>this.updateVisual()).observe(this,{attributes:!0,attributeFilter:["max"]})}setValue(t){this.currentValue=t,this.updateVisual()}updateVisual(){let t=this.hasAttribute("max")?parseFloat(this.getAttribute("max")):100,e=Math.max(0,Math.min(100,this.currentValue/t*100));this.style.setProperty("--flux-progress",e),this.style.setProperty("--flux-progress-percentage",e+"%"),h(this,"aria-valuenow",this.currentValue),h(this,"aria-valuemax",t)}};T("progress",cr);var dr=class extends I{boot(){let t=this.trigger(),e=this.overlay();this._disabled=this.hasAttribute("disabled"),this._popoverable=new rt(e);let s={getBoundingClientRect:()=>({x:0,y:0,width:0,height:0,top:0,left:0,right:0,bottom:0})};this._anchorable=new it(e,{reference:s,auto:!1,position:this.hasAttribute("position")?this.getAttribute("position"):void 0,gap:this.hasAttribute("gap")?this.getAttribute("gap"):void 0,offset:this.hasAttribute("offset")?this.getAttribute("offset"):void 0});let{lock:r,unlock:a}=ot(this._popoverable.el);this._popoverable.onChange(()=>{this._popoverable.getState()?r():a()}),y(t,"contextmenu",n=>{n.preventDefault(),s.getBoundingClientRect=()=>({x:n.clientX,y:n.clientY,width:0,height:0,top:n.clientY,left:n.clientX,right:n.clientX,bottom:n.clientY}),this._anchorable.reposition(),this._popoverable.setState(!0),this.hasAttribute("detail")&&h(e,"data-detail",this.getAttribute("detail"))}),this.hasAttribute("detail")&&h(e,"data-detail","")}unmount(){if(this.overlay()?._popoverable?.getState()){let{unlock:t}=ot();t()}}trigger(){return this.firstElementChild}overlay(){if(this.hasAttribute("target")){let t=this.getAttribute("target");return document.getElementById(t)}else return this.lastElementChild.matches("[popover]")&&this.lastElementChild}};T("context",dr);var _t=class extends kt{groupOfType=st;boot({options:t}){t({wrap:!1,ensureTabbable:!0})}mount(){this.options().ensureTabbable&&this.ensureTabbable()}focusFirst(){let t;t=t||this.walker().find(e=>e.hasAttribute("autofocus")),t=t||this.walker().find(e=>e.getAttribute("tabindex")==="0"),t=t||this.walker().find(e=>e.getAttribute("tabindex")==="-1"),t=t||this.walker().find(e=>oa(e)),t?.focus()}focusPrev(){this.moveFocus(t=>this.options().wrap?this.walker().prevOrLast(t):this.walker().prev(t))}focusNext(){this.moveFocus(t=>this.options().wrap?this.walker().nextOrFirst(t):this.walker().next(t))}focusBySearch(t){let e=this.walker().find(s=>s.textContent.toLowerCase().trim().startsWith(t.toLowerCase()));e?.use(st).tabbable(),e?.use(st).focus()}moveFocus(t){let e=this.walker().find(r=>r.use(st).isTabbable());t(e)?.use(st).focus()}ensureTabbable(){this.walker().findOrFirst(t=>{t.use(st).isTabbable()})?.use(st).tabbable()}wipeTabbables(){this.walker().each(t=>{t.use(st).untabbable()})}untabbleOthers(t){this.walker().each(e=>{e!==t&&e.use(st).untabbable()})}walker(){return tt(this.el,(t,{skip:e,reject:s})=>{if(t[this.constructor.name]&&t!==this.el)return s();if(!t[this.groupOfType.name])return e();if(t.hasAttribute("disabled"))return s()})}},st=class extends X{groupedByType=_t;boot({options:t}){t({hover:!1,disableable:null,tabbable:!1,tabbableAttr:null})}mount(){let t=this.options().disableable;if(!t)throw"Focusable requires a Disableable instance...";this.el.hasAttribute("tabindex")||(this.options().tabbable?this.tabbable():this.untabbable()),this.pauseFocusListener=this.on("focus",t.enabled(()=>{this.focus(!1)})).pause,this.on("focus",t.enabled(()=>{ee()&&h(this.el,"data-focus","")})),this.on("blur",t.enabled(()=>{x(this.el,"data-focus")})),this.options().hover&&this.on("pointerenter",t.enabled(()=>{this.group()?.untabbleOthers(this.el),this.tabbable()})),this.options().hover&&this.on("pointerleave",t.enabled(e=>{this.untabbable()}))}focus(t=!0){this.group()?.untabbleOthers(this.el),this.tabbable(),t&&this.pauseFocusListener(()=>{this.el.focus({focusVisible:!1})})}tabbable(){h(this.el,"tabindex","0"),this.options().tabbableAttr&&h(this.el,this.options().tabbableAttr,"")}untabbable(){h(this.el,"tabindex","-1"),this.options().tabbableAttr&&x(this.el,this.options().tabbableAttr)}isTabbable(){return this.el.getAttribute("tabindex")==="0"}};var ii=class i extends I{boot(){if(this._focusable=new _t(this,{wrap:!1,ensureTabbable:!1}),y(this,"keydown",t=>{["ArrowDown"].includes(t.key)?(t.target===this?this._focusable.focusFirst():this._focusable.focusNext(),t.preventDefault(),t.stopPropagation()):["ArrowUp"].includes(t.key)&&(t.target===this?this._focusable.focusFirst():this._focusable.focusPrev(),t.preventDefault(),t.stopPropagation())}),xi(this,t=>this._focusable.focusBySearch(t)),this.hasAttribute("popover")&&this.addEventListener("lofi-close-popovers",t=>{this.hasAttribute("keep-open")||(t.detail?.immediate?this.hidePopover():setTimeout(()=>this.hidePopover(),50))}),this.parentElement.localName==="ui-dropdown"){let t=this.parentElement;y(t.trigger(),"keydown",e=>{e.key==="ArrowDown"&&(this.fromArrowDown=!0,this.showPopover(),e.preventDefault(),e.stopPropagation())})}h(this,"role","menu"),h(this,"tabindex","-1")}mount(){this.initializeMenuItems(),new MutationObserver(e=>{this.initializeMenuItems()}).observe(this,{childList:!0,subtree:!0})}onPopoverShow(){requestAnimationFrame(()=>{this.fromArrowDown?(this._focusable.focusFirst(),this.fromArrowDown=!1):this.focus()})}onPopoverHide(){this._focusable.wipeTabbables()}initializeMenuItems(){this.walker().each(t=>{t._disableable||Jo(t)})}walker(){return tt(this,(t,{skip:e,reject:s})=>{if(t instanceof i||t instanceof ce)return s();if(!["a","button"].includes(t.localName))return e()})}},fr=class extends I{boot(){}},pr=class extends I{boot(){let t=this;this._disableable=new V(this),this._disableable.onInitAndChange(s=>{s?h(t,"aria-disabled","true"):x(t,"aria-disabled")}),K(t,"menu-checkbox"),h(t,"role","menuitemcheckbox"),t._focusable=new st(t,{disableable:this._disableable,hover:!0,tabbableAttr:"data-active"}),t._selectable=new Y(t,{toggleable:!0,value:this.hasAttribute("value")?this.getAttribute("value"):t.textContent.trim(),label:this.hasAttribute("label")?this.getAttribute("label"):t.textContent.trim(),dataAttr:"data-checked",ariaAttr:"aria-checked",selectedInitially:this.hasAttribute("checked")}),this._controllable=new U(this),this._controllable.initial(s=>s&&t._selectable.setState(s)),this._controllable.getter(()=>t._selectable.getState());let e=G();this._controllable.setter(e(s=>{this._selectable.setState(s)})),this._selectable.onChange(e(()=>{this._controllable.dispatch()})),y(t,"click",this._disableable.enabled(()=>{this.hasAttribute("keep-open")||this.dispatchEvent(new CustomEvent("lofi-close-popovers",{bubbles:!0})),t._selectable.press()})),vr(t)}},br=class extends I{boot(){let t=this;this._disableable=new V(this),this._disableable.onInitAndChange(e=>{e?h(t,"aria-disabled","true"):x(t,"aria-disabled")}),K(t,"menu-radio"),h(t,"role","menuitemradio"),t._focusable=new st(t,{disableable:this._disableable,hover:!0,tabbableAttr:"data-active"}),t._selectable=new Y(t,{toggleable:!1,value:this.hasAttribute("value")?this.getAttribute("value"):t.textContent.trim(),label:this.hasAttribute("label")?this.getAttribute("label"):t.textContent.trim(),dataAttr:"data-checked",ariaAttr:"aria-checked",selectedInitially:this.hasAttribute("checked")}),y(t,"click",this._disableable.enabled(()=>{this.hasAttribute("keep-open")||this.dispatchEvent(new CustomEvent("lofi-close-popovers",{bubbles:!0})),t._selectable.press()})),vr(t)}},mr=class extends I{boot(){this._selectable=new ut(this),this._controllable=new U(this),h(this,"role","group"),this._controllable.initial(e=>e&&this._selectable.setState(e)),this._controllable.getter(()=>this._selectable.getState());let t=G();this._controllable.setter(t(e=>{this._selectable.setState(e)})),this._selectable.onChange(t(()=>{this._controllable.dispatch()})),y(this,"lofi-close-popovers",e=>{this.hasAttribute("keep-open")&&(e.preventDefault(),e.stopPropagation())})}},gr=class extends I{boot(){this._selectable=new ut(this,{multiple:!0}),this._controllable=new U(this),h(this,"role","group"),this._controllable.initial(e=>e&&this._selectable.setState(e)),this._controllable.getter(()=>this._selectable.getState());let t=G();this._controllable.setter(t(e=>{this._selectable.setState(e)})),this._selectable.onChange(t(()=>{this._controllable.dispatch()}))}};T("menu",ii);T("submenu",fr);T("menu-checkbox",pr);T("menu-radio",br);T("menu-radio-group",mr);T("menu-checkbox-group",gr);function vr(i){y(i,"keydown",t=>{t.key==="Enter"&&(i.click(),t.preventDefault(),t.stopPropagation())}),y(i,"keydown",t=>{t.key===" "&&(t.preventDefault(),t.stopPropagation())}),y(i,"keyup",t=>{t.key===" "&&(i.click(),t.preventDefault(),t.stopPropagation())})}function Jo(i){let t=i.querySelector("a"),e=i,s=i.parentElement.matches("ui-submenu")&&i.parentElement.querySelector("ui-menu[popover]"),r=t||e;if(i._disableable=new V(i),i._disableable.onInitAndChange(a=>{a?h(r,"aria-disabled","true"):x(r,"aria-disabled")}),K(r,"menu-item"),h(r,"role","menuitem"),r._focusable=new st(r,{disableable:i._disableable,hover:!0,tabbableAttr:"data-active"}),s){s._popoverable=new rt(s,{triggers:[e]}),s._anchorable=new it(s,{reference:e,position:s.hasAttribute("position")?s.getAttribute("position"):bt(s)?"left start":"right start",gap:s.hasAttribute("gap")?s.getAttribute("gap"):"-5",crossAxis:!0}),e.addEventListener("click",i._disableable.enabled(n=>{s._popoverable.setState(!0)}));let{clear:a}=ye(e,s,{gain(){s._popoverable.setState(!0)},lose(){s._popoverable.setState(!1)},focusable:!1,useSafeArea:!0});s._popoverable.onChange(()=>{s._popoverable.getState()||(a(),s._focusable.wipeTabbables()),s._popoverable.getState()?s._anchorable.reposition():s._anchorable.cleanup()}),y(e,"keydown",n=>{n.key==="Enter"&&(s._popoverable.setState(!0),setTimeout(()=>s._focusable.focusFirst()))}),y(e,"keydown",n=>{n.key==="ArrowRight"&&(s._popoverable.setState(!0),setTimeout(()=>s._focusable.focusFirst()))}),y(s,"keydown",n=>{n.key==="ArrowLeft"&&(s._popoverable.setState(!1),e.focus(),n.stopPropagation())})}else{let a=i._disableable.enabled(()=>{i.hasAttribute("keep-open")||i.dispatchEvent(new CustomEvent("lofi-close-popovers",{bubbles:!0,detail:{immediate:!0}}))});y(i,"mouseup",a),y(i,"click",n=>!n.isTrusted&&a()),vr(e)}}var yr=class i extends I{mount(){this._focusable=new _t(this,{wrap:!0}),this._disableable=new V(this);let t=[];this._disableable.onInitAndChange(e=>{e?(h(this,"aria-disabled","true"),this.walker().each(s=>{s.hasAttribute("disabled")||(h(s,"disabled","true"),h(s,"aria-disabled","true"),t.push(()=>{dt(s,"disabled"),dt(s,"aria-disabled")}))})):(dt(this,"aria-disabled"),t.forEach(s=>s()),t=[])}),y(this,"keydown",e=>{["ArrowRight"].includes(e.key)?(e.target===this?this._focusable.focusFirst():this._focusable.focusNext(),e.preventDefault(),e.stopPropagation()):["ArrowLeft"].includes(e.key)&&(e.target===this?this._focusable.focusFirst():this._focusable.focusPrev(),e.preventDefault(),e.stopPropagation())}),h(this,"role","toolbar"),this.initializeToolbarItems()}initializeToolbarItems(){this.walker().each(t=>{t._disableable||Zo(t)})}walker(){return tt(this,(t,{skip:e,reject:s})=>{if(t instanceof i||t.hasAttribute("popover")||t instanceof ii||t instanceof Ke)return s();if(!["a","button"].includes(t.localName))return e()})}};T("toolbar",yr);function Zo(i){i._disableable=new V(i),i._disabled=i.hasAttribute("disabled");let s=i.querySelector("a")||i;i._disabled&&(h(s,"disabled",""),h(s,"aria-disabled","true")),!i._disabled&&(s._focusable=new st(s,{disableable:i._disableable}))}var wr=class extends I{boot(){let t=this.hasAttribute("label")?"label":"description",e=this.button(),s=this.overlay();if(e){if(!s)return}else return console.warn("ui-tooltip: no trigger element found",this);s._popoverable=new rt(s,{scope:"tooltip"}),s._anchorable=new it(s,{reference:e,position:this.hasAttribute("position")?this.getAttribute("position"):void 0,gap:this.hasAttribute("gap")?this.getAttribute("gap"):void 0,offset:this.hasAttribute("offset")?this.getAttribute("offset"):void 0}),s._popoverable.onChange(()=>{s._popoverable.getState()?s._anchorable.reposition():s._anchorable.cleanup()}),this._disableable=new V(this);let r;this._disableable.onInitAndChange(u=>{r&&(r(),r=null),u||(r=ye(this,s,{gain(){s._popoverable.setState(!0)},lose(){s._popoverable.setState(!1)},focusable:!0,useSafeArea:!1}).remove)}),new MutationObserver(()=>{this.getAttribute("draggable")==="true"&&s._popoverable.setState(!1)}).observe(this,{attributeFilter:["draggable"]});let n=K(s,"tooltip"),l=this.hasAttribute("interactive"),o=this.hasAttribute("label")||e.textContent.trim()==="";l?(h(e,"aria-controls",n),h(e,"aria-expanded","false"),s._popoverable.onChange(()=>{s._popoverable.getState()?h(e,"aria-expanded","true"):h(e,"aria-expanded","false")})):(o?h(e,"aria-labelledby",n):h(e,"aria-describedby",n),h(s,"aria-hidden","true")),h(s,"role","tooltip")}button(){return this.firstElementChild}overlay(){return this.lastElementChild!==this.button()&&this.lastElementChild.tagName!=="TEMPLATE"&&this.lastElementChild}};T("tooltip",wr);var j={STATE_CHANGED:"stateChanged",DESKTOP_COLLAPSED:"desktopCollapsed",DESKTOP_EXPANDED:"desktopExpanded",MOBILE_COLLAPSED:"mobileCollapsed",MOBILE_EXPANDED:"mobileExpanded",VIEWPORT_ENTER_MOBILE:"viewportEnterMobile",VIEWPORT_ENTER_DESKTOP:"viewportEnterDesktop"},xr=class extends I{boot(){if(this.config={breakpoint:this.hasAttribute("breakpoint")?this.getAttribute("breakpoint"):1024,collapsible:!1,persist:this.hasAttribute("persist")?!["false","none"].includes(this.getAttribute("persist")):!0,sticky:!!this.hasAttribute("sticky")},this.observable=new Wt,this.state={active:!1,viewportDesktop:!0,viewportMobile:!1,collapsedMobile:!0,collapsedDesktop:!1},this.config.sticky&&this.setStickyPositionStyles(),this.hasAttribute("collapsible")){let t=this.getAttribute("collapsible");t==="true"?this.config.collapsible=!0:t==="false"?this.config.collapsible=!1:t==="mobile"&&(this.config.collapsible="mobile")}this.config.persist&&this.config.collapsible&&(this.state.collapsedDesktop=JSON.parse(localStorage.getItem("flux-sidebar-collapsed-desktop"))),this.removeAttribute("data-flux-sidebar-cloak"),this.observable.subscribe(j.VIEWPORT_ENTER_DESKTOP,()=>{let t=ps(this,"transition","none");setTimeout(t),this.state.viewportDesktop=!0,this.state.viewportMobile=!1,this.observable.notify(j.STATE_CHANGED)}),this.observable.subscribe(j.VIEWPORT_ENTER_MOBILE,()=>{let t=ps(this,"transition","none");setTimeout(t),this.state.viewportDesktop=!1,this.state.viewportMobile=!0,this.observable.notify(j.STATE_CHANGED)}),this.observable.subscribe(j.DESKTOP_COLLAPSED,()=>{this.state.collapsedDesktop=!0,this.observable.notify(j.STATE_CHANGED)}),this.observable.subscribe(j.DESKTOP_EXPANDED,()=>{this.state.collapsedDesktop=!1,this.observable.notify(j.STATE_CHANGED)}),this.observable.subscribe(j.MOBILE_COLLAPSED,()=>{this.state.collapsedMobile=!0,this.observable.notify(j.STATE_CHANGED)}),this.observable.subscribe(j.MOBILE_EXPANDED,()=>{this.state.collapsedMobile=!1,this.observable.notify(j.STATE_CHANGED)}),this.observable.subscribe(j.STATE_CHANGED,()=>{this.config.persist&&localStorage.setItem("flux-sidebar-collapsed-desktop",JSON.stringify(this.state.collapsedDesktop)),this.updateDataAttributes(this)}),new Ar(this.observable,this.config),document.addEventListener("flux-sidebar-toggle",()=>{this.state.viewportDesktop?this.state.collapsedDesktop?this.observable.notify(j.DESKTOP_EXPANDED):this.observable.notify(j.DESKTOP_COLLAPSED):this.state.collapsedMobile?this.observable.notify(j.MOBILE_EXPANDED):this.observable.notify(j.MOBILE_COLLAPSED)}),this.addEventListener("click",t=>{t.target===this&&this.state.collapsedDesktop&&this.observable.notify(j.DESKTOP_EXPANDED)}),this.addEventListener("mouseenter",t=>{this.state.active=!0,this.observable.notify(j.STATE_CHANGED)}),this.addEventListener("mouseleave",t=>{this.state.active=!1,this.observable.notify(j.STATE_CHANGED)}),this.addEventListener("focusin",t=>{this.state.active=!0,this.observable.notify(j.STATE_CHANGED)}),this.addEventListener("focusout",t=>{this.state.active=!1,this.observable.notify(j.STATE_CHANGED)})}setStickyPositionStyles(){let t=this.offsetTop,e=window.pageYOffset;e>0&&(window.scrollTo(window.scrollX,0),t=this.offsetTop,window.scrollTo(window.scrollX,e)),this.style.position="sticky",this.style.top=t+"px",this.style.maxHeight=`calc(100dvh - ${t}px)`}updateDataAttributes(t){let e=this.config.collapsible===!0;e&&(this.state.active?h(t,"data-flux-sidebar-active",""):dt(t,"data-flux-sidebar-active")),this.state.viewportDesktop?(dt(t,"data-flux-sidebar-on-mobile"),h(t,"data-flux-sidebar-on-desktop",""),dt(t,"data-flux-sidebar-collapsed-mobile"),this.state.collapsedDesktop?e&&h(t,"data-flux-sidebar-collapsed-desktop",""):dt(t,"data-flux-sidebar-collapsed-desktop")):(dt(t,"data-flux-sidebar-on-desktop"),h(t,"data-flux-sidebar-on-mobile",""),dt(t,"data-flux-sidebar-collapsed-desktop"),this.state.collapsedMobile?h(t,"data-flux-sidebar-collapsed-mobile",""):dt(t,"data-flux-sidebar-collapsed-mobile"))}},Ar=class{constructor(t,{breakpoint:e}){this.observable=t,this.breakpoint=e,this.watchForViewportChanges()}watchForViewportChanges(){let t=typeof this.breakpoint=="number"?`${this.breakpoint}px`:this.breakpoint,e=matchMedia(`(min-width: ${t})`);e.matches?this.observable.notify(j.VIEWPORT_ENTER_DESKTOP):this.observable.notify(j.VIEWPORT_ENTER_MOBILE),e.addEventListener("change",()=>{e.matches?this.observable.notify(j.VIEWPORT_ENTER_DESKTOP):this.observable.notify(j.VIEWPORT_ENTER_MOBILE)})}},Sr=class extends I{mount(){let t=this.querySelector("button,ui-button");y(t||this,"click",()=>{this.dispatchEvent(new CustomEvent("flux-sidebar-toggle",{bubbles:!0}))}),queueMicrotask(()=>{let e=document.querySelector("ui-sidebar");e.updateDataAttributes(this),e.observable.subscribe(j.STATE_CHANGED,()=>{e.updateDataAttributes(this)})})}};T("sidebar",xr);T("sidebar-toggle",Sr);var Er=class extends I{boot(){this.thumbs=this.querySelectorAll("[data-flux-slider-thumb]"),this.indicator=this.querySelector("[data-flux-slider-indicator]"),this.inputEls=this.querySelectorAll('input[type="range"]'),this.config={range:this.range(),min:this.min(),max:this.max(),step:this.step(),bigStep:this.bigStep(),minStepsBetween:this.minStepsBetween(),rangeStartString:this.rangeStartString(),rangeEndString:this.rangeEndString()},this.state={onChanges:[],getValue:()=>this.config.range?[parseFloat(this.inputEls[0].value),parseFloat(this.inputEls[1].value)]:parseFloat(this.inputEls[0].value),getValueAsArray:()=>this.config.range?this.state.getValue():[this.state.getValue()],setValue:t=>{this.config.range?(this.inputEls[0].value=t[0],this.inputEls[1].value=t[1]):this.inputEls[0].value=t,this.state.onChanges.forEach(e=>e(this.state.getValue()))},setValueInRange:(t,e)=>{let s=[...this.state.getValue()];s[t]=e,this.state.setValue(s)},setValueFromString:t=>{this.config.range?this.state.setValue(t.split(",")):this.state.setValue(t)},increment:(t,e)=>{let s=this.state.getValueAsArray();this.config.range?(s[t]=this.constrainRangeValue(t,s[t]+e),this.state.setValueInRange(t,s[t])):this.state.setValue(Xi(s[t]+e,this.config.min,this.config.max))},onChange:t=>{this.state.onChanges.push(t)}},this._controllable=new U(this),this._disableable=new V(this),this._submittable=new Q(this,{name:this.getAttribute("name"),value:this.state.getValue()}),this.state.onChange(t=>{this.repositionThumbsAndIndicator(),this.updateTicks(),this._submittable.update(t),this.config.range&&(this.inputEls[0].ariaValueText=`${t[0]} ${this.config.rangeStartString}`,this.inputEls[1].ariaValueText=`${t[1]} ${this.config.rangeEndString}`)}),this._controllable.initial(t=>t&&this.state.setValue(t)),this._controllable.getter(()=>this.state.getValue()),this._controllable.setter(t=>this.state.setValue(t)),this._disableable.onInitAndChange(t=>{t?this.inputEls.forEach(e=>e.setAttribute("disabled","")):this.inputEls.forEach(e=>e.removeAttribute("disabled"))}),this.setNativeInputAttributes(),this.setInitialValue(),this.setupExtraInputIfExists(),this.repositionTicks(),this.registerNativeInputListeners(),this.registerPointerListeners(),this.registerMutationObserver(),new ResizeObserver(()=>{this.repositionThumbsAndIndicator(),this.repositionTicks()}).observe(this)}mount(){this.setupFieldIfExists()}setNativeInputAttributes(){for(let t=0;t<this.inputEls.length;t++)this.inputEls[t].setAttribute("min",this.config.min),this.inputEls[t].setAttribute("max",this.config.max),this.inputEls[t].setAttribute("step",this.config.step)}setInitialValue(){this.hasAttribute("value")?this.state.setValueFromString(this.getAttribute("value")):this.state.setValue(this.state.getValue())}setupExtraInputIfExists(){let t=this.closest("ui-field")?.querySelector("[data-flux-input] > input");t&&(this.extraInput=t,this._disableable.onInitAndChange(e=>{e?h(t,"disabled",""):x(t,"disabled")}))}setupFieldIfExists(){let t=this.closest("ui-field");t&&queueMicrotask(()=>{t.label&&y(t.label,"click",()=>this.inputEls[0].focus()),t.label&&this.extraInput&&h(this.extraInput,"aria-labelledby",t.label.id),t.description&&this.extraInput&&h(this.extraInput,"aria-describedby",t.description.id);for(let e=0;e<this.inputEls.length;e++)t.label&&h(this.inputEls[e],"aria-labelledby",t.label.id),t.description&&h(this.inputEls[e],"aria-describedby",t.description.id)})}registerNativeInputListeners(){for(let t=0;t<this.inputEls.length;t++)y(this.inputEls[t],"input",e=>{e.stopPropagation()}),y(this.inputEls[t],"change",e=>{let s=parseFloat(e.target.value);this.config.range?(s=this.constrainRangeValue(t,s),this.state.setValueInRange(t,s)):this.state.setValue(s),this._controllable.dispatch(),e.stopPropagation()}),y(this.inputEls[t],"keydown",e=>{if(e.shiftKey){switch(e.key){case"ArrowUp":this.state.increment(t,this.config.bigStep);break;case"ArrowDown":this.state.increment(t,this.config.bigStep*-1);break;case"ArrowRight":this.state.increment(t,this.config.bigStep*(bt(this)?-1:1));break;case"ArrowLeft":this.state.increment(t,this.config.bigStep*(bt(this)?1:-1));break;default:return}this._controllable.dispatch(),e.preventDefault()}}),y(this.inputEls[t],"focus",()=>this.raiseThumb(t)),y(this.inputEls[t],"blur",()=>this.lowerThumb(t))}registerPointerListeners(){y(this,"pointerdown",t=>{if(this._disableable.isDisabled()||t.button!==0)return;let e=this.getThumbIndexFromX(t.clientX),s=this.thumbs[e].getBoundingClientRect(),r=s.left+s.width/2,a=0;Math.abs(t.clientX-r)<s.width/2&&(a=t.clientX-r);let n=this.state.getValueAsArray(),l=this.state.getValueAsArray(),o=u=>{let d=this.getValueFromX(u.clientX-a);this.config.range&&(d=this.constrainRangeValue(e,d));let c=[...l];c[e]=d,l.toString()!==c.toString()&&(l=c,this.config.range?this.state.setValueInRange(e,d):this.state.setValue(d),this.dispatchEvent(new Event("input",{bubbles:!1,cancelable:!0})))};o(t),this.setPointerCapture(t.pointerId),requestAnimationFrame(()=>{this.inputEls[e].focus()}),document.addEventListener("pointermove",o),document.addEventListener("pointerup",u=>{document.removeEventListener("pointermove",o),this.releasePointerCapture(u.pointerId),requestAnimationFrame(()=>{this.lowerThumb(e)}),n.toString()!==l.toString()&&this.dispatchEvent(new Event("change",{bubbles:!1,cancelable:!0}))},{once:!0})})}registerMutationObserver(){new MutationObserver(()=>{this.config.min=this.min(),this.config.max=this.max(),this.config.step=this.step(),this.config.bigStep=this.bigStep(),this.config.minStepsBetween=this.minStepsBetween(),this.setNativeInputAttributes(),this.repositionThumbsAndIndicator(),this.repositionTicks()}).observe(this,{attributes:!0,attributeFilter:["min","max","step","big-step","min-steps-between"]})}repositionThumbsAndIndicator(){if(this.config.range){let t=this.state.getValue(),e=this.getPercentageFromValue(t[0]),s=this.getPercentageFromValue(t[1]);this.thumbs[0].style.insetInlineStart=e+"%",this.thumbs[1].style.insetInlineStart=s+"%",this.indicator.style.insetInlineStart=e+"%",this.indicator.style.insetInlineEnd=100-s+"%"}else{let t=this.state.getValue(),e=this.getPercentageFromValue(t);this.thumbs[0].style.insetInlineStart=e+"%",this.indicator.style.insetInlineStart=0,this.indicator.style.insetInlineEnd=100-e+"%"}}repositionTicks(){this.querySelectorAll("[data-flux-slider-tick]").forEach(t=>{let e=parseFloat(t.getAttribute("data-value"));if(isNaN(e))return;let s=this.getPercentageFromValue(e);h(t,"style",`inset-inline-start: ${s}%`)})}updateTicks(){let t=this.state.getValueAsArray(),e=this.config.range?t:[this.state.min,t[0]];this.querySelectorAll("[data-flux-slider-tick]").forEach(s=>{let r=parseFloat(s.getAttribute("data-value"));if(!isNaN(r)){for(let a=0;a<t.length;a++)t[a]==r?h(s,"data-current",""):x(s,"data-current");r>=e[0]||r<=e[1]?h(s,"data-active",""):x(s,"data-active")}})}raiseThumb(t){this.thumbs[t].style.zIndex=10}lowerThumb(t){this.thumbs[t].style.zIndex=null}getThumbIndexFromX(t){let e,s;for(let r=0;r<this.thumbs.length;r++){let a=this.thumbs[r].getBoundingClientRect(),n=(a.left+a.right)/2,l=Math.abs(n-t);s&&Math.abs(s-l)<a.width/2&&this.getBoundingClientRect().right-a.right<a.width/4||(s===void 0||l<=s)&&(s=l,e=r)}return e}getPercentageFromValue(t){let e=t-this.config.min,s=this.config.max-this.config.min;if(s==0)return 0;let r=Xi(e/s,0,100),a=this.getBoundingClientRect(),l=this.thumbs[0].getBoundingClientRect().width/2;return((a.width-l*2)*r+l)/a.width*100}getValueFromX(t){let e=this.config.min,s=this.config.max,r=this.config.step,a=this.getBoundingClientRect(),l=this.thumbs[0].getBoundingClientRect().width/2,o=a.width-l*2,u=a.left+l,d=t-u,c=Xi(d/o,0,1);c=bt(this)?1-c:c;let f=(s-e)*c+e;return f=Qo(f,r,e),f=Xi(f,e,s),f}constrainRangeValue(t,e){let s=[...this.state.getValue()];return s[t]=e,(s[1]-s[0])/this.config.step<this.config.minStepsBetween?[s[1]-this.config.minStepsBetween*this.config.step,s[0]+this.config.minStepsBetween*this.config.step][t]:e}range(){return this.hasAttribute("range")}min(){return this.hasAttribute("min")?parseFloat(this.getAttribute("min")):0}max(){return this.hasAttribute("max")?parseFloat(this.getAttribute("max")):100}step(){if(!this.hasAttribute("step"))return 1;let t=parseFloat(this.getAttribute("step"));return t<=0||isNaN(t)?1:t}bigStep(){if(!this.hasAttribute("big-step"))return this.step();let t=parseFloat(this.getAttribute("big-step"));return t<=0||isNaN(t)?this.step():t}minStepsBetween(){return this.hasAttribute("min-steps-between")?parseFloat(this.getAttribute("min-steps-between")):0}rangeStartString(){return this.getAttribute("data-flux-aria-range-start")||"start range"}rangeEndString(){return this.getAttribute("data-flux-aria-range-end")||"end range"}};function Xi(i,t,e){return Math.min(Math.max(i,t),e)}function Qo(i,t,e){let s;if(Math.abs(t)>=1)s=t.toString().split(".")[1]?.length||0;else{let a=t.toExponential().split("e-"),n=a[0].split(".")[1];s=(n?n.length:0)+parseInt(a[1],10)}let r=Math.round((i-e)/t)*t+e;return Number(r.toFixed(s))}T("slider",Er);var _r=class extends Z{boot(){let t=this;this._disableable=new V(this),this._selectable=new Y(t,{toggleable:!0,dataAttr:"data-checked",ariaAttr:"aria-checked",value:this.hasAttribute("value")?this.getAttribute("value"):null,label:this.hasAttribute("label")?this.getAttribute("label"):null,selectedInitially:this.hasAttribute("checked")}),this._submittable=new Q(this,{name:this.getAttribute("name"),value:this.getAttribute("value")??"on",includeWhenEmpty:!1,shouldUpdateValue:!1}),this.value=this._selectable.getValue(),this._detangled=G(),this._selectable.onChange(this._detangled(()=>{this.dispatchEvent(new Event("input",{bubbles:!1,cancelable:!0})),this.dispatchEvent(new Event("change",{bubbles:!1,cancelable:!0}))})),h(t,"role","switch"),this._selectable.onInitAndChange(()=>{this._submittable.update(this._selectable.getState())}),this._disableable.onInitAndChange(e=>{e?x(t,"tabindex","0"):h(t,"tabindex","0")}),y(t,"click",this._disableable.disabled(e=>{e.preventDefault(),e.stopPropagation()}),{capture:!0}),y(t,"click",this._disableable.enabled(e=>{this._selectable.press()})),y(t,"keydown",this._disableable.enabled(e=>{e.key==="Enter"&&(this._selectable.press(),e.preventDefault(),e.stopPropagation())})),y(t,"keydown",this._disableable.enabled(e=>{e.key===" "&&(e.preventDefault(),e.stopPropagation())})),y(t,"keyup",this._disableable.enabled(e=>{e.key===" "&&(this._selectable.press(),e.preventDefault(),e.stopPropagation())})),tl(t)}get checked(){return this._selectable.isSelected()}set checked(t){this._detangled(()=>{t?this._selectable.select():this._selectable.deselect()})()}};function tl(i){i.closest("label")?.addEventListener("click",t=>{i.contains(t.target)||i.click()})}T("switch",_r);var kr=class i extends I{mount(){this.control=this.fieldWalker().find(t=>this.isControl(t)),this.control}associateLabelWithControl(t){t&&this.label&&(this.control=t,!this.control.hasAttribute("aria-labelledby")&&(h(this.elOrButton(this.control),"aria-labelledby",this.label.id),this.control&&!(this.control instanceof Z)&&this.hasAttribute("disabled")&&this.control.setAttribute("disabled","")))}associateDescriptionWithControl(t){t&&this.description&&(this.control=t,!this.control.hasAttribute("aria-describedby")&&h(this.elOrButton(this.control),"aria-describedby",this.description.id))}associateLabel(t){this.label=t,y(t,"click",e=>{["a","button","ui-button"].includes(e.target.localName)||this.focusOrTogggle(this.control)}),this.control&&this.associateLabelWithControl(this.control)}associateDescription(t){this.description=t,this.control&&this.associateDescriptionWithControl(this.control)}fieldWalker(){return tt(this,(t,{skip:e,reject:s})=>{if(t instanceof i&&t!==this||t.parentElement.localName==="ui-editor"&&t!==this)return s()})}isControl(t){return!!(t instanceof Z||t.matches("input, textarea, select"))}focusOrTogggle(t){if(!t||t.disabled||t.hasAttribute("disabled"))return;t.localName==="input"&&["checkbox","radio"].includes(t.type)||["ui-switch","ui-radio","ui-checkbox"].includes(t.localName)?(t.click(),t.focus()):t.localName==="input"&&["file"].includes(t.type)?t.click():["ui-select","ui-date-picker","ui-time-picker","ui-otp"].includes(t.localName)?t.trigger()?.focus():["ui-editor"].includes(t.localName)?t.focus():["ui-composer"].includes(t.localName)?t.focusInput():t.focus()}elOrButton(t){return t instanceof I&&t.firstElementChild instanceof HTMLButtonElement?t.firstElementChild:t}},Cr=class extends I{mount(){K(this,"label"),h(this,"aria-hidden","true"),this.closest("ui-field")?.associateLabel(this)}},Tr=class extends I{mount(){K(this,"description"),h(this,"aria-hidden","true"),this.closest("ui-field")?.associateDescription(this)}};T("field",kr);T("label",Cr);T("description",Tr);var Dr=class extends I{mount(){let t=K(this,"legend"),e=this.closest("fieldset");e&&h(e,"aria-labelledby",t)}};T("legend",Dr);function en(i){let t={time:nl,linear:il,categorical:el},e=0,s=0,r={},a=(l,o,u)=>{let d=`${l}-${o}`;for(let c in r)c.startsWith(`${l}-`)&&!c.endsWith(String(o))&&delete r[c];return r[d]||(r[d]=u()),r[d]},n={locale:i.locale,data:[],stacksMetadata:i.stacksMetadata,groupsMetadata:i.groupsMetadata,width:i.width,height:i.height,inset:i.inset,axes:{x:{axis:"x",key:i.axes.x.key,format:i.axes.x.format,inset:{start:0,end:0},position:i.axes.x.position||"bottom",tickStart:i.axes.x.tickStart,tickEnd:i.axes.x.tickEnd,tickCount:i.axes.x.tickCount,tickStep:i.axes.x.tickStep,tickValues:i.axes.x.tickValues,tickSuffix:i.axes.x.tickSuffix,tickPrefix:i.axes.x.tickPrefix,asArea:i.axes.x.asArea,get rawValues(){return a("x.rawValues",e,()=>n.data.map(l=>l[this.key]))},get type(){return a("x.type",e,()=>i.axes.x.scale||(this.rawValues.every(l=>rl(l))?"time":"categorical"))},get interval(){return a("x.interval",e,()=>i.axes.x.interval||"auto")},get values(){return a("x.values",e,()=>this.rawValues.map(l=>this.type==="time"?Ji(l):this.type==="linear"?Number(l):l))},get points(){return a("x.points",e+s,()=>n.data.map(l=>{let{start:o,center:u,end:d,width:c}=this.scale(l[this.key],{area:this.asArea});return{start:o,center:u,end:d,width:c,datum:l}}))},get ticks(){return a("x.ticks",e,()=>{let l=Ja(n.data,this,ji(this.type,this.values)),o=Za(l,this.type,this.format,this.tickSuffix,this.tickPrefix,this.interval,n.locale);return l.map((u,d)=>({value:u,label:o[d]}))})},get domain(){return a("x.domain",e,()=>ji(this.type,[...this.ticks.map(l=>l.value),...this.values]))},get range(){return a("x.range",s,()=>[n.inset.left+this.inset.start,n.width-n.inset.right-this.inset.end])},get scale(){return a("x.scale",s+e,()=>t[this.type](this.domain,this.range,this.values))}},y:{axis:"y",keys:i.axes.y.keys,format:i.axes.y.format,inset:{start:0,end:0},position:i.axes.y.position||"left",tickStart:i.axes.y.tickStart,tickEnd:i.axes.y.tickEnd,tickCount:i.axes.y.tickCount,tickStep:i.axes.y.tickStep,tickValues:i.axes.y.tickValues,tickSuffix:i.axes.y.tickSuffix,tickPrefix:i.axes.y.tickPrefix,get values(){return a("y.values",e,()=>{let l=n.data.flatMap(d=>n.groupsMetadata.reduce((c,f)=>(f.children.forEach(m=>{if(m.type==="bar"){if(!m.field||d[m.field]===void 0)return;c.push(d[m.field])}if(m.type==="stack"){let p=Number(m.gap.replace("px","")),w=0,A=0,_=!1,L=!1;m.children.forEach(O=>{if(O.type==="bar"){if(!O.field||d[O.field]===void 0)return;let E=d[O.field];E>=0?(_&&(w+=p),w+=E,_=!0):(L&&(A-=p),A+=E,L=!0)}}),_&&c.push(w),L&&c.push(A)}}),c),[])),o=n.data.flatMap(d=>n.stacksMetadata.reduce((c,f)=>{let m=Number(f.gap.replace("px","")),p=0,w=0,A=!1,_=!1;return f.children.forEach(L=>{if(L.type==="bar"){if(!L.field||d[L.field]===void 0)return;let O=d[L.field];O>=0?(A&&(p+=m),p+=O,A=!0):(_&&(w-=m),w+=O,_=!0)}}),A&&c.push(p),_&&c.push(w),c},[])),u=n.data.flatMap(d=>this.keys.reduce((c,f)=>(d[f]===void 0||c.push(d[f]),c),[]));return[...l,...o,...u]})},get type(){return a("y.type",e,()=>i.axes.y.scale||"linear")},get interval(){return a("y.interval",e,()=>i.axes.y.interval||"auto")},get ticks(){return a("y.ticks",e,()=>{let l=Ja(n.data,this,ji(this.type,this.values)),o=Za(l,this.type,this.format,this.tickSuffix,this.tickPrefix,this.interval,n.locale);return l.map((u,d)=>({value:u,label:o[d]}))})},get domain(){return a("y.domain",e,()=>ji(this.type,[...this.ticks.map(l=>l.value),...this.values]))},get range(){return a("y.range",s,()=>[n.height-n.inset.bottom-this.inset.end,n.inset.top+this.inset.start])},get scale(){return a("y.scale",s+e,()=>t[this.type](this.domain,this.range,this.values))}}},get series(){return a("series",e+s,()=>this.axes.y.keys.reduce((l,o)=>{if(!n.data[0].hasOwnProperty(o))return console.warn(`ui-chart: series field "${o}" does not exist`),l;let u=n.data.map(c=>({x:n.axes.x.scale(c[n.axes.x.key],{area:n.axes.x.asArea}).center,y:n.axes.y.scale(c[o]).center,datum:c})),d={field:o,values:n.data.map(c=>c[o]),bars({barWidth:c,minHeight:f,radius:m}){let{start:p,center:w,width:A}=n.axes.x.scale(n.axes.x.domain[0],{area:n.axes.x.asArea}),_=m;c.match(/^(\d+)%$/)?c=A*Number(c.replace("%",""))/100:c=Number(c.replace("px",""));let L=(A-c)/2;return n.data.map(O=>{let E=O[o],{start:b}=n.axes.x.scale(O[n.axes.x.key],{area:n.axes.x.asArea}),q=b+L,S=E>=0?n.axes.y.scale(E).center:n.axes.y.scale(0).center,N=E>=0?n.axes.y.scale(0).center-S:n.axes.y.scale(E).center-S,F=c,v=_;return N<f&&(S-=f-N,N=f),E<0&&(v={topLeft:v.bottomLeft,topRight:v.bottomRight,bottomRight:v.topRight,bottomLeft:v.topLeft}),{x:q,y:S,width:F,height:N,path:()=>Pe(q,S,F,N,v)}})},linePath(c="smooth"){let f=this.points.map(m=>[m.x,m.y]);return{smooth:Qa,none:tn}[c](f)},areaPath(c="smooth"){let f={smooth:Qa,none:tn}[c](this.points.map(_=>[_.x,_.y])),m=this.points[0].x,p=this.points[this.points.length-1].x,w=n.axes.y.scale(n.axes.y.domain[0]).center;return`${f} L${p},${w} L${m},${w} Z`},points:u};return l[o]=d,l},{}))},get stackedSeries(){return a("stackedSeries",e+s,()=>{let l={},o=[];return n.stacksMetadata.map(u=>(u.children.forEach(c=>{if(c.type==="bar"){if(!c.field)return;if(!n.data[0].hasOwnProperty(c.field)){console.warn(`ui-chart: series field "${c.field}" does not exist`);return}l[c.field]=n.data.map(f=>f[c.field]),o.push(c)}}),{bars(){let{start:c,center:f,width:m}=n.axes.x.scale(n.axes.x.domain[0],{area:n.axes.x.asArea}),p=u.width??"90%";p.match(/^(\d+)%$/)?p=m*Number(p.replace("%",""))/100:p=Number(p.replace("px",""));let w=(m-p)/2,A=Number(u.gap.replace("px","")),_=[],L=[],O=u.radius,E=[],b=[];return O&&o.forEach(q=>{q.type==="bar"&&l[q.field].forEach((S,N)=>{S>=0?(E[N]=q.field,b[N]===void 0&&(b[N]=q.field)):(b[N]=q.field,E[N]===void 0&&(E[N]=q.field))})}),o.reduce((q,S)=>{if(S.type==="bar"){let N=[];l[S.field].forEach((F,v)=>{_[v]===void 0&&(_[v]=0,L[v]=0);let{start:M}=n.axes.x.scale(n.data[v][n.axes.x.key],{area:n.axes.x.asArea}),k=M+w,C=F>=0?n.axes.y.scale(F).center:n.axes.y.scale(0).center,D=F>=0?n.axes.y.scale(0).center-C:n.axes.y.scale(F).center-C,P=p,$=Number(S.minHeight.replace("px","")),W=S.radius;if(O){let H=S.field===E[v],z=S.field===b[v],J={topLeft:0,topRight:0,bottomLeft:0,bottomRight:0};H&&(J.topLeft=O.topLeft,J.topRight=O.topRight),z&&(J.bottomLeft=O.bottomLeft,J.bottomRight=O.bottomRight),F<0?W={topLeft:J.bottomLeft,topRight:J.bottomRight,bottomLeft:J.topLeft,bottomRight:J.topRight}:W=J}C=F>=0?C-_[v]:C+L[v],D<$&&(C-=$-D,D=$),F<0&&(W={topLeft:W.bottomLeft,topRight:W.bottomRight,bottomRight:W.topRight,bottomLeft:W.topLeft});let R={x:k,y:C,width:P,height:D,path:()=>Pe(k,C,P,D,W)};F>=0?_[v]+=D+A:L[v]+=D+A,N.push(R)}),q[S.field]=N}return q},{})}}))})},get groupedSeries(){return a("groupedSeries",e+s,()=>n.groupsMetadata.map(l=>{let o={},u=[];return l.children.forEach(c=>{if(c.type==="bar"){if(!c.field)return;if(!n.data[0].hasOwnProperty(c.field)){console.warn(`ui-chart: series field "${c.field}" does not exist`);return}o[c.field]=n.data.map(f=>f[c.field]),u.push(c)}else if(c.type==="stack"){let f=[];if(c.children.forEach(m=>{if(m.type==="bar"){if(!m.field)return;if(!n.data[0].hasOwnProperty(m.field)){console.warn(`ui-chart: series field "${m.field}" does not exist`);return}o[m.field]=n.data.map(p=>p[m.field]),f.push(m)}}),f.length>0){let m={...c,children:f};u.push(m)}}}),{keys:u,values:o,bars(){let{start:c,center:f,width:m}=n.axes.x.scale(n.axes.x.domain[0],{area:n.axes.x.asArea}),p=l.width??"90%";p.match(/^(\d+)%$/)?p=m*Number(p.replace("%",""))/100:p=Number(p.replace("px",""));let w=(m-p)/2,A=l.gap??"2%";A.match(/^(\d+)%$/)?A=p*Number(A.replace("%",""))/100:A=Number(A.replace("px",""));let _=u.length,L=A*(_-1),O=_,E=u.reduce((S,N)=>(N.width&&(N.width.match(/^(\d+)%$/)?S+=p*Number(N.width.replace("%",""))/100:S+=Number(N.width.replace("px","")),O--),S),0),b=O>0?(p-E-L)/O:0;b===0&&(w=(m-(E+L))/2);let q=w;return u.reduce((S,N,F)=>{let v=b;if(N.width&&(N.width.match(/^(\d+)%$/)?v=p*Number(N.width.replace("%",""))/100:v=Number(N.width.replace("px",""))),F>0&&(q+=A),N.type==="bar"){let M=[];o[N.field].forEach((k,C)=>{let{start:D}=n.axes.x.scale(n.data[C][n.axes.x.key],{area:n.axes.x.asArea}),P=D+q,$=k>=0?n.axes.y.scale(k).center:n.axes.y.scale(0).center,W=k>=0?n.axes.y.scale(0).center-$:n.axes.y.scale(k).center-$,R=Number(N.minHeight.replace("px","")),H=N.radius;W<R&&($-=R-W,W=R),k<0&&(H={topLeft:H.bottomLeft,topRight:H.bottomRight,bottomRight:H.topRight,bottomLeft:H.topLeft});let z={x:P,y:$,width:v,height:W,path:()=>Pe(P,$,v,W,H)};M.push(z)}),S[N.field]=M}if(N.type==="stack"){let M=[],k=Number(N.gap.replace("px","")),C=[],D=[],P=N.radius,$=[],W=[];P&&N.children.forEach(R=>{R.type==="bar"&&o[R.field].forEach((H,z)=>{H>=0?($[z]=R.field,W[z]===void 0&&(W[z]=R.field)):(W[z]=R.field,$[z]===void 0&&($[z]=R.field))})}),N.children.forEach(R=>{if(R.type==="bar"){let H=[];o[R.field].forEach((z,J)=>{C[J]===void 0&&(C[J]=0,D[J]=0);let{start:si}=n.axes.x.scale(n.data[J][n.axes.x.key],{area:n.axes.x.asArea}),$t=si+q,nt=z>=0?n.axes.y.scale(z).center:n.axes.y.scale(0).center,jt=z>=0?n.axes.y.scale(0).center-nt:n.axes.y.scale(z).center-nt,ts=Number(R.minHeight.replace("px","")),Bt=R.radius;if(P){let cn=R.field===$[J],dn=R.field===W[J],Tt={topLeft:0,topRight:0,bottomLeft:0,bottomRight:0};cn&&(Tt.topLeft=P.topLeft,Tt.topRight=P.topRight),dn&&(Tt.bottomLeft=P.bottomLeft,Tt.bottomRight=P.bottomRight),z<0?Bt={topLeft:Tt.bottomLeft,topRight:Tt.bottomRight,bottomLeft:Tt.topLeft,bottomRight:Tt.topRight}:Bt=Tt}jt<ts&&(nt-=ts-jt,jt=ts),nt=z>=0?nt-C[J]:nt+D[J],z<0&&(Bt={topLeft:Bt.bottomLeft,topRight:Bt.bottomRight,bottomRight:Bt.topRight,bottomLeft:Bt.topLeft});let hn={x:$t,y:nt,width:v,height:jt,path:()=>Pe($t,nt,v,jt,Bt)};z>=0?C[J]+=jt+k:D[J]+=jt+k,H.push(hn)}),S[R.field]=H}})}return q+=v,S},{})}}}))},closestXPoint(l){return this.closestXPoints(l)[0]},closestXPoints(l){return a("closestXPoints",e+s+l,()=>{let o=[],u=1/0,d=null;return this.axes.x.points.forEach(c=>{let f=Math.abs(c.center-l);f<u&&(u=f,d=c)}),d&&o.push(d),o})},updateDimensions(l,o){this.width=l.width,this.height=l.height,this.inset=o,s++},updateData(l){let o=JSON.parse(JSON.stringify(l));o[0]!==void 0&&typeof o[0]!="object"&&(o=o.map((u,d)=>({value:u}))),o.every(u=>u.index)||o.forEach((u,d)=>{u.index=d}),this.data=o,e++}};return n.updateData(i.data),n}function ji(i,t){let e=[...new Set(t)];return i==="time"?al(e):i==="linear"?(e.sort((s,r)=>Number(s)-Number(r)),e.length===1?e[0]===0?[Number(e[0]),1]:e[0]>0?[0,Number(e[0])]:[Number(e[0]),0]:[Number(e[0]),Number(e[e.length-1])]):[e[0],e[e.length-1]]}function Ja(i,t,e){let s=[];if(t.type==="linear"){if(t.tickValues)return t.tickValues;let[r,a]=e,n=t.tickCount?Number(t.tickCount):5,l=t.tickStart===0||t.tickStart==="0"?0:t.tickStart||"auto",o=t.tickEnd===0||t.tickEnd==="0"?0:t.tickEnd||"auto";l==="auto"&&r>0&&a>0&&(r=0),o!=="auto"&&o!=="max"&&!isNaN(Number(o))&&(a=Number(o));let u=Number(t.interval),d;if(t.interval==="auto"||Number.isNaN(u)){let p=(a-r)/(n-1),w=Math.pow(10,Math.floor(Math.log10(p))),A=p/w;A<1.5?d=1:A<3?d=2:A<7?d=5:d=10,d*=w}else d=u;let c;l==="auto"?c=Math.floor(r/d)*d:l==="min"?c=r:c=Number(l);let f=c;for(;f<=a+d*.1;)f>=r-d*.1&&s.push(f),f+=d;if(o==="max")Math.abs(s[s.length-1]-e[1])>d*.1&&s.push(e[1]);else if(o!=="auto"&&!isNaN(Number(o))){let m=Number(o),p=s.length;s=Array.from({length:p},(w,A)=>c+(m-c)*(A/(p-1)))}if(s.length>n*2){let m=Math.ceil(s.length/n);s=s.filter((p,w)=>w%m===0)}}else if(t.type==="time"){let[r,a]=sn(e[0],e[1],t.tickCount,t.interval,t.asArea);return a}else if(t.type==="categorical"&&(i.forEach(r=>{let a=r[t.key];s.push(a)}),t.tickCount&&s.length>t.tickCount)){let r=Math.ceil(s.length/t.tickCount);s=s.filter((a,n)=>n%r===0)}return s}function Za(i,t,e,s,r,a,n){let l=[];return t==="time"?(e||([e]=sn(i[0],i[i.length-1],null,a)),e={...e,timeZone:"UTC"},l=i.map(o=>new Date(o).toLocaleString(n,e))):t==="linear"?e?l=i.map(o=>o.toLocaleString(n,e)):l=i.map(o=>o.toLocaleString(n)):l=i.map(o=>o+""),r&&(l=l.map(o=>r+o)),s&&(l=l.map(o=>o+s)),l}function el(i,t,e){let s=[...new Set(e)],r=s.length,a=new Map(s.map((n,l)=>[n,l]));return function(n,{area:l=!1}={}){if(n==null)return;let o=a.get(n);if(o===void 0)return;if(l){let c=(t[1]-t[0])/(l?r:r-1),f=t[0]+o*c,m=f+c/2,p=f+c;return{start:f,center:m,end:p,width:c}}let u=(t[1]-t[0])/(r-1),d=t[0]+o*u;return{start:d,center:d,end:d,width:0}}}function il(i,t,e){let s=i[1]-i[0],r=t[1]-t[0];return function(a){let n=t[0]+(a-i[0])*(r/s);return{start:n,center:n,end:n,width:0}}}function Qa(i){if(i.length<2)return"";let t=o=>o<0?-1:1,e=(o,u,d,c,f,m)=>{let p=d-o,w=f-d,A=(c-u)/(p||w<0&&-0),_=(m-c)/(w||p<0&&-0),L=(A*w+_*p)/(p+w);return(t(A)+t(_))*Math.min(Math.abs(A),Math.abs(_),.5*Math.abs(L))||0},s=(o,u,d,c,f)=>{let m=d-o;return m?(3*(c-u)/m-f)/2:f},r=`M${i[0][0]},${i[0][1]}`;if(i.length===2)return r+`L${i[1][0]},${i[1][1]}`;for(let o=0;o<i.length-2;o++){let u=i[o],d=i[o+1];if(u[0]===d[0]&&u[1]===d[1])continue;let c=i[o+2],f=e(u[0],u[1],d[0],d[1],c[0],c[1]),m=(d[0]-u[0])/3,p=u[0]+m,w=u[1]+m*(o===0?s(u[0],u[1],d[0],d[1],f):i[o-1]?e(i[o-1][0],i[o-1][1],u[0],u[1],d[0],d[1]):f),A=d[0]-m,_=d[1]-m*f;r+=`C${p},${w} ${A},${_} ${d[0]},${d[1]}`}let a=i.length,n=i[a-1],l=i[a-2];if(!(n[0]===l[0]&&n[1]===l[1])){let o=e(i[a-3][0],i[a-3][1],l[0],l[1],n[0],n[1]),u=(n[0]-l[0])/3,d=l[0]+u,c=l[1]+u*o,f=n[0]-u,m=n[1]-u*s(l[0],l[1],n[0],n[1],o);r+=`C${d},${c} ${f},${m} ${n[0]},${n[1]}`}return r}function sl(i,t=.05){if(!i||i.length<2)return"";let e=`M ${i[0][0]} ${i[0][1]}`;for(let s=1;s<i.length;s++){let r=i[s],a=i[s-1],n=i[s-2]||a,l=i[s+1]||r,o=a[0]+(l[0]-n[0])*t,u=a[1]+(l[1]-n[1])*t,d=r[0]-(l[0]-n[0])*t,c=r[1]-(l[1]-n[1])*t;e+=` C ${o} ${u}, ${d} ${c}, ${r[0]} ${r[1]}`}return e}function tn(i){return sl(i,0)}function Pe(i,t,e,s,r=null){let a=r?.topLeft??0,n=r?.topRight??0,l=r?.bottomRight??0,o=r?.bottomLeft??0,u=Math.min(Math.abs(e)/2,Math.abs(s)/2);if(a=Math.min(a,u),n=Math.min(n,u),l=Math.min(l,u),o=Math.min(o,u),a===0&&n===0&&l===0&&o===0)return`M${i},${t} h${e} v${s} h-${e} v-${s}`;let d=t,c=t+s,f=a>0,m=n>0,p=l>0,w=o>0,A=i,_=i+e,L="";return f?(L+=`M${A},${d+a}`,L+=`A${a},${a} 0 0 1 ${A+a},${d}`):L+=`M${A},${d}`,m?(L+=`H${_-n}`,L+=`A${n},${n} 0 0 1 ${_},${d+n}`):L+=`H${_}`,p?(L+=`V${c-l}`,L+=`A${l},${l} 0 0 1 ${_-l},${c}`):L+=`V${c}`,w?(L+=`H${A+o}`,L+=`A${o},${o} 0 0 1 ${A},${c-o}`):L+=`H${A}`,L+=`V${d+(f?a:0)}`,L+="Z",L}function rl(i){return i instanceof Date||typeof i=="string"&&i.includes("-")&&!isNaN(Date.parse(i))}function al(i){return i.sort((t,e)=>typeof t=="string"?t.localeCompare(e):t-e),[Ji(i[0]),Ji(i[i.length-1])]}function nl(i,t,e){let s=new Date(i[0]).getTime(),a=new Date(i[1]).getTime()-s,n=t[1]-t[0],o=(e?[...new Set(e)]:[]).length;return function(u,{area:d=!1}={}){if(!u)return;let c=Ji(u);if(isNaN(c.getTime()))return;let f=(c.getTime()-s)/a;if(d){let p=Math.floor(f*o);p=Math.min(Math.max(0,p),o-1);let w=n/o,A=t[0]+p*w,_=A+w/2,L=A+w;return{start:A,center:_,end:L,width:w}}let m=t[0]+f*n;return{start:m,center:m,end:m,width:0}}}function sn(i,t,e,s,r=!1){let a=i,n=t,u=(n-a)/1e3/60,d=u/60,c=d/24,f=c/30,m=c/365,p,w,A;switch(s){case"second":p={hour:"numeric",minute:"numeric",second:"numeric"},w=E=>new Date(Date.UTC(E.getUTCFullYear(),E.getUTCMonth(),E.getUTCDate(),E.getUTCHours(),E.getUTCMinutes(),E.getUTCSeconds()+1)),A=new Date(Date.UTC(a.getUTCFullYear(),a.getUTCMonth(),a.getUTCDate(),a.getUTCHours(),a.getUTCMinutes(),a.getUTCSeconds()));break;case"minute":p={hour:"numeric",minute:"numeric"},w=E=>new Date(Date.UTC(E.getUTCFullYear(),E.getUTCMonth(),E.getUTCDate(),E.getUTCHours(),E.getUTCMinutes()+1)),A=new Date(Date.UTC(a.getUTCFullYear(),a.getUTCMonth(),a.getUTCDate(),a.getUTCHours(),a.getUTCMinutes()));break;case"hour":p={hour:"numeric",minute:"numeric"},w=E=>new Date(Date.UTC(E.getUTCFullYear(),E.getUTCMonth(),E.getUTCDate(),E.getUTCHours()+1)),A=new Date(Date.UTC(a.getUTCFullYear(),a.getUTCMonth(),a.getUTCDate(),a.getUTCHours()));break;case"day":p={day:"numeric"},w=E=>new Date(Date.UTC(E.getUTCFullYear(),E.getUTCMonth(),E.getUTCDate()+1)),A=new Date(Date.UTC(a.getUTCFullYear(),a.getUTCMonth(),a.getUTCDate()));break;case"week":p={day:"numeric",month:"short"},w=E=>new Date(Date.UTC(E.getUTCFullYear(),E.getUTCMonth(),E.getUTCDate()+7)),A=new Date(Date.UTC(a.getUTCFullYear(),a.getUTCMonth(),a.getUTCDate()));break;case"month":p={month:"short",day:"numeric"},w=E=>new Date(Date.UTC(E.getUTCFullYear(),E.getUTCMonth()+1,1)),A=new Date(Date.UTC(a.getUTCFullYear(),a.getUTCMonth(),1));break;case"year":p={year:"numeric"},w=E=>new Date(Date.UTC(E.getUTCFullYear()+1,0,1)),A=new Date(Date.UTC(a.getUTCFullYear(),0,1));break;default:}if(!w)if(d<1){p={hour:"numeric",minute:"numeric"};let E=e?Math.max(1,Math.floor(u/(e-1))):1;w=b=>new Date(Date.UTC(b.getUTCFullYear(),b.getUTCMonth(),b.getUTCDate(),b.getUTCHours(),b.getUTCMinutes()+E)),A=new Date(Date.UTC(a.getUTCFullYear(),a.getUTCMonth(),a.getUTCDate(),a.getUTCHours()))}else if(c<1){p={hour:"numeric"};let E=e?Math.max(1,Math.floor(d/(e-1))):1;w=b=>new Date(Date.UTC(b.getUTCFullYear(),b.getUTCMonth(),b.getUTCDate(),b.getUTCHours()+E)),A=new Date(Date.UTC(a.getUTCFullYear(),a.getUTCMonth(),a.getUTCDate(),0))}else if(c<=7){p={weekday:"short",hour:"numeric"};let E=e?Math.max(1,Math.floor(d/(e-1))):6;w=b=>new Date(Date.UTC(b.getUTCFullYear(),b.getUTCMonth(),b.getUTCDate(),b.getUTCHours()+E)),A=new Date(Date.UTC(a.getUTCFullYear(),a.getUTCMonth(),a.getUTCDate(),0))}else if(c<=30){p={month:"short",day:"numeric"};let E=e?Math.max(1,Math.floor(c/(e-1))):1;w=b=>new Date(Date.UTC(b.getUTCFullYear(),b.getUTCMonth(),b.getUTCDate()+E)),A=new Date(Date.UTC(a.getUTCFullYear(),a.getUTCMonth(),a.getUTCDate()))}else if(f<=6){p={month:"short",day:"numeric"};let E=e?Math.max(1,Math.floor(c/(e-1))):7;w=b=>new Date(Date.UTC(b.getUTCFullYear(),b.getUTCMonth(),b.getUTCDate()+E)),A=new Date(Date.UTC(a.getUTCFullYear(),a.getUTCMonth(),a.getUTCDate()))}else if(m<2){p={month:"short"};let E=e?Math.max(1,Math.floor(f/(e-1))):1;w=b=>new Date(Date.UTC(b.getUTCFullYear(),b.getUTCMonth()+E,1)),A=new Date(Date.UTC(a.getUTCFullYear(),a.getUTCMonth()))}else{p={year:"numeric"};let E=e?Math.max(1,Math.floor(m/(e-1))):1;w=b=>new Date(Date.UTC(b.getUTCFullYear()+E,0,1)),A=new Date(Date.UTC(a.getUTCFullYear(),0,1))}let _=a;if(r){let E=w(A);for(;E<=a;)A=E,E=w(A);_=A}let L=[_],O=_;for(;O<=n;)O=w(O),O<=n&&L.push(new Date(O.getTime()));return[p,L]}function Ji(i){if(i instanceof Date)return i;let{year:t,month:e,day:s,hour:r,minute:a,second:n,millisecond:l}=ol(i);return new Date(Date.UTC(t,e-1,s,r,a,n,l))}function ol(i){let t=i.match(/^(\d{4})(?:-(\d{2}))?(?:-(\d{2}))?(?:T(\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(Z)?)?$/);if(!t)throw new Error("Invalid date format");return{year:t[1]?parseInt(t[1],10):null,month:t[2]?parseInt(t[2],10):null,day:t[3]?parseInt(t[3],10):null,hour:t[4]?parseInt(t[4],10):null,minute:t[5]?parseInt(t[5],10):null,second:t[6]?parseInt(t[6],10):null,millisecond:t[7]?parseInt(t[7].padEnd(3,"0"),10):null,utc:!!t[8]}}var Ir=class extends HTMLElement{constructor(){super(),this.querySelectorAll("[data-appended]").forEach(s=>s.remove());let t=this.querySelector('template[name="svg"]'),e=Si(t);t.after(e),this.init(t,e)}init(t,e){this._initialized||(this._data=this.hasAttribute("value")?JSON.parse(this.getAttribute("value")):[],this._observable=new Wt,this._selectable={getState:()=>this._data,setState:S=>{this._data=S,this._observable.notify("data",this._data)}},this._controllable=new U(this),this._controllable.initial(S=>S&&this._selectable.setState(S)),this._controllable.getter(()=>this._selectable.getState()),this._controllable.setter(S=>{this._selectable.setState(S)}),this._initialized=!0);let s=this.hasAttribute("locale")?this.getAttribute("locale"):Ai(),r=!1,a={svg:t,bars:{},lines:{},areas:{},points:{},groups:[],stacks:[],cursor:t.content.querySelector('template[name="cursor"]'),zeroLine:t.content.querySelector('template[name="zero-line"]'),axes:{x:{template:t.content.querySelector('template[name="axis"][axis="x"]'),axisLine:t.content.querySelector('template[name="axis"][axis="x"] template[name="axis-line"]'),gridLine:t.content.querySelector('template[name="axis"][axis="x"] template[name="grid-line"]'),tickMark:t.content.querySelector('template[name="axis"][axis="x"] template[name="tick-mark"]'),tickLabel:t.content.querySelector('template[name="axis"][axis="x"] template[name="tick-label"]')},y:{template:t.content.querySelector('template[name="axis"][axis="y"]'),axisLine:t.content.querySelector('template[name="axis"][axis="y"] template[name="axis-line"]'),gridLine:t.content.querySelector('template[name="axis"][axis="y"] template[name="grid-line"]'),tickMark:t.content.querySelector('template[name="axis"][axis="y"] template[name="tick-mark"]'),tickLabel:t.content.querySelector('template[name="axis"][axis="y"] template[name="tick-label"]')}},tooltip:this.querySelector('template[name="tooltip"]'),summary:this.querySelector('template[name="summary"]')};t.content.querySelectorAll('template[name="group"]').forEach(S=>{a.groups.push(S)}),t.content.querySelectorAll('template[name="stack"]:not(template[name="group"] template[name="stack"])').forEach(S=>{a.stacks.push(S)}),t.content.querySelectorAll('template[name="bar"]:not(template[name="stack"] template[name="bar"]):not(template[name="group"] template[name="bar"])').forEach(S=>{a.bars[S.getAttribute("field")]=S,r=!0}),t.content.querySelectorAll('template[name="line"]').forEach(S=>{a.lines[S.getAttribute("field")]=S}),t.content.querySelectorAll('template[name="area"]').forEach(S=>{a.areas[S.getAttribute("field")]=S}),t.content.querySelectorAll('template[name="point"]').forEach(S=>{a.points[S.getAttribute("field")]=S});let n=()=>{},l=()=>{},o=()=>{},u=()=>{},d=null,c="line",f=null,m=null,p=null,w=[];t.content.querySelectorAll('template[name="stack"]:not(template[name="group"] template[name="stack"])').forEach(S=>{let N={width:S.getAttribute("width")??"90%",gap:S.getAttribute("gap")??"0",radius:S.hasAttribute("radius")?de(S.getAttribute("radius")):null,children:[]};S.querySelectorAll('template[name="bar"]').forEach(F=>{let v={type:"bar",field:F.getAttribute("field"),width:F.getAttribute("width"),minHeight:F.getAttribute("min-height")??"0",radius:de(F.getAttribute("radius")??"0")};N.children.push(v),r=!0}),w.push(N)});let A=[];t.content.querySelectorAll('template[name="group"]').forEach(S=>{let N={width:S.getAttribute("width")??"90%",gap:S.getAttribute("gap")??"2%",children:[]};S.querySelectorAll('template[name="stack"], template[name="bar"]:not(template[name="stack"] template[name="bar"])').forEach(F=>{let v={};F.getAttribute("name")==="stack"?(v={type:"stack",width:F.getAttribute("width"),gap:F.getAttribute("gap")??"0",radius:F.hasAttribute("radius")?de(F.getAttribute("radius")):null,children:[]},F.querySelectorAll('template[name="bar"]').forEach(M=>{let k={type:"bar",field:M.getAttribute("field"),width:M.getAttribute("width"),minHeight:M.getAttribute("min-height")??"0",radius:de(M.getAttribute("radius")??"0")};v.children.push(k),r=!0})):F.getAttribute("name")==="bar"&&(v={type:"bar",field:F.getAttribute("field"),width:F.getAttribute("width"),minHeight:F.getAttribute("min-height")??"0",radius:de(F.getAttribute("radius")??"4 0")},r=!0),N.children.push(v)}),A.push(N)}),f=document.createElementNS("http://www.w3.org/2000/svg","rect"),f.setAttribute("data-overlay",""),f.setAttribute("fill","none"),f.setAttribute("pointer-events","all"),f.addEventListener("mousemove",ds(function(S){n(S),l(S),o(S),u(S)},1)),f.addEventListener("mouseleave",()=>{n(null),l(null),o(null),u(null)}),e.appendChild(f),a.cursor&&(d=ct(a.cursor),d.setAttribute("data-cursor",""),e.appendChild(d));let _={left:8,right:8,top:8,bottom:8};if(a.svg?.hasAttribute("gutter")){let S=a.svg?.getAttribute("gutter").split(" ").map(N=>N.replace("px","")).map(Number);S.length===1?(_.top=S[0],_.right=S[0],_.bottom=S[0],_.left=S[0]):S.length===2?(_.top=S[0],_.right=S[1],_.bottom=S[0],_.left=S[1]):S.length===3?(_.top=S[0],_.right=S[1],_.bottom=S[2],_.left=S[1]):S.length===4&&(_.top=S[0],_.right=S[1],_.bottom=S[2],_.left=S[3])}let[L,O]=ll(e,r),E=e.parentElement.getBoundingClientRect();if(E.width===0||E.height===0){let S=new ResizeObserver(N=>{let F=N[0];F.contentRect.width>0&&F.contentRect.height>0&&(S.disconnect(),this.init(t,e))});S.observe(e.parentElement);return}a.tooltip&&(m=Si(a.tooltip),a.tooltip.after(m)),a.summary&&(p=Si(a.summary),a.summary.after(p));let b=en({locale:s,data:this._data,stacksMetadata:w,groupsMetadata:A,width:E.width,height:E.height,inset:{left:0,right:0,top:0,bottom:0},axes:{x:{key:L,format:a.axes.x.template?.hasAttribute("format")?JSON.parse(a.axes.x.template?.getAttribute("format")):null,scale:a.axes.x.template?.getAttribute("scale"),interval:a.axes.x.template?.getAttribute("interval"),position:a.axes.x.template?.getAttribute("position"),tickCount:a.axes.x.template?.getAttribute("tick-count")||a.axes.x.tickLabel?.getAttribute("target-tick-count"),tickStart:a.axes.x.template?.getAttribute("tick-start"),tickEnd:a.axes.x.template?.getAttribute("tick-end"),tickStep:a.axes.x.template?.getAttribute("tick-step")?Number(a.axes.x.template?.getAttribute("tick-step")):null,tickSuffix:a.axes.x.template?.getAttribute("tick-suffix"),tickPrefix:a.axes.x.template?.getAttribute("tick-prefix"),tickValues:a.axes.x.template?.hasAttribute("tick-values")?JSON.parse(a.axes.x.template?.getAttribute("tick-values")):null,asArea:r||a.cursor?.innerHTML?.match(/type="([^"]+)"/)?.[1]==="area"},y:{keys:O,format:a.axes.y.template?.hasAttribute("format")?JSON.parse(a.axes.y.template?.getAttribute("format")):null,scale:a.axes.y.template?.getAttribute("scale"),interval:a.axes.y.template?.getAttribute("interval"),position:a.axes.y.template?.getAttribute("position"),tickCount:a.axes.y.template?.getAttribute("tick-count")||a.axes.y.tickLabel?.getAttribute("target-tick-count"),tickStart:a.axes.y.template?.getAttribute("tick-start"),tickEnd:a.axes.y.template?.getAttribute("tick-end"),tickStep:a.axes.y.template?.getAttribute("tick-step")?Number(a.axes.y.template?.getAttribute("tick-step")):null,tickSuffix:a.axes.y.template?.getAttribute("tick-suffix"),tickPrefix:a.axes.y.template?.getAttribute("tick-prefix"),tickValues:a.axes.y.template?.hasAttribute("tick-values")?JSON.parse(a.axes.y.template?.getAttribute("tick-values")):null}}}),q=(S=!0)=>{if(h(e,"viewBox",`0 0 ${b.width} ${b.height}`),b.data.length===0)return;if(b.data.length===1){console.warn("ui-chart: chart only has one data point so it cannot be rendered.");return}if(b.data[0][b.axes.x.key]===void 0){console.warn(`ui-chart: axis field "${b.axes.x.key}" does not exist`);return}if(Object.entries(b.series).forEach(([v,M])=>{let k=e.querySelector(`[data-bar-group][data-series="${v}"]`),C=a.bars[v];if(C){let D=C.hasAttribute("width")?C.getAttribute("width"):"90%",P=de(C.hasAttribute("radius")?C.getAttribute("radius"):"8 0"),$=C.hasAttribute("min-height")?Number(C.getAttribute("min-height")):0;k?.remove(),k=document.createElementNS("http://www.w3.org/2000/svg","g"),k.setAttribute("data-bar-group",""),k.setAttribute("data-series",v),M.bars({barWidth:D,minHeight:$,radius:P}).forEach(W=>{let R=ct(C);R.setAttribute("data-bar",""),R.setAttribute("data-series",v),R.setAttribute("d",W.path(P)),k.appendChild(R)}),e.appendChild(k)}}),Object.entries(b.stackedSeries).forEach(([v,M])=>{let k=e.querySelector(`[data-stack][data-stack-index="${v}"]`),C=a.stacks[v];if(!C)return;k?.remove(),k=document.createElementNS("http://www.w3.org/2000/svg","g"),k.setAttribute("data-stack",""),k.setAttribute("data-stack-index",v);let D={bars:{}};C.querySelectorAll('template[name="bar"]').forEach(P=>{D.bars[P.getAttribute("field")]=P}),Object.entries(M.bars()).forEach(([P,$])=>{let W=D.bars[P],R=document.createElementNS("http://www.w3.org/2000/svg","g");R.setAttribute("data-bar-group",""),R.setAttribute("data-series",P),$.forEach(H=>{let z=ct(W);z.setAttribute("data-bar",""),z.setAttribute("data-series",P),z.setAttribute("d",H.path()),R.appendChild(z)}),k.appendChild(R)}),e.appendChild(k)}),Object.entries(b.groupedSeries).forEach(([v,M])=>{let k=e.querySelector(`[data-group][data-group-index="${v}"]`),C=a.groups[v];if(!C)return;k?.remove(),k=document.createElementNS("http://www.w3.org/2000/svg","g"),k.setAttribute("data-group",""),k.setAttribute("data-group-index",v);let D={bars:{}};C.querySelectorAll('template[name="bar"]').forEach(P=>{D.bars[P.getAttribute("field")]=P}),Object.entries(M.bars()).forEach(([P,$])=>{let W=D.bars[P],R=document.createElementNS("http://www.w3.org/2000/svg","g");R.setAttribute("data-bar-group",""),R.setAttribute("data-series",P),$.forEach(H=>{let z=ct(W);z.setAttribute("data-bar",""),z.setAttribute("data-series",P),z.setAttribute("d",H.path()),R.appendChild(z)}),k.appendChild(R)}),e.appendChild(k)}),Object.entries(b.series).forEach(([v,M])=>{let k=e.querySelector(`[data-line][data-series="${v}"]`),C=a.lines[v];if(C){let D=C.getAttribute("curve")||"smooth";if(k)k.setAttribute("d",M.linePath(D));else{let P=ct(C);P.setAttribute("data-line",""),P.setAttribute("data-series",v),P.setAttribute("d",M.linePath(D)),e.appendChild(P)}}}),Object.entries(b.series).forEach(([v,M])=>{let k=e.querySelector(`[data-area][data-series="${v}"]`),C=a.areas[v];if(C){let D=C.getAttribute("curve")||"smooth";if(k)k.setAttribute("d",M.areaPath(D));else{let P=ct(C);P.setAttribute("data-area",""),P.setAttribute("data-series",v),P.setAttribute("d",M.areaPath(D)),e.appendChild(P)}}}),Object.entries(b.series).forEach(([v,M])=>{let k=e.querySelector(`[data-point-group][data-series="${v}"]`),C=a.points[v];C&&(e.querySelector(`[data-point-group][data-series="${v}"]`)?.remove(),k=document.createElementNS("http://www.w3.org/2000/svg","g"),k.setAttribute("data-point-group",""),k.setAttribute("data-series",v),M.points.forEach(D=>{let P=ct(C);P.setAttribute("data-point",""),P.setAttribute("data-series",v),P.setAttribute("cx",D.x),P.setAttribute("cy",D.y),k.appendChild(P)}),e.appendChild(k))}),u=v=>{e.querySelectorAll("[data-point-group]").forEach(M=>{if(M.querySelectorAll("[data-point]").forEach(k=>k.removeAttribute("data-active")),v){let k=v.clientX-e.getBoundingClientRect().left,C=v.clientY-e.getBoundingClientRect().top;k>=b.inset.left&&k<=b.width-b.inset.right&&C>=b.inset.top&&C<=b.height-b.inset.bottom&&b.closestXPoints(k).forEach(P=>{M.querySelectorAll(`[data-point][cx="${P.x}"]`).forEach($=>$.setAttribute("data-active",""))})}else M.querySelectorAll("[data-point]").forEach(k=>k.removeAttribute("data-active"))})},a.axes.x.template){if(a.axes.x.axisLine){e.querySelector('[data-axis-line][data-axis="x"]')?.remove();let v=ct(a.axes.x.axisLine);v.setAttribute("data-axis-line",""),v.setAttribute("data-axis","x"),v.setAttribute("x1",b.axes.x.scale(b.axes.x.domain[0]).center),v.setAttribute("x2",b.axes.x.scale(b.axes.x.domain[1]).center),v.setAttribute("y1",b.axes.y.scale(b.axes.y.domain[b.axes.x.position==="bottom"?0:1]).center),v.setAttribute("y2",b.axes.y.scale(b.axes.y.domain[b.axes.x.position==="bottom"?0:1]).center),e.appendChild(v)}if(a.axes.x.gridLine){e.querySelector('[data-grid-line-group][data-axis="x"]')?.remove();let v=document.createElementNS("http://www.w3.org/2000/svg","g");v.setAttribute("data-grid-line-group",""),v.setAttribute("data-axis","x"),b.axes.x.ticks.forEach(({value:M})=>{let k=ct(a.axes.x.gridLine);k.setAttribute("data-grid-line",""),k.setAttribute("data-axis","x"),k.setAttribute("x1",b.axes.x.scale(M).center),k.setAttribute("x2",b.axes.x.scale(M).center),k.setAttribute("y1",b.inset.top),k.setAttribute("y2",b.height-b.inset.bottom),v.appendChild(k)}),e.appendChild(v)}if(a.axes.x.tickMark){e.querySelector('[data-tick-mark-group][data-axis="x"]')?.remove();let v=document.createElementNS("http://www.w3.org/2000/svg","g");v.setAttribute("data-tick-mark-group",""),v.setAttribute("data-axis","x"),b.axes.x.ticks.forEach(({value:M,label:k})=>{let C={x:b.axes.x.scale(M,{area:b.axes.x.asArea}).center,y:b.axes.y.scale(b.axes.y.domain[b.axes.x.position==="bottom"?0:1]).center},D=ct(a.axes.x.tickMark);D.setAttribute("data-tick-mark",""),D.setAttribute("data-axis","x"),D.setAttribute("transform",`translate(${C.x}, ${C.y})`),v.appendChild(D)}),e.appendChild(v)}if(a.axes.x.tickLabel){e.querySelector('[data-tick-label-group][data-axis="x"]')?.remove();let v=document.createElementNS("http://www.w3.org/2000/svg","g");v.setAttribute("data-tick-label-group",""),v.setAttribute("data-axis","x"),b.axes.x.ticks.forEach(({value:M,label:k})=>{let C={x:b.axes.x.scale(M,{area:b.axes.x.asArea}).center,y:b.axes.y.scale(b.axes.y.domain[b.axes.x.position==="bottom"?0:1]).center},D=ct(a.axes.x.tickLabel);D.querySelectorAll("slot").forEach(P=>P.replaceWith(document.createTextNode(k))),D.setAttribute("data-tick-label",""),D.setAttribute("data-axis","x"),D.setAttribute("transform",`translate(${C.x}, ${C.y})`),v.appendChild(D)}),e.appendChild(v),rn(v,b.axes.x)}}if(a.axes.y.template){if(a.axes.y.axisLine){e.querySelector('[data-axis-line][data-axis="y"]')?.remove();let v=ct(a.axes.y.axisLine);v.setAttribute("data-axis-line",""),v.setAttribute("data-axis","y"),v.setAttribute("x1",b.axes.x.scale(b.axes.x.domain[b.axes.y.position==="left"?0:1]).center),v.setAttribute("x2",b.axes.x.scale(b.axes.x.domain[b.axes.y.position==="left"?0:1]).center),v.setAttribute("y1",b.axes.y.scale(b.axes.y.domain[0]).center),v.setAttribute("y2",b.axes.y.scale(b.axes.y.domain[1]).center),e.appendChild(v)}if(a.axes.y.gridLine){e.querySelector('[data-grid-line-group][data-axis="y"]')?.remove();let v=document.createElementNS("http://www.w3.org/2000/svg","g");v.setAttribute("data-grid-line-group",""),v.setAttribute("data-axis","y"),b.axes.y.ticks.forEach(({value:M,label:k})=>{let C={x:b.axes.x.scale(b.axes.x.domain[0]).center,y:b.axes.y.scale(M).center},D=ct(a.axes.y.gridLine);D.setAttribute("data-grid-line",""),D.setAttribute("data-axis","y"),D.setAttribute("x1",b.inset.left),D.setAttribute("x2",b.width-b.inset.right),D.setAttribute("y1",C.y),D.setAttribute("y2",C.y),v.appendChild(D)}),e.appendChild(v)}if(a.axes.y.tickMark){e.querySelector('[data-tick-mark-group][data-axis="y"]')?.remove();let v=document.createElementNS("http://www.w3.org/2000/svg","g");v.setAttribute("data-tick-mark-group",""),v.setAttribute("data-axis","y"),b.axes.y.ticks.forEach(({value:M,label:k})=>{let C={x:b.axes.x.scale(b.axes.x.domain[b.axes.y.position==="left"?0:1]).center,y:b.axes.y.scale(M).center},D=ct(a.axes.y.tickMark);D.setAttribute("data-tick-mark",""),D.setAttribute("data-axis","y"),D.setAttribute("transform",`translate(${C.x}, ${C.y})`),v.appendChild(D)}),e.appendChild(v)}if(a.axes.y.tickLabel){e.querySelector('[data-tick-label-group][data-axis="y"]')?.remove();let v=document.createElementNS("http://www.w3.org/2000/svg","g");v.setAttribute("data-tick-label-group",""),v.setAttribute("data-axis","y"),b.axes.y.ticks.forEach(({value:M,label:k})=>{let C={x:b.axes.x.scale(b.axes.x.domain[b.axes.y.position==="left"?0:1]).center,y:b.axes.y.scale(M).center},D=ct(a.axes.y.tickLabel);D.querySelectorAll("slot").forEach(P=>P.replaceWith(document.createTextNode(k))),D.setAttribute("data-tick-label",""),D.setAttribute("data-axis","y"),D.setAttribute("transform",`translate(${C.x}, ${C.y})`),v.appendChild(D)}),e.appendChild(v),rn(v,b.axes.y)}}if(a.zeroLine&&b.axes.y.domain[0]<0&&b.axes.y.domain[1]>0){e.querySelector('[data-zero-line][data-axis="y"]')?.remove();let v=ct(a.zeroLine);v.setAttribute("data-zero-line",""),v.setAttribute("data-axis","y"),v.setAttribute("x1",b.axes.x.scale(b.axes.x.domain[0]).center),v.setAttribute("x2",b.axes.x.scale(b.axes.x.domain[1]).center),v.setAttribute("y1",b.axes.y.scale(0).center),v.setAttribute("y2",b.axes.y.scale(0).center),e.appendChild(v)}if(f&&(f.setAttribute("width",b.width),f.setAttribute("height",b.height),f.setAttribute("x",0),f.setAttribute("y",0)),d){c=d.getAttribute("type")??"line";let v=M=>{if(c==="area"){d.setAttribute("opacity","0.1");let P=M.start,$=b.axes.y.scale(b.axes.y.domain[1]).center,W=M.width,R=b.axes.y.scale(b.axes.y.domain[0]).center-b.axes.y.scale(b.axes.y.domain[1]).center,H=de(d.getAttribute("radius")??"0");d.setAttribute("fill","currentColor"),d.setAttribute("stroke","none"),d.setAttribute("d",Pe(P,$,W,R,H));return}d.setAttribute("opacity","1");let k=M.center,C=b.axes.y.scale(b.axes.y.domain[0]).center,D=b.axes.y.scale(b.axes.y.domain[1]).center;d.setAttribute("d",`M ${k} ${C} L ${k} ${D}`)};n=M=>{if(M){let k=e.getBoundingClientRect(),C=M.clientX-k.left,D=M.clientY-k.top;if(C>=b.inset.left&&C<=b.width-b.inset.right&&D>=b.inset.top&&D<=b.height-b.inset.bottom){let P=b.closestXPoint(C);v(P)}else d.setAttribute("opacity","0")}else d.setAttribute("opacity","0")}}m&&(l=v=>{if(v===null)x(m,"data-active");else{let M=v.clientX-e.getBoundingClientRect().left,k=v.clientY-e.getBoundingClientRect().top;if(M>=b.inset.left&&M<=b.width-b.inset.right&&k>=b.inset.top&&k<=b.height-b.inset.bottom){let C=b.closestXPoint(M);if(C){h(m,"data-active","");let D=m.getBoundingClientRect(),P=e.getBoundingClientRect(),$=P.width-(C.center+D.width+15),W=P.height-(k+D.height+15),R=$<0?C.center-D.width-15:C.center+15,H=W<0?k-D.height-15:k+15;m.style.transform=`translate(${R}px, ${H}px)`;let z=a.tooltip.content.cloneNode(!0).firstElementChild;z.querySelectorAll("slot").forEach(J=>{let si=J.getAttribute("field");if(si){let $t=J.hasAttribute("format")?JSON.parse(J.getAttribute("format")):null,nt=C.datum[si];if($t===null)return J.textContent=nt;$t={...$t,timeZone:"UTC"},an(nt)?nt=Number(nt).toLocaleString(b.locale,$t):nn(nt)&&(nt=new Date(nt).toLocaleDateString(b.locale,$t)),J.textContent=nt}}),m.innerHTML=z.innerHTML}else x(m,"data-active")}else x(m,"data-active")}}),p&&(o=v=>{let M=null;if(v!==null){let k=v.clientX-e.getBoundingClientRect().left,C=v.clientY-e.getBoundingClientRect().top;k>=b.inset.left&&k<=b.width-b.inset.right&&C>=b.inset.top&&C<=b.height-b.inset.bottom&&(M=b.closestXPoint(k))}if(M=M||b.closestXPoint(b.axes.x.range[1]),M){let k=a.summary.content.cloneNode(!0).firstElementChild;k.querySelectorAll("slot").forEach(C=>{let D=C.getAttribute("field");if(D){let P=C.hasAttribute("format")?JSON.parse(C.getAttribute("format")):{};P={...P,timeZone:"UTC"};let $=C.hasAttribute("fallback")&&v===null?C.getAttribute("fallback"):M.datum[D];an($)?$=Number($).toLocaleString(b.locale,P):nn($)&&($=new Date($).toLocaleString(b.locale,P)),C.textContent=$}}),p.innerHTML=k.innerHTML}},o(null)),e.appendChild(f),e.querySelectorAll("[data-grid-line-group]").forEach(v=>f.before(v)),e.querySelectorAll("[data-axis-line]").forEach(v=>f.before(v)),c==="area"&&e.querySelectorAll("[data-cursor]").forEach(v=>f.before(v));let N=0,F=0;if(t.content.querySelectorAll('template[name="group"], template[name="stack"]:not(template[name="group"] template[name="stack"]), template[name="bar"]:not(template[name="stack"] template[name="bar"]):not(template[name="group"] template[name="bar"]), template[name="line"], template[name="area"], template[name="point"]').forEach(v=>{let M=v.getAttribute("name"),k=v.getAttribute("field"),C;M==="group"?(C=e.querySelector(`[data-group][data-group-index="${N}"]`),N++):M==="stack"?(C=e.querySelector(`[data-stack][data-stack-index="${F}"]`),F++):M==="bar"?C=e.querySelector(`[data-bar-group][data-series="${k}"]`):M==="point"?C=e.querySelector(`[data-point-group][data-series="${k}"]`):C=e.querySelector(`[data-${M}][data-series="${k}"]`),C&&f.before(C)}),e.querySelectorAll("[data-zero-line]").forEach(v=>f.before(v)),c==="line"&&e.querySelectorAll("[data-cursor]").forEach(v=>f.before(v)),S){let v=ln(e);ul(e,b,_,v),b.updateDimensions({width:b.width,height:b.height},{left:_.left+v.left,right:_.right+v.right,top:_.top+v.top,bottom:_.bottom+v.bottom}),q(!1)}};this._observable.subscribe("resize",()=>{let S=e.parentElement.getBoundingClientRect();S.width===0||S.height===0||(b.updateDimensions({width:S.width,height:S.height},{left:0,right:0,top:0,bottom:0}),q(),d&&d.setAttribute("opacity","0"))}),this._observable.subscribe("data",()=>{b.updateData(this._data),b.updateDimensions({width:b.width,height:b.height},{left:0,right:0,top:0,bottom:0}),q()}),new ResizeObserver(()=>{this._observable.notify("resize")}).observe(this),new MutationObserver(S=>{S.forEach(N=>{N.attributeName==="value"&&this._selectable.setState(this.hasAttribute("value")?JSON.parse(this.getAttribute("value")):[])})}).observe(this,{attributes:!0,attributeFilter:["value"]})}};customElements.define("ui-chart",Ir);function ll(i,t=!1){let e=null,s=[];return i.querySelectorAll('template[name="line"], template[name="area"], template[name="point"], template[name="bar"]:not(template[name="stack"] template[name="bar"]):not(template[name="group"] template[name="bar"])').forEach(r=>{s.push(r.getAttribute("field")||"value")}),i.querySelectorAll('template[name="axis"][axis="x"]').forEach(r=>{e=r.getAttribute("field")||"index"}),s=Array.from(new Set(s)),e===null&&(e="index"),s.length===0&&!t&&(s=["value"]),[e,s]}function ct(i){let t=document.createElementNS("http://www.w3.org/2000/svg","svg");return t.setAttribute("xmlns","http://www.w3.org/2000/svg"),t.setAttribute("version","1.1"),t.innerHTML=i.innerHTML,t.firstElementChild}function ul(i,t,e,s){let r=i.querySelector('[data-tick-label-group][data-axis="x"]');if(!r||t.axes.x.type!=="categorical"||Lr(r,t.axes.x))return;let a=e.left+s.left+e.right+s.right-(t.inset.left+t.inset.right);if(a<=0)return;let n=Array.from(r.children).filter(l=>l.style.display!=="none");for(let l=0;l<n.length-1;l++){let o=n[l].getBoundingClientRect();if(n[l+1].getBoundingClientRect().left-o.right-a/Math.max(1,n.length-1)<20){let c=on(r),f=ln(i);s.bottom=Math.max(s.bottom,f.bottom),c();return}}}function rn(i,t){if(Lr(i,t)){if(t.axis==="x"&&t.type==="categorical")on(i);else if(t.axis==="x"&&t.type==="time"){let e=hl(i);if(!Lr(i,t))return;e(),cl(i)}}}function Lr(i,t){let e=Array.from(i.children);e=e.filter(s=>s.style.display!="none");for(let s=0;s<e.length;s++){let r=e[s],a=e[s+1];if(!a)break;let n=r.getBoundingClientRect(),l=a.getBoundingClientRect(),o=20;if(t.axis==="y"){if(n.bottom+o<l.top)return!0}else if(n.right+o>l.left)return!0}return!1}function on(i){let t=[];return Array.from(i.children).forEach((e,s)=>{let r=e.matches("text")?e:e.querySelector("text");Array.from(i.children).forEach((a,n)=>{let l=a.matches("text")?a:a.querySelector("text");l&&(l.style.transform="rotate(-45deg)",l.style.textAnchor="end",t.push(()=>{l.style.transform=null,l.style.textAnchor=null}))})}),()=>t.forEach(e=>e())}function hl(i){let t=Array.from(i.children);return t.forEach((e,s)=>{s%2===1&&(e.style.display="none")}),()=>t.forEach((e,s)=>{e.style.display="inline"})}function cl(i){let t=Array.from(i.children);t.forEach((n,l)=>{n.style.display="none"});let e=t[0],s=t[t.length-1],r=e.matches("text")?e:e.querySelector("text"),a=s.matches("text")?s:s.querySelector("text");return e.style.display="inline",r.style.textAnchor="start",s.style.display="inline",a.style.textAnchor="end",()=>t.forEach((n,l)=>{n.style.display="inline"})}function an(i){return typeof i=="number"||typeof i=="string"&&!isNaN(Number(i))}function nn(i){return i instanceof Date||typeof i=="string"&&!isNaN(Date.parse(i))}function ln(i){let t=i.getBoundingClientRect(),e={top:1/0,right:-1/0,bottom:-1/0,left:1/0};return Array.from(i.children).forEach(s=>{if(s.hasAttribute("data-overlay")||s.hasAttribute("data-cursor")||s.style.display==="none")return;let r=s.getBoundingClientRect();!r.width&&!r.height||(e.top=Math.min(e.top,r.top),e.right=Math.max(e.right,r.right),e.bottom=Math.max(e.bottom,r.bottom),e.left=Math.min(e.left,r.left))}),{top:Math.max(0,t.top-e.top),right:Math.max(0,e.right-t.right),bottom:Math.max(0,e.bottom-t.bottom),left:Math.max(0,t.left-e.left)}}function de(i){if(!i||i.trim()==="")throw new Error("Radius string cannot be empty");let t=i.trim().split(/\s+/).map(s=>{let r=s.replace(/px/,"");return Number(r)||0});if(t.length===0||t.every(s=>isNaN(s)))throw new Error(`Invalid radius string: "${i}"`);let e={topLeft:0,topRight:0,bottomRight:0,bottomLeft:0};if(t.length===1)e.topLeft=t[0],e.topRight=t[0],e.bottomRight=t[0],e.bottomLeft=t[0];else if(t.length===2)e.topLeft=t[0],e.topRight=t[0],e.bottomRight=t[1],e.bottomLeft=t[1];else if(t.length===4)e.topLeft=t[0],e.topRight=t[1],e.bottomRight=t[2],e.bottomLeft=t[3];else throw new Error(`Invalid radius string: "${i}". Must be 1, 2, or 4 numbers`);return e}var Mr=class extends I{boot(){h(this,"role","button"),this._disableable=new V(this),this._disableable.onInitAndChange(t=>{t?x(this,"tabindex","0"):h(this,"tabindex","0")}),this._buttonType=this.getAttribute("type")||"button"}mount(){y(this,"keydown",t=>{t.key==="Enter"&&(t.preventDefault(),this.disabled||this.click()),t.key===" "&&t.preventDefault()}),y(this,"keyup",t=>{t.key===" "&&(t.preventDefault(),t.stopPropagation(),this.disabled||this.click())}),y(this,"click",()=>{this.disabled||(this._buttonType==="submit"?this._handleSubmit():this._buttonType==="reset"&&this._handleReset())})}_handleSubmit(){let t=this.closest("form");t&&t.requestSubmit()}_handleReset(){let t=this.closest("form");t&&t.reset()}};T("button",Mr);var Pr=class extends I{mount(){let t=this.querySelector("button,ui-button");y(t,"click",()=>{yi(this,s=>!!s._closeable)?._closeable?.close()})}};T("close",Pr);var Or=class extends I{toasts=[];initiallyExpanded=!1;expanded=!1;mount(){this.initiallyExpanded=this.hasAttribute("expanded");let t=this.getAttribute("position")||"bottom right";this.verticalPosition=t.match(/\b(top|bottom)\b/)?.[0]||"bottom",this.horizontalPosition=t.match(/\b(left|start|center|right|end)\b/)?.[0]||"right",this.horizontalPosition==="left"?this.horizontalPosition="start":this.horizontalPosition==="right"&&(this.horizontalPosition="end"),h(this,"role","status")}showToast(t={}){let e=this.querySelector("ui-toast");if(!e)return console.warn("ui-toast-group: no ui-toast element found",this);this.matches(":popover-open")&&this.hidePopover(),this.showPopover();let s=Number(t.duration===void 0?5e3:t.duration),r=e.prepareToastTemplate(t),a=r.firstElementChild,n={timeout:null,el:r,height:null,contentEl:a,contentHeight:null},l=()=>{this.animateIn(n),this.updateList()},o=()=>{this.animateOut(n),this.updateList()};this.toasts.unshift(n),this.appendChild(r),l(),r.hideToast=o;let u=s!==0&&fs(()=>{n.timeout=null,o()},s);u&&(n.timeout=u),r.destroyToast=()=>{n.timeout&&(n.timeout.cancel(),n.timeout=null);let d=this.toasts.indexOf(n);d>-1&&this.toasts.splice(d,1),r.remove(),this.updateList()},r.addEventListener("mouseenter",()=>{this.pauseTimeouts(),this.initiallyExpanded||(this.expanded=!0,this.updateList())}),r.addEventListener("mouseleave",()=>{this.resumeTimeouts(),this.initiallyExpanded||(this.expanded=!1,this.updateList())}),r._closeable=new Lt(r),r._closeable.onClose(()=>r.destroyToast())}pauseTimeouts(){for(let t of this.toasts)t.timeout?.pause()}resumeTimeouts(){for(let t of this.toasts)t.timeout?.resume()}animateIn(t){let r=1.5*((this.verticalPosition==="top"?"bottom":"top")==="top"?1:-1);t.contentEl.style.opacity=0,t.contentEl.style.transform=`translateY(${r}rem)`,t.el.style.zIndex=5001,t.contentEl.offsetHeight,t.contentHeight=t.contentEl.offsetHeight,t.height=t.el.offsetHeight,t.contentEl.style.opacity=100,t.contentEl.style.transform="translateY(0)"}animateOut(t){let s=.5*(this.verticalPosition==="top"?1:-1);t.contentEl.style.transform=`translateY(${s}rem)`,t.contentEl.style.opacity=0;let r=this.toasts.indexOf(t);r>-1&&this.toasts.splice(r,1);let a=()=>{t.el.remove(),this.toasts.length===0&&(this.expanded=!1)};t.contentEl.getAnimations().length?t.contentEl.addEventListener("transitionend",()=>{a()},{once:!0}):a()}updateList(){this.initiallyExpanded||this.expanded?this.expand():this.collapse()}expand(){let t=0;for(let e of this.toasts){let s=this.verticalPosition==="top"?1:-1;e.el.style.transform=`translateY(${s*t}px)`,e.el.style.opacity=100,e.contentEl.style.height=`${e.contentHeight}px`,e.contentEl.style.overflow="auto",t+=e.height}}collapse(){let t=0,s=this.toasts[0]?.contentHeight||0;for(let r of this.toasts){let a=3,n=0,o=10*(this.verticalPosition==="top"?1:-1)*t;r.el.style.zIndex=5e3-t,t>=a?(n=1-.05*(a-1),r.el.style.opacity=0):(n=1-.05*t,r.el.style.opacity=100),r.contentEl.style.height=`${s}px`,r.contentEl.style.overflow="hidden",r.el.style.transform=`scaleX(${n}) translateY(${o}px)`,t++}}},Nr=class extends I{mount(){this.closest("ui-toast-group")||(h(this,"role","status"),document.addEventListener("keydown",t=>{t.key==="Escape"&&this.hideToast()}),this.defaultPosition=this.getAttribute("position")||"bottom end")}showToast(t={}){let e=this.template().nextElementSibling;e&&e.destroyToast();let s=Number(t.duration===void 0?5e3:t.duration),r=t.dataset?.position??this.defaultPosition;t.dataset?.position!==void 0&&delete t.dataset.position,this.setAttribute("position",r);let a=this.prepareToastTemplate(t),n=()=>{this.showPopover(),a.classList.add("showing")},l=()=>{a._hiding=!0,a.classList.remove("showing"),a.getAnimations().length?a.addEventListener("transitionend",()=>{a.remove(),this.hidePopover()},{once:!0}):(a.remove(),this.hidePopover())};this.appendChild(a),n(),a.hideToast=l;let o=s!==0&&fs(()=>{l()},s);a.destroyToast=()=>{o&&o.cancel(),a.remove(),this.hidePopover()},a.addEventListener("mouseenter",()=>{o&&o.pause()}),a.addEventListener("mouseleave",()=>{o&&o.resume()}),a._closeable=new Lt(a),a._closeable.onClose(()=>a.destroyToast())}hideToast(){let t=this.template().nextElementSibling;t&&t.destroyToast()}template(){return this.querySelector("template")}prepareToastTemplate(t){let e=t.slots||{},s=t.dataset||{},r=this.template();if(!r)return console.warn("ui-toast: no template element found",this);let a=r.content.cloneNode(!0).firstElementChild;return a.setAttribute("aria-atomic","true"),Object.entries(e).forEach(([n,l])=>{[null,void 0,!1].includes(l)||a.querySelectorAll(`slot[name="${n}"]`).forEach(o=>{o.replaceWith(document.createTextNode(l))})}),Object.entries(s).forEach(([n,l])=>{a.dataset[n]=l}),a.querySelectorAll("slot").forEach(n=>n.remove()),a}};T("toast-group",Or);T("toast",Nr);var Rr=class i extends Z{boot(){this._disableable=new V(this),this._disableable.onInitAndChange(t=>{this.walker().each(e=>{e.disabled=t})}),this._selectable=new ut(this),this._controllable=new U(this,{disabled:this._disabled,bubbles:!0}),this._focusable=new _t(this,{wrap:!0}),this._submittable=new Q(this,{name:this.getAttribute("name"),value:this._selectable.getState(),includeWhenEmpty:!1}),this._controllable.initial(t=>t&&this._selectable.setState(t)),this._controllable.getter(()=>this._selectable.getState()),this._detangled=G(),this._controllable.setter(this._detangled(t=>{this._selectable.setState(t)})),this._selectable.onChange(this._detangled(()=>{this._controllable.dispatch()})),this._selectable.onInitAndChange(()=>{this._submittable.update(this._selectable.getState())}),y(this,"keydown",t=>{["ArrowDown","ArrowRight"].includes(t.key)?(this._focusable.focusNext(),t.preventDefault(),t.stopPropagation()):["ArrowUp","ArrowLeft"].includes(t.key)&&(this._focusable.focusPrev(),t.preventDefault(),t.stopPropagation())}),h(this,"role","radiogroup"),queueMicrotask(()=>{this._submittable.update(this._selectable.getState())})}walker(){return tt(this,(t,{skip:e,reject:s})=>{if(t instanceof i)return s();if(t.localName!=="ui-radio")return e()})}},Fr=class extends Z{boot(){let t=this;this._disableable=new V(this),this._selectable=new Y(t,{value:this.hasAttribute("value")?this.getAttribute("value"):Math.random().toString(36).substring(2,10),label:this.hasAttribute("label")?this.getAttribute("label"):null,selectedInitially:this.hasAttribute("checked"),dataAttr:"data-checked",ariaAttr:"aria-checked"}),this._selectable.onChange(()=>{this._selectable.isSelected()&&this._focusable.focus(!1)}),this._disableable.onChange(e=>{e?this._focusable.untabbable():this._selectable.isSelected()&&this._focusable.tabbable()}),h(t,"role","radio"),this._focusable=new st(t,{disableable:this._disableable,tabbableAttr:"data-active"}),y(t,"click",this._disableable.disabled(e=>{e.preventDefault(),e.stopPropagation()}),{capture:!0}),y(t,"click",this._disableable.enabled(e=>{this._selectable.press()})),y(t,"keydown",this._disableable.enabled(e=>{e.key==="Enter"&&this.closest("form")?.requestSubmit()})),y(t,"keydown",this._disableable.enabled(e=>{e.key===" "&&(e.preventDefault(),e.stopPropagation())})),y(t,"keyup",this._disableable.enabled(e=>{e.key===" "&&(this._selectable.press(),e.preventDefault(),e.stopPropagation())})),dl(t),y(t,"focus",e=>{ee()&&this._selectable.select()})}get value(){return this._selectable?.getValue()}set value(t){this._selectable&&(this._selectable.value=t+"")}get checked(){return this._selectable.isSelected()}set checked(t){(this.closest("ui-radio-group")?._detangled||(()=>{}))(()=>{t&&this._selectable.select()})()}};function dl(i){i.closest("label")?.addEventListener("click",t=>{i.contains(t.target)||i.click()})}T("radio-group",Rr);T("radio",Fr);var Vr=class extends I{boot(){y(this,"scroll",t=>{this.updateAttributes()},{passive:!0}),new ResizeObserver(()=>{this.updateAttributes()}).observe(this)}mount(){queueMicrotask(()=>{this.updateAttributes()})}updateAttributes(){this.scrollLeft>12?h(this,"data-scrolled-right",""):x(this,"data-scrolled-right"),this.scrollWidth-this.clientWidth-this.scrollLeft>12?h(this,"data-scrolled-left",""):x(this,"data-scrolled-left")}};T("table-scroll-area",Vr);var Zi=class i extends I{boot(){this._disabled=this.hasAttribute("disabled")}mount(){this.walkPanels(t=>un(t)),new MutationObserver(t=>{this.walkPanels(e=>un(e))}).observe(this,{childList:!0})}showPanel(t){this.walkPanels(e=>{e.getAttribute("name")===t?e.show():e.hide()})}getPanel(t){return this.walkPanels((e,s)=>{e.getAttribute("name")===t&&s(e)})}walkPanels(t){let e=!1,s;for(let r of this.children)if(!(r instanceof i)&&!(r instanceof Qi)&&(t(r,a=>{e=!0,s=a}),e))break;return s}},qr=class extends I{boot(){y(this,"scroll",t=>{this.updateScrollVariable()},{passive:!0}),new ResizeObserver(()=>{this.updateScrollVariable()}).observe(this)}updateScrollVariable(){let t=Math.abs(this.scrollLeft)/(this.scrollWidth-this.clientWidth)*100;this.style.setProperty("--flux-scroll-percentage",t+"%")}},Qi=class i extends Z{boot(){this._focusable=new _t(this,{wrap:!0}),this._selectableGroup=new ut(this),this._controllable=new U(this,{disabled:this._disabled}),this._controllable.initial(e=>e&&this._selectableGroup.setState(e)),this._controllable.getter(()=>this._selectableGroup.getState());let t=G();this._controllable.setter(t(e=>{this._selectableGroup.setState(e)})),this._selectableGroup.onChange(t(()=>{this._controllable.dispatch()})),y(this,"keydown",e=>{["ArrowDown","ArrowRight"].includes(e.key)?(this._focusable.focusNext(),e.preventDefault(),e.stopPropagation()):["ArrowUp","ArrowLeft"].includes(e.key)&&(this._focusable.focusPrev(),e.preventDefault(),e.stopPropagation())}),h(this,"role","tablist")}mount(){this.initializeTabs(),this._focusable.ensureTabbable(),this._selectableGroup.getState()||this._selectableGroup.selectFirst(),new MutationObserver(t=>{this.initializeTabs();let e=this._selectableGroup.selected();e.el.closest("ui-tab-group").showPanel(e.value)}).observe(this,{childList:!0})}initializeTabs(){this.walker().each(t=>{t._initialized||t._disableable||t.hasAttribute("action")||(fl(t),t._initialized=!0)})}walker(){return tt(this,(t,{skip:e,reject:s})=>{if(t instanceof Zi||t instanceof i)return s();if(!["a","button"].includes(t.localName))return e()})}};function fl(i){i._disableable=new V(i);let t=i.matches("a")?i:null,e=t||i;i._disableable.onInitAndChange(r=>{r?h(e,"aria-disabled","true"):x(e,"aria-disabled")});let s=K(e,"tab");if(h(e,"role","tab"),e._focusable=new st(e,{disableable:i._disableable,tabbableAttr:"data-active"}),!t){let r=i.getAttribute("name");i._selectable=new Y(i,{value:r||Math.random().toString(36).substring(2,10),label:i.hasAttribute("label")?i.getAttribute("label"):i.textContent.trim(),selectedInitially:i.hasAttribute("selected"),toggleable:!1}),y(i,"click",()=>i._selectable.press()),i._selectable.onInitAndChange(()=>{let n=i.closest("ui-tab-group")?.getPanel(r);i._selectable.getState()?n?.show():n?.hide(),i._selectable.getState()&&i._focusable.focus(!1)});let a=null;i.closest("ui-tab-group")?.hasAttribute("manual")||(y(i,"pointerdown",()=>{clearTimeout(a),a=setTimeout(()=>a=null)}),y(i,"focus",()=>{a||i._selectable.select()})),queueMicrotask(()=>{let n=i.closest("ui-tab-group");if(!n)return;let l=n.getPanel(r);if(!l)throw new Error("Could not find panel...");h(i,"aria-controls",l.id),h(l,"aria-labelledby",i.id)})}}function un(i){i._initialized||(K(i,"tab-panel"),h(i,"role","tabpanel"),i.hasAttribute("tabindex")||h(i,"tabindex","-1"),i.show=()=>{h(i,"data-selected",""),h(i,"tabindex","0")},i.hide=()=>{x(i,"data-selected"),h(i,"tabindex","-1")},i._initialized=!0)}T("tab-group",Zi);T("tabs-scroll-area",qr);T("tabs",Qi);var $r=class extends Z{mount(){this.inputEls=this.querySelectorAll("[data-flux-otp-input]"),this.length=this.inputEls.length,this.config={mode:this.getAttribute("mode")||"numeric",autocomplete:this.getAttribute("autocomplete")||"one-time-code",autoSubmit:this.getAttribute("submit")==="auto",inputAriaLabelTemplate:this.getAttribute("data-flux-input-aria-label")||"Character {current} of {total}"},this.state={length:0,onChanges:[],getValue:()=>Array.from(this.inputEls).map(e=>e.value).join(""),setValue:e=>{let s=(e??"").replace(/\s/g,"").replace(this.invalidCharacters(),"").toUpperCase();for(let r=0;r<this.length;r++)this.inputEls[r].value=s[r]||"";this.state.length=s.length,this.state.onChanges.forEach(r=>r(s))},notify:()=>{let e=this.state.getValue();this.state.length=e.length,this.state.onChanges.forEach(s=>s(e))},reapply:()=>{let e=this.state.getValue();this.state.setValue(e)},onChange:e=>{this.state.onChanges.push(e)}},this.hasAttribute("value")&&this.state.setValue(this.getAttribute("value")),this._controllable=new U(this),this._controllable.initial(e=>e&&this.state.setValue(e)),this._controllable.getter(()=>this.state.getValue());let t=G();this._controllable.setter(t(e=>this.state.setValue(e))),this.state.onChange(t(()=>this._controllable.dispatch())),this._submittable=new Q(this,{name:this.getAttribute("name"),value:this.state.getValue()}),this.state.onChange(e=>{this._submittable.update(e),e.length===this.length&&this.config.autoSubmit&&this.closest("form")?.requestSubmit(),Array.from(this.inputEls).findIndex(r=>r===document.activeElement)>this.nextIndex()&&this.focusIndex(this.nextIndex())}),this._disableable=new V(this),this._disableable.onInitAndChange(e=>{for(let s of this.inputEls)e?h(s,"disabled",e):x(s,"disabled")}),this.updateTabIndexes(this.nextIndex());for(let e=0;e<this.length;e++){h(this.inputEls[e],"autocomplete",e===0?this.config.autocomplete:"off"),h(this.inputEls[e],"aria-label",this.config.inputAriaLabelTemplate.replace("{current}",e+1).replace("{total}",this.length));let s;y(this.inputEls[e],"beforeinput",r=>{s=r.target.value}),y(this.inputEls[e],"input",r=>{r.stopPropagation();let a=r.target.value;if(a.length>1){this.state.setValue(a),this.focusIndex(this.nextIndex()),r.preventDefault();return}if(a==""){this.state.reapply(),e<this.nextIndex()?this.focusIndex(e):this.focusPrev(e);return}if(this.invalidCharacters().test(a)){r.target.value=s,this.focusIndex(e);return}this.config.mode!=="numeric"&&(r.target.value=a.toUpperCase()),this.inputEls[e].blur(),this.state.notify(),this.focusNext(e)}),y(this.inputEls[e],"keydown",r=>{["Backspace","Delete","Clear"].includes(r.key)?r.target.value===""&&requestAnimationFrame(()=>this.focusPrev(e)):r.key==="ArrowRight"?(bt(this)?this.focusPrev(e):this.focusNext(e),r.preventDefault()):r.key==="ArrowLeft"&&(bt(this)?this.focusNext(e):this.focusPrev(e),r.preventDefault())}),y(this.inputEls[e],"pointerdown",r=>{this.focusIndex(Math.min(e,this.nextIndex())),r.preventDefault()}),y(this.inputEls[e],"focus",r=>{r.target.setSelectionRange(0,1),this.updateTabIndexes(e)})}}trigger(){return this.inputEls[this.nextIndex()]}focusIndex(t){let e=this.inputEls[t];document.activeElement===e&&e.blur(),e.focus()}focusPrev(t){this.focusIndex(Math.max(0,t-1))}focusNext(t){this.focusIndex(Math.min(t+1,this.nextIndex()))}nextIndex(){return Math.min(this.state.length,this.length-1)}updateTabIndexes(t){for(let e=0;e<this.length;e++)e===t?h(this.inputEls[e],"tabindex","0"):h(this.inputEls[e],"tabindex","-1")}invalidCharacters(){switch(this.config.mode){case"numeric":return/[^\d]/g;case"alpha":return/[^a-zA-Z]/g;case"alphanumeric":return/[^a-zA-Z0-9]/g;default:throw new Error(`Unknown OTP input mode "${this.config.mode}"`)}}};T("otp",$r);document.addEventListener("alpine:init",()=>{let i=window.Alpine,t=window.Flux?.applyAppearance;t||(t=()=>{window.Flux.appearance=null,window.localStorage.removeItem("flux.appearance")});let e=i.reactive({toast(...r){let a={slots:{},dataset:{}};typeof r[0]=="string"&&(a.slots.text=r.shift()),typeof r[0]=="string"&&(a.slots.heading=a.slots.text,a.slots.text=r.shift());let n=r.shift()||{};n.text&&(a.slots.text=n.text),n.heading&&(a.slots.heading=n.heading),n.variant&&(a.dataset.variant=n.variant),n.position&&(a.dataset.position=n.position),n.duration!==void 0&&(a.duration=n.duration),document.dispatchEvent(new CustomEvent("toast-show",{detail:a}))},modal(r){return{show(){document.dispatchEvent(new CustomEvent("modal-show",{detail:{name:r}}))},close(){document.dispatchEvent(new CustomEvent("modal-close",{detail:{name:r}}))}}},modals(){return{close(){document.dispatchEvent(new CustomEvent("modal-close",{detail:{}}))}}},appearance:window.localStorage.getItem("flux.appearance")||"system",systemAppearanceChanged:1,get dark(){return JSON.stringify(e.systemAppearanceChanged),e.appearance==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches:e.appearance==="dark"},set dark(r){let a=this.dark;r!==a&&(r?e.appearance="dark":e.appearance="light")}});window.Flux=e,i.magic("flux",()=>e),i.effect(()=>{t(e.appearance)}),document.addEventListener("livewire:navigating",r=>{r.detail.onSwap(()=>{t(e.appearance)})}),window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",()=>{e.systemAppearanceChanged++,t(e.appearance)}),i.data("fluxInputClearable",()=>({clear(){let r=this.$el.closest("[data-flux-input]").querySelector("input");r.value="",r.dispatchEvent(new Event("input",{bubbles:!1})),r.dispatchEvent(new Event("change",{bubbles:!1})),r.dispatchEvent(new CustomEvent("clear",{bubbles:!1})),r.focus()}})),i.data("fluxInputViewable",()=>({open:!1,toggle(){this.open=!this.open,this.$el.closest("[data-flux-input]").querySelector("input").setAttribute("type",this.open?"text":"password")},init(){let r=this.$el.closest("[data-flux-input]")?.querySelector("input");if(!r)return;new MutationObserver(()=>{let n=this.open?"text":"password";r.getAttribute("type")!==n&&r.setAttribute("type",n)}).observe(r,{attributes:!0,attributeFilter:["type"]})}})),i.data("fluxInputCopyable",()=>({copied:!1,copy(){this.copied=!this.copied;let r=this.$el.closest("[data-flux-input]").querySelector("input");navigator.clipboard&&navigator.clipboard.writeText(r.value),r.dispatchEvent(new CustomEvent("copy",{bubbles:!1})),setTimeout(()=>this.copied=!1,2e3)}})),i.data("fluxInputFile",r=>({updateLabel(a){this.$refs.name.textContent=a.target.files[1]?a.target.files.length+" "+r.files:a.target.files[0]?.name||r.noFile},init(){Object.defineProperty(this.$refs.input,"value",{...Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"value"),set(a){Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"value").set.call(this,a),a||this.dispatchEvent(new Event("change",{bubbles:!0}))}})}})),i.data("fluxModal",(r,a)=>({handleShow(n){n.detail.name===r&&(a&&n.detail.scope===a?this.$el.showModal():n.detail.scope||this.$el.showModal())},handleClose(n){n.detail.name?n.detail.name===r&&(a&&n.detail.scope===a?this.$el.close():n.detail.scope||this.$el.close()):this.$el.close()}})),i.data("fluxCommandInputClearable",()=>({clear(){let r=this.$el.closest("[data-flux-command-input]").querySelector("input");r.value="",r.dispatchEvent(new Event("input",{bubbles:!1})),r.dispatchEvent(new CustomEvent("clear",{bubbles:!1})),r.focus()}})),i.data("fluxSelectSearchClearable",()=>({clear(){let r=this.$el.closest("[data-flux-select-search]").querySelector("input");r.value="",r.dispatchEvent(new Event("input",{bubbles:!1})),r.dispatchEvent(new CustomEvent("clear",{bubbles:!1})),r.focus()}})),i.data("fluxPillboxSearchClearable",()=>({clear(){let r=this.$el.closest("[data-flux-pillbox-search]").querySelector("input");r.value="",r.dispatchEvent(new Event("input",{bubbles:!1})),r.dispatchEvent(new CustomEvent("clear",{bubbles:!1})),r.focus()}}))});!sa()&&!ra()&&aa();})();