PageSourceSearch

https://app.gowinston.ai/flux/flux.min.js?id=505e8a75

js gowinston.ai collected 2026-09-24 08:36:38 UTC 334,403 bytes, 131 lines download raw bytes

1(()=>{var Ti=class extends Event{oldState;newState;constructor(i,{oldState:t="",newState:e="",...s}={}){super(i,s),this.oldState=String(t||""),this.newState=String(e||"")}},Aa=new WeakMap;function _a(i,t,e){Aa.set(i,setTimeout(()=>{Aa.has(i)&&i.dispatchEvent(new Ti("toggle",{cancelable:!1,oldState:t,newState:e}))},0))}var Is=globalThis.ShadowRoot||function(){},il=globalThis.HTMLDialogElement||function(){},Ei=new WeakMap,jt=new WeakMap,ii=new WeakMap;function ki(i){return ii.get(i)||"hidden"}var _i=new WeakMap;function sl(i){let t=i.popoverTargetElement;if(!(t instanceof HTMLElement))return;let e=ki(t);i.popoverTargetAction==="show"&&e==="showing"||i.popoverTargetAction==="hide"&&e==="hidden"||(e==="showing"?ei(t,!0,!0):me(t,!1)&&(_i.set(t,i),Cs(t)))}function me(i,t){return!(i.popover!=="auto"&&i.popover!=="manual"||!i.isConnected||t&&ki(i)!=="showing"||!t&&ki(i)!=="hidden"||i instanceof il&&i.hasAttribute("open")||document.fullscreenElement===i)}function xa(i){return i?Array.from(jt.get(i.ownerDocument)||[]).indexOf(i)+1:0}function rl(i){let t=Ca(i),e=al(i);return xa(t)>xa(e)?t:e}function Ci(i){let t=jt.get(i);for(let e of t||[])if(!e.isConnected)t.delete(e);else return e;return null}function Fe(i){return typeof i.getRootNode=="function"?i.getRootNode():i.parentNode?Fe(i.parentNode):i}function Ca(i){for(;i;){if(i instanceof HTMLElement&&i.popover==="auto"&&ii.get(i)==="showing")return i;if(i=i instanceof Element&&i.assignedSlot||i.parentElement||Fe(i),i instanceof Is&&(i=i.host),i instanceof Document)return}}function al(i){for(;i;){let t=i.popoverTargetElement;if(t instanceof HTMLElement)return t;if(i=i.parentElement||Fe(i),i instanceof Is&&(i=i.host),i instanceof Document)return}}function nl(i){let t=new Map,e=0;for(let a of jt.get(i.ownerDocument)||[])t.set(a,e),e+=1;t.set(i,e),e+=1;let s=null;function r(a){let n=Ca(a);if(n===null)return null;let l=t.get(n);(s===null||t.get(s)<l)&&(s=n)}return r(i.parentElement||Fe(i)),s}function ll(i){return i.hidden||i instanceof Is||(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 ol(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(ll(r))return r;r=s.nextNode()}}function ul(i){ol(i)?.focus()}var Ii=new WeakMap;function Cs(i){if(!me(i,!1))return;let t=i.ownerDocument;if(!i.dispatchEvent(new Ti("beforetoggle",{cancelable:!0,oldState:"closed",newState:"open"}))||!me(i,!1))return;let e=!1;if(i.popover==="auto"){let r=i.getAttribute("popover"),a=nl(i)||t;if(Di(a,!1,!0),r!==i.getAttribute("popover")||!me(i,!1))return}Ci(t)||(e=!0),Ii.delete(i);let s=t.activeElement;i.classList.add(":popover-open"),ii.set(i,"showing"),Ei.has(t)||Ei.set(t,new Set),Ei.get(t).add(i),ul(i),i.popover==="auto"&&(jt.has(t)||jt.set(t,new Set),jt.get(t).add(i),Ia(_i.get(i),!0)),e&&s&&i.popover==="auto"&&Ii.set(i,s),_a(i,"closed","open")}function ei(i,t=!1,e=!1){if(!me(i,!0))return;let s=i.ownerDocument;if(i.popover==="auto"&&(Di(i,t,e),!me(i,!0))||(Ia(_i.get(i),!1),_i.delete(i),e&&(i.dispatchEvent(new Ti("beforetoggle",{oldState:"open",newState:"closed"})),!me(i,!0))))return;Ei.get(s)?.delete(i),jt.get(s)?.delete(i),i.classList.remove(":popover-open"),ii.set(i,"hidden"),e&&_a(i,"open","closed");let r=Ii.get(i);r&&(Ii.delete(i),t&&r.focus())}function Sa(i,t=!1,e=!1){let s=Ci(i);for(;s;)ei(s,t,e),s=Ci(i)}function Di(i,t,e){let s=i.ownerDocument||i;if(i instanceof Document)return Sa(s,t,e);let r=null,a=!1;for(let n of jt.get(s)||[])if(n===i)a=!0;else if(a){r=n;break}if(!a)return Sa(s,t,e);for(;r&&ki(r)==="showing"&&jt.get(s)?.size;)ei(r,t,e)}var Es=new WeakMap;function Ea(i){if(!i.isTrusted)return;let t=i.composedPath()[0];if(!t)return;let e=t.ownerDocument;if(!Ci(e))return;let r=rl(t);if(r&&i.type==="pointerdown")Es.set(e,r);else if(i.type==="pointerup"){let a=Es.get(e)===r;Es.delete(e),a&&Di(r||e,!1,!0)}}var ks=new WeakMap;function Ia(i,t=!1){if(!i)return;ks.has(i)||ks.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=ks.get(i);s?i.setAttribute("aria-expanded",s):i.removeAttribute("aria-expanded")}}var ka=globalThis.ShadowRoot||function(){};function hl(){return typeof HTMLElement<"u"&&typeof HTMLElement.prototype=="object"&&"popover"in HTMLElement.prototype}function be(i,t,e){let s=i[t];Object.defineProperty(i,t,{value(r){return s.call(this,e(r))}})}var cl=/(^|[^\\]):popover-open\b/g;function dl(){return typeof globalThis.CSSLayerBlockRule=="function"}function fl(){let i=dl();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 Ne=null;function _s(i){let t=fl();if(Ne===null)try{Ne=new CSSStyleSheet,Ne.replaceSync(t)}catch{Ne=!1}if(Ne===!1){let e=document.createElement("style");e.textContent=t,i instanceof Document?i.head.prepend(e):i.prepend(e)}else i.adoptedStyleSheets=[Ne,...i.adoptedStyleSheets]}function pl(){if(typeof window>"u")return;window.ToggleEvent=window.ToggleEvent||Ti;function i(o){return o?.includes(":popover-open")&&(o=o.replace(cl,"$1.\\:popover-open")),o}be(Document.prototype,"querySelector",i),be(Document.prototype,"querySelectorAll",i),be(Element.prototype,"querySelector",i),be(Element.prototype,"querySelectorAll",i),be(Element.prototype,"matches",i),be(Element.prototype,"closest",i),be(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(){Cs(this)}},hidePopover:{enumerable:!0,configurable:!0,value(){ei(this,!0,!0)}},togglePopover:{enumerable:!0,configurable:!0,value(o){ii.get(this)==="showing"&&o===void 0||o===!1?ei(this,!0,!0):(o===void 0||o===!0)&&Cs(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 _s(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&&_s(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=Fe(this),c=this.getAttribute("popovertarget");return(d instanceof Document||d instanceof ka)&&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=Fe(d);if(!(c instanceof ka||c instanceof Document))return;let p=u.find(b=>b.matches?.("[popovertargetaction],[popovertarget]"));if(p){sl(p),o.preventDefault();return}},n=o=>{let u=o.key,d=o.target;!o.defaultPrevented&&d&&(u==="Escape"||u==="Esc")&&Di(d.ownerDocument,!0,!0)};(o=>{o.addEventListener("click",a),o.addEventListener("keydown",n),o.addEventListener("pointerdown",Ea),o.addEventListener("pointerup",Ea)})(document),_s(document)}hl()||pl();var Fi=class extends Event{oldState;newState;constructor(i,{oldState:t="",newState:e="",...s}={}){super(i,s),this.oldState=String(t||""),this.newState=String(e||"")}},Ta=new WeakMap;function Oa(i,t,e){Ta.set(i,setTimeout(()=>{Ta.has(i)&&i.dispatchEvent(new Fi("toggle",{cancelable:!1,oldState:t,newState:e}))},0))}var Ps=globalThis.ShadowRoot||function(){},bl=globalThis.HTMLDialogElement||function(){},Li=new WeakMap,Kt=new WeakMap,ri=new WeakMap;function Mi(i){return ri.get(i)||"hidden"}var Pi=new WeakMap;function ml(i){let t=i.popoverTargetElement;if(!(t instanceof HTMLElement))return;let e=Mi(t);i.popoverTargetAction==="show"&&e==="showing"||i.popoverTargetAction==="hide"&&e==="hidden"||(e==="showing"?si(t,!0,!0):ve(t,!1)&&(Pi.set(t,i),Ms(t)))}function ve(i,t){return!(i.popover!=="auto"&&i.popover!=="manual"||!i.isConnected||t&&Mi(i)!=="showing"||!t&&Mi(i)!=="hidden"||i instanceof bl&&i.hasAttribute("open")||document.fullscreenElement===i)}function Da(i){return i?Array.from(Kt.get(i.ownerDocument)||[]).indexOf(i)+1:0}function gl(i){let t=Na(i),e=vl(i);return Da(t)>Da(e)?t:e}function Oi(i){let t=Kt.get(i);for(let e of t||[])if(!e.isConnected)t.delete(e);else return e;return null}function Ve(i){return typeof i.getRootNode=="function"?i.getRootNode():i.parentNode?Ve(i.parentNode):i}function Na(i){for(;i;){if(i instanceof HTMLElement&&i.popover==="auto"&&ri.get(i)==="showing")return i;if(i=i instanceof Element&&i.assignedSlot||i.parentElement||Ve(i),i instanceof Ps&&(i=i.host),i instanceof Document)return}}function vl(i){for(;i;){let t=i.popoverTargetElement;if(t instanceof HTMLElement)return t;if(i=i.parentElement||Ve(i),i instanceof Ps&&(i=i.host),i instanceof Document)return}}function yl(i){let t=new Map,e=0;for(let a of Kt.get(i.ownerDocument)||[])t.set(a,e),e+=1;t.set(i,e),e+=1;let s=null;function r(a){let n=Na(a);if(n===null)return null;let l=t.get(n);(s===null||t.get(s)<l)&&(s=n)}return r(i.parentElement||Ve(i)),s}function wl(i){return i.hidden||i instanceof Ps||(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 Al(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(wl(r))return r;r=s.nextNode()}}
63function xl(i){Al(i)?.focus()}var Ni=new WeakMap;function Ms(i){if(!ve(i,!1))return;let t=i.ownerDocument;if(!i.dispatchEvent(new Fi("beforetoggle",{cancelable:!0,oldState:"closed",newState:"open"}))||!ve(i,!1))return;let e=!1;if(i.popover==="auto"){let r=i.getAttribute("popover"),a=yl(i)||t;if(Ri(a,!1,!0),r!==i.getAttribute("popover")||!ve(i,!1))return}Oi(t)||(e=!0),Ni.delete(i);let s=t.activeElement;i.classList.add(":popover-open"),ri.set(i,"showing"),Li.has(t)||Li.set(t,new Set),Li.get(t).add(i),xl(i),i.popover==="auto"&&(Kt.has(t)||Kt.set(t,new Set),Kt.get(t).add(i),Fa(Pi.get(i),!0)),e&&s&&i.popover==="auto"&&Ni.set(i,s),Oa(i,"closed","open")}function si(i,t=!1,e=!1){if(!ve(i,!0))return;let s=i.ownerDocument;if(i.popover==="auto"&&(Ri(i,t,e),!ve(i,!0))||(Fa(Pi.get(i),!1),Pi.delete(i),e&&(i.dispatchEvent(new Fi("beforetoggle",{oldState:"open",newState:"closed"})),!ve(i,!0))))return;Li.get(s)?.delete(i),Kt.get(s)?.delete(i),i.classList.remove(":popover-open"),ri.set(i,"hidden"),e&&Oa(i,"open","closed");let r=Ni.get(i);r&&(Ni.delete(i),t&&r.focus())}function La(i,t=!1,e=!1){let s=Oi(i);for(;s;)si(s,t,e),s=Oi(i)}function Ri(i,t,e){let s=i.ownerDocument||i;if(i instanceof Document)return La(s,t,e);let r=null,a=!1;for(let n of Kt.get(s)||[])if(n===i)a=!0;else if(a){r=n;break}if(!a)return La(s,t,e);for(;r&&Mi(r)==="showing"&&Kt.get(s)?.size;)si(r,t,e)}var Ts=new WeakMap;function Ma(i){if(!i.isTrusted)return;let t=i.composedPath()[0];if(!t)return;let e=t.ownerDocument;if(!Oi(e))return;let r=gl(t);if(r&&i.type==="pointerdown")Ts.set(e,r);else if(i.type==="pointerup"){let a=Ts.get(e)===r;Ts.delete(e),a&&Ri(r||e,!1,!0)}}var Ds=new WeakMap;function Fa(i,t=!1){if(!i)return;Ds.has(i)||Ds.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=Ds.get(i);s?i.setAttribute("aria-expanded",s):i.removeAttribute("aria-expanded")}}var Pa=globalThis.ShadowRoot||function(){};function Ra(){return typeof HTMLElement<"u"&&typeof HTMLElement.prototype=="object"&&"popover"in HTMLElement.prototype}function Va(){return!!(document.body?.showPopover&&!/native code/i.test(document.body.showPopover.toString()))}function ge(i,t,e){let s=i[t];Object.defineProperty(i,t,{value(r){return s.call(this,e(r))}})}var Sl=/(^|[^\\]):popover-open\b/g;function El(){return typeof globalThis.CSSLayerBlockRule=="function"}function kl(){let i=El();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 Re=null;function Ls(i){let t=kl();if(Re===null)try{Re=new CSSStyleSheet,Re.replaceSync(t)}catch{Re=!1}if(Re===!1){let e=document.createElement("style");e.textContent=t,i instanceof Document?i.head.prepend(e):i.prepend(e)}else i.adoptedStyleSheets=[Re,...i.adoptedStyleSheets]}function $a(){if(typeof window>"u")return;window.ToggleEvent=window.ToggleEvent||Fi;function i(o){return o?.includes(":popover-open")&&(o=o.replace(Sl,"$1.\\:popover-open")),o}ge(Document.prototype,"querySelector",i),ge(Document.prototype,"querySelectorAll",i),ge(Element.prototype,"querySelector",i),ge(Element.prototype,"querySelectorAll",i),ge(Element.prototype,"matches",i),ge(Element.prototype,"closest",i),ge(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(){Ms(this)}},hidePopover:{enumerable:!0,configurable:!0,value(){si(this,!0,!0)}},togglePopover:{enumerable:!0,configurable:!0,value(o){ri.get(this)==="showing"&&o===void 0||o===!1?si(this,!0,!0):(o===void 0||o===!0)&&Ms(this)}}});let t=Element.prototype.attachShadow;t&&Object.defineProperties(Element.prototype,{attachShadow:{enumerable:!0,configurable:!0,writable:!0,value(o){let u=t.call(this,o);return Ls(u),u}}});let e=HTMLElement.prototype.attachInternals;e&&Object.defineProperties(HTMLElement.prototype,{attachInternals:{enumerable:!0,configurable:!0,writable:!0,value(){let o=e.call(this);return o.shadowRoot&&Ls(o.shadowRoot),o}}});let s=new WeakMap;function r(o){Object.defineProperties(o.prototype,{popoverTargetElement:{enumerable:!0,configurable:!0,set(u){if(u===null)this.removeAttribute("popovertarget"),s.delete(this);else if(u instanceof Element)this.setAttribute("popovertarget",""),s.set(this,u);else throw new TypeError("popoverTargetElement must be an element or null")},get(){if(this.localName!=="button"&&this.localName!=="input"||this.localName==="input"&&this.type!=="reset"&&this.type!=="image"&&this.type!=="button"||this.disabled||this.form&&this.type==="submit")return null;let u=s.get(this);if(u&&u.isConnected)return u;if(u&&!u.isConnected)return s.delete(this),null;let d=Ve(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=Ve(d);if(!(c instanceof Pa||c instanceof Document))return;let p=u.find(b=>b.matches?.("[popovertargetaction],[popovertarget]"));if(p){ml(p),o.preventDefault();return}},n=o=>{let u=o.key,d=o.target;!o.defaultPrevented&&d&&(u==="Escape"||u==="Esc")&&Ri(d.ownerDocument,!0,!0)};(o=>{o.addEventListener("click",a),o.addEventListener("keydown",n),o.addEventListener("pointerdown",Ma),o.addEventListener("pointerup",Ma)})(document),Ls(document)}var Vi;function ai(i){let t=i({css:(e,...s)=>`@layer base { ${e.raw[0]+s.join("")} }`});if(document.adoptedStyleSheets===void 0){let e=document.createElement("style");e.textContent=t,document.head.appendChild(e);return}Vi===void 0&&(Vi=new CSSStyleSheet,document.adoptedStyleSheets=[...document.adoptedStyleSheets,Vi]),Vi.insertRule(t)}function $i(i,t){let e=i;for(;e;){if(t(e))return e;e=e.parentElement}}function lt(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 Os(e)}var Os=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 I(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 Ba(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 qi(i,t){let e;return function(){let s=this,r=arguments;e||(i.apply(s,r),e=!0,setTimeout(()=>e=!1,t))}}function Ns(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 ni="pointer";document.addEventListener("keydown",()=>ni="keyboard",{capture:!0});document.addEventListener("pointerdown",i=>{ni=i.pointerType==="mouse"?"mouse":"touch"},{capture:!0});document.addEventListener("pointermove",i=>{ni=i.pointerType==="mouse"?"mouse":"touch"},{capture:!0});function ye(){return ni==="keyboard"}function Bi(){return ni==="touch"}function Ui(i,t){let e="",s=Pl(()=>{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 _l(i,t){return"lofi-"+(t?t+"-":"")+Math.random().toString(16).slice(2)}function et(i,t){let e=i.hasAttribute("id")?i.getAttribute("id"):_l(i,t);return h(i,"id",e),i._x_bindings||(i._x_bindings={}),i._x_bindings.id||(i._x_bindings.id=e),e}function J(){let i=!1;return t=>(...e)=>{if(!i){i=!0;try{t(...e)}finally{i=!1}}}}function Be(i,t,{gain:e,lose:s,focusable:r,useSafeArea:a}){let n=!1,l=v=>{ye()&&(i.contains(v.target)||t.contains(v.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=v=>{Bi()||n||(n=!0,e(),setTimeout(()=>{let{safeArea:x,redraw:C,remove:O}=a?Cl(i,t,v.clientX,v.clientY):Ml();u=O;let E,M=qi(B=>{let V=t.getBoundingClientRect(),Y=i.getBoundingClientRect(),N;switch(x.contains(B.target)&&Il(Y,V,B.clientX,B.clientY)?N="safeArea":t.contains(B.target)?N="panel":i.contains(B.target)?N="trigger":N="outside",E&&clearTimeout(E),N){case"outside":c();break;case"trigger":C(B.clientX,B.clientY);break;case"panel":u();break;case"safeArea":C(B.clientX,B.clientY),E=setTimeout(()=>{c()},300);break;default:break}},100);document.addEventListener("pointermove",M),d=()=>document.removeEventListener("pointermove",M)}))};i.addEventListener("pointerenter",b);let f=()=>{i.removeEventListener("pointerenter",b)};return{clear:p,remove:()=>{p(),f(),o()}}}function Cl(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,v,x,C,O=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)-O,g=Math.max(n.bottom,a.bottom)+O,v=g-f,x=u-f,C=`polygon(0% 0%, 100% ${x}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)-O,g=Math.max(n.bottom,a.bottom)+O,v=g-f,x=u-f,C=`polygon(0% ${x}px, 100% 0%, 100% 100%)`;break;case"up":c=Math.min(o,a.left)-O,p=Math.max(o,a.right)+O,b=p-c,f=a.bottom,g=Math.max(a.bottom,u)+5,v=g-f,x=o-c,C=`polygon(0% 0%, 100% 0%, ${x}px 100%)`;break;case"down":c=Math.min(o,a.left)-O,p=Math.max(o,a.right)+O,b=p-c,f=Math.min(a.top,u)-5,g=a.top,v=g-f,x=o-c,C=`polygon(${x}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=`${v}px`,r.style.clipPath=C};return{safeArea:r,redraw:(o,u)=>{r.isConnected||i.appendChild(r),l(o,u)},remove:()=>{r.remove()}}}function Il(i,t,e,s){return!Tl(i,e,s)&&!Dl(t,e,s)}function Tl(i,t,e){return i.left<=t&&t<=i.right&&i.top<=e&&e<=i.bottom}function Dl(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=Ua(i,[t])),i._durableAttributeObserver.hasAttribute(t)||i._durableAttributeObserver.addAttribute(t),i._durableAttributeObserver.pause(()=>{i.setAttribute(t,e)})}function At(i,t){w(i,t),Ll(i,t)}function w(i,t){i._durableAttributeObserver===void 0&&(i._durableAttributeObserver=Ua(i,[t])),i._durableAttributeObserver.hasAttribute(t)||i._durableAttributeObserver.addAttribute(t),i._durableAttributeObserver.pause(()=>{i.removeAttribute(t)})}function Ll(i,t){i?._durableAttributeObserver?.hasAttribute(t)&&i._durableAttributeObserver.releaseAttribute(t)}function Ua(i,t){let e=r=>{r.forEach(a=>{a.oldValue===null?i._durableAttributeObserver.pause(()=>w(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 Ml(){return{safeArea:{contains:()=>!1},redraw:()=>{},remove:()=>{}}}function Pl(i,t){let e;return(...s)=>{clearTimeout(e),e=setTimeout(()=>{i(...s)},t)}}var $e=0,qe=!1;ai(({css:i})=>i`[data-flux-allow-scroll] { pointer-events: auto; }`);function ft(i=null,t=!1,e=[]){if(t)return{lock:()=>{},unlock:()=>{}};let s=(a=!1)=>{qa(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})`,Ol(document.documentElement,n),a&&(h(i,"data-flux-allow-scroll",""),e.forEach(l=>{h(l,"data-flux-allow-scroll","")}),qe=!0)},r=(a=!1)=>{qa(document.documentElement),a&&(At(i,"data-flux-allow-scroll"),e.forEach(n=>{w(n,"data-flux-allow-scroll")}),qe=!1)};return{lock(){$e++,!($e>1&&i!==null&&qe)&&s(i!==null&&!qe)},unlock(){$e=Math.max(0,$e-1),!($e>0&&i!==null&&!qe)&&(r(i!==null&&qe),$e>0&&s(!1))}}}function Ol(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 qa(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 Fs(i,t,e){let s=i.style[t];return i.style[t]=e,()=>{i.style[t]=s}}function ne(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")):(w(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 Wi(){return navigator?.language||document.documentElement.lang||"en-US"}function Wa(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:{}})=>li(i,r));
125return s=Array.isArray(s)?s:[s],s.reverse().forEach(r=>{i.after(r)}),{cleanup:e}}function li(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 mt(i){return getComputedStyle(i).direction==="rtl"}function Ha(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)&&!navigator.userAgent.includes("CriOS")&&!navigator.userAgent.includes("FxiOS")}function Ya(){return/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream}var Xt=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 L=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}},it=class extends L{};var rt=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=L.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 $i(this.el,t=>t[this.groupedByType.name])?.use(this.groupedByType)}on(t,e){return m(this.el,t,e)}},Wt=class extends rt{constructor(t,e={}){super(t,e)}walker(){return lt(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 G=class extends rt{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 Rs=null;document.addEventListener("mousedown",i=>Rs=i);var le=class extends rt{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)||Rs&&za(r,Rs)&&za(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&&Ha()&&!this.el.hasAttribute("autofocus")&&this.el.querySelectorAll("[autofocus]").length===0&&setTimeout(()=>{this.el.setAttribute("tabindex","-1"),this.el.focus(),this.el.blur()})})}};function za(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 Pt=class extends rt{boot(){this.onCloses=[]}onClose(t){this.onCloses.push(t)}close(){this.onCloses.forEach(t=>t())}};var Vs=class extends L{boot(){this.querySelectorAll("[data-appended]").forEach(l=>l.remove()),this._controllable=new G(this,{disabled:this.hasAttribute("disabled")});let t=this.button(),e=this.dialog();if(!e)return;e._dialogable=new le(e,{clickOutside:!this.hasAttribute("disable-click-outside"),escape:!this.hasAttribute("disable-escape")}),e._closeable=new Pt(e),e._closeable.onClose(()=>e._dialogable.hide()),this._controllable.initial(l=>l&&e._dialogable.show()),this._controllable.getter(()=>e._dialogable.getState());let s=J();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","")):(w(this,"data-open"),t?.removeAttribute("data-open"),w(e,"data-open"))};e._dialogable.onChange(()=>r()),r();let{lock:a,unlock:n}=ft();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}=ft();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()}};ai(({css:i})=>i`dialog, ::backdrop { margin: auto; }`);I("modal",Vs);var Zt=class extends Wt{groupOfType=ot;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(ot).activate()}activateBySearch(t){this.filterAwareWalker().find(s=>s.textContent.toLowerCase().trim().startsWith(t.toLowerCase()))?.use(ot).activate()}activateSelectedOrFirst(t){if(!t||(s=>s.matches("ui-option, ui-option-create")?getComputedStyle(s).display==="none":!1)(t)){this.filterAwareWalker().first()?.use(ot).activate();return}t?.use(ot).activate()}activateActiveOrFirst(){let t=this.getActive();if(!t){this.filterAwareWalker().first()?.use(ot).activate();return}t?.use(ot).activate()}activateActiveOrLast(){let t=this.getActive();if(!t){this.filterAwareWalker().last()?.use(ot).activate();return}t?.use(ot).activate()}activatePrev(){let t=this.getActive();if(!t){this.filterAwareWalker().last()?.use(ot).activate();return}let e;this.options.wrap?e=this.filterAwareWalker().prevOrLast(t):e=this.filterAwareWalker().prev(t),e?.use(ot).activate()}activateNext(){let t=this.getActive();if(!t){this.filterAwareWalker().first()?.use(ot).activate();return}let e;this.options.wrap?e=this.filterAwareWalker().nextOrFirst(t):e=this.filterAwareWalker().next(t),e?.use(ot).activate()}getActive(){return this.walker().find(t=>t.use(ot).isActive())}clearActive(){this.getActive()?.use(ot).deactivate()}filterAwareWalker(){let t=e=>e.matches("ui-option, ui-option-create")?getComputedStyle(e).display==="none":!1;return lt(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()})}},ot=class i extends rt{groupedByType=Zt;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",""),ye()&&this.el.scrollIntoView({block:"nearest"}),this.group()&&this.group().activated(this.el))}deactivate(t=!0){w(this.el,"data-active"),t&&this.group()&&this.group().activated(this.el)}isActive(){return this.el.hasAttribute("data-active")}};var we=class extends Wt{groupOfType=Ht;boot({options:t}){t({}),this.onChanges=[],this.lastSearch=""}onChange(t){this.onChanges.push(t)}filter(t){t===""?this.walker().each(e=>{e.use(Ht).unfilter()}):this.walker().each(e=>{this.matches(e,t)?e.use(Ht).unfilter():e.use(Ht).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))||this.normalize(t.getAttribute("keywords")).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(Ht).isFiltered())}},Ht=class extends rt{groupedByType=we;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||(w(this.el,"data-hidden"),this.options().mirror&&w(this.options().mirror,"data-hidden",""))}isFiltered(){return this.el.hasAttribute("data-hidden")}};var Jt=new Map,ct=class extends rt{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){Nl(this.el,e);let a=new AbortController,n=document.activeElement,l=[...this.triggers,n];setTimeout(()=>{Fl(this.el,l,a),Rl(this.el,l,a),Vl(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")Jt.has(e)||Jt.set(e,new Set),Jt.get(e).add(this.el);else if(s.newState==="closed"){if(!Jt.has(e))return;Jt.get(e).delete(this.el),Jt.get(e).size===0&&Jt.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 Nl(i,t){Jt.has(t)&&Jt.get(t).forEach(e=>{i.contains(e)||e.contains(i)||e.hidePopover()})}function Fl(i,t,e){document.addEventListener("click",s=>{i.contains(s.target)||t.includes(s.target)||i.hidePopover()},{signal:e.signal})}function Rl(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 Vl(i,t,e){document.addEventListener("keydown",s=>{s.key==="Escape"&&i.hidePopover()},{signal:e.signal})}var F=class extends rt{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 Ga=["top","right","bottom","left"];var oe=Math.min,xt=Math.max,ui=Math.round,hi=Math.floor,Ot=i=>({x:i,y:i}),$l={left:"right",right:"left",bottom:"top",top:"bottom"},ql={start:"end",end:"start"};function $s(i,t,e){return xt(i,oe(t,e))}function Ae(i,t){return typeof i=="function"?i(t):i}function Qt(i){return i.split("-")[0]}function Ue(i){return i.split("-")[1]}function qs(i){return i==="x"?"y":"x"}function Bs(i){return i==="y"?"height":"width"}function ue(i){return["top","bottom"].includes(Qt(i))?"y":"x"}function Us(i){return qs(ue(i))}function ja(i,t,e){e===void 0&&(e=!1);let s=Ue(i),r=Us(i),a=Bs(r),n=r==="x"?s===(e?"end":"start")?"right":"left":s==="start"?"bottom":"top";return t.reference[a]>t.floating[a]&&(n=oi(n)),[n,oi(n)]}function Ka(i){let t=oi(i);return[Hi(i),t,Hi(t)]}function Hi(i){return i.replace(/start|end/g,t=>ql[t])}function Bl(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 Xa(i,t,e,s){let r=Ue(i),a=Bl(Qt(i),e==="start",s);return r&&(a=a.map(n=>n+"-"+r),t&&(a=a.concat(a.map(Hi)))),a}function oi(i){return i.replace(/left|right|bottom|top/g,t=>$l[t])}function Ul(i){return{top:0,right:0,bottom:0,left:0,...i}}function Za(i){return typeof i!="number"?Ul(i):{top:i,right:i,bottom:i,left:i}}function xe(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 Ja(i,t,e){let{reference:s,floating:r}=i,a=ue(t),n=Us(t),l=Bs(n),o=Qt(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(Ue(t)){case"start":b[n]-=p*(e&&u?-1:1);break;case"end":b[n]+=p*(e&&u?-1:1);break}return b}var en=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}=Ja(u,s,o),p=s,b={},f=0;for(let g=0;g<l.length;g++){let{name:v,fn:x}=l[g],{x:C,y:O,data:E,reset:M}=await x({x:d,y:c,initialPlacement:s,placement:p,strategy:r,middlewareData:b,rects:u,platform:n,elements:{reference:i,floating:t}});d=C??d,c=O??c,b={...b,[v]:{...b[v],...E}},M&&f<=50&&(f++,typeof M=="object"&&(M.placement&&(p=M.placement),M.rects&&(u=M.rects===!0?await n.getElementRects({reference:i,floating:t,strategy:r}):M.rects),{x:d,y:c}=Ja(u,p,o)),g=-1)}return{x:d,y:c,placement:p,strategy:r,middlewareData:b}};async function We(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}=Ae(t,i),f=Za(b),v=l[p?c==="floating"?"reference":"floating":c],x=xe(await a.getClippingRect({element:(e=await(a.isElement==null?void 0:a.isElement(v)))==null||e?v:v.contextElement||await(a.getDocumentElement==null?void 0:a.getDocumentElement(l.floating)),boundary:u,rootBoundary:d,strategy:o})),C=c==="floating"?{x:s,y:r,width:n.floating.width,height:n.floating.height}:n.reference,O=await(a.getOffsetParent==null?void 0:a.getOffsetParent(l.floating)),E=await(a.isElement==null?void 0:a.isElement(O))?await(a.getScale==null?void 0:a.getScale(O))||{x:1,y:1}:{x:1,y:1},M=xe(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:C,offsetParent:O,strategy:o}):C);return{top:(x.top-M.top+f.top)/E.y,bottom:(M.bottom-x.bottom+f.bottom)/E.y,left:(x.left-M.left+f.left)/E.x,right:(M.right-x.right+f.right)/E.x}}var sn=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,...v}=Ae(i,t);
vendor: 5,901 bytes, line 125
125if((e=a.arrow)!=null&&e.alignmentOffset)return{};let x=Qt(r),C=ue(l),O=Qt(l)===l,E=await(o.isRTL==null?void 0:o.isRTL(u.floating)),M=p||(O||!g?[oi(l)]:Ka(l)),B=f!=="none";!p&&B&&M.push(...Xa(l,g,f,E));let V=[l,...M],Y=await We(t,v),N=[],U=((s=a.flip)==null?void 0:s.overflows)||[];if(d&&N.push(Y[x]),c){let X=ja(r,n,E);N.push(Y[X[0]],Y[X[1]])}if(U=[...U,{placement:r,overflows:N}],!N.every(X=>X<=0)){var $,q;let X=((($=a.flip)==null?void 0:$.index)||0)+1,st=V[X];if(st)return{data:{index:X,overflows:U},reset:{placement:st}};let A=(q=U.filter(Z=>Z.overflows[0]<=0).sort((Z,K)=>Z.overflows[1]-K.overflows[1])[0])==null?void 0:q.placement;if(!A)switch(b){case"bestFit":{var z;let Z=(z=U.filter(K=>{if(B){let H=ue(K.placement);return H===C||H==="y"}return!0}).map(K=>[K.placement,K.overflows.filter(H=>H>0).reduce((H,bt)=>H+bt,0)]).sort((K,H)=>K[1]-H[1])[0])==null?void 0:z[0];Z&&(A=Z);break}case"initialPlacement":A=l;break}if(r!==A)return{reset:{placement:A}}}return{}}}};function Qa(i,t){return{top:i.top-t.height,right:i.right-t.width,bottom:i.bottom-t.height,left:i.left-t.width}}function tn(i){return Ga.some(t=>i[t]>=0)}var rn=function(i){return i===void 0&&(i={}),{name:"hide",options:i,async fn(t){let{rects:e}=t,{strategy:s="referenceHidden",...r}=Ae(i,t);switch(s){case"referenceHidden":{let a=await We(t,{...r,elementContext:"reference"}),n=Qa(a,e.reference);return{data:{referenceHiddenOffsets:n,referenceHidden:tn(n)}}}case"escaped":{let a=await We(t,{...r,altBoundary:!0}),n=Qa(a,e.floating);return{data:{escapedOffsets:n,escaped:tn(n)}}}default:return{}}}}};async function Wl(i,t){let{placement:e,platform:s,elements:r}=i,a=await(s.isRTL==null?void 0:s.isRTL(r.floating)),n=Qt(e),l=Ue(e),o=ue(e)==="y",u=["left","top"].includes(n)?-1:1,d=a&&o?-1:1,c=Ae(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 an=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 Wl(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}}}}},nn=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:v=>{let{x,y:C}=v;return{x,y:C}}},...o}=Ae(i,t),u={x:e,y:s},d=await We(t,o),c=ue(Qt(r)),p=qs(c),b=u[p],f=u[c];if(a){let v=p==="y"?"top":"left",x=p==="y"?"bottom":"right",C=b+d[v],O=b-d[x];b=$s(C,b,O)}if(n){let v=c==="y"?"top":"left",x=c==="y"?"bottom":"right",C=f+d[v],O=f-d[x];f=$s(C,f,O)}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 ln=function(i){return i===void 0&&(i={}),{name:"size",options:i,async fn(t){var e,s;let{placement:r,rects:a,platform:n,elements:l}=t,{apply:o=()=>{},...u}=Ae(i,t),d=await We(t,u),c=Qt(r),p=Ue(r),b=ue(r)==="y",{width:f,height:g}=a.floating,v,x;c==="top"||c==="bottom"?(v=c,x=p===(await(n.isRTL==null?void 0:n.isRTL(l.floating))?"start":"end")?"left":"right"):(x=c,v=p==="end"?"top":"bottom");let C=g-d.top-d.bottom,O=f-d.left-d.right,E=oe(g-d[v],C),M=oe(f-d[x],O),B=!t.middlewareData.shift,V=E,Y=M;if((e=t.middlewareData.shift)!=null&&e.enabled.x&&(Y=O),(s=t.middlewareData.shift)!=null&&s.enabled.y&&(V=C),B&&!p){let U=xt(d.left,0),$=xt(d.right,0),q=xt(d.top,0),z=xt(d.bottom,0);b?Y=f-2*(U!==0||$!==0?U+$:xt(d.left,d.right)):V=g-2*(q!==0||z!==0?q+z:xt(d.top,d.bottom))}await o({...t,availableWidth:Y,availableHeight:V});let N=await n.getDimensions(l.floating);return f!==N.width||g!==N.height?{reset:{rects:!0}}:{}}}};function Yi(){return typeof window<"u"}function Se(i){return un(i)?(i.nodeName||"").toLowerCase():"#document"}function Et(i){var t;return(i==null||(t=i.ownerDocument)==null?void 0:t.defaultView)||window}function Nt(i){var t;return(t=(un(i)?i.ownerDocument:i.document)||window.document)==null?void 0:t.documentElement}function un(i){return Yi()?i instanceof Node||i instanceof Et(i).Node:!1}function Dt(i){return Yi()?i instanceof Element||i instanceof Et(i).Element:!1}function Ft(i){return Yi()?i instanceof HTMLElement||i instanceof Et(i).HTMLElement:!1}function on(i){return!Yi()||typeof ShadowRoot>"u"?!1:i instanceof ShadowRoot||i instanceof Et(i).ShadowRoot}function Ye(i){let{overflow:t,overflowX:e,overflowY:s,display:r}=Lt(i);return/auto|scroll|overlay|hidden|clip/.test(t+s+e)&&!["inline","contents"].includes(r)}function hn(i){return["table","td","th"].includes(Se(i))}function ci(i){return[":popover-open",":modal"].some(t=>{try{return i.matches(t)}catch{return!1}})}function zi(i){let t=Gi(),e=Dt(i)?Lt(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 cn(i){let t=te(i);for(;Ft(t)&&!Ee(t);){if(zi(t))return t;if(ci(t))return null;t=te(t)}return null}function Gi(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Ee(i){return["html","body","#document"].includes(Se(i))}function Lt(i){return Et(i).getComputedStyle(i)}function di(i){return Dt(i)?{scrollLeft:i.scrollLeft,scrollTop:i.scrollTop}:{scrollLeft:i.scrollX,scrollTop:i.scrollY}}function te(i){if(Se(i)==="html")return i;let t=i.assignedSlot||i.parentNode||on(i)&&i.host||Nt(i);return on(t)?t.host:t}function dn(i){let t=te(i);return Ee(t)?i.ownerDocument?i.ownerDocument.body:i.body:Ft(t)&&Ye(t)?t:dn(t)}function He(i,t,e){var s;
vendor: 3,858 bytes, line 125
125t===void 0&&(t=[]),e===void 0&&(e=!0);let r=dn(i),a=r===((s=i.ownerDocument)==null?void 0:s.body),n=Et(r);if(a){let l=ji(n);return t.concat(n,n.visualViewport||[],Ye(r)?r:[],l&&e?He(l):[])}return t.concat(r,He(r,[],e))}function ji(i){return i.parent&&Object.getPrototypeOf(i.parent)?i.frameElement:null}function bn(i){let t=Lt(i),e=parseFloat(t.width)||0,s=parseFloat(t.height)||0,r=Ft(i),a=r?i.offsetWidth:e,n=r?i.offsetHeight:s,l=ui(e)!==a||ui(s)!==n;return l&&(e=a,s=n),{width:e,height:s,$:l}}function Hs(i){return Dt(i)?i:i.contextElement}function ze(i){let t=Hs(i);if(!Ft(t))return Ot(1);let e=t.getBoundingClientRect(),{width:s,height:r,$:a}=bn(t),n=(a?ui(e.width):e.width)/s,l=(a?ui(e.height):e.height)/r;return(!n||!Number.isFinite(n))&&(n=1),(!l||!Number.isFinite(l))&&(l=1),{x:n,y:l}}var Hl=Ot(0);function mn(i){let t=Et(i);return!Gi()||!t.visualViewport?Hl:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Yl(i,t,e){return t===void 0&&(t=!1),!e||t&&e!==Et(i)?!1:t}function ke(i,t,e,s){t===void 0&&(t=!1),e===void 0&&(e=!1);let r=i.getBoundingClientRect(),a=Hs(i),n=Ot(1);t&&(s?Dt(s)&&(n=ze(s)):n=ze(i));let l=Yl(a,e,s)?mn(a):Ot(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=Et(a),b=s&&Dt(s)?Et(s):s,f=p,g=ji(f);for(;g&&s&&b!==f;){let v=ze(g),x=g.getBoundingClientRect(),C=Lt(g),O=x.left+(g.clientLeft+parseFloat(C.paddingLeft))*v.x,E=x.top+(g.clientTop+parseFloat(C.paddingTop))*v.y;o*=v.x,u*=v.y,d*=v.x,c*=v.y,o+=O,u+=E,f=Et(g),g=ji(f)}}return xe({width:d,height:c,x:o,y:u})}function Ys(i,t){let e=di(i).scrollLeft;return t?t.left+e:ke(Nt(i)).left+e}function gn(i,t,e){e===void 0&&(e=!1);let s=i.getBoundingClientRect(),r=s.left+t.scrollLeft-(e?0:Ys(i,s)),a=s.top+t.scrollTop;return{x:r,y:a}}function zl(i){let{elements:t,rect:e,offsetParent:s,strategy:r}=i,a=r==="fixed",n=Nt(s),l=t?ci(t.floating):!1;if(s===n||l&&a)return e;let o={scrollLeft:0,scrollTop:0},u=Ot(1),d=Ot(0),c=Ft(s);if((c||!c&&!a)&&((Se(s)!=="body"||Ye(n))&&(o=di(s)),Ft(s))){let b=ke(s);u=ze(s),d.x=b.x+s.clientLeft,d.y=b.y+s.clientTop}let p=n&&!c&&!a?gn(n,o,!0):Ot(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 Gl(i){return Array.from(i.getClientRects())}function jl(i){let t=Nt(i),e=di(i),s=i.ownerDocument.body,r=xt(t.scrollWidth,t.clientWidth,s.scrollWidth,s.clientWidth),a=xt(t.scrollHeight,t.clientHeight,s.scrollHeight,s.clientHeight),n=-e.scrollLeft+Ys(i),l=-e.scrollTop;return Lt(s).direction==="rtl"&&(n+=xt(t.clientWidth,s.clientWidth)-r),{width:r,height:a,x:n,y:l}}function Kl(i,t){let e=Et(i),s=Nt(i),r=e.visualViewport,a=s.clientWidth,n=s.clientHeight,l=0,o=0;if(r){a=r.width,n=r.height;let u=Gi();(!u||u&&t==="fixed")&&(l=r.offsetLeft,o=r.offsetTop)}return{width:a,height:n,x:l,y:o}}function Xl(i,t){let e=ke(i,!0,t==="fixed"),s=e.top+i.clientTop,r=e.left+i.clientLeft,a=Ft(i)?ze(i):Ot(1),n=i.clientWidth*a.x,l=i.clientHeight*a.y,o=r*a.x,u=s*a.y;return{width:n,height:l,x:o,y:u}}function fn(i,t,e){let s;if(t==="viewport")s=Kl(i,e);else if(t==="document")s=jl(Nt(i));else if(Dt(t))s=Xl(t,e);else{let r=mn(i);s={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return xe(s)}function vn(i,t){let e=te(i);return e===t||!Dt(e)||Ee(e)?!1:Lt(e).position==="fixed"||vn(e,t)}function Zl(i,t){let e=t.get(i);if(e)return e;let s=He(i,[],!1).filter(l=>Dt(l)&&Se(l)!=="body"),r=null,a=Lt(i).position==="fixed",n=a?te(i):i;for(;Dt(n)&&!Ee(n);){let l=Lt(n),o=zi(n);!o&&l.position==="fixed"&&(r=null),(a?!o&&!r:!o&&l.position==="static"&&!!r&&["absolute","fixed"].includes(r.position)||Ye(n)&&!o&&vn(i,n))?s=s.filter(d=>d!==n):r=l,n=te(n)}return t.set(i,s),s}function Jl(i){let{element:t,boundary:e,rootBoundary:s,strategy:r}=i,n=[...e==="clippingAncestors"?ci(t)?[]:Zl(t,this._c):[].concat(e),s],l=n[0],o=n.reduce((u,d)=>{let c=fn(t,d,r);
125return u.top=xt(c.top,u.top),u.right=oe(c.right,u.right),u.bottom=oe(c.bottom,u.bottom),u.left=xt(c.left,u.left),u},fn(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}=bn(i);return{width:t,height:e}}function to(i,t,e){let s=Ft(t),r=Nt(t),a=e==="fixed",n=ke(i,!0,a,t),l={scrollLeft:0,scrollTop:0},o=Ot(0);if(s||!s&&!a)if((Se(t)!=="body"||Ye(r))&&(l=di(t)),s){let p=ke(t,!0,a,t);o.x=p.x+t.clientLeft,o.y=p.y+t.clientTop}else r&&(o.x=Ys(r));let u=r&&!s&&!a?gn(r,l):Ot(0),d=n.left+l.scrollLeft-o.x-u.x,c=n.top+l.scrollTop-o.y-u.y;return{x:d,y:c,width:n.width,height:n.height}}function Ws(i){return Lt(i).position==="static"}function pn(i,t){if(!Ft(i)||Lt(i).position==="fixed")return null;if(t)return t(i);let e=i.offsetParent;return Nt(i)===e&&(e=e.ownerDocument.body),e}function yn(i,t){let e=Et(i);if(ci(i))return e;if(!Ft(i)){let r=te(i);for(;r&&!Ee(r);){if(Dt(r)&&!Ws(r))return r;r=te(r)}return e}let s=pn(i,t);for(;s&&hn(s)&&Ws(s);)s=pn(s,t);return s&&Ee(s)&&Ws(s)&&!zi(s)?e:s||cn(i)||e}var eo=async function(i){let t=this.getOffsetParent||yn,e=this.getDimensions,s=await e(i.floating);return{reference:to(i.reference,await t(i.floating),i.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function io(i){return Lt(i).direction==="rtl"}var so={convertOffsetParentRelativeRectToViewportRelativeRect:zl,getDocumentElement:Nt,getClippingRect:Jl,getOffsetParent:yn,getElementRects:eo,getClientRects:Gl,getDimensions:Ql,getScale:ze,isElement:Dt,isRTL:io};function wn(i,t){return i.x===t.x&&i.y===t.y&&i.width===t.width&&i.height===t.height}function ro(i,t){let e=null,s,r=Nt(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=hi(c),g=hi(r.clientWidth-(d+p)),v=hi(r.clientHeight-(c+b)),x=hi(d),O={rootMargin:-f+"px "+-g+"px "+-v+"px "+-x+"px",threshold:xt(0,oe(1,o))||1},E=!0;function M(B){let V=B[0].intersectionRatio;if(V!==o){if(!E)return n();V?n(!1,V):s=setTimeout(()=>{n(!1,1e-7)},1e3)}V===1&&!wn(u,i.getBoundingClientRect())&&n(),E=!1}try{e=new IntersectionObserver(M,{...O,root:r.ownerDocument})}catch{e=new IntersectionObserver(M,O)}e.observe(i)}return n(!0),a}function An(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=Hs(i),d=r||a?[...u?He(u):[],...He(t)]:[];d.forEach(x=>{r&&x.addEventListener("scroll",e,{passive:!0}),a&&x.addEventListener("resize",e)});let c=u&&l?ro(u,e):null,p=-1,b=null;n&&(b=new ResizeObserver(x=>{let[C]=x;C&&C.target===u&&b&&(b.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var O;(O=b)==null||O.observe(t)})),e()}),u&&!o&&b.observe(u),b.observe(t));let f,g=o?ke(i):null;o&&v();function v(){let x=ke(i);g&&!wn(g,x)&&e(),g=x,f=requestAnimationFrame(v)}return e(),()=>{var x;d.forEach(C=>{r&&C.removeEventListener("scroll",e),a&&C.removeEventListener("resize",e)}),c?.(),(x=b)==null||x.disconnect(),b=null,o&&cancelAnimationFrame(f)}}var xn=an;var Sn=nn,En=sn,kn=ln,_n=rn;var Cn=(i,t,e)=>{let s=new Map,r={platform:so,...e},a={...r.platform,_c:s};return en(i,t,{...r,platform:a})};var In=!(CSS.supports?.("selector(:popover-open)")??!1),nt=class extends rt{boot({options:t}){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]=lo(this.el,{scrollY:this.options().scrollY}),r=ao(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=An(this.options().reference,this.el,r):r(null,...n)},this.cleanup=()=>{a(),s()}}};function ao(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)=>{Cn(t,i,{strategy:In?"fixed":"absolute",placement:no(s,i),middleware:[xn({mainAxis:Number(a),alignmentAxis:Number(r)}),En(),Sn({padding:5,crossAxis:l}),kn({padding:5,apply({rects:f,elements:g,availableHeight:v}){n&&Object.assign(g.floating.style,{width:`${f.reference.width}px`});let x=d;x===null&&(x=o?g.floating.scrollHeight:g.floating.offsetHeight),g.floating.style.maxHeight=v>x?"":`${v}px`}}),...u?[_n({strategy:"referenceHidden"})]:[]]}).then(({x:f,y:g,middlewareData:v})=>
125{if(v.hide?.referenceHidden){u();return}e(p||f,b||g)})}}function no(i,t){let e=i.split(" ");switch(e[0]){case"start":e[0]=mt(t)?"right":"left";break;case"end":e[0]=mt(t)?"left":"right";break}return e.join("-")}function lo(i,{scrollY:t=!0}){let e=(o,u,d,c)=>{Object.assign(i.style,{position:In?"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 Ki=class extends L{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=fi(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=fi(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=fi(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=fi(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=fi(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=()=>{}}}},Xi=class extends L{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 fi(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}
125"]`)).forEach(n=>n.replaceWith(typeof r=="string"?document.createTextNode(r):r))}),e.firstElementChild}var yt=class extends Wt{groupOfType=j;boot({options:t}){t({multiple:!1}),this.state=this.options().multiple?new Set:null,this.onChanges=[]}onInitAndChange(t){t(),this.onChanges.push(t)}onChange(t){this.onChanges.push(t)}changed(t,e=!1){if(t.ungrouped)return;let s=t.value,r=t.isSelected(),a=this.options().multiple;r?a?this.state.add(s):this.state=s:a?this.state.delete(s):this.state=null,e||this.onChanges.forEach(n=>n(t))}deselectByValue(t,e=!1){this.options().multiple?this.state.delete(t):this.state=null,e||this.onChanges.forEach(s=>s())}getState(){return this.options().multiple?Array.from(this.state):this.state}hasValue(t){return this.options().multiple?this.state.has(t):this.state===t}setState(t){(t===null||t==="")&&(t=this.options().multiple?[]:""),this.options().multiple?(Array.isArray(t)||(t=[t]),t=t.map(s=>s+"")):t=t+"",this.state=this.options().multiple?new Set(t):t;let e=this.options().multiple?t:[t];this.walker().each(s=>{let r=s.use(j);if(r.ungrouped)return;let a=e.includes(r.value);a&&!r.isSelected()?r.surgicallySelect():!a&&r.isSelected()&&r.surgicallyDeselect()}
125),this.onChanges.forEach(s=>s())}selected(){return this.walker().find(t=>t.use(j).isSelected()).use(j)}selecteds(){return this.walker().filter(t=>t.use(j).isSelected()).map(t=>t.use(j))}selectFirst(){this.walker().first()?.use(j).select()}selectAll(){this.walker().filter(t=>!t.use(j).isSelected()).map(t=>t.use(j).select())}deselectAll(){this.walker().filter(t=>t.use(j).isSelected()).map(t=>t.use(j).deselect())}allAreSelected(){let t=this.walker().filter(e=>!0);return t.length>0&&this.walker().filter(e=>e.use(j).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(j).value===t)?.use(j)}deselectOthers(t){this.walker().each(e=>{e!==t&&e.use(j).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 lt(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()})}},j=class extends rt{boot({options:t}){this.groupedByType=yt,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"),w(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"),w(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 at=class extends rt{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 De=class extends it{boot(){let t=this.list();this._controllable=new G(this,{bubbles:!0}),this._selectable=new yt(t,{multiple:this.hasAttribute("multiple")}),this._submittable=new at(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=J();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 F(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=zs(l,"options",r);this._activatable=new Zt(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 we(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))Rt(this,this._activatable),Vt(this,this,this._activatable),Tn(this,this._activatable,this._selectable);else if(!u&&c){let f=c;this._disableable.onInitAndChange(g=>{g?f&&h(f,"disabled",""):f&&w(f,"disabled")}),Xe(this,f,this._selectable,this._popoverable),Tn(f,this._activatable,this._selectable),Dn(a,n,this,f,this._selectable,this._popoverable,this._filterable),Ke(f),je(f),this._filterable&&Ge(s,f,this._filterable),de(f,this._activatable,this._selectable),Rt(f,this._activatable),Vt(this,f,this._activatable),he(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 ct(g),this._anchorable=new nt(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}),Dn(a,n,this,f,this._selectable,this._popoverable,this._filterable),this._disableable.onInitAndChange(v=>{v?f&&h(f,"disabled",""):f&&w(f,"disabled")}),this.querySelectorAll("button,ui-button").forEach(v=>{g.contains(v)||(h(v,"tabindex","-1"),h(v,"aria-controls",o),h(v,"aria-haspopup","listbox"),ce(v,this._popoverable),m(v,"click",()=>{this._popoverable.toggle(),Bi()||f.focus()}))}),Xe(this,f,this._selectable,this._popoverable),_e(this,f,g,this._popoverable,this._anchorable),Te(this,this._popoverable,[f]),ce(f,this._popoverable),Ke(f),je(f),this._filterable&&Ge(s,f,this._filterable),de(f,this._activatable,this._selectable),js(f,this._popoverable),ie(f,this._popoverable,this._activatable,this._selectable),Gs(f,this._popoverable),ee(this,this._popoverable),Rt(f,this._activatable),Vt(this,f,this._activatable),he(this,this._activatable),Ce(this._popoverable,this._activatable,this._selectable),Ie(this,this._selectable,this._popoverable,r)}else if(u&&d){let f=p,g=d,v=u;h(f,"role","combobox"),h(g,"role","combobox"),h(f,"aria-controls",o),this._disableable.onInitAndChange(x=>{x?(f&&h(f,"disabled",""),g&&h(g,"disabled","")):(f&&w(f,"disabled"),g&&w(g,"disabled"))}),this._popoverable=new ct(v),this._anchorable=new nt(v,{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}),Ke(g),je(g),this._filterable&&Ge(s,g,this._filterable),de(g,this._activatable,this._selectable),Zi(g,this._popoverable),_e(this,f,v,this._popoverable,this._anchorable),Te(this,this._popoverable,[g]),ce(f,this._popoverable),Xe(this,g,this._selectable,this._popoverable),ie(f,this._popoverable,this._activatable,this._selectable),pi(f,this._popoverable),ee(this,this._popoverable),Rt(g,this._activatable),fe(f,this._activatable,this._popoverable),Vt(this,g,this._activatable),he(this,this._activatable),Ce(this._popoverable,this._activatable,this._selectable),Ie(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(v=>{v?(f&&h(f,"disabled",""),t&&h(t,"disabled","")):(f&&w(f,"disabled"),t&&w(t,"disabled"))}),this._popoverable=new ct(g),this._anchorable=new nt(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}),_e(this,f,g,this._popoverable,this._anchorable),Te(this,this._popoverable),ce(f,this._popoverable),ie(f,this._popoverable,this._activatable,this._selectable),pi(f,this._popoverable),de(f,this._activatable,this._selectable),ee(this,this._popoverable),Rt(f,this._activatable),fe(f,this._activatable,this._popoverable),Vt(this,f,this._activatable),he(this,this._activatable),Ce(this._popoverable,this._activatable,this._selectable),Ie(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}=ft();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})))}};I("selected-remove",Xi);I("selected",Ki);I("select",De);function Rt(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 fe(i,t,e){Ui(i,s=>{t.activateBySearch(s),e.getState()||t.getActive()?.click()})}function Vt(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 he(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 Tn(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 zs(i,t){let e=et(i,"options");return h(i,"role","listbox"),h(i,"aria-multiselectable",t?"true":"false"),e}function ce(i,t){h(i,"aria-haspopup","listbox");let e=()=>{h(i,"aria-expanded",t.getState()?"true":"false"),t.getState()?h(i,"data-open",""):w(i,"data-open","")};t.onChange(()=>{e()}),e()}function _e(i,t,e,s,r){let a=()=>{Array.from([i,e]).forEach(n=>{s.getState()?h(n,"data-open",""):w(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 Ce(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 ee(i,t){m(i,"keydown",e=>{e.key==="Escape"&&t.getState()&&(t.setState(!1),e.preventDefault(),e.stopImmediatePropagation())})}function ie(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 Gs(i,t){m(i,"click",()=>{t.getState()||(t.setState(!0),i.focus())})}function pi(i,t){m(i,"click",()=>{t.setState(!t.getState()),i.focus()})}function Zi(i,t){t.onChange(()=>{t.getState()&&!Bi()&&setTimeout(()=>i.focus())})}function Ge(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 je(i){m(i,"focus",()=>i.select())}function Ke(i){m(i,"change",t=>t.stopPropagation()),m(i,"input",t=>t.stopPropagation())}function js(i,t){m(i,"keydown",e=>{(/^[a-zA-Z0-9]$/.test(e.key)||e.key==="Backspace")&&(t.getState()||t.setState(!0))})}function Xe(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 Ie(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 de(i,t,e){t.onChange(()=>{let s=t.getActive();s?h(i,"aria-activedescendant",s.id):w(i,"aria-activedescendant")}),e.onChange(s=>{if(!s)return;let r=s.el;r&&h(i,"aria-activedescendant",r.id)})}function Dn(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(""),w(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 Te(i,t,e=[]){let{lock:s,unlock:r}=ft(t.el,!1,e);t.onChange(()=>{t.getState()?s():r()})}var Ks=class extends De{mount(){this._disableable=new F(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=zs(a,"options",s);this._activatable=new Zt(a,{filter:"data-hidden"}),this.hasAttribute("filter")&&this.getAttribute("filter")!=="manual"&&(this._filterable=new we(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&&w(c,"disabled"),p&&w(p,"disabled"))}),this._popoverable=new ct(b),this._anchorable=new nt(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}),de(p,this._activatable,this._selectable),Ke(p),je(p),this._filterable&&Ge(e,p,this._filterable),Zi(p,this._popoverable),_e(this,c,b,this._popoverable,this._anchorable),Te(this,this._popoverable,[p]),ce(c,this._popoverable),Xe(this,p,this._selectable,this._popoverable),ie(c,this._popoverable,this._activatable,this._selectable),pi(c,this._popoverable),ee(this,this._popoverable),Rt(p,this._activatable),fe(c,this._activatable,this._popoverable),Vt(this,p,this._activatable),he(this,this._activatable),Ce(this._popoverable,this._activatable,this._selectable),Ie(this,this._selectable,this._popoverable,s),Ln(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&&w(c,"disabled"),p&&w(p,"disabled"))}),this._popoverable=new ct(b,{triggers:[p,c]}),this._anchorable=new nt(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}),de(p,this._activatable,this._selectable),Ke(p),je(p),this._filterable&&Ge(e,p,this._filterable),Zi(p,this._popoverable),_e(this,c,b,this._popoverable,this._anchorable),Te(this,this._popoverable,[c]),ce(c,this._popoverable),Xe(this,p,this._selectable,this._popoverable),js(p,this._popoverable),ie(p,this._popoverable,this._activatable,this._selectable),Gs(c,this._popoverable,p),ee(this,this._popoverable),Rt(p,this._activatable),fe(c,this._activatable,this._popoverable),Vt(this,p,this._activatable),he(this,this._activatable),Ce(this._popoverable,this._activatable,this._selectable),Ie(this,this._selectable,this._popoverable,s),oo(this,this._selectable,p),uo(this._selectable,p),ho(this._selectable,p),co(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&&w(c,"disabled"),t&&w(t,"disabled"))}),this._popoverable=new ct(p),this._anchorable=new nt(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}),_e(this,c,p,this._popoverable,this._anchorable),Te(this,this._popoverable),ce(c,this._popoverable),ie(c,this._popoverable,this._activatable,this._selectable),pi(c,this._popoverable),de(c,this._activatable,this._selectable),ee(this,this._popoverable),Rt(c,this._activatable),fe(c,this._activatable,this._popoverable),Vt(this,c,this._activatable),he(this,this._activatable),Ce(this._popoverable,this._activatable,this._selectable),Ie(this,this._selectable,this._popoverable,s),Ln(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}},Xs=class extends L{boot(){this.querySelector("input")?h(this,"tabindex","-1"):h(this,"tabindex","0"),this._disableable=new F(this);let t=e=>{e.preventDefault(),e.stopImmediatePropagation()};this._disableable.onInitAndChange(e=>{e?this.addEventListener("click",t,!0):this.removeEventListener("click",t,!0)})}mount(){}};I("pillbox-trigger",Xs);I("pillbox",Ks);function Ln(i){m(i,"keydown",t=>{t.key===" "&&(t.preventDefault(),t.stopImmediatePropagation(),i.click())})}function oo(i,t,e){t.onChange(()=>{document.activeElement!==e&&document.activeElement.closest("ui-pillbox")===i&&e.focus()})}function uo(i,t){i.onInitAndChange(()=>{i.noneAreSelected()?h(t,"placeholder",t.getAttribute("data-placeholder")):h(t,"placeholder","")})}function ho(i,t){m(t,"keydown",e=>{t.value==""&&e.key==="Backspace"&&i.findByValue(i.getState().at(-1))?.deselect()})}function co(i,t,e){m(t,"click",s=>{i.getState()&&(e.focus(),s.preventDefault(),s.stopImmediatePropagation())})}var bi=class extends L{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&&fo(this,e,t._filterable)}},Zs=class extends L{mount(){let t=this;this._disableable=new F(t,{disableWithParent:!1}),this._disableable.onInitAndChange(r=>{r?h(t,"aria-disabled","true"):w(t,"aria-disabled")});let e=et(t,"option");h(t,"role","option"),this._filterable=new Ht(t,{mirror:this,keep:!!this.closest("ui-option-empty, ui-empty")||this.getAttribute("filter")==="manual"}),this._activatable=new ot(t),this.hasAttribute("action")||(this._selectable=new j(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()}},Js=class extends L{mount(){this._activatable=new ot(this),this._filterable=new Ht(this,{keep:!0}),this._disableable=new F(this,{disableWithParent:!1}),this._disableable.onInitAndChange(t=>{t?h(this,"aria-disabled","true"):w(this,"aria-disabled")})}},Ji=class extends L{},Qs=class extends Ji{};I("option-create",Js);I("options",bi);I("option",Zs);I("option-empty",Ji);I("empty",Qs);function fo(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(v=>l(v))?w(r,"data-hidden"):h(r,"data-hidden",""),f&&r._activatable.activate(!0);let g=()=>{w(r,"disabled")};e?g():c=setTimeout(g,150)}f&&(!r||n(r))?w(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(v=>n(v));g&&t.value.trim()===""&&!n(r)?(u(),w(s,"data-hidden"),h(r,"data-hidden","")):t.value.trim()===""&&!n(r)&&h(r,"data-hidden",""),a&&t.value.trim().length>=a&&w(r,"data-hidden"),h(r,"disabled",""),d=setTimeout(()=>{w(r,"disabled"),g&&r._activatable.activate()},200)})}queueMicrotask(()=>p())}var y=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 Mn(i,t,e,s){let r=i.querySelector('template[name="heading"]'),a=i.querySelector('template[name="weekday"]'),n=i.querySelector('template[name="week"]');r&&po(r,t,e),a&&bo(a,t),n&&mo(n,t,e,s)}function po(i,t,e){pt(i,s=>s({slots:{default:new Intl.DateTimeFormat(t.locale,{month:i.hasAttribute("display")?i.getAttribute("display"):"long",year:"numeric",timeZone:"UTC"}).format(new y(e.year,e.month).getDate())}}))}function bo(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)});pt(i,r=>s.map(a=>r({slots:{default:a}})))}
125function mo(i,t,e,s){let r=e.month,a=e.year,n=(new y(a,r).getFirstDayOfMonth()-t.startDay+7)%7,l=new y(a,r).getDaysInMonth(),[o,u]=new y(a,r).addMonths(-1).toParts(),d=new y(o,u).getDaysInMonth(),[c,p]=[[],[]];for(let E=0;E<n;E++){c.push(0);let M=d-n+E+1;p.push(new y(o,u,M).toIsoDateString())}for(let E=1;E<=l;E++)c.push(E),p.push(new y(a,r,E).toIsoDateString());let f=(7-(n+l)%7)%7,[g,v]=new y(a,r).addMonths(1).toParts();for(let E=1;E<=f;E++)c.push(0),p.push(new y(g,v,E).toIsoDateString());if(t.fixedWeeks){let E=Math.ceil(c.length/7),M=t.fixedWeeks,B=M-E;if(B>0)for(let V=0;V<B*7;V++)c.push(0),p.push(y.fromIsoDateString(p[p.length-1]).addDays(1).toIsoDateString());else B<0&&(c.length=M*7,p.length=M*7)}let x=E=>Array.from({length:Math.ceil(E.length/7)},(M,B)=>E.slice(B*7,(B+1)*7)),C=x(c),O=x(p);pt(i,E=>C.map((M,B)=>{let V=E(),Y=O[B],N=V.querySelector('template[name="number"]');if(N){let U=(4-t.startDay+7)%7,$=y.fromIsoDateString(Y[U]).getWeekNumber();pt(N,q=>q({slots:{default:$}}))}return pt(V.querySelector('template[name="day"]'),U=>M.map(($,q)=>{if($===0){let H=y.fromIsoDateString(Y[q]).getDay();return U({slots:{default:H},attrs:{"data-date":Y[q],"data-outside":""}})}let z=y.fromIsoDateString(Y[q]),X=U({slots:{default:$},attrs:{"data-date":Y[q]}}),st=s.subtext(z),A=s.details(z),Z=s.variant(z);if([!1,null,void 0].includes(Z)||(X.dataset.dateVariant=Z),![!1,null,void 0].includes(st)){let K=X.querySelector('template[name="subtext"]');K&&pt(K,H=>H({slots:{default:st}}))}if(![!1,null,void 0].includes(A)){let K=X.querySelector('template[name="details"]');K&&pt(K,H=>H({slots:{default:A}}))}return X})),V}))}function Pn(i,t,e,s,r,a){let l=((o,u)=>r.lowerBound(()=>y.today().getMonth()===o&&y.today().getYear()===u?y.today():new y(u,o)))(s.month,s.year);i.querySelectorAll("[data-date]").forEach(o=>{h(o,"role","gridcell");let u=o.querySelector("button,ui-button"),d=go(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","")):(w(o,"disabled"),w(o,"data-unavailable"),w(o,"aria-disabled"),u&&w(u,"disabled")):(h(o,"disabled",""),h(o,"aria-disabled","true"),u&&h(u,"disabled",""),a.isUnavailable(d)&&h(o,"data-unavailable","")),y.today().isSameDay(d)?h(o,"data-today",""):w(o,"data-today",""),r.attributes(o,d),d.isSameDay(l)?u&&h(u,"tabindex","0"):u&&h(u,"tabindex","-1"))})}function pt(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 go(i){return!i||!i.hasAttribute("data-date")?null:y.fromIsoDateString(i.getAttribute("data-date"))}var se=class{static SINGLE="single";static MULTIPLE="multiple"},wt=class{static SELECTION="selection";static ACTIVATION="activation";static VIEW_CHANGE="view-change"},Qi=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(wt.SELECTION):this.observable.notify(wt.ACTIVATION)}setValue(t){let e=this.selection;this.selection=i.createSelectionFromValue(t,this.config),this.selection.shouldNotify(e)?this.observable.notify(wt.SELECTION):this.observable.notify(wt.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===se.MULTIPLE?(t??=[],new tr(t)):t?new es(t):new ts}static createFromValueStringAttribute(t,e,s){let r=i.createSelectionFromValueStringAttribute(t,e);return new i(r,e,s)}static createSelectionFromValueStringAttribute(t,e){return e.mode===se.MULTIPLE&&(t=t?t.split(",").map(s=>s.trim()):[]),i.createSelectionFromValue(t,e)}},mi=class{contains(){}shouldNotify(t){return!0}hasSelection(){return!1}lowerBound(t){return is(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")):(w(t,"data-selected"),h(t,"aria-selected","false"))}},ts=class i extends mi{contains(){return!1}shouldNotify(t){return!(t instanceof i)}hasSelection(){return!1}lowerBound(t){return is(t)}select(t){return new es(t)}display(t){return""}value(){return null}},es=class i extends mi{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 ts:new i(t)}display(t){return ss(this._value,t.timeFormat,t.locale)}value(){return this._value}},tr=class i extends mi{constructor(t){super(),this._values=t.sort((e,s)=>$t(e)<$t(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)=>$t(s)<$t(r)?-1:1)[0]||is(t)}upperBound(t){let e=this._values.sort((s,r)=>$t(s)<$t(r)?-1:1);return e[e.length-1]||is(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)=>$t(e)<$t(s)?-1:1).map(e=>ss(e,t.timeFormat,t.locale)).join(", ")}value(){return this._values}};function is(i=null){return typeof i=="function"?i():i}var rs=class extends L{boot(){this.picker=this.closest("ui-time-picker");let t=this.querySelectorAll("input");this._disableable=new F(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=Yt(0,this.picker.config.locale)||"AM"),this.clearInputs(),er(this.hourInput),er(this.minuteInput),this.meridiemInput&&er(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()}),ir(this.hourInput),ir(this.minuteInput),this.meridiemInput&&ir(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;
125r===this.hourInput||r===this.minuteInput||r===this.meridiemInput?this._lastFocusedInput=r:this._lastFocusedInput=null}),this.picker.observable.subscribe(wt.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:yo(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=Yt(0,r);e=t.value===a?"AM":"PM"}let s=vo(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=Yt(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();w(this.picker,"data-empty");let[e,s]=t.split(":"),r=null,a=this.meridiemInputForTimeFormat();a&&(e=parseInt(e),r=Yt(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&&St(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"),St(this.hourInput);return}if(!["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===Yt(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(),St(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():St(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():St(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"),St(this.minuteInput);return}
125if(!["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(),St(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():St(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():St(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="",St(this.meridiemInput);return}if(!["ArrowUp","ArrowDown"].includes(t.key))return;t.preventDefault(),t.stopPropagation(),as(this.meridiemInput);let e=this.picker.config.locale,s=Yt(0,e),r=Yt(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(),St(this.meridiemInput)}),this.meridiemInput?.addEventListener("keydown",t=>{if(!["a","p","A","P"].includes(t.key))return;as(this.meridiemInput);let e=this.picker.config.locale;t.key==="a"||t.key==="A"?this.meridiemInput.value=Yt(0,e):(t.key==="p"||t.key==="P")&&(this.meridiemInput.value=Yt(12,e)),this.meridiemInput.style.color="",delete this.meridiemInput.dataset.showingPlaceholder,this.processTime(),St(this.meridiemInput)})}setMeridiemWidthBasedOnLocale(){let t=Yt(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 er(i){i.addEventListener("focus",t=>{St(i)}),i.addEventListener("blur",t=>{as(i)}),i.addEventListener("mousedown",t=>{t.preventDefault(),i.focus(),St(i)}),i.addEventListener("mouseup",t=>{t.preventDefault(),St(i)})}function ir(i,{isMeridiem:t=!1}={}){i.addEventListener("keydown",e=>{/[0-9]/.test(e.key)&&!t&&(as(i),i.classList.remove("font-mono")),!(e.ctrlKey||e.metaKey||e.altKey)&&(["Tab","Backspace"].includes(e.key)||e.preventDefault())})}function St(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 as(i){"showingPlaceholder"in i.dataset&&(i.value="",i.style.color="",delete i.dataset.showingPlaceholder)}function Yt(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 vo(i,t,e=null){i=i.padStart(2,"0"),t=t.padStart(2,"0");let s=e?i+":"+t+" "+e:i+":"+t;return wo(s)}function yo(i){return new Intl.DateTimeFormat(i,{hour:"numeric"}).format(new Date(2024,0,1,0,0)).startsWith("00")}function wo(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")}
125:${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 sr=class extends it{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")?se.MULTIPLE:se.SINGLE,dropdown:!(this.hasAttribute("dropdown")&&this.getAttribute("dropdown")==="false")},this.observable=new Xt,this._controllable=new G(this,{bubbles:!0}),this._submittable=new at(this,{name:this.getAttribute("name"),value:this.getAttribute("value"),includeWhenEmpty:!1}),this.selectable=Qi.createFromValueStringAttribute(this.getAttribute("value"),this.config,this.observable),this._controllable.getter(()=>this.selectable.getValue());let t=J();if(this._controllable.setter(t(l=>{this.selectable.setValue(l)})),this.observable.subscribe(wt.SELECTION,t(()=>{this._controllable.dispatch(),this.dispatchEvent(new CustomEvent("input",{bubbles:!1}))})),this.observable.subscribe(wt.SELECTION,()=>{this._submittable.update(this.selectable.getValue())}),this._disableable=new F(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=Ao(r,this.config.mode===se.MULTIPLE);this._popoverable=new ct(e,{triggers:[s]}),this._anchorable=new nt(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 Zt(r,{filter:"data-hidden"}),this._disableable.onInitAndChange(l=>{l?(h(s,"disabled",""),s.querySelectorAll("button,ui-button").forEach(o=>h(o,"disabled",""))):(w(s,"disabled"),s.querySelectorAll("button,ui-button").forEach(o=>w(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=>{xo(l,this._popoverable,a),_o(l,this._activatable,this.observable)}),So(this,e,this._popoverable,this._anchorable),Eo(this,this._popoverable),ie(s,this._popoverable),ee(this,this._popoverable),Rt(s,this._activatable),fe(s,this._activatable,this._popoverable),Vt(this,s,this._activatable),Lo(this._popoverable,this._activatable,this.selectable,this.config.openTo),Co(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(wt.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}):gi(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}):gi(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("-")?To(e):gi(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}):gi(t)?t:console.warn(`Invalid open-to attribute: ${t}`)}}},rr=class extends L{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(wt.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}=pt(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}=pt(this.templates.placeholder,s=>s({slots:{}}));this.templates.placeholder.clearPlaceholder=e}}},ar=class extends L{boot(){this.picker=this.closest("ui-time-picker"),this.render(),this.picker.observable.subscribe(wt.SELECTION,()=>{this.render()}),this.picker.observable.subscribe(wt.VIEW_CHANGE,()=>{this.render()});let{enable:t,disable:e}=Io(this,this.picker.selectable);this.picker._disableable.onInitAndChange(s=>{s?e():t()})}render(){let t=this.querySelector('template[name="option"]');t&&pt(t,e=>Po(this.picker.config).map(({value:r,label:a})=>{let n=this.picker.config.unavailable.some(u=>Do(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 ot(o),et(o,"option"),o}))}};I("time-picker",sr);I("time-picker-trigger",rs);I("selected-time",rr);I("time-picker-options",ar);function Ao(i,t){let e=et(i,"options");return h(i,"role","listbox"),h(i,"aria-multiselectable",t?"true":"false"),e}function xo(i,t,e){h(i,"role","combobox"),h(i,"aria-controls",e),h(i,"aria-haspopup","listbox"),ko(i,t),m(i,"click",s=>{s.stopPropagation(),t.setState(!t.getState()),i.focus()})}function So(i,t,e,s){let r=()=>
125{Array.from([i,t]).forEach(a=>{e.getState()?h(a,"data-open",""):w(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 Eo(i,t){let{lock:e,unlock:s}=ft(t.el);t.onChange(()=>{t.getState()?e():s()})}function ko(i,t){h(i,"aria-haspopup","listbox");let e=()=>{h(i,"aria-expanded",t.getState()?"true":"false"),t.getState()?h(i,"data-open",""):w(i,"data-open","")};t.onChange(()=>{e()}),e()}function _o(i,t){t.onChange(()=>{let e=t.getActive();e?h(i,"aria-activedescendant",e.id):w(i,"aria-activedescendant")})}function Co(i,t,e,s,r){t!==se.MULTIPLE&&e.subscribe(wt.SELECTION,()=>{s.hasSelection()&&r.setState(!1)})}function Io(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]");if(!a)return;let n=a.getAttribute("data-time");setTimeout(()=>{gi(n)&&t.select(n)})}),{enable:()=>{},disable:()=>{}}}function gi(i){return new RegExp(`^${nr()}$`).test(i)}function To(i){return new RegExp(`^${nr()}-${nr()}$`).test(i)}function nr(){return"([01]?[0-9]|2[0-3]):[0-5][0-9]"}function Do(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 ss(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 $t(i){if(!i)return null;let[t,e]=i.split(":");return isNaN(t)||isNaN(e)?null:parseInt(t)*60+parseInt(e)}function Lo(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=Mo(t,s)),setTimeout(()=>{let o=n||l;t.activateSelectedOrFirst(o),o?.scrollIntoView({block:"nearest"})})}else t.clearActive()})}function Mo(i,t){let e=$t(t),s=null,r=null;return i.filterAwareWalker().walk((a,n)=>{let l=a.getAttribute("data-time"),o=$t(l);o>e||Math.abs(o-e)<Math.abs(r-e)&&(s=a,r=o)}),s}function Po({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=ss(c,t,e);a.push({value:c,label:p})}return a}var ns=class extends rt{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 lr=class extends L{boot(){let t=this.button(),e=this.details();if(!t)return console.warn("ui-disclosure: no trigger element found",this);if(this._disableable=new F(this),this._disableable.onInitAndChange(n=>{n?t.hasAttribute("disabled")||h(t,"disabled",""):t.hasAttribute("disabled")&&w(t,"disabled")}),!e)return;this._controllable=new G(this,{disabled:this.disabled}),e._disclosable=new ns(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",""),w(e,"hidden")):(w(this,"data-open"),w(t,"data-open"),w(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=et(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(){let t=this.lastElementChild;return t===this.button()?null:t}},or=class i extends L{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 lt(this,(t,{skip:e,reject:s})=>{if(t instanceof i&&t!==this||t.localName!=="ui-disclosure")return s()})}};I("disclosure",lr);I("disclosure-group",or);var ur=class extends L{boot(){}},hr=class extends L{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)})}};I("resizable",ur);I("grip",hr);var cr=class i extends it{boot(){this._disableable=new F(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 yt(this,{multiple:!0}),this._controllable=new G(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 at(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=J(),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=J();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(j).isSelected()).map(t=>t.use(j).select())}deselectAll(){this.walker({checkable:!0}).filter(t=>t.use(j).isSelected()).map(t=>t.use(j).deselect())}allAreSelected(){let t=this.walker({checkable:!0}).filter(e=>!0);return t.length>0&&this.walker({checkable:!0}).filter(e=>e.use(j).isSelected()).length===t.length}noneAreSelected(){return this.walker({checkable:!0}).filter(t=>t.use(j).isSelected()).length===0}walker({checkable:t}={}){return lt(this,(e,{skip:s,reject:r})=>{if(e instanceof i)return r();if(e.localName!=="ui-checkbox"||t&&(e.disabled||e.use(j).ungrouped))return s()})}},dr=class extends it{boot(){let t=this;this.isIndeterminate=!1,this._disableable=new F(this),this.hasAttribute("all")?(this._selectable=new j(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 j(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 at(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=J(),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?w(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())})),Oo(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",""):w(this,"data-indeterminate")}};I("checkbox-group",cr);I("checkbox",dr);function Oo(i){i.closest("label")?.addEventListener("click",t=>{i.contains(t.target)||i._selectable.press()})}var fr=class extends L{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 G(this),e._popoverable=new ct(e),e._anchorable=new nt(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}=ft(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=J();if(this._controllable.setter(n=>e._popoverable.setState(n)),e._popoverable.onChange(r(()=>this._controllable.dispatch())),this.hasAttribute("hover")){let n=()=>{};Be(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()),No(e),e._popoverable.getState()?(h(this,"data-open",""),h(t,"data-open",""),h(e,"data-open","")):(w(this,"data-open"),w(t,"data-open"),w(e,"data-open")),e._popoverable.onChange(()=>{e._popoverable.getState()?(h(this,"data-open",""),h(t,"data-open",""),h(e,"data-open","")):(w(this,"data-open"),w(t,"data-open"),w(e,"data-open"))});let a=et(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}=ft();t()}}trigger(){return this.querySelector("button,ui-button,a")}overlay(){return this.lastElementChild?.matches("[popover]")&&this.lastElementChild}};I("dropdown",fr);function No(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 pr=class extends L{boot(){this.type="file"}mount(){this._disableable=new F(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",()=>{w(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",()=>{w(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",()=>{w(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?w(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&&w(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(),w(this,"data-dragging"),t.dataTransfer.files&&t.dataTransfer.files.length>0&&this.addFiles(t.dataTransfer.files)})),m(this.triggerEl,"dragleave",t=>{w(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",()=>{w(this,"data-focus")}))}};I("file-upload",pr);var W=class{static SELECTION=1;static ACTIVATION=2;static VIEW_CHANGE=3},Ze=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 gt=class{static SINGLE="single";static MULTIPLE="multiple";static RANGE="range"},ls=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(W.SELECTION):this.observable.notify(W.ACTIVATION)}activate(t){let e=this.active;t?this.active=t:this.active=null,this.selection.activate(t),e!==this.active&&this.observable.notify(W.ACTIVATION)}setValue(t){let e=this.selection;this.selection=this.createSelectionFromValue(t,this.config),this.selection.shouldNotify(e)?this.observable.notify(W.SELECTION):this.observable.notify(W.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===gt.MULTIPLE){let s=t?t.map(r=>y.fromIsoDateString(r)):[];return new us(s)}else if(e.mode===gt.RANGE){let{start:s,end:r,preset:a}=t||{};return a&&cs[a]&&a!=="custom"?new hs(a,e):!s&&!r?new wi:r?new Ai(y.fromIsoDateString(s),y.fromIsoDateString(r)):new pe(y.fromIsoDateString(s))}else return t?new yi(y.fromIsoDateString(t)):new vi}static createFromValueStringAttribute(t,e,s){let r=i.createSelectionFromValueStringAttribute(t,e);return new i(r,e,s)}static createSelectionFromValueStringAttribute(t,e){if(e.mode===gt.MULTIPLE){let s=t?t.split(",").map(r=>r.trim()).map(r=>y.fromIsoDateString(r)):[];return new us(s)}else if(e.mode===gt.RANGE){if(!t)return new wi;let[s,r]=t.split("/").map(a=>a.trim());return!r&&s&&cs[s]&&s!=="custom"?new hs(s,e):(s=y.fromIsoDateString(s),r?(r=y.fromIsoDateString(r),new Ai(s,r)):new pe(s))}else return t?new yi(y.fromIsoDateString(t)):new vi}},os=class{constructor(t,e){this.selectable=t,this.observable=e,this._selection=this.selectable.selection,this.selectable.observable.subscribe(W.SELECTION,()=>{this._blockSync()||this.sync()}),this._blockSync=()=>{}}blockSyncIf(t){this._blockSync=t}sync(){this._selection=this.selectable.selection,this.observable.notify(W.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))}},re=class{contains(){}shouldNotify(t){return!0}hasSelection(){return!1}lowerBound(t){return xi(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")):(w(t,"data-selected"),h(t,"aria-selected","false"))}},vi=class i extends re{shouldNotify(t){return!(t instanceof i)}hasSelection(){return!1}contains(){return!1}select(t){return new yi(t)}lowerBound(t){return xi(t)}display(t){return""}value(){return null}},yi=class i extends re{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 vi: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()}},us=class i extends re{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]||xi(t)}upperBound(t){let e=this._dates.sort((s,r)=>s.isBefore(r)?-1:1);return e[e.length-1]||xi(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())}},wi=class i extends re{constructor(){super()}hasSelection(){return!1}shouldNotify(t){return!(t instanceof i||t instanceof pe)}select(t){return new pe(t)}contains(){return!1}lowerBound(t){return xi(t)}display(t){return""}value(){return null}},pe=class i extends re{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 wi:new Ai(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")):(w(t,"data-in-range"),w(t,"aria-selected")),e.isSameDay(this._start)?h(t,"data-selected",""):w(t,"data-selected"),e.isSameDay(this._start)?h(t,"aria-selected","true"):w(t,"aria-selected"),e.isSameDay(this._start)?h(t,"data-start",""):w(t,"data-start"),e.isSameDay(this._endPreview)?h(t,"data-end-preview",""):w(t,"data-end-preview")}},Ai=class i extends re{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 pe(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",""):w(t,"data-selected"),e.isSameDay(this._start)?h(t,"data-start",""):w(t,"data-start"),e.isSameDay(this._end)?h(t,"data-end",""):w(t,"data-end"),this.contains(e)?(h(t,"data-in-range",""),h(t,"aria-selected","true")):(w(t,"data-in-range"),w(t,"aria-selected"))}},hs=class i extends re{constructor(t,e){super(),this._preset=t,this._config=e}get _start(){let[t]=cs[this._preset](this._config);return this._config.min&&t.isBefore(this._config.min)?this._config.min:t}get _end(){let[,t]=cs[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 pe(t,this._config)}contains(t){return t.isBetween(this._start,this._end)}lowerBound(){return this._preset==="allTime"?y.today():this._start}upperBound(){return this._preset==="allTime"?y.today():y.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",""):w(t,"data-selected"),e.isSameDay(this._start)?h(t,"data-start",""):w(t,"data-start"),e.isSameDay(this._end)?h(t,"data-end",""):w(t,"data-end"),this.contains(e)?(h(t,"data-in-range",""),h(t,"aria-selected","true")):(w(t,"data-in-range"),w(t,"aria-selected"))}};function xi(i=null){return typeof i=="function"?i():i}var cs={today:()=>[y.today(),y.today()],yesterday:()=>{let i=y.today().incrementDays(-1);return[i,i]},thisWeek:i=>{let t=y.today().getCopy().incrementDays(i.startDay-y.today().getDayOfWeek()),e=t.incrementDays(6);return[t,e]},lastWeek:i=>{let t=y.today().incrementDays(i.startDay-(y.today().getDayOfWeek()+7)),e=t.incrementDays(6);return[t,e]},last7Days:()=>{let i=y.today();return[y.today().incrementDays(-6),i]},thisMonth:()=>{let i=y.fromParts(y.today().getYear(),y.today().getMonth(),1),t=y.fromParts(y.today().getYear(),y.today().getMonth(),y.today().getDaysInMonth());return[i,t]},lastMonth:()=>{let i=y.today().getMonth()-1,t=y.today().getYear();i<1&&(i+=12,t--);let e=y.fromParts(t,i,1),s=y.fromParts(t,i,e.getDaysInMonth());return[e,s]},thisQuarter:()=>{let t=Math.floor((y.today().getMonth()-1)/3)*3+1,e=t+2,s=y.fromParts(y.today().getYear(),t,1),r=y.fromParts(y.today().getYear(),e,1),a=y.fromParts(y.today().getYear(),e,r.getDaysInMonth());return[s,a]},lastQuarter:()=>{let t=Math.floor((y.today().getMonth()-4)/3)*3+1,e=t+2,s=y.today().getYear();t<1&&(t+=12,e+=12,s--);let r=y.fromParts(s,t,1),a=y.fromParts(s,e,1),n=y.fromParts(s,e,a.getDaysInMonth());return[r,n]},thisYear:()=>{let i=y.fromParts(y.today().getYear(),1,1),t=y.fromParts(y.today().getYear(),12,31);return[i,t]},lastYear:()=>{let i=y.today().getYear()-1,t=y.fromParts(i,1,1),e=y.fromParts(i,12,31);return[t,e]},last14Days:()=>{let i=y.today();return[y.today().incrementDays(-13),i]},last30Days:()=>{let i=y.today();return[y.today().incrementDays(-29),i]},last3Months:()=>{let i=y.today(),t=y.today().getDay()+1,e=y.today().getMonth()-3,s=y.today().getYear();return e<1&&(e+=12,s--),[y.fromParts(s,e,t),i]},last6Months:()=>{let i=y.today(),t=y.today().getDay()+1,e=y.today().getMonth()-6,s=y.today().getYear();return e<1&&(e+=12,s--),[y.fromParts(s,e,t),i]},yearToDate:()=>{let i=y.fromParts(y.today().getYear(),1,1),t=y.today();return[i,t]},tomorrow:()=>{let i=y.today().incrementDays(1);return[i,i]},nextWeek:i=>{let t=y.today().incrementDays(7+i.startDay-y.today().getDayOfWeek()),e=t.incrementDays(6);return[t,e]},next7Days:()=>{let i=y.today(),t=y.today().incrementDays(6);return[i,t]},nextMonth:()=>{let i=y.today().getMonth()+1,t=y.today().getYear();i>12&&(i-=12,t++);let e=y.fromParts(t,i,1),s=y.fromParts(t,i,e.getDaysInMonth());return[e,s]},nextQuarter:()=>{let t=(Math.floor((y.today().getMonth()-1)/3)+1)*3+1,e=y.today().getYear();t>12&&(t-=12,e++);let s=t+2;s>12&&(s-=12,e++);let r=y.fromParts(e,t,1),a=y.fromParts(e,s,1),n=y.fromParts(e,s,a.getDaysInMonth());return[r,n]},nextYear:()=>{let i=y.today().getYear()+1,t=y.fromParts(i,1,1),e=y.fromParts(i,12,31);return[t,e]},next14Days:()=>{let i=y.today(),t=y.today().incrementDays(13);return[i,t]},next30Days:()=>{let i=y.today(),t=y.today().incrementDays(29);return[i,t]},next3Months:()=>{let i=y.today(),t=y.today().getDay(),e=y.today().getMonth()+3,s=y.today().getYear();e>12&&(e-=12,s++);let r=y.fromParts(s,e,t).incrementDays(-1);return[i,r]},next6Months:()=>{let i=y.today(),t=y.today().getDay(),e=y.today().getMonth()+6,s=y.today().getYear();e>12&&(e-=12,s++);let r=y.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=y.today();return[t,e]}};var ds=class{constructor(t,e,s,r){this.month=t,this.year=e,this.config=s,this.observable=r}generateOffsetState(t){return new br(this,t)}canNavigatePrevious(){let[t,e]=new y(this.year,this.month).addMonths(-1).toParts();return!(this.config.min&&y.fromParts(t,e).isBefore(y.firstDayOfMonth(this.config.min)))}canNavigateNext(){let[t,e]=new y(this.year,this.month).addMonths(this.config.months).toParts();return!(this.config.max&&y.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(W.VIEW_CHANGE))}setYear(t){if(!t)return;let e=this.month;this.isWithinMinAndMax(e,t)||(this.config.min&&y.fromParts(t,e).isBefore(y.firstDayOfMonth(this.config.min))?e=this.config.min.getMonth():this.config.max&&y.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(W.VIEW_CHANGE)}setDate(t){t&&(this.isWithinMinAndMax(t.getMonth(),t.getYear())&&(this.month=t.getMonth(),this.year=t.getYear()),this.observable.notify(W.VIEW_CHANGE))}isWithinMinAndMax(t,e){return!(this.config.min&&y.fromParts(e,t).isBefore(y.firstDayOfMonth(this.config.min))||this.config.max&&y.fromParts(e,t).isAfter(this.config.max))}adjustMonth(t){let[e,s]=new y(this.year,this.month).addMonths(t).toParts();this.config.min&&y.fromParts(e,s).isBefore(y.firstDayOfMonth(this.config.min))||this.config.max&&y.fromParts(e,s).isAfter(this.config.max)||([this.month,this.year]=[s,e],this.observable.notify(W.VIEW_CHANGE))}},br=class{constructor(t,e=0){this.offset=e,this.viewState=t}get month(){let[,t]=new y(this.viewState.year,this.viewState.month).addMonths(this.offset).toParts();return t}get year(){let[t]=new y(this.viewState.year,this.viewState.month).addMonths(this.offset).toParts();return t}};var fs=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 ps=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(W.VIEW_CHANGE)}reset(t){this.metadata=t,this.observable.notify(W.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 mr=class extends L{boot(){let t=this.closest("ui-date-picker")||this;this.querySelectorAll("[data-appended]").forEach(o=>o.remove());let[e,s]=Ro(this,t);this.observable=new Ze;let r=t.hasAttribute("locale")?t.getAttribute("locale"):Wi();this.config={mode:t.getAttribute("mode")==="range"?gt.RANGE:t.hasAttribute("multiple")?gt.MULTIPLE:gt.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(W.VIEW_CHANGE)}),this.selectable=ls.createFromValueStringAttribute(t.getAttribute("value"),this.config,this.observable),this.metadata=new ps(this.observable),this.validator=new fs(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(()=>y.today());if(this.viewState=new ds(a.getMonth(),a.getYear(),this.config,this.observable),this._disableable=new F(this,{disableWithParent:!1}),!this.hasAttribute("static")){let{enable:o,disable:u}=Fo(this,this.selectable,this.viewState,this.validator);this._disableable.onInitAndChange(d=>{d?u():o()})}this._controllable=new G(this,{bubbles:!0}),this._submittable=new at(this,{name:this.getAttribute("name"),value:this.selectable.getValue()});let n=J();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(W.SELECTION,n(()=>{this.dispatchEvent(new Event("select",{bubbles:!1,cancelable:!0})),this._controllable.dispatch()})),this.observable.subscribe(W.SELECTION,()=>{this._submittable.update(this.selectable.getValue())}),this.observable.subscribe(W.SELECTION,()=>{this.anchorSelection(t)}),this.observable.subscribe(W.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(W.VIEW_CHANGE))})}).observe(t,{attributes:!0})}getOpenTo(t){if(!t.hasAttribute("open-to"))return;let e=t.getAttribute("open-to");return e=e==="today"?y.today():y.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(y.today()))}appendMetadata(t){this.metadata.append(t)}resetMetadata(t={}){this.metadata.reset(t)}visibleDateRange(){return[y.fromParts(this.viewState.year,this.viewState.month,1).toIsoDateString(),y.fromParts(this.viewState.year,this.viewState.month+1,0).toIsoDateString()]}getUnavailableDates(t){return t.hasAttribute("unavailable")?t.getAttribute("unavailable").split(",").map(e=>y.fromIsoDateString(e.trim())):[]}getMinDate(t){return t.hasAttribute("min")?t.getAttribute("min")==="today"?y.today():y.fromIsoDateString(t.getAttribute("min")):null}getMaxDate(t){return t.hasAttribute("max")?t.getAttribute("max")==="today"?y.today():y.fromIsoDateString(t.getAttribute("max")):null}},gr=class extends L{boot(){let t=this.closest("ui-calendar");this._disableable=t._disableable,ne(this,()=>this._disableable.isDisabled(),()=>t.navigatePrevious());let e=()=>{t.viewState.canNavigatePrevious()&&!this._disableable.isDisabled()?w(this,"disabled"):h(this,"disabled","")};t.observable.subscribe(W.VIEW_CHANGE,e),this._disableable.onInitAndChange(()=>{e()})}},vr=class extends L{boot(){let t=this.closest("ui-calendar");this._disableable=t._disableable,ne(this,()=>this._disableable.isDisabled(),()=>t.navigateNext());let e=()=>{t.viewState.canNavigateNext()&&!this._disableable.isDisabled()?w(this,"disabled"):h(this,"disabled","")};t.observable.subscribe(W.VIEW_CHANGE,e),this._disableable.onInitAndChange(()=>{e()})}},yr=class extends L{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(W.VIEW_CHANGE,()=>{this.renderSelectOptions(e,s),e.value=this.viewState.month}),this._disableable.onInitAndChange(r=>{r?h(e,"disabled",""):w(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 y(this.offsetState.year,this.offsetState.month).getDate());r(),this.viewState.observable.subscribe(W.VIEW_CHANGE,()=>r())}}renderSelectOptions(t,e){let r=Array.from({length:12},(a,n)=>n+1).map(a=>{let n=new y(this.viewState.year,a),l=new y(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 y(2024,a).getDate())}}
125).filter(Boolean);pt(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 y(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})})}},wr=class extends L{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(W.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",""):w(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 y(this.offsetState.year,this.offsetState.month).getDate());s(),this.viewState.observable.subscribe(W.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 y(a,1),l=new y(a,12,31);return this.config.min&&l.isBefore(this.config.min)||this.config.max&&n.isAfter(this.config.max)?null:a}).filter(Boolean);pt(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}}))})}},Ar=class extends L{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=>Mn(a,this.config,a.offsetState,this.metadata)),s=()=>this.monthEls.forEach(a=>Pn(a,this._disableable.isDisabled(),this.config,a.offsetState,this.selectable,this.validator));e(),s();let r=this.config.months;this.viewState.observable.subscribe(W.VIEW_CHANGE,()=>{r!==this.config.months&&(r=this.config.months,this.renderMonths()),e(),s()}),this.observable.subscribe([W.SELECTION,W.ACTIVATION],()=>{s()}),this._disableable.onChange(()=>s())}renderMonths(){let t=this.querySelector('template:not([name]), template[name="month"]');pt(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})}},xr=class extends L{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"),ne(this,()=>this._disableable.isDisabled(),()=>this.navigateAndSelectToday()),this._disableable.onInitAndChange(s=>{s?h(this,"disabled",""):w(this,"disabled")});let e=this.querySelector("template");e&&pt(e,s=>s({slots:{default:y.today().getDay()}}))}navigateAndSelectToday(){let t=this.closest("ui-calendar, ui-date-picker"),e=()=>{let r=t.viewState,a=y.today();return r.year===a.getYear()&&r.month===a.getMonth()};(this.behavior==="select"||this.behavior==="auto"&&e())&&(t.config.mode===gt.RANGE?t.selectable.setValue({start:y.today().toIsoDateString(),end:y.today().toIsoDateString()}):t.config.mode===gt.MULTIPLE?t.selectable.setValue([y.today().toIsoDateString()]):t.selectable.setValue(y.today().toIsoDateString())),t.viewState.setMonth(y.today().getMonth()),t.viewState.setYear(y.today().getYear())}},Sr=class extends L{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!==gt.RANGE)throw"Presets can only be used with range calendars";let e=this.firstElementChild;if(e){let s=r=>{if(e._selectable instanceof yt){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};
125this.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(W.SELECTION,()=>{let r=this.selectable.getValue();e.value=r?.preset||"custom"}),this._disableable.onInitAndChange(r=>{r?h(e,"disabled",""):w(e,"disabled")})}}},Er=class extends L{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===gt.RANGE?Cr(e,s,t):_r(e,t)}};I("calendar",mr);I("calendar-today",xr);I("calendar-presets",Sr);I("calendar-previous",gr);I("calendar-inputs",Er);I("calendar-next",vr);I("calendar-months",Ar);I("calendar-month",yr);I("calendar-year",wr);function Fo(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=Je(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=Je(l);s.isValid(o)&&t.activate(o)}),m(i,"mouseout",()=>{r||a||t.activate(null)}),m(i,"focusin",n=>{if(r||a)return;let l=n.target.closest("[data-date]");if(!l)return;let o=Je(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=Je(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=>Je(b).isSameDay(d));!p&&u&&(u==="forward"?e.nextMonth():e.previousMonth(),p=Array.from(i.querySelectorAll("[data-date]")).find(b=>Je(b).isSameDay(d))),p?.querySelector("button,ui-button")?.focus()}}),{enable(){r=!1},disable(){r=!0}}}function Je(i){return!i||!i.hasAttribute("data-date")?null:y.fromIsoDateString(i.getAttribute("data-date"))}function Ro(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 _r(i,t){kr(i);let e=J(),s=e(()=>{let r=t.selectable.getValue();i.value=r||""});t.observable.subscribe(W.SELECTION,s),s(),i.addEventListener("change",e(()=>{let r=i.valueAsDate;r?(t.selectable.setValue(y.fromLocalDate(r).toIsoDateString()),t.viewState.setDate(y.fromLocalDate(r))):t.selectable.setValue("")}))}function Cr(i,t,e){kr(i),kr(t);let s=J(),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:y.fromLocalDate(n).toIsoDateString(),end:y.fromLocalDate(l).toIsoDateString()}):n?e.selectable.setValue({start:y.fromLocalDate(n).toIsoDateString(),end:null}):e.selectable.setValue({start:null,end:null})});e.observable.subscribe(W.SELECTION,r),r(),i.addEventListener("change",a),t.addEventListener("change",a)}function kr(i){m(i,"change",t=>t.stopPropagation()),m(i,"input",t=>t.stopPropagation())}var bs=class extends it{boot(){this.picker=this.closest("ui-date-picker"),this._disableable=new F(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}=$o(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);
125this.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(),Ir(this.dayInput),Ir(this.monthInput),Ir(this.yearInput),qo(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())})}),Tr(this.dayInput),Tr(this.monthInput),Tr(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(W.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(y.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();w(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&&kt(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=y.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="",kt(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(),kt(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():kt(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():kt(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="",kt(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(),kt(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():kt(this.yearInput);return}this.yearInput.value=t.padStart(4,"0"),kt(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=Vo(r,s);if(!a){if(!this.isValidInputValue(t,r)){t.value=e,kt(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(),kt(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 Vo(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 $o(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 qo(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 Ir(i){i.addEventListener("focus",()=>{kt(i)}),i.addEventListener("blur",()=>{On(i)}),i.addEventListener("mousedown",t=>{t.preventDefault(),i.focus(),kt(i)}),i.addEventListener("mouseup",t=>{t.preventDefault(),kt(i)})}function Tr(i){i.addEventListener("keydown",t=>{/[0-9]/.test(t.key)&&(On(i),i.classList.remove("font-mono")),!(t.ctrlKey||t.metaKey||t.altKey)&&(["Tab"].includes(t.key)||t.preventDefault())})}function kt(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 On(i){i.value===i.placeholder&&(i.value="",i.style.color="")}var Lr=class extends it{bootWithCalendar(t){let e=t.config.mode===gt.RANGE;this.calendar=t,this._disableable=new F(this),this._disableable.onInitAndChange(b=>{this.calendar.disabled=b}),this.observable=new Ze,this.selectable=new os(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=et(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",""):w(this.triggerEl,"disabled")}),s){this._dialogable=new le(r,{clickOutside:!this.hasAttribute("disable-click-outside"),triggers:n?[d].filter(Boolean):[d,o,u].filter(Boolean)}),this._closeable=new Pt(this),this._closeable.onClose(()=>this._dialogable.hide()),this._anchorable=new nt(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}),Ya()&&!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"),Nn(f,this._dialogable),m(f,"click",()=>this._dialogable.toggle())))}),Bo(this,this.triggerEl,r,this._dialogable,this._anchorable),n||Nn(this.triggerEl,this._dialogable),Ho(this,this._dialogable),n||Uo(this.triggerEl,this._dialogable),Yo(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)Dr(o),Dr(u),Cr(o,u,this);else if(r&&o){let b=o;Dr(b),_r(b,this)}else r&&Wo(d,this._dialogable);this._controllable=new G(this,{bubbles:!0}),this.calendar.addEventListener("change",b=>b.stopPropagation()),this.calendar.addEventListener("input",b=>b.stopPropagation()),this._submittable=new at(this,{name:this.getAttribute("name"),value:this.selectable.getValue()});let p=J();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(W.SELECTION,p(()=>{this.dispatchEvent(new Event("select",{bubbles:!1,cancelable:!0})),this._controllable.dispatch()})),this.observable.subscribe(W.SELECTION,()=>{this._submittable.update(this.selectable.getValue())}),this.observable.subscribe(W.VIEW_CHANGE,()=>{this.dispatchEvent(new Event("navigate",{bubbles:!1,cancelable:!0}))})}unmount(){if(this._dialogable?.getState()){let{unlock:t}=ft();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}},Mr=class extends L{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(W.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}=pt(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}=pt(this.templates.placeholder,s=>s({slots:{}}));this.templates.placeholder.clearPlaceholder=e}}},Pr=class extends L{bootWithCalendar(){this.picker=this.closest("ui-date-picker"),this.picker.selectable.blockSyncIf(()=>this.getBoundingClientRect().width>0),ne(this,()=>this.picker._disableable.isDisabled(),()=>{this.picker.selectable.sync(),this.picker._dialogable.setState(!1)})}};I("date-picker",Lr);I("date-picker-select",Pr);I("selected-date",Mr);I("date-picker-trigger",bs);ai(({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 Nn(i,t){h(i,"aria-haspopup","listbox");let e=()=>{h(i,"aria-expanded",t.getState()?"true":"false"),t.getState()?h(i,"data-open",""):w(i,"data-open","")};t.onChange(()=>{e()}),e()}function Bo(i,t,e,s,r){let a=()=>{Array.from([i,e]).forEach(n=>{s.getState()?h(n,"data-open",""):w(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 Uo(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 Wo(i,t){m(i,"click",()=>{t.setState(!t.getState())})}function Dr(i){m(i,"focus",()=>i.select())}function Ho(i,t){let{lock:e,unlock:s}=ft(t.el);t.onChange(()=>{t.getState()?e():s()})}function Yo(i,t,e,s,r){let a=t!==gt.MULTIPLE;if(i.hasAttribute("close")){let n=i.getAttribute("close");a=n.split(" ").includes("auto"),n==="manual"&&(a=!1)}a&&e.subscribe(W.SELECTION,()=>{s.hasSelection()&&r.setState(!1)})}var Or=class extends it{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 G(this),this._disableable=new F(this),this._submittable=new at(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=()=>{},w(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(()=>{At(s,"disabled")}))}),()=>{t.forEach(s=>s()),t=[]}}};I("composer",Or);var Nr=class extends L{boot(){this._controllable=new G(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)}};I("progress",Nr);var Fr=class extends L{boot(){let t=this.trigger(),e=this.overlay();this._disabled=this.hasAttribute("disabled"),this._popoverable=new ct(e);let s={getBoundingClientRect:()=>({x:0,y:0,width:0,height:0,top:0,left:0,right:0,bottom:0})};this._anchorable=new nt(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}=ft(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}=ft();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}};I("context",Fr);var qt=class extends Wt{groupOfType=ht;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=>Ba(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(ht).tabbable(),e?.use(ht).focus()}moveFocus(t){let e=this.walker().find(r=>r.use(ht).isTabbable());t(e)?.use(ht).focus()}ensureTabbable(){this.walker().findOrFirst(t=>{t.use(ht).isTabbable()})?.use(ht).tabbable()}wipeTabbables(){this.walker().each(t=>{t.use(ht).untabbable()})}untabbleOthers(t){this.walker().each(e=>{e!==t&&e.use(ht).untabbable()})}walker(){return lt(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()})}},ht=class extends rt{groupedByType=qt;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(()=>{ye()&&h(this.el,"data-focus","")})),this.on("blur",t.enabled(()=>{w(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&&w(this.el,this.options().tabbableAttr)}isTabbable(){return this.el.getAttribute("tabindex")==="0"}};var Si=class i extends L{boot(){if(this._focusable=new qt(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())}),Ui(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.ke
131y)&&(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||zo(t)})}walker(){return lt(this,(t,{skip:e,reject:s})=>{if(t instanceof i||t instanceof De)return s();if(!["a","button"].includes(t.localName))return e()})}},Rr=class extends L{boot(){}},Vr=class extends L{boot(){let t=this;this._disableable=new F(this),this._disableable.onInitAndChange(s=>{s?h(t,"aria-disabled","true"):w(t,"aria-disabled")}),et(t,"menu-checkbox"),h(t,"role","menuitemcheckbox"),t._focusable=new ht(t,{disableable:this._disableable,hover:!0,tabbableAttr:"data-active"}),t._selectable=new j(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 G(this),this._controllable.initial(s=>s&&t._selectable.setState(s)),this._controllable.getter(()=>t._selectable.getState());let e=J();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()})),Ur(t)}},$r=class extends L{boot(){let t=this;this._disableable=new F(this),this._disableable.onInitAndChange(e=>{e?h(t,"aria-disabled","true"):w(t,"aria-disabled")}),et(t,"menu-radio"),h(t,"role","menuitemradio"),t._focusable=new ht(t,{disableable:this._disableable,hover:!0,tabbableAttr:"data-active"}),t._selectable=new j(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()})),Ur(t)}},qr=class extends L{boot(){this._selectable=new yt(this),this._controllable=new G(this),h(this,"role","group"),this._controllable.initial(e=>e&&this._selectable.setState(e)),this._controllable.getter(()=>this._selectable.getState());let t=J();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())})}},Br=class extends L{boot(){this._selectable=new yt(this,{multiple:!0}),this._controllable=new G(this),h(this,"role","group"),this._controllable.initial(e=>e&&this._selectable.setState(e)),this._controllable.getter(()=>this._selectable.getState());let t=J();this._controllable.setter(t(e=>{this._selectable.setState(e)})),this._selectable.onChange(t(()=>{this._controllable.dispatch()}))}};I("menu",Si);I("submenu",Rr);I("menu-checkbox",Vr);I("menu-radio",$r);I("menu-radio-group",qr);I("menu-checkbox-group",Br);function Ur(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 zo(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 F(i),i._disableable.onInitAndChange(a=>{a?h(r,"aria-disabled","true"):w(r,"aria-disabled")}),et(r,"menu-item"),h(r,"role","menuitem"),r._focusable=new ht(r,{disableable:i._disableable,hover:!0,tabbableAttr:"data-active"}),s){s._popoverable=new ct(s,{triggers:[e]}),s._anchorable=new nt(s,{reference:e,position:s.hasAttribute("position")?s.getAttribute("position"):mt(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}=Be(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()),Ur(e)}}var Wr=class i extends L{mount(){this._focusable=new qt(this,{wrap:!0}),this._disableable=new F(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(()=>{At(s,"disabled"),At(s,"aria-disabled")}))})):(At(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||Go(t)})}walker(){return lt(this,(t,{skip:e,reject:s})=>{if(t instanceof i||t.hasAttribute("popover")||t instanceof Si||t instanceof bi)return s();if(!["a","button"].includes(t.localName))return e()})}};I("toolbar",Wr);function Go(i){i._disableable=new F(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 ht(s,{disableable:i._disableable}))}var Hr=class extends L{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 ct(s,{scope:"tooltip"}),s._anchorable=new nt(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 F(this),new MutationObserver(()=>{this.getAttribute("draggable")==="true"&&s._popoverable.setState(!1)}).observe(this,{attributeFilter:["draggable"]});let a=et(s,"tooltip"),n=this.hasAttribute("interactive"),l=this.hasAttribute("label")||e.textContent.trim()==="";n?(h(e,"aria-controls",a),h(e,"aria-expanded","false"),s._popoverable.onChange(()=>{s._popoverable.getState()?h(e,"aria-expanded","true"):h(e,"aria-expanded","false")})):(l?h(e,"aria-labelledby",a):h(e,"aria-describedby",a),h(s,"aria-hidden","true")),h(s,"role","tooltip")}mount(){if(!this._disableable)return;let t=this.overlay(),e;this._disableable.onInitAndChange(s=>{e&&(e(),e=null),s||(e=Be(this,t,{gain(){t._popoverable.setState(!0)},lose(){t._popoverable.setState(!1)},focusable:!0,useSafeArea:!1}).remove)}),this.onUnmount(()=>{e&&(e(),e=null)})}button(){return this.firstElementChild}overlay(){return this.lastElementChild!==this.button()&&this.lastElementChild.tagName!=="TEMPLATE"&&this.lastElementChild}};I("tooltip",Hr);var ut={STATE_CHANGED:"stateChanged",DESKTOP_COLLAPSED:"desktopCollapsed",DESKTOP_EXPANDED:"desktopExpanded",MOBILE_COLLAPSED:"mobileCollapsed",MOBILE_EXPANDED:"mobileExpanded",VIEWPORT_ENTER_MOBILE:"viewportEnterMobile",VIEWPORT_ENTER_DESKTOP:"viewportEnterDesktop"},Yr=class extends L{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")}
131,this.observable=new Xt,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(ut.VIEWPORT_ENTER_DESKTOP,()=>{let r=Fs(this,"transition","none");setTimeout(r),this.state.viewportDesktop=!0,this.state.viewportMobile=!1,this.observable.notify(ut.STATE_CHANGED)}),this.observable.subscribe(ut.VIEWPORT_ENTER_MOBILE,()=>{let r=Fs(this,"transition","none");setTimeout(r),this.state.viewportDesktop=!1,this.state.viewportMobile=!0,this.observable.notify(ut.STATE_CHANGED)}),this.observable.subscribe(ut.DESKTOP_COLLAPSED,()=>{this.state.collapsedDesktop=!0,this.observable.notify(ut.STATE_CHANGED)}),this.observable.subscribe(ut.DESKTOP_EXPANDED,()=>{this.state.collapsedDesktop=!1,this.observable.notify(ut.STATE_CHANGED)}),this.observable.subscribe(ut.MOBILE_COLLAPSED,()=>{this.state.collapsedMobile=!0,this.observable.notify(ut.STATE_CHANGED)}),this.observable.subscribe(ut.MOBILE_EXPANDED,()=>{this.state.collapsedMobile=!1,this.observable.notify(ut.STATE_CHANGED)}),this.observable.subscribe(ut.STATE_CHANGED,()=>{this.config.persist&&localStorage.setItem("flux-sidebar-collapsed-desktop",JSON.stringify(this.state.collapsedDesktop)),this.updateDataAttributes(this)});let t=new zr(this.observable,this.config);this.onUnmount(()=>t.disconnect());let e=()=>{this.state.viewportDesktop?this.state.collapsedDesktop?this.observable.notify(ut.DESKTOP_EXPANDED):this.observable.notify(ut.DESKTOP_COLLAPSED):this.state.collapsedMobile?this.observable.notify(ut.MOBILE_EXPANDED):this.observable.notify(ut.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(ut.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(ut.STATE_CHANGED))}updateDataAttributes(t){let e=this.config.collapsible===!0;e&&(this.state.active?h(t,"data-flux-sidebar-active",""):At(t,"data-flux-sidebar-active")),this.state.viewportDesktop?(At(t,"data-flux-sidebar-on-mobile"),h(t,"data-flux-sidebar-on-desktop",""),At(t,"data-flux-sidebar-collapsed-mobile"),this.state.collapsedDesktop?e&&h(t,"data-flux-sidebar-collapsed-desktop",""):At(t,"data-flux-sidebar-collapsed-desktop")):(At(t,"data-flux-sidebar-on-desktop"),h(t,"data-flux-sidebar-on-mobile",""),At(t,"data-flux-sidebar-collapsed-desktop"),this.state.collapsedMobile?h(t,"data-flux-sidebar-collapsed-mobile",""):At(t,"data-flux-sidebar-collapsed-mobile"))}},zr=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(ut.VIEWPORT_ENTER_DESKTOP):this.observable.notify(ut.VIEWPORT_ENTER_MOBILE)},this.onViewportChange(),this.viewport.addEventListener("change",this.onViewportChange)}disconnect(){this.viewport.removeEventListener("change",this.onViewportChange)}},Gr=class extends L{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(ut.STATE_CHANGED,(
131)=>{e.updateDataAttributes(this)})})}};I("sidebar",Yr);I("sidebar-toggle",Gr);var jr=class extends L{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(ms(s[t]+e,this.config.min,this.config.max))},onChange:t=>{this.state.onChanges.push(t)}},this._controllable=new G(this),this._disableable=new F(this),this._submittable=new at(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()}mount(){this.setupFieldIfExists();let t=new ResizeObserver(()=>{this.repositionThumbsAndIndicator(),this.repositionTicks()});t.observe(this),this.onUnmount(()=>t.disconnect())}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",""):w(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*(mt(this)?-1:1));break;case"ArrowLeft":this.state.increment(t,this.config.bigStep*(mt(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",""):w(s,"data-current");r>=e[0]||r<=e[1]?h(s,"data-active",""):w(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=ms(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=ms(d/o,0,1);c=mt(this)?1-c:c;let p=(s-e)*c+e;return p=jo(p,r,e),p=ms(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 ms(i,t,e){return Math.min(Math.max(i,t),e)}function jo(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))}I("slider",jr);var Kr=class extends L{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 F(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=Ko(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(){Le(this,"role","group"),Le(this,"aria-roledescription","carousel"),Le(this.track,"aria-live","polite"),Le(this.track,"aria-atomic","false"),this.slides.forEach((t,e)=>{Le(t,"role","group"),Le(t,"aria-roledescription","slide"),Le(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",""):w(this,"data-at-start"),t?h(this,"data-at-end",""):w(this,"data-at-end"),this.controlElements("ui-carousel-button").forEach(e=>{this.state.atStart?h(e,"data-at-start",""):w(e,"data-at-start"),t?h(e,"data-at-end",""):w(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",mt(this)?`max(${s}, ${r})`:`max(${s}, ${a})`),this.track.style.setProperty("--flux-carousel-fade-right",mt(this)?`max(${s}, ${a})`:`max(${s}, ${r})`)}reflectSelectedSlide(){this.slides.forEach((t,e)=>{e===this.state.current?h(t,"data-selected",""):w(t,"data-selected")}),this.indicators.forEach(t=>t.update(this.state.current))}syncDisabledState(t){t?h(this,"aria-disabled","true"):w(this,"aria-disabled"),this.controlElements().forEach(e=>{t?h(e,"data-disabled",""):w(e,"data-disabled"),w(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",""):w(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=mt(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(),r=1;return s.left>=e.left-r&&s.right<=e.right+r}scrollDistanceTo(t){let e=this.track.getBoundingClientRect(),s=t.getBoundingClientRect();return mt(this)?s.right-e.right:s.left-e.left}scrollBehavior(){return window.matchMedia("(prefers-reduced-motion: reduce)").matches||this.getAttribute("scroll")==="instant"?"instant":"smooth"}},Xr=class extends L{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=Wa(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")):(w(s,"data-selected"),w(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")}},Zr=class extends L{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 Le(i,t,e){i.hasAttribute(t)||h(i,t,e)}function Ko(i,t,e){return Math.min(Math.max(i,t),e)}I("carousel",Kr);I("carousel-indicators",Xr);I("carousel-button",Zr);var ea=class extends it{boot(){this.listeners=[],this.scrollLocked=!1,this.pointerCleanup=null,this.previewEls=[],this.sliderEls=[],this.swatchContainers=[],this.swatchEls=[],this.dropperButtons=[],this.copyButtons=[],this.state=Jr(),this.committedState=Jr(),this._disableable=new F(this),this._controllable=new G(this,{bubbles:!0}),this._closeable=new Pt(this),this._submittable=new at(this,{name:this.resolveName(),value:null,includeWhenEmpty:!1});let t=J();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(Jr(),{dispatch:s});else{let r=sa(t);if(!r)return!1;this.writeState({hsv:tu(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:Bt(t.h??0,0,360),s:Bt(t.s??0,0,100),v:Bt(t.v??0,0,100)},alpha:Bt(e.alpha??1,0,1),empty:!1}:r={...this.state,hsv:{h:Bt(t.h??this.state.hsv.h,0,360),s:Bt(t.s??this.state.hsv.s,0,100),v:Bt(t.v??this.state.hsv.v,0,100)},alpha:Bt(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=Xo(this,t),this.afterStateMutation({dispatch:e})}syncCommittedState(){this.committedState=ia(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:gs(this.state.hsv.h,this.state.hsv.s,this.state.hsv.v)}getHsl(){let t=this.getRgb();return t?Rn(t.r,t.g,t.b):null}formatValue(t=this.state){if(t.empty)return null;let e=gs(t.hsv.h,t.hsv.s,t.hsv.v),s=Rn(e.r,e.g,e.b),r=Bt(t.alpha,0,1);switch(this.getFormat()){case"hexa":return`${Fn(e.r,e.g,e.b)}${Jo(r)}`;case"rgb":return`rgb(${e.r} ${e.g} ${e.b})`;case"rgba":return`rgb(${e.r} ${e.g} ${e.b} / ${Qr(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)}% / ${Qr(r)})`;default:return Fn(e.r,e.g,e.b)}}syncValueAttribute(){this.committedState.empty||!this.committedState.value?w(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 le(this.popoverEl,{clickOutside:!0,triggers:[this.triggerControl]}),this._anchorable=new nt(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(),su(this,this.popoverEl,this._dialogable,this._anchorable,()=>{queueMicrotask(()=>this.initialFocusEl?.focus())}),this._closeable.onClose(()=>this._dialogable.setState(!1)),this._dialogable.onChange(()=>{this.state=ia(this.committedState),this.notify()}
131),this.getAriaTargets().forEach(t=>iu(t,this._dialogable)),au(this,this._dialogable),ru(this.triggerControl,this._dialogable)}linkPopoverAria(){let t=et(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=mt(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=mt(this)?(e.right-t.clientX)/e.width:(t.clientX-e.left)/e.width,r=Bt(s*100,0,100),a=Bt((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"):w(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=eu(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&&Vn(s,t);r?h(e,"data-selected",""):w(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&&Vn(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",""):w(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=gs(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=gs(t.hsv.h,t.hsv.s,t.hsv.v);return`rgb(${e.r} ${e.g} ${e.b} / ${Qr(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 Jr(){return{hsv:{h:0,s:0,v:0},alpha:1,value:null,empty:!0}}function ia(i){return{hsv:{...i.hsv},alpha:i.alpha,value:i.value,empty:i.empty}}function Xo(i,t){let e=ia(t);return e.value=e.empty?null:i.formatValue(e),e}function Bt(i,t,e){return Math.min(Math.max(i,t),e)}function Zo(i){let t=i%360;return t<0?t+360:t}function Qr(i){return Number(i.toFixed(2)).toString()}function Jo(i){return Math.round(i*255).toString(16).padStart(2,"0")}function Fn(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 ta;function sa(i){if(!i)return null;let t=Qo(i);ta||(ta=document.createElement("canvas").getContext("2d"));let e=ta;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 tu(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:Zo(n),s:s===0?0:a/s*100,v:s*100}}function gs(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 Rn(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 Vn(i,t){let e=sa(i),s=sa(t);return!e||!s?!1:e.r===s.r&&e.g===s.g&&e.b===s.b}function eu(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 ra=class extends L{mount(){this.picker=this.closest("ui-color-picker"),this.picker&&ne(this,()=>this.picker._disableable?.isDisabled?.()??!1,()=>{this.picker.commit()})}};I("color-picker",ea);I("color-picker-select",ra);function iu(i,t){let e=()=>{h(i,"aria-expanded",t.getState()?"true":"false"),t.getState()?h(i,"data-open",""):w(i,"data-open")};t.onChange(()=>e()),e()}function su(i,t,e,s,r=()=>{}){let a=()=>
131{Array.from([i,t]).forEach(n=>{e.getState()?h(n,"data-open",""):w(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 ru(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 au(i,t){let{lock:e,unlock:s}=ft(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 aa=class extends it{boot(){let t=this;this._disableable=new F(this),this._selectable=new j(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 at(this,{name:this.getAttribute("name"),value:this.getAttribute("value")??"on",includeWhenEmpty:!1,shouldUpdateValue:!1}),this.value=this._selectable.getValue(),this._detangled=J(),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(r=>{r?w(t,"tabindex","0"):h(t,"tabindex","0")});let e=()=>{t.hasAttribute("data-loading")?h(t,"aria-busy","true"):w(t,"aria-busy"),t.hasAttribute("data-loading")||t.disabled?h(t,"aria-disabled","true"):w(t,"aria-disabled")};e();let s=new MutationObserver(e);s.observe(t,{attributeFilter:["data-loading","disabled"]}),this.onUnmount(()=>s.disconnect());for(let r of["click","keydown","keyup"])m(t,r,a=>{t.hasAttribute("data-loading")&&(r!=="click"&&!["Enter"," "].includes(a.key)||(a.preventDefault(),a.stopImmediatePropagation()))},{capture:!0});m(t,"click",this._disableable.disabled(r=>{r.preventDefault(),r.stopPropagation()}),{capture:!0}),m(t,"click",this._disableable.enabled(r=>{this._selectable.press()})),m(t,"keydown",this._disableable.enabled(r=>{r.key==="Enter"&&(this._selectable.press(),r.preventDefault(),r.stopPropagation())})),m(t,"keydown",this._disableable.enabled(r=>{r.key===" "&&(r.preventDefault(),r.stopPropagation())})),m(t,"keyup",this._disableable.enabled(r=>{r.key===" "&&(this._selectable.press(),r.preventDefault(),r.stopPropagation())})),nu(t)}get checked(){return this._selectable.isSelected()}set checked(t){this._detangled(()=>{t?this._selectable.select():this._selectable.deselect()})()}};function nu(i){i.closest("label")?.addEventListener("click",t=>{i.contains(t.target)||i.click()})}I("switch",aa);var na=class i extends L{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 it)&&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 lt(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 it||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 L&&t.firstElementChild instanceof HTMLButtonElement?t.firstElementChild:t}},la=class extends L{mount(){et(this,"label"),h(this,"aria-hidden","true"),this.closest("ui-field")?.associateLabel(this)}},oa=class extends L{mount(){et(this,"description"),h(this,"aria-hidden","true"),this.closest("ui-field")?.associateDescription(this)}};I("field",na);I("label",la);I("description",oa);var ua=class extends L{mount(){let t=et(this,"legend"),e=this.closest("fieldset");e&&h(e,"aria-labelledby",t)}};I("legend",ua);var Me=i=>i!=null;function Wn(i){let t={time:du,linear:ou,categorical:lu},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]))}
131,get type(){return a("index.type",e,()=>this.axis.defaultScale||(this.rawValues.every(o=>hu(o))?"time":"categorical"))},get values(){return a("index.values",e,()=>this.rawValues.map(o=>this.type==="time"?ws(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||!Me(c[f.field]))return;p.push(c[f.field])}if(f.type==="stack"){let g=Number(f.gap.replace("px","")),v=0,x=0,C=!1,O=!1;f.children.forEach(E=>{if(E.type==="bar"){if(!E.field||!Me(c[E.field]))return;let M=c[E.field];M>=0?(C&&(v+=g),v+=M,C=!0):(O&&(x-=g),x+=M,O=!0)}}),C&&p.push(v),O&&p.push(x)}}),p),[])),u=l.data.flatMap(c=>l.stacksMetadata.reduce((p,b)=>{let f=Number(b.gap.replace("px","")),g=0,v=0,x=!1,C=!1;return b.children.forEach(O=>{if(O.type==="bar"){if(!O.field||!Me(c[O.field]))return;let E=c[O.field];E>=0?(x&&(g+=f),g+=E,x=!0):(C&&(v-=f),v+=E,C=!0)}}),x&&p.push(g),C&&p.push(v),p},[])),d=l.data.flatMap(c=>this.keys.reduce((p,b)=>(Me(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=$n(l.data,this,ys(this.type,this.values)),u=qn(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,()=>ys(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=$n(l.data,this,ys(this.type,this.values)),u=qn(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("y.domain",e,()=>ys(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=>
131Me(f[u])))return console.warn(`ui-chart: series field "${u}" does not exist`),o;let d=[],c=[];l.data.forEach(f=>{if(!Me(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,v=l.dimensions.value.axis.scale(f[u]).center;c.push({x:l.horizontal?v:g,y:l.horizontal?g:v,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:v}){let{start:x,center:C,width:O}=l.dimensions.index.axis.scale(l.dimensions.index.axis.domain[0],{area:l.dimensions.index.asArea}),E=v;f.match(/^(\d+)%$/)?f=O*Number(f.replace("%",""))/100:f=Number(f.replace("px",""));let M=(O-f)/2;return l.data.flatMap(B=>{let V=B[u];if(!Me(V))return[];let{start:Y}=l.dimensions.index.axis.scale(B[l.dimensions.index.key],{area:l.dimensions.index.asArea}),N,U,$,q,z=E;return l.horizontal?(N=V>=0?l.dimensions.value.axis.scale(0).center:l.dimensions.value.axis.scale(V).center,U=Y+M,$=V>=0?l.dimensions.value.axis.scale(V).center-N:l.dimensions.value.axis.scale(0).center-N,q=f,$<g&&(V<0&&(N-=g-$),$=g)):(N=Y+M,U=V>=0?l.dimensions.value.axis.scale(V).center:l.dimensions.value.axis.scale(0).center,q=V>=0?l.dimensions.value.axis.scale(0).center-U:l.dimensions.value.axis.scale(V).center-U,$=f,q<g&&(U-=g-q,q=g)),z=vs(z,V,l.horizontal),[{x:N,y:U,width:$,height:q,path:()=>Qe(N,U,$,q,z)}]})},linePath(f="smooth"){let g={smooth:v=>Bn(v,l.horizontal?"y":"x"),none:Un}[f];return this.segments.map(v=>g(v.map(x=>[x.x,x.y]))).filter(Boolean).join(" ")},areaPath(f="smooth"){let g={smooth:v=>Bn(v,l.horizontal?"y":"x"),none:Un}[f];return this.segments.map(v=>{let x=g(v.map(M=>[M.x,M.y]));if(!x)return"";let C=v[0],O=v[v.length-1],E=l.dimensions.value.axis.scale(l.dimensions.value.axis.domain[0]).center;return l.horizontal?`${x} L${E},${O.y} L${E},${C.y} Z`:`${x} L${O.x},${E} L${C.x},${E} 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 v=(f-g)/2,x=Number(d.gap.replace("px","")),C=[],O=[],E=d.radius,M=[],B=[];return E&&u.forEach(V=>{V.type==="bar"&&o[V.field].forEach((Y,N)=>{Y>=0?(M[N]=V.field,B[N]===void 0&&(B[N]=V.field)):(B[N]=V.field,M[N]===void 0&&(M[N]=V.field))})}),u.reduce((V,Y)=>{if(Y.type==="bar"){let N=[];o[Y.field].forEach((U,$)=>{C[$]===void 0&&(C[$]=0,O[$]=0);let{start:q}=l.dimensions.index.axis.scale(l.data[$][l.dimensions.index.key],{area:l.dimensions.index.asArea}),z,X,st,A,Z=Number(Y.minHeight.replace("px","")),K=Y.radius;if(l.horizontal?(z=U>=0?l.dimensions.value.axis.scale(0).center:l.dimensions.value.axis.scale(U).center,X=q+v,st=U>=0?l.dimensions.value.axis.scale(U).center-z:l.dimensions.value.axis.scale(0).center-z,A=g):(z=q+v,X=U>=0?l.dimensions.value.axis.scale(U).center:l.dimensions.value.axis.scale(0).center,A=U>=0?l.dimensions.value.axis.scale(0).center-X:l.dimensions.value.axis.scale(U).center-X,st=g),E){let bt=Y.field===M[$],Q=Y.field===B[$],tt={topLeft:0,topRight:0,bottomLeft:0,bottomRight:0};bt&&(tt.topLeft=E.topLeft,tt.topRight=E.topRight),Q&&(tt.bottomLeft=E.bottomLeft,tt.bottomRight=E.bottomRight),U<0?K={topLeft:tt.bottomLeft,topRight:tt.bottomRight,bottomLeft:tt.topLeft,bottomRight:tt.topRight}:K=tt}l.horizontal?(st<Z&&(U<0&&(z-=Z-st),st=Z),z=U>=0?z+C[$]:z-O[$]):(X=U>=0?X-C[$]:X+O[$],A<Z&&(X-=Z-A,A=Z)),K=vs(K,U,l.horizontal);let H={x:z,y:X,width:st,height:A,path:()=>Qe(z,X,st,A,K)};U>=0?C[$]+=(l.horizontal?st:A)+x:O[$]+=(l.horizontal?st:A)+x,N.push(H)}),V[Y.field]=N}return V},{})}}))})},get groupedSeries(){return a("groupedSeries",e+s,()=>l.groupsMetadata.map(o=>{let u={},d=[];
131return 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 v=(f-g)/2,x=o.gap??"2%";x.match(/^(\d+)%$/)?x=g*Number(x.replace("%",""))/100:x=Number(x.replace("px",""));let C=d.length,O=x*(C-1),E=C,M=d.reduce((Y,N)=>(N.width&&(N.width.match(/^(\d+)%$/)?Y+=g*Number(N.width.replace("%",""))/100:Y+=Number(N.width.replace("px","")),E--),Y),0),B=E>0?(g-M-O)/E:0;B===0&&(v=(f-(M+O))/2);let V=v;return d.reduce((Y,N,U)=>{let $=B;if(N.width&&(N.width.match(/^(\d+)%$/)?$=g*Number(N.width.replace("%",""))/100:$=Number(N.width.replace("px",""))),U>0&&(V+=x),N.type==="bar"){let q=[];u[N.field].forEach((z,X)=>{let{start:st}=l.dimensions.index.axis.scale(l.data[X][l.dimensions.index.key],{area:l.dimensions.index.asArea}),A,Z,K,H,bt=Number(N.minHeight.replace("px","")),Q=N.radius;l.horizontal?(A=z>=0?l.dimensions.value.axis.scale(0).center:l.dimensions.value.axis.scale(z).center,Z=st+V,K=z>=0?l.dimensions.value.axis.scale(z).center-A:l.dimensions.value.axis.scale(0).center-A,H=$,K<bt&&(z<0&&(A-=bt-K),K=bt)):(A=st+V,Z=z>=0?l.dimensions.value.axis.scale(z).center:l.dimensions.value.axis.scale(0).center,H=z>=0?l.dimensions.value.axis.scale(0).center-Z:l.dimensions.value.axis.scale(z).center-Z,K=$,H<bt&&(Z-=bt-H,H=bt)),Q=vs(Q,z,l.horizontal);let tt={x:A,y:Z,width:K,height:H,path:()=>Qe(A,Z,K,H,Q)};q.push(tt)}),Y[N.field]=q}if(N.type==="stack"){let q=[],z=Number(N.gap.replace("px","")),X=[],st=[],A=N.radius,Z=[],K=[];A&&N.children.forEach(H=>{H.type==="bar"&&u[H.field].forEach((bt,Q)=>{bt>=0?(Z[Q]=H.field,K[Q]===void 0&&(K[Q]=H.field)):(K[Q]=H.field,Z[Q]===void 0&&(Z[Q]=H.field))})}),N.children.forEach(H=>{if(H.type==="bar"){let bt=[];u[H.field].forEach((Q,tt)=>{X[tt]===void 0&&(X[tt]=0,st[tt]=0);let{start:ti}=l.dimensions.index.axis.scale(l.data[tt][l.dimensions.index.key],{area:l.dimensions.index.asArea}),_t,Ct,Tt,It,zt=Number(H.minHeight.replace("px","")),ae=H.radius;if(l.horizontal?(_t=Q>=0?l.dimensions.value.axis.scale(0).center:l.dimensions.value.axis.scale(Q).center,Ct=ti+V,Tt=Q>=0?l.dimensions.value.axis.scale(Q).center-_t:l.dimensions.value.axis.scale(0).center-_t,It=$):(_t=ti+V,Ct=Q>=0?l.dimensions.value.axis.scale(Q).center:l.dimensions.value.axis.scale(0).center,It=Q>=0?l.dimensions.value.axis.scale(0).center-Ct:l.dimensions.value.axis.scale(Q).center-Ct,Tt=$),A){let S=H.field===Z[tt],k=H.field===K[tt],_={topLeft:0,topRight:0,bottomLeft:0,bottomRight:0};S&&(_.topLeft=A.topLeft,_.topRight=A.topRight),k&&(_.bottomLeft=A.bottomLeft,_.bottomRight=A.bottomRight),Q<0?ae={topLeft:_.bottomLeft,topRight:_.bottomRight,bottomLeft:_.topLeft,bottomRight:_.topRight}:ae=_}l.horizontal?(Tt<zt&&(Q<0&&(_t-=zt-Tt),Tt=zt),_t=Q>=0?_t+X[tt]:_t-st[tt]):(It<zt&&(Ct-=zt-It,It=zt),Ct=Q>=0?Ct-X[tt]:Ct+st[tt]),ae=vs(ae,Q,l.horizontal);let T={x:_t,y:Ct,width:Tt,height:It,path:()=>Qe(_t,Ct,Tt,It,ae)};Q>=0?X[tt]+=(l.horizontal?Tt:It)+z:st[tt]+=(l.horizontal?Tt:It)+z,bt.push(T)}),Y[H.field]=bt}})}return V+=$,Y},{})}}}))},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 vs(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 ys(i,t){let e=[...new Set(t)];return i==="time"?cu(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 $n(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))),v=f/g;v<1.5?d=1:v<3?d=2:v<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,v)=>c+(b-c)*(v/(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]=Hn(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 qn(i,t,e,s,r,a,n){let l=[];return t==="time"?(e||([e]=Hn(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 lu(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 ou(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 Bn(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:v}=s(c),{x,y:C}=s(p),O=g-b,E=x-g,M=(v-f)/(O||E<0&&-0),B=(C-v)/(E||O<0&&-0),V=(M*E+B*O)/(O+E);return(e(M)+e(B))*Math.min(Math.abs(M),Math.abs(B),.5*Math.abs(V))||0},a=(d,c,p)=>{let{x:b,y:f}=s(d),{x:g,y:v}=s(c),x=g-b;return x?(3*(v-f)/x-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:v}=s(p),x=(v-g)/3,C=d===0?a(c,p,f):i[d-1]?r(i[d-1],c,p):f,O=t==="x"?c[0]+x:c[0]+x*C,E=t==="x"?c[1]+x*C:c[1]+x,M=t==="x"?p[0]-x:p[0]-x*f,B=t==="x"?p[1]-x*f:p[1]-x;n+=`C${O},${E} ${M}
131,${B} ${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,v=t==="x"?u[1]+b*d:u[1]+b,x=t==="x"?o[0]-b:o[0]-b*f,C=t==="x"?o[1]-b*f:o[1]-b;n+=`C${g},${v} ${x},${C} ${o[0]},${o[1]}`}return n}function uu(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 Un(i){return uu(i,0)}function Qe(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,v=i,x=i+e,C="";return p?(C+=`M${v},${d+a}`,C+=`A${a},${a} 0 0 1 ${v+a},${d}`):C+=`M${v},${d}`,b?(C+=`H${x-n}`,C+=`A${n},${n} 0 0 1 ${x},${d+n}`):C+=`H${x}`,f?(C+=`V${c-l}`,C+=`A${l},${l} 0 0 1 ${x-l},${c}`):C+=`V${c}`,g?(C+=`H${v+o}`,C+=`A${o},${o} 0 0 1 ${v},${c-o}`):C+=`H${v}`,C+=`V${d+(p?a:0)}`,C+="Z",C}function hu(i){return i instanceof Date||typeof i=="string"&&i.includes("-")&&!isNaN(Date.parse(i))}function cu(i){return i.sort((t,e)=>typeof t=="string"?t.localeCompare(e):t-e),[ws(i[0]),ws(i[i.length-1])]}function du(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=ws(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,v=t[0]+f*g,x=v+g/2,C=v+g;return{start:v,center:x,end:C,width:g}}let b=t[0]+p*n;return{start:b,center:b,end:b,width:0}}}function Hn(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,v;switch(s){case"second":f={hour:"numeric",minute:"numeric",second:"numeric"},g=E=>new Date(Date.UTC(E.getUTCFullYear(),E.getUTCMonth(),E.getUTCDate(),E.getUTCHours(),E.getUTCMinutes(),E.getUTCSeconds()+1)),v=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=E=>new Date(Date.UTC(E.getUTCFullYear(),E.getUTCMonth(),E.getUTCDate(),E.getUTCHours(),E.getUTCMinutes()+1)),v=new Date(Date.UTC(a.getUTCFullYear(),a.getUTCMonth(),a.getUTCDate(),a.getUTCHours(),a.getUTCMinutes()));break;case"hour":f={hour:"numeric",minute:"numeric"},g=E=>new Date(Date.UTC(E.getUTCFullYear(),E.getUTCMonth(),E.getUTCDate(),E.getUTCHours()+1)),v=new Date(Date.UTC(a.getUTCFullYear(),a.getUTCMonth(),a.getUTCDate(),a.getUTCHours()));break;case"day":f={day:"numeric"},g=E=>new Date(Date.UTC(E.getUTCFullYear(),E.getUTCMonth(),E.getUTCDate()+1)),v=new Date(Date.UTC(a.getUTCFullYear(),a.getUTCMonth(),a.getUTCDate()));break;case"week":f={day:"numeric",month:"short"},g=E=>new Date(Date.UTC(E.getUTCFullYear(),E.getUTCMonth(),E.getUTCDate()+7)),v=new Date(Date.UTC(a.getUTCFullYear(),a.getUTCMonth(),a.getUTCDate()));break;case"month":f={month:"short",day:"numeric"},g=E=>new Date(Date.UTC(E.getUTCFullYear(),E.getUTCMonth()+1,1)),v=new Date(Date.UTC(a.getUTCFullYear(),a.getUTCMonth(),1));break;case"year":f={year:"numeric"},g=E=>new Date(Date.UTC(E.getUTCFullYear()+1,0,1)),v=new Date(Date.UTC(a.getUTCFullYear(),0,1));break;default:}if(!g)if(d<1){f={hour:"numeric",minute:"numeric"};let E=e?Math.max(1,Math.floor(u/(e-1))):1;g=M=>new Date(Date.UTC(M.getUTCFullYear(),M.getUTCMonth(),M.getUTCDate(),M.getUTCHours(),M.getUTCMinutes()+E)),v=new Date(Date.UTC(a.getUTCFullYear(),a.getUTCMonth(),a.getUTCDate(),a.getUTCHours()))}else if(c<1){f={hour:"numeric"};let E=e?Math.max(1,Math.floor(d/(e-1))):1;g=M=>new Date(Date.UTC(M.getUTCFullYear(),M.getUTCMonth(),M.getUTCDate(),M.getUTCHours()+E)),v=new Date(Date.UTC(a.getUTCFullYear(),a.getUTCMonth(),a.getUTCDate(),0))}else if(c<=7){f={weekday:"short",hour:"numeric"};let E=e?Math.max(1,Math.floor(d/(e-1))):6;g=M=>new Date(Date.UTC(M.getUTCFullYear(),M.getUTCMonth(),M.getUTCDate(),M.getUTCHours()+E)),v=new Date(Date.UTC(a.getUTCFullYear(),a.getUTCMonth(),a.getUTCDate(),0))}else if(c<=30){f={month:"short",day:"numeric"};let E=e?Math.max(1,Math.floor(c/(e-1))):1;g=M=>new Date(Date.UTC(M.getUTCFullYear(),M.getUTCMonth(),M.getUTCDate()+E)),v=new Date(Date.UTC(a.getUTCFullYear(),a.getUTCMonth(),a.getUTCDate()))}else if(p<=6){f={month:"short",day:"numeric"};let E=e?Math.max(1,Math.floor(c/(e-1))):7;g=M=>new Date(Date.UTC(M.getUTCFullYear(),M.getUTCMonth(),M.getUTCDate()+E)),v=new Date(Date.UTC(a.getUTCFullYear(),a.getUTCMonth(),a.getUTCDate()))}else if(b<2){f={month:"short"};let E=e?Math.max(1,Math.floor(p/(e-1))):1;g=M=>new Date(Date.UTC(M.getUTCFullYear(),M.getUTCMonth()+E,1)),v=new Date(Date.UTC(a.getUTCFullYear(),a.getUTCMonth()))}else{f={year:"numeric"};let E=e?Math.max(1,Math.floor(b/(e-1))):1;g=M=>new Date(Date.UTC(M.getUTCFullYear()+E,0,1)),v=new Date(Date.UTC(a.getUTCFullYear(),0,1))}let x=a;if(r){let E=g(v);for(;E<=a;)v=E,E=g(v);x=v}let C=[x],O=x;for(;O<=n;)O=g(O),O<=n&&C.push(new Date(O.getTime()));return[f,C]}function ws(i){if(i instanceof Date)return i;let{year:t,month:e,day:s,hour:r,minute:a,second:n,millisecond:l}=fu(i);return new Date(Date.UTC(t,e-1,s,r,a,n,l))}function fu(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 Yn=Math.PI*2,pu=-Math.PI/2,bu=1e-9,As=["blue","violet","emerald","amber","rose","cyan","fuchsia","lime","orange","teal","indigo","pink","sky","green","yellow","red","purple"];function zn(i,{field:t="value",labelField:e="index",colorAssignments:s=new Map}={}){let{items:r,issues:a}=mu(i,{field:t,labelField:e});return{sectors:vu(gu(r,s)),issues:a}}function mu(i,{field:t="value",labelField:e="index"}={}){let s=new Set,r=[];
131return i.forEach((a,n)=>{let l=a[t];if(l==null)return;let o=wu(l);if(!Number.isFinite(o))return s.add("invalid");if(o<0)return s.add("negative");if(o===0)return;let u=a.color===void 0||a.color===null?null:String(a.color);u!==null&&!As.includes(u)&&(s.add("invalid-color"),u=null),r.push({key:xu(a,e,n),datum:a,label:a[e],value:o,index:n,color:u})}),i.length>0&&i.every(a=>a[t]===void 0)&&s.add("missing-field"),new Set(r.map(a=>String(a.key))).size!==r.length&&s.add("duplicate-key"),{items:r,issues:[...s]}}function gu(i,t=new Map,e=As){let s=[...new Set(i.filter(a=>!a.color).map(a=>String(a.key)))],r=new Set(s.filter(a=>t.has(a)).map(a=>t.get(a)));return s.filter(a=>!t.has(a)).sort().forEach(a=>{let n=Su(a)%e.length;if(r.size<e.length)for(;r.has(e[n]);)n=(n+1)%e.length;t.set(a,e[n]),r.add(e[n])}),i.map(a=>({...a,color:a.color??t.get(String(a.key))}))}function vu(i){let t=i.reduce((s,r)=>s+r.value,0);if(!(t>0))return[];let e=pu;return i.map(s=>{let r=e;return e+=s.value/t*Yn,{...s,total:t,percentage:s.value/t,startAngle:r,endAngle:e}})}function Gn({width:i,height:t,inset:e={},innerRadius:s=0,separatorWidth:r=0}){let a=e.left??0,n=e.right??0,l=e.top??0,o=e.bottom??0,u=Math.max(0,i-a-n),d=Math.max(0,t-l-o),c=Math.max(0,Math.min(u,d)/2-r/2),p=Au(s,c);return p=Math.min(Math.max(0,p),Math.max(0,c-1)),{cx:a+u/2,cy:l+d/2,outerRadius:c,innerRadius:p}}function jn({cx:i,cy:t,innerRadius:e=0,outerRadius:s,startAngle:r,endAngle:a,cornerRadius:n=0}){let l=Math.max(0,e),o=s,u=r,d=a,c=d-u;if(!(o>0)||!(c>0))return"";let p=(x,C)=>`${i+Math.cos(C)*x},${t+Math.sin(C)*x}`,b=(x,C,O,E)=>`A${x},${x} 0 ${C} ${O} ${E}`;if(c>=Yn-bu){let x=u+Math.PI,C=`M${p(o,u)} ${b(o,1,1,p(o,x))} ${b(o,1,1,p(o,u))} Z`;return l<=0?C:`${C} M${p(l,u)} ${b(l,1,0,p(l,x))} ${b(l,1,0,p(l,u))} Z`}let{outer:f,inner:g}=yu(n,l,o,c),v=[];if(f>0){let x=o-f,C=Math.min(Math.asin(f/x),c/2),O=x*Math.cos(C);v.push(`M${p(O,u)}`),v.push(b(f,0,1,p(o,u+C))),v.push(b(o,c-2*C>Math.PI?1:0,1,p(o,d-C))),v.push(b(f,0,1,p(O,d)))}else v.push(`M${p(o,u)}`),v.push(b(o,c>Math.PI?1:0,1,p(o,d)));if(l<=0)v.push(`L${i},${t}`);else if(g>0){let x=l+g,C=Math.min(Math.asin(g/x),c/2),O=x*Math.cos(C);v.push(`L${p(O,d)}`),v.push(b(g,0,1,p(l,d-C))),v.push(b(l,c-2*C>Math.PI?1:0,0,p(l,u+C))),v.push(b(g,0,1,p(O,u)))}else v.push(`L${p(l,d)}`),v.push(b(l,c>Math.PI?1:0,0,p(l,u)));return v.push("Z"),v.join(" ")}function yu(i,t,e,s){let r=Math.min(Math.max(0,Number(i)||0),(e-t)/2),a=r,n=t>0?r:0;if(r>0&&s<Math.PI){let l=Math.sin(s/2);a=Math.min(a,e*l/(1+l)),l<1&&(n=Math.min(n,t*l/(1-l)))}return{outer:a>1e-6?a:0,inner:n>1e-6?n:0}}function wu(i){return typeof i=="number"?i:typeof i=="string"&&i.trim()!==""?Number(i):NaN}function Au(i,t){if(typeof i=="number")return i;let e=String(i??"").trim();return e.endsWith("%")?t*(Number(e.slice(0,-1))||0)/100:Number(e.replace(/px$/,""))||0}function xu(i,t,e){return i.id!==void 0&&i.id!==null?i.id:i[t]!==void 0&&i[t]!==null?i[t]:e}function Su(i){let t=2166136261;for(let e=0;e<i.length;e++)t^=i.charCodeAt(e),t=Math.imul(t,16777619);return t>>>0}var ha=class extends L{boot(){this._data=this.hasAttribute("value")?JSON.parse(this.getAttribute("value")):[],this._observable=new Xt,this._selectable={getState:()=>this._data,setState:t=>{this._data=t,this._observable.notify("data",this._data)}},this._controllable=new G(this),this._controllable.initial(t=>t&&this._selectable.setState(t)),this._controllable.getter(()=>this._selectable.getState()),this._controllable.setter(t=>{this._selectable.setState(t)}),this._pieColorAssignments=new Map}mount(){this._valueOnUnmount!==void 0&&this._valueOnUnmount!==this.getAttribute("value")&&(this._data=this.hasAttribute("value")?JSON.parse(this.getAttribute("value")):[]),this.querySelectorAll("[data-appended]").forEach(s=>s.remove());let t=this.querySelector('template[name="svg"]'),e=li(t);t.after(e),this.init(t,e)}unmount(){this._valueOnUnmount=this.getAttribute("value"),this._observable=new Xt}init(t,e){let s=this.hasAttribute("horizontal"),r=this.hasAttribute("locale")?this.getAttribute("locale"):Wi(),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"]'),pie:t.content.querySelector('template[name="pie"]'),axes:{x:{template:t.content.querySelector('template[name="axis"][axis="x"]'),axisLine
131: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(T=>{u.groups.push(T)}),t.content.querySelectorAll('template[name="stack"]:not(template[name="group"] template[name="stack"])').forEach(T=>{u.stacks.push(T)}),t.content.querySelectorAll('template[name="bar"]:not(template[name="stack"] template[name="bar"]):not(template[name="group"] template[name="bar"])').forEach(T=>{u.bars[T.getAttribute("field")]=T,a=!0}),t.content.querySelectorAll('template[name="line"]').forEach(T=>{u.lines[T.getAttribute("field")]=T,n=!0}),t.content.querySelectorAll('template[name="area"]').forEach(T=>{u.areas[T.getAttribute("field")]=T,l=!0}),t.content.querySelectorAll('template[name="point"]').forEach(T=>{u.points[T.getAttribute("field")]=T,o=!0});let d=()=>{},c=()=>{},p=()=>{},b=()=>{},f=null,g="line",v=null,x=null,C=null,O=[];t.content.querySelectorAll('template[name="stack"]:not(template[name="group"] template[name="stack"])').forEach(T=>{let S={width:T.getAttribute("width")??"90%",gap:T.getAttribute("gap")??"0",radius:T.hasAttribute("radius")?Pe(T.getAttribute("radius")):null,children:[]};T.querySelectorAll('template[name="bar"]').forEach(k=>{let _={type:"bar",field:k.getAttribute("field"),width:k.getAttribute("width"),minHeight:k.getAttribute("min-height")??"0",radius:Pe(k.getAttribute("radius")??"0")};S.children.push(_),a=!0}),O.push(S)});let E=[];t.content.querySelectorAll('template[name="group"]').forEach(T=>{let S={width:T.getAttribute("width")??"90%",gap:T.getAttribute("gap")??"2%",children:[]};T.querySelectorAll('template[name="stack"], template[name="bar"]:not(template[name="stack"] template[name="bar"])').forEach(k=>{let _={};k.getAttribute("name")==="stack"?(_={type:"stack",width:k.getAttribute("width"),gap:k.getAttribute("gap")??"0",radius:k.hasAttribute("radius")?Pe(k.getAttribute("radius")):null,children:[]},k.querySelectorAll('template[name="bar"]').forEach(D=>{let P={type:"bar",field:D.getAttribute("field"),width:D.getAttribute("width"),minHeight:D.getAttribute("min-height")??"0",radius:Pe(D.getAttribute("radius")??"0")};_.children.push(P),a=!0})):k.getAttribute("name")==="bar"&&(_={type:"bar",field:k.getAttribute("field"),width:k.getAttribute("width"),minHeight:k.getAttribute("min-height")??"0",radius:Pe(k.getAttribute("radius")??"4 0")},a=!0),S.children.push(_)}),E.push(S)});let M=a||n||l||o,B=M?n||l:!0,V=t.content.querySelectorAll('template[name="pie"]'),Y=V.length>0,N=!!(u.cursor||u.zeroLine||u.axes.x.template||u.axes.y.template),U=null;Y&&(M||N)?U="ui-chart: a pie cannot be combined with bar, line, area, point, axis, cursor, or zero-line marks, so nothing was rendered.":V.length>1&&(U="ui-chart: only one pie is allowed per chart, so nothing was rendered.");let $=null;Y&&($={field:u.pie.getAttribute("field")||"value",labelField:u.pie.getAttribute("label-field")||"index",innerRadius:u.pie.getAttribute("inner-radius")??"0",radius:Number(u.pie.getAttribute("radius"))||0,separatorWidth:Number(u.pie.firstElementChild?.getAttribute("stroke-width"))||0}),v=document.createElementNS("http://www.w3.org/2000/svg","rect"),v.setAttribute("data-overlay",""),v.setAttribute("fill","none"),v.setAttribute("pointer-events","all"),Y&&v.setAttribute("pointer-events","none"),v.addEventListener("mousemove",qi(function(T){d(T),c(T),p(T),b(T)},1)),v.addEventListener("mouseleave",()=>{d(null),c(null),p(null),b(null)}),e.appendChild(v),u.cursor&&(f=vt(u.cursor),f.setAttribute("data-cursor",""),e.appendChild(f));let q={left:8,right:8,top:8,bottom:8};if(u.svg?.hasAttribute("gutter")){let T=u.svg?.getAttribute("gutter").split(" ").map(S=>S.replace("px","")).map(Number);T.length===1?(q.top=T[0],q.right=T[0],q.bottom=T[0],q.left=T[0]):T.length===2?(q.top=T[0],q.right=T[1],q.bottom=T[0],q.left=T[1]):T.length===3?(q.top=T[0],q.right=T[1],q.bottom=T[2],q.left=T[1]):T.length===4&&(q.top=T[0],q.right=T[1],q.bottom=T[2],q.left=T[3])}let[z,X]=Eu(e,a,s),st=e.parentElement.getBoundingClientRect();if(st.width===0||st.height===0){let T=new ResizeObserver(S=>{let k=S[0];k.contentRect.width>0&&k.contentRect.height>0&&(T.disconnect(),this.init(t,e))});T.observe(e.parentElement),this.onUnmount(()=>T.disconnect());return}U&&console.warn(U),u.tooltip&&(x=li(u.tooltip),u.tooltip.after(x)),u.summary&&(C=li(u.summary),u.summary.after(C));let A=Wn({horizontal:s,locale:r,data:this._data,stacksMetadata:O,groupsMetadata:E,width:st.width,height:st.height,inset:{left:0,right:0,top:0,bottom:0},dimensions:{index:{key:z,asArea:a||u.cursor?.innerHTML?.match(/type="([^"]+)"/)?.[1]==="area"},value:{keys:X,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}}}),Z=T=>{let S=u.tooltip.content.cloneNode(!0).firstElementChild;S.querySelectorAll("slot").forEach(k=>{let _=k.getAttribute("field");if(_){let D=k.hasAttribute("format")?JSON.parse(k.getAttribute("format")):null,P=T[_];if(D===null)return k.textContent=P;D={...D,timeZone:"UTC"}
131,Zn(P)?P=Number(P).toLocaleString(A.locale,D):Jn(P)&&(P=new Date(P).toLocaleDateString(A.locale,D)),k.textContent=P}}),x.innerHTML=S.innerHTML},K=(T,S)=>{let k=x.getBoundingClientRect(),_=e.getBoundingClientRect(),D=_.width-(T+k.width+15),P=_.height-(S+k.height+15),R=D<0?T-k.width-15:T+15,Mt=P<0?S-k.height-15:S+15,Ut=0,dt=0;if(x.offsetParent){let Oe=x.offsetParent.getBoundingClientRect();Ut=_.left-(Oe.left+x.offsetParent.clientLeft)-x.offsetLeft,dt=_.top-(Oe.top+x.offsetParent.clientTop)-x.offsetTop}x.style.transform=`translate(${Ut+R}px, ${dt+Mt}px)`},H=(T,S)=>{let k=u.summary.content.cloneNode(!0).firstElementChild;k.querySelectorAll("slot").forEach(_=>{let D=_.getAttribute("field");if(D){let P=_.hasAttribute("format")?JSON.parse(_.getAttribute("format")):{};P={...P,timeZone:"UTC"};let R=_.hasAttribute("fallback")&&S?_.getAttribute("fallback"):T[D];Zn(R)?R=Number(R).toLocaleString(A.locale,P):Jn(R)&&(R=new Date(R).toLocaleString(A.locale,P)),_.textContent=R}}),C.innerHTML=k.innerHTML},bt=()=>{e.appendChild(v),e.querySelectorAll("[data-grid-line-group]").forEach(k=>v.before(k)),e.querySelectorAll("[data-axis-line]").forEach(k=>v.before(k)),g==="area"&&e.querySelectorAll("[data-cursor]").forEach(k=>v.before(k));let T=0,S=0;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"], template[name="pie"]').forEach(k=>{let _=k.getAttribute("name"),D=k.getAttribute("field"),P;_==="group"?(P=e.querySelector(`[data-group][data-group-index="${T}"]`),T++):_==="stack"?(P=e.querySelector(`[data-stack][data-stack-index="${S}"]`),S++):_==="bar"?P=e.querySelector(`[data-bar-group][data-series="${D}
131"]`):_==="point"?P=e.querySelector(`[data-point-group][data-series="${D}"]`):_==="pie"?P=e.querySelector(`[data-pie-group][data-series="${D}"]`):P=e.querySelector(`[data-${_}][data-series="${D}"]`),P&&v.before(P)}),e.querySelectorAll("[data-zero-line]").forEach(k=>v.before(k)),g==="line"&&e.querySelectorAll("[data-cursor]").forEach(k=>v.before(k))},Q=()=>{let T=tl(e);_u(e,A,q,T),A.updateDimensions({width:A.width,height:A.height},{left:q.left+T.left,right:q.right+T.right,top:q.top+T.top,bottom:q.bottom+T.bottom})},tt=[],ti=()=>{if(!$||U)return;let{sectors:T,issues:S}=zn(A.data,{field:$.field,labelField:$.labelField,colorAssignments:this._pieColorAssignments});tt=T,S.forEach(k=>console.warn(ku(k,$.field)))};ti();let _t=()=>{let T=tt[tt.length-1];T&&H(T.datum,!0)},Ct=(T,S)=>{if(e.querySelectorAll("[data-sector]").forEach(k=>{w(k,"data-active"),w(k,"data-inactive")}),T===null){x&&w(x,"data-active"),C&&_t();return}if(e.querySelectorAll("[data-sector]").forEach(k=>{h(k,k===T.currentTarget?"data-active":"data-inactive","")}),x){let k=e.getBoundingClientRect();h(x,"data-active",""),x.style.setProperty("--flux-chart-color",Kn(S)),K(T.clientX-k.left,T.clientY-k.top),Z(S.datum)}C&&H(S.datum,!1)},Tt=(T=!0)=>{if(e.querySelector("[data-pie-group]")?.remove(),U||tt.length===0)return;let S=Gn({width:A.width,height:A.height,inset:A.inset,innerRadius:$.innerRadius,separatorWidth:$.separatorWidth}),k=document.createElementNS("http://www.w3.org/2000/svg","g");k.setAttribute("data-pie-group",""),k.setAttribute("data-series",$.field),tt.forEach(_=>{let D=vt(u.pie);D.setAttribute("data-sector",""),D.setAttribute("data-series",$.field),D.setAttribute("data-key",_.key),D.setAttribute("d",jn({...S,startAngle:_.startAngle,endAngle:_.endAngle,cornerRadius:$.radius})),D.style.fill=Kn(_),D.addEventListener("mousemove",qi(P=>Ct(P,_),1)),D.addEventListener("mouseleave",()=>Ct(null)),k.appendChild(D)}),e.appendChild(k),C&&_t(),bt(),T&&(Q(),Tt(!1))},It=(T=!0)=>{if(h(e,"viewBox",`0 0 ${A.width} ${A.height}`),Y)return Tt(T);if(A.data.length!==0){if(A.data.length===1&&B){console.warn("ui-chart: chart only has one data point so charts with lines or areas cannot be rendered.");return}if(A.data[0][A.dimensions.index.key]===void 0){console.warn(`ui-chart: axis field "${A.dimensions.index.key}" does not exist`);return}if(Object.entries(A.series).forEach(([S,k])=>{let _=e.querySelector(`[data-bar-group][data-series="${S}"]`),D=u.bars[S];if(D){let P=D.hasAttribute("width")?D.getAttribute("width"):"90%",R=Pe(D.hasAttribute("radius")?D.getAttribute("radius"):"8 0"),Mt=D.hasAttribute("min-height")?Number(D.getAttribute("min-height")):0;_?.remove(),_=document.createElementNS("http://www.w3.org/2000/svg","g"),_.setAttribute("data-bar-group",""),_.setAttribute("data-series",S),k.bars({barWidth:P,minHeight:Mt,radius:R}).forEach(Ut=>{let dt=vt(D);dt.setAttribute("data-bar",""),dt.setAttribute("data-series",S),dt.setAttribute("d",Ut.path(R)),_.appendChild(dt)}),e.appendChild(_)}}),Object.entries(A.stackedSeries).forEach(([S,k])=>{let _=e.querySelector(`[data-stack][data-stack-index="${S}"]`),D=u.stacks[S];if(!D)return;_?.remove(),_=document.createElementNS("http://www.w3.org/2000/svg","g"),_.setAttribute("data-stack",""),_.setAttribute("data-stack-index",S);let P={bars:{}};D.querySelectorAll('template[name="bar"]').forEach(R=>{P.bars[R.getAttribute("field")]=R}),Object.entries(k.bars()).forEach(([R,Mt])=>{let Ut=P.bars[R],dt=document.createElementNS("http://www.w3.org/2000/svg","g");dt.setAttribute("data-bar-group",""),dt.setAttribute("data-series",R),Mt.forEach(Oe=>{let Gt=vt(Ut);Gt.setAttribute("data-bar",""),Gt.setAttribute("data-series",R),Gt.setAttribute("d",Oe.path()),dt.appendChild(Gt)}),_.appendChild(dt)}),e.appendChild(_)}),Object.entries(A.groupedSeries).forEach(([S,k])=>{let _=e.querySelector(`[data-group][data-group-index="${S}"]`),D=u.groups[S];if(!D)return;_?.remove(),_=document.createElementNS("http://www.w3.org/2000/svg","g"),_.setAttribute("data-group",""),_.setAttribute("data-group-index",S);let P={bars:{}};D.querySelectorAll('template[name="bar"]').forEach(R=>{P.bars[R.getAttribute("field")]=R}
131),Object.entries(k.bars()).forEach(([R,Mt])=>{let Ut=P.bars[R],dt=document.createElementNS("http://www.w3.org/2000/svg","g");dt.setAttribute("data-bar-group",""),dt.setAttribute("data-series",R),Mt.forEach(Oe=>{let Gt=vt(Ut);Gt.setAttribute("data-bar",""),Gt.setAttribute("data-series",R),Gt.setAttribute("d",Oe.path()),dt.appendChild(Gt)}),_.appendChild(dt)}),e.appendChild(_)}),Object.entries(A.series).forEach(([S,k])=>{let _=e.querySelector(`[data-line][data-series="${S}"]`),D=u.lines[S];if(D){let P=D.getAttribute("curve")||"smooth";if(_)_.setAttribute("d",k.linePath(P));else{let R=vt(D);R.setAttribute("data-line",""),R.setAttribute("data-series",S),R.setAttribute("d",k.linePath(P)),e.appendChild(R)}}}),Object.entries(A.series).forEach(([S,k])=>{let _=e.querySelector(`[data-area][data-series="${S}"]`),D=u.areas[S];if(D){let P=D.getAttribute("curve")||"smooth";if(_)_.setAttribute("d",k.areaPath(P));else{let R=vt(D);R.setAttribute("data-area",""),R.setAttribute("data-series",S),R.setAttribute("d",k.areaPath(P)),e.appendChild(R)}}}),Object.entries(A.series).forEach(([S,k])=>
131{let _=e.querySelector(`[data-point-group][data-series="${S}"]`),D=u.points[S];D&&(e.querySelector(`[data-point-group][data-series="${S}"]`)?.remove(),_=document.createElementNS("http://www.w3.org/2000/svg","g"),_.setAttribute("data-point-group",""),_.setAttribute("data-series",S),k.points.forEach(P=>{if(!isFinite(P.x)||!isFinite(P.y))return;let R=vt(D);R.setAttribute("data-point",""),R.setAttribute("data-series",S),R.setAttribute("cx",P.x),R.setAttribute("cy",P.y),_.appendChild(R)}),e.appendChild(_))}),b=S=>{e.querySelectorAll("[data-point-group]").forEach(k=>{if(k.querySelectorAll("[data-point]").forEach(_=>_.removeAttribute("data-active")),S){let _=S.clientX-e.getBoundingClientRect().left,D=S.clientY-e.getBoundingClientRect().top;_>=A.inset.left&&_<=A.width-A.inset.right&&D>=A.inset.top&&D<=A.height-A.inset.bottom&&A.closestIndexPoints(A.indexPosition(_,D)).forEach(R=>{let Mt=A.data.indexOf(R.datum);k.querySelectorAll("[data-point]")[Mt]?.setAttribute("data-active","")})}else k.querySelectorAll("[data-point]").forEach(_=>_.removeAttribute("data-active"))})},u.axes.x.template){if(u.axes.x.axisLine){e.querySelector('[data-axis-line][data-axis="x"]')?.remove();let S=vt(u.axes.x.axisLine);S.setAttribute("data-axis-line",""),S.setAttribute("data-axis","x"),S.setAttribute("x1",A.axes.x.range[0]),S.setAttribute("x2",A.axes.x.range[1]);let k=A.axes.x.position==="bottom"?Math.max(...A.axes.y.range):Math.min(...A.axes.y.range);S.setAttribute("y1",k),S.setAttribute("y2",k),e.appendChild(S)}if(u.axes.x.gridLine){e.querySelector('[data-grid-line-group][data-axis="x"]')?.remove();let S=document.createElementNS("http://www.w3.org/2000/svg","g");S.setAttribute("data-grid-line-group",""),S.setAttribute("data-axis","x"),A.axes.x.ticks.forEach(({value:k})=>{let _=vt(u.axes.x.gridLine);_.setAttribute("data-grid-line",""),_.setAttribute("data-axis","x"),_.setAttribute("x1",A.axes.x.scale(k,{area:A.axes.x.dimension.asArea}).center),_.setAttribute("x2",A.axes.x.scale(k,{area:A.axes.x.dimension.asArea}).center),_.setAttribute("y1",A.inset.top),_.setAttribute("y2",A.height-A.inset.bottom),S.appendChild(_)}),e.appendChild(S)}if(u.axes.x.tickMark){e.querySelector('[data-tick-mark-group][data-axis="x"]')?.remove();let S=document.createElementNS("http://www.w3.org/2000/svg","g");S.setAttribute("data-tick-mark-group",""),S.setAttribute("data-axis","x"),A.axes.x.ticks.forEach(({value:k,label:_})=>{let D={x:A.axes.x.scale(k,{area:A.axes.x.dimension.asArea}).center,y:A.axes.x.position==="bottom"?Math.max(...A.axes.y.range):Math.min(...A.axes.y.range)},P=vt(u.axes.x.tickMark);P.setAttribute("data-tick-mark",""),P.setAttribute("data-axis","x"),P.setAttribute("transform",`translate(${D.x}, ${D.y})`),S.appendChild(P)}),e.appendChild(S)}if(u.axes.x.tickLabel){e.querySelector('[data-tick-label-group][data-axis="x"]')?.remove();let S=document.createElementNS("http://www.w3.org/2000/svg","g");S.setAttribute("data-tick-label-group",""),S.setAttribute("data-axis","x"),A.axes.x.ticks.forEach(({value:k,label:_})=>{let D={x:A.axes.x.scale(k,{area:A.axes.x.dimension.asArea}).center,y:A.axes.x.position==="bottom"?Math.max(...A.axes.y.range):Math.min(...A.axes.y.range)},P=vt(u.axes.x.tickLabel);P.querySelectorAll("slot").forEach(R=>R.replaceWith(document.createTextNode(_))),P.setAttribute("data-tick-label",""),P.setAttribute("data-axis","x"),P.setAttribute("transform",`translate(${D.x}, ${D.y})`),S.appendChild(P)}),e.appendChild(S),Xn(S,A.axes.x)}}if(u.axes.y.template){if(u.axes.y.axisLine){e.querySelector('[data-axis-line][data-axis="y"]')?.remove();let S=vt(u.axes.y.axisLine);S.setAttribute("data-axis-line",""),S.setAttribute("data-axis","y"),S.setAttribute("x1",A.axes.x.range[A.axes.y.position==="left"?0:1]),S.setAttribute("x2",A.axes.x.range[A.axes.y.position==="left"?0:1]),S.setAttribute("y1",A.axes.y.range[0]),S.setAttribute("y2",A.axes.y.range[1]),e.appendChild(S)}if(u.axes.y.gridLine){e.querySelector('[data-grid-line-group][data-axis="y"]')?.remove();let S=document.createElementNS("http://www.w3.org/2000/svg","g");S.setAttribute("data-grid-line-group",""),S.setAttribute("data-axis","y"),A.axes.y.ticks.forEach(({value:k,label:_})=>{let D={x:A.axes.x.range[0],y:A.axes.y.scale(k,{area:A.axes.y.dimension.asArea}).center},P=vt(u.axes.y.gridLine);P.setAttribute("data-grid-line",""),P.setAttribute("data-axis","y"),P.setAttribute("x1",A.inset.left),P.setAttribute("x2",A.width-A.inset.right),P.setAttribute("y1",D.y),P.setAttribute("y2",D.y),S.appendChild(P)}),e.appendChild(S)}if(u.axes.y.tickMark){e.querySelector('[data-tick-mark-group][data-axis="y"]')?.remove();let S=document.createElementNS("http://www.w3.org/2000/svg","g");S.setAttribute("data-tick-mark-group",""),S.setAttribute("data-axis","y"),A.axes.y.ticks.forEach(({value:k,label:_})=>{let D={x:A.axes.x.range[A.axes.y.position==="left"?0:1],y:A.axes.y.scale(k,{area:A.axes.y.dimension.asArea}).center},P=vt(u.axes.y.tickMark);P.setAttribute("data-tick-mark",""),P.setAttribute("data-axis","y"),P.setAttribute("transform",`translate(${D.x}, ${D.y})`),S.appendChild(P)}),e.appendChild(S)}if(u.axes.y.tickLabel){e.querySelector('[data-tick-label-group][data-axis="y"]')?.remove();let S=document.createElementNS("http://www.w3.org/2000/svg","g");S.setAttribute("data-tick-label-group",""),S.setAttribute("data-axis","y"),A.axes.y.ticks.forEach(({value:k,label:_})=>{let D={x:A.axes.x.range[A.axes.y.position==="left"?0:1],y:A.axes.y.scale(k,{area:A.axes.y.dimension.asArea}).center},P=vt(u.axes.y.tickLabel);P.querySelectorAll("slot").forEach(R=>R.replaceWith(document.createTextNode(_))),P.setAttribute("data-tick-label",""),P.setAttribute("data-axis","y"),P.setAttribute("transform",`translate(${D.x}, ${D.y})`),S.appendChild(P)}),e.appendChild(S),Xn(S,A.axes.y)}}if(e.querySelector("[data-zero-line]")?.remove(),u.zeroLine&&A.dimensions.value.axis.domain[0]<0&&A.dimensions.value.axis.domain[1]>0){let S=vt(u.zeroLine);S.setAttribute("data-zero-line",""),S.setAttribute("data-axis",A.dimensions.value.axis.axis);let{x1:k,x2:_,y1:D,y2:P}=A.dimensions.value.zeroLine();S.setAttribute("x1",k),S.setAttribute("x2",_),S.setAttribute("y1",D),S.setAttribute("y2",P),e.appendChild(S)}if(v&&(v.setAttribute("width",A.width),v.setAttribute("height",A.height),v.setAttribute("x",0),v.setAttribute("y",0)),f){g=f.getAttribute("type")??"line";let S=k=>
131{if(g==="area"){f.setAttribute("opacity","0.1");let{x:P,y:R,width:Mt,height:Ut}=A.cursor(k,"area"),dt=Pe(f.getAttribute("radius")??"0");f.setAttribute("fill","currentColor"),f.setAttribute("stroke","none"),f.setAttribute("d",Qe(P,R,Mt,Ut,dt));return}f.setAttribute("opacity","1");let[_,D]=A.cursor(k);f.setAttribute("d",`M ${_.x} ${_.y} L ${D.x} ${D.y}`)};d=k=>{if(k){let _=e.getBoundingClientRect(),D=k.clientX-_.left,P=k.clientY-_.top;if(D>=A.inset.left&&D<=A.width-A.inset.right&&P>=A.inset.top&&P<=A.height-A.inset.bottom){let R=A.closestIndexPoint(A.indexPosition(D,P));S(R)}else f.setAttribute("opacity","0")}else f.setAttribute("opacity","0")}}x&&(c=S=>{if(S===null)w(x,"data-active");else{let k=S.clientX-e.getBoundingClientRect().left,_=S.clientY-e.getBoundingClientRect().top;if(k>=A.inset.left&&k<=A.width-A.inset.right&&_>=A.inset.top&&_<=A.height-A.inset.bottom){let D=A.closestIndexPoint(A.indexPosition(k,_));if(D){h(x,"data-active","");let P=A.horizontal?k:D.center,R=A.horizontal?D.center:_;K(P,R),Z(D.datum)}else w(x,"data-active")}else w(x,"data-active")}}),C&&(p=S=>{let k=null;if(S!==null){let _=S.clientX-e.getBoundingClientRect().left,D=S.clientY-e.getBoundingClientRect().top;_>=A.inset.left&&_<=A.width-A.inset.right&&D>=A.inset.top&&D<=A.height-A.inset.bottom&&(k=A.closestIndexPoint(A.indexPosition(_,D)))}k=k||A.closestIndexPoint(A.dimensions.index.axis.range[1]),k&&H(k.datum,S===null)},p(null)),bt(),T&&(Q(),It(!1))}};this._observable.subscribe("resize",()=>{let T=e.parentElement.getBoundingClientRect();T.width===0||T.height===0||(A.updateDimensions({width:T.width,height:T.height},{left:0,right:0,top:0,bottom:0}),It(),f&&f.setAttribute("opacity","0"))}),this._observable.subscribe("data",()=>{A.updateData(this._data),ti(),A.updateDimensions({width:A.width,height:A.height},{left:0,right:0,top:0,bottom:0}),It()});let zt=new ResizeObserver(()=>{this._observable.notify("resize")});zt.observe(this),this.onUnmount(()=>zt.disconnect());let ae=new MutationObserver(T=>{T.forEach(S=>{S.attributeName==="value"&&this._selectable.setState(this.hasAttribute("value")?JSON.parse(this.getAttribute("value")):[])})});ae.observe(this,{attributes:!0,attributeFilter:["value"]}),this.onUnmount(()=>ae.disconnect())}};customElements.define("ui-chart",ha);function Eu(i,t=!1,e=!1){let s=null,r=[];return i.querySelectorAll('template[name="line"], template[name="area"], template[name="point"], template[name="pie"], 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"}),i.querySelectorAll('template[name="pie"][label-field]').forEach(a=>{s=a.getAttribute("label-field")}),r=Array.from(new Set(r)),s===null&&(s="index"),r.length===0&&!t&&(r=["value"]),[s,r]}function Kn(i){return`var(--color-${i.color}-500)`}function ku(i,t){return{"missing-field":`ui-chart: series field "${t}" does not exist`,invalid:"ui-chart: pie values must be finite numbers, so non-numeric values were omitted.",negative:"ui-chart: pie values must be positive, so negative values were omitted.","duplicate-key":"ui-chart: multiple pie sectors resolved to the same identity (id or label field), so their colors and updates may be ambiguous.","invalid-color":`ui-chart: pie "color" values must be one of ${As.join(", ")}, so unsupported colors fell back to the default palette.`}[i]}function vt(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 _u(i,t,e,s){let r=i.querySelector('[data-tick-label-group][data-axis="x"]');if(!r||t.axes.x.type!=="categorical"||ca(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=Qn(r),p=tl(i);s.bottom=Math.max(s.bottom,p.bottom),c();return}}}function Xn(i,t){if(ca(i,t)){if(t.axis==="x"&&t.type==="categorical")Qn(i);else if(t.axis==="x"&&t.type==="time"){let e=Cu(i);if(!ca(i,t))return;e(),Iu(i)}}}function ca(i,t){let e=Array.from(i.children);e=e.filter(s=>s.style.display!="none");for(let s=0;s<e.length;
131s++){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 Qn(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 Cu(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 Iu(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 Zn(i){return typeof i=="number"||typeof i=="string"&&!isNaN(Number(i))}function Jn(i){return i instanceof Date||typeof i=="string"&&!isNaN(Date.parse(i))}function tl(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 Pe(i){if(!i||i.trim()==="")throw new Error("Radius string cannot be empty");let t=i.trim().split(/\s+/).map(s=>{let r=s.replace(/px/,"");return Number(r)||0});if(t.length===0||t.every(s=>isNaN(s)))throw new Error(`Invalid radius string: "${i}"`);let e={topLeft:0,topRight:0,bottomRight:0,bottomLeft:0};if(t.length===1)e.topLeft=t[0],e.topRight=t[0],e.bottomRight=t[0],e.bottomLeft=t[0];else if(t.length===2)e.topLeft=t[0],e.topRight=t[0],e.bottomRight=t[1],e.bottomLeft=t[1];else if(t.length===4)e.topLeft=t[0],e.topRight=t[1],e.bottomRight=t[2],e.bottomLeft=t[3];else throw new Error(`Invalid radius string: "${i}". Must be 1, 2, or 4 numbers`);return e}var da=class extends L{boot(){h(this,"role","button"),this._disableable=new F(this),this._disableable.onInitAndChange(t=>{t?w(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()}};I("button",da);var fa=class extends L{mount(){this.onUnmount(m(this,"click",t=>{if(!t.target.closest("button,ui-button"))return;$i(this,s=>!!s._closeable)?._closeable?.close()}).off)}};I("close",fa);var pa=class extends L{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&&Ns(()=>{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 Pt(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++}}},ba=class extends L{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?Ns(()=>{this.toastTimeout=null,l()},s):null,a.destroyToast=()=>{a.isConnected&&(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 Pt(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=t.action||null,n=this.template();if(!n)return console.warn("ui-toast: no template element found",this);let l=n.content.cloneNode(!0).firstElementChild;return l.setAttribute("aria-atomic","true"),Object.entries(e).forEach(([o,u])=>{[null,void 0,!1].includes(u)||l.querySelectorAll(`slot[name="${o}"]`).forEach(d=>{d.replaceWith(document.createTextNode(u))})}),Object.entries(s).forEach(([o,u])=>{l.dataset[o]=u}),this.hydrateLinkTemplate(l,r),this.hydrateAction(l,a),l.querySelectorAll("slot").forEach(o=>o.remove()),l}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)&&!["label","text"].includes(a)){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.label??e.text??""))),s.replaceWith(r)}hydrateAction(t,e){let s=t.querySelector('template[name="action"]');if(!s)return;if(!e?.label||!e.href&&!e.event&&typeof e.onClick!="function"){s.remove();return}let r=s.content.cloneNode(!0).firstElementChild,a=r.querySelector("[data-flux-toast-action-button]"),n=r.querySelector("[data-flux-toast-action-link]"),l=e.href?n:a,o=e.href?a:n,u=l?.querySelector("[data-flux-toast-action-label]");if(!l||!u){s.remove();return}if(o?.remove(),u.textContent=e.label,s.replaceWith(r),e.href){this.hydrateActionLink(l,e),l.addEventListener("click",()=>{setTimeout(()=>t._closeable?.close())});return}l.addEventListener("click",()=>{typeof e.onClick=="function"?e.onClick():e.event&&(e.dismiss!==!1&&this.dismissAfterLoading(l,t),l.dispatchEvent(new CustomEvent(e.event,{bubbles:!0,composed:!0,detail:e.params||{}}))),!e.event&&e.dismiss!==!1&&t._closeable?.close()})}hydrateActionLink(t,e){Object.entries(e).forEach(([s,r])=>
131{if(![null,void 0,!1].includes(r)){if(s==="navigate"&&r)return t.setAttribute("wire:navigate","");if(["href","target","rel","download"].includes(s)){if(s==="download"&&r===!0)return t.setAttribute(s,"");t.setAttribute(s,r)}}})}dismissAfterLoading(t,e){let s=t.hasAttribute("data-loading"),r=new MutationObserver(()=>{if(t.hasAttribute("data-loading")){s=!0;return}s&&(r.disconnect(),e._closeable?.close())});r.observe(t,{attributes:!0,attributeFilter:["data-loading"]}),setTimeout(()=>{s||t.hasAttribute("data-loading")||(r.disconnect(),e._closeable?.close())},150)}};I("toast-group",pa);I("toast",ba);var ma=class i extends it{boot(){this._disableable=new F(this),this._disableable.onInitAndChange(t=>{this.walker().each(e=>{e.disabled=t})}),this._selectable=new yt(this),this._controllable=new G(this,{disabled:this._disabled,bubbles:!0}),this._focusable=new qt(this,{wrap:!0}),this._submittable=new at(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=J(),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 lt(this,(t,{skip:e,reject:s})=>{if(t instanceof i)return s();if(t.localName!=="ui-radio")return e()})}},ga=class extends it{boot(){let t=this;this._disableable=new F(this),this._selectable=new j(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 ht(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())})),Tu(t),m(t,"focus",e=>{ye()&&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 Tu(i){i.closest("label")?.addEventListener("click",t=>{i.contains(t.target)||i.click()})}I("radio-group",ma);I("radio",ga);var va=class extends L{boot(){m(this,"scroll",t=>{this.updateAttributes()},{passive:!0})}mount(){let t=new ResizeObserver(()=>{this.updateAttributes()});t.observe(this),this.onUnmount(()=>t.disconnect()),queueMicrotask(()=>{this.updateAttributes()})}updateAttributes(){this.scrollLeft>12?h(this,"data-scrolled-right",""):w(this,"data-scrolled-right"),this.scrollWidth-this.clientWidth-this.scrollLeft>12?h(this,"data-scrolled-left",""):w(this,"data-scrolled-left")}};I("table-scroll-area",va);var xs=class i extends L{boot(){this._disabled=this.hasAttribute("disabled")}mount(){this.walkPanels(t=>el(t)),new MutationObserver(t=>{this.walkPanels(e=>el(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 Ss)&&(t(r,a=>{e=!0,s=a}),e))break;return s}},ya=class extends L{boot(){m(this,"scroll",t=>{this.updateScrollVariable()},{passive:!0})}mount(){let t=new ResizeObserver(()=>{this.updateScrollVariable()});t.observe(this),this.onUnmount(()=>t.disconnect())}updateScrollVariable(){let t=Math.abs(this.scrollLeft)/(this.scrollWidth-this.clientWidth)*100;this.style.setProperty("--flux-scroll-percentage",t+"%")}},Ss=class i extends it{boot(){this._focusable=new qt(this,{wrap:!0}),this._selectableGroup=new yt(this),this._controllable=new G(this,{disabled:this._disabled}),this._controllable.initial(e=>e&&this._selectableGroup.setState(e)),this._controllable.getter(()=>this._selectableGroup.getState());let t=J();this._controllable.setter(t(e=>{this._selectableGroup.setState(e)})),this._selectableGroup.onChange(t(()=>{this._controllable.dispatch()})),m(this,"keydown",e=>
131{["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")||(Du(t),t._initialized=!0)})}walker(){return lt(this,(t,{skip:e,reject:s})=>{if(t instanceof xs||t instanceof i)return s();if(!["a","button"].includes(t.localName))return e()})}};function Du(i){i._disableable=new F(i);let t=i.matches("a")?i:null,e=t||i;i._disableable.onInitAndChange(r=>{r?h(e,"aria-disabled","true"):w(e,"aria-disabled")});let s=et(e,"tab");if(h(e,"role","tab"),e._focusable=new ht(e,{disableable:i._disableable,tabbableAttr:"data-active"}),!t){let r=i.getAttribute("name");i._selectable=new j(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 el(i){i._initialized||(et(i,"tab-panel"),h(i,"role","tabpanel"),i.hasAttribute("tabindex")||h(i,"tabindex","-1"),i.show=()=>{h(i,"data-selected",""),h(i,"tabindex","0"),w(i,"hidden")},i.hide=()=>{w(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)}I("tab-group",xs);I("tabs-scroll-area",ya);I("tabs",Ss);var wa=class extends it{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 G(this),this._controllable.initial(e=>e&&this.state.setValue(e)),this._controllable.getter(()=>this.state.getValue());let t=J();this._controllable.setter(t(e=>this.state.setValue(e))),this.state.onChange(t(()=>this._controllable.dispatch())),this._submittable=new at(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 F(this),this._disableable.onInitAndChange(e=>{for(let s of this.inputEls)e?h(s,"disabled",e):w(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}"`)}}};I("otp",wa);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.action&&(a.action=n.action),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()}}))});!Ra()&&!Va()&&$a();})();

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.