PageSourceSearch

https://academics.ucc.edu.gh/flux/flux.min.js?id=2d7e3896

js ucc.edu.gh collected 2026-09-24 08:57:48 UTC 324,841 bytes, 131 lines download raw bytes

1(()=>{var yi=class extends Event{oldState;newState;constructor(i,{oldState:t="",newState:e="",...s}={}){super(i,s),this.oldState=String(t||""),this.newState=String(e||"")}},ha=new WeakMap;function ba(i,t,e){ha.set(i,setTimeout(()=>{ha.has(i)&&i.dispatchEvent(new yi("toggle",{cancelable:!1,oldState:t,newState:e}))},0))}var ms=globalThis.ShadowRoot||function(){},Un=globalThis.HTMLDialogElement||function(){},pi=new WeakMap,$t=new WeakMap,ze=new WeakMap;function bi(i){return ze.get(i)||"hidden"}var mi=new WeakMap;function Hn(i){let t=i.popoverTargetElement;if(!(t instanceof HTMLElement))return;let e=bi(t);i.popoverTargetAction==="show"&&e==="showing"||i.popoverTargetAction==="hide"&&e==="hidden"||(e==="showing"?Ye(t,!0,!0):oe(t,!1)&&(mi.set(t,i),bs(t)))}function oe(i,t){return!(i.popover!=="auto"&&i.popover!=="manual"||!i.isConnected||t&&bi(i)!=="showing"||!t&&bi(i)!=="hidden"||i instanceof Un&&i.hasAttribute("open")||document.fullscreenElement===i)}function ca(i){return i?Array.from($t.get(i.ownerDocument)||[]).indexOf(i)+1:0}function Wn(i){let t=ma(i),e=Yn(i);return ca(t)>ca(e)?t:e}function gi(i){let t=$t.get(i);for(let e of t||[])if(!e.isConnected)t.delete(e);else return e;return null}function Ce(i){return typeof i.getRootNode=="function"?i.getRootNode():i.parentNode?Ce(i.parentNode):i}function ma(i){for(;i;){if(i instanceof HTMLElement&&i.popover==="auto"&&ze.get(i)==="showing")return i;if(i=i instanceof Element&&i.assignedSlot||i.parentElement||Ce(i),i instanceof ms&&(i=i.host),i instanceof Document)return}}function Yn(i){for(;i;){let t=i.popoverTargetElement;if(t instanceof HTMLElement)return t;if(i=i.parentElement||Ce(i),i instanceof ms&&(i=i.host),i instanceof Document)return}}function zn(i){let t=new Map,e=0;for(let a of $t.get(i.ownerDocument)||[])t.set(a,e),e+=1;t.set(i,e),e+=1;let s=null;function r(a){let n=ma(a);if(n===null)return null;let l=t.get(n);(s===null||t.get(s)<l)&&(s=n)}return r(i.parentElement||Ce(i)),s}function Gn(i){return i.hidden||i instanceof ms||(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 jn(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(Gn(r))return r;r=s.nextNode()}}function Kn(i){jn(i)?.focus()}var vi=new WeakMap;function bs(i){if(!oe(i,!1))return;let t=i.ownerDocument;if(!i.dispatchEvent(new yi("beforetoggle",{cancelable:!0,oldState:"closed",newState:"open"}))||!oe(i,!1))return;let e=!1;if(i.popover==="auto"){let r=i.getAttribute("popover"),a=zn(i)||t;if(wi(a,!1,!0),r!==i.getAttribute("popover")||!oe(i,!1))return}gi(t)||(e=!0),vi.delete(i);let s=t.activeElement;i.classList.add(":popover-open"),ze.set(i,"showing"),pi.has(t)||pi.set(t,new Set),pi.get(t).add(i),Kn(i),i.popover==="auto"&&($t.has(t)||$t.set(t,new Set),$t.get(t).add(i),ga(mi.get(i),!0)),e&&s&&i.popover==="auto"&&vi.set(i,s),ba(i,"closed","open")}function Ye(i,t=!1,e=!1){if(!oe(i,!0))return;let s=i.ownerDocument;if(i.popover==="auto"&&(wi(i,t,e),!oe(i,!0))||(ga(mi.get(i),!1),mi.delete(i),e&&(i.dispatchEvent(new yi("beforetoggle",{oldState:"open",newState:"closed"})),!oe(i,!0))))return;pi.get(s)?.delete(i),$t.get(s)?.delete(i),i.classList.remove(":popover-open"),ze.set(i,"hidden"),e&&ba(i,"open","closed");let r=vi.get(i);r&&(vi.delete(i),t&&r.focus())}function da(i,t=!1,e=!1){let s=gi(i);for(;s;)Ye(s,t,e),s=gi(i)}function wi(i,t,e){let s=i.ownerDocument||i;if(i instanceof Document)return da(s,t,e);let r=null,a=!1;for(let n of $t.get(s)||[])if(n===i)a=!0;else if(a){r=n;break}if(!a)return da(s,t,e);for(;r&&bi(r)==="showing"&&$t.get(s)?.size;)Ye(r,t,e)}var ds=new WeakMap;function fa(i){if(!i.isTrusted)return;let t=i.composedPath()[0];if(!t)return;let e=t.ownerDocument;if(!gi(e))return;let r=Wn(t);if(r&&i.type==="pointerdown")ds.set(e,r);else if(i.type==="pointerup"){let a=ds.get(e)===r;ds.delete(e),a&&wi(r||e,!1,!0)}}var fs=new WeakMap;function ga(i,t=!1){if(!i)return;fs.has(i)||fs.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=fs.get(i);s?i.setAttribute("aria-expanded",s):i.removeAttribute("aria-expanded")}}var pa=globalThis.ShadowRoot||function(){};function Xn(){return typeof HTMLElement<"u"&&typeof HTMLElement.prototype=="object"&&"popover"in HTMLElement.prototype}function le(i,t,e){let s=i[t];Object.defineProperty(i,t,{value(r){return s.call(this,e(r))}})}var Zn=/(^|[^\\]):popover-open\b/g;function Jn(){return typeof globalThis.CSSLayerBlockRule=="function"}function Qn(){let i=Jn();return`
2${i?"@layer popover-polyfill {":""}
3  :where([popover]) {
4    position: fixed;
5    z-index: 2147483647;
6    inset: 0;
7    padding: 0.25em;
8    width: fit-content;
9    height: fit-content;
10    border-width: initial;
11    border-color: initial;
12    border-image: initial;
13    border-style: solid;
14    background-color: canvas;
15    color: canvastext;
16    overflow: auto;
17    margin: auto;
18  }
19
20  :where([popover]:not(.\\:popover-open)) {
21    display: none;
22  }
23
24  :where(dialog[popover].\\:popover-open) {
25    display: block;
26  }
27
28  :where(dialog[popover][open]) {
29    display: revert;
30  }
31
32  :where([anchor].\\:popover-open) {
33    inset: auto;
34  }
35
36  :where([anchor]:popover-open) {
37    inset: auto;
38  }
39
40  @supports not (background-color: canvas) {
41    :where([popover]) {
42      background-color: white;
43      color: black;
44    }
45  }
46
47  @supports (width: -moz-fit-content) {
48    :where([popover]) {
49      width: -moz-fit-content;
50      height: -moz-fit-content;
51    }
52  }
53
54  @supports not (inset: 0) {
55    :where([popover]) {
56      top: 0;
57      left: 0;
58      right: 0;
59      bottom: 0;
60    }
61  }
62${i?"}":""}
63`}var _e=null;function ps(i){let t=Qn();if(_e===null)try{_e=new CSSStyleSheet,_e.replaceSync(t)}catch{_e=!1}if(_e===!1){let e=document.createElement("style");e.textContent=t,i instanceof Document?i.head.prepend(e):i.prepend(e)}else i.adoptedStyleSheets=[_e,...i.adoptedStyleSheets]}function tl(){if(typeof window>"u")return;window.ToggleEvent=window.ToggleEvent||yi;function i(o){return o?.includes(":popover-open")&&(o=o.replace(Zn,"$1.\\:popover-open")),o}le(Document.prototype,"querySelector",i),le(Document.prototype,"querySelectorAll",i),le(Element.prototype,"querySelector",i),le(Element.prototype,"querySelectorAll",i),le(Element.prototype,"matches",i),le(Element.prototype,"closest",i),le(DocumentFragment.prototype,"querySelectorAll",i),Object.defineProperties(HTMLElement.prototype,{popover:{enumerable:!0,configurable:!0,get(){if
63(!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(){bs(this)}},hidePopover:{enumerable:!0,configurable:!0,value(){Ye(this,!0,!0)}},togglePopover:{enumerable:!0,configurable:!0,value(o){ze.get(this)==="showing"&&o===void 0||o===!1?Ye(this,!0,!0):(o===void 0||o===!0)&&bs(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 ps(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&&ps(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=Ce(this),c=this.getAttribute("popovertarget");return(d instanceof Document||d instanceof pa)&&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=Ce(d);if(!(c instanceof pa||c instanceof Document))return;let p=u.find(b=>b.matches?.("[popovertargetaction],[popovertarget]"));if(p){Hn(p),o.preventDefault();return}},n=o=>{let u=o.key,d=o.target;!o.defaultPrevented&&d&&(u==="Escape"||u==="Esc")&&wi(d.ownerDocument,!0,!0)};(o=>{o.addEventListener("click",a),o.addEventListener("keydown",n),o.addEventListener("pointerdown",fa),o.addEventListener("pointerup",fa)})(document),ps(document)}Xn()||tl();var _i=class extends Event{oldState;newState;constructor(i,{oldState:t="",newState:e="",...s}={}){super(i,s),this.oldState=String(t||""),this.newState=String(e||"")}},va=new WeakMap;function Sa(i,t,e){va.set(i,setTimeout(()=>{va.has(i)&&i.dispatchEvent(new _i("toggle",{cancelable:!1,oldState:t,newState:e}))},0))}var xs=globalThis.ShadowRoot||function(){},el=globalThis.HTMLDialogElement||function(){},xi=new WeakMap,Bt=new WeakMap,je=new WeakMap;function Ai(i){return je.get(i)||"hidden"}var Si=new WeakMap;function il(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"?Ge(t,!0,!0):he(t,!1)&&(Si.set(t,i),ws(t)))}function he(i,t){return!(i.popover!=="auto"&&i.popover!=="manual"||!i.isConnected||t&&Ai(i)!=="showing"||!t&&Ai(i)!=="hidden"||i instanceof el&&i.hasAttribute("open")||document.fullscreenElement===i)}function ya(i){return i?Array.from(Bt.get(i.ownerDocument)||[]).indexOf(i)+1:0}function sl(i){let t=Ea(i),e=rl(i);return ya(t)>ya(e)?t:e}function Ei(i){let t=Bt.get(i);for(let e of t||[])if(!e.isConnected)t.delete(e);else return e;return null}function De(i){return typeof i.getRootNode=="function"?i.getRootNode():i.parentNode?De(i.parentNode):i}function Ea(i){for(;i;){if(i instanceof HTMLElement&&i.popover==="auto"&&je.get(i)==="showing")return i;if(i=i instanceof Element&&i.assignedSlot||i.parentElement||De(i),i instanceof xs&&(i=i.host),i instanceof Document)return}}function rl(i){for(;i;){let t=i.popoverTargetElement;if(t instanceof HTMLElement)return t;if(i=i.parentElement||De(i),i instanceof xs&&(i=i.host),i instanceof Document)return}}function al(i){let t=new Map,e=0;for(let a of Bt.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||De(i)),s}function nl(i){return i.hidden||i instanceof xs||(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 ll(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(nl(r))return r;r=s.nextNode()}}
63function ol(i){ll(i)?.focus()}var ki=new WeakMap;function ws(i){if(!he(i,!1))return;let t=i.ownerDocument;if(!i.dispatchEvent(new _i("beforetoggle",{cancelable:!0,oldState:"closed",newState:"open"}))||!he(i,!1))return;let e=!1;if(i.popover==="auto"){let r=i.getAttribute("popover"),a=al(i)||t;if(Ci(a,!1,!0),r!==i.getAttribute("popover")||!he(i,!1))return}Ei(t)||(e=!0),ki.delete(i);let s=t.activeElement;i.classList.add(":popover-open"),je.set(i,"showing"),xi.has(t)||xi.set(t,new Set),xi.get(t).add(i),ol(i),i.popover==="auto"&&(Bt.has(t)||Bt.set(t,new Set),Bt.get(t).add(i),ka(Si.get(i),!0)),e&&s&&i.popover==="auto"&&ki.set(i,s),Sa(i,"closed","open")}function Ge(i,t=!1,e=!1){if(!he(i,!0))return;let s=i.ownerDocument;if(i.popover==="auto"&&(Ci(i,t,e),!he(i,!0))||(ka(Si.get(i),!1),Si.delete(i),e&&(i.dispatchEvent(new _i("beforetoggle",{oldState:"open",newState:"closed"})),!he(i,!0))))return;xi.get(s)?.delete(i),Bt.get(s)?.delete(i),i.classList.remove(":popover-open"),je.set(i,"hidden"),e&&Sa(i,"open","closed");let r=ki.get(i);r&&(ki.delete(i),t&&r.focus())}function wa(i,t=!1,e=!1){let s=Ei(i);for(;s;)Ge(s,t,e),s=Ei(i)}function Ci(i,t,e){let s=i.ownerDocument||i;if(i instanceof Document)return wa(s,t,e);let r=null,a=!1;for(let n of Bt.get(s)||[])if(n===i)a=!0;else if(a){r=n;break}if(!a)return wa(s,t,e);for(;r&&Ai(r)==="showing"&&Bt.get(s)?.size;)Ge(r,t,e)}var gs=new WeakMap;function xa(i){if(!i.isTrusted)return;let t=i.composedPath()[0];if(!t)return;let e=t.ownerDocument;if(!Ei(e))return;let r=sl(t);if(r&&i.type==="pointerdown")gs.set(e,r);else if(i.type==="pointerup"){let a=gs.get(e)===r;gs.delete(e),a&&Ci(r||e,!1,!0)}}var vs=new WeakMap;function ka(i,t=!1){if(!i)return;vs.has(i)||vs.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=vs.get(i);s?i.setAttribute("aria-expanded",s):i.removeAttribute("aria-expanded")}}var Aa=globalThis.ShadowRoot||function(){};function _a(){return typeof HTMLElement<"u"&&typeof HTMLElement.prototype=="object"&&"popover"in HTMLElement.prototype}function Ca(){return!!(document.body?.showPopover&&!/native code/i.test(document.body.showPopover.toString()))}function ue(i,t,e){let s=i[t];Object.defineProperty(i,t,{value(r){return s.call(this,e(r))}})}var ul=/(^|[^\\]):popover-open\b/g;function hl(){return typeof globalThis.CSSLayerBlockRule=="function"}function cl(){let i=hl();return`
64${i?"@layer popover-polyfill {":""}
65  :where([popover]) {
66    position: fixed;
67    z-index: 2147483647;
68    inset: 0;
69    padding: 0.25em;
70    width: fit-content;
71    height: fit-content;
72    border-width: initial;
73    border-color: initial;
74    border-image: initial;
75    border-style: solid;
76    background-color: canvas;
77    color: canvastext;
78    overflow: auto;
79    margin: auto;
80  }
81
82  :where([popover]:not(.\\:popover-open)) {
83    display: none;
84  }
85
86  :where(dialog[popover].\\:popover-open) {
87    display: block;
88  }
89
90  :where(dialog[popover][open]) {
91    display: revert;
92  }
93
94  :where([anchor].\\:popover-open) {
95    inset: auto;
96  }
97
98  :where([anchor]:popover-open) {
99    inset: auto;
100  }
101
102  @supports not (background-color: canvas) {
103    :where([popover]) {
104      background-color: white;
105      color: black;
106    }
107  }
108
109  @supports (width: -moz-fit-content) {
110    :where([popover]) {
111      width: -moz-fit-content;
112      height: -moz-fit-content;
113    }
114  }
115
116  @supports not (inset: 0) {
117    :where([popover]) {
118      top: 0;
119      left: 0;
120      right: 0;
121      bottom: 0;
122    }
123  }
124${i?"}":""}
125`}var Ie=null;function ys(i){let t=cl();if(Ie===null)try{Ie=new CSSStyleSheet,Ie.replaceSync(t)}catch{Ie=!1}if(Ie===!1){let e=document.createElement("style");e.textContent=t,i instanceof Document?i.head.prepend(e):i.prepend(e)}else i.adoptedStyleSheets=[Ie,...i.adoptedStyleSheets]}function Ia(){if(typeof window>"u")return;window.ToggleEvent=window.ToggleEvent||_i;function i(o){return o?.includes(":popover-open")&&(o=o.replace(ul,"$1.\\:popover-open")),o}ue(Document.prototype,"querySelector",i),ue(Document.prototype,"querySelectorAll",i),ue(Element.prototype,"querySelector",i),ue(Element.prototype,"querySelectorAll",i),ue(Element.prototype,"matches",i),ue(Element.prototype,"closest",i),ue(DocumentFragment.prototype,"querySelectorAll",i),Object.defineProperties(HTMLElement.prototype,{popover:{enumerable:!0,configurable:!0,get(){if
125(!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(){ws(this)}},hidePopover:{enumerable:!0,configurable:!0,value(){Ge(this,!0,!0)}},togglePopover:{enumerable:!0,configurable:!0,value(o){je.get(this)==="showing"&&o===void 0||o===!1?Ge(this,!0,!0):(o===void 0||o===!0)&&ws(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 ys(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&&ys(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=De(this),c=this.getAttribute("popovertarget");return(d instanceof Document||d instanceof Aa)&&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=De(d);if(!(c instanceof Aa||c instanceof Document))return;let p=u.find(b=>b.matches?.("[popovertargetaction],[popovertarget]"));if(p){il(p),o.preventDefault();return}},n=o=>{let u=o.key,d=o.target;!o.defaultPrevented&&d&&(u==="Escape"||u==="Esc")&&Ci(d.ownerDocument,!0,!0)};(o=>{o.addEventListener("click",a),o.addEventListener("keydown",n),o.addEventListener("pointerdown",xa),o.addEventListener("pointerup",xa)})(document),ys(document)}var Ii;function Ke(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}Ii===void 0&&(Ii=new CSSStyleSheet,document.adoptedStyleSheets=[...document.adoptedStyleSheets,Ii]),Ii.insertRule(t)}function Di(i,t){let e=i;for(;e;){if(t(e))return e;e=e.parentElement}}function it(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 As(e)}var As=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 D(i,t){customElements.define(`ui-${i}`,t)}function m(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 Ta(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 Ss(i,t){let e;return function(){let s=this,r=arguments;e||(i.apply(s,r),e=!0,setTimeout(()=>e=!1,t))}}function Es(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)}
125,cancel:()=>{clearTimeout(e),a=!1,r=t}};return n.resume(),n}var Xe="pointer";document.addEventListener("keydown",()=>Xe="keyboard",{capture:!0});document.addEventListener("pointerdown",i=>{Xe=i.pointerType==="mouse"?"mouse":"touch"},{capture:!0});document.addEventListener("pointermove",i=>{Xe=i.pointerType==="mouse"?"mouse":"touch"},{capture:!0});function ce(){return Xe==="keyboard"}function Ti(){return Xe==="touch"}function Li(i,t){let e="",s=yl(()=>{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 dl(i,t){return"lofi-"+(t?t+"-":"")+Math.random().toString(16).slice(2)}function X(i,t){let e=i.hasAttribute("id")?i.getAttribute("id"):dl(i,t);return h(i,"id",e),i._x_bindings||(i._x_bindings={}),i._x_bindings.id||(i._x_bindings.id=e),e}function K(){let i=!1;return t=>(...e)=>{if(!i){i=!0;try{t(...e)}finally{i=!1}}}}function Me(i,t,{gain:e,lose:s,focusable:r,useSafeArea:a}){let n=!1,l=w=>{ce()&&(i.contains(w.target)||t.contains(w.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()},p=()=>{n=!1,u(),d()},b=w=>{Ti()||n||(n=!0,e(),setTimeout(()=>{let{safeArea:E,redraw:L,remove:N}=a?fl(i,t,w.clientX,w.clientY):vl();u=N;let S,C=Ss(q=>{let V=t.getBoundingClientRect(),U=i.getBoundingClientRect(),y;switch(E.contains(q.target)&&pl(U,V,q.clientX,q.clientY)?y="safeArea":t.contains(q.target)?y="panel":i.contains(q.target)?y="trigger":y="outside",S&&clearTimeout(S),y){case"outside":c();break;case"trigger":L(q.clientX,q.clientY);break;case"panel":u();break;case"safeArea":L(q.clientX,q.clientY),S=setTimeout(()=>{c()},300);break;default:break}},100);document.addEventListener("pointermove",C),d=()=>document.removeEventListener("pointermove",C)}))};i.addEventListener("pointerenter",b);let f=()=>{i.removeEventListener("pointerenter",b)};return{clear:p,remove:()=>{p(),f(),o()}}}function fl(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,p,b,f,g,w,E,L,N=10;switch(d){case"left":c=a.right,p=Math.max(a.right,o)+5,b=p-c,f=Math.min(n.top,a.top)-N,g=Math.max(n.bottom,a.bottom)+N,w=g-f,E=u-f,L=`polygon(0% 0%, 100% ${E}px, 0% 100%)`;break;case"right":c=Math.min(a.left,o)-5,p=a.left,b=p-c,f=Math.min(n.top,a.top)-N,g=Math.max(n.bottom,a.bottom)+N,w=g-f,E=u-f,L=`polygon(0% ${E}px, 100% 0%, 100% 100%)`;break;case"up":c=Math.min(o,a.left)-N,p=Math.max(o,a.right)+N,b=p-c,f=a.bottom,g=Math.max(a.bottom,u)+5,w=g-f,E=o-c,L=`polygon(0% 0%, 100% 0%, ${E}px 100%)`;break;case"down":c=Math.min(o,a.left)-N,p=Math.max(o,a.right)+N,b=p-c,f=Math.min(a.top,u)-5,g=a.top,w=g-f,E=o-c,L=`polygon(${E}px 0%, 100% 100%, 0% 100%)`;break}r.style.left=`${c}px`,r.style.top=`${f}px`,r.style.width=`${b}px`,r.style.height=`${w}px`,r.style.clipPath=L};return{safeArea:r,redraw:(o,u)=>{r.isConnected||i.appendChild(r),l(o,u)},remove:()=>{r.remove()}}}function pl(i,t,e,s){return!bl(i,e,s)&&!ml(t,e,s)}function bl(i,t,e){return i.left<=t&&t<=i.right&&i.top<=e&&e<=i.bottom}function ml(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 bt(i,t){x(i,t),gl(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 gl(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 vl(){return{safeArea:{contains:()=>!1},redraw:()=>{},remove:()=>{}}}function yl(i,t){let e;return(...s)=>{clearTimeout(e),e=setTimeout(()=>{i(...s)},t)}}var Te=0,Le=!1;Ke(({css:i})=>i`[data-flux-allow-scroll] { pointer-events: auto; }`);function lt(i=null,t=!1,e=[]){if(t)return{lock:()=>{},unlock:()=>{}};let s=(a=!1)=>{Da(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})`,wl(document.documentElement,n),a&&(h(i,"data-flux-allow-scroll",""),e.forEach(l=>{h(l,"data-flux-allow-scroll","")}),Le=!0)},r=(a=!1)=>{Da(document.documentElement),a&&(bt(i,"data-flux-allow-scroll"),e.forEach(n=>{x(n,"data-flux-allow-scroll")}),Le=!1)};return{lock(){Te++,!(Te>1&&i!==null&&Le)&&s(i!==null&&!Le)},unlock(){Te=Math.max(0,Te-1),!(Te>0&&i!==null&&!Le)&&(r(i!==null&&Le),Te>0&&s(!1))}}}function wl(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 Da(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 ks(i,t,e){let s=i.style[t];return i.style[t]=e,()=>{i.style[t]=s}}function Jt(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(),m(i,"click",()=>e()),m(i,"keydown",s("Enter",()=>e())),m(i,"keydown",s(" ",()=>{})),m(i,"keyup",s(" ",()=>e()))}function Mi(){return navigator?.language||document.documentElement.lang||"en-US"}function Ma(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((r={slots:{},attrs:{}})=>Ze(i,r));
125return s=Array.isArray(s)?s:[s],s.reverse().forEach(r=>{i.after(r)}),{cleanup:e}}function Ze(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 ut(i){return getComputedStyle(i).direction==="rtl"}function Pa(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)&&!navigator.userAgent.includes("CriOS")&&!navigator.userAgent.includes("FxiOS")}function Oa(){return/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream}var Zt=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 P=class extends HTMLElement{wasDisconnected=!1;onUnmounts=[];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.onUnmounts.forEach(t=>t()),this.onUnmounts=[]),this.wasDisconnected=!1})}onUnmount(t){this.onUnmounts.push(t)}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 m(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 P{};var J=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=P.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 Di(this.el,t=>t[this.groupedByType.name])?.use(this.groupedByType)}on(t,e){return m(this.el,t,e)}},Nt=class extends J{constructor(t,e={}){super(t,e)}walker(){return it(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 z=class extends J{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 _s=null;document.addEventListener("mousedown",i=>_s=i);var Qt=class extends J{boot({options:t}){t({clickOutside:!0,escape:!0,triggers:[]}),this.onChanges=[],this.state=!1,this.stopDialogFromFocusingTheFirstElement();let e=this.options().triggers;if(new MutationObserver(r=>{r.forEach(a=>{a.attributeName==="open"&&(this.el.hasAttribute("open")?this.state=!0:this.state=!1)}
125),this.onChanges.forEach(a=>a())}).observe(this.el,{attributeFilter:["open"]}),this.options().clickOutside){let r=this.el.querySelector("[data-flux-modal-content]")||this.el;this.el.addEventListener("click",a=>{a.target!==r&&r?.contains(a.target)||_s&&Na(r,_s)&&Na(r,a)&&(this.cancel(),a.preventDefault(),a.stopPropagation())})}this.options().escape||(h(this.el,"closedby","none"),this.el.addEventListener("keydown",r=>{r.key!=="Escape"&&r.key!=="Esc"||r.preventDefault()}),this.el.addEventListener("cancel",r=>{r.isTrusted&&r.preventDefault()})),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&&Pa()&&!this.el.hasAttribute("autofocus")&&this.el.querySelectorAll("[autofocus]").length===0&&setTimeout(()=>{this.el.setAttribute("tabindex","-1"),this.el.focus(),this.el.blur()})})}};function Na(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 kt=class extends J{boot(){this.onCloses=[]}onClose(t){this.onCloses.push(t)}close(){this.onCloses.forEach(t=>t())}};var Cs=class extends P{boot(){this.querySelectorAll("[data-appended]").forEach(l=>l.remove()),this._controllable=new z(this,{disabled:this.hasAttribute("disabled")});let t=this.button(),e=this.dialog();if(!e)return;e._dialogable=new Qt(e,{clickOutside:!this.hasAttribute("disable-click-outside"),escape:!this.hasAttribute("disable-escape")}),e._closeable=new kt(e),e._closeable.onClose(()=>e._dialogable.hide()),this._controllable.initial(l=>l&&e._dialogable.show()),this._controllable.getter(()=>e._dialogable.getState());let s=K();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}=lt();e._dialogable.onChange(()=>{e._dialogable.getState()?a():n()}),t&&m(t,"click",l=>{e._dialogable.show()})}unmount(){if(this.dialog()?._dialogable?.getState()){let{unlock:t}=lt();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()}};Ke(({css:i})=>i`dialog, ::backdrop { margin: auto; }`);D("modal",Cs);var Ut=class extends Nt{groupOfType=st;boot({options:t}){t({wrap:!1,filter:!1}),this.onChanges=[]}onChange(t){this.onChanges.push(t)}
125activated(t){this.onChanges.forEach(e=>e())}activateFirst(){this.filterAwareWalker().first()?.use(st).activate()}activateBySearch(t){this.filterAwareWalker().find(s=>s.textContent.toLowerCase().trim().startsWith(t.toLowerCase()))?.use(st).activate()}activateSelectedOrFirst(t){if(!t||(s=>s.matches("ui-option, ui-option-create")?getComputedStyle(s).display==="none":!1)(t)){this.filterAwareWalker().first()?.use(st).activate();return}t?.use(st).activate()}activateActiveOrFirst(){let t=this.getActive();if(!t){this.filterAwareWalker().first()?.use(st).activate();return}t?.use(st).activate()}activateActiveOrLast(){let t=this.getActive();if(!t){this.filterAwareWalker().last()?.use(st).activate();return}t?.use(st).activate()}activatePrev(){let t=this.getActive();if(!t){this.filterAwareWalker().last()?.use(st).activate();return}let e;this.options.wrap?e=this.filterAwareWalker().prevOrLast(t):e=this.filterAwareWalker().prev(t),e?.use(st).activate()}activateNext(){let t=this.getActive();if(!t){this.filterAwareWalker().first()?.use(st).activate();return}let e;this.options.wrap?e=this.filterAwareWalker().nextOrFirst(t):e=this.filterAwareWalker().next(t),e?.use(st).activate()}getActive(){return this.walker().find(t=>t.use(st).isActive())}clearActive(){this.getActive()?.use(st).deactivate()}filterAwareWalker(){let t=e=>e.matches("ui-option, ui-option-create")?getComputedStyle(e).display==="none":!1;return it(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()})}},st=class i extends J{groupedByType=Ut;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",""),ce()&&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 de=class extends Nt{groupOfType=Ft;boot({options:t}){t({}),this.onChanges=[],this.lastSearch=""}onChange(t){this.onChanges.push(t)}filter(t){t===""?this.walker().each(e=>{e.use(Ft).unfilter()}):this.walker().each(e=>{this.matches(e,t)?e.use(Ft).unfilter():e.use(Ft).filter()}
125),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==null?"":t.normalize("NFD").replace(/\p{Diacritic}/gu,"").toLowerCase().trim()}hasResults(){return this.walker().some(t=>!t.use(Ft).isFiltered())}},Ft=class extends J{groupedByType=de;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 Ht=new Map,nt=class extends J{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,m(this.el,"beforetoggle",s=>{let r=this.state;if(this.state=s.newState==="open",this.state){xl(this.el,e);let a=new AbortController,n=document.activeElement,l=[...this.triggers,n];setTimeout(()=>{Al(this.el,l,a),Sl(this.el,l,a),El(this.el,l,a)}),this.el.addEventListener("beforetoggle",o=>{o.newState==="closed"&&(a.abort(),n?.focus({preventScroll:!0}))},{signal:a.signal})}
125r!==this.state&&this.onChanges.forEach(a=>a(this.state,r))}),m(this.el,"toggle",s=>{if(s.newState==="open")Ht.has(e)||Ht.set(e,new Set),Ht.get(e).add(this.el);else if(s.newState==="closed"){if(!Ht.has(e))return;Ht.get(e).delete(this.el),Ht.get(e).size===0&&Ht.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 xl(i,t){Ht.has(t)&&Ht.get(t).forEach(e=>{i.contains(e)||e.contains(i)||e.hidePopover()})}function Al(i,t,e){document.addEventListener("click",s=>{i.contains(s.target)||t.includes(s.target)||i.hidePopover()},{signal:e.signal})}function Sl(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 El(i,t,e){document.addEventListener("keydown",s=>{s.key==="Escape"&&i.hidePopover()},{signal:e.signal})}var R=class extends J{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=>
vendor: 4,479 bytes, line 125
125{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 Fa=["top","right","bottom","left"];var te=Math.min,mt=Math.max,Qe=Math.round,ti=Math.floor,_t=i=>({x:i,y:i}),kl={left:"right",right:"left",bottom:"top",top:"bottom"},_l={start:"end",end:"start"};function Is(i,t,e){return mt(i,te(t,e))}function fe(i,t){return typeof i=="function"?i(t):i}function Wt(i){return i.split("-")[0]}function Pe(i){return i.split("-")[1]}function Ds(i){return i==="x"?"y":"x"}function Ts(i){return i==="y"?"height":"width"}function ee(i){return["top","bottom"].includes(Wt(i))?"y":"x"}function Ls(i){return Ds(ee(i))}function Ra(i,t,e){e===void 0&&(e=!1);let s=Pe(i),r=Ls(i),a=Ts(r),n=r==="x"?s===(e?"end":"start")?"right":"left":s==="start"?"bottom":"top";return t.reference[a]>t.floating[a]&&(n=Je(n)),[n,Je(n)]}function Va(i){let t=Je(i);return[Pi(i),t,Pi(t)]}function Pi(i){return i.replace(/start|end/g,t=>_l[t])}function Cl(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 qa(i,t,e,s){let r=Pe(i),a=Cl(Wt(i),e==="start",s);return r&&(a=a.map(n=>n+"-"+r),t&&(a=a.concat(a.map(Pi)))),a}function Je(i){return i.replace(/left|right|bottom|top/g,t=>kl[t])}function Il(i){return{top:0,right:0,bottom:0,left:0,...i}}function $a(i){return typeof i!="number"?Il(i):{top:i,right:i,bottom:i,left:i}}function pe(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 Ba(i,t,e){let{reference:s,floating:r}=i,a=ee(t),n=Ls(t),l=Ts(n),o=Wt(t),u=a==="y",d=s.x+s.width/2-r.width/2,c=s.y+s.height/2-r.height/2,p=s[l]/2-r[l]/2,b;switch(o){case"top":b={x:d,y:s.y-r.height};break;case"bottom":b={x:d,y:s.y+s.height};break;case"right":b={x:s.x+s.width,y:c};break;case"left":b={x:s.x-r.width,y:c};break;default:b={x:s.x,y:s.y}}switch(Pe(t)){case"start":b[n]-=p*(e&&u?-1:1);break;case"end":b[n]+=p*(e&&u?-1:1);break}return b}var Wa=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}=Ba(u,s,o),p=s,b={},f=0;for(let g=0;g<l.length;g++){let{name:w,fn:E}=l[g],{x:L,y:N,data:S,reset:C}=await E({x:d,y:c,initialPlacement:s,placement:p,strategy:r,middlewareData:b,rects:u,platform:n,elements:{reference:i,floating:t}});d=L??d,c=N??c,b={...b,[w]:{...b[w],...S}},C&&f<=50&&(f++,typeof C=="object"&&(C.placement&&(p=C.placement),C.rects&&(u=C.rects===!0?await n.getElementRects({reference:i,floating:t,strategy:r}):C.rects),{x:d,y:c}=Ba(u,p,o)),g=-1)}return{x:d,y:c,placement:p,strategy:r,middlewareData:b}};async function Oe(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:p=!1,padding:b=0}=fe(t,i),f=$a(b),w=l[p?c==="floating"?"reference":"floating":c],E=pe(await a.getClippingRect({element:(e=await(a.isElement==null?void 0:a.isElement(w)))==null||e?w:w.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,N=await(a.getOffsetParent==null?void 0:a.getOffsetParent(l.floating)),S=await(a.isElement==null?void 0:a.isElement(N))?await(a.getScale==null?void 0:a.getScale(N))||{x:1,y:1}:{x:1,y:1},C=pe(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:L,offsetParent:N,strategy:o}):L);return{top:(E.top-C.top+f.top)/S.y,bottom:(C.bottom-E.bottom+f.bottom)/S.y,left:(E.left-C.left+f.left)/S.x,right:(C.right-E.right+f.right)/S.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:p,fallbackStrategy:b="bestFit",fallbackAxisSideDirection:f="none",flipAlignment:g=!0,...w}=fe(i,t);
vendor: 5,900 bytes, line 125
125if((e=a.arrow)!=null&&e.alignmentOffset)return{};let E=Wt(r),L=ee(l),N=Wt(l)===l,S=await(o.isRTL==null?void 0:o.isRTL(u.floating)),C=p||(N||!g?[Je(l)]:Va(l)),q=f!=="none";!p&&q&&C.push(...qa(l,g,f,S));let V=[l,...C],U=await Oe(t,w),y=[],H=((s=a.flip)==null?void 0:s.overflows)||[];if(d&&y.push(U[E]),c){let A=Ra(r,n,S);y.push(U[A[0]],U[A[1]])}if(H=[...H,{placement:r,overflows:y}],!y.every(A=>A<=0)){var _,W;let A=(((_=a.flip)==null?void 0:_.index)||0)+1,O=V[A];if(O)return{data:{index:A,overflows:H},reset:{placement:O}};let k=(W=H.filter(I=>I.overflows[0]<=0).sort((I,T)=>I.overflows[1]-T.overflows[1])[0])==null?void 0:W.placement;if(!k)switch(b){case"bestFit":{var F;let I=(F=H.filter(T=>{if(q){let M=ee(T.placement);return M===L||M==="y"}return!0}).map(T=>[T.placement,T.overflows.filter(M=>M>0).reduce((M,j)=>M+j,0)]).sort((T,M)=>T[1]-M[1])[0])==null?void 0:F[0];I&&(k=I);break}case"initialPlacement":k=l;break}if(r!==k)return{reset:{placement:k}}}return{}}}};function Ua(i,t){return{top:i.top-t.height,right:i.right-t.width,bottom:i.bottom-t.height,left:i.left-t.width}}function Ha(i){return Fa.some(t=>i[t]>=0)}var za=function(i){return i===void 0&&(i={}),{name:"hide",options:i,async fn(t){let{rects:e}=t,{strategy:s="referenceHidden",...r}=fe(i,t);switch(s){case"referenceHidden":{let a=await Oe(t,{...r,elementContext:"reference"}),n=Ua(a,e.reference);return{data:{referenceHiddenOffsets:n,referenceHidden:Ha(n)}}}case"escaped":{let a=await Oe(t,{...r,altBoundary:!0}),n=Ua(a,e.floating);return{data:{escapedOffsets:n,escaped:Ha(n)}}}default:return{}}}}};async function Dl(i,t){let{placement:e,platform:s,elements:r}=i,a=await(s.isRTL==null?void 0:s.isRTL(r.floating)),n=Wt(e),l=Pe(e),o=ee(e)==="y",u=["left","top"].includes(n)?-1:1,d=a&&o?-1:1,c=fe(t,i),{mainAxis:p,crossAxis:b,alignmentAxis:f}=typeof c=="number"?{mainAxis:c,crossAxis:0,alignmentAxis:null}:{mainAxis:c.mainAxis||0,crossAxis:c.crossAxis||0,alignmentAxis:c.alignmentAxis};return l&&typeof f=="number"&&(b=l==="end"?f*-1:f),o?{x:b*d,y:p*u}:{x:p*u,y:b*d}}var Ga=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 Dl(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}}}}},ja=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:w=>{let{x:E,y:L}=w;return{x:E,y:L}}},...o}=fe(i,t),u={x:e,y:s},d=await Oe(t,o),c=ee(Wt(r)),p=Ds(c),b=u[p],f=u[c];if(a){let w=p==="y"?"top":"left",E=p==="y"?"bottom":"right",L=b+d[w],N=b-d[E];b=Is(L,b,N)}if(n){let w=c==="y"?"top":"left",E=c==="y"?"bottom":"right",L=f+d[w],N=f-d[E];f=Is(L,f,N)}let g=l.fn({...t,[p]:b,[c]:f});return{...g,data:{x:g.x-e,y:g.y-s,enabled:{[p]:a,[c]:n}}}}}};var Ka=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}=fe(i,t),d=await Oe(t,u),c=Wt(r),p=Pe(r),b=ee(r)==="y",{width:f,height:g}=a.floating,w,E;c==="top"||c==="bottom"?(w=c,E=p===(await(n.isRTL==null?void 0:n.isRTL(l.floating))?"start":"end")?"left":"right"):(E=c,w=p==="end"?"top":"bottom");let L=g-d.top-d.bottom,N=f-d.left-d.right,S=te(g-d[w],L),C=te(f-d[E],N),q=!t.middlewareData.shift,V=S,U=C;if((e=t.middlewareData.shift)!=null&&e.enabled.x&&(U=N),(s=t.middlewareData.shift)!=null&&s.enabled.y&&(V=L),q&&!p){let H=mt(d.left,0),_=mt(d.right,0),W=mt(d.top,0),F=mt(d.bottom,0);b?U=f-2*(H!==0||_!==0?H+_:mt(d.left,d.right)):V=g-2*(W!==0||F!==0?W+F:mt(d.top,d.bottom))}await o({...t,availableWidth:U,availableHeight:V});let y=await n.getDimensions(l.floating);return f!==y.width||g!==y.height?{reset:{rects:!0}}:{}}}};function Oi(){return typeof window<"u"}function be(i){return Za(i)?(i.nodeName||"").toLowerCase():"#document"}function vt(i){var t;return(i==null||(t=i.ownerDocument)==null?void 0:t.defaultView)||window}function Ct(i){var t;return(t=(Za(i)?i.ownerDocument:i.document)||window.document)==null?void 0:t.documentElement}function Za(i){return Oi()?i instanceof Node||i instanceof vt(i).Node:!1}function At(i){return Oi()?i instanceof Element||i instanceof vt(i).Element:!1}function It(i){return Oi()?i instanceof HTMLElement||i instanceof vt(i).HTMLElement:!1}function Xa(i){return!Oi()||typeof ShadowRoot>"u"?!1:i instanceof ShadowRoot||i instanceof vt(i).ShadowRoot}function Fe(i){let{overflow:t,overflowX:e,overflowY:s,display:r}=St(i);return/auto|scroll|overlay|hidden|clip/.test(t+s+e)&&!["inline","contents"].includes(r)}function Ja(i){return["table","td","th"].includes(be(i))}function ei(i){return[":popover-open",":modal"].some(t=>{try{return i.matches(t)}catch{return!1}})}function Ni(i){let t=Fi(),e=At(i)?St(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 Qa(i){let t=Yt(i);for(;It(t)&&!me(t);){if(Ni(t))return t;if(ei(t))return null;t=Yt(t)}return null}function Fi(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function me(i){return["html","body","#document"].includes(be(i))}function St(i){return vt(i).getComputedStyle(i)}function ii(i){return At(i)?{scrollLeft:i.scrollLeft,scrollTop:i.scrollTop}:{scrollLeft:i.scrollX,scrollTop:i.scrollY}}function Yt(i){if(be(i)==="html")return i;let t=i.assignedSlot||i.parentNode||Xa(i)&&i.host||Ct(i);return Xa(t)?t.host:t}function tn(i){let t=Yt(i);return me(t)?i.ownerDocument?i.ownerDocument.body:i.body:It(t)&&Fe(t)?t:tn(t)}function Ne(i,t,e){var s;
vendor: 2,925 bytes, line 125
125t===void 0&&(t=[]),e===void 0&&(e=!0);let r=tn(i),a=r===((s=i.ownerDocument)==null?void 0:s.body),n=vt(r);if(a){let l=Ri(n);return t.concat(n,n.visualViewport||[],Fe(r)?r:[],l&&e?Ne(l):[])}return t.concat(r,Ne(r,[],e))}function Ri(i){return i.parent&&Object.getPrototypeOf(i.parent)?i.frameElement:null}function rn(i){let t=St(i),e=parseFloat(t.width)||0,s=parseFloat(t.height)||0,r=It(i),a=r?i.offsetWidth:e,n=r?i.offsetHeight:s,l=Qe(e)!==a||Qe(s)!==n;return l&&(e=a,s=n),{width:e,height:s,$:l}}function Ps(i){return At(i)?i:i.contextElement}function Re(i){let t=Ps(i);if(!It(t))return _t(1);let e=t.getBoundingClientRect(),{width:s,height:r,$:a}=rn(t),n=(a?Qe(e.width):e.width)/s,l=(a?Qe(e.height):e.height)/r;return(!n||!Number.isFinite(n))&&(n=1),(!l||!Number.isFinite(l))&&(l=1),{x:n,y:l}}var Tl=_t(0);function an(i){let t=vt(i);return!Fi()||!t.visualViewport?Tl:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Ll(i,t,e){return t===void 0&&(t=!1),!e||t&&e!==vt(i)?!1:t}function ge(i,t,e,s){t===void 0&&(t=!1),e===void 0&&(e=!1);let r=i.getBoundingClientRect(),a=Ps(i),n=_t(1);t&&(s?At(s)&&(n=Re(s)):n=Re(i));let l=Ll(a,e,s)?an(a):_t(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 p=vt(a),b=s&&At(s)?vt(s):s,f=p,g=Ri(f);for(;g&&s&&b!==f;){let w=Re(g),E=g.getBoundingClientRect(),L=St(g),N=E.left+(g.clientLeft+parseFloat(L.paddingLeft))*w.x,S=E.top+(g.clientTop+parseFloat(L.paddingTop))*w.y;o*=w.x,u*=w.y,d*=w.x,c*=w.y,o+=N,u+=S,f=vt(g),g=Ri(f)}}return pe({width:d,height:c,x:o,y:u})}function Os(i,t){let e=ii(i).scrollLeft;return t?t.left+e:ge(Ct(i)).left+e}function nn(i,t,e){e===void 0&&(e=!1);let s=i.getBoundingClientRect(),r=s.left+t.scrollLeft-(e?0:Os(i,s)),a=s.top+t.scrollTop;return{x:r,y:a}}function Ml(i){let{elements:t,rect:e,offsetParent:s,strategy:r}=i,a=r==="fixed",n=Ct(s),l=t?ei(t.floating):!1;if(s===n||l&&a)return e;let o={scrollLeft:0,scrollTop:0},u=_t(1),d=_t(0),c=It(s);if((c||!c&&!a)&&((be(s)!=="body"||Fe(n))&&(o=ii(s)),It(s))){let b=ge(s);u=Re(s),d.x=b.x+s.clientLeft,d.y=b.y+s.clientTop}let p=n&&!c&&!a?nn(n,o,!0):_t(0);return{width:e.width*u.x,height:e.height*u.y,x:e.x*u.x-o.scrollLeft*u.x+d.x+p.x,y:e.y*u.y-o.scrollTop*u.y+d.y+p.y}}function Pl(i){return Array.from(i.getClientRects())}function Ol(i){let t=Ct(i),e=ii(i),s=i.ownerDocument.body,r=mt(t.scrollWidth,t.clientWidth,s.scrollWidth,s.clientWidth),a=mt(t.scrollHeight,t.clientHeight,s.scrollHeight,s.clientHeight),n=-e.scrollLeft+Os(i),l=-e.scrollTop;return St(s).direction==="rtl"&&(n+=mt(t.clientWidth,s.clientWidth)-r),{width:r,height:a,x:n,y:l}}function Nl(i,t){let e=vt(i),s=Ct(i),r=e.visualViewport,a=s.clientWidth,n=s.clientHeight,l=0,o=0;if(r){a=r.width,n=r.height;let u=Fi();(!u||u&&t==="fixed")&&(l=r.offsetLeft,o=r.offsetTop)}return{width:a,height:n,x:l,y:o}}function Fl(i,t){let e=ge(i,!0,t==="fixed"),s=e.top+i.clientTop,r=e.left+i.clientLeft,a=It(i)?Re(i):_t(1),n=i.
vendor: 4,357 bytes, line 125
125clientWidth*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 en(i,t,e){let s;if(t==="viewport")s=Nl(i,e);else if(t==="document")s=Ol(Ct(i));else if(At(t))s=Fl(t,e);else{let r=an(i);s={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return pe(s)}function ln(i,t){let e=Yt(i);return e===t||!At(e)||me(e)?!1:St(e).position==="fixed"||ln(e,t)}function Rl(i,t){let e=t.get(i);if(e)return e;let s=Ne(i,[],!1).filter(l=>At(l)&&be(l)!=="body"),r=null,a=St(i).position==="fixed",n=a?Yt(i):i;for(;At(n)&&!me(n);){let l=St(n),o=Ni(n);!o&&l.position==="fixed"&&(r=null),(a?!o&&!r:!o&&l.position==="static"&&!!r&&["absolute","fixed"].includes(r.position)||Fe(n)&&!o&&ln(i,n))?s=s.filter(d=>d!==n):r=l,n=Yt(n)}return t.set(i,s),s}function Vl(i){let{element:t,boundary:e,rootBoundary:s,strategy:r}=i,n=[...e==="clippingAncestors"?ei(t)?[]:Rl(t,this._c):[].concat(e),s],l=n[0],o=n.reduce((u,d)=>{let c=en(t,d,r);return u.top=mt(c.top,u.top),u.right=te(c.right,u.right),u.bottom=te(c.bottom,u.bottom),u.left=mt(c.left,u.left),u},en(t,l,r));return{width:o.right-o.left,height:o.bottom-o.top,x:o.left,y:o.top}}function ql(i){let{width:t,height:e}=rn(i);return{width:t,height:e}}function $l(i,t,e){let s=It(t),r=Ct(t),a=e==="fixed",n=ge(i,!0,a,t),l={scrollLeft:0,scrollTop:0},o=_t(0);if(s||!s&&!a)if((be(t)!=="body"||Fe(r))&&(l=ii(t)),s){let p=ge(t,!0,a,t);o.x=p.x+t.clientLeft,o.y=p.y+t.clientTop}else r&&(o.x=Os(r));let u=r&&!s&&!a?nn(r,l):_t(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 Ms(i){return St(i).position==="static"}function sn(i,t){if(!It(i)||St(i).position==="fixed")return null;if(t)return t(i);let e=i.offsetParent;return Ct(i)===e&&(e=e.ownerDocument.body),e}function on(i,t){let e=vt(i);if(ei(i))return e;if(!It(i)){let r=Yt(i);for(;r&&!me(r);){if(At(r)&&!Ms(r))return r;r=Yt(r)}return e}let s=sn(i,t);for(;s&&Ja(s)&&Ms(s);)s=sn(s,t);return s&&me(s)&&Ms(s)&&!Ni(s)?e:s||Qa(i)||e}var Bl=async function(i){let t=this.getOffsetParent||on,e=this.getDimensions,s=await e(i.floating);return{reference:$l(i.reference,await t(i.floating),i.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function Ul(i){return St(i).direction==="rtl"}var Hl={convertOffsetParentRelativeRectToViewportRelativeRect:Ml,getDocumentElement:Ct,getClippingRect:Vl,getOffsetParent:on,getElementRects:Bl,getClientRects:Pl,getDimensions:ql,getScale:Re,isElement:At,isRTL:Ul};function un(i,t){return i.x===t.x&&i.y===t.y&&i.width===t.width&&i.height===t.height}function Wl(i,t){let e=null,s,r=Ct(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:p,height:b}=u;if(l||t(),!p||!b)return;let f=ti(c),g=ti(r.clientWidth-(d+p)),w=ti(r.clientHeight-(c+b)),E=ti(d),N={rootMargin:-f+"px "+-g+"px "+-w+"px "+-E+"px",threshold:mt(0,te(1,o))||1},S=!0;function C(q){let V=q[0].intersectionRatio;if(V!==o){if(!S)return n();V?n(!1,V):s=setTimeout(()=>{n(!1,1e-7)},1e3)}V===1&&!un(u,i.getBoundingClientRect())&&n(),S=!1}try{e=new IntersectionObserver(C,{...N,root:r.ownerDocument})}catch{e=new IntersectionObserver(C,N)}e.observe(i)}return n(!0),a}function hn(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=Ps(i),d=r||a?[...u?Ne(u):[],...Ne(t)]:[];d.forEach(E=>{r&&E.addEventListener("scroll",e,{passive:!0}),a&&E.addEventListener("resize",e)});let c=u&&l?Wl(u,e):null,p=-1,b=null;n&&(b=new ResizeObserver(E=>{let[L]=E;L&&L.target===u&&b&&(b.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var N;(N=b)==null||N.observe(t)})),e()}),u&&!o&&b.observe(u),b.observe(t));let f,g=o?ge(i):null;o&&w();function w(){let E=ge(i);g&&!un(g,E)&&e(),g=E,f=requestAnimationFrame(w)}return e(),()=>{var E;d.forEach(L=>{r&&L.removeEventListener("scroll",e),a&&L.removeEventListener("resize",e)}),c?.(),(E=b)==null||E.disconnect(),b=null,o&&cancelAnimationFrame(f)}}var cn=Ga;var dn=ja,fn=Ya,pn=Ka,bn=za;var mn=(i,t,e)=>{let s=new Map,r={platform:Hl,...e},a={...r.platform,_c:s};return Wa(i,t,{...r,platform:a})};var gn=!(CSS.supports?.("selector(:popover-open)")??!1),tt=class extends J{boot({options:t}
125){if(t({reference:null,auto:!0,position:"bottom start",gap:"5",offset:"0",matchWidth:!1,crossAxis:!1,scrollY:!0,onReferenceHidden:null}),this.options().reference===null||this.options().position===null)return;let[e,s]=Gl(this.el,{scrollY:this.options().scrollY}),r=Yl(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,onReferenceHidden:this.options().onReferenceHidden}),a=()=>{};this.reposition=(...n)=>{this.options().auto?a=hn(this.options().reference,this.el,r):r(null,...n)},this.cleanup=()=>{a(),s()}}};function Yl(i,t,e,{position:s,offset:r,gap:a,matchWidth:n,crossAxis:l,scrollY:o,onReferenceHidden:u}){let d=window.getComputedStyle(i).maxHeight;return d=d==="none"?null:parseFloat(d),(c,p,b)=>{mn(t,i,{strategy:gn?"fixed":"absolute",placement:zl(s,i),middleware:[cn({mainAxis:Number(a),alignmentAxis:Number(r)}),fn(),dn({padding:5,crossAxis:l}),pn({padding:5,apply({rects:f,elements:g,availableHeight:w}){n&&Object.assign(g.floating.style,{width:`${f.reference.width}px`});let E=d;E===null&&(E=o?g.floating.scrollHeight:g.floating.offsetHeight),g.floating.style.maxHeight=w>E?"":`${w}px`}}),...u?[bn({strategy:"referenceHidden"})]:[]]}).then(({x:f,y:g,middlewareData:w})=>{if(w.hide?.referenceHidden){u();return}e(p||f,b||g)})}}function zl(i,t){let e=i.split(" ");switch(e[0]){case"start":e[0]=ut(t)?"right":"left";break;case"end":e[0]=ut(t)?"left":"right";break}return e.join("-")}function Gl(i,{scrollY:t=!0}){let e=(o,u,d,c)=>{Object.assign(i.style,{position:gn?"fixed":"absolute",overflowY:t?"auto":"hidden",left:`${o}px`,top:`${u}px`,right:"auto",bottom:"auto",width:d,maxHeight:c})},s,r,a,n,l=new MutationObserver(()=>e(s,r,a,n));return[(o,u)=>{s=o,r=u,a=i.style.width,n=i.style.maxHeight,l.disconnect(),e(s,r,a,n),l.observe(i,{attributeFilter:["style"]})},()=>{l.disconnect()}]}var Vi=class extends P{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=si(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=si(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=si(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=si(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=si(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=()=>{}}}}
125,qi=class extends P{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 si(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 ct=class extends Nt{groupOfType=G;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.forEac
125h(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(G);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(G).isSelected()).use(G)}selecteds(){return this.walker().filter(t=>t.use(G).isSelected()).map(t=>t.use(G))}selectFirst(){this.walker().first()?.use(G).select()}selectAll(){this.walker().filter(t=>!t.use(G).isSelected()).map(t=>t.use(G).select())}deselectAll(){this.walker().filter(t=>t.use(G).isSelected()).map(t=>t.use(G).deselect())}allAreSelected(){let t=this.walker().filter(e=>!0);return t.length>0&&this.walker().filter(e=>e.use(G).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(G).value===t)?.use(G)}deselectOthers(t){this.walker().each(e=>{e!==t&&e.use(G).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 it(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()})}},G=class extends J{boot({options:t}){this.groupedByType=ct,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=>
125s()),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 J{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 Ae=class extends Z{boot(){let t=this.list();this._controllable=new z(this,{bubbles:!0}),this._selectable=new ct(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=K();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 R(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=Ns(l,"options",r);this._activatable=new Ut(l,{filter:"data-hidden"}),!t&&!e&&this._disableable.onInitAndChange(f=>{f?this.removeAttribute("tabindex"):this.setAttribute("tabindex","0")}),this.hasAttribute("filter")&&this.getAttribute("filter")!=="manual"&&(this._filterable=new de(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("")}
125)}));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 p=this.querySelector("button,ui-button");if(p=u?.contains(p)?null:p,!(u||c))Dt(this,this._activatable),Tt(this,this,this._activatable),vn(this,this._activatable,this._selectable);else if(!u&&c){let f=c;this._disableable.onInitAndChange(g=>{g?f&&h(f,"disabled",""):f&&x(f,"disabled")}),Be(this,f,this._selectable,this._popoverable),vn(f,this._activatable,this._selectable),yn(a,n,this,f,this._selectable,this._popoverable,this._filterable),$e(f),qe(f),this._filterable&&Ve(s,f,this._filterable),re(f,this._activatable,this._selectable),Dt(f,this._activatable),Tt(this,f,this._activatable),ie(this,this._activatable)}else if(u&&c){let f=c;h(f,"role","combobox"),h(f,"aria-controls",o);let g=u;this._popoverable=new nt(g),this._anchorable=new tt(g,{reference:f,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}),yn(a,n,this,f,this._selectable,this._popoverable,this._filterable),this._disableable.onInitAndChange(w=>{w?f&&h(f,"disabled",""):f&&x(f,"disabled")}),this.querySelectorAll("button,ui-button").forEach(w=>{g.contains(w)||(h(w,"tabindex","-1"),h(w,"aria-controls",o),h(w,"aria-haspopup","listbox"),se(w,this._popoverable),m(w,"click",()=>{this._popoverable.toggle(),Ti()||f.focus()}))}),Be(this,f,this._selectable,this._popoverable),ve(this,f,g,this._popoverable,this._anchorable),xe(this,this._popoverable,[f]),se(f,this._popoverable),$e(f),qe(f),this._filterable&&Ve(s,f,this._filterable),re(f,this._activatable,this._selectable),Rs(f,this._popoverable),Gt(f,this._popoverable,this._activatable,this._selectable),Fs(f,this._popoverable),zt(this,this._popoverable),Dt(f,this._activatable),Tt(this,f,this._activatable),ie(this,this._activatable),ye(this._popoverable,this._activatable,this._selectable),we(this,this._selectable,this._popoverable,r)}else if(u&&d){let f=p,g=d,w=u;h(f,"role","combobox"),h(g,"role","combobox"),h(f,"aria-controls",o),this._disableable.onInitAndChange(E=>{E?(f&&h(f,"disabled",""),g&&h(g,"disabled","")):(f&&x(f,"disabled"),g&&x(g,"disabled"))}),this._popoverable=new nt(w),this._anchorable=new tt(w,{reference:f,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}),$e(g),qe(g),this._filterable&&Ve(s,g,this._filterable),re(g,this._activatable,this._selectable),$i(g,this._popoverable),ve(this,f,w,this._popoverable,this._anchorable),xe(this,this._popoverable,[g]),se(f,this._popoverable),Be(this,g,this._selectable,this._popoverable),Gt(f,this._popoverable,this._activatable,this._selectable),ri(f,this._popoverable),zt(this,this._popoverable),Dt(g,this._activatable),ae(f,this._activatable,this._popoverable),Tt(this,g,this._activatable),ie(this,this._activatable),ye(this._popoverable,this._activatable,this._selectable),we(this,this._selectable,this._popoverable,r)}else if(u){let f=p,g=u;h(f,"role","combobox"),h(f,"aria-controls",o),this._disableable.onInitAndChange(w=>{w?(f&&h(f,"disabled",""),t&&h(t,"disabled","")):(f&&x(f,"disabled"),t&&x(t,"disabled"))}),this._popoverable=new nt(g),this._anchorable=new tt(g,{reference:f,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}),ve(this,f,g,this._popoverable,this._anchorable),xe(this,this._popoverable),se(f,this._popoverable),Gt(f,this._popoverable,this._activatable,this._selectable),ri(f,this._popoverable),re(f,this._activatable,this._selectable),zt(this,this._popoverable),Dt(f,this._activatable),ae(f,this._activatable,this._popoverable),Tt(this,f,this._activatable),ie(this,this._activatable),ye(this._popoverable,this._activatable,this._selectable),we(this,this._selectable,this._popoverable,r)}new MutationObserver(()=>{requestAnimationFrame(()=>{if(!this._popoverable||this._popoverable.getState()){let f=this._selectable.selecteds().find(g=>!g.el._disableable.isDisabled())?.el;this._activatable.activateSelectedOrFirst(f)}else this._activatable.clearActive()})}).observe(s,{childList:!0})}unmount(){if(this._popoverable?.getState()){let{unlock:t}=lt();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})))}};D("selected-remove",qi);D("selected",Vi);D("select",Ae);function Dt(i,t){m(i,"keydown",e=>
125{["ArrowDown","ArrowUp"].includes(e.key)&&(e.key==="ArrowDown"?(t.activateNext(),e.preventDefault(),e.stopPropagation()):e.key==="ArrowUp"&&(t.activatePrev(),e.preventDefault(),e.stopPropagation()))})}function ae(i,t,e){Li(i,s=>{t.activateBySearch(s),e.getState()||t.getActive()?.click()})}function Tt(i,t,e){m(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 ie(i,t,e=!1){m(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 vn(i,t,e){m(i,"focus",()=>{let s=e.selecteds().find(r=>!r.el._disableable.isDisabled())?.el;t.activateSelectedOrFirst(s)}),m(i,"blur",()=>{t.clearActive()})}function Ns(i,t){let e=X(i,"options");return h(i,"role","listbox"),h(i,"aria-multiselectable",t?"true":"false"),e}function se(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 ve(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 ye(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 zt(i,t){m(i,"keydown",e=>{e.key==="Escape"&&t.getState()&&(t.setState(!1),e.preventDefault(),e.stopImmediatePropagation())})}function Gt(i,t){m(i,"keydown",e=>{["ArrowDown","ArrowUp"].includes(e.key)&&(e.key==="ArrowDown"||e.key==="ArrowUp")&&(t.getState()||(t.setState(!0),e.preventDefault(),e.stopImmediatePropagation()))})}function Fs(i,t){m(i,"click",()=>{t.getState()||(t.setState(!0),i.focus())})}function ri(i,t){m(i,"click",()=>{t.setState(!t.getState()),i.focus()})}function $i(i,t){t.onChange(()=>{t.getState()&&!Ti()&&setTimeout(()=>i.focus())})}function Ve(i,t,e){m(t,"input",a=>{e.filter(a.target.value)});let s=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(t),"value");Object.defineProperty(t,"value",{get(){return s.get.call(this)},set(a){s.set.call(this,a),e.filter(a)}}),new MutationObserver(()=>{requestAnimationFrame(()=>{e.filter(e.lastSearch)})}).observe(i,{childList:!0})}function qe(i){m(i,"focus",()=>i.select())}function $e(i){m(i,"change",t=>t.stopPropagation()),m(i,"input",t=>t.stopPropagation())}function Rs(i,t){m(i,"keydown",e=>{(/^[a-zA-Z0-9]$/.test(e.key)||e.key==="Backspace")&&(t.getState()||t.setState(!0))})}function Be(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&&m(t,"keydown",c=>{c.key==="Escape"&&a("")})}function we(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.
125setState(!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 re(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 yn(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(()=>
125{a.getState()||requestAnimationFrame(()=>{l(s.getAttribute("data-selected")||"")})})}function xe(i,t,e=[]){let{lock:s,unlock:r}=lt(t.el,!1,e);t.onChange(()=>{t.getState()?s():r()})}var Vs=class extends Ae{mount(){this._disableable=new R(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=Ns(a,"options",s);this._activatable=new Ut(a,{filter:"data-hidden"}),this.hasAttribute("filter")&&this.getAttribute("filter")!=="manual"&&(this._filterable=new de(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,p=o,b=l;h(c,"role","button"),h(p,"aria-autocomplete","list"),h(p,"aria-controls",n),h(p,"role","combobox"),this._disableable.onInitAndChange(f=>{f?(c&&h(c,"disabled",""),p&&h(p,"disabled","")):(c&&x(c,"disabled"),p&&x(p,"disabled"))}),this._popoverable=new nt(b),this._anchorable=new tt(b,{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}),re(p,this._activatable,this._selectable),$e(p),qe(p),this._filterable&&Ve(e,p,this._filterable),$i(p,this._popoverable),ve(this,c,b,this._popoverable,this._anchorable),xe(this,this._popoverable,[p]),se(c,this._popoverable),Be(this,p,this._selectable,this._popoverable),Gt(c,this._popoverable,this._activatable,this._selectable),ri(c,this._popoverable),zt(this,this._popoverable),Dt(p,this._activatable),ae(c,this._activatable,this._popoverable),Tt(this,p,this._activatable),ie(this,this._activatable),ye(this._popoverable,this._activatable,this._selectable),we(this,this._selectable,this._popoverable,s),wn(c)}else if(u){let c=r,p=u,b=l;h(c,"role","button"),h(p,"aria-autocomplete","list"),h(p,"aria-controls",n),h(p,"role","combobox"),this._disableable.onInitAndChange(f=>{f?(c&&h(c,"disabled",""),p&&h(p,"disabled","")):(c&&x(c,"disabled"),p&&x(p,"disabled"))}),this._popoverable=new nt(b,{triggers:[p,c]}),this._anchorable=new tt(b,{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}),re(p,this._activatable,this._selectable),$e(p),qe(p),this._filterable&&Ve(e,p,this._filterable),$i(p,this._popoverable),ve(this,c,b,this._popoverable,this._anchorable),xe(this,this._popoverable,[c]),se(c,this._popoverable),Be(this,p,this._selectable,this._popoverable),Rs(p,this._popoverable),Gt(p,this._popoverable,this._activatable,this._selectable),Fs(c,this._popoverable,p),zt(this,this._popoverable),Dt(p,this._activatable),ae(c,this._activatable,this._popoverable),Tt(this,p,this._activatable),ie(this,this._activatable),ye(this._popoverable,this._activatable,this._selectable),we(this,this._selectable,this._popoverable,s),jl(this,this._selectable,p),Kl(this._selectable,p),Xl(this._selectable,p),Zl(this._popoverable,c,p)}else{let c=r,p=l;h(c,"role","combobox"),h(c,"aria-controls",n),h(c,"aria-autocomplete","none"),this._disableable.onInitAndChange(b=>{b?(c&&h(c,"disabled",""),t&&h(t,"disabled","")):(c&&x(c,"disabled"),t&&x(t,"disabled"))}),this._popoverable=new nt(p),this._anchorable=new tt(p,{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}),ve(this,c,p,this._popoverable,this._anchorable),xe(this,this._popoverable),se(c,this._popoverable),Gt(c,this._popoverable,this._activatable,this._selectable),ri(c,this._popoverable),re(c,this._activatable,this._selectable),zt(this,this._popoverable),Dt(c,this._activatable),ae(c,this._activatable,this._popoverable),Tt(this,c,this._activatable),ie(this,this._activatable),ye(this._popoverable,this._activatable,this._selectable),we(this,this._selectable,this._popoverable,s),wn(c)}
125new MutationObserver(()=>{requestAnimationFrame(()=>{if(!this._popoverable||this._popoverable.getState()){let c=this._selectable.selecteds().find(p=>!p.el._disableable.isDisabled())?.el;this._activatable.activateSelectedOrFirst(c)}else this._activatable.clearActive()})}).observe(e,{childList:!0})}list(){return this.querySelector("ui-options")||this}},qs=class extends P{boot(){this.querySelector("input")?h(this,"tabindex","-1"):h(this,"tabindex","0"),this._disableable=new R(this);let t=e=>{e.preventDefault(),e.stopImmediatePropagation()};this._disableable.onInitAndChange(e=>{e?this.addEventListener("click",t,!0):this.removeEventListener("click",t,!0)})}mount(){}};D("pillbox-trigger",qs);D("pillbox",Vs);function wn(i){m(i,"keydown",t=>{t.key===" "&&(t.preventDefault(),t.stopImmediatePropagation(),i.click())})}function jl(i,t,e){t.onChange(()=>{document.activeElement!==e&&document.activeElement.closest("ui-pillbox")===i&&e.focus()})}function Kl(i,t){i.onInitAndChange(()=>{i.noneAreSelected()?h(t,"placeholder",t.getAttribute("data-placeholder")):h(t,"placeholder","")})}function Xl(i,t){m(t,"keydown",e=>{t.value==""&&e.key==="Backspace"&&i.findByValue(i.getState().at(-1))?.deselect()})}function Zl(i,t,e){m(t,"click",s=>{i.getState()&&(e.focus(),s.preventDefault(),s.stopImmediatePropagation())})}var ai=class extends P{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&&Jl(this,e,t._filterable)}},$s=class extends P{mount(){let t=this;this._disableable=new R(t,{disableWithParent:!1}),this._disableable.onInitAndChange(r=>{r?h(t,"aria-disabled","true"):x(t,"aria-disabled")});let e=X(t,"option");h(t,"role","option"),this._filterable=new Ft(t,{mirror:this,keep:!!this.closest("ui-option-empty, ui-empty")||this.getAttribute("filter")==="manual"}),this._activatable=new st(t),this.hasAttribute("action")||(this._selectable=new G(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()}},Bs=class extends P{mount(){this._activatable=new st(this),this._filterable=new Ft(this,{keep:!0}),this._disableable=new R(this,{disableWithParent:!1}),this._disableable.onInitAndChange(t=>{t?h(this,"aria-disabled","true"):x(this,"aria-disabled")})}},Bi=class extends P{},Us=class extends Bi{};D("option-create",Bs);D("options",ai);D("option",$s);D("option-empty",Bi);D("empty",Us);function Jl(i,t,e){let s=Array.from(i.children).find(b=>b.matches("ui-option-empty, ui-empty")),r=Array.from(i.children).find(b=>b.matches("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=b=>b.hasAttribute("data-hidden"),l=b=>b.textContent.toLowerCase().trim()!==t.value.toLowerCase().trim(),o=()=>Array.from(i.querySelectorAll("ui-option")).filter(b=>b.closest("ui-options")===i),u=()=>{if(s.hasAttribute("when-loading")){let b=s.textContent;s.textContent=s.getAttribute("when-loading"),s.__hideLoading=()=>{s.textContent=b,s.__hideLoading=void 0}}},d,c,p=()=>
125{if(clearTimeout(d),clearTimeout(c),t.hasAttribute("data-flux-loading")||t.hasAttribute("data-loading"))return;let b=o(),f=b.every(g=>n(g));if(r){a&&t.value.trim().length<a?h(r,"data-hidden",""):b.every(w=>l(w))?x(r,"data-hidden"):h(r,"data-hidden",""),f&&r._activatable.activate(!0);let g=()=>{x(r,"disabled")};e?g():c=setTimeout(g,150)}f&&(!r||n(r))?x(s,"data-hidden"):h(s,"data-hidden",""),s.__hideLoading?.()};if(e)e.onChange(()=>p()),r&&m(t,"input",()=>{a&&t.value.trim().length<a&&h(r,"data-hidden","")});else{let b=new MutationObserver(()=>{requestAnimationFrame(()=>p())});b.observe(i,{childList:!0}),b.observe(t,{attributes:!0,attributeFilter:["data-loading","data-flux-loading"]}),r&&m(t,"input",f=>{clearTimeout(d),clearTimeout(c);let g=o().every(w=>n(w));g&&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"),g&&r._activatable.activate()},200)})}queueMicrotask(()=>p())}var v=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 xn(i,t,e,s){let r=i.querySelector('template[name="heading"]'),a=i.querySelector('template[name="weekday"]'),n=i.querySelector('template[name="week"]');r&&Ql(r,t,e),a&&to(a,t),n&&eo(n,t,e,s)}function Ql(i,t,e){ot(i,s=>s({slots:{default:new Intl.DateTimeFormat(t.locale,{month:i.hasAttribute("display")?i.getAttribute("display"):"long",year:"numeric",timeZone:"UTC"}).format(new v(e.year,e.month).getDate())}}))}function to(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)});ot(i,r=>s.map(a=>r({slots:{default:a}})))}
125function eo(i,t,e,s){let r=e.month,a=e.year,n=(new v(a,r).getFirstDayOfMonth()-t.startDay+7)%7,l=new v(a,r).getDaysInMonth(),[o,u]=new v(a,r).addMonths(-1).toParts(),d=new v(o,u).getDaysInMonth(),[c,p]=[[],[]];for(let S=0;S<n;S++){c.push(0);let C=d-n+S+1;p.push(new v(o,u,C).toIsoDateString())}for(let S=1;S<=l;S++)c.push(S),p.push(new v(a,r,S).toIsoDateString());let f=(7-(n+l)%7)%7,[g,w]=new v(a,r).addMonths(1).toParts();for(let S=1;S<=f;S++)c.push(0),p.push(new v(g,w,S).toIsoDateString());if(t.fixedWeeks){let S=Math.ceil(c.length/7),C=t.fixedWeeks,q=C-S;if(q>0)for(let V=0;V<q*7;V++)c.push(0),p.push(v.fromIsoDateString(p[p.length-1]).addDays(1).toIsoDateString());else q<0&&(c.length=C*7,p.length=C*7)}let E=S=>Array.from({length:Math.ceil(S.length/7)},(C,q)=>S.slice(q*7,(q+1)*7)),L=E(c),N=E(p);ot(i,S=>L.map((C,q)=>{let V=S(),U=N[q],y=V.querySelector('template[name="number"]');if(y){let H=(4-t.startDay+7)%7,_=v.fromIsoDateString(U[H]).getWeekNumber();ot(y,W=>W({slots:{default:_}}))}return ot(V.querySelector('template[name="day"]'),H=>C.map((_,W)=>{if(_===0){let M=v.fromIsoDateString(U[W]).getDay();return H({slots:{default:M},attrs:{"data-date":U[W],"data-outside":""}})}let F=v.fromIsoDateString(U[W]),A=H({slots:{default:_},attrs:{"data-date":U[W]}}),O=s.subtext(F),k=s.details(F),I=s.variant(F);if([!1,null,void 0].includes(I)||(A.dataset.dateVariant=I),![!1,null,void 0].includes(O)){let T=A.querySelector('template[name="subtext"]');T&&ot(T,M=>M({slots:{default:O}}))}if(![!1,null,void 0].includes(k)){let T=A.querySelector('template[name="details"]');T&&ot(T,M=>M({slots:{default:k}}))}return A})),V}))}function An(i,t,e,s,r,a){let l=((o,u)=>r.lowerBound(()=>v.today().getMonth()===o&&v.today().getYear()===u?v.today():new v(u,o)))(s.month,s.year);i.querySelectorAll("[data-date]").forEach(o=>{h(o,"role","gridcell");let u=o.querySelector("button,ui-button"),d=io(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","")),v.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 ot(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 io(i){return!i||!i.hasAttribute("data-date")?null:v.fromIsoDateString(i.getAttribute("data-date"))}var jt=class{static SINGLE="single";static MULTIPLE="multiple"},dt=class{static SELECTION="selection";static ACTIVATION="activation";static VIEW_CHANGE="view-change"},Ui=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(dt.SELECTION):this.observable.notify(dt.ACTIVATION)}setValue(t){let e=this.selection;this.selection=i.createSelectionFromValue(t,this.config),this.selection.shouldNotify(e)?this.observable.notify(dt.SELECTION):this.observable.notify(dt.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===jt.MULTIPLE?(t??=[],new Hs(t)):t?new Wi(t):new Hi}static createFromValueStringAttribute(t,e,s){let r=i.createSelectionFromValueStringAttribute(t,e);return new i(r,e,s)}static createSelectionFromValueStringAttribute(t,e){return e.mode===jt.MULTIPLE&&(t=t?t.split(",").map(s=>s.trim()):[]),i.createSelectionFromValue(t,e)}},ni=class{contains(){}shouldNotify(t){return!0}hasSelection(){return!1}lowerBound(t){return Yi(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"))}},Hi=class i extends ni{contains(){return!1}shouldNotify(t){return!(t instanceof i)}hasSelection(){return!1}lowerBound(t){return Yi(t)}select(t){return new Wi(t)}display(t){return""}value(){return null}},Wi=class i extends ni{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 Hi:new i(t)}display(t){return zi(this._value,t.timeFormat,t.locale)}value(){return this._value}},Hs=class i extends ni{constructor(t){super(),this._values=t.sort((e,s)=>Lt(e)<Lt(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)=>Lt(s)<Lt(r)?-1:1)[0]||Yi(t)}upperBound(t){let e=this._values.sort((s,r)=>Lt(s)<Lt(r)?-1:1);return e[e.length-1]||Yi(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)=>Lt(e)<Lt(s)?-1:1).map(e=>zi(e,t.timeFormat,t.locale)).join(", ")}value(){return this._values}};function Yi(i=null){return typeof i=="function"?i():i}
125var Gi=class extends P{boot(){this.picker=this.closest("ui-time-picker");let t=this.querySelectorAll("input");this._disableable=new R(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.hourInput.placeholder=this.meridiemInput?"hh":"HH",this.minuteInput.placeholder="mm",this.meridiemInput&&(this.meridiemInput.placeholder=Rt(0,this.picker.config.locale)||"AM"),this.clearInputs(),Ws(this.hourInput),Ws(this.minuteInput),this.meridiemInput&&Ws(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.meridiemInputForTimeFormat()?.focus()}),this.meridiemInput?.addEventListener("keydown",s=>{if(s.key==="ArrowLeft")return this.minuteInput.focus()}),Ys(this.hourInput),Ys(this.minuteInput),this.meridiemInput&&Ys(this.meridiemInput,{isMeridiem:!0}),this.initHourInputListeners(),this.initMinuteInputListeners(),this.meridiemInput&&this.initMeridiemInputListeners(),this.meridiemInput&&this.setMeridiemWidthBasedOnLocale(),this._lastFocusedInput=null,this.addEventListener("mousedown",s=>{if(s.target.closest("input")||this.picker._popoverable?.state)return;let r=document.activeElement;r===this.hourInput||r===this.minuteInput||r===this.meridiemInput?this._lastFocusedInput=r:this._lastFocusedInput=null}),this.picker.observable.subscribe(dt.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:ro(this.picker.config.locale)}meridiemInputForTimeFormat(){return this.use24HourFormat()?null:this.meridiemInput}processTime(){let t=this.meridiemInputForTimeFormat();if(this.hourInput.value===""||this.minuteInput.value===""||t&&t.value==="")return;let e=null;if(t?.value){let r=this.picker.config.locale,a=Rt(0,r);e=t.value===a?"AM":"PM"}let s=so(this.hourInput.value,this.minuteInput.value,e);s&&(this.updateSelectable(s),this.updateInputsFromSelectable(this.picker.selectable))}updateSelectable(t){this.picker.selectable.setValue(t)}updateInputsFromSelectable(t){let e=t.getValue();this.updateInputs(e)}updateHourDisplay(t,{forceMeridiem:e=!1}={}){if(t=parseInt(t),isNaN(t))return;let s=this.meridiemInputForTimeFormat();if(s){let r=s.value&&!("showingPlaceholder"in s.dataset);if(e||!r||t>12||t===0){let a=Rt(t,this.picker.config.locale);s.value=a,s.style.color="",delete s.dataset.showingPlaceholder}t>12?t=t-12:t===0&&(t=12)}this.hourInput.value=t.toString().padStart(2,"0"),this.hourInput.style.color="",this.hourInput.classList.remove("font-mono")}updateInputs(t){if(!t)return this.clearInputs();x(this.picker,"data-empty");let[e,s]=t.split(":"),r=null,a=this.meridiemInputForTimeFormat();a&&(e=parseInt(e),r=Rt(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.hourInput.style.color="",this.hourInput.classList.remove("font-mono"),this.minuteInput.value=s.padStart(2,"0"),this.minuteInput.style.color="",this.minuteInput.classList.remove("font-mono"),a&&(a.value=r,a.style.color="",delete a.dataset.showingPlaceholder)}clearInputs(){this.hourInput.value="",this.hourInput.style.color="",this.hourInput.classList.add("font-mono"),this.minuteInput.value="",this.minuteInput.style.color="",this.minuteInput.classList.add("font-mono"),this.meridiemInput&&(this.meridiemInput.value="",this.meridiemInput.style.color="");let t=[this.hourInput,this.minuteInput,this.meridiemInput].find(e=>e===document.activeElement);t&&gt(t),h(this.picker,"data-empty","")}initHourInputListeners(){let t=!1;this.hourInput.addEventListener("keydown",e=>{if(e.key==="Backspace"){if(this.hourInput.value===""||this.hourInput.value===this.hourInput.placeholder)return;t=!1,this.hourInput.value="",this.hourInput.style.color="",this.hourInput.classList.add("font-mono"),gt(this.hourInput);return}
125if(!["ArrowUp","ArrowDown"].includes(e.key))return;e.preventDefault(),e.stopPropagation();let s=parseInt(this.hourInput.value),r=this.meridiemInputForTimeFormat();if(!isNaN(s)&&r&&r.value&&!("showingPlaceholder"in r.dataset)){let a=r.value===Rt(12,this.picker.config.locale);a&&s!==12&&(s+=12),!a&&s===12&&(s=0)}e.key==="ArrowUp"?isNaN(s)||s===23?s=0:s++:e.key==="ArrowDown"&&(isNaN(s)||s===0?s=23:s--),this.updateHourDisplay(s,{forceMeridiem:!0}),this.processTime(),gt(this.hourInput)}),this.hourInput.addEventListener("keydown",e=>{if(!/[0-9]/.test(e.key))return;let s=parseInt(e.key);if(this.hourInput.value===""||!t){t=!0,this.hourInput.value=`0${s}`,this.hourInput.style.color="",this.hourInput.classList.remove("font-mono"),s>2?this.minuteInput.focus():gt(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():gt(this.hourInput)}),this.hourInput.addEventListener("blur",e=>{t=!1,this.hourInput.value!==""&&this.hourInput.value!==this.hourInput.placeholder&&this.updateHourDisplay(this.hourInput.value),this.processTime()})}initMinuteInputListeners(){let t=!1;this.minuteInput.addEventListener("keydown",e=>{if(e.key==="Backspace"){if(this.minuteInput.value===""||this.minuteInput.value===this.minuteInput.placeholder){this.hourInput.focus();return}t=!1,this.minuteInput.value="",this.minuteInput.style.color="",this.minuteInput.classList.add("font-mono"),gt(this.minuteInput);return}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.minuteInput.style.color="",this.minuteInput.classList.remove("font-mono"),this.processTime(),gt(this.minuteInput)}),this.minuteInput.addEventListener("keydown",e=>{if(!/[0-9]/.test(e.key))return;let s=parseInt(e.key);if(this.minuteInput.value===""||!t){t=!0,this.minuteInput.value=`0${s}`,this.minuteInput.style.color="",this.minuteInput.classList.remove("font-mono"),this.processTime(),s>5?this.meridiemInputForTimeFormat()?.focus():gt(this.minuteInput);return}let r=parseInt(this.minuteInput.value);if(r<=5){this.minuteInput.value=`${r}${s}`,this.processTime(),this.meridiemInputForTimeFormat()?.focus();return}this.minuteInput.value=`0${s}`,this.processTime(),s>5?this.meridiemInputForTimeFormat()?.focus():gt(this.minuteInput)}),this.minuteInput.addEventListener("blur",e=>{t=!1,this.processTime()})}initMeridiemInputListeners(){this.meridiemInput?.addEventListener("keydown",t=>{if(t.key==="Backspace"){if(this.meridiemInput.value===""||"showingPlaceholder"in this.meridiemInput.dataset){this.minuteInput.focus();return}this.meridiemInput.value="",this.meridiemInput.style.color="",gt(this.meridiemInput);return}if(!["ArrowUp","ArrowDown"].includes(t.key))return;t.preventDefault(),t.stopPropagation(),ji(this.meridiemInput);let e=this.picker.config.locale,s=Rt(0,e),r=Rt(12,e),a=this.meridiemInput.value;t.key==="ArrowUp"?a===""||a===r?a=s:a=r:t.key==="ArrowDown"&&(a===""||a===s?a=r:a=s),this.meridiemInput.value=a,this.meridiemInput.style.color="",delete this.meridiemInput.dataset.showingPlaceholder,this.processTime(),gt(this.meridiemInput)}),this.meridiemInput?.addEventListener("keydown",t=>{if(!["a","p","A","P"].includes(t.key))return;ji(this.meridiemInput);let e=this.picker.config.locale;t.key==="a"||t.key==="A"?this.meridiemInput.value=Rt(0,e):(t.key==="p"||t.key==="P")&&(this.meridiemInput.value=Rt(12,e)),this.meridiemInput.style.color="",delete this.meridiemInput.dataset.showingPlaceholder,this.processTime(),gt(this.meridiemInput)})}setMeridiemWidthBasedOnLocale(){let t=Rt(12,this.picker.config.locale);if(!t)return;if(/^[\u0000-\u024F\u0370-\u03FF\u1E00-\u1EFF\s.]+$/.test(t)){this.meridiemInput.style.width=`calc(${t.length}ch + 2px)`;return}let s=document.createElement("span");s.style.cssText="position:absolute;visibility:hidden;white-space:nowrap",s.style.font=getComputedStyle(this.meridiemInput).font,s.textContent=t,document.body.appendChild(s),this.meridiemInput.style.width=`${s.getBoundingClientRect().width}px`,s.remove()}};function Ws(i){i.addEventListener("focus",t=>{gt(i)}),i.addEventListener("blur",t=>{ji(i)}),i.addEventListener("mousedown",t=>{t.preventDefault(),i.focus(),gt(i)}),i.addEventListener("mouseup",t=>{t.preventDefault(),gt(i)})}function Ys(i,{isMeridiem:t=!1}={}){i.addEventListener("keydown",e=>{/[0-9]/.test(e.key)&&!t&&(ji(i),i.classList.remove("font-mono")),!(e.ctrlKey||e.metaKey||e.altKey)&&(["Tab","Backspace"].includes(e.ke
125y)||e.preventDefault())})}function gt(i){!i.value&&i.placeholder&&(i.style.color=getComputedStyle(i,"::placeholder").color,i.value=i.placeholder,i.classList.add("font-mono"),i.dataset.showingPlaceholder=""),i.setSelectionRange(0,i.value.length)}function ji(i){"showingPlaceholder"in i.dataset&&(i.value="",i.style.color="",delete i.dataset.showingPlaceholder)}function Rt(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 so(i,t,e=null){i=i.padStart(2,"0"),t=t.padStart(2,"0");let s=e?i+":"+t+" "+e:i+":"+t;return ao(s)}function ro(i){return new Intl.DateTimeFormat(i,{hour:"numeric"}).format(new Date(2024,0,1,0,0)).startsWith("00")}function ao(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 zs=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")?jt.MULTIPLE:jt.SINGLE,dropdown:!(this.hasAttribute("dropdown")&&this.getAttribute("dropdown")==="false")},this.observable=new Zt,this._controllable=new z(this,{bubbles:!0}),this._submittable=new Q(this,{name:this.getAttribute("name"),value:this.getAttribute("value"),includeWhenEmpty:!1}),this.selectable=Ui.createFromValueStringAttribute(this.getAttribute("value"),this.config,this.observable),this._controllable.getter(()=>this.selectable.getValue());let t=K();if(this._controllable.setter(t(l=>{this.selectable.setValue(l)}
125)),this.observable.subscribe(dt.SELECTION,t(()=>{this._controllable.dispatch(),this.dispatchEvent(new CustomEvent("input",{bubbles:!1}))})),this.observable.subscribe(dt.SELECTION,()=>{this._submittable.update(this.selectable.getValue())}),this._disableable=new R(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=no(r,this.config.mode===jt.MULTIPLE);this._popoverable=new nt(e,{triggers:[s]}),this._anchorable=new tt(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 Ut(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()}),this._popoverable.onChange(l=>{if(!l&&s._lastFocusedInput){let o=s._lastFocusedInput;s._lastFocusedInput=null,o.focus()}}),s.querySelectorAll("button,ui-button").forEach(l=>{lo(l,this._popoverable,a),co(l,this._activatable,this.observable)}),oo(this,e,this._popoverable,this._anchorable),uo(this,this._popoverable),Gt(s,this._popoverable),zt(this,this._popoverable),Dt(s,this._activatable),ae(s,this._activatable,this._popoverable),Tt(this,s,this._activatable),go(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(dt.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}):li(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}):li(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("-")?bo(e):li(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}):li(t)?t:console.warn(`Invalid open-to attribute: ${t}`)}}},Gs=class extends P{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(dt.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}=ot(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}=ot(this.templates.placeholder,s=>s({slots:{}}));this.templates.placeholder.clearPlaceholder=e}}}
125,js=class extends P{boot(){this.picker=this.closest("ui-time-picker"),this.render(),this.picker.observable.subscribe(dt.SELECTION,()=>{this.render()}),this.picker.observable.subscribe(dt.VIEW_CHANGE,()=>{this.render()});let{enable:t,disable:e}=po(this,this.picker.selectable);this.picker._disableable.onInitAndChange(s=>{s?e():t()})}render(){let t=this.querySelector('template[name="option"]');t&&ot(t,e=>yo(this.picker.config).map(({value:r,label:a})=>{let n=this.picker.config.unavailable.some(u=>mo(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 st(o),X(o,"option"),o}))}};D("time-picker",zs);D("time-picker-trigger",Gi);D("selected-time",Gs);D("time-picker-options",js);function no(i,t){let e=X(i,"options");return h(i,"role","listbox"),h(i,"aria-multiselectable",t?"true":"false"),e}function lo(i,t,e){h(i,"role","combobox"),h(i,"aria-controls",e),h(i,"aria-haspopup","listbox"),ho(i,t),m(i,"click",s=>{s.stopPropagation(),t.setState(!t.getState()),i.focus()})}function oo(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 uo(i,t){let{lock:e,unlock:s}=lt(t.el);t.onChange(()=>{t.getState()?e():s()})}function ho(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 co(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!==jt.MULTIPLE&&e.subscribe(dt.SELECTION,()=>{s.hasSelection()&&r.setState(!1)})}function po(i,t){let e=!1,s=i.hasAttribute("readonly");return m(i,"click",r=>{if(e||s)return;let a=r.target.closest("[data-time]");
125if(!a)return;let n=a.getAttribute("data-time");setTimeout(()=>{li(n)&&t.select(n)})}),{enable:()=>{},disable:()=>{}}}function li(i){return new RegExp(`^${Ks()}$`).test(i)}function bo(i){return new RegExp(`^${Ks()}-${Ks()}$`).test(i)}function Ks(){return"([01]?[0-9]|2[0-3]):[0-5][0-9]"}function mo(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 zi(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 Lt(i){if(!i)return null;let[t,e]=i.split(":");return isNaN(t)||isNaN(e)?null:parseInt(t)*60+parseInt(e)}function go(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=vo(t,s)),setTimeout(()=>{let o=n||l;t.activateSelectedOrFirst(o),o?.scrollIntoView({block:"nearest"})})}else t.clearActive()})}function vo(i,t){let e=Lt(t),s=null,r=null;return i.filterAwareWalker().walk((a,n)=>{let l=a.getAttribute("data-time"),o=Lt(l);o>e||Math.abs(o-e)<Math.abs(r-e)&&(s=a,r=o)}),s}function yo({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")}`,p=zi(c,t,e);a.push({value:c,label:p})}return a}var Ki=class extends J{boot({options:t}){this.onChanges=[],this.state=!1}onChange(t){this.onChanges.push(t)}getState(){return this.state}setState(t){let e=this.state;
125this.state=!!t,this.state!==e&&this.onChanges.forEach(s=>s())}};var Xs=class extends P{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 R(this),this._disableable.onInitAndChange(n=>{n?t.hasAttribute("disabled")||h(t,"disabled",""):t.hasAttribute("disabled")&&x(t,"disabled")}),this._controllable=new z(this,{disabled:this.disabled}),e._disclosable=new Ki(e),this._controllable.initial(n=>n&&e._disclosable.setState(!0)),this._controllable.getter(()=>e._disclosable.getState()),this._controllable.setter(n=>e._disclosable.setState(n)),e._disclosable.onChange(()=>{this.dispatchEvent(new CustomEvent("lofi-disclosable-change",{bubbles:!0})),this._controllable.dispatch()});let s=e.getAttributeNames().some(n=>n==="x-collapse"||n.startsWith("x-collapse.")),r=(n=!1)=>{e._disclosable.getState()?(h(this,"data-open",""),h(t,"data-open",""),h(e,"data-open",""),x(e,"hidden")):(x(this,"data-open"),x(t,"data-open"),x(e,"data-open"),(!s||n)&&h(e,"hidden","until-found"))};e._disclosable.onChange(()=>r()),r(!0),s&&m(e,"transitionend",n=>{n.target!==e||n.propertyName!=="height"||e._disclosable.getState()||h(e,"hidden","until-found")}),m(e,"beforematch",()=>{e._disclosable.setState(!0)}),m(t,"click",n=>{this.disabled||e._disclosable.setState(!e._disclosable.getState())});let a=X(e,"disclosure");h(t,"aria-controls",a),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}},Zs=class i extends P{boot(){this.exclusive=this.hasAttribute("exclusive"),this.exclusive&&m(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 it(this,(t,{skip:e,reject:s})=>{if(t instanceof i&&t!==this||t.localName!=="ui-disclosure")return s()})}};D("disclosure",Xs);D("disclosure-group",Zs);var Js=class extends P{boot(){}},Qs=class extends P{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),p=b=>{let f=d+(b.clientX-o),g=c+(b.clientY-u);(t==="width"||t==="both")&&(e?s.style.width=`${Math.min(f,r)}px`:s.style.width=`${f}px`),(t==="height"||t==="both")&&(e?s.style.height=`${Math.min(g,a)}px`:s.style.height=`${g}px`)};document.addEventListener("pointermove",p),document.addEventListener("pointerup",()=>{this.releasePointerCapture(l.pointerId),document.removeEventListener("pointermove",p)},{once:!0}),this.setPointerCapture(l.pointerId)})}};D("resizable",Js);D("grip",Qs);var tr=class i extends Z{boot(){this._disableable=new R(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 ct(this,{multiple:!0}),this._controllable=new z(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=K(),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=K();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.allAreSelected()?(t.indeterminate=!1,t._selectable.select()):this.noneAreSelected()?(t.indeterminate=!1,t._selectable.deselect()):t.indeterminate=!0};this._selectable.onChange(e(()=>{s()})),s()}selectAll(){this.walker({checkable:!0}).filter(t=>!t.use(G).isSelected()).map(t=>t.use(G).select())}deselectAll(){this.walker({checkable:!0}).filter(t=>t.use(G).isSelected()).map(t=>t.use(G).deselect())}allAreSelected(){let t=this.walker({checkable:!0}).filter(e=>!0);return t.length>0&&this.walker({checkable:!0}).filter(e=>e.use(G).isSelected()).length===t.length}noneAreSelected(){return this.walker({checkable:!0}).filter(t=>t.use(G).isSelected()).length===0}walker({checkable:t}={}){return it(this,(e,{skip:s,reject:r})=>{if(e instanceof i)return r();if(e.localName!=="ui-checkbox"||t&&(e.disabled||e.use(G).ungrouped))return s()})}},er=class extends Z{boot(){let t=this;this.isIndeterminate=!1,this._disableable=new R(this),this.hasAttribute("all")?(this._selectable=new G(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 G(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=K(),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")}),m(t,"click",this._disableable.disabled(e=>{e.preventDefault(),e.stopPropagation()}),{capture:!0}),m(t,"click",this._disableable.enabled(e=>{this._selectable.press()})),m(t,"keydown",this._disableable.enabled(e=>{e.key==="Enter"&&this.closest("form")?.requestSubmit()})),m(t,"keydown",this._disableable.enabled(e=>{e.key===" "&&(e.preventDefault(),e.stopPropagation())})),m(t,"keyup",this._disableable.enabled(e=>{e.key===" "&&(this._selectable.press(),e.preventDefault(),e.stopPropagation())})),wo(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()}
125))()}get indeterminate(){return this.isIndeterminate}set indeterminate(t){this.isIndeterminate=!!t,this.isIndeterminate?h(this,"data-indeterminate",""):x(this,"data-indeterminate")}};D("checkbox-group",tr);D("checkbox",er);function wo(i){i.closest("label")?.addEventListener("click",t=>{i.contains(t.target)||i._selectable.press()})}var ir=class extends P{boot(){let t=this.trigger(),e=this.overlay(),s=this.hasAttribute("data-flux-tooltip");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 z(this),e._popoverable=new nt(e),e._anchorable=new tt(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,onReferenceHidden:s?()=>e._popoverable.hide():null}),e._popoverable.onChange(()=>{e._popoverable.getState()?e._anchorable.reposition():e._anchorable.cleanup()}),this._locksScroll=!this.hasAttribute("hover")&&!s,this._locksScroll){let{lock:n,unlock:l}=lt(e._popoverable.el);e._popoverable.onChange(()=>{e._popoverable.getState()?n():l()})}this._controllable.initial(n=>e._popoverable.setState(n)),this._controllable.getter(()=>e._popoverable.getState());let r=K();if(this._controllable.setter(n=>e._popoverable.setState(n)),e._popoverable.onChange(r(()=>this._controllable.dispatch())),this.hasAttribute("hover")){let n=()=>{};Me(t,e,{gain(){e._openedViaHover=!0,e._popoverable.setState(!0),n=m(document,"scroll",()=>{e._popoverable.getState()&&(e._popoverable.setState(!1),n())}).off},lose(){e._popoverable.setState(!1),n()},focusable:!1})}m(t,"click",()=>e._popoverable.toggle()),xo(e),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 a=X(e,"dropdown");h(t,"aria-haspopup","true"),h(t,"aria-controls",a),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._locksScroll){let{unlock:t}=lt();t()}}trigger(){return this.querySelector("button,ui-button,a")}overlay(){return this.lastElementChild?.matches("[popover]")&&this.lastElementChild}};D("dropdown",ir);function xo(i){if(!i.matches("[data-flux-navmenu]"))return;let t=e=>{e.closest?.("[data-flux-navmenu-item]")&&i._popoverable.hide()};m(i,"mouseup",e=>t(e.target)),m(i,"click",e=>!e.isTrusted&&t(e.target))}var sr=class extends P{boot(){this.type="file"}mount(){this._disableable=new R(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%'"),m(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%'")}),m(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%'")}),m(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%'")}),m(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%'")}),m(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"))}),m(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&&(m(this.triggerEl,"dragenter",this._disableable.enabled(t=>{t.preventDefault(),h(this,"data-dragging",""),this.clear()}
125)),m(this.triggerEl,"dragover",this._disableable.enabled(t=>{t.preventDefault(),h(this,"data-dragging","")})),m(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)})),m(this.triggerEl,"dragleave",t=>{x(this,"data-dragging")}))}initClickListeners(){this.triggerEl&&(m(this.triggerEl,"click",this._disableable.disabled(t=>{t.preventDefault(),t.stopPropagation()}),{capture:!0}),m(this.triggerEl,"click",this._disableable.enabled(t=>{t.preventDefault(),this.inputEl.click()})),m(this.inputEl,"change",t=>{t.stopPropagation(),this.inputEl.files&&this.inputEl.files.length>0&&!this.disabled&&this.addFiles(this.inputEl.files)}),m(this.triggerEl,"keydown",this._disableable.enabled(t=>{["Enter"," "].includes(t.key)&&t.preventDefault(),["Enter"].includes(t.key)&&this.inputEl.click()})),m(this.triggerEl,"keyup",this._disableable.enabled(t=>{t.key===" "&&(t.preventDefault(),this.inputEl.click())})),m(this.triggerEl,"focus",this._disableable.enabled(()=>{h(this,"data-focus","")})),m(this.triggerEl,"blur",()=>{x(this,"data-focus")}))}};D("file-upload",sr);var $=class{static SELECTION=1;static ACTIVATION=2;static VIEW_CHANGE=3},Ue=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 ht=class{static SINGLE="single";static MULTIPLE="multiple";static RANGE="range"},Xi=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($.SELECTION):this.observable.notify($.ACTIVATION)}activate(t){let e=this.active;t?this.active=t:this.active=null,this.selection.activate(t),e!==this.active&&this.observable.notify($.ACTIVATION)}setValue(t){let e=this.selection;this.selection=this.createSelectionFromValue(t,this.config),this.selection.shouldNotify(e)?this.observable.notify($.SELECTION):this.observable.notify($.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===ht.MULTIPLE){let s=t?t.map(r=>v.fromIsoDateString(r)):[];return new Ji(s)}else if(e.mode===ht.RANGE){let{start:s,end:r,preset:a}=t||{};return a&&ts[a]&&a!=="custom"?new Qi(a,e):!s&&!r?new hi:r?new ci(v.fromIsoDateString(s),v.fromIsoDateString(r)):new ne(v.fromIsoDateString(s))}else return t?new ui(v.fromIsoDateString(t)):new oi}static createFromValueStringAttribute(t,e,s){let r=i.createSelectionFromValueStringAttribute(t,e);return new i(r,e,s)}static createSelectionFromValueStringAttribute(t,e){if(e.mode===ht.MULTIPLE){let s=t?t.split(",").map(r=>r.trim()).map(r=>v.fromIsoDateString(r)):[];return new Ji(s)}else if(e.mode===ht.RANGE){if(!t)return new hi;let[s,r]=t.split("/").map(a=>a.trim());return!r&&s&&ts[s]&&s!=="custom"?new Qi(s,e):(s=v.fromIsoDateString(s),r?(r=v.fromIsoDateString(r),new ci(s,r)):new ne(s))}else return t?new ui(v.fromIsoDateString(t)):new oi}},Zi=class{constructor(t,e){this.selectable=t,this.observable=e,this._selection=this.selectable.selection,this.selectable.observable.subscribe($.SELECTION,()=>{this._blockSync()||this.sync()}),this._blockSync=()=>{}}blockSyncIf(t){this._blockSync=t}sync(){this._selection=this.selectable.selection,this.observable.notify($.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()}
125display(...t){return this.selectable.displayResolver(this._selection.display(...t))}},Kt=class{contains(){}shouldNotify(t){return!0}hasSelection(){return!1}lowerBound(t){return di(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"))}},oi=class i extends Kt{shouldNotify(t){return!(t instanceof i)}hasSelection(){return!1}contains(){return!1}select(t){return new ui(t)}lowerBound(t){return di(t)}display(t){return""}value(){return null}},ui=class i extends Kt{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 oi: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()}},Ji=class i extends Kt{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]||di(t)}upperBound(t){let e=this._dates.sort((s,r)=>s.isBefore(r)?-1:1);return e[e.length-1]||di(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())}},hi=class i extends Kt{constructor(){super()}hasSelection(){return!1}shouldNotify(t){return!(t instanceof i||t instanceof ne)}select(t){return new ne(t)}contains(){return!1}lowerBound(t){return di(t)}display(t){return""}value(){return null}},ne=class i extends Kt{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 hi:new ci(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")}},ci=class i extends Kt{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 ne(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"))}},Qi=class i extends Kt{constructor(t,e){super(),this._preset=t,this._config=e}get _start(){let[t]=ts[this._preset](this._config);return this._config.min&&t.isBefore(this._config.min)?this._config.min:t}get _end(){let[,t]=ts[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 ne(t,this._config)}contains(t){return t.isBetween(this._start,this._end)}lowerBound(){return this._preset==="allTime"?v.today():this._start}upperBound(){return this._preset==="allTime"?v.today():v.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 di(i=null){return typeof i=="function"?i():i}var ts={today:()=>[v.today(),v.today()],yesterday:()=>{let i=v.today().incrementDays(-1);return[i,i]},thisWeek:i=>{let t=v.today().getCopy().incrementDays(i.startDay-v.today().getDayOfWeek()),e=t.incrementDays(6);return[t,e]},lastWeek:i=>{let t=v.today().incrementDays(i.startDay-(v.today().getDayOfWeek()+7)),e=t.incrementDays(6);return[t,e]},last7Days:()=>{let i=v.today();return[v.today().incrementDays(-6),i]},thisMonth:()=>{let i=v.fromParts(v.today().getYear(),v.today().getMonth(),1),t=v.fromParts(v.today().getYear(),v.today().getMonth(),v.today().getDaysInMonth());return[i,t]},lastMonth:()=>{let i=v.today().getMonth()-1,t=v.today().getYear();i<1&&(i+=12,t--);let e=v.fromParts(t,i,1),s=v.fromParts(t,i,e.getDaysInMonth());return[e,s]},thisQuarter:()=>{let t=Math.floor((v.today().getMonth()-1)/3)*3+1,e=t+2,s=v.fromParts(v.today().getYear(),t,1),r=v.fromParts(v.today().getYear(),e,1),a=v.fromParts(v.today().getYear(),e,r.getDaysInMonth());return[s,a]},lastQuarter:()=>{let t=Math.floor((v.today().getMonth()-4)/3)*3+1,e=t+2,s=v.today().getYear();t<1&&(t+=12,e+=12,s--);let r=v.fromParts(s,t,1),a=v.fromParts(s,e,1),n=v.fromParts(s,e,a.getDaysInMonth());return[r,n]},thisYear:()=>{let i=v.fromParts(v.today().getYear(),1,1),t=v.fromParts(v.today().getYear(),12,31);return[i,t]},lastYear:()=>{let i=v.today().getYear()-1,t=v.fromParts(i,1,1),e=v.fromParts(i,12,31);return[t,e]},last14Days:()=>{let i=v.today();return[v.today().incrementDays(-13),i]},last30Days:()=>{let i=v.today();return[v.today().incrementDays(-29),i]},last3Months:()=>{let i=v.today(),t=v.today().getDay()+1,e=v.today().getMonth()-3,s=v.today().getYear();return e<1&&(e+=12,s--),[v.fromParts(s,e,t),i]},last6Months:()=>{let i=v.today(),t=v.today().getDay()+1,e=v.today().getMonth()-6,s=v.today().getYear();return e<1&&(e+=12,s--),[v.fromParts(s,e,t),i]},yearToDate:()=>{let i=v.fromParts(v.today().getYear(),1,1),t=v.today();return[i,t]},tomorrow:()=>{let i=v.today().incrementDays(1);return[i,i]},nextWeek:i=>{let t=v.today().incrementDays(7+i.startDay-v.today().getDayOfWeek()),e=t.incrementDays(6);return[t,e]},next7Days:()=>{let i=v.today(),t=v.today().incrementDays(6);return[i,t]},nextMonth:()=>{let i=v.today().getMonth()+1,t=v.today().getYear();i>12&&(i-=12,t++);let e=v.fromParts(t,i,1),s=v.fromParts(t,i,e.getDaysInMonth());return[e,s]},nextQuarter:()=>{let t=(Math.floor((v.today().getMonth()-1)/3)+1)*3+1,e=v.today().getYear();t>12&&(t-=12,e++);let s=t+2;s>12&&(s-=12,e++);let r=v.fromParts(e,t,1),a=v.fromParts(e,s,1),n=v.fromParts(e,s,a.getDaysInMonth());return[r,n]},nextYear:()=>{let i=v.today().getYear()+1,t=v.fromParts(i,1,1),e=v.fromParts(i,12,31);return[t,e]},next14Days:()=>{let i=v.today(),t=v.today().incrementDays(13);return[i,t]},next30Days:()=>{let i=v.today(),t=v.today().incrementDays(29);return[i,t]},next3Months:()=>{let i=v.today(),t=v.today().getDay(),e=v.today().getMonth()+3,s=v.today().getYear();e>12&&(e-=12,s++);let r=v.fromParts(s,e,t).incrementDays(-1);return[i,r]},next6Months:()=>{let i=v.today(),t=v.today().getDay(),e=v.today().getMonth()+6,s=v.today().getYear();e>12&&(e-=12,s++);let r=v.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=v.today();return[t,e]}};var es=class{constructor(t,e,s,r){this.month=t,this.year=e,this.config=s,this.observable=r}generateOffsetState(t){return new rr(this,t)}canNavigatePrevious(){let[t,e]=new v(this.year,this.month).addMonths(-1).toParts();return!(this.config.min&&v.fromParts(t,e).isBefore(v.firstDayOfMonth(this.config.min)))}canNavigateNext(){let[t,e]=new v(this.year,this.month).addMonths(this.config.months).toParts();return!(this.config.max&&v.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($.VIEW_CHANGE))}setYear(t){if(!t)return;let e=this.month;this.isWithinMinAndMax(e,t)||(this.config.min&&v.fromParts(t,e).isBefore(v.firstDayOfMonth(this.config.min))?e=this.config.min.getMonth():this.config.max&&v.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($.VIEW_CHANGE)}setDate(t){t&&(this.isWithinMinAndMax(t.getMonth(),t.getYear())&&(this.month=t.getMonth(),this.year=t.getYear()),this.observable.notify($.VIEW_CHANGE))}isWithinMinAndMax(t,e){return!(this.config.min&&v.fromParts(e,t).isBefore(v.firstDayOfMonth(this.config.min))||this.config.max&&v.fromParts(e,t).isAfter(this.config.max))}adjustMonth(t){let[e,s]=new v(this.year,this.month).addMonths(t).toParts();this.config.min&&v.fromParts(e,s).isBefore(v.firstDayOfMonth(this.config.min))||this.config.max&&v.fromParts(e,s).isAfter(this.config.max)||([this.month,this.year]=[s,e],this.observable.notify($.VIEW_CHANGE))}},rr=class{constructor(t,e=0){this.offset=e,this.viewState=t}get month(){let[,t]=new v(this.viewState.year,this.viewState.month).addMonths(this.offset).toParts();return t}get year(){let[t]=new v(this.viewState.year,this.viewState.month).addMonths(this.offset).toParts();return t}};var is=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 ss=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($.VIEW_CHANGE)}reset(t){this.metadata=t,this.observable.notify($.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}
125details(t){return this.metadata[t.toIsoDateString()]?.details}variant(t){return this.metadata[t.toIsoDateString()]?.variant}unavailable(t){return!!this.metadata[t.toIsoDateString()]?.unavailable}};var ar=class extends P{boot(){let t=this.closest("ui-date-picker")||this;this.querySelectorAll("[data-appended]").forEach(o=>o.remove());let[e,s]=So(this,t);this.observable=new Ue;let r=t.hasAttribute("locale")?t.getAttribute("locale"):Mi();this.config={mode:t.getAttribute("mode")==="range"?ht.RANGE:t.hasAttribute("multiple")?ht.MULTIPLE:ht.SINGLE,months: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=o,this.observable.notify($.VIEW_CHANGE)}),this.selectable=Xi.createFromValueStringAttribute(t.getAttribute("value"),this.config,this.observable),this.metadata=new ss(this.observable),this.validator=new is(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(()=>v.today());if(this.viewState=new es(a.getMonth(),a.getYear(),this.config,this.observable),this._disableable=new R(this,{disableWithParent:!1}),!this.hasAttribute("static")){let{enable:o,disable:u}=Ao(this,this.selectable,this.viewState,this.validator);this._disableable.onInitAndChange(d=>{d?u():o()})}this._controllable=new z(this,{bubbles:!0}),this._submittable=new Q(this,{name:this.getAttribute("name"),value:this.selectable.getValue()});let n=K();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($.SELECTION,n(()=>{this.dispatchEvent(new Event("select",{bubbles:!1,cancelable:!0})),this._controllable.dispatch()})),this.observable.subscribe($.SELECTION,()=>{this._submittable.update(this.selectable.getValue())}),this.observable.subscribe($.SELECTION,()=>{this.anchorSelection(t)}),this.observable.subscribe($.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($.VIEW_CHANGE))})}).observe(t,{attributes:!0})}getOpenTo(t){if(!t.hasAttribute("open-to"))return;let e=t.getAttribute("open-to");return e=e==="today"?v.today():v.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(v.today()))}appendMetadata(t){this.metadata.append(t)}resetMetadata(t={}){this.metadata.reset(t)}visibleDateRange(){return[v.fromParts(this.viewState.year,this.viewState.month,1).toIsoDateString(),v.fromParts(this.viewState.year,this.viewState.month+1,0).toIsoDateString()]}getUnavailableDates(t){return t.hasAttribute("unavailable")?t.getAttribute("unavailable").split(",").map(e=>v.fromIsoDateString(e.trim())):[]}getMinDate(t){return t.hasAttribute("min")?t.getAttribute("min")==="today"?v.today():v.fromIsoDateString(t.getAttribute("min")):null}getMaxDate(t){return t.hasAttribute("max")?t.getAttribute("max")==="today"?v.today():v.fromIsoDateString(t.getAttribute("max")):null}}
125,nr=class extends P{boot(){let t=this.closest("ui-calendar");this._disableable=t._disableable,Jt(this,()=>this._disableable.isDisabled(),()=>t.navigatePrevious());let e=()=>{t.viewState.canNavigatePrevious()&&!this._disableable.isDisabled()?x(this,"disabled"):h(this,"disabled","")};t.observable.subscribe($.VIEW_CHANGE,e),this._disableable.onInitAndChange(()=>{e()})}},lr=class extends P{boot(){let t=this.closest("ui-calendar");this._disableable=t._disableable,Jt(this,()=>this._disableable.isDisabled(),()=>t.navigateNext());let e=()=>{t.viewState.canNavigateNext()&&!this._disableable.isDisabled()?x(this,"disabled"):h(this,"disabled","")};t.observable.subscribe($.VIEW_CHANGE,e),this._disableable.onInitAndChange(()=>{e()})}},or=class extends P{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($.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 v(this.offsetState.year,this.offsetState.month).getDate());r(),this.viewState.observable.subscribe($.VIEW_CHANGE,()=>r())}}renderSelectOptions(t,e){let r=Array.from({length:12},(a,n)=>n+1).map(a=>{let n=new v(this.viewState.year,a),l=new v(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 v(2024,a).getDate())}}).filter(Boolean);ot(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 v(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})})}},ur=class extends P{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($.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 v(this.offsetState.year,this.offsetState.month).getDate());s(),this.viewState.observable.subscribe($.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 v(a,1),l=new v(a,12,31);return this.config.min&&l.isBefore(this.config.min)||this.config.max&&n.isAfter(this.config.max)?null:a}
125).filter(Boolean);ot(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}}))})}},hr=class extends P{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=>xn(a,this.config,a.offsetState,this.metadata)),s=()=>this.monthEls.forEach(a=>An(a,this._disableable.isDisabled(),this.config,a.offsetState,this.selectable,this.validator));e(),s();let r=this.config.months;this.viewState.observable.subscribe($.VIEW_CHANGE,()=>{r!==this.config.months&&(r=this.config.months,this.renderMonths()),e(),s()}),this.observable.subscribe([$.SELECTION,$.ACTIVATION],()=>{s()}),this._disableable.onChange(()=>s())}renderMonths(){let t=this.querySelector('template:not([name]), template[name="month"]');ot(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})}},cr=class extends P{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"),Jt(this,()=>this._disableable.isDisabled(),()=>this.navigateAndSelectToday()),this._disableable.onInitAndChange(s=>{s?h(this,"disabled",""):x(this,"disabled")});let e=this.querySelector("template");e&&ot(e,s=>s({slots:{default:v.today().getDay()}}))}navigateAndSelectToday(){let t=this.closest("ui-calendar, ui-date-picker"),e=()=>{let r=t.viewState,a=v.today();return r.year===a.getYear()&&r.month===a.getMonth()};(this.behavior==="select"||this.behavior==="auto"&&e())&&(t.config.mode===ht.RANGE?t.selectable.setValue({start:v.today().toIsoDateString(),end:v.today().toIsoDateString()}):t.config.mode===ht.MULTIPLE?t.selectable.setValue([v.today().toIsoDateString()]):t.selectable.setValue(v.today().toIsoDateString())),t.viewState.setMonth(v.today().getMonth()),t.viewState.setYear(v.today().getYear())}},dr=class extends P{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!==ht.RANGE)throw"Presets can only be used with range calendars";let e=this.firstElementChild;if(e){let s=r=>{if(e._selectable instanceof ct){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($.SELECTION,()=>{let r=this.selectable.getValue();e.value=r?.preset||"custom"}),this._disableable.onInitAndChange(r=>{r?h(e,"disabled",""):x(e,"disabled")})}}},fr=class extends P{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.querySelector("ui-date-picker-trigger"))return;let[e,s]=this.querySelectorAll("input");this.config.mode===ht.RANGE?mr(e,s,t):br(e,t)}};D("calendar",ar);D("calendar-today",cr);D("calendar-presets",dr);D("calendar-previous",nr);D("calendar-inputs",fr);D("calendar-next",lr);D("calendar-months",hr);D("calendar-month",or);D("calendar-year",ur);function Ao(i,t,e,s){let r=!1,a=i.hasAttribute("readonly");return m(i,"click",n=>{if(r||a)return;let l=n.target.closest("[data-date]");if(!l)return;let o=He(l);s.isValid(o)&&t.select(o)}),m(i,"mouseover",n=>{if(r||a)return;let l=n.target.closest("[data-date]");if(!l)return;let o=He(l);s.isValid(o)&&t.activate(o)}),m(i,"mouseout",()=>{r||a||t.activate(null)}
125),m(i,"focusin",n=>{if(r||a)return;let l=n.target.closest("[data-date]");if(!l)return;let o=He(l);s.isValid(o)&&t.activate(o)}),m(i,"keydown",n=>{if(r)return;let l=n.target.closest("[data-date]");if(!l)return;let o=!0,u,d=He(l),c=p=>{let b=d.getCopy(),f=Math.sign(p),g=366;for(b.setDay(b.getDay()+p);!s.isValid(b)&&g>0;)b.setDay(b.getDay()+f),g--;d=b};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 p=Array.from(i.querySelectorAll("[data-date]")).find(b=>He(b).isSameDay(d));!p&&u&&(u==="forward"?e.nextMonth():e.previousMonth(),p=Array.from(i.querySelectorAll("[data-date]")).find(b=>He(b).isSameDay(d))),p?.querySelector("button,ui-button")?.focus()}}),{enable(){r=!1},disable(){r=!0}}}function He(i){return!i||!i.hasAttribute("data-date")?null:v.fromIsoDateString(i.getAttribute("data-date"))}function So(i,t){let e=parseInt(t.getAttribute("sm:months")||t.getAttribute("months")||1),s,r=matchMedia("(min-width: 640px)"),a=()=>s?.(r.matches?e:1);return r.addEventListener("change",a),i.onUnmount(()=>r.removeEventListener("change",a)),[r.matches?e:1,n=>s=n]}function br(i,t){pr(i);let e=K(),s=e(()=>{let r=t.selectable.getValue();i.value=r||""});t.observable.subscribe($.SELECTION,s),s(),i.addEventListener("change",e(()=>{let r=i.valueAsDate;r?(t.selectable.setValue(v.fromLocalDate(r).toIsoDateString()),t.viewState.setDate(v.fromLocalDate(r))):t.selectable.setValue("")}))}function mr(i,t,e){pr(i),pr(t);let s=K(),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:v.fromLocalDate(n).toIsoDateString(),end:v.fromLocalDate(l).toIsoDateString()}):n?e.selectable.setValue({start:v.fromLocalDate(n).toIsoDateString(),end:null}):e.selectable.setValue({start:null,end:null})});e.observable.subscribe($.SELECTION,r),r(),i.addEventListener("change",a),t.addEventListener("change",a)}function pr(i){m(i,"change",t=>t.stopPropagation()),m(i,"input",t=>t.stopPropagation())}var rs=class extends Z{boot(){this.picker=this.closest("ui-date-picker"),this._disableable=new R(this);let t=l=>{l.preventDefault(),l.stopImmediatePropagation()};if(this._disableable.onInitAndChange(l=>{l?this.addEventListener("click",t,!0):this.removeEventListener("click",t,!0)}),this.dayInput=this.querySelector("[data-flux-day-input]"),this.monthInput=this.querySelector("[data-flux-month-input]"),this.yearInput=this.querySelector("[data-flux-year-input]"),!this.dayInput||!this.monthInput||!this.yearInput)return;let e=this.picker?.getAttribute("locale")||navigator.language,{order:s,separator:r,placeholders:a}=ko(e);this.dayInput.setAttribute("placeholder",a.day),this.monthInput.setAttribute("placeholder",a.month),this.yearInput.setAttribute("placeholder",a.year),this.inputs=s.map(l=>{if(l==="day")return this.dayInput;if(l==="month")return this.monthInput;if(l==="year")return this.yearInput});let n=this.querySelector("[data-flux-date-inputs]");if(n){for(;n.firstChild;)n.removeChild(n.firstChild);this.inputs.forEach((l,o)=>{if(n.appendChild(l),o<this.inputs.length-1){let u=document.createElement("span");u.textContent=` ${r} `,u.style.userSelect="none",n.appendChild(u)}})}this._disableable.onInitAndChange(l=>{l?(this.dayInput.setAttribute("disabled",""),this.monthInput.setAttribute("disabled",""),this.yearInput.setAttribute("disabled","")):(this.dayInput.removeAttribute("disabled"),this.monthInput.removeAttribute("disabled"),this.yearInput.removeAttribute("disabled"))}),this.clearInputs(),gr(this.dayInput),gr(this.monthInput),gr(this.yearInput),_o(this.inputs,(l,o)=>{this.processInputValue(l,o,s)}),this.inputs.forEach((l,o)=>{l.addEventListener("keydown",u=>{if(u.key==="ArrowRight"&&o<this.inputs.length-1)return this.inputs[o+1].focus();if(u.key==="ArrowLeft"&&o>0)return this.inputs[o-1].focus();u.key===" "&&!this.hasAttribute("data-bare")&&(u.preventDefault(),this.picker?._dialogable?.toggle(
125))})}),vr(this.dayInput),vr(this.monthInput),vr(this.yearInput),this.initTwoDigitInputListeners(this.dayInput,{max:()=>this.maxDay(),advanceThreshold:3,handleSecondDigit:(l,o)=>{if(l===3&&o<=1)return`${l}${o}`;if(l<=2){let u=`${l}${o}`;return u==="00"?"01":u}return null}}),this.initTwoDigitInputListeners(this.monthInput,{max:12,advanceThreshold:1,handleSecondDigit:(l,o)=>l===1&&o<=2?`${l}${o}`:l===0?o===0?"01":`0${o}`:null,onValueChange:()=>this.clampDay()}),this.initYearInputListeners()}connectToPicker(t,e=null){this.picker=t,this.rangeRole=e,queueMicrotask(()=>{let s=this.picker.getAttribute("aria-labelledby"),r=this.getAttribute("aria-labelledby");s&&r&&s!==r&&h(this,"aria-labelledby",`${s} ${r}`)}),this.picker.observable.subscribe($.SELECTION,()=>{this.updateInputsFromSelectable(this.picker.selectable)}),this.updateInputsFromSelectable(this.picker.selectable),this.addEventListener("mousedown",s=>{s.target.closest("input")||s.preventDefault()}),this.hasAttribute("data-bare")||this.addEventListener("click",()=>{this.picker._dialogable.toggle()})}focus(){if(this.inputs?.length)return this.inputs[0].focus();this.querySelector("button,ui-button")?.focus()}processDate(){let t=this.dayInput.value,e=this.monthInput.value,s=this.yearInput.value;if(t===""||e===""||s==="")return;let r=parseInt(t),a=parseInt(e),n=parseInt(s);if(isNaN(r)||isNaN(a)||isNaN(n)||a<1||a>12||r<1||n<100)return;let l=new Date(n,a,0).getDate();r>l&&(r=l,this.dayInput.value=r.toString().padStart(2,"0"));let o=`${n.toString().padStart(4,"0")}-${a.toString().padStart(2,"0")}-${r.toString().padStart(2,"0")}`;if(this.rangeRole){this.picker._rangeTriggerDates=this.picker._rangeTriggerDates||{start:null,end:null},this.picker._rangeTriggerDates[this.rangeRole]=o;let{start:u,end:d}=this.picker._rangeTriggerDates;u&&d?this.picker.selectable.setValue({start:u,end:d}):u?this.picker.selectable.setValue({start:u,end:null}):this.picker.selectable.setValue({start:null,end:null})}else this.picker.selectable.setValue(o);this.picker.viewState.setDate(v.fromIsoDateString(o))}updateInputsFromSelectable(t){let e=t.getValue();if(this.rangeRole&&e&&typeof e=="object"){this.picker._rangeTriggerDates=this.picker._rangeTriggerDates||{start:null,end:null},this.picker._rangeTriggerDates[this.rangeRole]=e[this.rangeRole]||null,this.updateInputs(e[this.rangeRole]||null);return}this.updateInputs(e)}updateInputs(t){if(!t)return this.clearInputs();x(this.picker,"data-empty");let[e,s,r]=t.split("T")[0].split("-");this.dayInput.value=r.padStart(2,"0"),this.dayInput.style.color="",this.dayInput.classList.remove("font-mono"),this.monthInput.value=s.padStart(2,"0"),this.monthInput.style.color="",this.monthInput.classList.remove("font-mono"),this.yearInput.value=e.padStart(4,"0"),this.yearInput.style.color="",this.yearInput.classList.remove("font-mono")}clearInputs(){this.dayInput.value="",this.dayInput.style.color="",this.dayInput.classList.add("font-mono"),this.monthInput.value="",this.monthInput.style.color="",this.monthInput.classList.add("font-mono"),this.yearInput.value="",this.yearInput.style.color="",this.yearInput.classList.add("font-mono");let t=this.inputs.find(e=>e===document.activeElement);t&&yt(t),h(this.picker,"data-empty","")}maxDay(){let t=parseInt(this.monthInput.value),e=parseInt(this.yearInput.value);return isNaN(t)||t<1||t>12?31:((isNaN(e)||e<1)&&(e=2e3),new Date(e,t,0).getDate())}clampDay(){let t=parseInt(this.dayInput.value);if(isNaN(t))return;let e=this.maxDay();t>e&&(this.dayInput.value=e.toString().padStart(2,"0"))}expandTwoDigitYear(t){let e=v.today().getYear()+20,r=Math.floor(e/100)*100+t;return r>e?r-100:r}initTwoDigitInputListeners(t,{max:e,advanceThreshold:s,handleSecondDigit:r,onValueChange:a}){let n=!1;t.addEventListener("keydown",o=>{if(o.key==="Backspace"){if(t.value===""||t.value===t.placeholder){let c=this.inputs.indexOf(t);c>0&&this.inputs[c-1].focus();return}t.value="",yt(t);return}if(!["ArrowUp","ArrowDown"].includes(o.key))return;o.preventDefault(),o.stopPropagation();let u=parseInt(t.value),d=typeof e=="function"?e():e;o.key==="ArrowUp"?isNaN(u)||u>=d?u=1:u++:o.key==="ArrowDown"&&(isNaN(u)||u===1?u=d:u--),t.value=u.toString().padStart(2,"0"),t.style.color="",t.classList.remove("font-mono"),a?.(),this.processDate(),yt(t)});let l=this.inputs[this.inputs.indexOf(t)+1];t.addEventListener("keydown",o=>{if(!/[0-9]/.test(o.key))return;let u=parseInt(o.key);if(t.value===""||!n){n=!0,t.value=`0${u}`,a?.(),u>s?l?.focus():yt(t);return}let d=parseInt(t.value),c=r(d,u);if(c){t.value=c,a?.(),l?.focus();return}t.value=`0${u}`,a?.(),u>s?l?.focus():yt(t)}),t.addEventListener("blur",()=>{n=!1,t.value==="00"&&(t.value="01"),a?.(),this.processDate()})}initYearInputListeners(){let t="";this.yearInput.addEventListener("keydown",s=>{if(s.key==="Backspace"){if(t="",this.yearInput.value===""||this.yearInput.value===this.yearInput.placeholder){let a=this.inputs.indexOf(this.yearInput);a>0&&this.inputs[a-1].focus();return}this.yearInput.value="",yt(this.yearInput);return}if(!["ArrowUp","ArrowDown"].includes(s.key))return;s.preventDefault(),s.stopPropagation();let r=parseInt(this.yearInput.value);s.key==="ArrowUp"?isNaN(r)?r=new Date().getFullYear():r++:s.key==="ArrowDown"&&(isNaN(r)?r=new Date().getFullYear():r>1&&r--),this.yearInput.value=r.toString().padStart(4,"0"),this.yearInput.style.color="",this.yearInput.classList.remove("font-mono"),t="",this.clampDay(),this.processDate(),yt(this.yearInput)});let e=this.inputs[this.inputs.indexOf(this.yearInput)+1];this.yearInput.addEventListener("keydown",s=>{if(!/[0-9]/.test(s.key))return;let r=parseInt(s.key);if(t+=r.toString(),t.length>=4){this.yearInput.value=t.slice(-4)==="0000"?"0001":t.slice(-4),t="",this.clampDay(),this.processDate(),e?e.focus():yt(this.yearInput);return}this.yearInput.value=t.padStart(4,"0"),yt(this.yearInput)}),this.yearInput.addEventListener("blur",()=>{t.length>0&&t.length<=2?this.yearInput.value=this.expandTwoDigitYear(parseInt(t)).toString():t.length>0&&(this.yearInput.value=t.padStart(4,"0")),t="",this.yearInput.value==="0000"&&(this.yearInput.value="0001"),this.clampDay(),this.processDate()})}processInputValue(t,e,s){let r=t.value,a=Eo(r,s);if(!a){if(!this.isValidInputValue(t,r)){t.value=e,yt(t);return}if(r!==""){let l=t===this.yearInput?4:2,o=parseInt(r);t===this.yearInput&&r.length<=2&&(o=this.expandTwoDigitYear(o)),t.value=o.toString().padStart(l,"0"),t.style.color="",t.classList.remove("font-mono")}this.clampDay(),this.processDate();return}this.dayInput.value=a.day.toString().padStart(2,"0"),this.monthInput.value=a.month.toString().padStart(2,"0"),this.yearInput.value=a.year.toString().padStart(4,"0"),this.processDate();let n=this.inputs.at(-1);n.focus(),yt(n)}isValidInputValue(t,e){if(e==="")return!0;
125if(!/^\d+$/.test(e))return!1;let s=parseInt(e);return t===this.dayInput?e.length<=2&&s>=1&&s<=31:t===this.monthInput?e.length<=2&&s>=1&&s<=12:t===this.yearInput?e.length<=4:!1}};function Eo(i,t){let e=i.trim().match(/^(\d{4})-(\d{2})-(\d{2})$/);if(e)return{year:parseInt(e[1]),month:parseInt(e[2]),day:parseInt(e[3])};let s=i.trim().split(/\D+/);if(s.at(-1)===""&&s.pop(),s.length!==t.length||s.some(a=>!/^\d+$/.test(a)))return null;let r={};return t.forEach((a,n)=>{r[a]=parseInt(s[n])}),r}function ko(i){try{let e=new Intl.DateTimeFormat(i,{year:"numeric",month:"2-digit",day:"2-digit"}).formatToParts(new Date(2024,2,15)),s=e.filter(l=>["day","month","year"].includes(l.type)).map(l=>l.type),a=e.find(l=>l.type==="literal")?.value?.trim()||"/",n={day:"dd",month:"mm",year:"yyyy"};return e.forEach(l=>{l.type==="day"&&(n.day=l.value.replace(/\d/g,"d")),l.type==="month"&&(n.month=l.value.replace(/\d/g,"m")),l.type==="year"&&(n.year=l.value.replace(/\d/g,"y"))}),{order:s,separator:a,placeholders:n}}catch{return{order:["day","month","year"],separator:"/",placeholders:{day:"dd",month:"mm",year:"yyyy"}}}}function _o(i,t){i.forEach(e=>{let s=e.value;e.addEventListener("focus",()=>{s=e.value}),e.addEventListener("beforeinput",()=>{s=e.value}),e.addEventListener("input",r=>{r.stopPropagation(),t(e,s),s=e.value})})}function gr(i){i.addEventListener("focus",()=>{yt(i)}),i.addEventListener("blur",()=>{Sn(i)}),i.addEventListener("mousedown",t=>{t.preventDefault(),i.focus(),yt(i)}),i.addEventListener("mouseup",t=>{t.preventDefault(),yt(i)})}function vr(i){i.addEventListener("keydown",t=>{/[0-9]/.test(t.key)&&(Sn(i),i.classList.remove("font-mono")),!(t.ctrlKey||t.metaKey||t.altKey)&&(["Tab"].includes(t.key)||t.preventDefault())})}function yt(i){!i.value&&i.placeholder&&(i.style.color=getComputedStyle(i,"::placeholder").color,i.value=i.placeholder,i.classList.add("font-mono")),i.setSelectionRange(0,i.value.length)}function Sn(i){i.value===i.placeholder&&(i.value="",i.style.color="")}var wr=class extends Z{bootWithCalendar(t){let e=t.config.mode===ht.RANGE;this.calendar=t,this._disableable=new R(this),this._disableable.onInitAndChange(b=>{this.calendar.disabled=b}),this.observable=new Ue,this.selectable=new Zi(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.hasAttribute("dropdown")&&this.getAttribute("dropdown")==="false"),r=this.querySelector("dialog");if(!r)return;let a=Array.from(this.querySelectorAll("ui-date-picker-trigger")).filter(b=>!r?.contains(b)),n=a[0]||null,l=a[1]||null,o=n?null:this.querySelector("input");o=r?.contains(o)?null:o;let u=n?null:Array.from(this.querySelectorAll("input")).find(b=>b!==o);u=r?.contains(u)?null:u,n||(o&&o.addEventListener("click",b=>b.preventDefault()),u&&u.addEventListener("click",b=>b.preventDefault()));let d=this.querySelector("button,ui-button");d=r?.contains(d)?null:d;let c=X(this.calendar,"calendar");if(this.triggerEl=n||o||d,!this.triggerEl)return;if(n?h(this.triggerEl,"role","group"):h(this.triggerEl,"role","combobox"),h(this.triggerEl,"aria-controls",c),this._disableable.onInitAndChange(b=>{b?h(this.triggerEl,"disabled",""):x(this.triggerEl,"disabled")}),s){this._dialogable=new Qt(r,{clickOutside:!this.hasAttribute("disable-click-outside"),triggers:n?[d].filter(Boolean):[d,o,u].filter(Boolean)}),this._closeable=new kt(this),this._closeable.onClose(()=>this._dialogable.hide()),this._anchorable=new tt(r,{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}),Oa()&&!n&&(o&&this.showIOSOverlay(o),u&&this.showIOSOverlay(u)),this.querySelectorAll("button,ui-button").forEach(f=>{f!==this.triggerEl&&(r.contains(f)||(h(f,"aria-controls",c),h(f,"aria-haspopup","combobox"),En(f,this._dialogable),m(f,"click",()=>this._dialogable.toggle())))}),Co(this,this.triggerEl,r,this._dialogable,this._anchorable),n||En(this.triggerEl,this._dialogable),To(this,this._dialogable),n||Io(this.triggerEl,this._dialogable),Lo(this,this.calendar.config.mode,this.observable,this.selectable,this._dialogable);let b=Array.from(r.querySelectorAll("ui-date-picker-trigger[data-bare]"));b.length===2&&e?(b[0].connectToPicker(this,"start"),b[1].connectToPicker(this,"end")):b.length===1&&b[0].connectToPicker(this)}if(n&&l&&e)n.connectToPicker(this,"start"),l.connectToPicker(this,"end");else if(n)n.connectToPicker(this);else if(e&&r&&o&&u)yr(o),yr(u),mr(o,u,this);else if(r&&o){let b=o;yr(b),br(b,this)}else r&&Do(d,this._dialogable);this._controllable=new z(this,{bubbles:!0}),this.calendar.addEventListener("change",b=>b.stopPropagation()),this.calendar.addEventListener("input",b=>b.stopPropagation()),this._submittable=new Q(this,{name:this.getAttribute("name"),value:this.selectable.getValue()});let p=K();this._controllable.initial(b=>b&&this.selectable.setValue(b)),this._controllable.getter(()=>this.selectable.getValue()),this._controllable.setter(p(b=>this.selectable.setValue(b))),this.observable.subscribe($.SELECTION,p(()=>{this.dispatchEvent(new Event("select",{bubbles:!1,cancelable:!0})),this._controllable.dispatch()})),this.observable.subscribe($.SELECTION,()=>{this._submittable.update(this.selectable.getValue())}),this.observable.subscribe($.VIEW_CHANGE,()=>{this.dispatchEvent(new Event("navigate",{bubbles:!1,cancelable:!0}))})}unmount(){if(this._dialogable?.getState()){let{unlock:t}=lt();t()}}showIOSOverlay(t){let e=document.createElement("button");e.setAttribute("data-flux-ios-overlay",""),e.setAttribute("data-appended",""),e.classList.add("absolute","
125inset-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}},xr=class extends P{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($.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}=ot(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}=ot(this.templates.placeholder,s=>s({slots:{}}));this.templates.placeholder.clearPlaceholder=e}}},Ar=class extends P{bootWithCalendar(){this.picker=this.closest("ui-date-picker"),this.picker.selectable.blockSyncIf(()=>this.getBoundingClientRect().width>0),Jt(this,()=>this.picker._disableable.isDisabled(),()=>{this.picker.selectable.sync(),this.picker._dialogable.setState(!1)})}};D("date-picker",wr);D("date-picker-select",Ar);D("selected-date",xr);D("date-picker-trigger",rs);Ke(({css:i})=>i`
126/* For Chrome, Safari, Edge */
127ui-date-picker input[type="date"]::-webkit-calendar-picker-indicator {
128    display: none;
129    -webkit-appearance: none;
130}
131`);function En(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 Co(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 Io(i,t){m(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 Do(i,t){m(i,"click",()=>{t.setState(!t.getState())})}function yr(i){m(i,"focus",()=>i.select())}function To(i,t){let{lock:e,unlock:s}=lt(t.el);t.onChange(()=>{t.getState()?e():s()})}function Lo(i,t,e,s,r){let a=t!==ht.MULTIPLE;if(i.hasAttribute("close")){let n=i.getAttribute("close");a=n.split(" ").includes("auto"),n==="manual"&&(a=!1)}a&&e.subscribe($.SELECTION,()=>{s.hasSelection()&&r.setState(!1)})}var Sr=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=>
131{this._inputEl.value=r,this.state.onChanges.forEach(a=>a(this.state.getValue()))},onChange:r=>{this.state.onChanges.push(r)}},this._controllable=new z(this),this._disableable=new R(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"))}),m(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(),m(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()}),m(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(()=>{bt(s,"disabled")}))}),()=>{t.forEach(s=>s()),t=[]}}};D("composer",Sr);var Er=class extends P{boot(){this._controllable=new z(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)}};D("progress",Er);var kr=class extends P{boot(){let t=this.trigger(),e=this.overlay();this._disabled=this.hasAttribute("disabled"),this._popoverable=new nt(e);let s={getBoundingClientRect:()=>({x:0,y:0,width:0,height:0,top:0,left:0,right:0,bottom:0})};this._anchorable=new tt(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}=lt(this._popoverable.el);this._popoverable.onChange(()=>{this._popoverable.getState()?r():a()}),m(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}=lt();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}};D("context",kr);var Mt=class extends Nt{groupOfType=at;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=>Ta(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(at).tabbable(),e?.use(at).focus()}moveFocus(t){let e=this.walker().find(r=>r.use(at).isTabbable());t(e)?.use(at).focus()}ensureTabbable(){this.walker().findOrFirst(t=>{t.use(at).isTabbable()})?.use(at).tabbable()}wipeTabbables(){this.walker().each(t=>{t.use(at).untabbable()})}untabbleOthers(t){this.walker().each(e=>{e!==t&&e.use(at).untabbable()})}walker(){return it(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()})}},at=class extends J{groupedByType=Mt;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(()=>{ce()&&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"}};
131var fi=class i extends P{boot(){if(this._focusable=new Mt(this,{wrap:!1,ensureTabbable:!1}),m(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())}),Li(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;m(t.trigger(),"keydown",e=>{e.key==="ArrowDown"?(this.fromArrowDown=!0,this.showPopover(),e.preventDefault(),e.stopPropagation()):t.hasAttribute("data-flux-sidebar-group-dropdown")&&["Enter"," "].includes(e.key)&&(this.fromCollapsedSidebarGroupTrigger=!this.matches(":popover-open"))})}h(this,"role","menu"),h(this,"tabindex","-1")}mount(){this.initializeMenuItems(),new MutationObserver(e=>{this.initializeMenuItems()}).observe(this,{childList:!0,subtree:!0})}onPopoverShow(){requestAnimationFrame(()=>{let t=this._openedViaHover;this._openedViaHover=!1,!t&&(this.fromArrowDown||this.fromCollapsedSidebarGroupTrigger?(this._focusable.focusFirst(),this.fromArrowDown=!1,this.fromCollapsedSidebarGroupTrigger=!1):this.focus())})}onPopoverHide(){this._focusable.wipeTabbables()}initializeMenuItems(){this.walker().each(t=>{t._disableable||Mo(t)})}walker(){return it(this,(t,{skip:e,reject:s})=>{if(t instanceof i||t instanceof Ae)return s();if(!["a","button"].includes(t.localName))return e()})}},_r=class extends P{boot(){}},Cr=class extends P{boot(){let t=this;this._disableable=new R(this),this._disableable.onInitAndChange(s=>{s?h(t,"aria-disabled","true"):x(t,"aria-disabled")}),X(t,"menu-checkbox"),h(t,"role","menuitemcheckbox"),t._focusable=new at(t,{disableable:this._disableable,hover:!0,tabbableAttr:"data-active"}),t._selectable=new G(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 z(this),this._controllable.initial(s=>s&&t._selectable.setState(s)),this._controllable.getter(()=>t._selectable.getState());let e=K();this._controllable.setter(e(s=>{this._selectable.setState(s)})),this._selectable.onChange(e(()=>{this._controllable.dispatch()})),m(t,"click",this._disableable.enabled(()=>{this.hasAttribute("keep-open")||this.dispatchEvent(new CustomEvent("lofi-close-popovers",{bubbles:!0})),t._selectable.press()})),Lr(t)}},Ir=class extends P{boot(){let t=this;this._disableable=new R(this),this._disableable.onInitAndChange(e=>{e?h(t,"aria-disabled","true"):x(t,"aria-disabled")}),X(t,"menu-radio"),h(t,"role","menuitemradio"),t._focusable=new at(t,{disableable:this._disableable,hover:!0,tabbableAttr:"data-active"}),t._selectable=new G(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")}),m(t,"click",this._disableable.enabled(()=>{this.hasAttribute("keep-open")||this.dispatchEvent(new CustomEvent("lofi-close-popovers",{bubbles:!0})),t._selectable.press()})),Lr(t)}},Dr=class extends P{boot(){this._selectable=new ct(this),this._controllable=new z(this),h(this,"role","group"),this._controllable.initial(e=>e&&this._selectable.setState(e)),this._controllable.getter(()=>this._selectable.getState());let t=K();this._controllable.setter(t(e=>{this._selectable.setState(e)})),this._selectable.onChange(t(()=>{this._controllable.dispatch()})),m(this,"lofi-close-popovers",e=>{this.hasAttribute("keep-open")&&(e.preventDefault(),e.stopPropagation())})}},Tr=class extends P{boot(){this._selectable=new ct(this,{multiple:!0}),this._controllable=new z(this),h(this,"role","group"),this._controllable.initial(e=>e&&this._selectable.setState(e)),this._controllable.getter(()=>this._selectable.getState());let t=K();this._controllable.setter(t(e=>{this._selectable.setState(e)})),this._selectable.onChange(t(()=>{this._controllable.dispatch()}))}};D("menu",fi);D("submenu",_r);D("menu-checkbox",Cr);D("menu-radio",Ir);D("menu-radio-group",Dr);D("menu-checkbox-group",Tr);function Lr(i){m(i,"keydown",t=>{t.key==="Enter"&&(i.click(),t.preventDefault(),t.stopPropagation())}),m(i,"keydown",t=>{t.key===" "&&(t.preventDefault(),t.stopPropagation())}),m(i,"keyup",t=>{t.key===" "&&(i.click(),t.preventDefault(),t.stopPropagation())})}function Mo(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 R(i),i._disableable.onInitAndChange(a=>{a?h(r,"aria-disabled","true"):x(r,"aria-disabled")}),X(r,"menu-item"),h(r,"role","menuitem"),r._focusable=new at(r,{disableable:i._disableable,hover:!0,tabbableAttr:"data-active"}),s){s._popoverable=new nt(s,{triggers:[e]}),s._anchorable=new tt(s,{reference:e,position:s.hasAttribute("position")?s.getAttribute("position"):ut(s)?"left start":"right start",ga
131p:s.hasAttribute("gap")?s.getAttribute("gap"):"-5",crossAxis:!0}),e.addEventListener("click",i._disableable.enabled(n=>{s._popoverable.setState(!0)}));let{clear:a}=Me(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()}),m(e,"keydown",n=>{n.key==="Enter"&&(s._popoverable.setState(!0),setTimeout(()=>s._focusable.focusFirst()))}),m(e,"keydown",n=>{n.key==="ArrowRight"&&(s._popoverable.setState(!0),setTimeout(()=>s._focusable.focusFirst()))}),m(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}}))});m(i,"mouseup",a),m(i,"click",n=>!n.isTrusted&&a()),Lr(e)}}var Mr=class i extends P{mount(){this._focusable=new Mt(this,{wrap:!0}),this._disableable=new R(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(()=>{bt(s,"disabled"),bt(s,"aria-disabled")}))})):(bt(this,"aria-disabled"),t.forEach(s=>s()),t=[])}),m(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||Po(t)})}walker(){return it(this,(t,{skip:e,reject:s})=>{if(t instanceof i||t.hasAttribute("popover")||t instanceof fi||t instanceof ai)return s();if(!["a","button"].includes(t.localName))return e()})}};D("toolbar",Mr);function Po(i){i._disableable=new R(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 at(s,{disableable:i._disableable}))}var Pr=class extends P{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 nt(s,{scope:"tooltip"}),s._anchorable=new tt(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 R(this);let r;this._disableable.onInitAndChange(u=>{r&&(r(),r=null),u||(r=Me(this,s,{gain(){s._popoverable.setState(!0)},lose(){s._popoverable.setState(!1)},focusable:!0,useSafeArea:!1}).remove)}),this.onUnmount(()=>{r&&(r(),r=null)}),new MutationObserver(()=>{this.getAttribute("draggable")==="true"&&s._popoverable.setState(!1)}).observe(this,{attributeFilter:["draggable"]});let n=X(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}};D("tooltip",Pr);var rt={STATE_CHANGED:"stateChanged",DESKTOP_COLLAPSED:"desktopCollapsed",DESKTOP_EXPANDED:"desktopExpanded",MOBILE_COLLAPSED:"mobileCollapsed",MOBILE_EXPANDED:"mobileExpanded",VIEWPORT_ENTER_MOBILE:"viewportEnterMobile",VIEWPORT_ENTER_DESKTOP:"viewportEnterDesktop"}
131,Or=class extends P{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 Zt,this.state={active:!1,viewportDesktop:!0,viewportMobile:!1,collapsedMobile:!0,collapsedDesktop:!1},this.config.sticky&&this.setStickyPositionStyles(),this.hasAttribute("collapsible")){let r=this.getAttribute("collapsible");r==="true"?this.config.collapsible=!0:r==="false"?this.config.collapsible=!1:r==="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(rt.VIEWPORT_ENTER_DESKTOP,()=>{let r=ks(this,"transition","none");setTimeout(r),this.state.viewportDesktop=!0,this.state.viewportMobile=!1,this.observable.notify(rt.STATE_CHANGED)}),this.observable.subscribe(rt.VIEWPORT_ENTER_MOBILE,()=>{let r=ks(this,"transition","none");setTimeout(r),this.state.viewportDesktop=!1,this.state.viewportMobile=!0,this.observable.notify(rt.STATE_CHANGED)}),this.observable.subscribe(rt.DESKTOP_COLLAPSED,()=>{this.state.collapsedDesktop=!0,this.observable.notify(rt.STATE_CHANGED)}),this.observable.subscribe(rt.DESKTOP_EXPANDED,()=>{this.state.collapsedDesktop=!1,this.observable.notify(rt.STATE_CHANGED)}),this.observable.subscribe(rt.MOBILE_COLLAPSED,()=>{this.state.collapsedMobile=!0,this.observable.notify(rt.STATE_CHANGED)}),this.observable.subscribe(rt.MOBILE_EXPANDED,()=>{this.state.collapsedMobile=!1,this.observable.notify(rt.STATE_CHANGED)}),this.observable.subscribe(rt.STATE_CHANGED,()=>{this.config.persist&&localStorage.setItem("flux-sidebar-collapsed-desktop",JSON.stringify(this.state.collapsedDesktop)),this.updateDataAttributes(this)});let t=new Nr(this.observable,this.config);this.onUnmount(()=>t.disconnect());let e=()=>{this.state.viewportDesktop?this.state.collapsedDesktop?this.observable.notify(rt.DESKTOP_EXPANDED):this.observable.notify(rt.DESKTOP_COLLAPSED):this.state.collapsedMobile?this.observable.notify(rt.MOBILE_EXPANDED):this.observable.notify(rt.MOBILE_COLLAPSED)};document.addEventListener("flux-sidebar-toggle",e),this.onUnmount(()=>document.removeEventListener("flux-sidebar-toggle",e)),this.addEventListener("click",r=>{r.target===this&&this.state.collapsedDesktop&&this.observable.notify(rt.DESKTOP_EXPANDED)}),this.addEventListener("mouseenter",()=>this.refreshActiveState()),this.addEventListener("mouseleave",()=>this.refreshActiveState()),this.addEventListener("focusin",()=>this.refreshActiveState()),this.addEventListener("focusout",()=>queueMicrotask(()=>this.refreshActiveState()));let s=new MutationObserver(r=>{r.some(a=>a.target.matches?.("[data-flux-sidebar-group-dropdown]"))&&this.refreshActiveState()});s.observe(this,{attributes:!0,attributeFilter:["data-open"],subtree:!0}),this.onUnmount(()=>s.disconnect())}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)`}refreshActiveState(){let t=!!(this.matches(":hover")||this.querySelector(":focus-visible")||this.querySelector("[data-flux-sidebar-group-dropdown][data-open]"));this.state.active!==t&&(this.state.active=t,this.observable.notify(rt.STATE_CHANGED))}updateDataAttributes(t){let e=this.config.collapsible===!0;e&&(this.state.active?h(t,"data-flux-sidebar-active",""):bt(t,"data-flux-sidebar-active")),this.state.viewportDesktop?(bt(t,"data-flux-sidebar-on-mobile"),h(t,"data-flux-sidebar-on-desktop",""),bt(t,"data-flux-sidebar-collapsed-mobile"),this.state.collapsedDesktop?e&&h(t,"data-flux-sidebar-collapsed-desktop",""):bt(t,"data-flux-sidebar-collapsed-desktop")):(bt(t,"data-flux-sidebar-on-desktop"),h(t,"data-flux-sidebar-on-mobile",""),bt(t,"data-flux-sidebar-collapsed-desktop"),this.state.collapsedMobile?h(t,"data-flux-sidebar-collapsed-mobile",""):bt(t,"data-flux-sidebar-collapsed-mobile"))}},Nr=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;this.viewport=matchMedia(`(min-width: ${t})`),this.onViewportChange=()=>{this.viewport.matches?this.observable.notify(rt.VIEWPORT_ENTER_DESKTOP):this.observable.notify(rt.VIEWPORT_ENTER_MOBILE)},this.onViewportChange(),this.viewport.addEventListener("change",this.onViewportChange)}disconnect(){this.viewport.removeEventListener("change",this.onViewportChange)}},Fr=class extends P{mount(){let t=this.querySelector("button,ui-button");m(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(rt.STATE_CHANGED,(
131)=>{e.updateDataAttributes(this)})})}};D("sidebar",Or);D("sidebar-toggle",Fr);var Rr=class extends P{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(as(s[t]+e,this.config.min,this.config.max))},onChange:t=>{this.state.onChanges.push(t)}},this._controllable=new z(this),this._disableable=new R(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&&m(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++)m(this.inputEls[t],"input",e=>{e.stopPropagation()}),m(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()}),m(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*(ut(this)?-1:1));break;case"ArrowLeft":this.state.increment(t,this.config.bigStep*(ut(this)?1:-1));break;default:return}this._controllable.dispatch(),e.preventDefault()}}
131),m(this.inputEls[t],"focus",()=>this.raiseThumb(t)),m(this.inputEls[t],"blur",()=>this.lowerThumb(t))}registerPointerListeners(){m(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+"%"}}
131repositionTicks(){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=as(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=as(d/o,0,1);c=ut(this)?1-c:c;let p=(s-e)*c+e;return p=Oo(p,r,e),p=as(p,e,s),p}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 as(i,t,e){return Math.min(Math.max(i,t),e)}function Oo(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))}D("slider",Rr);var Vr=class extends P{mount(){this.track=null,this.slides=[],this.indicators=this.indicators||[],this.state={current:0,atStart:!0,atEnd:!1},this.updateFrame=null,this.autoplayTimeout=null,this.autoplayPauseLocks=new Set,this.observer=null,this.resizeObserver=null,this._disableable=new R(this),this.syncElementsAndState(),!(!this.track||this.slides.length===0)&&(this._disableable.onInitAndChange(t=>this.syncDisabledState(t)),requestAnimationFrame(()=>{h(this,"data-ready","")}),this.onUnmount(m(this.track,"scroll",()=>this.queueStateUpdate(),{passive:!0}).off),this.observer=new MutationObserver(()=>this.syncElementsAndState()),this.observer.observe(this.track,{childList:!0}),this.onUnmount(()=>this.observer.disconnect()),this.resizeObserver=new ResizeObserver(()=>{this.indicators.forEach(t=>t.render()),this.queueStateUpdate()}),this.resizeObserver.observe(this.track),this.onUnmount(()=>this.resizeObserver.disconnect()),this.setupAutoplay())}unmount(){this.updateFrame&&cancelAnimationFrame(this.updateFrame),this.clearAutoplayTimeout()}next(){if(this.state.atEnd&&this.canRewind())return this.goTo(0);this.goTo(this.calculateTargetIndex(1))}previous(){this.goTo(this.calculateTargetIndex(-1))}goTo(t){!this.track||this.slides.length===0||this.disabled||(t=No(t,0,this.slides.length-1),this.track.scrollBy({left:this.scrollDistanceTo(this.slides[t]),behavior:this.scrollBehavior()}),this.updateState(),this.syncDisabledState(this.disabled))}syncElementsAndState(){this.refreshElements(),this.track&&(this.setupAccessibility(),this.indicators.forEac
131h(t=>{t.carousel=t.carousel||this,t.render()}),this.updateState(),this.syncDisabledState(this.disabled))}refreshElements(){this.track=this.querySelector("[data-flux-carousel-track]"),this.slides=Array.from(this.track?.querySelectorAll(":scope > ui-carousel-slide")||[]),this.indicators=Array.from(new Set([...this.indicators,...this.querySelectorAll("ui-carousel-indicators")]))}setupAccessibility(){Se(this,"role","group"),Se(this,"aria-roledescription","carousel"),Se(this.track,"aria-live","polite"),Se(this.track,"aria-atomic","false"),this.slides.forEach((t,e)=>{Se(t,"role","group"),Se(t,"aria-roledescription","slide"),Se(t,"aria-label",`${e+1} of ${this.slides.length}`)})}queueStateUpdate(){this.updateFrame||(this.updateFrame=requestAnimationFrame(()=>{this.updateFrame=null,this.updateState()}))}updateState(){this.state=this.readState(),this.reflectState()}readState(){return{current:this.calculateCurrentIndex(),atStart:this.isSlideVisible(this.slides[0]),atEnd:this.isSlideVisible(this.slides[this.slides.length-1])}}reflectState(){this.reflectEdgeState(),this.reflectScrollPercentage(),this.reflectSelectedSlide()}reflectEdgeState(){let t=this.state.atEnd&&!this.canRewind();this.state.atStart?h(this,"data-at-start",""):x(this,"data-at-start"),t?h(this,"data-at-end",""):x(this,"data-at-end"),this.controlElements("ui-carousel-button").forEach(e=>{this.state.atStart?h(e,"data-at-start",""):x(e,"data-at-start"),t?h(e,"data-at-end",""):x(e,"data-at-end")}),this.syncButtonDisabledStates()}reflectScrollPercentage(){let t=this.track.scrollWidth-this.track.clientWidth,e=t>0?Math.abs(this.track.scrollLeft)/t*100:0;if(this.track.style.setProperty("--flux-carousel-scroll-percentage",e+"%"),t<=0){this.track.style.setProperty("--flux-carousel-fade-left","100%"),this.track.style.setProperty("--flux-carousel-fade-right","100%");return}let s="calc(100% - var(--flux-carousel-fade-size))",r=e+"%",a=`calc(100% - ${e}%)`;this.track.style.setProperty("--flux-carousel-fade-left",ut(this)?`max(${s}, ${r})`:`max(${s}, ${a})`),this.track.style.setProperty("--flux-carousel-fade-right",ut(this)?`max(${s}, ${a})`:`max(${s}, ${r})`)}reflectSelectedSlide(){this.slides.forEach((t,e)=>{e===this.state.current?h(t,"data-selected",""):x(t,"data-selected")}),this.indicators.forEach(t=>t.update(this.state.current))}syncDisabledState(t){t?h(this,"aria-disabled","true"):x(this,"aria-disabled"),this.controlElements().forEach(e=>{t?h(e,"data-disabled",""):x(e,"data-disabled"),x(e,"aria-disabled")}),this.syncButtonDisabledStates(),this.syncAutoplay()}setupAutoplay(){this.hasAttribute("autoplay")&&(window.matchMedia("(prefers-reduced-motion: reduce)").matches||(this.onUnmount(m(this,"mouseenter",()=>this.pauseAutoplay("hover")).off),this.onUnmount(m(this,"mouseleave",()=>this.resumeAutoplay("hover")).off),this.onUnmount(m(this,"focusin",()=>this.pauseAutoplay("focus")).off),this.onUnmount(m(this,"focusout",t=>{this.contains(t.relatedTarget)||this.resumeAutoplay("focus")}).off),this.onUnmount(m(this.track,"pointerdown",()=>this.pauseAutoplay("manual")).off),this.onUnmount(m(this.track,"wheel",()=>this.pauseAutoplay("manual"),{passive:!0}).off),this.onUnmount(m(this.track,"touchstart",()=>this.pauseAutoplay("manual"),{passive:!0}).off),this.controlElements().filter(t=>!this.contains(t)).forEach(t=>{this.onUnmount(m(t,"mouseenter",()=>this.pauseAutoplay("hover")).off),this.onUnmount(m(t,"mouseleave",()=>this.resumeAutoplay("hover")).off),this.onUnmount(m(t,"focusin",()=>this.pauseAutoplay("focus")).off),this.onUnmount(m(t,"focusout",e=>{t.contains(e.relatedTarget)||this.resumeAutoplay("focus")}).off)}),this.scheduleAutoplay()))}syncAutoplay(){this.hasAttribute("autoplay")&&(this.disabled?this.clearAutoplayTimeout():this.scheduleAutoplay())}scheduleAutoplay(){this.clearAutoplayTimeout(),this.hasAttribute("autoplay")&&(this.disabled||this.autoplayPauseLocks.size>0||window.matchMedia("(prefers-reduced-motion: reduce)").matches||(this.autoplayTimeout=setTimeout(()=>{this.autoplayTimeout=null,this.advanceAutoplay(),this.scheduleAutoplay()},this.autoplayInterval())))}clearAutoplayTimeout(){this.autoplayTimeout&&(clearTimeout(this.autoplayTimeout),this.autoplayTimeout=null)}pauseAutoplay(t="manual"){this.hasAttribute("autoplay")&&(this.autoplayPauseLocks.add(t),this.clearAutoplayTimeout())}resumeAutoplay(t){this.hasAttribute("autoplay")&&(this.autoplayPauseLocks.delete(t),this.scheduleAutoplay())}advanceAutoplay(){this.state.atEnd?this.goTo(0):this.next()}autoplayInterval(){let t=Number(this.getAttribute("autoplay-interval")||5e3);return Number.isFinite(t)?Math.max(1e3,t):5e3}
131syncButtonDisabledStates(){this.controlElements().forEach(t=>{t.querySelectorAll("button").forEach(e=>{this.buttonIsDisabled(t)?h(e,"disabled",""):x(e,"disabled")})})}buttonIsDisabled(t){return this.disabled?!0:t.matches("ui-carousel-button")?t.getAttribute("direction")==="previous"?this.state.atStart:this.state.atEnd&&!this.canRewind():!1}canRewind(){return this.getAttribute("wrap")==="rewind"&&!(this.state.atStart&&this.state.atEnd)}controlElements(t="ui-carousel-button, ui-carousel-indicators"){let e=Array.from(this.querySelectorAll(t));return this.hasAttribute("name")&&e.push(...document.querySelectorAll(t.split(",").map(s=>`${s.trim()}[name="${CSS.escape(this.getAttribute("name"))}"]`).join(", "))),Array.from(new Set(e))}calculateTargetIndex(t){let e=this.calculateCurrentIndex();return this.getAttribute("advance")!=="page"?e+t:e+this.visibleSlideCount()*t}visibleSlideCount(){return Math.max(1,this.slides.filter(t=>this.isSlideVisible(t)).length)}calculateCurrentIndex(){let t=0,e=1/0,s=this.track.getBoundingClientRect();return this.slides.forEach((r,a)=>{let n=r.getBoundingClientRect(),l=ut(this)?Math.abs(s.right-n.right):Math.abs(s.left-n.left);l<e&&(t=a,e=l)}),t}isSlideVisible(t){if(!t)return!1;let e=this.track.getBoundingClientRect(),s=t.getBoundingClientRect();return Math.floor(s.left)>=Math.floor(e.left)&&Math.ceil(s.right)<=Math.ceil(e.right)}scrollDistanceTo(t){let e=this.track.getBoundingClientRect(),s=t.getBoundingClientRect();return ut(this)?s.right-e.right:s.left-e.left}scrollBehavior(){return window.matchMedia("(prefers-reduced-motion: reduce)").matches||this.getAttribute("scroll")==="instant"?"instant":"smooth"}},qr=class extends P{boot(){this.buttons=[],this.buttonCleanups=[],this.targets=[]}mount(){this.carousel=this.findCarousel(),this.carousel&&(this.carousel.indicators=this.carousel.indicators||[],this.render(),this.carousel.indicators.includes(this)||this.carousel.indicators.push(this),this.update(this.carousel.calculateCurrentIndex()),this.onUnmount(()=>{this.cleanupButtonListeners(),this.carousel.indicators=this.carousel.indicators.filter(t=>t!==this)}))}render(){this.cleanupButtonListeners();let t=[],e=this.calculateTargets();this.rendered=Ma(this.querySelector("template"),s=>e.map((r,a)=>{let n=this.carousel.getAttribute("advance")==="page"?`Show page ${a+1}`:`Show slide ${a+1}`,l=s({attrs:{"aria-label":n}});return this.buttonCleanups.push(m(l,"click",()=>{this.carousel.pauseAutoplay(),this.carousel.goTo(r)}).off),t.push(l),l})),this.buttons=t,this.targets=e}cleanupButtonListeners(){this.buttonCleanups.forEach(t=>t()),this.buttonCleanups=[]}update(t){let e=this.targets.reduce((s,r,a)=>Math.abs(t-r)<Math.abs(t-this.targets[s])?a:s,0);this.carousel.state.atEnd&&(e=this.targets.length-1),this.buttons.forEach((s,r)=>{r===e?(h(s,"data-selected",""),h(s,"aria-current","true")):(x(s,"data-selected"),x(s,"aria-current"))})}calculateTargets(){let t=this.carousel.slides.map((s,r)=>r);if(this.carousel.getAttribute("advance")!=="page")return t;let e=this.carousel.visibleSlideCount();return t.filter(s=>s%e===0)}findCarousel(){return this.hasAttribute("name")?document.querySelector(`ui-carousel[name="${CSS.escape(this.getAttribute("name"))}"]`):this.closest("ui-carousel")}},$r=class extends P{mount(){this.onUnmount(m(this,"click",t=>{let e=this.carousel();e&&(e.pauseAutoplay(),this.getAttribute("direction")==="previous"?e.previous():e.next(),t.preventDefault())}).off)}carousel(){return this.hasAttribute("name")?document.querySelector(`ui-carousel[name="${CSS.escape(this.getAttribute("name"))}"]`):this.closest("ui-carousel")}};function Se(i,t,e){i.hasAttribute(t)||h(i,t,e)}function No(i,t,e){return Math.min(Math.max(i,t),e)}D("carousel",Vr);D("carousel-indicators",qr);D("carousel-button",$r);var Wr=class extends Z{boot(){this.listeners=[],this.scrollLocked=!1,this.pointerCleanup=null,this.previewEls=[],this.sliderEls=[],this.swatchContainers=[],this.swatchEls=[],this.dropperButtons=[],this.copyButtons=[],this.state=Br(),this.committedState=Br(),this._disableable=new R(this),this._controllable=new z(this,{bubbles:!0}),this._closeable=new kt(this),this._submittable=new Q(this,{name:this.resolveName(),value:null,includeWhenEmpty:!1});let t=K();this.onStateChange(()=>{this._submittable.update(this.getValue()),this.syncUI()}),this._controllable.initial(e=>{e!=null&&e!==""?this.setValue(e,{dispatch:!1}):this.setValue(this.getAttribute("value"),{dispatch:!1})}),this._controllable.getter(()=>this.getValue()),this._controllable.setter(t(e=>{this.setValue(e,{dispatch:!1}),this.isDeferred()&&this.syncCommittedStateFromDraft()})),this._disableable.onInitAndChange(e=>this.syncDisabledState(e)),this.observeAttributes()}mount(){this.cacheDom(),!(!this.popoverEl||!this.triggerEl)&&(this.setupPopover(),this.setupTrigger(),this.setupArea(),this.setupSliders(),this.setupPopoverInput(),this.setupSwatches(),this.setupDropper(),this.setupCopyButton(),this.setupFieldIfExists(),this.syncDisabledState(this._disableable.isDisabled()),this.syncUI())}cacheDom(){this.popoverEl=this.querySelector("dialog"),this.triggerEl=this.querySelector("[data-flux-color-picker-trigger]")||this.querySelector("[data-flux-color-picker-button]"),this.inputEl=this.querySelector("[data-flux-color-picker-input]"),this.triggerControl=this.inputEl||this.triggerEl,this.popoverInputEl=this.querySelector("[data-flux-color-picker-popover-input]"),this.areaEl=this.querySelector("[data-flux-color-picker-area]"),this.areaThumb=this.querySelector("[data-flux-color-picker-area-thumb]"),this.areaHue=this.querySelector("[data-flux-color-picker-area-hue]"),this.buttonEl=this.querySelector("[data-flux-color-picker-button]"),this.swatchButton=this.querySelector("[data-flux-color-picker-swatch-button]"),this.previewEls=Array.from(this.querySelectorAll("[data-flux-color-picker-preview]")),this.sliderEls=Array.from(this.querySelectorAll("[data-flux-color-picker-slider]")),this.swatchContainers=Array.from(this.querySelectorAll("[data-flux-color-picker-swatches]")),this.swatchEls=Array.from(this.querySelectorAll("[data-flux-color-picker-swatch]")),this.dropperButtons=Array.from(this.querySelectorAll("[data-flux-color-picker-dropper]")),this.copyButtons=Array.from(this.querySelectorAll("[data-flux-color-picker-copy]")),this.mobileMediaQuery=window.matchMedia("(max-width: 639px)"),this.initialFocusEl=this.querySelector("[data-flux-color-picker-initial-focus]")||this.areaThumb||this.popoverInputEl}unmount(){this.pointerCleanup?.(),this.pointerCleanup=null}observeAttributes(){this.attributeObserver=new MutationObserver(t=>
131{t.forEach(e=>{if(e.attributeName==="disabled"){this.syncDisabledState(this._disableable.isDisabled());return}if(e.attributeName==="value"){let s=this.getAttribute("value"),r=this.committedState.empty?null:this.committedState.value;if((s??null)===r){this.syncUI();return}this.setValue(s,{dispatch:!1});return}e.attributeName==="format"&&(this.state.empty||(this.state.value=this.formatValue(this.state)),this.committedState.empty||(this.committedState.value=this.formatValue(this.committedState)),this.syncValueAttribute(),this.notify())})}),this.attributeObserver.observe(this,{attributes:!0,attributeFilter:["disabled","format","value"]}),this.onUnmount(()=>this.attributeObserver.disconnect())}resolveName(){let t=this.getAttribute("name");return t||Array.from(this.attributes).find(e=>e.name.startsWith("wire:model"))?.value}onStateChange(t){return this.listeners.push(t),()=>{this.listeners=this.listeners.filter(e=>e!==t)}}notify(){this.listeners.forEach(t=>t(this.state))}getFormat(){return this.getAttribute("format")||"hex"}supportsAlpha(){return["hexa","rgba","hsla"].includes(this.getFormat())}getValue(){return this.committedState.empty?null:this.committedState.value}getDraftValue(){return this.state.empty?null:this.state.value}clear(){this.setValue(null),this.dispatchEvent(new CustomEvent("clear",{bubbles:!1}))}setValue(t,e={}){let{dispatch:s=!0}=e;if(t==null||t==="")this.writeState(Br(),{dispatch:s});else{let r=zr(t);if(!r)return!1;this.writeState({hsv:$o(r.r,r.g,r.b),alpha:r.a,empty:!1},{dispatch:s})}return!0}updateColor(t,e={}){let{dispatch:s=!0}=e,r;this.state.empty?r={hsv:{h:Pt(t.h??0,0,360),s:Pt(t.s??0,0,100),v:Pt(t.v??0,0,100)},alpha:Pt(e.alpha??1,0,1),empty:!1}:r={...this.state,hsv:{h:Pt(t.h??this.state.hsv.h,0,360),s:Pt(t.s??this.state.hsv.s,0,100),v:Pt(t.v??this.state.hsv.v,0,100)},alpha:Pt(e.alpha??this.state.alpha,0,1),empty:!1},this.writeState(r,{dispatch:s})}afterStateMutation({dispatch:t=!0}={}){if(this.isDeferred()){this.notify();return}this.syncCommittedState(),this.notify(),t&&this._controllable.dispatch()}writeState(t,{dispatch:e=!0}={}){this.state=Fo(this,t),this.afterStateMutation({dispatch:e})}syncCommittedState(){this.committedState=Yr(this.state),this.syncValueAttribute()}syncCommittedStateFromDraft(){this.syncCommittedState()}commit(){this.syncCommittedState(),this._submittable.update(this.getValue()),this.notify(),this._controllable.dispatch(),this.close()}isDeferred(){let t=this.querySelector("ui-color-picker-select");return!!t&&t.getBoundingClientRect().width>0}setHue(t,e={}){this.updateColor({h:t},e)}setAlpha(t,e={}){this.updateColor({},{...e,alpha:t})}setSaturationValue(t,e,s={}){this.updateColor({s:t,v:e},s)}getRgb(){return this.state.empty?null:ns(this.state.hsv.h,this.state.hsv.s,this.state.hsv.v)}getHsl(){let t=this.getRgb();return t?_n(t.r,t.g,t.b):null}formatValue(t=this.state){if(t.empty)return null;let e=ns(t.hsv.h,t.hsv.s,t.hsv.v),s=_n(e.r,e.g,e.b),r=Pt(t.alpha,0,1);switch(this.getFormat()){case"hexa":return`${kn(e.r,e.g,e.b)}${Vo(r)}`;case"rgb":return`rgb(${e.r} ${e.g} ${e.b})`;case"rgba":return`rgb(${e.r} ${e.g} ${e.b} / ${Ur(r)})`;case"hsl":return`hsl(${Math.round(s.h)} ${Math.round(s.s)}% ${Math.round(s.l)}%)`;case"hsla":return`hsl(${Math.round(s.h)} ${Math.round(s.s)}% ${Math.round(s.l)}% / ${Ur(r)})`;default:return kn(e.r,e.g,e.b)}}syncValueAttribute(){this.committedState.empty||!this.committedState.value?x(this,"value"):h(this,"value",this.committedState.value)}toggle(){this._disableable.isDisabled()||this._dialogable?.toggle()}open(){this._disableable.isDisabled()||this._dialogable?.setState(!0)}close(){this._dialogable?.setState(!1)}trigger(){return this.triggerControl||this.triggerEl}isMobileViewport(){return this.mobileMediaQuery?.matches??window.matchMedia("(max-width: 639px)").matches}setupPopover(){this._dialogable=new Qt(this.popoverEl,{clickOutside:!0,triggers:[this.triggerControl]}),this._anchorable=new tt(this.popoverEl,{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}),this.linkPopoverAria(),Ho(this,this.popoverEl,this._dialogable,this._anchorable,()=>{queueMicrotask(()=>this.initialFocusEl?.focus())}),this._closeable.onClose(()=>this._dialogable.setState(!1)),this._dialogable.onChange(()=>{this.state=Yr(this.committedState),this.notify()}
131),this.getAriaTargets().forEach(t=>Uo(t,this._dialogable)),Yo(this,this._dialogable),Wo(this.triggerControl,this._dialogable)}linkPopoverAria(){let t=X(this.popoverEl,"color-picker-popover");this.getAriaTargets().forEach(e=>{h(e,"aria-haspopup","dialog"),h(e,"aria-controls",t)})}setupTrigger(){this.inputEl&&(m(this.triggerEl,"click",t=>{if(!(t.target!==this.triggerEl&&t.target!==this.inputEl)){if(this.isMobileViewport()){this.open();return}this.inputEl.focus()}}),this.setupMobileTriggerInputMode(this.inputEl),this.setupInput(this.inputEl)),this.buttonEl&&m(this.buttonEl,"click",t=>{t.target.closest('[aria-label="Clear color"]')||this._disableable.isDisabled()||this.toggle()}),this.swatchButton&&m(this.swatchButton,"click",t=>{this._disableable.isDisabled()||(t.stopPropagation(),this.toggle())})}setupInput(t){m(t,"mousedown",e=>{document.activeElement!==t&&(e.preventDefault(),t.focus())}),m(t,"focus",()=>t.select()),m(t,"change",e=>{e.stopPropagation();let s=t.value.trim();s===""?this.setValue(null):this.setValue(s)||(t.value=this.getValue()||"")}),m(t,"input",e=>e.stopPropagation()),m(t,"blur",()=>{t.value=this.getValue()||""}),m(t,"keydown",e=>{e.key==="Enter"&&(e.preventDefault(),t.blur())})}setupArea(){!this.areaEl||!this.areaThumb||(m(this.areaEl,"touchmove",t=>{t.preventDefault()}),m(this.areaEl,"pointerdown",t=>{if(this._disableable.isDisabled()||t.button!==0)return;t.preventDefault(),this.setAreaFromPointer(t),this.areaEl.setPointerCapture(t.pointerId),this.pointerCleanup?.();let e=r=>this.setAreaFromPointer(r),s=r=>{this.pointerCleanup?.(),this.pointerCleanup=null,document.removeEventListener("pointermove",e),this.areaEl.releasePointerCapture(r.pointerId),this.dispatchEvent(new Event("change",{bubbles:!1}))};document.addEventListener("pointermove",e),document.addEventListener("pointerup",s,{once:!0}),this.pointerCleanup=()=>{document.removeEventListener("pointermove",e),document.removeEventListener("pointerup",s)}}),m(this.areaEl,"keydown",t=>{if(this._disableable.isDisabled())return;let e=t.shiftKey?10:2,s=ut(this)?-e:e,{s:r,v:a}=this.state.hsv;switch(t.key){case"ArrowRight":r+=s;break;case"ArrowLeft":r-=s;break;case"ArrowUp":a+=e;break;case"ArrowDown":a-=e;break;case"Home":r=0;break;case"End":r=100;break;case"PageUp":a=100;break;case"PageDown":a=0;break;default:return}this.setSaturationValue(r,a),t.preventDefault()}))}setAreaFromPointer(t){let e=this.areaEl.getBoundingClientRect(),s=ut(this)?(e.right-t.clientX)/e.width:(t.clientX-e.left)/e.width,r=Pt(s*100,0,100),a=Pt((1-(t.clientY-e.top)/e.height)*100,0,100);this.setSaturationValue(r,a,{dispatch:!1}),this.dispatchEvent(new Event("input",{bubbles:!1}))}setupSliders(){this.sliderEls.forEach(t=>{let e=t.getAttribute("data-channel");m(t,"input",s=>{s.stopPropagation(),this.updateSliderValue(e,parseFloat(t.value)),this.dispatchEvent(new Event("input",{bubbles:!1}))}),m(t,"change",s=>{s.stopPropagation(),this.dispatchEvent(new Event("change",{bubbles:!1}))})})}updateSliderValue(t,e){t==="alpha"?this.setAlpha(e/100,{dispatch:!1}):this.setHue(e,{dispatch:!1})}setupPopoverInput(){this.popoverInputEl&&this.setupInput(this.popoverInputEl)}setupMobileTriggerInputMode(t){let e=this.mobileMediaQuery,s=()=>{e.matches?h(t,"inputmode","none"):x(t,"inputmode")};s(),e.addEventListener("change",s),this.onUnmount(()=>e.removeEventListener("change",s)),m(t,"mousedown",r=>{e.matches&&(r.preventDefault(),r.stopImmediatePropagation())})}setupSwatches(){this.swatchContainers.forEach(t=>{m(t,"click",e=>{let s=e.target.closest("[data-flux-color-picker-swatch]");!s||this._disableable.isDisabled()||this.commitSwatch(s)}),m(t,"keydown",e=>{if(this._disableable.isDisabled())return;let s=e.target.closest("[data-flux-color-picker-swatch]");if(!s)return;let r=Array.from(t.querySelectorAll("[data-flux-color-picker-swatch]")),a=r.indexOf(s),n=Bo(r),l=null;switch(e.key){case"ArrowRight":l=r[a+1];break;case"ArrowLeft":l=r[a-1];break;case"ArrowDown":l=r[a+n];break;case"ArrowUp":l=r[a-n];break;case"Home":l=r[0];break;case"End":l=r[r.length-1];break;case"Enter":case" ":this.commitSwatch(s),e.preventDefault();return;default:return}l&&(this.focusSwatch(l),e.preventDefault())})})}commitSwatch(t){let e=t.getAttribute("data-value")||t.getAttribute("value");e&&(this.setValue(e),this.announceSelection(this.getSwatchLabel(t)),this.isDeferred()&&this.isMobileViewport()&&this.commit())}getSwatchLabel(t){return t.getAttribute("aria-label")||t.getAttribute("title")||t.getAttribute("data-value")||t.getAttribute("value")}
131focusSwatch(t){this.swatchEls.forEach(e=>{h(e,"tabindex",e===t?"0":"-1")}),t.focus()}announceSelection(t){let e=this.querySelector("[data-flux-color-picker-announce]");e&&(e.textContent="",setTimeout(()=>{e.textContent=`${t} selected`},150))}setupDropper(){this.dropperButtons.forEach(t=>{if(!window.EyeDropper){h(t,"disabled",""),h(t,"hidden","");return}m(t,"click",async()=>{try{let s=await new EyeDropper().open();s.sRGBHex&&this.setValue(s.sRGBHex)}catch{}})})}setupCopyButton(){this.copyButtons.forEach(t=>{m(t,"click",e=>{e.stopPropagation();let s=this.getValue();s&&navigator.clipboard?.writeText&&navigator.clipboard.writeText(s)})})}syncUI(){let t=this.getValue(),e=this.getDraftValue();this.previewEls.forEach(s=>{s.style.backgroundColor=t?this.getCheckerboardColor(this.committedState):"transparent"}),this.inputEl&&document.activeElement!==this.inputEl&&(this.inputEl.value=t||""),this.popoverInputEl&&document.activeElement!==this.popoverInputEl&&(this.popoverInputEl.value=e||""),this.syncTriggerValueText(t),this.areaHue&&(this.areaHue.style.backgroundColor=this.getAreaColor(this.state)),this.syncAreaThumb(),this.syncSliders(),this.syncSwatches(e),this.syncSwatchButtonLabel(t),this.syncSwatchTabIndex()}syncTriggerValueText(t){let e=this.querySelector("[data-flux-color-picker-value]");e&&(e.textContent=t||"")}syncAreaThumb(){if(!this.areaThumb)return;let t=Math.round(this.state.hsv.s),e=Math.round(this.state.hsv.v);this.areaThumb.style.insetInlineStart=`${this.state.hsv.s}%`,this.areaThumb.style.top=`${100-this.state.hsv.v}%`,h(this.areaThumb,"aria-valuenow",t),h(this.areaThumb,"aria-valuetext",`Saturation ${t}%, brightness ${e}%`)}syncSliders(){this.sliderEls.forEach(t=>{t.getAttribute("data-channel")==="alpha"?(t.value=Math.round(this.state.alpha*100),this.syncAlphaTrack(t)):t.value=Math.round(this.state.hsv.h)})}syncAlphaTrack(t){let e=t.querySelector("[data-flux-color-picker-slider-track]");e&&(e.style.background=`linear-gradient(to right, transparent, ${this.getSolidColor(this.state)})`)}syncSwatches(t){this.swatchEls.forEach(e=>{let s=e.getAttribute("data-value")||e.getAttribute("value"),r=t&&s&&Cn(s,t);r?h(e,"data-selected",""):x(e,"data-selected"),h(e,"aria-selected",r?"true":"false")})}syncSwatchButtonLabel(t){if(!this.swatchButton)return;this.swatchButton.dataset.baseLabel===void 0&&(this.swatchButton.dataset.baseLabel=this.swatchButton.getAttribute("aria-label")||"");let e=this.swatchButton.dataset.baseLabel,s=t?this.getCommittedSwatchLabel(t):null;h(this.swatchButton,"aria-label",s?`${e}, ${s}`:e)}getCommittedSwatchLabel(t){let e=this.swatchEls.find(s=>{let r=s.getAttribute("data-value")||s.getAttribute("value");return r&&Cn(r,t)});return e?this.getSwatchLabel(e):t}syncSwatchTabIndex(){if(!this.swatchEls.length||this.querySelector("[data-flux-color-picker-swatch]:focus"))return;let s=this.swatchEls.find(r=>r.getAttribute("aria-selected")==="true")||this.swatchEls[0];this.swatchEls.forEach(r=>h(r,"tabindex",r===s?"0":"-1"))}syncDisabledState(t){this.querySelectorAll("button, input").forEach(e=>{t?h(e,"disabled",""):x(e,"disabled")}),this.previewEls.forEach(e=>{e.style.opacity=t?"0.65":""})}getAreaColor(t=this.state){return`hsl(${t.hsv.h} 100% 50%)`}getSolidColor(t=this.state){if(t.empty)return"transparent";let e=ns(t.hsv.h,t.hsv.s,t.hsv.v);return`rgb(${e.r} ${e.g} ${e.b})`}getCheckerboardColor(t=this.state){if(t.empty)return"transparent";let e=ns(t.hsv.h,t.hsv.s,t.hsv.v);return`rgb(${e.r} ${e.g} ${e.b} / ${Ur(t.alpha)})`}setupFieldIfExists(){let t=this.closest("ui-field");t&&queueMicrotask(()=>{if(t.label){let e=m(t.label,"click",()=>this.triggerControl?.focus());this.onUnmount(()=>e.off())}t.label&&this.triggerControl&&h(this.triggerControl,"aria-labelledby",t.label.id),t.description&&this.triggerControl&&h(this.triggerControl,"aria-describedby",t.description.id)})}getAriaTargets(){return[this.triggerControl,this.swatchButton].filter(Boolean)}};function Br(){return{hsv:{h:0,s:0,v:0},alpha:1,value:null,empty:!0}}function Yr(i){return{hsv:{...i.hsv},alpha:i.alpha,value:i.value,empty:i.empty}}function Fo(i,t){let e=Yr(t);return e.value=e.empty?null:i.formatValue(e),e}function Pt(i,t,e){return Math.min(Math.max(i,t),e)}function Ro(i){let t=i%360;return t<0?t+360:t}function Ur(i){return Number(i.toFixed(2)).toString()}function Vo(i){return Math.round(i*255).toString(16).padStart(2,"0")}function kn(i,t,e){return`#${[i,t,e].map(s=>s.toString(16).padStart(2,"0")).join("")}`}function qo(i){let t=i.trim();return/^[0-9a-fA-F]{3}$|^[0-9a-fA-F]{6}$|^[0-9a-fA-F]{8}$/.test(t)?`#${t}`:/^\d{1,3}\s*,\s*\d{1,3}\s*,\s*\d{1,3}$/.test(t)?`rgb(${t.replace(/,/g," ").replace(/\s+/g," ")})`:t}var Hr;function zr(i){if(!i)return null;let t=qo(i);Hr||(Hr=document.createElement("canvas").getContext("2d"));let e=Hr;e.fillStyle="#000000",e.fillStyle=t;let s=e.fillStyle;if(s==="#000000"&&t!=="#000000"&&t!=="#000"&&t!=="black"){if(e.fillStyle="#ffffff",e.fillStyle=t,e.fillStyle==="#ffffff")return null;s=e.fillStyle}if(s.startsWith("#")){let a=s.slice(1);return{r:parseInt(a.slice(0,2),16),g:parseInt(a.slice(2,4),16),b:parseInt(a.slice(4,6),16),a:a.length===8?parseInt(a.slice(6,8),16)/255:1}}let r=s.match(/[\d.]+/g);return r?{r:parseFloat(r[0]),g:parseFloat(r[1]),b:parseFloat(r[2]),a:r[3]===void 0?1:parseFloat(r[3])}:null}function $o(i,t,e){i/=255,t/=255,e/=255;let s=Math.max(i,t,e),r=Math.min(i,t,e),a=s-r,n=0;return a!==0&&(s===i?n=60*((t-e)/a%6):s===t?n=60*((e-i)/a+2):n=60*((i-t)/a+4)),{h:Ro(n),s:s===0?0:a/s*100,v:s*100}}function ns(i,t,e){t/=100,e/=100;let s=e*t,r=s*(1-Math.abs(i/60%2-1)),a=e-s,n=0,l=0,o=0;return i>=0&&i<60?[n,l,o]=[s,r,0]:i<120?[n,l,o]=[r,s,0]:i<180?[n,l,o]=[0,s,r]:i<240?[n,l,o]=[0,r,s]:i<300?[n,l,o]=[r,0,s]:[n,l,o]=[s,0,r],{r:Math.round((n+a)*255),g:Math.round((l+a)*255),b:Math.round((o+a)*255)}}function _n(i,t,e){i/=255,t/=255,e/=255;let s=Math.max(i,t,e),r=Math.min(i,t,e),a=0,n=0,l=(s+r)/2;if(s!==r){let o=s-r;switch(n=l>.5?o/(2-s-r):o/(s+r),s){case i:a=(t-e)/o+(t<e?6:0);break;case t:a=(e-i)/o+2;break;default:a=(i-t)/o+4;break}a/=6}return{h:a*360,s:n*100,l:l*100}}function Cn(i,t){let e=zr(i),s=zr(t);return!e||!s?!1:e.r===s.r&&e.g===s.g&&e.b===s.b}
131function Bo(i){if(!i.length)return 1;let t=i[0].offsetTop,e=0;for(let s of i){if(s.offsetTop!==t)break;e++}return e||1}var Gr=class extends P{mount(){this.picker=this.closest("ui-color-picker"),this.picker&&Jt(this,()=>this.picker._disableable?.isDisabled?.()??!1,()=>{this.picker.commit()})}};D("color-picker",Wr);D("color-picker-select",Gr);function Uo(i,t){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 Ho(i,t,e,s,r=()=>{}){let a=()=>{Array.from([i,t]).forEach(n=>{e.getState()?h(n,"data-open",""):x(n,"data-open")}),e.getState()?(s.reposition(),r()):s.cleanup()};e.onChange(()=>a()),a(),e.onChange(()=>{e.getState()?i.dispatchEvent(new Event("open",{bubbles:!1,cancelable:!1})):i.dispatchEvent(new Event("close",{bubbles:!1,cancelable:!1}))})}function Wo(i,t){m(i,"keydown",e=>{e.key==="ArrowDown"&&!t.getState()?(t.setState(!0),e.preventDefault(),e.stopImmediatePropagation()):e.key==="Escape"&&t.getState()&&(t.setState(!1),e.preventDefault(),e.stopImmediatePropagation())})}function Yo(i,t){let{lock:e,unlock:s}=lt(t.el),r=()=>!window.matchMedia("(min-width: 640px)").matches;t.onChange(()=>{let a=t.getState()&&r();a&&!i.scrollLocked?(e(),i.scrollLocked=!0):!a&&i.scrollLocked&&(s(),i.scrollLocked=!1)}),i.onUnmount(()=>{i.scrollLocked&&(s(),i.scrollLocked=!1)})}var jr=class extends Z{boot(){let t=this;this._disableable=new R(this),this._selectable=new G(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=K(),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")}),m(t,"click",this._disableable.disabled(e=>{e.preventDefault(),e.stopPropagation()}),{capture:!0}),m(t,"click",this._disableable.enabled(e=>{this._selectable.press()})),m(t,"keydown",this._disableable.enabled(e=>{e.key==="Enter"&&(this._selectable.press(),e.preventDefault(),e.stopPropagation())})),m(t,"keydown",this._disableable.enabled(e=>{e.key===" "&&(e.preventDefault(),e.stopPropagation())})),m(t,"keyup",this._disableable.enabled(e=>{e.key===" "&&(this._selectable.press(),e.preventDefault(),e.stopPropagation())})),zo(t)}get checked(){return this._selectable.isSelected()}set checked(t){this._detangled(()=>{t?this._selectable.select():this._selectable.deselect()})()}};function zo(i){i.closest("label")?.addEventListener("click",t=>{i.contains(t.target)||i.click()})}D("switch",jr);var Kr=class i extends P{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,m(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 it(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","ui-color-picker"].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 P&&t.firstElementChild instanceof HTMLButtonElement?t.firstElementChild:t}},Xr=class extends P{mount(){X(this,"label"),h(this,"aria-hidden","true"),this.closest("ui-field")?.associateLabel(this)}},Zr=class extends P{mount(){X(this,"description"),h(this,"aria-hidden","true"),this.closest("ui-field")?.associateDescription(this)}};D("field",Kr);D("label",Xr);D("description",Zr);var Jr=class extends P{mount(){let t=X(this,"legend"),e=this.closest("fieldset");e&&h(e,"aria-labelledby",t)}};D("legend",Jr);var Ee=i=>i!=null;
131function Mn(i){let t={time:Jo,linear:jo,categorical:Go},e=0,s=0,r={},a=(o,u,d)=>{let c=`${o}-${u}`;for(let p in r)p.startsWith(`${o}-`)&&!p.endsWith(String(u))&&delete r[p];return r[c]||(r[c]=d()),r[c]},n={index:{key:i.dimensions.index.key,asArea:i.dimensions.index.asArea,get axis(){return l.axes[l.horizontal?"y":"x"]},get rawValues(){return a("index.rawValues",e,()=>l.data.map(o=>o[this.key]))},get type(){return a("index.type",e,()=>this.axis.defaultScale||(this.rawValues.every(o=>Xo(o))?"time":"categorical"))},get values(){return a("index.values",e,()=>this.rawValues.map(o=>this.type==="time"?us(o):this.type==="linear"?Number(o):o))},get points(){return a("index.points",e+s,()=>l.data.map(o=>{let{start:u,center:d,end:c,width:p}=this.axis.scale(o[this.key],{area:this.asArea});return{start:u,center:d,end:c,width:p,datum:o}}))}},value:{keys:i.dimensions.value.keys,includeZero:i.dimensions.value.includeZero,get axis(){return l.axes[l.horizontal?"x":"y"]},get type(){return a("value.type",e,()=>this.axis.defaultScale||"linear")},get values(){return a("value.values",e,()=>{let o=l.data.flatMap(c=>l.groupsMetadata.reduce((p,b)=>(b.children.forEach(f=>{if(f.type==="bar"){if(!f.field||!Ee(c[f.field]))return;p.push(c[f.field])}if(f.type==="stack"){let g=Number(f.gap.replace("px","")),w=0,E=0,L=!1,N=!1;f.children.forEach(S=>{if(S.type==="bar"){if(!S.field||!Ee(c[S.field]))return;let C=c[S.field];C>=0?(L&&(w+=g),w+=C,L=!0):(N&&(E-=g),E+=C,N=!0)}}),L&&p.push(w),N&&p.push(E)}}),p),[])),u=l.data.flatMap(c=>l.stacksMetadata.reduce((p,b)=>{let f=Number(b.gap.replace("px","")),g=0,w=0,E=!1,L=!1;return b.children.forEach(N=>{if(N.type==="bar"){if(!N.field||!Ee(c[N.field]))return;let S=c[N.field];S>=0?(E&&(g+=f),g+=S,E=!0):(L&&(w-=f),w+=S,L=!0)}}),E&&p.push(g),L&&p.push(w),p},[])),d=l.data.flatMap(c=>this.keys.reduce((p,b)=>(Ee(c[b])&&p.push(c[b]),p),[]));return[...o,...u,...d,...this.includeZero?[0]:[]]})},zeroLine(){let o=this.axis.scale(0).center;return this.axis.axis==="x"?{x1:o,x2:o,y1:l.dimensions.index.axis.range[0],y2:l.dimensions.index.axis.range[1]}:{x1:l.dimensions.index.axis.range[0],x2:l.dimensions.index.axis.range[1],y1:o,y2:o}}}},l={horizontal:i.horizontal,locale:i.locale,data:[],stacksMetadata:i.stacksMetadata,groupsMetadata:i.groupsMetadata,width:i.width,height:i.height,inset:i.inset,dimensions:n,axes:{x:{axis:"x",format:i.axes.x.format,inset:{start:0,end:0},position:i.axes.x.position||"bottom",defaultScale:i.axes.x.scale,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,get interval(){return a("x.interval",e,()=>i.axes.x.interval||"auto")},get dimension(){return l.dimensions[l.horizontal?"value":"index"]},get values(){return this.dimension.values},get type(){return this.dimension.type},get ticks(){return a("x.ticks",e,()=>{let o=In(l.data,this,os(this.type,this.values)),u=Dn(o,this.type,this.format,this.tickSuffix,this.tickPrefix,this.interval,l.locale);return o.map((d,c)=>({value:d,label:u[c]}))})},get domain(){return a("x.domain",e,()=>os(this.type,[...this.ticks.map(o=>o.value),...this.values]))},get range(){return a("x.range",s,()=>[l.inset.left+this.inset.start,l.width-l.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",format:i.axes.y.format,inset:{start:0,end:0},position:i.axes.y.position||"left",defaultScale:i.axes.y.scale,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 interval(){return a("y.interval",e,()=>i.axes.y.interval||"auto")},get dimension(){return l.dimensions[l.horizontal?"index":"value"]},get values(){return this.dimension.values},get type(){return this.dimension.type},get ticks(){return a("y.ticks",e,()=>{let o=In(l.data,this,os(this.type,this.values)),u=Dn(o,this.type,this.format,this.tickSuffix,this.tickPrefix,this.interval,l.locale);
131return o.map((d,c)=>({value:d,label:u[c]}))})},get domain(){return a("y.domain",e,()=>os(this.type,[...this.ticks.map(o=>o.value),...this.values]))},get range(){return a("y.range",s,()=>l.horizontal?[l.inset.top+this.inset.start,l.height-l.inset.bottom-this.inset.end]:[l.height-l.inset.bottom-this.inset.end,l.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.dimensions.value.keys.reduce((o,u)=>{if(!l.data.some(f=>Ee(f[u])))return console.warn(`ui-chart: series field "${u}" does not exist`),o;let d=[],c=[];l.data.forEach(f=>{if(!Ee(f[u])){c.length&&d.push(c),c=[];return}let g=l.dimensions.index.axis.scale(f[l.dimensions.index.key],{area:l.dimensions.index.asArea}).center,w=l.dimensions.value.axis.scale(f[u]).center;c.push({x:l.horizontal?w:g,y:l.horizontal?g:w,datum:f})}),c.length&&d.push(c);let p=d.flat(),b={field:u,values:l.data.map(f=>f[u]),bars({barWidth:f,minHeight:g,radius:w}){let{start:E,center:L,width:N}=l.dimensions.index.axis.scale(l.dimensions.index.axis.domain[0],{area:l.dimensions.index.asArea}),S=w;f.match(/^(\d+)%$/)?f=N*Number(f.replace("%",""))/100:f=Number(f.replace("px",""));let C=(N-f)/2;return l.data.flatMap(q=>{let V=q[u];if(!Ee(V))return[];let{start:U}=l.dimensions.index.axis.scale(q[l.dimensions.index.key],{area:l.dimensions.index.asArea}),y,H,_,W,F=S;return l.horizontal?(y=V>=0?l.dimensions.value.axis.scale(0).center:l.dimensions.value.axis.scale(V).center,H=U+C,_=V>=0?l.dimensions.value.axis.scale(V).center-y:l.dimensions.value.axis.scale(0).center-y,W=f,_<g&&(V<0&&(y-=g-_),_=g)):(y=U+C,H=V>=0?l.dimensions.value.axis.scale(V).center:l.dimensions.value.axis.scale(0).center,W=V>=0?l.dimensions.value.axis.scale(0).center-H:l.dimensions.value.axis.scale(V).center-H,_=f,W<g&&(H-=g-W,W=g)),F=ls(F,V,l.horizontal),[{x:y,y:H,width:_,height:W,path:()=>We(y,H,_,W,F)}]})},linePath(f="smooth"){let g={smooth:w=>Tn(w,l.horizontal?"y":"x"),none:Ln}[f];return this.segments.map(w=>g(w.map(E=>[E.x,E.y]))).filter(Boolean).join(" ")},areaPath(f="smooth"){let g={smooth:w=>Tn(w,l.horizontal?"y":"x"),none:Ln}[f];return this.segments.map(w=>{let E=g(w.map(C=>[C.x,C.y]));if(!E)return"";let L=w[0],N=w[w.length-1],S=l.dimensions.value.axis.scale(l.dimensions.value.axis.domain[0]).center;return l.horizontal?`${E} L${S},${N.y} L${S},${L.y} Z`:`${E} L${N.x},${S} L${L.x},${S} Z`}).filter(Boolean).join(" ")},points:p,segments:d};return o[u]=b,o},{}))},get stackedSeries(){return a("stackedSeries",e+s,()=>{let o={},u=[];return l.stacksMetadata.map(d=>(d.children.forEach(p=>{if(p.type==="bar"){if(!p.field)return;if(!l.data[0].hasOwnProperty(p.field)){console.warn(`ui-chart: series field "${p.field}" does not exist`);return}o[p.field]=l.data.map(b=>b[p.field]),u.push(p)}}),{bars(){let{start:p,center:b,width:f}=l.dimensions.index.axis.scale(l.dimensions.index.axis.domain[0],{area:l.dimensions.index.asArea}),g=d.width??"90%";g.match(/^(\d+)%$/)?g=f*Number(g.replace("%",""))/100:g=Number(g.replace("px",""));let w=(f-g)/2,E=Number(d.gap.replace("px","")),L=[],N=[],S=d.radius,C=[],q=[];return S&&u.forEach(V=>{V.type==="bar"&&o[V.field].forEach((U,y)=>{U>=0?(C[y]=V.field,q[y]===void 0&&(q[y]=V.field)):(q[y]=V.field,C[y]===void 0&&(C[y]=V.field))})}),u.reduce((V,U)=>{if(U.type==="bar"){let y=[];o[U.field].forEach((H,_)=>{L[_]===void 0&&(L[_]=0,N[_]=0);let{start:W}=l.dimensions.index.axis.scale(l.data[_][l.dimensions.index.key],{area:l.dimensions.index.asArea}),F,A,O,k,I=Number(U.minHeight.replace("px","")),T=U.radius;if(l.horizontal?(F=H>=0?l.dimensions.value.axis.scale(0).center:l.dimensions.value.axis.scale(H).center,A=W+w,O=H>=0?l.dimensions.value.axis.scale(H).center-F:l.dimensions.value.axis.scale(0).center-F,k=g):(F=W+w,A=H>=0?l.dimensions.value.axis.scale(H).center:l.dimensions.value.axis.scale(0).center,k=H>=0?l.dimensions.value.axis.scale(0).center-A:l.dimensions.value.axis.scale(H).center-A,O=g),S){let j=U.field===C[_],Y=U.field===q[_],B={topLeft:0,topRight:0,bottomLeft:0,bottomRight:0};j&&(B.topLeft=S.topLeft,B.topRight=S.topRight),Y&&(B.bottomLeft=S.bottomLeft,B.bottomRight=S.bottomRight),H<0?T={to
131pLeft:B.bottomLeft,topRight:B.bottomRight,bottomLeft:B.topLeft,bottomRight:B.topRight}:T=B}l.horizontal?(O<I&&(H<0&&(F-=I-O),O=I),F=H>=0?F+L[_]:F-N[_]):(A=H>=0?A-L[_]:A+N[_],k<I&&(A-=I-k,k=I)),T=ls(T,H,l.horizontal);let M={x:F,y:A,width:O,height:k,path:()=>We(F,A,O,k,T)};H>=0?L[_]+=(l.horizontal?O:k)+E:N[_]+=(l.horizontal?O:k)+E,y.push(M)}),V[U.field]=y}return V},{})}}))})},get groupedSeries(){return a("groupedSeries",e+s,()=>l.groupsMetadata.map(o=>{let u={},d=[];return o.children.forEach(p=>{if(p.type==="bar"){if(!p.field)return;if(!l.data[0].hasOwnProperty(p.field)){console.warn(`ui-chart: series field "${p.field}" does not exist`);return}u[p.field]=l.data.map(b=>b[p.field]),d.push(p)}else if(p.type==="stack"){let b=[];if(p.children.forEach(f=>{if(f.type==="bar"){if(!f.field)return;if(!l.data[0].hasOwnProperty(f.field)){console.warn(`ui-chart: series field "${f.field}" does not exist`);return}u[f.field]=l.data.map(g=>g[f.field]),b.push(f)}}),b.length>0){let f={...p,children:b};d.push(f)}}}),{keys:d,values:u,bars(){let{start:p,center:b,width:f}=l.dimensions.index.axis.scale(l.dimensions.index.axis.domain[0],{area:l.dimensions.index.asArea}),g=o.width??"90%";g.match(/^(\d+)%$/)?g=f*Number(g.replace("%",""))/100:g=Number(g.replace("px",""));let w=(f-g)/2,E=o.gap??"2%";E.match(/^(\d+)%$/)?E=g*Number(E.replace("%",""))/100:E=Number(E.replace("px",""));let L=d.length,N=E*(L-1),S=L,C=d.reduce((U,y)=>(y.width&&(y.width.match(/^(\d+)%$/)?U+=g*Number(y.width.replace("%",""))/100:U+=Number(y.width.replace("px","")),S--),U),0),q=S>0?(g-C-N)/S:0;q===0&&(w=(f-(C+N))/2);let V=w;return d.reduce((U,y,H)=>{let _=q;if(y.width&&(y.width.match(/^(\d+)%$/)?_=g*Number(y.width.replace("%",""))/100:_=Number(y.width.replace("px",""))),H>0&&(V+=E),y.type==="bar"){let W=[];u[y.field].forEach((F,A)=>{let{start:O}=l.dimensions.index.axis.scale(l.data[A][l.dimensions.index.key],{area:l.dimensions.index.asArea}),k,I,T,M,j=Number(y.minHeight.replace("px","")),Y=y.radius;l.horizontal?(k=F>=0?l.dimensions.value.axis.scale(0).center:l.dimensions.value.axis.scale(F).center,I=O+V,T=F>=0?l.dimensions.value.axis.scale(F).center-k:l.dimensions.value.axis.scale(0).center-k,M=_,T<j&&(F<0&&(k-=j-T),T=j)):(k=O+V,I=F>=0?l.dimensions.value.axis.scale(F).center:l.dimensions.value.axis.scale(0).center,M=F>=0?l.dimensions.value.axis.scale(0).center-I:l.dimensions.value.axis.scale(F).center-I,T=_,M<j&&(I-=j-M,M=j)),Y=ls(Y,F,l.horizontal);let B={x:k,y:I,width:T,height:M,path:()=>We(k,I,T,M,Y)};W.push(B)}),U[y.field]=W}if(y.type==="stack"){let W=[],F=Number(y.gap.replace("px","")),A=[],O=[],k=y.radius,I=[],T=[];k&&y.children.forEach(M=>{M.type==="bar"&&u[M.field].forEach((j,Y)=>{j>=0?(I[Y]=M.field,T[Y]===void 0&&(T[Y]=M.field)):(T[Y]=M.field,I[Y]===void 0&&(I[Y]=M.field))})}),y.children.forEach(M=>{if(M.type==="bar"){let j=[];u[M.field].forEach((Y,B)=>{A[B]===void 0&&(A[B]=0,O[B]=0);let{start:Xt}=l.dimensions.index.axis.scale(l.data[B][l.dimensions.index.key],{area:l.dimensions.index.asArea}),et,wt,xt,pt,Vt=Number(M.minHeight.replace("px","")),Et=M.radius;if(l.horizontal?(et=Y>=0?l.dimensions.value.axis.scale(0).center:l.dimensions.value.axis.scale(Y).center,wt=Xt+V,xt=Y>=0?l.dimensions.value.axis.scale(Y).center-et:l.dimensions.value.axis.scale(0).center-et,pt=_):(et=Xt+V,wt=Y>=0?l.dimensions.value.axis.scale(Y).center:l.dimensions.value.axis.scale(0).center,pt=Y>=0?l.dimensions.value.axis.scale(0).center-wt:l.dimensions.value.axis.scale(Y).center-wt,xt=_),k){let $n=M.field===I[B],Bn=M.field===T[B],qt={topLeft:0,topRight:0,bottomLeft:0,bottomRight:0};$n&&(qt.topLeft=k.topLeft,qt.topRight=k.topRight),Bn&&(qt.bottomLeft=k.bottomLeft,qt.bottomRight=k.bottomRight),Y<0?Et={topLeft:qt.bottomLeft,topRight:qt.bottomRight,bottomLeft:qt.topLeft,bottomRight:qt.topRight}:Et=qt}l.horizontal?(xt<Vt&&(Y<0&&(et-=Vt-xt),xt=Vt),et=Y>=0?et+A[B]:et-O[B]):(pt<Vt&&(wt-=Vt-pt,pt=Vt),wt=Y>=0?wt-A[B]:wt+O[B]),Et=ls(Et,Y,l.horizontal);let Ot={x:et,y:wt,width:xt,height:pt,path:()=>We(et,wt,xt,pt,Et)};Y>=0?A[B]+=(l.horizontal?xt:pt)+F:O[B]+=(l.horizontal?xt:pt)+F,j.push(Ot)}),U[M.field]=j}})}return V+=_,U},{})}}}))},cursor(o,u="line"){if(u==="area")return this.horizontal?{x:this.dimensions.value.axis.scale(this.dimensions.value.axis.domain[0]).center,y:o.start,width:this.dimensions.value.axis.scale(this.dimensions.value.axis.domain[1]).center-this.dimensions.value.axis.scale(this.dimensions.value.axis.domain[0]).center,height:o.width}:{x:o.start,y:this.dimensions.value.axis.scale(this.dimensions.value.axis.domain[1]).center,width:o.width,height:this.dimensions.value.axis.scale(this.dimensions.value.axis.domain[0]).center-this.dimensions.value.axis.scale(this.dimensions.value.axis.domain[1]).center};if(this.horizontal){let c=o.center;return[{x:this.dimensions.value.axis.scale(this.dimensions.value.axis.domain[0]).center,y:c},{x:this.dimensions.value.axis.scale(this.dimensions.value.axis.domain[1]).center,y:c}]}let d=o.center;return[{x:d,y:this.dimensions.value.axis.scale(this.dimensions.value.axis.domain[0]).center},{x:d,y:this.dimensions.value.axis.scale(this.dimensions.value.axis.domain[1]).center}]},indexPosition(o,u){return this.horizontal?u:o},closestIndexPoint(o){return this.closestIndexPoints(o)[0]},closestIndexPoints(o){return a("closestIndexPoints",e+s+o,()=>{let u=[],d=1/0,c=null;
131return this.dimensions.index.points.forEach(p=>{let b=Math.abs(p.center-o);b<d&&(d=b,c=p)}),c&&u.push(c),u})},updateDimensions(o,u){this.width=o.width,this.height=o.height,this.inset=u,s++},updateData(o){let u=JSON.parse(JSON.stringify(o));u[0]!==void 0&&typeof u[0]!="object"&&(u=u.map((d,c)=>({value:d}))),u.every(d=>d.index)||u.forEach((d,c)=>{d.index=c}),this.data=u,e++}};return l.updateData(i.data),l}function ls(i,t,e){let s={...i};return t<0&&(s={topLeft:s.bottomLeft,topRight:s.bottomRight,bottomRight:s.topRight,bottomLeft:s.topLeft}),e&&(s={topLeft:s.bottomLeft,topRight:s.topLeft,bottomRight:s.topRight,bottomLeft:s.bottomRight}),s}function os(i,t){let e=[...new Set(t)];return i==="time"?Zo(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 In(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:l!=="min"&&!isNaN(Number(l))&&(r=Math.min(r,Number(l))),o!=="auto"&&o!=="max"&&!isNaN(Number(o))&&(a=Number(o));let u=Number(t.interval),d;if(t.interval==="auto"||Number.isNaN(u)){let f=(a-r)/(n-1),g=Math.pow(10,Math.floor(Math.log10(f))),w=f/g;w<1.5?d=1:w<3?d=2:w<7?d=5:d=10,d*=g}else d=u;let c;l==="auto"?c=Math.floor(r/d)*d:l==="min"?c=r:c=Number(l);let p=c;for(;p<=a+d*.1;)p>=r-d*.1&&s.push(p),p+=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 b=Number(o),f=s.length;s=Array.from({length:f},(g,w)=>c+(b-c)*(w/(f-1)))}if(s.length>n*2){let b=Math.ceil(s.length/n);s=s.filter((f,g)=>g%b===0)}}else if(t.type==="time"){let r=t.tickCount||i.length,[a,n]=Pn(e[0],e[1],r,t.interval,t.dimension.asArea);return n}else if(t.type==="categorical"&&(i.forEach(r=>{let a=r[t.dimension.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 Dn(i,t,e,s,r,a,n){let l=[];return t==="time"?(e||([e]=Pn(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 Go(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),p=t[0]+o*c,b=p+c/2,f=p+c;return{start:p,center:b,end:f,width:c}}if(r===1){let c=t[0]+(t[1]-t[0])/2;return{start:c,center:c,end:c,width:0}}let u=(t[1]-t[0])/(r-1),d=t[0]+o*u;return{start:d,center:d,end:d,width:0}}}function jo(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 Tn(i,t="x"){if(i.length<2)return"";let e=d=>d<0?-1:1,s=d=>t==="x"?{x:d[0],y:d[1]}:{x:d[1],y:d[0]},r=(d,c,p)=>{let{x:b,y:f}=s(d),{x:g,y:w}=s(c),{x:E,y:L}=s(p),N=g-b,S=E-g,C=(w-f)/(N||S<0&&-0),q=(L-w)/(S||N<0&&-0),V=(C*S+q*N)/(N+S);return(e(C)+e(q))*Math.min(Math.abs(C),Math.abs(q),.5*Math.abs(V))||0},a=(d,c,p)=>{let{x:b,y:f}=s(d),{x:g,y:w}=s(c),E=g-b;return E?(3*(w-f)/E-p)/2:p},n=`M${i[0][0]},${i[0][1]}`;if(i.length===2)return n+`L${i[1][0]},${i[1][1]}`;for(let d=0;d<i.length-2;d++){let c=i[d],p=i[d+1];if(c[0]===p[0]&&c[1]===p[1])continue;let b=i[d+2],f=r(c,p,b),{x:g}=s(c),{x:w}=s(p),E=(w-g)/3,L=d===0?a(c,p,f):i[d-1]?r(i[d-1],c,p):f,N=t==="x"?c[0]+E:c[0]+E*L,S=t==="x"?c[1]+E*L:c[1]+E,C=t==="x"?p[0]-E:p[0]-E*f,q=t==="x"?p[1]-E*f:p[1]-E;n+=`C${N},${S} ${C},${q} ${p[0]},${p[1]}`}let l=i.length,o=i[l-1],u=i[l-2];if(!(o[0]===u[0]&&o[1]===u[1])){let d=r(i[l-3],u,o),{x:c}=s(u),{x:p}=s(o),b=(p-c)/3,f=a(u,o,d),g=t==="x"?u[0]+b:u[0]+b*d,w=t==="x"?u[1]+b*d:u[1]+b,E=t==="x"?o[0]-b:o[0]-b*f,L=t==="x"?o[1]-b*f:o[1]-b;n+=`C${g},${w} ${E},${L} ${o[0]},${o[1]}`}return n}function Ko(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 Ln(i){return Ko(i,0)}
131function We(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,p=a>0,b=n>0,f=l>0,g=o>0,w=i,E=i+e,L="";return p?(L+=`M${w},${d+a}`,L+=`A${a},${a} 0 0 1 ${w+a},${d}`):L+=`M${w},${d}`,b?(L+=`H${E-n}`,L+=`A${n},${n} 0 0 1 ${E},${d+n}`):L+=`H${E}`,f?(L+=`V${c-l}`,L+=`A${l},${l} 0 0 1 ${E-l},${c}`):L+=`V${c}`,g?(L+=`H${w+o}`,L+=`A${o},${o} 0 0 1 ${w},${c-o}`):L+=`H${w}`,L+=`V${d+(p?a:0)}`,L+="Z",L}function Xo(i){return i instanceof Date||typeof i=="string"&&i.includes("-")&&!isNaN(Date.parse(i))}function Zo(i){return i.sort((t,e)=>typeof t=="string"?t.localeCompare(e):t-e),[us(i[0]),us(i[i.length-1])]}function Jo(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=us(u);if(isNaN(c.getTime()))return;if(a===0){let f=t[0]+n/2;return d?{start:t[0],center:f,end:t[1],width:n/o}:{start:f,center:f,end:f,width:0}}let p=(c.getTime()-s)/a;if(d){let f=Math.floor(p*o);f=Math.min(Math.max(0,f),o-1);let g=n/o,w=t[0]+f*g,E=w+g/2,L=w+g;return{start:w,center:E,end:L,width:g}}let b=t[0]+p*n;return{start:b,center:b,end:b,width:0}}}function Pn(i,t,e,s,r=!1){let a=i,n=t,u=(n-a)/1e3/60,d=u/60,c=d/24,p=c/30,b=c/365,f,g,w;switch(s){case"second":f={hour:"numeric",minute:"numeric",second:"numeric"},g=S=>new Date(Date.UTC(S.getUTCFullYear(),S.getUTCMonth(),S.getUTCDate(),S.getUTCHours(),S.getUTCMinutes(),S.getUTCSeconds()+1)),w=new Date(Date.UTC(a.getUTCFullYear(),a.getUTCMonth(),a.getUTCDate(),a.getUTCHours(),a.getUTCMinutes(),a.getUTCSeconds()));break;case"minute":f={hour:"numeric",minute:"numeric"},g=S=>new Date(Date.UTC(S.getUTCFullYear(),S.getUTCMonth(),S.getUTCDate(),S.getUTCHours(),S.getUTCMinutes()+1)),w=new Date(Date.UTC(a.getUTCFullYear(),a.getUTCMonth(),a.getUTCDate(),a.getUTCHours(),a.getUTCMinutes()));break;case"hour":f={hour:"numeric",minute:"numeric"},g=S=>new Date(Date.UTC(S.getUTCFullYear(),S.getUTCMonth(),S.getUTCDate(),S.getUTCHours()+1)),w=new Date(Date.UTC(a.getUTCFullYear(),a.getUTCMonth(),a.getUTCDate(),a.getUTCHours()));break;case"day":f={day:"numeric"},g=S=>new Date(Date.UTC(S.getUTCFullYear(),S.getUTCMonth(),S.getUTCDate()+1)),w=new Date(Date.UTC(a.getUTCFullYear(),a.getUTCMonth(),a.getUTCDate()));break;case"week":f={day:"numeric",month:"short"},g=S=>new Date(Date.UTC(S.getUTCFullYear(),S.getUTCMonth(),S.getUTCDate()+7)),w=new Date(Date.UTC(a.getUTCFullYear(),a.getUTCMonth(),a.getUTCDate()));break;case"month":f={month:"short",day:"numeric"},g=S=>new Date(Date.UTC(S.getUTCFullYear(),S.getUTCMonth()+1,1)),w=new Date(Date.UTC(a.getUTCFullYear(),a.getUTCMonth(),1));break;case"year":f={year:"numeric"},g=S=>new Date(Date.UTC(S.getUTCFullYear()+1,0,1)),w=new Date(Date.UTC(a.getUTCFullYear(),0,1));break;default:}if(!g)if(d<1){f={hour:"numeric",minute:"numeric"};let S=e?Math.max(1,Math.floor(u/(e-1))):1;g=C=>new Date(Date.UTC(C.getUTCFullYear(),C.getUTCMonth(),C.getUTCDate(),C.getUTCHours(),C.getUTCMinutes()+S)),w=new Date(Date.UTC(a.getUTCFullYear(),a.getUTCMonth(),a.getUTCDate(),a.getUTCHours()))}else if(c<1){f={hour:"numeric"};let S=e?Math.max(1,Math.floor(d/(e-1))):1;g=C=>new Date(Date.UTC(C.getUTCFullYear(),C.getUTCMonth(),C.getUTCDate(),C.getUTCHours()+S)),w=new Date(Date.UTC(a.getUTCFullYear(),a.getUTCMonth(),a.getUTCDate(),0))}else if(c<=7){f={weekday:"short",hour:"numeric"};let S=e?Math.max(1,Math.floor(d/(e-1))):6;g=C=>new Date(Date.UTC(C.getUTCFullYear(),C.getUTCMonth(),C.getUTCDate(),C.getUTCHours()+S)),w=new Date(Date.UTC(a.getUTCFullYear(),a.getUTCMonth(),a.getUTCDate(),0))}else if(c<=30){f={month:"short",day:"numeric"};let S=e?Math.max(1,Math.floor(c/(e-1))):1;g=C=>new Date(Date.UTC(C.getUTCFullYear(),C.getUTCMonth(),C.getUTCDate()+S)),w=new Date(Date.UTC(a.getUTCFullYear(),a.getUTCMonth(),a.getUTCDate()))}else if(p<=6){f={month:"short",day:"numeric"};let S=e?Math.max(1,Math.floor(c/(e-1))):7;g=C=>new Date(Date.UTC(C.getUTCFullYear(),C.getUTCMonth(),C.getUTCDate()+S)),w=new Date(Date.UTC(a.getUTCFullYear(),a.getUTCMonth(),a.getUTCDate()))}else if(b<2){f={month:"short"};let S=e?Math.max(1,Math.floor(p/(e-1))):1;g=C=>new Date(Date.UTC(C.getUTCFullYear(),C.getUTCMonth()+S,1)),w=new Date(Date.UTC(a.getUTCFullYear(),a.getUTCMonth()))}else{f={year:"numeric"};let S=e?Math.max(1,Math.floor(b/(e-1))):1;g=C=>new Date(Date.UTC(C.getUTCFullYear()+S,0,1)),w=new Date(Date.UTC(a.getUTCFullYear(),0,1))}let E=a;if(r){let S=g(w);for(;S<=a;)w=S,S=g(w);E=w}let L=[E],N=E;for(;N<=n;)N=g(N),N<=n&&L.push(new Date(N.getTime()));return[f,L]}function us(i){if(i instanceof Date)return i;let{year:t,month:e,day:s,hour:r,minute:a,second:n,millisecond:l}=Qo(i);return new Date(Date.UTC(t,e-1,s,r,a,n,l))}function Qo(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 Qr=class extends HTMLElement{constructor(){super(),this.querySelectorAll("[data-appended]").forEach(s=>s.remove());let t=this.querySelector('template[name="svg"]'),e=Ze(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 Zt,this._selectable={getState:()=>this._data,setState:_=>{this._data=_,this._observable.notify("data",this._data)}},this._controllable=new z(this),this._controllable.initial(_=>_&&this._selectable.setState(_)),this._controllable.getter(()=>this._selectable.getState()),this._controllable.setter(_=>{this._selectable.setState(_)}
131),this._initialized=!0);let s=this.hasAttribute("horizontal"),r=this.hasAttribute("locale")?this.getAttribute("locale"):Mi(),a=!1,n=!1,l=!1,o=!1,u={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(_=>{u.groups.push(_)}),t.content.querySelectorAll('template[name="stack"]:not(template[name="group"] template[name="stack"])').forEach(_=>{u.stacks.push(_)}),t.content.querySelectorAll('template[name="bar"]:not(template[name="stack"] template[name="bar"]):not(template[name="group"] template[name="bar"])').forEach(_=>{u.bars[_.getAttribute("field")]=_,a=!0}),t.content.querySelectorAll('template[name="line"]').forEach(_=>{u.lines[_.getAttribute("field")]=_,n=!0}),t.content.querySelectorAll('template[name="area"]').forEach(_=>{u.areas[_.getAttribute("field")]=_,l=!0}),t.content.querySelectorAll('template[name="point"]').forEach(_=>{u.points[_.getAttribute("field")]=_,o=!0});let d=()=>{},c=()=>{},p=()=>{},b=()=>{},f=null,g="line",w=null,E=null,L=null,N=[];t.content.querySelectorAll('template[name="stack"]:not(template[name="group"] template[name="stack"])').forEach(_=>{let W={width:_.getAttribute("width")??"90%",gap:_.getAttribute("gap")??"0",radius:_.hasAttribute("radius")?ke(_.getAttribute("radius")):null,children:[]};_.querySelectorAll('template[name="bar"]').forEach(F=>{let A={type:"bar",field:F.getAttribute("field"),width:F.getAttribute("width"),minHeight:F.getAttribute("min-height")??"0",radius:ke(F.getAttribute("radius")??"0")};W.children.push(A),a=!0}),N.push(W)});let S=[];t.content.querySelectorAll('template[name="group"]').forEach(_=>{let W={width:_.getAttribute("width")??"90%",gap:_.getAttribute("gap")??"2%",children:[]};_.querySelectorAll('template[name="stack"], template[name="bar"]:not(template[name="stack"] template[name="bar"])').forEach(F=>{let A={};F.getAttribute("name")==="stack"?(A={type:"stack",width:F.getAttribute("width"),gap:F.getAttribute("gap")??"0",radius:F.hasAttribute("radius")?ke(F.getAttribute("radius")):null,children:[]},F.querySelectorAll('template[name="bar"]').forEach(O=>{let k={type:"bar",field:O.getAttribute("field"),width:O.getAttribute("width"),minHeight:O.getAttribute("min-height")??"0",radius:ke(O.getAttribute("radius")??"0")};A.children.push(k),a=!0})):F.getAttribute("name")==="bar"&&(A={type:"bar",field:F.getAttribute("field"),width:F.getAttribute("width"),minHeight:F.getAttribute("min-height")??"0",radius:ke(F.getAttribute("radius")??"4 0")},a=!0),W.children.push(A)}),S.push(W)}),w=document.createElementNS("http://www.w3.org/2000/svg","rect"),w.setAttribute("data-overlay",""),w.setAttribute("fill","none"),w.setAttribute("pointer-events","all"),w.addEventListener("mousemove",Ss(function(_){d(_),c(_),p(_),b(_)},1)),w.addEventListener("mouseleave",()=>{d(null),c(null),p(null),b(null)}),e.appendChild(w),u.cursor&&(f=ft(u.cursor),f.setAttribute("data-cursor",""),e.appendChild(f));let C={left:8,right:8,top:8,bottom:8};if(u.svg?.hasAttribute("gutter")){let _=u.svg?.getAttribute("gutter").split(" ").map(W=>W.replace("px","")).map(Number);_.length===1?(C.top=_[0],C.right=_[0],C.bottom=_[0],C.left=_[0]):_.length===2?(C.top=_[0],C.right=_[1],C.bottom=_[0],C.left=_[1]):_.length===3?(C.top=_[0],C.right=_[1],C.bottom=_[2],C.left=_[1]):_.length===4&&(C.top=_[0],C.right=_[1],C.bottom=_[2],C.left=_[3])}let[q,V]=tu(e,a,s),U=e.parentElement.getBoundingClientRect();if(U.width===0||U.height===0){let _=new ResizeObserver(W=>{let F=W[0];F.contentRect.width>0&&F.contentRect.height>0&&(_.disconnect(),this.init(t,e))});_.observe(e.parentElement);return}u.tooltip&&(E=Ze(u.tooltip),u.tooltip.after(E)),u.summary&&(L=Ze(u.summary),u.summary.after(L));let y=Mn({horizontal:s,locale:r,data:this._data,stacksMetadata:N,groupsMetadata:S,width:U.width,height:U.height,inset:{left:0,right:0,top:0,bottom:0},dimensions:{index:{key:q,asArea:a||u.cursor?.innerHTML?.match(/type="([^"]+)"/)?.[1]==="area"},value:{keys:V,includeZero:a}},axes:{x:{format:u.axes.x.template?.hasAttribute("format")?JSON.parse(u.axes.x.template?.getAttribute("format")):null,scale:u.axes.x.template?.getAttribute("scale"),interval:u.axes.x.template?.getAttribute("interval"),position:u.axes.x.template?.getAttribute("position"),tickCount:u.axes.x.template?.getAttribute("tick-count")||u.axes.x.tickLabel?.getAttribute("target-tick-count"),tickStart:u.axes.x.template?.getAttribute("tick-start"),tickEnd:u.axes.x.template?.getAttribute("tick-end"),tickStep:u.axes.x.template?.getAttribute("tick-step")?Number(u.axes.x.template?.getAttribute("tick-step")):null,tickSuffix:u.axes.x.template?.getAttribute("tick-suffix"),tickPrefix:u.axes.x.template?.getAttribute("tick-prefix"),tickValues:u.axes.x.template?.hasAttribute("tick-values")?JSON.parse(u.axes.x.template?.getAttribute("tick-values")):null},y:{format:u.axes.y.template?.hasAttribute("format")?JSON.parse(u.axes.y.template?.getAttribute("format")):null,scale:u.axes.y.template?.getAttribute("scale"),interval:u.axes.y.template?.getAttribute("interval"),position:u.axes.y.template?.getAttribute("position"),tickCount:u.axes.y.template?.getAttribute("tick-count")||u.axes.y.tickLabel?.getAttribute("target-tick-count"),tickStart:u.axes.y.template?.getAttribute("tick-start"),tickEnd:u.axes.y.template?.getAttribute("tick-end"),tickStep:u.axes.y.template?.getAttribute("tick-step")?Number(u.axes.y.template?.getAttribute("tick-step")):null,tickSuffix:u.axes.y.template?.getAttribute("tick-suffix"),tickPrefix:u.axes.y.template?.getAttribute("tick-prefix"),tickValues:u.axes.y.template?.hasAttribute("tick-values")?JSON.parse(u.axes.y.template?.getAttribute("tick-values")):null}}}),H=(_=!0)=>
131{if(h(e,"viewBox",`0 0 ${y.width} ${y.height}`),y.data.length===0)return;if(y.data.length===1&&(n||l||!a&&!o)){console.warn("ui-chart: chart only has one data point so charts with lines or areas cannot be rendered.");return}if(y.data[0][y.dimensions.index.key]===void 0){console.warn(`ui-chart: axis field "${y.dimensions.index.key}" does not exist`);return}if(Object.entries(y.series).forEach(([A,O])=>{let k=e.querySelector(`[data-bar-group][data-series="${A}"]`),I=u.bars[A];if(I){let T=I.hasAttribute("width")?I.getAttribute("width"):"90%",M=ke(I.hasAttribute("radius")?I.getAttribute("radius"):"8 0"),j=I.hasAttribute("min-height")?Number(I.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",A),O.bars({barWidth:T,minHeight:j,radius:M}).forEach(Y=>{let B=ft(I);B.setAttribute("data-bar",""),B.setAttribute("data-series",A),B.setAttribute("d",Y.path(M)),k.appendChild(B)}),e.appendChild(k)}}),Object.entries(y.stackedSeries).forEach(([A,O])=>{let k=e.querySelector(`[data-stack][data-stack-index="${A}"]`),I=u.stacks[A];if(!I)return;k?.remove(),k=document.createElementNS("http://www.w3.org/2000/svg","g"),k.setAttribute("data-stack",""),k.setAttribute("data-stack-index",A);let T={bars:{}};I.querySelectorAll('template[name="bar"]').forEach(M=>{T.bars[M.getAttribute("field")]=M}),Object.entries(O.bars()).forEach(([M,j])=>{let Y=T.bars[M],B=document.createElementNS("http://www.w3.org/2000/svg","g");B.setAttribute("data-bar-group",""),B.setAttribute("data-series",M),j.forEac
131h(Xt=>{let et=ft(Y);et.setAttribute("data-bar",""),et.setAttribute("data-series",M),et.setAttribute("d",Xt.path()),B.appendChild(et)}),k.appendChild(B)}),e.appendChild(k)}),Object.entries(y.groupedSeries).forEach(([A,O])=>{let k=e.querySelector(`[data-group][data-group-index="${A}"]`),I=u.groups[A];if(!I)return;k?.remove(),k=document.createElementNS("http://www.w3.org/2000/svg","g"),k.setAttribute("data-group",""),k.setAttribute("data-group-index",A);let T={bars:{}};I.querySelectorAll('template[name="bar"]').forEach(M=>{T.bars[M.getAttribute("field")]=M}),Object.entries(O.bars()).forEach(([M,j])=>{let Y=T.bars[M],B=document.createElementNS("http://www.w3.org/2000/svg","g");B.setAttribute("data-bar-group",""),B.setAttribute("data-series",M),j.forEach(Xt=>{let et=ft(Y);et.setAttribute("data-bar",""),et.setAttribute("data-series",M),et.setAttribute("d",Xt.path()),B.appendChild(et)}),k.appendChild(B)}),e.appendChild(k)}),Object.entries(y.series).forEach(([A,O])=>{let k=e.querySelector(`[data-line][data-series="${A}"]`),I=u.lines[A];if(I){let T=I.getAttribute("curve")||"smooth";if(k)k.setAttribute("d",O.linePath(T));else{let M=ft(I);M.setAttribute("data-line",""),M.setAttribute("data-series",A),M.setAttribute("d",O.linePath(T)),e.appendChild(M)}}}),Object.entries(y.series).forEach(([A,O])=>{let k=e.querySelector(`[data-area][data-series="${A}"]`),I=u.areas[A];if(I){let T=I.getAttribute("curve")||"smooth";if(k)k.setAttribute("d",O.areaPath(T));else{let M=ft(I);M.setAttribute("data-area",""),M.setAttribute("data-series",A),M.setAttribute("d",O.areaPath(T)),e.appendChild(M)}}}),Object.entries(y.series).forEach(([A,O])=>
131{let k=e.querySelector(`[data-point-group][data-series="${A}"]`),I=u.points[A];I&&(e.querySelector(`[data-point-group][data-series="${A}"]`)?.remove(),k=document.createElementNS("http://www.w3.org/2000/svg","g"),k.setAttribute("data-point-group",""),k.setAttribute("data-series",A),O.points.forEach(T=>{if(!isFinite(T.x)||!isFinite(T.y))return;let M=ft(I);M.setAttribute("data-point",""),M.setAttribute("data-series",A),M.setAttribute("cx",T.x),M.setAttribute("cy",T.y),k.appendChild(M)}),e.appendChild(k))}),b=A=>{e.querySelectorAll("[data-point-group]").forEach(O=>{if(O.querySelectorAll("[data-point]").forEach(k=>k.removeAttribute("data-active")),A){let k=A.clientX-e.getBoundingClientRect().left,I=A.clientY-e.getBoundingClientRect().top;k>=y.inset.left&&k<=y.width-y.inset.right&&I>=y.inset.top&&I<=y.height-y.inset.bottom&&y.closestIndexPoints(y.indexPosition(k,I)).forEach(M=>{let j=y.data.indexOf(M.datum);O.querySelectorAll("[data-point]")[j]?.setAttribute("data-active","")})}else O.querySelectorAll("[data-point]").forEach(k=>k.removeAttribute("data-active"))})},u.axes.x.template){if(u.axes.x.axisLine){e.querySelector('[data-axis-line][data-axis="x"]')?.remove();let A=ft(u.axes.x.axisLine);A.setAttribute("data-axis-line",""),A.setAttribute("data-axis","x"),A.setAttribute("x1",y.axes.x.range[0]),A.setAttribute("x2",y.axes.x.range[1]);let O=y.axes.x.position==="bottom"?Math.max(...y.axes.y.range):Math.min(...y.axes.y.range);A.setAttribute("y1",O),A.setAttribute("y2",O),e.appendChild(A)}if(u.axes.x.gridLine){e.querySelector('[data-grid-line-group][data-axis="x"]')?.remove();let A=document.createElementNS("http://www.w3.org/2000/svg","g");A.setAttribute("data-grid-line-group",""),A.setAttribute("data-axis","x"),y.axes.x.ticks.forEach(({value:O})=>{let k=ft(u.axes.x.gridLine);k.setAttribute("data-grid-line",""),k.setAttribute("data-axis","x"),k.setAttribute("x1",y.axes.x.scale(O,{area:y.axes.x.dimension.asArea}).center),k.setAttribute("x2",y.axes.x.scale(O,{area:y.axes.x.dimension.asArea}
131).center),k.setAttribute("y1",y.inset.top),k.setAttribute("y2",y.height-y.inset.bottom),A.appendChild(k)}),e.appendChild(A)}if(u.axes.x.tickMark){e.querySelector('[data-tick-mark-group][data-axis="x"]')?.remove();let A=document.createElementNS("http://www.w3.org/2000/svg","g");A.setAttribute("data-tick-mark-group",""),A.setAttribute("data-axis","x"),y.axes.x.ticks.forEach(({value:O,label:k})=>{let I={x:y.axes.x.scale(O,{area:y.axes.x.dimension.asArea}).center,y:y.axes.x.position==="bottom"?Math.max(...y.axes.y.range):Math.min(...y.axes.y.range)},T=ft(u.axes.x.tickMark);T.setAttribute("data-tick-mark",""),T.setAttribute("data-axis","x"),T.setAttribute("transform",`translate(${I.x}, ${I.y})`),A.appendChild(T)}),e.appendChild(A)}if(u.axes.x.tickLabel){e.querySelector('[data-tick-label-group][data-axis="x"]')?.remove();let A=document.createElementNS("http://www.w3.org/2000/svg","g");A.setAttribute("data-tick-label-group",""),A.setAttribute("data-axis","x"),y.axes.x.ticks.forEach(({value:O,label:k})=>{let I={x:y.axes.x.scale(O,{area:y.axes.x.dimension.asArea}).center,y:y.axes.x.position==="bottom"?Math.max(...y.axes.y.range):Math.min(...y.axes.y.range)},T=ft(u.axes.x.tickLabel);T.querySelectorAll("slot").forEach(M=>M.replaceWith(document.createTextNode(k))),T.setAttribute("data-tick-label",""),T.setAttribute("data-axis","x"),T.setAttribute("transform",`translate(${I.x}, ${I.y})`),A.appendChild(T)}),e.appendChild(A),On(A,y.axes.x)}}if(u.axes.y.template){if(u.axes.y.axisLine){e.querySelector('[data-axis-line][data-axis="y"]')?.remove();let A=ft(u.axes.y.axisLine);A.setAttribute("data-axis-line",""),A.setAttribute("data-axis","y"),A.setAttribute("x1",y.axes.x.range[y.axes.y.position==="left"?0:1]),A.setAttribute("x2",y.axes.x.range[y.axes.y.position==="left"?0:1]),A.setAttribute("y1",y.axes.y.range[0]),A.setAttribute("y2",
131y.axes.y.range[1]),e.appendChild(A)}if(u.axes.y.gridLine){e.querySelector('[data-grid-line-group][data-axis="y"]')?.remove();let A=document.createElementNS("http://www.w3.org/2000/svg","g");A.setAttribute("data-grid-line-group",""),A.setAttribute("data-axis","y"),y.axes.y.ticks.forEach(({value:O,label:k})=>{let I={x:y.axes.x.range[0],y:y.axes.y.scale(O,{area:y.axes.y.dimension.asArea}).center},T=ft(u.axes.y.gridLine);T.setAttribute("data-grid-line",""),T.setAttribute("data-axis","y"),T.setAttribute("x1",y.inset.left),T.setAttribute("x2",y.width-y.inset.right),T.setAttribute("y1",I.y),T.setAttribute("y2",I.y),A.appendChild(T)}),e.appendChild(A)}if(u.axes.y.tickMark){e.querySelector('[data-tick-mark-group][data-axis="y"]')?.remove();let A=document.createElementNS("http://www.w3.org/2000/svg","g");A.setAttribute("data-tick-mark-group",""),A.setAttribute("data-axis","y"),y.axes.y.ticks.forEach(({value:O,label:k})=>{let I={x:y.axes.x.range[y.axes.y.position==="left"?0:1],y:y.axes.y.scale(O,{area:y.axes.y.dimension.asArea}).center},T=ft(u.axes.y.tickMark);T.setAttribute("data-tick-mark",""),T.setAttribute("data-axis","y"),T.setAttribute("transform",`translate(${I.x}, ${I.y})`),A.appendChild(T)}),e.appendChild(A)}if(u.axes.y.tickLabel){e.querySelector('[data-tick-label-group][data-axis="y"]')?.remove();let A=document.createElementNS("http://www.w3.org/2000/svg","g");A.setAttribute("data-tick-label-group",""),A.setAttribute("data-axis","y"),y.axes.y.ticks.forEach(({value:O,label:k})=>{let I={x:y.axes.x.range[y.axes.y.position==="left"?0:1],y:y.axes.y.scale(O,{area:y.axes.y.dimension.asArea}).center},T=ft(u.axes.y.tickLabel);T.querySelectorAll("slot").forEach(M=>M.replaceWith(document.createTextNode(k))),T.setAttribute("data-tick-label",""),T.setAttribute("data-axis","y"),T.setAttribute("transform",`translate(${I.x}, ${I.y})`),A.appendChild(T)}),e.appendChild(A),On(A,y.axes.y)}}if(e.querySelector("[data-zero-line]")?.remove(),u.zeroLine&&y.dimensions.value.axis.domain[0]<0&&y.dimensions.value.axis.domain[1]>0){let A=ft(u.zeroLine);A.setAttribute("data-zero-line",""),A.setAttribute("data-axis",y.dimensions.value.axis.axis);let{x1:O,x2:k,y1:I,y2:T}=y.dimensions.value.zeroLine();A.setAttribute("x1",O),A.setAttribute("x2",k),A.setAttribute("y1",I),A.setAttribute("y2",T),e.appendChild(A)}if(w&&(w.setAttribute("width",y.width),w.setAttribute("height",y.height),w.setAttribute("x",0),w.setAttribute("y",0)),f){g=f.getAttribute("type")??"line";let A=O=>{if(g==="area"){f.setAttribute("opacity","0.1");let{x:T,y:M,width:j,height:Y}=y.cursor(O,"area"),B=ke(f.getAttribute("radius")??"0");f.setAttribute("fill","currentColor"),f.setAttribute("stroke","none"),f.setAttribute("d",We(T,M,j,Y,B));return}f.setAttribute("opacity","1");let[k,I]=y.cursor(O);f.setAttribute("d",`M ${k.x} ${k.y} L ${I.x} ${I.y}`)};d=O=>{if(O){let k=e.getBoundingClientRect(),I=O.clientX-k.left,T=O.clientY-k.top;if(I>=y.inset.left&&I<=y.width-y.inset.right&&T>=y.inset.top&&T<=y.height-y.inset.bottom){let M=y.closestIndexPoint(y.indexPosition(I,T));A(M)}else f.setAttribute("opacity","0")}else f.setAttribute("opacity","0")}}E&&(c=A=>{if(A===null)x(E,"data-active");else{let O=A.clientX-e.getBoundingClientRect().left,k=A.clientY-e.getBoundingClientRect().top;if(O>=y.inset.left&&O<=y.width-y.inset.right&&k>=y.inset.top&&k<=y.height-y.inset.bottom){let I=y.closestIndexPoint(y.indexPosition(O,k));if(I){h(E,"data-active","");let T=E.getBoundingClientRect(),M=e.getBoundingClientRect(),j=y.horizontal?O:I.center,Y=y.horizontal?I.center:k,B=M.width-(j+T.width+15),Xt=M.height-(Y+T.height+15),et=B<0?j-T.width-15:j+15,wt=Xt<0?Y-T.height-15:Y+15;E.style.transform=`translate(${et}px, ${wt}px)`;let xt=u.tooltip.content.cloneNode(!0).firstElementChild;xt.querySelectorAll("slot").forEach(pt=>{let Vt=pt.getAttribute("field");if(Vt){let Et=pt.hasAttribute("format")?JSON.parse(pt.getAttribute("format")):null,Ot=I.datum[Vt];
131if(Et===null)return pt.textContent=Ot;Et={...Et,timeZone:"UTC"},Nn(Ot)?Ot=Number(Ot).toLocaleString(y.locale,Et):Fn(Ot)&&(Ot=new Date(Ot).toLocaleDateString(y.locale,Et)),pt.textContent=Ot}}),E.innerHTML=xt.innerHTML}else x(E,"data-active")}else x(E,"data-active")}}),L&&(p=A=>{let O=null;if(A!==null){let k=A.clientX-e.getBoundingClientRect().left,I=A.clientY-e.getBoundingClientRect().top;k>=y.inset.left&&k<=y.width-y.inset.right&&I>=y.inset.top&&I<=y.height-y.inset.bottom&&(O=y.closestIndexPoint(y.indexPosition(k,I)))}if(O=O||y.closestIndexPoint(y.dimensions.index.axis.range[1]),O){let k=u.summary.content.cloneNode(!0).firstElementChild;k.querySelectorAll("slot").forEach(I=>{let T=I.getAttribute("field");if(T){let M=I.hasAttribute("format")?JSON.parse(I.getAttribute("format")):{};M={...M,timeZone:"UTC"};let j=I.hasAttribute("fallback")&&A===null?I.getAttribute("fallback"):O.datum[T];Nn(j)?j=Number(j).toLocaleString(y.locale,M):Fn(j)&&(j=new Date(j).toLocaleString(y.locale,M)),I.textContent=j}}),L.innerHTML=k.innerHTML}},p(null)),e.appendChild(w),e.querySelectorAll("[data-grid-line-group]").forEach(A=>w.before(A)),e.querySelectorAll("[data-axis-line]").forEach(A=>w.before(A)),g==="area"&&e.querySelectorAll("[data-cursor]").forEach(A=>w.before(A));let W=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(A=>{let O=A.getAttribute("name"),k=A.getAttribute("field"),I;O==="group"?(I=e.querySelector(`[data-group][data-group-index="${W}"]`),W++):O==="stack"?(I=e.querySelector(`[data-stack][data-stack-index="${F}"]`),F++):O==="bar"?I=e.querySelector(`[data-bar-group][data-series="${k}
131"]`):O==="point"?I=e.querySelector(`[data-point-group][data-series="${k}"]`):I=e.querySelector(`[data-${O}][data-series="${k}"]`),I&&w.before(I)}),e.querySelectorAll("[data-zero-line]").forEach(A=>w.before(A)),g==="line"&&e.querySelectorAll("[data-cursor]").forEach(A=>w.before(A)),_){let A=Vn(e);eu(e,y,C,A),y.updateDimensions({width:y.width,height:y.height},{left:C.left+A.left,right:C.right+A.right,top:C.top+A.top,bottom:C.bottom+A.bottom}),H(!1)}};this._observable.subscribe("resize",()=>{let _=e.parentElement.getBoundingClientRect();_.width===0||_.height===0||(y.updateDimensions({width:_.width,height:_.height},{left:0,right:0,top:0,bottom:0}),H(),f&&f.setAttribute("opacity","0"))}),this._observable.subscribe("data",()=>{y.updateData(this._data),y.updateDimensions({width:y.width,height:y.height},{left:0,right:0,top:0,bottom:0}),H()}),new ResizeObserver(()=>{this._observable.notify("resize")}).observe(this),new MutationObserver(_=>{_.forEach(W=>{W.attributeName==="value"&&this._selectable.setState(this.hasAttribute("value")?JSON.parse(this.getAttribute("value")):[])})}).observe(this,{attributes:!0,attributeFilter:["value"]})}};customElements.define("ui-chart",Qr);function tu(i,t=!1,e=!1){let s=null,r=[];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(a=>{r.push(a.getAttribute("field")||"value")}),i.querySelectorAll(`template[name="axis"][axis="${e?"y":"x"}"]`).forEach(a=>{s=a.getAttribute("field")||"index"}),r=Array.from(new Set(r)),s===null&&(s="index"),r.length===0&&!t&&(r=["value"]),[s,r]}function ft(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 eu(i,t,e,s){let r=i.querySelector('[data-tick-label-group][data-axis="x"]');if(!r||t.axes.x.type!=="categorical"||ta(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=Rn(r),p=Vn(i);s.bottom=Math.max(s.bottom,p.bottom),c();return}}}function On(i,t){if(ta(i,t)){if(t.axis==="x"&&t.type==="categorical")Rn(i);else if(t.axis==="x"&&t.type==="time"){let e=iu(i);if(!ta(i,t))return;e(),su(i)}}}function ta(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 Rn(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 iu(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 su(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 Nn(i){return typeof i=="number"||typeof i=="string"&&!isNaN(Number(i))}function Fn(i){return i instanceof Date||typeof i=="string"&&!isNaN(Date.parse(i))}function Vn(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 ke(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=>
131isNaN(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 ea=class extends P{boot(){h(this,"role","button"),this._disableable=new R(this),this._disableable.onInitAndChange(t=>{t?x(this,"tabindex","0"):h(this,"tabindex","0")}),this._buttonType=this.getAttribute("type")||"button"}mount(){m(this,"keydown",t=>{t.key==="Enter"&&(t.preventDefault(),this.disabled||this.click()),t.key===" "&&t.preventDefault()}),m(this,"keyup",t=>{t.key===" "&&(t.preventDefault(),t.stopPropagation(),this.disabled||this.click())}),m(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()}};D("button",ea);var ia=class extends P{mount(){let t=this.querySelector("button,ui-button");m(t,"click",()=>{Di(this,s=>!!s._closeable)?._closeable?.close()})}};D("close",ia);var sa=class extends P{toasts=[];initiallyExpanded=!1;expanded=!1;hovered=!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");let e=()=>this.syncTimeouts();document.addEventListener("visibilitychange",e),this.onUnmount(()=>document.removeEventListener("visibilitychange",e))}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&&Es(()=>{n.timeout=null,o()},s);u&&(n.timeout=u,this.syncTimeouts()),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.toasts.length===0&&(this.expanded=!1,this.hovered=!1),this.updateList()},r.addEventListener("mouseenter",()=>{this.hovered=!0,this.syncTimeouts(),this.initiallyExpanded||(this.expanded=!0,this.updateList())}),r.addEventListener("mouseleave",()=>{this.hovered=!1,this.syncTimeouts(),this.initiallyExpanded||(this.expanded=!1,this.updateList())}),r._closeable=new kt(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()}syncTimeouts(){document.hidden||this.hovered?this.pauseTimeouts():this.resumeTimeouts()}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,this.hovered=!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}
131px`,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++}}},ra=class extends P{toastTimeout=null;hovered=!1;mount(){if(!this.closest("ui-toast-group")){h(this,"role","status");let t=s=>{s.key==="Escape"&&this.hideToast()};document.addEventListener("keydown",t);let e=()=>this.syncTimeout();document.addEventListener("visibilitychange",e),this.onUnmount(()=>{document.removeEventListener("keydown",t),document.removeEventListener("visibilitychange",e)}),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,this.toastTimeout=s!==0&&Es(()=>{this.toastTimeout=null,l()},s),a.destroyToast=()=>{this.toastTimeout?.cancel(),this.toastTimeout=null,this.hovered=!1,a.remove(),this.hidePopover()},a.addEventListener("mouseenter",()=>{this.hovered=!0,this.syncTimeout()}),a.addEventListener("mouseleave",()=>{this.hovered=!1,this.syncTimeout()}),this.syncTimeout(),a._closeable=new kt(a),a._closeable.onClose(()=>a.destroyToast())}hideToast(){let t=this.template().nextElementSibling;t&&t.destroyToast()}syncTimeout(){this.toastTimeout&&(document.hidden||this.hovered?this.toastTimeout.pause():this.toastTimeout.resume())}template(){return this.querySelector("template")}prepareToastTemplate(t){let e=t.slots||{},s=t.dataset||{},r=t.link||null,a=this.template();if(!a)return console.warn("ui-toast: no template element found",this);let n=a.content.cloneNode(!0).firstElementChild;return n.setAttribute("aria-atomic","true"),Object.entries(e).forEach(([l,o])=>{[null,void 0,!1].includes(o)||n.querySelectorAll(`slot[name="${l}"]`).forEach(u=>{u.replaceWith(document.createTextNode(o))})}),Object.entries(s).forEach(([l,o])=>{n.dataset[l]=o}),this.hydrateLinkTemplate(n,r),n.querySelectorAll("slot").forEach(l=>l.remove()),n}hydrateLinkTemplate(t,e){let s=t.querySelector('template[name="link"]');if(!s)return;if(!e){s.remove();return}let r=s.content.cloneNode(!0).firstElementChild;Object.entries(e).forEach(([a,n])=>{if(![null,void 0,!1].includes(n)&&a!=="text"){if(a==="navigate"&&n)return r.setAttribute("wire:navigate","");if(["href","target","rel","download"].includes(a)){if(a==="download"&&n===!0)return r.setAttribute(a,"");r.setAttribute(a,n)}}}),r.querySelectorAll('slot[name="text"]').forEach(a=>a.replaceWith(document.createTextNode(e.text||""))),s.replaceWith(r)}};D("toast-group",sa);D("toast",ra);var aa=class i extends Z{boot(){this._disableable=new R(this),this._disableable.onInitAndChange(t=>{this.walker().each(e=>{e.disabled=t})}),this._selectable=new ct(this),this._controllable=new z(this,{disabled:this._disabled,bubbles:!0}),this._focusable=new Mt(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=K(),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())}),m(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 it(this,(t,{skip:e,reject:s})=>{if(t instanceof i)return s();if(t.localName!=="ui-radio")return e()})}},na=class extends Z{boot(){let t=this;this._disableable=new R(this),this._selectable=new G(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 at(t,{disableable:this._disableable,tabbableAttr:"data-active"}),m(t,"click",this._disableable.disabled(e=>{e.preventDefault(),e.stopPropagation()}),{capture:!0}),m(t,"click",this._disableable.enabled(e=>{this._selectable.press()})),m(t,"keydown",this._disableable.enabled(e=>{e.key==="Enter"&&this.closest("form")?.requestSubmit()})),m(t,"keydown",this._disableable.enabled(e=>{e.key===" "&&(e.preventDefault(),e.stopPropagation())})),m(t,"keyup",this._disableable.enabled(e=>{e.key===" "&&(this._selectable.press(),e.preventDefault(),e.stopPropagation())})),ru(t),m(t,"focus",e=>{ce()&&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 ru(i){i.closest("label")?.addEventListener("click",t=>{i.contains(t.target)||i.click()})}D("radio-group",aa);D("radio",na);
131var la=class extends P{boot(){m(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")}};D("table-scroll-area",la);var hs=class i extends P{boot(){this._disabled=this.hasAttribute("disabled")}mount(){this.walkPanels(t=>qn(t)),new MutationObserver(t=>{this.walkPanels(e=>qn(e))}).observe(this,{childList:!0})}showPanel(t){this.walkPanels(e=>{e.getAttribute("name")===t?e.show():e.hide()})}selectPanel(t){for(let e of this.querySelectorAll("ui-tabs"))e.closest("ui-tab-group")===this&&e._selectableGroup?.setState(t)}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 cs)&&(t(r,a=>{e=!0,s=a}),e))break;return s}},oa=class extends P{boot(){m(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+"%")}},cs=class i extends Z{boot(){this._focusable=new Mt(this,{wrap:!0}),this._selectableGroup=new ct(this),this._controllable=new z(this,{disabled:this._disabled}),this._controllable.initial(e=>e&&this._selectableGroup.setState(e)),this._controllable.getter(()=>this._selectableGroup.getState());let t=K();this._controllable.setter(t(e=>{this._selectableGroup.setState(e)})),this._selectableGroup.onChange(t(()=>{this._controllable.dispatch()})),m(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")||(au(t),t._initialized=!0)})}walker(){return it(this,(t,{skip:e,reject:s})=>{if(t instanceof hs||t instanceof i)return s();if(!["a","button"].includes(t.localName))return e()})}};function au(i){i._disableable=new R(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=X(e,"tab");if(h(e,"role","tab"),e._focusable=new at(e,{disableable:i._disableable,tabbableAttr:"data-active"}),!t){let r=i.getAttribute("name");i._selectable=new G(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}),m(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")||(m(i,"pointerdown",()=>{clearTimeout(a),a=setTimeout(()=>a=null)}),m(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 qn(i){i._initialized||(X(i,"tab-panel"),h(i,"role","tabpanel"),i.hasAttribute("tabindex")||h(i,"tabindex","-1"),i.show=()=>{h(i,"data-selected",""),h(i,"tabindex","0"),x(i,"hidden")},i.hide=()=>{x(i,"data-selected"),h(i,"tabindex","-1"),h(i,"hidden",i.closest("ui-tab-group")?.hasAttribute("findable")?"until-found":"")},m(i,"beforematch",()=>{let t=i.closest("ui-tab-group");t?.hasAttribute("findable")&&t.selectPanel(i.getAttribute("name"))}),i._initialized=!0)}D("tab-group",hs);D("tabs-scroll-area",oa);D("tabs",cs);var ua=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]||"";
131this.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 z(this),this._controllable.initial(e=>e&&this.state.setValue(e)),this._controllable.getter(()=>this.state.getValue());let t=K();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 R(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,r;m(this.inputEls[e],"beforeinput",n=>{s=n.target.value,r=n.inputType==="insertText"&&n.data?.length===1?n.data:null}),m(this.inputEls[e],"input",n=>{n.stopPropagation();let l=n.target.value;if(l.length>1&&r&&(l=n.target.value=r),l.length>1){this.state.setValue(l),this.focusIndex(this.nextIndex()),n.preventDefault();return}if(l==""){this.state.reapply(),e<this.nextIndex()?this.focusIndex(e):this.focusPrev(e);return}if(this.invalidCharacters().test(l)){n.target.value=s,this.focusIndex(e);return}this.config.mode!=="numeric"&&(n.target.value=l.toUpperCase()),this.inputEls[e].blur(),this.state.notify(),this.focusNext(e)}),m(this.inputEls[e],"keydown",n=>{["Backspace","Delete","Clear"].includes(n.key)?n.target.value===""&&requestAnimationFrame(()=>this.focusPrev(e)):n.key==="ArrowRight"?(this.focusNext(e),n.preventDefault()):n.key==="ArrowLeft"&&(this.focusPrev(e),n.preventDefault())});let a;m(this.inputEls[e],"pointerdown",n=>{a=n.pointerType,n.pointerType==="mouse"&&(this.focusIndex(Math.min(e,this.nextIndex())),n.preventDefault())}),m(this.inputEls[e],"click",n=>{if(a==="mouse")return;let l=Math.min(e,this.nextIndex());document.activeElement===this.inputEls[l]?requestAnimationFrame(()=>this.inputEls[l].setSelectionRange(0,1)):this.focusIndex(l)}),m(this.inputEls[e],"focus",n=>{n.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}"`)}}};D("otp",ua);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.link&&(a.link=n.link),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()}}
131)),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()}}))});!_a()&&!Ca()&&Ia();})();

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.