1(()=>{var ui=class extends Event{oldState;newState;constructor(i,{oldState:t="",newState:e="",...s}={}){super(i,s),this.oldState=String(t||""),this.newState=String(e||"")}},Yr=new WeakMap;function jr(i,t,e){Yr.set(i,setTimeout(()=>{Yr.has(i)&&i.dispatchEvent(new ui("toggle",{cancelable:!1,oldState:t,newState:e}))},0))}var ns=globalThis.ShadowRoot||function(){},gn=globalThis.HTMLDialogElement||function(){},ri=new WeakMap,It=new WeakMap,Re=new WeakMap;function ai(i){return Re.get(i)||"hidden"}var ni=new WeakMap;function vn(i){let t=i.popoverTargetElement;if(!(t instanceof HTMLElement))return;let e=ai(t);i.popoverTargetAction==="show"&&e==="showing"||i.popoverTargetAction==="hide"&&e==="hidden"||(e==="showing"?Ne(t,!0,!0):Qt(t,!1)&&(ni.set(t,i),as(t)))}function Qt(i,t){return!(i.popover!=="auto"&&i.popover!=="manual"||!i.isConnected||t&&ai(i)!=="showing"||!t&&ai(i)!=="hidden"||i instanceof gn&&i.hasAttribute("open")||document.fullscreenElement===i)}function zr(i){return i?Array.from(It.get(i.ownerDocument)||[]).indexOf(i)+1:0}function yn(i){let t=Jr(i),e=wn(i);return zr(t)>zr(e)?t:e}function li(i){let t=It.get(i);for(let e of t||[])if(!e.isConnected)t.delete(e);else return e;return null}function be(i){return typeof i.getRootNode=="function"?i.getRootNode():i.parentNode?be(i.parentNode):i}function Jr(i){for(;i;){if(i instanceof HTMLElement&&i.popover==="auto"&&Re.get(i)==="showing")return i;if(i=i instanceof Element&&i.assignedSlot||i.parentElement||be(i),i instanceof ns&&(i=i.host),i instanceof Document)return}}function wn(i){for(;i;){let t=i.popoverTargetElement;if(t instanceof HTMLElement)return t;if(i=i.parentElement||be(i),i instanceof ns&&(i=i.host),i instanceof Document)return}}function xn(i){let t=new Map,e=0;for(let a of It.get(i.ownerDocument)||[])t.set(a,e),e+=1;t.set(i,e),e+=1;let s=null;function r(a){let n=Jr(a);if(n===null)return null;let o=t.get(n);(s===null||t.get(s)<o)&&(s=n)}return r(i.parentElement||be(i)),s}function An(i){return i.hidden||i instanceof ns||(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 Sn(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 o=n.assignedElements({flatten:!0});for(let l of o){if(l.hasAttribute("autofocus"))return l;if(e=l.querySelector("[autofocus]"),e)return e}}}let s=i.ownerDocument.createTreeWalker(t,NodeFilter.SHOW_ELEMENT),r=s.currentNode;for(;r;){if(An(r))return r;r=s.nextNode()}}function En(i){Sn(i)?.focus()}var oi=new WeakMap;function as(i){if(!Qt(i,!1))return;let t=i.ownerDocument;if(!i.dispatchEvent(new ui("beforetoggle",{cancelable:!0,oldState:"closed",newState:"open"}))||!Qt(i,!1))return;let e=!1;if(i.popover==="auto"){let r=i.getAttribute("popover"),a=xn(i)||t;if(hi(a,!1,!0),r!==i.getAttribute("popover")||!Qt(i,!1))return}li(t)||(e=!0),oi.delete(i);let s=t.activeElement;i.classList.add(":popover-open"),Re.set(i,"showing"),ri.has(t)||ri.set(t,new Set),ri.get(t).add(i),En(i),i.popover==="auto"&&(It.has(t)||It.set(t,new Set),It.get(t).add(i),Zr(ni.get(i),!0)),e&&s&&i.popover==="auto"&&oi.set(i,s),jr(i,"closed","open")}function Ne(i,t=!1,e=!1){if(!Qt(i,!0))return;let s=i.ownerDocument;if(i.popover==="auto"&&(hi(i,t,e),!Qt(i,!0))||(Zr(ni.get(i),!1),ni.delete(i),e&&(i.dispatchEvent(new ui("beforetoggle",{oldState:"open",newState:"closed"})),!Qt(i,!0))))return;ri.get(s)?.delete(i),It.get(s)?.delete(i),i.classList.remove(":popover-open"),Re.set(i,"hidden"),e&&jr(i,"open","closed");let r=oi.get(i);r&&(oi.delete(i),t&&r.focus())}function Gr(i,t=!1,e=!1){let s=li(i);for(;s;)Ne(s,t,e),s=li(i)}function hi(i,t,e){let s=i.ownerDocument||i;if(i instanceof Document)return Gr(s,t,e);let r=null,a=!1;for(let n of It.get(s)||[])if(n===i)a=!0;else if(a){r=n;break}if(!a)return Gr(s,t,e);for(;r&&ai(r)==="showing"&&It.get(s)?.size;)Ne(r,t,e)}var is=new WeakMap;function Kr(i){if(!i.isTrusted)return;let t=i.composedPath()[0];if(!t)return;let e=t.ownerDocument;if(!li(e))return;let r=yn(t);if(r&&i.type==="pointerdown")is.set(e,r);else if(i.type==="pointerup"){let a=is.get(e)===r;is.delete(e),a&&hi(r||e,!1,!0)}}var ss=new WeakMap;function Zr(i,t=!1){if(!i)return;ss.has(i)||ss.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=ss.get(i);s?i.setAttribute("aria-expanded",s):i.removeAttribute("aria-expanded")}}var Xr=globalThis.ShadowRoot||function(){};function _n(){return typeof HTMLElement<"u"&&typeof HTMLElement.prototype=="object"&&"popover"in HTMLElement.prototype}function Zt(i,t,e){let s=i[t];Object.defineProperty(i,t,{value(r){return s.call(this,e(r))}})}var kn=/(^|[^\\]):popover-open\b/g;function Cn(){return typeof globalThis.CSSLayerBlockRule=="function"}function Dn(){let i=Cn();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 pe=null;function rs(i){let t=Dn();if(pe===null)try{pe=new CSSStyleSheet,pe.replaceSync(t)}catch{pe=!1}if(pe===!1){let e=document.createElement("style");e.textContent=t,i instanceof Document?i.head.prepend(e):i.prepend(e)}else i.adoptedStyleSheets=[pe,...i.adoptedStyleSheets]}function In(){if(typeof window>"u")return;window.ToggleEvent=window.ToggleEvent||ui;function i(l){return l?.includes(":popover-open")&&(l=l.replace(kn,"$1.\\:popover-open")),l}Zt(Document.prototype,"querySelector",i),Zt(Document.prototype,"querySelectorAll",i),Zt(Element.prototype,"querySelector",i),Zt(Element.prototype,"querySelectorAll",i),Zt(Element.prototype,"matches",i),Zt(Element.prototype,"closest",i),Zt(DocumentFragment.prototype,"querySelectorAll",i),Object.defineProperties(HTMLElement.prototype,{popover:{enumerable:!0,configurable:!0,get(){if
63(!this.hasAttribute("popover"))return null;let l=(this.getAttribute("popover")||"").toLowerCase();return l===""||l=="auto"?"auto":"manual"},set(l){l===null?this.removeAttribute("popover"):this.setAttribute("popover",l)}},showPopover:{enumerable:!0,configurable:!0,value(){as(this)}},hidePopover:{enumerable:!0,configurable:!0,value(){Ne(this,!0,!0)}},togglePopover:{enumerable:!0,configurable:!0,value(l){Re.get(this)==="showing"&&l===void 0||l===!1?Ne(this,!0,!0):(l===void 0||l===!0)&&as(this)}}});let t=Element.prototype.attachShadow;t&&Object.defineProperties(Element.prototype,{attachShadow:{enumerable:!0,configurable:!0,writable:!0,value(l){let u=t.call(this,l);return rs(u),u}}});let e=HTMLElement.prototype.attachInternals;e&&Object.defineProperties(HTMLElement.prototype,{attachInternals:{enumerable:!0,configurable:!0,writable:!0,value(){let l=e.call(this);return l.shadowRoot&&rs(l.shadowRoot),l}}});let s=new WeakMap;function r(l){Object.defineProperties(l.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=be(this),c=this.getAttribute("popovertarget");return(d instanceof Document||d instanceof Xr)&&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=l=>{let u=l.composedPath(),d=u[0];if(!(d instanceof Element)||d?.shadowRoot)return;let c=be(d);if(!(c instanceof Xr||c instanceof Document))return;let f=u.find(b=>b.matches?.("[popovertargetaction],[popovertarget]"));if(f){vn(f),l.preventDefault();return}},n=l=>{let u=l.key,d=l.target;!l.defaultPrevented&&d&&(u==="Escape"||u==="Esc")&&hi(d.ownerDocument,!0,!0)};(l=>{l.addEventListener("click",a),l.addEventListener("keydown",n),l.addEventListener("pointerdown",Kr),l.addEventListener("pointerup",Kr)})(document),rs(document)}_n()||In();var mi=class extends Event{oldState;newState;constructor(i,{oldState:t="",newState:e="",...s}={}){super(i,s),this.oldState=String(t||""),this.newState=String(e||"")}},Qr=new WeakMap;function ra(i,t,e){Qr.set(i,setTimeout(()=>{Qr.has(i)&&i.dispatchEvent(new mi("toggle",{cancelable:!1,oldState:t,newState:e}))},0))}var cs=globalThis.ShadowRoot||function(){},Tn=globalThis.HTMLDialogElement||function(){},ci=new WeakMap,Tt=new WeakMap,Ve=new WeakMap;function di(i){return Ve.get(i)||"hidden"}var fi=new WeakMap;function Ln(i){let t=i.popoverTargetElement;if(!(t instanceof HTMLElement))return;let e=di(t);i.popoverTargetAction==="show"&&e==="showing"||i.popoverTargetAction==="hide"&&e==="hidden"||(e==="showing"?Fe(t,!0,!0):ee(t,!1)&&(fi.set(t,i),hs(t)))}function ee(i,t){return!(i.popover!=="auto"&&i.popover!=="manual"||!i.isConnected||t&&di(i)!=="showing"||!t&&di(i)!=="hidden"||i instanceof Tn&&i.hasAttribute("open")||document.fullscreenElement===i)}function ta(i){return i?Array.from(Tt.get(i.ownerDocument)||[]).indexOf(i)+1:0}function Mn(i){let t=aa(i),e=Pn(i);return ta(t)>ta(e)?t:e}function pi(i){let t=Tt.get(i);for(let e of t||[])if(!e.isConnected)t.delete(e);else return e;return null}function ge(i){return typeof i.getRootNode=="function"?i.getRootNode():i.parentNode?ge(i.parentNode):i}function aa(i){for(;i;){if(i instanceof HTMLElement&&i.popover==="auto"&&Ve.get(i)==="showing")return i;if(i=i instanceof Element&&i.assignedSlot||i.parentElement||ge(i),i instanceof cs&&(i=i.host),i instanceof Document)return}}function Pn(i){for(;i;){let t=i.popoverTargetElement;if(t instanceof HTMLElement)return t;if(i=i.parentElement||ge(i),i instanceof cs&&(i=i.host),i instanceof Document)return}}function On(i){let t=new Map,e=0;for(let a of Tt.get(i.ownerDocument)||[])t.set(a,e),e+=1;t.set(i,e),e+=1;let s=null;function r(a){let n=aa(a);if(n===null)return null;let o=t.get(n);(s===null||t.get(s)<o)&&(s=n)}return r(i.parentElement||ge(i)),s}function Nn(i){return i.hidden||i instanceof cs||(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 Rn(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 o=n.assignedElements({flatten:!0});for(let l of o){if(l.hasAttribute("autofocus"))return l;if(e=l.querySelector("[autofocus]"),e)return e}}}let s=i.ownerDocument.createTreeWalker(t,NodeFilter.SHOW_ELEMENT),r=s.currentNode;for(;r;){if(Nn(r))return r;r=s.nextNode()}}
63function Fn(i){Rn(i)?.focus()}var bi=new WeakMap;function hs(i){if(!ee(i,!1))return;let t=i.ownerDocument;if(!i.dispatchEvent(new mi("beforetoggle",{cancelable:!0,oldState:"closed",newState:"open"}))||!ee(i,!1))return;let e=!1;if(i.popover==="auto"){let r=i.getAttribute("popover"),a=On(i)||t;if(gi(a,!1,!0),r!==i.getAttribute("popover")||!ee(i,!1))return}pi(t)||(e=!0),bi.delete(i);let s=t.activeElement;i.classList.add(":popover-open"),Ve.set(i,"showing"),ci.has(t)||ci.set(t,new Set),ci.get(t).add(i),Fn(i),i.popover==="auto"&&(Tt.has(t)||Tt.set(t,new Set),Tt.get(t).add(i),na(fi.get(i),!0)),e&&s&&i.popover==="auto"&&bi.set(i,s),ra(i,"closed","open")}function Fe(i,t=!1,e=!1){if(!ee(i,!0))return;let s=i.ownerDocument;if(i.popover==="auto"&&(gi(i,t,e),!ee(i,!0))||(na(fi.get(i),!1),fi.delete(i),e&&(i.dispatchEvent(new mi("beforetoggle",{oldState:"open",newState:"closed"})),!ee(i,!0))))return;ci.get(s)?.delete(i),Tt.get(s)?.delete(i),i.classList.remove(":popover-open"),Ve.set(i,"hidden"),e&&ra(i,"open","closed");let r=bi.get(i);r&&(bi.delete(i),t&&r.focus())}function ea(i,t=!1,e=!1){let s=pi(i);for(;s;)Fe(s,t,e),s=pi(i)}function gi(i,t,e){let s=i.ownerDocument||i;if(i instanceof Document)return ea(s,t,e);let r=null,a=!1;for(let n of Tt.get(s)||[])if(n===i)a=!0;else if(a){r=n;break}if(!a)return ea(s,t,e);for(;r&&di(r)==="showing"&&Tt.get(s)?.size;)Fe(r,t,e)}var ls=new WeakMap;function ia(i){if(!i.isTrusted)return;let t=i.composedPath()[0];if(!t)return;let e=t.ownerDocument;if(!pi(e))return;let r=Mn(t);if(r&&i.type==="pointerdown")ls.set(e,r);else if(i.type==="pointerup"){let a=ls.get(e)===r;ls.delete(e),a&&gi(r||e,!1,!0)}}var os=new WeakMap;function na(i,t=!1){if(!i)return;os.has(i)||os.set(i,i.getAttribute("aria-expanded"));let e=i.popoverTargetElement;if(e instanceof HTMLElement&&e.popover==="auto")i.setAttribute("aria-expanded",String(t));else{let s=os.get(i);s?i.setAttribute("aria-expanded",s):i.removeAttribute("aria-expanded")}}var sa=globalThis.ShadowRoot||function(){};function la(){return typeof HTMLElement<"u"&&typeof HTMLElement.prototype=="object"&&"popover"in HTMLElement.prototype}function oa(){return!!(document.body?.showPopover&&!/native code/i.test(document.body.showPopover.toString()))}function te(i,t,e){let s=i[t];Object.defineProperty(i,t,{value(r){return s.call(this,e(r))}})}var Vn=/(^|[^\\]):popover-open\b/g;function qn(){return typeof globalThis.CSSLayerBlockRule=="function"}function $n(){let i=qn();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 me=null;function us(i){let t=$n();if(me===null)try{me=new CSSStyleSheet,me.replaceSync(t)}catch{me=!1}if(me===!1){let e=document.createElement("style");e.textContent=t,i instanceof Document?i.head.prepend(e):i.prepend(e)}else i.adoptedStyleSheets=[me,...i.adoptedStyleSheets]}function ua(){if(typeof window>"u")return;window.ToggleEvent=window.ToggleEvent||mi;function i(l){return l?.includes(":popover-open")&&(l=l.replace(Vn,"$1.\\:popover-open")),l}te(Document.prototype,"querySelector",i),te(Document.prototype,"querySelectorAll",i),te(Element.prototype,"querySelector",i),te(Element.prototype,"querySelectorAll",i),te(Element.prototype,"matches",i),te(Element.prototype,"closest",i),te(DocumentFragment.prototype,"querySelectorAll",i),Object.defineProperties(HTMLElement.prototype,{popover:{enumerable:!0,configurable:!0,get(){if
125(!this.hasAttribute("popover"))return null;let l=(this.getAttribute("popover")||"").toLowerCase();return l===""||l=="auto"?"auto":"manual"},set(l){l===null?this.removeAttribute("popover"):this.setAttribute("popover",l)}},showPopover:{enumerable:!0,configurable:!0,value(){hs(this)}},hidePopover:{enumerable:!0,configurable:!0,value(){Fe(this,!0,!0)}},togglePopover:{enumerable:!0,configurable:!0,value(l){Ve.get(this)==="showing"&&l===void 0||l===!1?Fe(this,!0,!0):(l===void 0||l===!0)&&hs(this)}}});let t=Element.prototype.attachShadow;t&&Object.defineProperties(Element.prototype,{attachShadow:{enumerable:!0,configurable:!0,writable:!0,value(l){let u=t.call(this,l);return us(u),u}}});let e=HTMLElement.prototype.attachInternals;e&&Object.defineProperties(HTMLElement.prototype,{attachInternals:{enumerable:!0,configurable:!0,writable:!0,value(){let l=e.call(this);return l.shadowRoot&&us(l.shadowRoot),l}}});let s=new WeakMap;function r(l){Object.defineProperties(l.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=ge(this),c=this.getAttribute("popovertarget");return(d instanceof Document||d instanceof sa)&&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=l=>{let u=l.composedPath(),d=u[0];if(!(d instanceof Element)||d?.shadowRoot)return;let c=ge(d);if(!(c instanceof sa||c instanceof Document))return;let f=u.find(b=>b.matches?.("[popovertargetaction],[popovertarget]"));if(f){Ln(f),l.preventDefault();return}},n=l=>{let u=l.key,d=l.target;!l.defaultPrevented&&d&&(u==="Escape"||u==="Esc")&&gi(d.ownerDocument,!0,!0)};(l=>{l.addEventListener("click",a),l.addEventListener("keydown",n),l.addEventListener("pointerdown",ia),l.addEventListener("pointerup",ia)})(document),us(document)}var vi;function qe(i){let t=i({css:(e,...s)=>`@layer base { ${e.raw[0]+s.join("")} }`});if(document.adoptedStyleSheets===void 0){let e=document.createElement("style");e.textContent=t,document.head.appendChild(e);return}vi===void 0&&(vi=new CSSStyleSheet,document.adoptedStyleSheets=[...document.adoptedStyleSheets,vi]),vi.insertRule(t)}function yi(i,t){let e=i;for(;e;){if(t(e))return e;e=e.parentElement}}function tt(i,t){let e=document.createTreeWalker(i,NodeFilter.SHOW_ELEMENT,t?{acceptNode:s=>{let r,a;return t(s,{skip:()=>r=!0,reject:()=>a=!0}),r?NodeFilter.FILTER_SKIP:a?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}}:{});return new ds(e)}var ds=class{constructor(t){this.walker=t}from(t){return this.walker.currentNode=t,this}first(){return this.walker.firstChild()}last(){return this.walker.lastChild()}next(t){return this.walker.currentNode=t,this.walker.nextSibling()}nextOrFirst(t){let e=this.next(t);return e||(this.walker.currentNode=this.walker.root,this.first())}prev(t){return this.walker.currentNode=t,this.walker.previousSibling()}prevOrLast(t){let e=this.prev(t);return e||(this.walker.currentNode=this.walker.root,this.last())}closest(t,e){let s=this.from(t).walker;for(;s.currentNode;){if(e(s.currentNode))return s.currentNode;s.parentNode()}}contains(t){return this.find(e=>e===t)}find(t){return this.walk((e,s)=>{t(e)&&s(e)})}findOrFirst(t){return this.find(t)||(this.walker.currentNode=this.walker.root),this.first()}each(t){this.walk(e=>t(e))}some(t){return!!this.find(t)}every(t){let e=!0;return this.walk(s=>{t(s)||(e=!1)}),e}map(t){let e=[];return this.walk(s=>e.push(t(s))),e}filter(t){let e=[];return this.walk(s=>t(s)&&e.push(s)),e}walk(t){let e,s=this.walker,r;for(;s.nextNode()&&(e=s.currentNode,t(e,a=>r=a),r===void 0););return r}};function D(i,t){customElements.define(`ui-${i}`,t)}function y(i,t,e,s={}){return i.addEventListener(t,e,s),{off:()=>i.removeEventListener(t,e),pause:r=>{i.removeEventListener(t,e),r(),i.addEventListener(t,e)}}}function ca(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 fs(i,t){let e;return function(){let s=this,r=arguments;e||(i.apply(s,r),e=!0,setTimeout(()=>e=!1,t))}}function ps(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 $e="pointer";document.addEventListener("keydown",()=>$e="keyboard",{capture:!0});document.addEventListener("pointerdown",i=>{$e=i.pointerType==="mouse"?"mouse":"touch"},{capture:!0});document.addEventListener("pointermove",i=>{$e=i.pointerType==="mouse"?"mouse":"touch"},{capture:!0});function ie(){return $e==="keyboard"}function wi(){return $e==="touch"}function xi(i,t){let e="",s=Kn(()=>{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 Bn(i,t){return"lofi-"+(t?t+"-":"")+Math.random().toString(16).slice(2)}function K(i,t){let e=i.hasAttribute("id")?i.getAttribute("id"):Bn(i,t);return h(i,"id",e),i._x_bindings||(i._x_bindings={}),i._x_bindings.id||(i._x_bindings.id=e),e}function G(){let i=!1;return t=>(...e)=>{if(!i){i=!0;try{t(...e)}finally{i=!1}}}}function we(i,t,{gain:e,lose:s,focusable:r,useSafeArea:a}){let n=!1,o=A=>{ie()&&(i.contains(A.target)||t.contains(A.target)?(n=!0,e()):(n=!1,s()))};r&&document.addEventListener("focusin",o);let l=()=>{document.removeEventListener("focusin",o)},u=()=>{},d=()=>{},c=()=>{n=!1,s(),u(),d()},f=()=>{n=!1,u(),d()},b=A=>{wi()||n||(n=!0,e(),setTimeout(()=>{let{safeArea:_,redraw:L,remove:O}=a?Wn(i,t,A.clientX,A.clientY):Gn();u=O;let E,m=fs(q=>{let S=t.getBoundingClientRect(),N=i.getBoundingClientRect(),F;switch(_.contains(q.target)&&Hn(N,S,q.clientX,q.clientY)?F="safeArea":t.contains(q.target)?F="panel":i.contains(q.target)?F="trigger":F="outside",E&&clearTimeout(E),F){case"outside":c();break;case"trigger":L(q.clientX,q.clientY);break;case"panel":u();break;case"safeArea":L(q.clientX,q.clientY),E=setTimeout(()=>{c()},300);break;default:break}},100);document.addEventListener("pointermove",m),d=()=>document.removeEventListener("pointermove",m)}))};i.addEventListener("pointerenter",b);let p=()=>{i.removeEventListener("pointerenter",b)};return{clear:f,remove:()=>{f(),p(),l()}}}function Wn(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 o=(l,u)=>{if(a.top===0&&a.bottom===0)return;let d;a.left<n.left&&(d="left"),a.right>n.right&&(d="right"),a.top<n.top&&a.bottom<u&&(d="up"),a.bottom>n.bottom&&a.top>u&&(d="down"),d===void 0&&(d="right");let c,f,b,p,w,A,_,L,O=10;switch(d){case"left":c=a.right,f=Math.max(a.right,l)+5,b=f-c,p=Math.min(n.top,a.top)-O,w=Math.max(n.bottom,a.bottom)+O,A=w-p,_=u-p,L=`polygon(0% 0%, 100% ${_}px, 0% 100%)`;break;case"right":c=Math.min(a.left,l)-5,f=a.left,b=f-c,p=Math.min(n.top,a.top)-O,w=Math.max(n.bottom,a.bottom)+O,A=w-p,_=u-p,L=`polygon(0% ${_}px, 100% 0%, 100% 100%)`;break;case"up":c=Math.min(l,a.left)-O,f=Math.max(l,a.right)+O,b=f-c,p=a.bottom,w=Math.max(a.bottom,u)+5,A=w-p,_=l-c,L=`polygon(0% 0%, 100% 0%, ${_}px 100%)`;break;case"down":c=Math.min(l,a.left)-O,f=Math.max(l,a.right)+O,b=f-c,p=Math.min(a.top,u)-5,w=a.top,A=w-p,_=l-c,L=`polygon(${_}px 0%, 100% 100%, 0% 100%)`;break}r.style.left=`${c}px`,r.style.top=`${p}px`,r.style.width=`${b}px`,r.style.height=`${A}px`,r.style.clipPath=L};return{safeArea:r,redraw:(l,u)=>{r.isConnected||i.appendChild(r),o(l,u)},remove:()=>{r.remove()}}}function Hn(i,t,e,s){return!Un(i,e,s)&&!Yn(t,e,s)}function Un(i,t,e){return i.left<=t&&t<=i.right&&i.top<=e&&e<=i.bottom}function Yn(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=da(i,[t])),i._durableAttributeObserver.hasAttribute(t)||i._durableAttributeObserver.addAttribute(t),i._durableAttributeObserver.pause(()=>{i.setAttribute(t,e)})}function dt(i,t){x(i,t),zn(i,t)}function x(i,t){i._durableAttributeObserver===void 0&&(i._durableAttributeObserver=da(i,[t])),i._durableAttributeObserver.hasAttribute(t)||i._durableAttributeObserver.addAttribute(t),i._durableAttributeObserver.pause(()=>{i.removeAttribute(t)})}function zn(i,t){i?._durableAttributeObserver?.hasAttribute(t)&&i._durableAttributeObserver.releaseAttribute(t)}function da(i,t){let e=r=>{r.forEach(a=>{a.oldValue===null?i._durableAttributeObserver.pause(()=>x(i,a.attributeName)):i._durableAttributeObserver.pause(()=>h(i,a.attributeName,a.oldValue))})},s=new MutationObserver(r=>e(r));return s.observe(i,{attributeFilter:t,attributeOldValue:!0}),{attributes:t,hasAttribute(r){return this.attributes.includes(r)},addAttribute(r){this.attributes.includes(r)||this.attributes.push(r),s.observe(i,{attributeFilter:this.attributes,attributeOldValue:!0})},releaseAttribute(r){this.hasAttribute(r)&&s.observe(i,{attributeFilter:this.attributes,attributeOldValue:!0})},pause(r){e(s.takeRecords()),s.disconnect(),r(),s.observe(i,{attributeFilter:this.attributes,attributeOldValue:!0})}}}function Gn(){return{safeArea:{contains:()=>!1},redraw:()=>{},remove:()=>{}}}function Kn(i,t){let e;return(...s)=>{clearTimeout(e),e=setTimeout(()=>{i(...s)},t)}}var ve=0,ye=!1;qe(({css:i})=>i`[data-flux-allow-scroll] { pointer-events: auto; }`);function lt(i=null,t=!1,e=[]){if(t)return{lock:()=>{},unlock:()=>{}};let s=(a=!1)=>{ha(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})`,Xn(document.documentElement,n),a&&(h(i,"data-flux-allow-scroll",""),e.forEach(o=>{h(o,"data-flux-allow-scroll","")}),ye=!0)},r=(a=!1)=>{ha(document.documentElement),a&&(dt(i,"data-flux-allow-scroll"),e.forEach(n=>{x(n,"data-flux-allow-scroll")}),ye=!1)};return{lock(){ve++,!(ve>1&&i!==null&&ye)&&s(i!==null&&!ye)},unlock(){ve=Math.max(0,ve-1),!(ve>0&&i!==null&&!ye)&&(r(i!==null&&ye),ve>0&&s(!1))}}}function Xn(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 ha(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 bs(i,t,e){let s=i.style[t];return i.style[t]=e,()=>{i.style[t]=s}}function xe(i,t,e){let s=(n,o)=>l=>{l.key===n&&!t()&&(o(),l.preventDefault(),l.stopPropagation())};h(i,"role","button");let r=()=>{i.hasAttribute("disabled")?(h(i,"aria-disabled","true"),h(i,"tabindex","-1")):(x(i,"aria-disabled"),h(i,"tabindex","0"))};new MutationObserver(()=>r()).observe(i,{attributes:!0,attributeFilter:["disabled"]}),r(),y(i,"click",()=>e()),y(i,"keydown",s("Enter",()=>e())),y(i,"keydown",s(" ",()=>{})),y(i,"keyup",s(" ",()=>e()))}function Ai(){return navigator?.language||document.documentElement.lang||"en-US"}function Si(i,t={slots:{},attrs:{}}){let{slots:e={},attrs:s={}}=t,r=i.content.cloneNode(!0).firstElementChild;return Object.entries(e).forEach(([a,n])=>{(a==="default"?r.querySelectorAll("slot:not([name])"):r.querySelectorAll(`slot[name="${a}
125"]`)).forEach(l=>l.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 Lt(i){return getComputedStyle(i).direction==="rtl"}function fa(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)&&!navigator.userAgent.includes("CriOS")&&!navigator.userAgent.includes("FxiOS")}function pa(){return/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream}var Ht=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 T=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 y(this,t,e)}root(t,e={}){if(t===void 0)return this.__root;let s=document.createElement(t);for(let a in e)setAttribute(s,a,e[a]);let r=this.attachShadow({mode:"open"});return s.appendChild(document.createElement("slot")),r.appendChild(s),this.__root=s,this.__root}},X=class extends T{};var j=class{constructor(t,e={}){this.el=t,this.grouped=e.grouped===void 0,this.el.mixins=this.el.mixins?this.el.mixins:new Map,this.el.mixins.set(this.constructor.name,this),this.el[this.constructor.name]=!0,this.el.use||(this.el.use=T.prototype.use.bind(this.el)),this.opts=e,this.boot?.({options:s=>{let r=s;Object.entries(this.opts).forEach(([a,n])=>{n!==void 0&&(r[a]=n)}),this.opts=r}}),queueMicrotask(()=>{this.mount?.()})}options(){return this.opts}hasGroup(){return!!this.group()}group(){if(this.grouped!==!1)return yi(this.el,t=>t[this.groupedByType.name])?.use(this.groupedByType)}on(t,e){return y(this.el,t,e)}},kt=class extends j{constructor(t,e={}){super(t,e)}walker(){return tt(this.el,(t,{skip:e,reject:s})=>{if(t[this.constructor.name]&&t!==this.el)return s();if(!t[this.groupOfType.name]||!t.mixins.get(this.groupOfType.name).grouped)return e()})}};var Y=class extends j{boot({options:t}){t({bubbles:!1}),this.initialState=this.el.value,this.getterFunc=()=>{},this.setterFunc=e=>this.initialState=e,Object.defineProperty(this.el,"value",{get:()=>this.getterFunc(),set:e=>{this.setterFunc(e)}})}initial(t){t(this.initialState)}getter(t){this.getterFunc=t}setter(t){this.setterFunc=t}dispatch(){this.el.dispatchEvent(new Event("input",{bubbles:this.options().bubbles,cancelable:!0})),this.el.dispatchEvent(new Event("change",{bubbles:this.options().bubbles,cancelable:!0}))}};var ms=null;document.addEventListener("mousedown",i=>ms=i);var Ae=class extends j{boot({options:t}){t({clickOutside:!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)||ms&&ba(r,ms)&&ba(r,a)&&(this.cancel(),a.preventDefault(),a.stopPropagation())})}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&&fa()&&!this.el.hasAttribute("autofocus")&&this.el.querySelectorAll("[autofocus]").length===0&&setTimeout(()=>{this.el.setAttribute("tabindex","-1"),this.el.focus(),this.el.blur()})})}};function ba(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 Mt=class extends j{boot(){this.onCloses=[]}onClose(t){this.onCloses.push(t)}close(){this.onCloses.forEach(t=>t())}};var gs=class extends T{boot(){this.querySelectorAll("[data-appended]").forEach(o=>o.remove()),this._controllable=new Y(this,{disabled:this.hasAttribute("disabled")});let t=this.button(),e=this.dialog();if(!e)return;e._dialogable=new Ae(e,{clickOutside:!this.hasAttribute("disable-click-outside")}),e._closeable=new Mt(e),e._closeable.onClose(()=>e._dialogable.hide()),this._controllable.initial(o=>o&&e._dialogable.show()),this._controllable.getter(()=>e._dialogable.getState());let s=G();this._controllable.setter(s(o=>{e._dialogable.setState(o)})),e._dialogable.onChange(s(()=>{this._controllable.dispatch()}));let r=()=>{e._dialogable.getState()?(h(this,"data-open",""),t?.setAttribute("data-open",""),h(e,"data-open","")):(x(this,"data-open"),t?.removeAttribute("data-open"),x(e,"data-open"))};e._dialogable.onChange(()=>r()),r();let{lock:a,unlock:n}=lt();e._dialogable.onChange(()=>{e._dialogable.getState()?a():n()}),t&&y(t,"click",o=>{e._dialogable.show()})}unmount(){if(this.dialog()?._dialogable?.getState()){let{unlock:t}=lt();t()}}button(){let t=this.querySelector("button,ui-button");if(!this.dialog()?.contains(t))return t}dialog(){return this.querySelector("dialog")}showModal(){let t=this.dialog();t&&t.showModal()}};qe(({css:i})=>i`dialog, ::backdrop { margin: auto; }`);D("modal",gs);var Pt=class extends kt{groupOfType=et;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(et).activate()}activateBySearch(t){this.filterAwareWalker().find(s=>s.textContent.toLowerCase().trim().startsWith(t.toLowerCase()))?.use(et).activate()}activateSelectedOrFirst(t){if(!t||(s=>s.matches("ui-option, ui-option-create")?getComputedStyle(s).display==="none":!1)(t)){this.filterAwareWalker().first()?.use(et).activate();return}t?.use(et).activate()}activateActiveOrFirst(){let t=this.getActive();if(!t){this.filterAwareWalker().first()?.use(et).activate();return}t?.use(et).activate()}activateActiveOrLast(){let t=this.getActive();if(!t){this.filterAwareWalker().last()?.use(et).activate();return}t?.use(et).activate()}activatePrev(){let t=this.getActive();if(!t){this.filterAwareWalker().last()?.use(et).activate();return}let e;this.options.wrap?e=this.filterAwareWalker().prevOrLast(t):e=this.filterAwareWalker().prev(t),e?.use(et).activate()}activateNext(){let t=this.getActive();if(!t){this.filterAwareWalker().first()?.use(et).activate();return}let e;this.options.wrap?e=this.filterAwareWalker().nextOrFirst(t):e=this.filterAwareWalker().next(t),e?.use(et).activate()}getActive(){return this.walker().find(t=>t.use(et).isActive())}clearActive(){this.getActive()?.use(et).deactivate()}filterAwareWalker(){let t=e=>e.matches("ui-option, ui-option-create")?getComputedStyle(e).display==="none":!1;return tt(this.el,(e,{skip:s,reject:r})=>{if(e[this.constructor.name]&&e!==this.el)return r();if(!e[this.groupOfType.name])return s();if(e.hasAttribute("disabled")||t(e))return r()})}},et=class i extends j{groupedByType=Pt;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",""),ie()&&this.el.scrollIntoView({block:"nearest"}),this.group()&&this.group().activated(this.el))}deactivate(t=!0){x(this.el,"data-active"),t&&this.group()&&this.group().activated(this.el)}isActive(){return this.el.hasAttribute("data-active")}};var se=class extends kt{groupOfType=Ct;boot({options:t}){t({}),this.onChanges=[],this.lastSearch=""}onChange(t){this.onChanges.push(t)}filter(t){t===""?this.walker().each(e=>{e.use(Ct).unfilter()}):this.walker().each(e=>{this.matches(e,t)?e.use(Ct).unfilter():e.use(Ct).filter()}
125),this.lastSearch!==t&&this.onChanges.forEach(e=>e()),this.lastSearch=t}matches(t,e){return this.normalize(t.textContent).includes(this.normalize(e))}normalize(t){return t.normalize("NFD").replace(/\p{Diacritic}/gu,"").toLowerCase().trim()}hasResults(){return this.walker().some(t=>!t.use(Ct).isFiltered())}},Ct=class extends j{groupedByType=se;boot({options:t}){t({mirror:null,keep:!1}),this.onChanges=[]}filter(){this.options().keep||(h(this.el,"data-hidden",""),this.options().mirror&&h(this.options().mirror,"data-hidden",""))}unfilter(){this.options().keep||(x(this.el,"data-hidden"),this.options().mirror&&x(this.options().mirror,"data-hidden",""))}isFiltered(){return this.el.hasAttribute("data-hidden")}};var Ot=new Map,rt=class extends j{boot({options:t}){t({triggers:[],scope:null});let e=this.options().scope||"global";h(this.el,"popover","manual"),this.triggers=this.options().triggers,this.onChanges=[],this.state=!1,y(this.el,"beforetoggle",s=>{let r=this.state;if(this.state=s.newState==="open",this.state){jn(this.el,e);let a=new AbortController,n=document.activeElement,o=[...this.triggers,n];setTimeout(()=>{Jn(this.el,o,a),Zn(this.el,o,a),Qn(this.el,o,a)}),this.el.addEventListener("beforetoggle",l=>{l.newState==="closed"&&(a.abort(),n?.focus())},{signal:a.signal})}
125r!==this.state&&this.onChanges.forEach(a=>a(this.state,r))}),y(this.el,"toggle",s=>{if(s.newState==="open")Ot.has(e)||Ot.set(e,new Set),Ot.get(e).add(this.el);else if(s.newState==="closed"){if(!Ot.has(e))return;Ot.get(e).delete(this.el),Ot.get(e).size===0&&Ot.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 jn(i,t){Ot.has(t)&&Ot.get(t).forEach(e=>{i.contains(e)||e.contains(i)||e.hidePopover()})}function Jn(i,t,e){document.addEventListener("click",s=>{i.contains(s.target)||t.includes(s.target)||i.hidePopover()},{signal:e.signal})}function Zn(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 Qn(i,t,e){document.addEventListener("keydown",s=>{s.key==="Escape"&&i.hidePopover()},{signal:e.signal})}var V=class extends j{boot({options:t}){t({disableWithParent:!0}),this.onChanges=[],Object.defineProperty(this.el,"disabled",{get:()=>this.el.hasAttribute("disabled"),set:s=>{s?this.el.setAttribute("disabled",""):this.el.removeAttribute("disabled")}}),this.el.hasAttribute("disabled")?this.el.disabled=!0:this.options().disableWithParent&&this.el.parentElement?.closest("[disabled]")&&(this.el.disabled=!0),new MutationObserver(s=>
vendor: 4,440 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 Ut=Math.min,ft=Math.max,We=Math.round,He=Math.floor,vt=i=>({x:i,y:i}),tl={left:"right",right:"left",bottom:"top",top:"bottom"},el={start:"end",end:"start"};function vs(i,t,e){return ft(i,Ut(t,e))}function Se(i,t){return typeof i=="function"?i(t):i}function Nt(i){return i.split("-")[0]}function Ee(i){return i.split("-")[1]}function ys(i){return i==="x"?"y":"x"}function ws(i){return i==="y"?"height":"width"}function Yt(i){return["top","bottom"].includes(Nt(i))?"y":"x"}function xs(i){return ys(Yt(i))}function ma(i,t,e){e===void 0&&(e=!1);let s=Ee(i),r=xs(i),a=ws(r),n=r==="x"?s===(e?"end":"start")?"right":"left":s==="start"?"bottom":"top";return t.reference[a]>t.floating[a]&&(n=Be(n)),[n,Be(n)]}function ga(i){let t=Be(i);return[Ei(i),t,Ei(t)]}function Ei(i){return i.replace(/start|end/g,t=>el[t])}function il(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 va(i,t,e,s){let r=Ee(i),a=il(Nt(i),e==="start",s);return r&&(a=a.map(n=>n+"-"+r),t&&(a=a.concat(a.map(Ei)))),a}function Be(i){return i.replace(/left|right|bottom|top/g,t=>tl[t])}function sl(i){return{top:0,right:0,bottom:0,left:0,...i}}function ya(i){return typeof i!="number"?sl(i):{top:i,right:i,bottom:i,left:i}}function re(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 wa(i,t,e){let{reference:s,floating:r}=i,a=Yt(t),n=xs(t),o=ws(n),l=Nt(t),u=a==="y",d=s.x+s.width/2-r.width/2,c=s.y+s.height/2-r.height/2,f=s[o]/2-r[o]/2,b;switch(l){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(Ee(t)){case"start":b[n]-=f*(e&&u?-1:1);break;case"end":b[n]+=f*(e&&u?-1:1);break}return b}var xa=async(i,t,e)=>{let{placement:s="bottom",strategy:r="absolute",middleware:a=[],platform:n}=e,o=a.filter(Boolean),l=await(n.isRTL==null?void 0:n.isRTL(t)),u=await n.getElementRects({reference:i,floating:t,strategy:r}),{x:d,y:c}=wa(u,s,l),f=s,b={},p=0;for(let w=0;w<o.length;w++){let{name:A,fn:_}=o[w],{x:L,y:O,data:E,reset:m}=await _({x:d,y:c,initialPlacement:s,placement:f,strategy:r,middlewareData:b,rects:u,platform:n,elements:{reference:i,floating:t}});d=L??d,c=O??c,b={...b,[A]:{...b[A],...E}},m&&p<=50&&(p++,typeof m=="object"&&(m.placement&&(f=m.placement),m.rects&&(u=m.rects===!0?await n.getElementRects({reference:i,floating:t,strategy:r}):m.rects),{x:d,y:c}=wa(u,f,l)),w=-1)}return{x:d,y:c,placement:f,strategy:r,middlewareData:b}};async function _i(i,t){var e;t===void 0&&(t={});let{x:s,y:r,platform:a,rects:n,elements:o,strategy:l}=i,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:c="floating",altBoundary:f=!1,padding:b=0}=Se(t,i),p=ya(b),A=o[f?c==="floating"?"reference":"floating":c],_=re(await a.getClippingRect({element:(e=await(a.isElement==null?void 0:a.isElement(A)))==null||e?A:A.contextElement||await(a.getDocumentElement==null?void 0:a.getDocumentElement(o.floating)),boundary:u,rootBoundary:d,strategy:l})),L=c==="floating"?{x:s,y:r,width:n.floating.width,height:n.floating.height}:n.reference,O=await(a.getOffsetParent==null?void 0:a.getOffsetParent(o.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=re(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:L,offsetParent:O,strategy:l}):L);return{top:(_.top-m.top+p.top)/E.y,bottom:(m.bottom-_.bottom+p.bottom)/E.y,left:(_.left-m.left+p.left)/E.x,right:(m.right-_.right+p.right)/E.x}}var Aa=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:o,platform:l,elements:u}=t,{mainAxis:d=!0,crossAxis:c=!0,fallbackPlacements:f,fallbackStrategy:b="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:w=!0,...A}=Se(i,t);
vendor: 5,300 bytes, line 125
125if((e=a.arrow)!=null&&e.alignmentOffset)return{};let _=Nt(r),L=Yt(o),O=Nt(o)===o,E=await(l.isRTL==null?void 0:l.isRTL(u.floating)),m=f||(O||!w?[Be(o)]:ga(o)),q=p!=="none";!f&&q&&m.push(...va(o,w,p,E));let S=[o,...m],N=await _i(t,A),F=[],v=((s=a.flip)==null?void 0:s.overflows)||[];if(d&&F.push(N[_]),c){let I=ma(r,n,E);F.push(N[I[0]],N[I[1]])}if(v=[...v,{placement:r,overflows:F}],!F.every(I=>I<=0)){var M,k;let I=(((M=a.flip)==null?void 0:M.index)||0)+1,P=S[I];if(P)return{data:{index:I,overflows:v},reset:{placement:P}};let B=(k=v.filter(W=>W.overflows[0]<=0).sort((W,R)=>W.overflows[1]-R.overflows[1])[0])==null?void 0:k.placement;if(!B)switch(b){case"bestFit":{var C;let W=(C=v.filter(R=>{if(q){let U=Yt(R.placement);return U===L||U==="y"}return!0}).map(R=>[R.placement,R.overflows.filter(U=>U>0).reduce((U,z)=>U+z,0)]).sort((R,U)=>R[1]-U[1])[0])==null?void 0:C[0];W&&(B=W);break}case"initialPlacement":B=o;break}if(r!==B)return{reset:{placement:B}}}return{}}}};async function rl(i,t){let{placement:e,platform:s,elements:r}=i,a=await(s.isRTL==null?void 0:s.isRTL(r.floating)),n=Nt(e),o=Ee(e),l=Yt(e)==="y",u=["left","top"].includes(n)?-1:1,d=a&&l?-1:1,c=Se(t,i),{mainAxis:f,crossAxis:b,alignmentAxis:p}=typeof c=="number"?{mainAxis:c,crossAxis:0,alignmentAxis:null}:{mainAxis:c.mainAxis||0,crossAxis:c.crossAxis||0,alignmentAxis:c.alignmentAxis};return o&&typeof p=="number"&&(b=o==="end"?p*-1:p),l?{x:b*d,y:f*u}:{x:f*u,y:b*d}}var Sa=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:o}=t,l=await rl(t,i);return n===((e=o.offset)==null?void 0:e.placement)&&(s=o.arrow)!=null&&s.alignmentOffset?{}:{x:r+l.x,y:a+l.y,data:{...l,placement:n}}}}},Ea=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:o={fn:A=>{let{x:_,y:L}=A;return{x:_,y:L}}},...l}=Se(i,t),u={x:e,y:s},d=await _i(t,l),c=Yt(Nt(r)),f=ys(c),b=u[f],p=u[c];if(a){let A=f==="y"?"top":"left",_=f==="y"?"bottom":"right",L=b+d[A],O=b-d[_];b=vs(L,b,O)}if(n){let A=c==="y"?"top":"left",_=c==="y"?"bottom":"right",L=p+d[A],O=p-d[_];p=vs(L,p,O)}let w=o.fn({...t,[f]:b,[c]:p});return{...w,data:{x:w.x-e,y:w.y-s,enabled:{[f]:a,[c]:n}}}}}};var _a=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:o}=t,{apply:l=()=>{},...u}=Se(i,t),d=await _i(t,u),c=Nt(r),f=Ee(r),b=Yt(r)==="y",{width:p,height:w}=a.floating,A,_;c==="top"||c==="bottom"?(A=c,_=f===(await(n.isRTL==null?void 0:n.isRTL(o.floating))?"start":"end")?"left":"right"):(_=c,A=f==="end"?"top":"bottom");let L=w-d.top-d.bottom,O=p-d.left-d.right,E=Ut(w-d[A],L),m=Ut(p-d[_],O),q=!t.middlewareData.shift,S=E,N=m;if((e=t.middlewareData.shift)!=null&&e.enabled.x&&(N=O),(s=t.middlewareData.shift)!=null&&s.enabled.y&&(S=L),q&&!f){let v=ft(d.left,0),M=ft(d.right,0),k=ft(d.top,0),C=ft(d.bottom,0);b?N=p-2*(v!==0||M!==0?v+M:ft(d.left,d.right)):S=w-2*(k!==0||C!==0?k+C:ft(d.top,d.bottom))}await l({...t,availableWidth:N,availableHeight:S});let F=await n.getDimensions(o.floating);return p!==F.width||w!==F.height?{reset:{rects:!0}}:{}}}};function ki(){return typeof window<"u"}function ae(i){return Ca(i)?(i.nodeName||"").toLowerCase():"#document"}function pt(i){var t;return(i==null||(t=i.ownerDocument)==null?void 0:t.defaultView)||window}function yt(i){var t;return(t=(Ca(i)?i.ownerDocument:i.document)||window.document)==null?void 0:t.documentElement}function Ca(i){return ki()?i instanceof Node||i instanceof pt(i).Node:!1}function bt(i){return ki()?i instanceof Element||i instanceof pt(i).Element:!1}function wt(i){return ki()?i instanceof HTMLElement||i instanceof pt(i).HTMLElement:!1}function ka(i){return!ki()||typeof ShadowRoot>"u"?!1:i instanceof ShadowRoot||i instanceof pt(i).ShadowRoot}function ke(i){let{overflow:t,overflowX:e,overflowY:s,display:r}=mt(i);return/auto|scroll|overlay|hidden|clip/.test(t+s+e)&&!["inline","contents"].includes(r)}function Da(i){return["table","td","th"].includes(ae(i))}function Ue(i){return[":popover-open",":modal"].some(t=>{try{return i.matches(t)}catch{return!1}})}function Ci(i){let t=Di(),e=bt(i)?mt(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 Ia(i){let t=Rt(i);for(;wt(t)&&!ne(t);){if(Ci(t))return t;if(Ue(t))return null;t=Rt(t)}return null}function Di(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function ne(i){return["html","body","#document"].includes(ae(i))}function mt(i){return pt(i).getComputedStyle(i)}function Ye(i){return bt(i)?{scrollLeft:i.scrollLeft,scrollTop:i.scrollTop}:{scrollLeft:i.scrollX,scrollTop:i.scrollY}}function Rt(i){if(ae(i)==="html")return i;let t=i.assignedSlot||i.parentNode||ka(i)&&i.host||yt(i);return ka(t)?t.host:t}function Ta(i){let t=Rt(i);return ne(t)?i.ownerDocument?i.ownerDocument.body:i.body:wt(t)&&ke(t)?t:Ta(t)}function _e(i,t,e){var s;
vendor: 2,925 bytes, line 125
125t===void 0&&(t=[]),e===void 0&&(e=!0);let r=Ta(i),a=r===((s=i.ownerDocument)==null?void 0:s.body),n=pt(r);if(a){let o=Ii(n);return t.concat(n,n.visualViewport||[],ke(r)?r:[],o&&e?_e(o):[])}return t.concat(r,_e(r,[],e))}function Ii(i){return i.parent&&Object.getPrototypeOf(i.parent)?i.frameElement:null}function Pa(i){let t=mt(i),e=parseFloat(t.width)||0,s=parseFloat(t.height)||0,r=wt(i),a=r?i.offsetWidth:e,n=r?i.offsetHeight:s,o=We(e)!==a||We(s)!==n;return o&&(e=a,s=n),{width:e,height:s,$:o}}function Ss(i){return bt(i)?i:i.contextElement}function Ce(i){let t=Ss(i);if(!wt(t))return vt(1);let e=t.getBoundingClientRect(),{width:s,height:r,$:a}=Pa(t),n=(a?We(e.width):e.width)/s,o=(a?We(e.height):e.height)/r;return(!n||!Number.isFinite(n))&&(n=1),(!o||!Number.isFinite(o))&&(o=1),{x:n,y:o}}var al=vt(0);function Oa(i){let t=pt(i);return!Di()||!t.visualViewport?al:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function nl(i,t,e){return t===void 0&&(t=!1),!e||t&&e!==pt(i)?!1:t}function le(i,t,e,s){t===void 0&&(t=!1),e===void 0&&(e=!1);let r=i.getBoundingClientRect(),a=Ss(i),n=vt(1);t&&(s?bt(s)&&(n=Ce(s)):n=Ce(i));let o=nl(a,e,s)?Oa(a):vt(0),l=(r.left+o.x)/n.x,u=(r.top+o.y)/n.y,d=r.width/n.x,c=r.height/n.y;if(a){let f=pt(a),b=s&&bt(s)?pt(s):s,p=f,w=Ii(p);for(;w&&s&&b!==p;){let A=Ce(w),_=w.getBoundingClientRect(),L=mt(w),O=_.left+(w.clientLeft+parseFloat(L.paddingLeft))*A.x,E=_.top+(w.clientTop+parseFloat(L.paddingTop))*A.y;l*=A.x,u*=A.y,d*=A.x,c*=A.y,l+=O,u+=E,p=pt(w),w=Ii(p)}}return re({width:d,height:c,x:l,y:u})}function Es(i,t){let e=Ye(i).scrollLeft;return t?t.left+e:le(yt(i)).left+e}function Na(i,t,e){e===void 0&&(e=!1);let s=i.getBoundingClientRect(),r=s.left+t.scrollLeft-(e?0:Es(i,s)),a=s.top+t.scrollTop;return{x:r,y:a}}function ll(i){let{elements:t,rect:e,offsetParent:s,strategy:r}=i,a=r==="fixed",n=yt(s),o=t?Ue(t.floating):!1;if(s===n||o&&a)return e;let l={scrollLeft:0,scrollTop:0},u=vt(1),d=vt(0),c=wt(s);if((c||!c&&!a)&&((ae(s)!=="body"||ke(n))&&(l=Ye(s)),wt(s))){let b=le(s);u=Ce(s),d.x=b.x+s.clientLeft,d.y=b.y+s.clientTop}let f=n&&!c&&!a?Na(n,l,!0):vt(0);return{width:e.width*u.x,height:e.height*u.y,x:e.x*u.x-l.scrollLeft*u.x+d.x+f.x,y:e.y*u.y-l.scrollTop*u.y+d.y+f.y}}function ol(i){return Array.from(i.getClientRects())}function ul(i){let t=yt(i),e=Ye(i),s=i.ownerDocument.body,r=ft(t.scrollWidth,t.clientWidth,s.scrollWidth,s.clientWidth),a=ft(t.scrollHeight,t.clientHeight,s.scrollHeight,s.clientHeight),n=-e.scrollLeft+Es(i),o=-e.scrollTop;return mt(s).direction==="rtl"&&(n+=ft(t.clientWidth,s.clientWidth)-r),{width:r,height:a,x:n,y:o}}function hl(i,t){let e=pt(i),s=yt(i),r=e.visualViewport,a=s.clientWidth,n=s.clientHeight,o=0,l=0;if(r){a=r.width,n=r.height;let u=Di();(!u||u&&t==="fixed")&&(o=r.offsetLeft,l=r.offsetTop)}return{width:a,height:n,x:o,y:l}}function cl(i,t){let e=le(i,!0,t==="fixed"),s=e.top+i.clientTop,r=e.left+i.clientLeft,a=wt(i)?Ce(i):vt(1),n=i.
vendor: 4,351 bytes, line 125
125clientWidth*a.x,o=i.clientHeight*a.y,l=r*a.x,u=s*a.y;return{width:n,height:o,x:l,y:u}}function La(i,t,e){let s;if(t==="viewport")s=hl(i,e);else if(t==="document")s=ul(yt(i));else if(bt(t))s=cl(t,e);else{let r=Oa(i);s={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return re(s)}function Ra(i,t){let e=Rt(i);return e===t||!bt(e)||ne(e)?!1:mt(e).position==="fixed"||Ra(e,t)}function dl(i,t){let e=t.get(i);if(e)return e;let s=_e(i,[],!1).filter(o=>bt(o)&&ae(o)!=="body"),r=null,a=mt(i).position==="fixed",n=a?Rt(i):i;for(;bt(n)&&!ne(n);){let o=mt(n),l=Ci(n);!l&&o.position==="fixed"&&(r=null),(a?!l&&!r:!l&&o.position==="static"&&!!r&&["absolute","fixed"].includes(r.position)||ke(n)&&!l&&Ra(i,n))?s=s.filter(d=>d!==n):r=o,n=Rt(n)}return t.set(i,s),s}function fl(i){let{element:t,boundary:e,rootBoundary:s,strategy:r}=i,n=[...e==="clippingAncestors"?Ue(t)?[]:dl(t,this._c):[].concat(e),s],o=n[0],l=n.reduce((u,d)=>{let c=La(t,d,r);return u.top=ft(c.top,u.top),u.right=Ut(c.right,u.right),u.bottom=Ut(c.bottom,u.bottom),u.left=ft(c.left,u.left),u},La(t,o,r));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function pl(i){let{width:t,height:e}=Pa(i);return{width:t,height:e}}function bl(i,t,e){let s=wt(t),r=yt(t),a=e==="fixed",n=le(i,!0,a,t),o={scrollLeft:0,scrollTop:0},l=vt(0);if(s||!s&&!a)if((ae(t)!=="body"||ke(r))&&(o=Ye(t)),s){let f=le(t,!0,a,t);l.x=f.x+t.clientLeft,l.y=f.y+t.clientTop}else r&&(l.x=Es(r));let u=r&&!s&&!a?Na(r,o):vt(0),d=n.left+o.scrollLeft-l.x-u.x,c=n.top+o.scrollTop-l.y-u.y;return{x:d,y:c,width:n.width,height:n.height}}function As(i){return mt(i).position==="static"}function Ma(i,t){if(!wt(i)||mt(i).position==="fixed")return null;if(t)return t(i);let e=i.offsetParent;return yt(i)===e&&(e=e.ownerDocument.body),e}function Fa(i,t){let e=pt(i);if(Ue(i))return e;if(!wt(i)){let r=Rt(i);for(;r&&!ne(r);){if(bt(r)&&!As(r))return r;r=Rt(r)}return e}let s=Ma(i,t);for(;s&&Da(s)&&As(s);)s=Ma(s,t);return s&&ne(s)&&As(s)&&!Ci(s)?e:s||Ia(i)||e}var ml=async function(i){let t=this.getOffsetParent||Fa,e=this.getDimensions,s=await e(i.floating);return{reference:bl(i.reference,await t(i.floating),i.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function gl(i){return mt(i).direction==="rtl"}var vl={convertOffsetParentRelativeRectToViewportRelativeRect:ll,getDocumentElement:yt,getClippingRect:fl,getOffsetParent:Fa,getElementRects:ml,getClientRects:ol,getDimensions:pl,getScale:Ce,isElement:bt,isRTL:gl};function Va(i,t){return i.x===t.x&&i.y===t.y&&i.width===t.width&&i.height===t.height}function yl(i,t){let e=null,s,r=yt(i);function a(){var o;clearTimeout(s),(o=e)==null||o.disconnect(),e=null}function n(o,l){o===void 0&&(o=!1),l===void 0&&(l=1),a();let u=i.getBoundingClientRect(),{left:d,top:c,width:f,height:b}=u;if(o||t(),!f||!b)return;let p=He(c),w=He(r.clientWidth-(d+f)),A=He(r.clientHeight-(c+b)),_=He(d),O={rootMargin:-p+"px "+-w+"px "+-A+"px "+-_+"px",threshold:ft(0,Ut(1,l))||1},E=!0;function m(q){let S=q[0].intersectionRatio;if(S!==l){if(!E)return n();S?n(!1,S):s=setTimeout(()=>{n(!1,1e-7)},1e3)}S===1&&!Va(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 qa(i,t,e,s){s===void 0&&(s={});let{ancestorScroll:r=!0,ancestorResize:a=!0,elementResize:n=typeof ResizeObserver=="function",layoutShift:o=typeof IntersectionObserver=="function",animationFrame:l=!1}=s,u=Ss(i),d=r||a?[...u?_e(u):[],..._e(t)]:[];d.forEach(_=>{r&&_.addEventListener("scroll",e,{passive:!0}),a&&_.addEventListener("resize",e)});let c=u&&o?yl(u,e):null,f=-1,b=null;n&&(b=new ResizeObserver(_=>{let[L]=_;L&&L.target===u&&b&&(b.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var O;(O=b)==null||O.observe(t)})),e()}),u&&!l&&b.observe(u),b.observe(t));let p,w=l?le(i):null;l&&A();function A(){let _=le(i);w&&!Va(w,_)&&e(),w=_,p=requestAnimationFrame(A)}return e(),()=>{var _;d.forEach(L=>{r&&L.removeEventListener("scroll",e),a&&L.removeEventListener("resize",e)}),c?.(),(_=b)==null||_.disconnect(),b=null,l&&cancelAnimationFrame(p)}}var $a=Sa;var Ba=Ea,Wa=Aa,Ha=_a;var Ua=(i,t,e)=>{let s=new Map,r={platform:vl,...e},a={...r.platform,_c:s};return xa(i,t,{...r,platform:a})};var Ya=!(CSS.supports?.("selector(:popover-open)")??!1),it=class extends j{boot({options:t}
125){if(t({reference:null,auto:!0,position:"bottom start",gap:"5",offset:"0",matchWidth:!1,crossAxis:!1,scrollY:!0}),this.options().reference===null||this.options().position===null)return;let[e,s]=Al(this.el,{scrollY:this.options().scrollY}),r=wl(this.el,this.options().reference,e,{position:this.options().position,gap:this.options().gap,offset:this.options().offset,matchWidth:this.options().matchWidth,crossAxis:this.options().crossAxis,scrollY:this.options().scrollY}),a=()=>{};this.reposition=(...n)=>{this.options().auto?a=qa(this.options().reference,this.el,r):r(null,...n)},this.cleanup=()=>{a(),s()}}};function wl(i,t,e,{position:s,offset:r,gap:a,matchWidth:n,crossAxis:o,scrollY:l}){let u=window.getComputedStyle(i).maxHeight;return u=u==="none"?null:parseFloat(u),(d,c,f)=>{Ua(t,i,{strategy:Ya?"fixed":"absolute",placement:xl(s,i),middleware:[$a({mainAxis:Number(a),alignmentAxis:Number(r)}),Wa(),Ba({padding:5,crossAxis:o}),Ha({padding:5,apply({rects:b,elements:p,availableHeight:w}){n&&Object.assign(p.floating.style,{width:`${b.reference.width}px`});let A=u;A===null&&(A=l?p.floating.scrollHeight:p.floating.offsetHeight),p.floating.style.maxHeight=w>A?"":`${w}px`}})]}).then(({x:b,y:p})=>{e(c||b,f||p)})}}function xl(i,t){let e=i.split(" ");switch(e[0]){case"start":e[0]=Lt(t)?"right":"left";break;case"end":e[0]=Lt(t)?"left":"right";break}return e.join("-")}function Al(i,{scrollY:t=!0}){let e=(l,u,d,c)=>{Object.assign(i.style,{position:Ya?"fixed":"absolute",overflowY:t?"auto":"hidden",left:`${l}px`,top:`${u}px`,right:"auto",bottom:"auto",width:d,maxHeight:c})},s,r,a,n,o=new MutationObserver(()=>e(s,r,a,n));return[(l,u)=>{s=l,r=u,a=i.style.width,n=i.style.maxHeight,o.disconnect(),e(s,r,a,n),o.observe(i,{attributeFilter:["style"]})},()=>{o.disconnect()}]}var Ti=class extends T{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 o=this.picker._selectable.findByValue(n);if(!o){if(t)return setTimeout(()=>this.render());throw`Could not find option for value "${n}"`}a.set(n,o)}a.forEach((n,o)=>this.selecteds.set(o,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 o=!1;if(this.renderOverflow(this.selecteds.size,this.selecteds.size-n),this.clientWidth<this.scrollWidth&&(o=!0),this.templates.overflow?.clearOverflow?.(),o)return!0}return n>parseInt(this.max)},renderOverflow:n=>{this.templates?.overflow?.getAttribute("mode")!=="append"&&this.templates.options?.clearOptions?.(),this.renderOverflow(this.selecteds.size,n)}}):this.renderPlaceholder()}else{let e=this.picker.value;if(Array.from(this.selecteds.keys()).includes(e))return;this.selecteds.clear();let s=this.picker._selectable.findByValue(e);if(s)this.selecteds.set(e,s);else if(!["",null,void 0].includes(e)){if(t)return setTimeout(()=>{this.render()});throw`Could not find option for value "${e}"`}this.templates.placeholder?.clearPlaceholder?.(),this.templates.option?.clearOption?.(),this.selecteds.size>0?this.renderOption():this.renderPlaceholder()}}renderOptions({hasOverflowed:t,renderOverflow:e}){let s=document.createElement("div");s.style.display="contents";let r=ze(this.templates.options,{default:s});this.templates.options.after(r),this.templates.options.clearOptions=()=>{r.remove(),this.templates.options.clearOptions=()=>{}};let a=0,n=!1;for(let[l,u]of this.selecteds){let d=new DocumentFragment;d.append(...u.el.cloneNode(!0).childNodes);let c=ze(this.templates.option,{text:u.getSelectedLabel()??u.getLabel(),default:u.getSelectedLabel()??d,value:l});if(c.setAttribute("data-value",l),c.setAttribute("data-appended",""),c.deselect=()=>u.deselect(),s.appendChild(c),a++,t(a)){n=!0,s.removeChild(c),a--;break}}let o=new DocumentFragment;o.append(...s.childNodes),s.replaceWith(o),n&&e(this.selecteds.size-a)}renderOption(){for(let[t,e]of this.selecteds){let s=new DocumentFragment;s.append(...e.el.cloneNode(!0).childNodes);let r=ze(this.templates.option,{text:e.getSelectedLabel()??e.getLabel(),default:e.getSelectedLabel()??s,value:t});r.setAttribute("data-value",t),r.setAttribute("data-appended",t),r.deselect=()=>e.deselect(),this.templates.option.after(r),this.templates.option.clearOption=()=>{r.remove(),this.templates.option.clearOption=()=>{}}}}renderPlaceholder(){if(!this.templates.placeholder)return;let t=ze(this.templates.placeholder);t.setAttribute("data-appended",""),this.templates.placeholder.after(t),this.templates.placeholder.clearPlaceholder=()=>{t.remove(),this.templates.placeholder.clearPlaceholder=()=>{}}}renderOverflow(t,e){if(!this.templates.overflow)return;let s=ze(this.templates.overflow,{remainder:e,count:this.selecteds.size});s.setAttribute("data-appended",""),this.templates.overflow.after(s),this.templates.overflow.clearOverflow=()=>{s.remove(),this.templates.placeholder.clearOverflow=()=>{}}}},Li=class extends T{boot(){this.addEventListener("click",t=>{t.stopPropagation();let e=this.closest("[data-value]")?.getAttribute("data-value");if(e===void 0)return;let s=this.closest("ui-pillbox")._selectable,r=s.selectableByValue(e);r?r.deselect():s.deselectByValue(e)})}};function ze(i,t={}){let e=i.content.cloneNode(!0);return Object.entries(t).forEach(([s,r])=>{(s==="default"?e.querySelectorAll("slot:not([name])"):e.querySelectorAll(`slot[name="${s}
125"]`)).forEach(n=>n.replaceWith(typeof r=="string"?document.createTextNode(r):r))}),e.firstElementChild}var ut=class extends kt{groupOfType=H;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(H);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(H).isSelected()).use(H)}selecteds(){return this.walker().filter(t=>t.use(H).isSelected()).map(t=>t.use(H))}selectFirst(){this.walker().first()?.use(H).select()}selectAll(){this.walker().filter(t=>!t.use(H).isSelected()).map(t=>t.use(H).select())}deselectAll(){this.walker().filter(t=>t.use(H).isSelected()).map(t=>t.use(H).deselect())}allAreSelected(){let t=this.walker().filter(e=>!0);return t.length>0&&this.walker().filter(e=>e.use(H).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(H).value===t)?.use(H)}deselectOthers(t){this.walker().each(e=>{e!==t&&e.use(H).surgicallyDeselect()})}selectedTextValue(){return this.options().multiple?Array.from(this.state).map(t=>this.convertValueStringToElementText(t)).join(", "):this.convertValueStringToElementText(this.state)}convertValueStringToElementText(t){let e=this.findByValue(t);return e?e.selectedLabel||e.label||e.value:t}findByValue(t){return this.selecteds().find(e=>e.value===t)}walker(){return tt(this.el,(t,{skip:e,reject:s})=>{if(t[this.constructor.name]&&t!==this.el)return s();if(!t[this.groupOfType.name]||t.mixins.get(this.groupOfType.name).ungrouped)return e()})}},H=class extends j{boot({options:t}){this.groupedByType=ut,t({ungrouped:!1,togglable:!1,value:void 0,label:void 0,selectedLabel:void 0,selectedInitially:!1,dataAttr:"data-selected",ariaAttr:"aria-selected"}),this.ungrouped=this.options().ungrouped,this.value=this.options().value===void 0?this.el.value:this.options().value,this.value=this.value+"",this.label=this.options().label,this.selectedLabel=this.options().selectedLabel;let e=this.options().selectedInitially;this.onSelects=[],this.onUnselects=[],this.onChanges=[];let s=()=>{this.group()&&this.group().hasValue(this.value)&&(e=!0),this.multiple=this.hasGroup()?this.group().options().multiple:!1,this.toggleable=this.options().toggleable||this.multiple,e?this.select(!0):(this.state=e,this.surgicallyDeselect(!0))};s(),!this.hasGroup()&&!this.el.isConnected&&queueMicrotask(()=>{this.hasGroup()&&s()})}mount(){this.el.hasAttribute(this.options().ariaAttr)||h(this.el,this.options().ariaAttr,"false")}onInitAndChange(t){t(),this.onChanges.push(t)}onChange(t){this.onChanges.push(t)}onSelect(t){this.onSelects.push(t)}onUnselect(t){this.onUnselects.push(t)}setState(t){t?this.select():this.deselect()}getState(){return this.state}press(){this.toggleable?this.toggle():this.select()}trigger(){this.toggleable?this.toggle():this.select()}toggle(){this.isSelected()?this.deselect():this.select()}isSelected(){return this.state}select(t=!1){let e=!this.isSelected();this.toggleable||this.group()?.deselectOthers(this.el),this.state=!0,h(this.el,this.options().ariaAttr,"true"),h(this.el,this.options().dataAttr,""),e&&(t||(this.onSelects.forEach(s=>
125s()),this.onChanges.forEach(s=>s())),this.group()?.changed(this,t))}surgicallySelect(){let t=!this.isSelected();this.state=!0,h(this.el,this.options().ariaAttr,"true"),h(this.el,this.options().dataAttr,""),t&&(this.onSelects.forEach(e=>e()),this.onChanges.forEach(e=>e()))}deselect(t=!0){let e=this.isSelected();this.state=!1,h(this.el,this.options().ariaAttr,"false"),x(this.el,this.options().dataAttr),e&&(this.onUnselects.forEach(s=>s()),this.onChanges.forEach(s=>s()),t&&this.group()?.changed(this))}surgicallyDeselect(t=!1){let e=this.isSelected();this.state=!1,h(this.el,this.options().ariaAttr,"false"),x(this.el,this.options().dataAttr),e&&!t&&(this.onUnselects.forEach(s=>s()),this.onChanges.forEach(s=>s()))}getValue(){return this.value}getLabel(){return this.label}getSelectedLabel(){return this.selectedLabel}};var Q=class extends j{boot({options:t}){t({name:void 0,value:void 0,includeWhenEmpty:!0,shouldUpdateValue:!0}),this.name=this.options().name,this.value=this.options().value===void 0?this.el.value:this.options().value,this.state=!1,this.observer=new MutationObserver(()=>{this.renderHiddenInputs()}),this.observer.observe(this.el,{childList:!0})}mount(){this.renderHiddenInputs()}update(t){this.options().shouldUpdateValue?this.value=t:this.state=!!t,this.renderHiddenInputs()}valueIsEmpty(){return this.value===void 0||this.value===null||this.value===""}renderHiddenInputs(){if(this.observer.disconnect(),!this.name)return;let t=this.el.children,e=[];for(let r=0;r<t.length;r++){let a=t[r];a.hasAttribute("data-flux-hidden")&&e.push(a)}e.forEach(r=>r.remove());let s;this.options().shouldUpdateValue?s=!this.valueIsEmpty()||this.options().includeWhenEmpty?this.generateInputs(this.name,this.value):[]:s=this.state||this.options().includeWhenEmpty?this.generateInputs(this.name,this.value):[],s.forEach(r=>{this.el.append(r)}),this.observer.observe(this.el,{childList:!0})}generateInputs(t,e,s=[]){if(this.isObjectOrArray(e))for(let r in e)s=s.concat(this.generateInputs(`${t}[${r}]`,e[r]));else{let r=document.createElement("input");return r.setAttribute("type","hidden"),r.setAttribute("name",t),r.setAttribute("value",e===null?"":""+e),r.setAttribute("data-flux-hidden",""),r.setAttribute("data-appended",""),[r]}return s}isObjectOrArray(t){return typeof t=="object"&&t!==null}submitEnclosingForm(){let t=this.getAssociatedForm();t&&t.requestSubmit()}getAssociatedForm(){let t=this.el.getAttribute("form");return t?document.getElementById(t)||null:this.el.closest("form")}};var de=class extends X{boot(){let t=this.list();this._controllable=new Y(this,{bubbles:!0}),this._selectable=new ut(t,{multiple:this.hasAttribute("multiple")}),this._submittable=new Q(this,{name:this.getAttribute("name"),value:this._selectable.getState()}),this._controllable.initial(s=>s&&this._selectable.setState(s)),this._controllable.getter(()=>this._selectable.getState());let e=G();this._controllable.setter(e(s=>{this._selectable.setState(s)})),this._selectable.onChange(e(()=>{this._controllable.dispatch(),this.dispatchEvent(new CustomEvent("select",{bubbles:!1}))})),this._selectable.onInitAndChange(()=>{this._submittable.update(this._selectable.getState())})}mount(){this._disableable=new V(this),queueMicrotask(()=>{this._submittable.update(this._selectable.getState())});let t=this.input(),e=this.button(),s=this.list(),r=this.hasAttribute("multiple"),a=this.hasAttribute("autocomplete"),n=this.hasAttribute("autocomplete")&&this.getAttribute("autocomplete").trim().split(" ").includes("strict"),o=this.querySelector("ui-options")||this,l=_s(o,"options",r);this._activatable=new Pt(o,{filter:"data-hidden"}),!t&&!e&&this._disableable.onInitAndChange(p=>{p?this.removeAttribute("tabindex"):this.setAttribute("tabindex","0")}),this.hasAttribute("filter")&&this.getAttribute("filter")!=="manual"&&(this._filterable=new se(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 f=this.querySelector("button,ui-button");if(f=u?.contains(f)?null:f,!(u||c))xt(this,this._activatable),At(this,this,this._activatable),za(this,this._activatable,this._selectable);else if(!u&&c){let p=c;this._disableable.onInitAndChange(w=>{w?p&&h(p,"disabled",""):p&&x(p,"disabled")}),Le(this,p,this._selectable,this._popoverable),za(p,this._activatable,this._selectable),Ga(a,n,this,p,this._selectable,this._popoverable,this._filterable),Te(p),Ie(p),this._filterable&&De(s,p,this._filterable),Kt(p,this._activatable,this._selectable),xt(p,this._activatable),At(this,p,this._activatable),zt(this,this._activatable)}else if(u&&c){let p=c;h(p,"role","combobox"),h(p,"aria-controls",l);let w=u;this._popoverable=new rt(w),this._anchorable=new it(w,{reference:p,matchWidth:!0,position:this.hasAttribute("position")?this.getAttribute("position"):void 0,gap:this.hasAttribute("gap")?this.getAttribute("gap"):void 0,offset:this.hasAttribute("offset")?this.getAttribute("offset"):void 0}),Ga(a,n,this,p,this._selectable,this._popoverable,this._filterable),this._disableable.onInitAndChange(A=>{A?p&&h(p,"disabled",""):p&&x(p,"disabled")}),this.querySelectorAll("button,ui-button").forEach(A=>{w.contains(A)||(h(A,"tabindex","-1"),h(A,"aria-controls",l),h(A,"aria-haspopup","listbox"),Gt(A,this._popoverable),y(A,"click",()=>{this._popoverable.toggle(),wi()||p.focus()}))}),Le(this,p,this._selectable,this._popoverable),oe(this,p,w,this._popoverable,this._anchorable),ce(this,this._popoverable,[p]),Gt(p,this._popoverable),Te(p),Ie(p),this._filterable&&De(s,p,this._filterable),Kt(p,this._activatable,this._selectable),Cs(p,this._popoverable),Vt(p,this._popoverable,this._activatable,this._selectable),ks(p,this._popoverable),Ft(this,this._popoverable),xt(p,this._activatable),At(this,p,this._activatable),zt(this,this._activatable),ue(this._popoverable,this._activatable,this._selectable),he(this,this._selectable,this._popoverable,r)}else if(u&&d){let p=f,w=d,A=u;h(p,"role","combobox"),h(w,"role","combobox"),h(p,"aria-controls",l),this._disableable.onInitAndChange(_=>{_?(p&&h(p,"disabled",""),w&&h(w,"disabled","")):(p&&x(p,"disabled"),w&&x(w,"disabled"))}),this._popoverable=new rt(A),this._anchorable=new it(A,{reference:p,matchWidth:!0,position:this.hasAttribute("position")?this.getAttribute("position"):void 0,gap:this.hasAttribute("gap")?this.getAttribute("gap"):void 0,offset:this.hasAttribute("offset")?this.getAttribute("offset"):void 0,scrollY:!1}),Te(w),Ie(w),this._filterable&&De(s,w,this._filterable),Kt(w,this._activatable,this._selectable),Mi(w,this._popoverable),oe(this,p,A,this._popoverable,this._anchorable),ce(this,this._popoverable,[w]),Gt(p,this._popoverable),Le(this,w,this._selectable,this._popoverable),Vt(p,this._popoverable,this._activatable,this._selectable),Ge(p,this._popoverable),Ft(this,this._popoverable),xt(w,this._activatable),Xt(p,this._activatable,this._popoverable),At(this,w,this._activatable),zt(this,this._activatable),ue(this._popoverable,this._activatable,this._selectable),he(this,this._selectable,this._popoverable,r)}else if(u){let p=f,w=u;h(p,"role","combobox"),h(p,"aria-controls",l),this._disableable.onInitAndChange(A=>{A?(p&&h(p,"disabled",""),t&&h(t,"disabled","")):(p&&x(p,"disabled"),t&&x(t,"disabled"))}),this._popoverable=new rt(w),this._anchorable=new it(w,{reference:p,matchWidth:!0,position:this.hasAttribute("position")?this.getAttribute("position"):void 0,gap:this.hasAttribute("gap")?this.getAttribute("gap"):void 0,offset:this.hasAttribute("offset")?this.getAttribute("offset"):void 0}),oe(this,p,w,this._popoverable,this._anchorable),ce(this,this._popoverable),Gt(p,this._popoverable),Vt(p,this._popoverable,this._activatable,this._selectable),Ge(p,this._popoverable),Kt(p,this._activatable,this._selectable),Ft(this,this._popoverable),xt(p,this._activatable),Xt(p,this._activatable,this._popoverable),At(this,p,this._activatable),zt(this,this._activatable),ue(this._popoverable,this._activatable,this._selectable),he(this,this._selectable,this._popoverable,r)}new MutationObserver(()=>{requestAnimationFrame(()=>{if(!this._popoverable||this._popoverable.getState()){let p=this._selectable.selecteds().find(w=>!w.el._disableable.isDisabled())?.el;this._activatable.activateSelectedOrFirst(p)}else this._activatable.clearActive()})}).observe(s,{childList:!0})}unmount(){if(this._popoverable?.getState()){let{unlock:t}=lt();t()}}trigger(){return this.button()||this.input()}button(){return Array.from(this.querySelectorAll("button,ui-button")).find(t=>t.nextElementSibling?.matches("[popover]"))||null}input(){return this.querySelector('input:not([type="hidden"])')}list(){return this.querySelector("ui-options")||this}clear(){this._selectable.setState(null),this.dispatchEvent(new CustomEvent("clear",{bubbles:!1}))}open(){this._popoverable.setState(!0)}close(){this._popoverable.setState(!1)}deselectLast(){!this.hasAttribute("multiple")&&this.value!==null&&(this.value=null,this.dispatchEvent(new Event("input",{bubbles:!1})),this.dispatchEvent(new Event("change",{bubbles:!1}))),this.hasAttribute("multiple")&&this.value.length!==0&&(this.value=this.value.slice(0,-1),this.dispatchEvent(new Event("input",{bubbles:!1})),this.dispatchEvent(new Event("change",{bubbles:!1})))}};D("selected-remove",Li);D("selected",Ti);D("select",de);function xt(i,t){y(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 Xt(i,t,e){xi(i,s=>{t.activateBySearch(s),e.getState()||t.getActive()?.click()})}function At(i,t,e){y(t,"keydown",s=>{if(s.key==="Enter"){let r=e.getActive();if(s.preventDefault(),s.stopPropagation(),!r||r._disableable?.isDisabled())return;r.click(),i.dispatchEvent(new CustomEvent("interaction",{bubbles:!1,cancelable:!1,detail:{optionEl:r}})),r.hasAttribute("action")&&i.dispatchEvent(new CustomEvent("action",{bubbles:!1,cancelable:!1,detail:{optionEl:r}}))}})}function zt(i,t,e=!1){y(i,e?"pointerdown":"click",s=>{if(s.target.closest("ui-option, ui-option-create")){let r=s.target.closest("ui-option, ui-option-create");if(r._disableable.isDisabled())return;r._selectable?.trigger(),i.dispatchEvent(new CustomEvent("interaction",{bubbles:!1,cancelable:!1,detail:{optionEl:r}})),r.hasAttribute("action")&&i.dispatchEvent(new CustomEvent("action",{bubbles:!1,cancelable:!1,detail:{optionEl:r}})),s.preventDefault(),s.stopPropagation()}})}function za(i,t,e){y(i,"focus",()=>{let s=e.selecteds().find(r=>!r.el._disableable.isDisabled())?.el;t.activateSelectedOrFirst(s)}),y(i,"blur",()=>{t.clearActive()})}function _s(i,t){let e=K(i,"options");return h(i,"role","listbox"),h(i,"aria-multiselectable",t?"true":"false"),e}function Gt(i,t){h(i,"aria-haspopup","listbox");let e=()=>{h(i,"aria-expanded",t.getState()?"true":"false"),t.getState()?h(i,"data-open",""):x(i,"data-open","")};t.onChange(()=>{e()}),e()}function oe(i,t,e,s,r){let a=()=>{Array.from([i,e]).forEach(n=>{s.getState()?h(n,"data-open",""):x(n,"data-open","")}),s.getState()?r.reposition():r.cleanup()};s.onChange(()=>a()),a(),s.onChange(()=>{s.getState()?i.dispatchEvent(new Event("open",{bubbles:!1,cancelable:!1})):i.dispatchEvent(new Event("close",{bubbles:!1,cancelable:!1}))})}function ue(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 Ft(i,t){y(i,"keydown",e=>{e.key==="Escape"&&t.getState()&&(t.setState(!1),e.preventDefault(),e.stopImmediatePropagation())})}function Vt(i,t){y(i,"keydown",e=>{["ArrowDown","ArrowUp"].includes(e.key)&&(e.key==="ArrowDown"||e.key==="ArrowUp")&&(t.getState()||(t.setState(!0),e.preventDefault(),e.stopImmediatePropagation()))})}function ks(i,t){y(i,"click",()=>{t.getState()||(t.setState(!0),i.focus())})}function Ge(i,t){y(i,"click",()=>{t.setState(!t.getState()),i.focus()})}function Mi(i,t){t.onChange(()=>{t.getState()&&!wi()&&setTimeout(()=>i.focus())})}function De(i,t,e){y(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 Ie(i){y(i,"focus",()=>i.select())}function Te(i){y(i,"change",t=>t.stopPropagation()),y(i,"input",t=>t.stopPropagation())}function Cs(i,t){y(i,"keydown",e=>{(/^[a-zA-Z0-9]$/.test(e.key)||e.key==="Backspace")&&(t.getState()||t.setState(!0))})}function Le(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"),o=n===""||n.split(" ").includes("action"),l=n===""||n.split(" ").includes("select"),u=n===""||n.split(" ").includes("close"),d=n===""||n.split(" ").includes("esc");n==="none"&&(o=l=u=d=!1),o?i.addEventListener("action",c=>{a("")}):l&&e.onChange(()=>{queueMicrotask(()=>a(""))}),u&&s.onChange(()=>{s.getState()||a("")}),d&&y(t,"keydown",c=>{c.key==="Escape"&&a("")})}function he(i,t,e,s){let r=!s,a=!s,n=!s;if(i.hasAttribute("close")){let o=i.getAttribute("close");if(r=o==="",a=o.split(" ").includes("action"),n=o.split(" ").includes("select"),o==="none")return}r||a?i.addEventListener("interaction",o=>{let l=o.detail.optionEl;if(!l.hasAttribute("action")){e.setState(!1);return}setTimeout(()=>{if(!l.hasAttribute("data-flux-loading")&&!l.hasAttribute("data-loading")){e.
125setState(!1);return}let u=new MutationObserver(()=>{requestAnimationFrame(()=>{i.querySelector("input[data-invalid]")||e.setState(!1)}),u.disconnect()});u.observe(l,{attributes:!0,attributeFilter:["data-loading","data-flux-loading"]})},10)}):n&&t.onChange(()=>{e.setState(!1)})}function Kt(i,t,e){t.onChange(()=>{let s=t.getActive();s?h(i,"aria-activedescendant",s.id):x(i,"aria-activedescendant")}),e.onChange(s=>{if(!s)return;let r=s.el;r&&h(i,"aria-activedescendant",r.id)})}function Ga(i,t,e,s,r,a,n){if(!i){h(s,"autocomplete","off"),h(s,"aria-autocomplete","none");return}let o=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 l=()=>{r.isNotEmpty()?requestAnimationFrame(()=>{o(r.selectedTextValue()),t&&h(s,"data-selected",r.selectedTextValue())}):(o(""),x(s,"data-selected"))};queueMicrotask(()=>{r.isEmpty()&&s.value!==""&&r.setState(s.value),r.onInitAndChange(()=>l())}),e.addEventListener("interaction",u=>{u.detail.optionEl._selectable?.isSelected()&&l()}),t&&a.onChange(()=>
125{a.getState()||requestAnimationFrame(()=>{o(s.getAttribute("data-selected")||"")})})}function ce(i,t,e=[]){let{lock:s,unlock:r}=lt(t.el,!1,e);t.onChange(()=>{t.getState()?s():r()})}var Ds=class extends de{mount(){this._disableable=new V(this),queueMicrotask(()=>{this._submittable.update(this._selectable.getState())});let t=this.input(),e=this.list(),s=this.hasAttribute("multiple"),r=this.querySelector("ui-pillbox-trigger"),a=this.querySelector("ui-options")||this,n=_s(a,"options",s);this._activatable=new Pt(a,{filter:"data-hidden"}),this.hasAttribute("filter")&&this.getAttribute("filter")!=="manual"&&(this._filterable=new se(e),this._filterable.onChange(()=>{this._activatable.clearActive(),this._filterable.hasResults()&&this._activatable.activateFirst()}),this.addEventListener("close",()=>{this._filterable&&this._filterable.filter("")}));let o=this.querySelector("[popover]:not(ui-tooltip > [popover])"),l=o?.querySelector('input:not([type="hidden"])'),u=this.querySelector("ui-selected input");if(!o)throw new Error("Popover element not found");if(l){let c=r,f=l,b=o;h(c,"role","button"),h(f,"aria-autocomplete","list"),h(f,"aria-controls",n),h(f,"role","combobox"),this._disableable.onInitAndChange(p=>{p?(c&&h(c,"disabled",""),f&&h(f,"disabled","")):(c&&x(c,"disabled"),f&&x(f,"disabled"))}),this._popoverable=new rt(b),this._anchorable=new it(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}),Kt(f,this._activatable,this._selectable),Te(f),Ie(f),this._filterable&&De(e,f,this._filterable),Mi(f,this._popoverable),oe(this,c,b,this._popoverable,this._anchorable),ce(this,this._popoverable,[f]),Gt(c,this._popoverable),Le(this,f,this._selectable,this._popoverable),Vt(c,this._popoverable,this._activatable,this._selectable),Ge(c,this._popoverable),Ft(this,this._popoverable),xt(f,this._activatable),Xt(c,this._activatable,this._popoverable),At(this,f,this._activatable),zt(this,this._activatable),ue(this._popoverable,this._activatable,this._selectable),he(this,this._selectable,this._popoverable,s),Ka(c)}else if(u){let c=r,f=u,b=o;h(c,"role","button"),h(f,"aria-autocomplete","list"),h(f,"aria-controls",n),h(f,"role","combobox"),this._disableable.onInitAndChange(p=>{p?(c&&h(c,"disabled",""),f&&h(f,"disabled","")):(c&&x(c,"disabled"),f&&x(f,"disabled"))}),this._popoverable=new rt(b,{triggers:[f,c]}),this._anchorable=new it(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}),Kt(f,this._activatable,this._selectable),Te(f),Ie(f),this._filterable&&De(e,f,this._filterable),Mi(f,this._popoverable),oe(this,c,b,this._popoverable,this._anchorable),ce(this,this._popoverable,[c]),Gt(c,this._popoverable),Le(this,f,this._selectable,this._popoverable),Cs(f,this._popoverable),Vt(f,this._popoverable,this._activatable,this._selectable),ks(c,this._popoverable,f),Ft(this,this._popoverable),xt(f,this._activatable),Xt(c,this._activatable,this._popoverable),At(this,f,this._activatable),zt(this,this._activatable),ue(this._popoverable,this._activatable,this._selectable),he(this,this._selectable,this._popoverable,s),Sl(this,this._selectable,f),El(this._selectable,f),_l(this._selectable,f),kl(this._popoverable,c,f)}else{let c=r,f=o;h(c,"role","combobox"),h(c,"aria-controls",n),h(c,"aria-autocomplete","none"),this._disableable.onInitAndChange(b=>{b?(c&&h(c,"disabled",""),t&&h(t,"disabled","")):(c&&x(c,"disabled"),t&&x(t,"disabled"))}),this._popoverable=new rt(f),this._anchorable=new it(f,{reference:c,matchWidth:!0,position:this.hasAttribute("position")?this.getAttribute("position"):void 0,gap:this.hasAttribute("gap")?this.getAttribute("gap"):void 0,offset:this.hasAttribute("offset")?this.getAttribute("offset"):void 0}),oe(this,c,f,this._popoverable,this._anchorable),ce(this,this._popoverable),Gt(c,this._popoverable),Vt(c,this._popoverable,this._activatable,this._selectable),Ge(c,this._popoverable),Kt(c,this._activatable,this._selectable),Ft(this,this._popoverable),xt(c,this._activatable),Xt(c,this._activatable,this._popoverable),At(this,c,this._activatable),zt(this,this._activatable),ue(this._popoverable,this._activatable,this._selectable),he(this,this._selectable,this._popoverable,s),Ka(c)}new MutationObserver(()=>{requestAnimationFrame(()=>{if(!this._popoverable||this._popoverable.getState()){let c=this._selectable.selecteds().find(f=>!f.el._disableable.isDisabled())?.el;this._activatable.activateSelectedOrFirst(c)}else this._activatable.clearActive()})}).observe(e,{childList:!0})}list(){return this.querySelector("ui-options")||this}},Is=class extends T{boot(){this.querySelector("input")?h(this,"tabindex","-1"):h(this,"tabindex","0"),this._disableable=new V(this);let t=e=>{e.preventDefault(),e.stopImmediatePropagation()};this._disableable.onInitAndChange(e=>{e?this.addEventListener("click",t,!0):this.removeEventListener("click",t,!0)})}mount(){}};D("pillbox-trigger",Is);D("pillbox",Ds);function Ka(i){y(i,"keydown",t=>{t.key===" "&&(t.preventDefault(),t.stopImmediatePropagation(),i.click())})}function Sl(i,t,e){t.onChange(()=>{document.activeElement!==e&&document.activeElement.closest("ui-pillbox")===i&&e.focus()})}function El(i,t){i.onInitAndChange(()=>{i.noneAreSelected()?h(t,"placeholder",t.getAttribute("data-placeholder")):h(t,"placeholder","")})}function _l(i,t){y(t,"keydown",e=>{t.value==""&&e.key==="Backspace"&&i.findByValue(i.getState().at(-1))?.deselect()})}function kl(i,t,e){y(t,"click",s=>{i.getState()&&(e.focus(),s.preventDefault(),s.stopImmediatePropagation())})}var Ke=class extends T{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&&Cl(this,e,t._filterable)}},Ls=class extends T{mount(){let t=this;this._disableable=new V(t,{disableWithParent:!1}),this._disableable.onInitAndChange(r=>{r?h(t,"aria-disabled","true"):x(t,"aria-disabled")});let e=K(t,"option");h(t,"role","option"),this._filterable=new Ct(t,{mirror:this,keep:!!this.closest("ui-option-empty, ui-empty")||this.getAttribute("filter")==="manual"}),this._activatable=new et(t),this.hasAttribute("action")||(this._selectable=new H(t,{value:this._pe
125ndingValue??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()}},Ms=class extends T{mount(){this._activatable=new et(this),this._filterable=new Ct(this,{keep:!0}),this._disableable=new V(this,{disableWithParent:!1}),this._disableable.onInitAndChange(t=>{t?h(this,"aria-disabled","true"):x(this,"aria-disabled")})}},Pi=class extends T{},Ps=class extends Pi{};D("option-create",Ms);D("options",Ke);D("option",Ls);D("option-empty",Pi);D("empty",Ps);function Ts(i){return CSS.supports("selector(&)")?i:i.replace("&",":scope")}function Cl(i,t,e){let s=i.querySelector(Ts("& > ui-option-empty, & > ui-empty")),r=i.querySelector(Ts("& > ui-option-create")),a=r?.hasAttribute("min-length")?parseInt(r.getAttribute("min-length")):void 0;h(s,"data-hidden",""),r&&h(r,"data-hidden","");let n=b=>b.hasAttribute("data-hidden"),o=b=>b.textContent.toLowerCase().trim()!==t.value.toLowerCase().trim(),l=()=>Array.from(i.querySelectorAll(Ts("& > ui-option"))),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,f=()=>{if(clearTimeout(d),clearTimeout(c),t.hasAttribute("data-flux-loading")||t.hasAttribute("data-loading"))return;let b=l(),p=b.every(w=>n(w));if(r){a&&t.value.trim().length<a?h(r,"data-hidden",""):b.every(A=>o(A))?x(r,"data-hidden"):h(r,"data-hidden",""),p&&r._activatable.activate(!0);let w=()=>{x(r,"disabled")};e?w():c=setTimeout(w,150)}p&&(!r||n(r))?x(s,"data-hidden"):h(s,"data-hidden",""),s.__hideLoading?.()};if(e)e.onChange(()=>f()),r&&y(t,"input",()=>{a&&t.value.trim().length<a&&h(r,"data-hidden","")});else{let b=new MutationObserver(()=>{requestAnimationFrame(()=>f())});b.observe(i,{childList:!0}),b.observe(t,{attributes:!0,attributeFilter:["data-loading","data-flux-loading"]}),r&&y(t,"input",p=>{clearTimeout(d),clearTimeout(c);let w=l().every(A=>n(A));w&&t.value.trim()===""&&!n(r)?(u(),x(s,"data-hidden"),h(r,"data-hidden","")):t.value.trim()===""&&!n(r)&&h(r,"data-hidden",""),a&&t.value.trim().length>=a&&x(r,"data-hidden"),h(r,"disabled",""),d=setTimeout(()=>{x(r,"disabled"),w&&r._activatable.activate()},200)})}f()}var g=class i{constructor(t,e,s=1){this._date=new Date(Date.UTC(t,e-1,s))}isBetween(t,e){return!t&&!e?!0:t?e?this._date>=t._date&&this._date<=e._date:this._date>=t._date:this._date<=e._date}isSameDay(t){return t?this._date.getUTCDate()===t._date.getUTCDate()&&this._date.getUTCMonth()===t._date.getUTCMonth()&&this._date.getUTCFullYear()===t._date.getUTCFullYear():!1}isBefore(t){return t?this._date<t._date:!1}isAfter(t){return t?this._date>t._date:!1}incrementDays(t){let e=this.getCopy();return e._date.setUTCDate(e._date.getUTCDate()+t),e}addMonths(t){let e=this.getCopy();return e._date.setUTCMonth(e._date.getUTCMonth()+t),e}addDays(t){let e=this.getCopy();return e._date.setUTCDate(e._date.getUTCDate()+t),e}getYear(){return this._date.getUTCFullYear()}getMonth(){return this._date.getUTCMonth()+1}getPaddedMonth(){return String(this.getMonth()).padStart(2,"0")}getDay(){return this._date.getUTCDate()}getPaddedDay(){return String(this.getDay()).padStart(2,"0")}getDate(){return this._date}getCopy(){return new i(this.getYear(),this.getMonth(),this.getDay())}getDayOfWeek(){return this._date.getUTCDay()}getDaysInMonth(){return new i(this.getYear(),this.getMonth()+1,0).getDay()}getFirstDayOfMonth(){return new i(this.getYear(),this.getMonth(),1).getDayOfWeek()}getWeekNumber(){let t=new Date(Date.UTC(this._date.getUTCFullYear(),0,1)),e=new Date(t);e.setUTCDate(1+(11-t.getUTCDay())%7);let s=new Date(this._date);return s.setUTCDate(this._date.getUTCDate()+(11-this._date.getUTCDay())%7),Math.floor((s.getTime()-e.getTime())/(
1257*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 Xa(i,t,e,s){let r=i.querySelector('template[name="heading"]'),a=i.querySelector('template[name="weekday"]'),n=i.querySelector('template[name="week"]');r&&Dl(r,t,e),a&&Il(a,t),n&&Tl(n,t,e,s)}function Dl(i,t,e){at(i,s=>s({slots:{default:new Intl.DateTimeFormat(t.locale,{month:i.hasAttribute("display")?i.getAttribute("display"):"long",year:"numeric",timeZone:"UTC"}).format(new g(e.year,e.month).getDate())}}))}function Il(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,o=new Date(2024,0,n+7);return e(o)});at(i,r=>s.map(a=>r({slots:{default:a}})))}function Tl(i,t,e,s){let r=e.month,a=e.year,n=(new g(a,r).getFirstDayOfMonth()-t.startDay+7)%7,o=new g(a,r).getDaysInMonth(),[l,u]=new g(a,r).addMonths(-1).toParts(),d=new g(l,u).getDaysInMonth(),[c,f]=[[],[]];for(let E=0;E<n;E++){c.push(0);let m=d-n+E+1;f.push(new g(l,u,m).toIsoDateString())}for(let E=1;E<=o;E++)c.push(E),f.push(new g(a,r,E).toIsoDateString());let p=(7-(n+o)%7)%7,[w,A]=new g(a,r).addMonths(1).toParts();for(let E=1;E<=p;E++)c.push(0),f.push(new g(w,A,E).toIsoDateString());if(t.fixedWeeks){let E=Math.ceil(c.length/7),m=t.fixedWeeks,q=m-E;if(q>0)for(let S=0;S<q*7;S++)c.push(0),f.push(g.fromIsoDateString(f[f.length-1]).addDays(1).toIsoDateString());else q<0&&(c.length=m*7,f.length=m*7)}let _=E=>Array.from({length:Math.ceil(E.length/7)},(m,q)=>E.slice(q*7,(q+1)*7)),L=_(c),O=_(f);at(i,E=>L.map((m,q)=>{let S=E(),N=O[q],F=S.querySelector('template[name="number"]');if(F){let v=(4-t.startDay+7)%7,M=g.fromIsoDateString(N[v]).getWeekNumber();at(F,k=>k({slots:{default:M}}))}return at(S.querySelector('template[name="day"]'),v=>m.map((M,k)=>{if(M===0){let U=g.fromIsoDateString(N[k]).getDay();return v({slots:{default:U},attrs:{"data-date":N[k],"data-outside":""}})}let C=g.fromIsoDateString(N[k]),I=v({slots:{default:M},attrs:{"data-date":N[k]}}),P=s.subtext(C),B=s.details(C),W=s.variant(C);if([!1,null,void 0].includes(W)||(I.dataset.dateVariant=W),![!1,null,void 0].includes(P)){let R=I.querySelector('template[name="subtext"]');R&&at(R,U=>U({slots:{default:P}}))}if(![!1,null,void 0].includes(B)){let R=I.querySelector('template[name="details"]');R&&at(R,U=>U({slots:{default:B}}))}return I})),S}))}function ja(i,t,e,s,r,a){let o=((l,u)=>r.lowerBound(()=>g.today().getMonth()===l&&g.today().getYear()===u?g.today():new g(u,l)))(s.month,s.year);i.querySelectorAll("[data-date]").forEach(l=>{h(l,"role","gridcell");let u=l.querySelector("button,ui-button"),d=Ll(l);d&&(u?h(u,"aria-label",d.toFormattedString(e.locale,{day:"numeric",month:"long",year:"numeric",weekday:"long"})):h(l,"aria-label",d.toFormattedString(e.locale,{day:"numeric",month:"long",year:"numeric",weekday:"long"})),a.isValid(d)?t?(h(l,"disabled",""),h(l,"aria-disabled","true"),u&&h(u,"disabled","")):(x(l,"disabled"),x(l,"data-unavailable"),x(l,"aria-disabled"),u&&x(u,"disabled")):(h(l,"disabled",""),h(l,"aria-disabled","true"),u&&h(u,"disabled",""),a.isUnavailable(d)&&h(l,"data-unavailable","")),g.today().isSameDay(d)?h(l,"data-today",""):x(l,"data-today",""),r.attributes(l,d),d.isSameDay(o)?u&&h(u,"tabindex","0"):u&&h(u,"tabindex","-1"))})}function at(i,t){if(!i)return;let e=()=>{let r=i.nextElementSibling;for(;r&&r.hasAttribute("data-appended");){let a=r;r=r.nextElementSibling,a.remove()}};e();let s=t(({slots:r={},attrs:a={}}={})=>{let n=i.content.cloneNode(!0).firstElementChild;return Object.entries(r).forEach(([o,l])=>{(o==="default"?n.querySelectorAll("slot:not([name])"):n.querySelectorAll(`slot[name="${o}
125"]`)).forEach(d=>d.replaceWith(typeof l=="string"?document.createTextNode(l):l))}),n.querySelectorAll("slot").forEach(o=>o.remove()),Object.entries(a).forEach(([o,l])=>{n.setAttribute(o,l)}),n});return s=Array.isArray(s)?s:[s],s.reverse().forEach(r=>{h(r,"data-appended",""),i.after(r)}),{cleanup:e}}function Ll(i){return!i||!i.hasAttribute("data-date")?null:g.fromIsoDateString(i.getAttribute("data-date"))}var qt=class{static SINGLE="single";static MULTIPLE="multiple"},ht=class{static SELECTION="selection";static ACTIVATION="activation";static VIEW_CHANGE="view-change"},Oi=class i{constructor(t,e,s){this.config=e,this.observable=s,this.selection=t}select(t){let e=this.selection;this.selection=this.selection.select(t,this.config),this.selection.shouldNotify(e)?this.observable.notify(ht.SELECTION):this.observable.notify(ht.ACTIVATION)}setValue(t){let e=this.selection;this.selection=i.createSelectionFromValue(t,this.config),this.selection.shouldNotify(e)?this.observable.notify(ht.SELECTION):this.observable.notify(ht.ACTIVATION)}getValue(){return this.selection.value()}isSelectable(t){return this.selection.selectable(t,this.config)}contains(...t){return this.selection.contains(...t)}hasSelection(){return this.selection.hasSelection()}lowerBound(...t){return this.selection.lowerBound(...t)}upperBound(...t){return this.selection.upperBound(...t)}display(...t){return this.selection.display(this.config,...t)}attributes(...t){return this.selection.attributes(...t)}static createSelectionFromValue(t,e){return e.mode===qt.MULTIPLE?(t??=[],new Os(t)):t?new Ri(t):new Ni}static createFromValueStringAttribute(t,e,s){let r=i.createSelectionFromValueStringAttribute(t,e);return new i(r,e,s)}static createSelectionFromValueStringAttribute(t,e){return e.mode===qt.MULTIPLE&&(t=t?t.split(",").map(s=>s.trim()):[]),i.createSelectionFromValue(t,e)}},Xe=class{contains(){}shouldNotify(t){return!0}hasSelection(){return!1}lowerBound(t){return Fi(t)}upperBound(t){return this.lowerBound(t)}selectable(t,e){return!0}display(t){}value(){}attributes(t,e){this.contains(e)?(h(t,"data-selected",""),h(t,"aria-selected","true")):(x(t,"data-selected"),h(t,"aria-selected","false"))}},Ni=class i extends Xe{contains(){return!1}shouldNotify(t){return!(t instanceof i)}hasSelection(){return!1}lowerBound(t){return Fi(t)}select(t){return new Ri(t)}display(t){return""}value(){return null}},Ri=class i extends Xe{constructor(t){super(),this._value=t}contains(t){return this._value===t}shouldNotify(t){return!(t instanceof i&&this._value===t._value)}hasSelection(){return!0}lowerBound(){return this._value}select(t){return this._value===t?new Ni:new i(t)}display(t){return Vi(this._value,t.timeFormat,t.locale)}value(){return this._value}},Os=class i extends Xe{constructor(t){super(),this._values=t.sort((e,s)=>St(e)<St(s)?-1:1)}contains(t){return this._values.some(e=>e===t)}shouldNotify(t){return!(t instanceof i&&this._values.every(e=>t._values.includes(e))&&t._values.every(e=>this._values.includes(e)))}hasSelection(){return this._values.length>0}lowerBound(t){return this._values.sort((s,r)=>St(s)<St(r)?-1:1)[0]||Fi(t)}upperBound(t){let e=this._values.sort((s,r)=>St(s)<St(r)?-1:1);return e[e.length-1]||Fi(t)}select(t){return this._values.some(s=>s===t)?new i(this._values.filter(s=>s!==t)):new i([...this._values,t])}display(t){return this._values.sort((e,s)=>St(e)<St(s)?-1:1).map(e=>Vi(e,t.timeFormat,t.locale)).join(", ")}value(){return this._values}};function Fi(i=null){return typeof i=="function"?i():i}var qi=class extends T{boot(){this.picker=this.closest("ui-time-picker");let t=this.querySelectorAll("input");this._disableable=new V(this);let e=s=>{s.preventDefault(),s.stopImmediatePropagation()};if(this._disableable.onInitAndChange(s=>{s?this.addEventListener("click",e,!0):this.removeEventListener("click",e,!0)}),t.length!==0){if(t.length<2)throw new Error("Time picker inputs missing");this.hourInput=t[0],this.minuteInput=t[1],this.meridiemInput=t[2]||null,this.meridiemInput&&this.use24HourFormat()&&(this.meridiemInput.style.display="none",this.meridiemInput=null),this._disableable.onInitAndChange(s=>{s?(this.hourInput.setAttribute("disabled",""),this.minuteInput.setAttribute("disabled",""),this.meridiemInput?.setAttribute("disabled","")):(this.hourInput.removeAttribute("disabled"),this.minuteInput.removeAttribute("disabled"),this.meridiemInput?.removeAttribute("disabled"))}),this.clearInputs(),Ns(this.hourInput),Ns(this.minuteInput),this.meridiemInput&&Ns(this.meridiemInput),this.hourInput.addEventListener("keydown",s=>{if(s.key==="ArrowRight")return this.minuteInput.focus()}),this.minuteInput.addEventListener("keydown",s=>{if(s.key==="ArrowLeft")return this.hourInput.focus();if(s.key==="ArrowRight")return this.meridiemInput?.focus()}),this.meridiemInput?.addEventListener("keydown",s=>{if(s.key==="ArrowLeft")return this.minuteInput.focus()}),Rs(this.hourInput),Rs(this.minuteInput),this.meridiemInput&&Rs(this.meridiemInput),this.initHourInputListeners(),this.initMinuteInputListeners(),this.meridiemInput&&this.initMeridiemInputListeners(),this.meridiemInput&&this.setMeridiemWidthBasedOnLocale(),this.picker.observable.subscribe(ht.SELECTION,()=>{this.updateInputsFromSelectable(this.picker.selectable)}),this.updateInputsFromSelectable(this.picker.selectable)}}focus(){if(this.hourInput)return this.hourInput.focus();this.querySelector("button,ui-button")?.focus()}
125use24HourFormat(){return this.picker.config.timeFormat==="24-hour"?!0:this.picker.config.timeFormat==="12-hour"?!1:Ml(this.picker.config.locale)}processTime(){let t=Za(this.hourInput.value,this.minuteInput.value,this.meridiemInput?.value);t&&(this.updateSelectable(t),this.updateInputsFromSelectable(this.picker.selectable))}updateSelectable(t){this.picker.selectable.setValue(t)}updateInputsFromSelectable(t){let e=t.getValue();this.updateInputs(e)}updateInputs(t){if(!t)return this.clearInputs();x(this.picker,"data-empty");let[e,s]=t.split(":"),r=null;this.meridiemInput&&(e=parseInt(e),r=Ja(e,this.picker.config.locale),e>12?e=e-12:e===0&&(e=12),e=e.toString()),this.hourInput.value=e.padStart(2,"0"),this.minuteInput.value=s.padStart(2,"0"),this.meridiemInput&&(this.meridiemInput.value=r)}clearInputs(){this.hourInput.value="--",this.minuteInput.value="--",this.meridiemInput&&(this.meridiemInput.value="--"),h(this.picker,"data-empty","")}initHourInputListeners(){let t=!1;this.hourInput.addEventListener("keydown",e=>{if(!["ArrowUp","ArrowDown"].includes(e.key))return;e.preventDefault(),e.stopPropagation();let s=parseInt(this.hourInput.value),r=this.picker.selectable.getValue(),[a,n]=r?.split(":")||["00","00"];a=parseInt(a),e.key==="ArrowUp"?r===null||a===23?a=0:a++:e.key==="ArrowDown"&&(r===null||a===0?a=23:a--);let o=Za(a.toString(),n);this.updateSelectable(o),this.updateInputsFromSelectable(this.picker.selectable),Et(this.hourInput)}),this.hourInput.addEventListener("keydown",e=>{if(!/[0-9]/.test(e.key))return;let s=parseInt(e.key);if(this.hourInput.value===""||this.hourInput.value==="--"||!t){t=!0,this.hourInput.value=`0${s}`,s>2?this.minuteInput.focus():Et(this.hourInput);return}let r=parseInt(this.hourInput.value);if(r===2&&s>=0&&s<=3){this.hourInput.value=`${r}${s}`,this.minuteInput.focus();return}if(r===1||r===0){this.hourInput.value=`${r}${s}`,this.minuteInput.focus();return}this.hourInput.value=`0${s}`,s>2?this.minuteInput.focus():Et(this.hourInput)}),this.hourInput.addEventListener("blur",e=>{t=!1,this.processTime()})}initMinuteInputListeners(){let t=!1;this.minuteInput.addEventListener("keydown",e=>{if(!["ArrowUp","ArrowDown"].includes(e.key))return;e.preventDefault(),e.stopPropagation();let s=parseInt(this.minuteInput.value);e.key==="ArrowUp"?isNaN(s)||s===59?s=0:s=s+1:e.key==="ArrowDown"&&(isNaN(s)||s===0?s=59:s=s-1),this.minuteInput.value=s.toString().padStart(2,"0"),this.processTime(),Et(this.minuteInput)}),this.minuteInput.addEventListener("keydown",e=>{if(!/[0-9]/.test(e.key))return;let s=parseInt(e.key);if(this.minuteInput.value===""||this.minuteInput.value==="--"||!t){t=!0,this.minuteInput.value=`0${s}`,this.processTime(),s>5?this.meridiemInput?.focus():Et(this.minuteInput);return}let r=parseInt(this.minuteInput.value);if(r<=5){this.minuteInput.value=`${r}${s}`,this.processTime(),this.meridiemInput?.focus();return}this.minuteInput.value=`0${s}`,this.processTime(),s>5?this.meridiemInput?.focus():Et(this.minuteInput)}),this.minuteInput.addEventListener("blur",e=>{t=!1,this.processTime()})}initMeridiemInputListeners(){this.meridiemInput?.addEventListener("keydown",t=>{if(!["ArrowUp","ArrowDown"].includes(t.key))return;t.preventDefault(),t.stopPropagation();let e=this.meridiemInput.value;t.key==="ArrowUp"?e===""||e==="AM"?e="PM":e="AM":t.key==="ArrowDown"&&(e===""||e==="PM"?e="AM":e="PM"),this.meridiemInput.value=e,this.processTime(),Et(this.meridiemInput)}),this.meridiemInput?.addEventListener("keydown",t=>{["a","p","A","P"].includes(t.key)&&(t.key==="a"||t.key==="A"?this.meridiemInput.value="AM":(t.key==="p"||t.key==="P")&&(this.meridiemInput.value="PM"),this.processTime(),Et(this.meridiemInput))})}setMeridiemWidthBasedOnLocale(){let t=Ja(12,this.picker.config.locale);t&&(this.meridiemInput.style.width=`calc(${t.length}ch + 2px)`)}};function Ns(i){i.addEventListener("focus",t=>{Et(i)}),i.addEventListener("mousedown",t=>{Et(i)}),i.addEventListener("mouseup",t=>{t.preventDefault(),Et(i)})}function Rs(i){i.addEventListener("keydown",t=>{t.ctrlKey||t.metaKey||t.altKey||["Tab"].includes(t.key)||t.preventDefault()})}function Et(i){i.setSelectionRange(0,i.value.length)}function Ja(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 Za(i,t,e=null){if(i==="--"&&t==="--"&&(e===null||e==="--"))return null;e==="PM"&&i==="--"&&(i="12"),i==="--"&&(i="00"),t==="--"&&(t="00"),e==="--"&&(e=null),i=i.padStart(2,"0"),t=t.padStart(2,"0");let s=e?i+":"+t+" "+e:i+":"+t;return Pl(s)}function Ml(i){return new Intl.DateTimeFormat(i,{hour:"numeric"}).format(new Date(2024,0,1,0,0)).startsWith("00")}function Pl(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 Fs=class extends X{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")?qt.MULTIPLE:qt.SINGLE,dropdown:!(this.hasAttribute("dropdown")&&this.getAttribute("dropdown")==="false")},this.observable=new Ht,this._controllable=new Y(this,{bubbles:!0}),this._submittable=new Q(this,{name:this.getAttribute("name"),value:this.getAttribute("value"),includeWhenEmpty:!1}),this.selectable=Oi.createFromValueStringAttribute(this.getAttribute("value"),this.config,this.observable),this._controllable.getter(()=>this.selectable.getValue());let t=G();if(this._controllable.setter(t(o=>{this.selectable.setValue(o)})),this.observable.subscribe(ht.SELECTION,t(()=>{this._controllable.dispatch(),this.dispatchEvent(new CustomEvent("input",{bubbles:!1}))})),this.observable.subscribe(ht.SELECTION,()=>{this._submittable.update(this.selectable.getValue())}),this._disableable=new V(this),!this.config.dropdown)return;let e=this.querySelector("[popover]");if(!e)return;let s=this.trigger(),r=this.querySelector("ui-time-picker-options"),a=Ol(r,this.config.mode===qt.MULTIPLE);this._popoverable=new rt(e,{triggers:[s]}),this._anchorable=new it(e,{reference:s,position:this.hasAttribute("position")?this.getAttribute("position"):void 0,gap:this.hasAttribute("gap")?this.getAttribute("gap"):void 0,offset:this.hasAttribute("offset")?this.getAttribute("offset"):void 0,matchWidth:!0}),this._activatable=new Pt(r,{filter:"data-hidden"}),this._disableable.onInitAndChange(o=>{o?(h(s,"disabled",""),s.querySelectorAll("button,ui-button").forEach(l=>h(l,"disabled",""))):(x(s,"disabled"),s.querySelectorAll("button,ui-button").forEach(l=>x(l,"disabled")))}),s.addEventListener("click",o=>{this._popoverable.toggle(),s.focus()}),s.querySelectorAll("button,ui-button").forEach(o=>{Nl(o,this._popoverable,a),ql(o,this._activatable,this.observable)}),Rl(this,e,this._popoverable,this._anchorable),Fl(this,this._popoverable),Vt(s,this._popoverable),Ft(this,this._popoverable),xt(s,this._activatable),Xt(s,this._activatable,this._popoverable),At(this,s,this._activatable),Ul(this._popoverable,this._activatable,this.selectable,this.config.openTo),$l(this,this.config.mode,this.observable,this.selectable,this._popoverable),new MutationObserver(o=>{o.forEach(l=>{["interval","unavailable","max","min","open-to"].includes(l.attributeName)&&(this.config.interval=this.interval(),this.config.unavailable=this.unavailable(),this.config.min=this.min(),this.config.max=this.max(),this.config.openTo=this.openTo(),this.observable.notify(ht.VIEW_CHANGE))})}).observe(this,{attributes:!0})}trigger(){return this.querySelector("ui-time-picker-trigger")}list(){return this.querySelector("ui-options")||this}clear(){this.selectable.setValue(null),this.dispatchEvent(new CustomEvent("clear",{bubbles:!1}))}interval(){return this.hasAttribute("interval")?parseInt(this.getAttribute("interval")):30}min(){if(this.hasAttribute("min")){let t=this.getAttribute("min");return t==="now"?new Date().toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!1}):je(t)?t:console.warn(`Invalid min attribute: ${t}`)}}max(){if(this.hasAttribute("max")){let t=this.getAttribute("max");return t==="now"?new Date().toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!1}):je(t)?t:console.warn(`Invalid max attribute: ${t}`)}}unavailable(){if(this.hasAttribute("unavailable")){let t=this.getAttribute("unavailable").split(",").map(e=>e.trim());return t.every(e=>e.includes("-")?Wl(e):je(e))?t:console.warn(`Invalid unavailable attribute: ${t}`)}return[]}openTo(){if(this.hasAttribute("open-to")){let t=this.getAttribute("open-to");return t==="now"?new Date().toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!1}):je(t)?t:console.warn(`Invalid open-to attribute: ${t}`)}}},Vs=class extends T{boot(){if(this.picker=this.closest("ui-time-picker"),!this.querySelector('template[name="time"]')){let t=document.createElement("template");t.setAttribute("name","time"),t.innerHTML="<div><slot></slot></div>"}this.templates={placeholder:this.querySelector('template[name="placeholder"]'),time:this.querySelector('template[name="time"]')},this.picker.observable.subscribe(ht.SELECTION,()=>{this.render(this.picker)}),this.render(this.picker)}mount(){this.render(this.picker)}render(t){if(this.templates.placeholder?.clearPlaceholder?.(),this.templates.time?.clearTime?.(),t.selectable.hasSelection()){let{cleanup:e}=at(this.templates.time,s=>s({slots:{default:t.selectable.display(t.config.locale)}}));this.templates.time.clearTime=e}else{if(!this.templates.placeholder)return;let{cleanup:e}=at(this.templates.placeholder,s=>s({slots:{}}));this.templates.placeholder.clearPlaceholder=e}}},qs=class extends T{boot(){this.picker=this.closest("ui-time-picker"),this.render(),this.picker.observable.subscribe(ht.SELECTION,()=>{this.render()}),this.picker.observable.subscribe(ht.VIEW_CHANGE,()=>{this.render()});let{enable:t,disable:e}=Bl(this,this.picker.selectable);this.picker._disableable.onInitAndChange(s=>{s?e():t()})}render(){let t=this.querySelector('template[name="option"]');t&&at(t,e=>zl(this.picker.config).map(({value:r,label:a})=>{let n=this.picker.config.unavailable.some(u=>Hl(r,u)),o={"data-time":r,role:"option"};n&&(o.disabled="");let l=e({attrs:o,slots:{default:a}});return this.picker.selectable.attributes(l,r),l._activatable=new et(l),K(l,"option"),l}))}};D("time-picker",Fs);D("time-picker-trigger",qi);D("selected-time",Vs);D("time-picker-options",qs);function Ol(i,t){let e=K(i,"options");return h(i,"role","listbox"),h(i,"aria-multiselectable",t?"true":"false"),e}function Nl(i,t,e){h(i,"role","combobox"),h(i,"aria-controls",e),h(i,"aria-haspopup","listbox"),Vl(i,t),y(i,"click",s=>{s.stopPropagation(),t.setState(!t.getState()),i.focus()})}function Rl(i,t,e,s){let r=()=>
125{Array.from([i,t]).forEach(a=>{e.getState()?h(a,"data-open",""):x(a,"data-open","")}),e.getState()?s.reposition():s.cleanup()};e.onChange(()=>r()),r(),e.onChange(()=>{e.getState()?i.dispatchEvent(new Event("open",{bubbles:!1,cancelable:!1})):i.dispatchEvent(new Event("close",{bubbles:!1,cancelable:!1}))})}function Fl(i,t){let{lock:e,unlock:s}=lt(t.el);t.onChange(()=>{t.getState()?e():s()})}function Vl(i,t){h(i,"aria-haspopup","listbox");let e=()=>{h(i,"aria-expanded",t.getState()?"true":"false"),t.getState()?h(i,"data-open",""):x(i,"data-open","")};t.onChange(()=>{e()}),e()}function ql(i,t){t.onChange(()=>{let e=t.getActive();e?h(i,"aria-activedescendant",e.id):x(i,"aria-activedescendant")})}function $l(i,t,e,s,r){t!==qt.MULTIPLE&&e.subscribe(ht.SELECTION,()=>{s.hasSelection()&&r.setState(!1)})}function Bl(i,t){let e=!1,s=i.hasAttribute("readonly");return y(i,"click",r=>{if(e||s)return;let a=r.target.closest("[data-time]");if(!a)return;let n=a.getAttribute("data-time");setTimeout(()=>{je(n)&&t.select(n)})}),{enable:()=>{},disable:()=>{}}}function je(i){return new RegExp(`^${$s()}$`).test(i)}function Wl(i){return new RegExp(`^${$s()}-${$s()}$`).test(i)}function $s(){return"([01]?[0-9]|2[0-3]):[0-5][0-9]"}function Hl(i,t){let[e,s]=i.split("-").map(n=>{let[o,l]=n.split(":").map(Number);return o*60+l}),[r,a]=t.split("-").map(n=>{let[o,l]=n.split(":").map(Number);return o*60+l});return isNaN(s)&&(s=e),isNaN(a)&&(a=r),!(s<r||e>a)}function Vi(i,t,e){let[s,r]=i.split(":").map(Number),a={"12-hour":!0,"24-hour":!1,auto:void 0};return new Intl.DateTimeFormat(e,{hour:"numeric",minute:"numeric",hour12:a[t]}).format(new Date(2024,0,1,s,r))}function St(i){if(!i)return null;let[t,e]=i.split(":");return isNaN(t)||isNaN(e)?null:parseInt(t)*60+parseInt(e)}function Ul(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(l=>r.includes(l.getAttribute("data-time"))),o=null;!n&&s&&(o=Yl(t,s)),setTimeout(()=>{let l=n||o;t.activateSelectedOrFirst(l),l?.scrollIntoView({block:"nearest"})})}else t.clearActive()})}function Yl(i,t){let e=St(t),s=null,r=null;return i.filterAwareWalker().walk((a,n)=>{let o=a.getAttribute("data-time"),l=St(o);l>e||Math.abs(l-e)<Math.abs(r-e)&&(s=a,r=l)}),s}function zl({interval:i=30,timeFormat:t="auto",locale:e=navigator.language,min:s,max:r}={}){let a=[],n=0,o=24*60-1;if(s){let l=new Date(2024,0,1),[u,d]=s.split(":");l.setHours(u,d),n=l.getHours()*60+l.getMinutes()}if(r){let l=new Date(2024,0,1,23,59,59),[u,d]=r.split(":");l.setHours(u,d),o=l.getHours()*60+l.getMinutes()}for(let l=n;l<=o;l+=i){let u=Math.floor(l/60),d=l%60,c=`${String(u).padStart(2,"0")}:${String(d).padStart(2,"0")}`,f=Vi(c,t,e);a.push({value:c,label:f})}return a}var $i=class extends j{boot({options:t}){this.onChanges=[],this.state=!1}onChange(t){this.onChanges.push(t)}getState(){return this.state}setState(t){let e=this.state;
125this.state=!!t,this.state!==e&&this.onChanges.forEach(s=>s())}};var Bs=class extends T{boot(){let t=this.button(),e=this.details();if(t){if(!e)return console.warn("ui-disclosure: no panel element found",this)}else return console.warn("ui-disclosure: no trigger element found",this);this._disableable=new V(this),this._disableable.onInitAndChange(a=>{a?t.hasAttribute("disabled")||h(t,"disabled",""):t.hasAttribute("disabled")&&x(t,"disabled")}),this._controllable=new Y(this,{disabled:this.disabled}),e._disclosable=new $i(e),this._controllable.initial(a=>a&&e._disclosable.setState(!0)),this._controllable.getter(()=>e._disclosable.getState()),this._controllable.setter(a=>e._disclosable.setState(a)),e._disclosable.onChange(()=>{this.dispatchEvent(new CustomEvent("lofi-disclosable-change",{bubbles:!0})),this._controllable.dispatch()});let s=()=>{e._disclosable.getState()?(h(this,"data-open",""),h(t,"data-open",""),h(e,"data-open","")):(x(this,"data-open"),x(t,"data-open"),x(e,"data-open"))};e._disclosable.onChange(()=>s()),s(),y(t,"click",a=>{this.disabled||e._disclosable.setState(!e._disclosable.getState())});let r=K(e,"disclosure");h(t,"aria-controls",r),h(t,"aria-expanded","false"),e._disclosable.onChange(()=>{e._disclosable.getState()?h(t,"aria-expanded","true"):h(t,"aria-expanded","false")}),this.hasAttribute("open")&&e._disclosable.setState(!0)}button(){return this.querySelector("button,ui-button")}details(){return this.lastElementChild}},Ws=class i extends T{boot(){this.exclusive=this.hasAttribute("exclusive"),this.exclusive&&y(this,"lofi-disclosable-change",t=>{t.stopPropagation(),t.target.localName==="ui-disclosure"&&t.target.value&&this.disclosureWalker().each(e=>{e!==t.target&&(e.value=!1)})})}disclosureWalker(){return tt(this,(t,{skip:e,reject:s})=>{if(t instanceof i&&t!==this||t.localName!=="ui-disclosure")return s()})}};D("disclosure",Bs);D("disclosure-group",Ws);var Hs=class extends T{boot(){}},Us=class extends T{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",o=>{n||(r=s.offsetWidth,a=s.offsetHeight,n=!0);let l=o.clientX,u=o.clientY,d=parseInt(getComputedStyle(s).width,10),c=parseInt(getComputedStyle(s).height,10),f=b=>{let p=d+(b.clientX-l),w=c+(b.clientY-u);(t==="width"||t==="both")&&(e?s.style.width=`${Math.min(p,r)}px`:s.style.width=`${p}px`),(t==="height"||t==="both")&&(e?s.style.height=`${Math.min(w,a)}px`:s.style.height=`${w}px`)};document.addEventListener("pointermove",f),document.addEventListener("pointerup",()=>{this.releasePointerCapture(o.pointerId),document.removeEventListener("pointermove",f)},{once:!0}),this.setPointerCapture(o.pointerId)})}};D("resizable",Hs);D("grip",Us);var Ys=class i extends X{boot(){this._disableable=new V(this);let t=[];this._disableable.onInitAndChange(e=>{e?this.walker().each(s=>{s.hasAttribute("disabled")||(s.setAttribute("disabled",""),t.push(()=>s.removeAttribute("disabled")))}):(t.forEach(s=>s()),t=[])}),this._selectable=new ut(this,{multiple:!0}),this._controllable=new Y(this,{disabled:this._disabled,bubbles:!0}),this.walker().each(e=>{e.addEventListener("input",s=>s.stopPropagation()),e.addEventListener("change",s=>s.stopPropagation())}),this._submittable=new Q(this,{name:this.getAttribute("name"),value:this.getAttribute("value"),includeWhenEmpty:!1}),this._controllable.initial(e=>e&&this._selectable.setState(e)),this._controllable.getter(()=>this._selectable.getState()),this._detangled=G(),this._controllable.setter(this._detangled(e=>{this._selectable.setState(e)})),this._selectable.onChange(this._detangled(()=>{this._controllable.dispatch()})),this._selectable.onInitAndChange(()=>{this._submittable.update(this._selectable.getState())}),h(this,"role","group"),queueMicrotask(()=>{this._submittable.update(this._selectable.getState())})}initCheckAll(t){let e=G();t._selectable.onChange(e(()=>{t.indeterminate?(this.selectAll(),t.checked=!0,t.indeterminate=!1):t.checked?(this.selectAll(),t.checked=!0,t.indeterminate=!1):(this.deselectAll(),t.checked=!1,t.indeterminate=!1)}));let s=()=>{this.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(H).isSelected()).map(t=>t.use(H).select())}deselectAll(){this.walker({checkable:!0}).filter(t=>t.use(H).isSelected()).map(t=>t.use(H).deselect())}allAreSelected(){let t=this.walker({checkable:!0}).filter(e=>!0);return t.length>0&&this.walker({checkable:!0}).filter(e=>e.use(H).isSelected()).length===t.length}noneAreSelected(){return this.walker({checkable:!0}).filter(t=>t.use(H).isSelected()).length===0}walker({checkable:t}={}){return tt(this,(e,{skip:s,reject:r})=>{if(e instanceof i)return r();if(e.localName!=="ui-checkbox"||t&&(e.disabled||e.use(H).ungrouped))return s()})}},zs=class extends X{boot(){let t=this;this.isIndeterminate=!1,this._disableable=new V(this),this.hasAttribute("all")?(this._selectable=new H(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 H(t,{toggleable:!0,dataAttr:"data-checked",ariaAttr:"aria-checked",value:this.hasAttribute("value")?this.getAttribute("value"):Math.random().toString(36).substring(2,10),label:this.hasAttribute("label")?this.getAttribute("label"):null,selectedInitially:this.hasAttribute("checked")}),this._submittable=new Q(this,{name:this.getAttribute("name"),value:this.getAttribute("value")??"on",includeWhenEmpty:!1,shouldUpdateValue:!1}),this._selectable.onChange(()=>{this.indeterminate&&(this.indeterminate=!1)}),this._selectable.onInitAndChange(()=>{this._submittable.update(this._selectable.isSelected())}),queueMicrotask(()=>{this._submittable.update(this._selectable.isSelected())})),this._detangled=G(),this._selectable.onChange(this._detangled(()=>{this.dispatchEvent(new Event("input",{bubbles:!0,cancelable:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,cancelable:!0}))})),h(t,"role","checkbox"),this._disableable.onInitAndChange(e=>{e?x(t,"tabindex","0"):h(t,"tabindex","0")}),y(t,"click",this._disableable.disabled(e=>{e.preventDefault(),e.stopPropagation()}),{capture:!0}),y(t,"click",this._disableable.enabled(e=>{this._selectable.press()})),y(t,"keydown",this._disableable.enabled(e=>{e.key==="Enter"&&this.closest("form")?.requestSubmit()})),y(t,"keydown",this._disableable.enabled(e=>{e.key===" "&&(e.preventDefault(),e.stopPropagation())})),y(t,"keyup",this._disableable.enabled(e=>{e.key===" "&&(this._selectable.press(),e.preventDefault(),e.stopPropagation())})),Gl(t)}get value(){return this._selectable?.getValue()}set value(t){this._selectable&&(this._selectable.value=t+"",this._submittable&&(this._submittable.value=t+""))}get checked(){return this._selectable.isSelected()}set checked(t){let e=this.closest("ui-checkbox-group")?._detangled||(s=>s);this._detangled(e(()=>{t?this._selectable.select():this._selectable.deselect()}
125))()}get indeterminate(){return this.isIndeterminate}set indeterminate(t){this.isIndeterminate=!!t,this.isIndeterminate?h(this,"data-indeterminate",""):x(this,"data-indeterminate")}};D("checkbox-group",Ys);D("checkbox",zs);function Gl(i){i.closest("label")?.addEventListener("click",t=>{i.contains(t.target)||i._selectable.press()})}var Gs=class extends T{boot(){let t=this.trigger(),e=this.overlay();if(t){if(!e)return console.warn("ui-dropdown: no [popover] overlay found",this)}else return console.warn("ui-dropdown: no trigger element found",this);if(this._disabled=this.hasAttribute("disabled"),this._controllable=new Y(this),e._popoverable=new rt(e),e._anchorable=new it(e,{reference:t,position:this.hasAttribute("position")?this.getAttribute("position"):void 0,gap:this.hasAttribute("gap")?this.getAttribute("gap"):void 0,offset:this.hasAttribute("offset")?this.getAttribute("offset"):void 0}),e._popoverable.onChange(()=>{e._popoverable.getState()?e._anchorable.reposition():e._anchorable.cleanup()}),!this.hasAttribute("hover")){let{lock:a,unlock:n}=lt(e._popoverable.el);e._popoverable.onChange(()=>{e._popoverable.getState()?a():n()})}this._controllable.initial(a=>e._popoverable.setState(a)),this._controllable.getter(()=>e._popoverable.getState());let s=G();if(this._controllable.setter(a=>e._popoverable.setState(a)),e._popoverable.onChange(s(()=>this._controllable.dispatch())),this.hasAttribute("hover")){let a=()=>{};we(t,e,{gain(){e._popoverable.setState(!0),a=y(document,"scroll",()=>{e._popoverable.getState()&&(e._popoverable.setState(!1),a())}).off},lose(){e._popoverable.setState(!1),a()},focusable:!1})}y(t,"click",()=>e._popoverable.toggle()),e._popoverable.getState()?(h(this,"data-open",""),h(t,"data-open",""),h(e,"data-open","")):(x(this,"data-open"),x(t,"data-open"),x(e,"data-open")),e._popoverable.onChange(()=>{e._popoverable.getState()?(h(this,"data-open",""),h(t,"data-open",""),h(e,"data-open","")):(x(this,"data-open"),x(t,"data-open"),x(e,"data-open"))});let r=K(e,"dropdown");h(t,"aria-haspopup","true"),h(t,"aria-controls",r),h(t,"aria-expanded",e._popoverable.getState()?"true":"false"),e._popoverable.onChange(()=>{h(t,"aria-expanded",e._popoverable.getState()?"true":"false")}),e._popoverable.onChange(()=>{setTimeout(()=>e._popoverable.getState()?e.onPopoverShow?.():e.onPopoverHide?.())})}unmount(){if(this.overlay()?._popoverable?.getState()&&!this.hasAttribute("hover")){let{unlock:t}=lt();t()}}trigger(){return this.querySelector("button,ui-button,a")}overlay(){return this.lastElementChild?.matches("[popover]")&&this.lastElementChild}};D("dropdown",Gs);var Ks=class extends T{boot(){this.type="file"}mount(){this._disableable=new V(this),this._files=[],this.inputEl=this.querySelector('input[data-slot="receiver"]'),this.inputEl&&(this.forwardAcceptAttribute(),this.configureSRInput()),this.triggerEl=this.findTriggerElement(),this.rootEl=this.closest("ui-file-upload");let t=this.hasAttribute("multiple")||this.rootEl&&this.rootEl.hasAttribute("multiple");t&&h(this.inputEl,"multiple",""),Object.defineProperty(this,"multiple",{get(){return t}}),Object.defineProperty(this,"files",{get(){return this._files},set(e){e===null||e===""?this._files=[]:Array.isArray(e)?this._files=e:e instanceof FileList?this._files=Array.from(e):this._files=[e],this.dispatchEvent(new Event("change",{bubbles:!0}))}}),this.observer=new MutationObserver(()=>{this.ensureInputsExist()}),this.observer.observe(this,{childList:!0}),this.style.setProperty("--flux-file-upload-progress","0%"),this.style.setProperty("--flux-file-upload-progress-as-string","'0%'"),y(this,"livewire-upload-start",()=>{h(this,"data-loading",""),this.disabled=!0,this.style.setProperty("--flux-file-upload-progress","0"),this.style.setProperty("--flux-file-upload-progress-as-string","'0%'")}),y(this,"livewire-upload-finish",()=>{x(this,"data-loading"),this.disabled=!1,this.style.setProperty("--flux-file-upload-progress","100%"),this.style.setProperty("--flux-file-upload-progress-as-string","'100%'")}),y(this,"livewire-upload-cancel",()=>{x(this,"data-loading"),this.disabled=!1,this.style.setProperty("--flux-file-upload-progress","0%"),this.style.setProperty("--flux-file-upload-progress-as-string","'0%'")}),y(this,"livewire-upload-error",()=>{x(this,"data-loading"),this.disabled=!1,this.style.setProperty("--flux-file-upload-progress","0%"),this.style.setProperty("--flux-file-upload-progress-as-string","'0%'")}),y(this,"livewire-upload-progress",e=>{let s=e.detail.progress;this.style.setProperty("--flux-file-upload-progress",`${s}%`),this.style.setProperty("--flux-file-upload-progress-as-string",`'${s}%'`)}),this._disableable.onInitAndChange(e=>{this.inputEl.disabled=e,this.triggerEl&&(e?x(this.triggerEl,"tabindex"):h(this.triggerEl,"tabindex","0"))}),y(this.inputEl,"click",e=>{e.stopPropagation(),this.clear()}),this.initDragListeners(),this.initClickListeners()}addFiles(t){let e=Array.from(t);this.multiple?this._files=[...this._files,...e]:this._files=e.slice(0,1),this.dispatchEvent(new Event("change",{bubbles:!0}))}removeFile(t){this._files=this._files.filter((e,s)=>s!==t),this.dispatchEvent(new Event("change",{bubbles:!0}))}clear(){this.inputEl.value=null,this._files=[]}forwardAcceptAttribute(){this.hasAttribute("accept")&&this.inputEl.setAttribute("accept",this.getAttribute("accept"))}configureSRInput(){this.inputEl.tabIndex=-1,Object.assign(this.inputEl.style,{position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:"0"})}findTriggerElement(){return Array.from(this.children).find(e=>!e.hasAttribute("data-slot"))}ensureInputsExist(){(!this.inputEl||!this.querySelector('input[data-slot="receiver"]'))&&(this.inputEl=this.querySelector('input[data-slot="receiver"]'),this.inputEl&&(this.configureSRInput(),(this.hasAttribute("multiple")||this.rootEl&&this.rootEl.hasAttribute("multiple"))&&h(this.inputEl,"multiple",""),this.inputEl.disabled=this.disabled)),(!this.triggerEl||!this.contains(this.triggerEl))&&(this.triggerEl=this.findTriggerElement(),this.triggerEl&&!this.disabled?h(this.triggerEl,"tabindex","0"):this.triggerEl&&this.disabled&&x(this.triggerEl,"tabindex"))}initDragListeners(){this.triggerEl&&(y(this.triggerEl,"dragenter",this._disableable.enabled(t=>{t.preventDefault(),h(this,"data-dragging",""),this.clear()}
125)),y(this.triggerEl,"dragover",this._disableable.enabled(t=>{t.preventDefault(),h(this,"data-dragging","")})),y(this.triggerEl,"drop",this._disableable.enabled(t=>{t.preventDefault(),x(this,"data-dragging"),t.dataTransfer.files&&t.dataTransfer.files.length>0&&this.addFiles(t.dataTransfer.files)})),y(this.triggerEl,"dragleave",t=>{x(this,"data-dragging")}))}initClickListeners(){this.triggerEl&&(y(this.triggerEl,"click",this._disableable.disabled(t=>{t.preventDefault(),t.stopPropagation()}),{capture:!0}),y(this.triggerEl,"click",this._disableable.enabled(t=>{t.preventDefault(),this.inputEl.click()})),y(this.inputEl,"change",t=>{t.stopPropagation(),this.inputEl.files&&this.inputEl.files.length>0&&!this.disabled&&this.addFiles(this.inputEl.files)}),y(this.triggerEl,"keydown",this._disableable.enabled(t=>{["Enter"," "].includes(t.key)&&t.preventDefault(),["Enter"].includes(t.key)&&this.inputEl.click()})),y(this.triggerEl,"keyup",this._disableable.enabled(t=>{t.key===" "&&(t.preventDefault(),this.inputEl.click())})),y(this.triggerEl,"focus",this._disableable.enabled(()=>{h(this,"data-focus","")})),y(this.triggerEl,"blur",()=>{x(this,"data-focus")}))}};D("file-upload",Ks);var $=class{static SELECTION=1;static ACTIVATION=2;static VIEW_CHANGE=3},Me=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 ot=class{static SINGLE="single";static MULTIPLE="multiple";static RANGE="range"},Bi=class i{constructor(t,e,s){this.config=e,this.observable=s,this.selection=t,this.active=null,this.displayResolver=r=>r}setDisplayResolver(t){this.displayResolver=t}select(t){let e=this.selection;this.selection=this.selection.select(t,this.config),this.selection.shouldNotify(e)?this.observable.notify($.SELECTION):this.observable.notify($.ACTIVATION)}activate(t){let e=this.active;t?this.active=t:this.active=null,this.selection.activate(t),e!==this.active&&this.observable.notify($.ACTIVATION)}setValue(t){let e=this.selection;this.selection=this.createSelectionFromValue(t,this.config),this.selection.shouldNotify(e)?this.observable.notify($.SELECTION):this.observable.notify($.ACTIVATION)}getValue(){return this.selection.value()}isSelectable(t){return this.selection.selectable(t,this.config)}contains(...t){return this.selection.contains(...t)}hasSelection(){return this.selection.hasSelection()}lowerBound(...t){return this.selection.lowerBound(...t)}upperBound(...t){return this.selection.upperBound(...t)}display(...t){return this.displayResolver(this.selection.display(...t))}attributes(...t){return this.selection.attributes(...t)}createSelectionFromValue(t,e){if(e.mode===ot.MULTIPLE){let s=t?t.map(r=>g.fromIsoDateString(r)):[];return new Hi(s)}else if(e.mode===ot.RANGE){let{start:s,end:r,preset:a}=t||{};return a&&Yi[a]&&a!=="custom"?new Ui(a,e):!s&&!r?new Qe:r?new ti(g.fromIsoDateString(s),g.fromIsoDateString(r)):new jt(g.fromIsoDateString(s))}else return t?new Ze(g.fromIsoDateString(t)):new Je}static createFromValueStringAttribute(t,e,s){let r=i.createSelectionFromValueStringAttribute(t,e);return new i(r,e,s)}static createSelectionFromValueStringAttribute(t,e){if(e.mode===ot.MULTIPLE){let s=t?t.split(",").map(r=>r.trim()).map(r=>g.fromIsoDateString(r)):[];return new Hi(s)}else if(e.mode===ot.RANGE){if(!t)return new Qe;let[s,r]=t.split("/").map(a=>a.trim());return!r&&s&&Yi[s]&&s!=="custom"?new Ui(s,e):(s=g.fromIsoDateString(s),r?(r=g.fromIsoDateString(r),new ti(s,r)):new jt(s))}else return t?new Ze(g.fromIsoDateString(t)):new Je}},Wi=class{constructor(t,e){this.selectable=t,this.observable=e,this._selection=this.selectable.selection,this.selectable.observable.subscribe($.SELECTION,()=>{this._blockSync()||this.sync()}),this._blockSync=()=>{}}blockSyncIf(t){this._blockSync=t}sync(){this._selection=this.selectable.selection,this.observable.notify($.SELECTION)}setValue(t){return this.selectable.setValue(t)}getValue(){return this._selection.value()}isSelectable(t){return this._selection.selectable(t,this.config)}hasSelection(){return this._selection.hasSelection()}
125display(...t){return this.selectable.displayResolver(this._selection.display(...t))}},$t=class{contains(){}shouldNotify(t){return!0}hasSelection(){return!1}lowerBound(t){return ei(t)}upperBound(t){return this.lowerBound(t)}selectable(t,e){return!0}display(){}value(){}activate(){}attributes(t,e){this.contains(e)?(h(t,"data-selected",""),h(t,"aria-selected","true")):(x(t,"data-selected"),h(t,"aria-selected","false"))}},Je=class i extends $t{shouldNotify(t){return!(t instanceof i)}hasSelection(){return!1}contains(){return!1}select(t){return new Ze(t)}lowerBound(t){return ei(t)}display(t){return""}value(){return null}},Ze=class i extends $t{constructor(t){super(),this._date=t}hasSelection(){return!0}shouldNotify(t){return!(t instanceof i&&this._date.isSameDay(t._date))}select(t){return this._date.isSameDay(t)?new Je:new i(t)}contains(t){return this._date.isSameDay(t)}lowerBound(){return this._date}display(t){return this._date.toFormattedString(t,{day:"numeric",month:"short",year:"numeric"})}value(){return this._date.toIsoDateString()}},Hi=class i extends $t{constructor(t){super(),this._dates=t}hasSelection(){return this._dates.length>0}shouldNotify(t){return!(t instanceof i&&this._dates.every(e=>t._dates.includes(e))&&t._dates.every(e=>this._dates.includes(e)))}select(t){return this._dates.some(s=>s.isSameDay(t))?new i(this._dates.filter(s=>!s.isSameDay(t))):new i([...this._dates,t])}contains(t){return this._dates.some(e=>e.isSameDay(t))}lowerBound(t){return this._dates.sort((s,r)=>s.isBefore(r)?-1:1)[0]||ei(t)}upperBound(t){let e=this._dates.sort((s,r)=>s.isBefore(r)?-1:1);return e[e.length-1]||ei(t)}display(t){return this._dates.map(e=>e.toFormattedString(t,{day:"numeric",month:"short",year:"numeric"})).join(", ")}value(){return this._dates.map(t=>t.toIsoDateString())}},Qe=class i extends $t{constructor(){super()}hasSelection(){return!1}shouldNotify(t){return!(t instanceof i||t instanceof jt)}select(t){return new jt(t)}contains(){return!1}lowerBound(t){return ei(t)}display(t){return""}value(){return null}},jt=class i extends $t{constructor(t){super(),this._start=t,this._endPreview=null}hasSelection(){return!1}shouldNotify(t){return!1}select(t,e){return t.isBefore(this._start)?new i(t):t.isSameDay(this._start)&&e.minRange>1?new Qe:new ti(this._start,t)}activate(t){this._endPreview=t}selectable(t,e){if(e.maxRange&&(t.isBefore(this._start)||this._start.addDays(e.maxRange-1).isBefore(t)))return!1;if(e.minRange){if(this._start.isSameDay(t))return!0;if(t.isBefore(this._start)||this._start.addDays(e.minRange-1).isAfter(t))return!1}let s=e.unavailable.filter(a=>a.isAfter(this._start)).sort((a,n)=>a.toDate()-n.toDate())[0],r=e.unavailable.filter(a=>a.isBefore(this._start)).sort((a,n)=>n.toDate()-a.toDate())[0];return t.isAfter(this._start)?!s||t.isBefore(s):t.isBefore(this._start)?!r||t.isAfter(r):!0}contains(t){return t.isSameDay(this._start)}lowerBound(){return this._start}display(t){return new Intl.DateTimeFormat(t,{day:"numeric",month:"short",year:"numeric",timeZone:"UTC"}).format(this._start.getDate())+" -"}value(){return null}attributes(t,e){this._endPreview&&e.isBetween(this._start,this._endPreview)?(h(t,"data-in-range",""),h(t,"aria-selected","true")):(x(t,"data-in-range"),x(t,"aria-selected")),e.isSameDay(this._start)?h(t,"data-selected",""):x(t,"data-selected"),e.isSameDay(this._start)?h(t,"aria-selected","true"):x(t,"aria-selected"),e.isSameDay(this._start)?h(t,"data-start",""):x(t,"data-start"),e.isSameDay(this._endPreview)?h(t,"data-end-preview",""):x(t,"data-end-preview")}},ti=class i extends $t{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 jt(t)}contains(t){return t.isBetween(this._start,this._end)}lowerBound(){return this._start}upperBound(){return this._end}display(t){return new Intl.DateTimeFormat(t,{day:"numeric",month:"short",year:"numeric",timeZone:"UTC"}).formatRange(this._start.getDate(),this._end.getDate()).replaceAll("\u2009"," ")}value(){return{start:this._start.toIsoDateString(),end:this._end.toIsoDateString()}}attributes(t,e){e.isSameDay(this._start)||e.isSameDay(this._end)?h(t,"data-selected",""):x(t,"data-selected"),e.isSameDay(this._start)?h(t,"data-start",""):x(t,"data-start"),e.isSameDay(this._end)?h(t,"data-end",""):x(t,"data-end"),this.contains(e)?(h(t,"data-in-range",""),h(t,"aria-selected","true")):(x(t,"data-in-range"),x(t,"aria-selected"))}},Ui=class i extends $t{constructor(t,e){super(),this._preset=t,this._config=e}get _start(){let[t]=Yi[this._preset](this._config);return this._config.min&&t.isBefore(this._config.min)?this._config.min:t}get _end(){let[,t]=Yi[this._preset](this._config);return this._config.max&&t.isAfter(this._config.max)?this._config.max:t}hasSelection(){return!0}shouldNotify(t){return!(t instanceof i&&this._preset===t._preset)}select(t){return new jt(t,this._config)}contains(t){return t.isBetween(this._start,this._end)}lowerBound(){return this._preset==="allTime"?g.today():this._start}upperBound(){return this._preset==="allTime"?g.today():g.today()}display(t){return new Intl.DateTimeFormat(t,{day:"numeric",month:"short",year:"numeric",timeZone:"UTC"}).formatRange(this._start.getDate(),this._end.getDate()).replaceAll("\u2009"," ")}value(){return{start:this._start.toIsoDateString(),end:this._end.toIsoDateString(),preset:this._preset}}attributes(t,e){e.isSameDay(this._start)||e.isSameDay(this._end)?h(t,"data-selected",""):x(t,"data-selected"),e.isSameDay(this._start)?h(t,"data-start",""):x(t,"data-start"),e.isSameDay(this._end)?h(t,"data-end",""):x(t,"data-end"),this.contains(e)?(h(t,"data-in-range",""),h(t,"aria-selected","true")):(x(t,"data-in-range"),x(t,"aria-selected"))}};function ei(i=null){return typeof i=="function"?i():i}var Yi={today:()=>[g.today(),g.today()],yesterday:()=>{let i=g.today().incrementDays(-1);return[i,i]},thisWeek:i=>{let t=g.today().getCopy().incrementDays(i.startDay-g.today().getDayOfWeek()),e=t.incrementDays(6);return[t,e]},lastWeek:i=>{let t=g.today().incrementDays(i.startDay-(g.today().getDayOfWeek()+7)),e=t.incrementDays(6);return[t,e]},last7Days:()=>{let i=g.today();return[g.today().incrementDays(-6),i]},thisMonth:()=>{let i=g.fromParts(g.today().getYear(),g.today().getMonth(),1),t=g.fromParts(g.today().getYear(),g.today().getMonth(),g.today().getDaysInMonth());return[i,t]},lastMonth:()=>{let i=g.today().getMonth()-1,t=g.today().getYear();i<1&&(i+=12,t--);let e=g.fromParts(t,i,1),s=g.fromParts(t,i,e.getDaysInMonth());return[e,s]},thisQuarter:()=>{let t=Math.floor((g.today().getMonth()-1)/3)*3+1,e=t+2,s=g.fromParts(g.today().getYear(),t,1),r=g.fromParts(g.today().getYear(),e,1),a=g.fromParts(g.today().getYear(),e,r.getDaysInMonth());return[s,a]},lastQuarter:()=>{let t=Math.floor((g.today().getMonth()-4)/3)*3+1,e=t+2,s=g.today().getYear();t<1&&(t+=12,e+=12,s--);let r=g.fromParts(s,t,1),a=g.fromParts(s,e,1),n=g.fromParts(s,e,a.getDaysInMonth());return[r,n]},thisYear:()=>{let i=g.fromParts(g.today().getYear(),1,1),t=g.fromParts(g.today().getYear(),12,31);return[i,t]},lastYear:()=>{let i=g.today().getYear()-1,t=g.fromParts(i,1,1),e=g.fromParts(i,12,31);return[t,e]},last14Days:()=>{let i=g.today();return[g.today().incrementDays(-13),i]},last30Days:()=>{let i=g.today();return[g.today().incrementDays(-29),i]},last3Months:()=>{let i=g.today(),t=g.today().getDay()+1,e=g.today().getMonth()-3,s=g.today().getYear();return e<1&&(e+=12,s--),[g.fromParts(s,e,t),i]},last6Months:()=>{let i=g.today(),t=g.today().getDay()+1,e=g.today().getMonth()-6,s=g.today().getYear();return e<1&&(e+=12,s--),[g.fromParts(s,e,t),i]},yearToDate:()=>{let i=g.fromParts(g.today().getYear(),1,1),t=g.today();return[i,t]},tomorrow:()=>{let i=g.today().incrementDays(1);return[i,i]},nextWeek:i=>{let t=g.today().incrementDays(7+i.startDay-g.today().getDayOfWeek()),e=t.incrementDays(6);return[t,e]},next7Days:()=>{let i=g.today(),t=g.today().incrementDays(6);return[i,t]},nextMonth:()=>{let i=g.today().getMonth()+1,t=g.today().getYear();i>12&&(i-=12,t++);let e=g.fromParts(t,i,1),s=g.fromParts(t,i,e.getDaysInMonth());return[e,s]},nextQuarter:()=>{let t=(Math.floor((g.today().getMonth()-1)/3)+1)*3+1,e=g.today().getYear();t>12&&(t-=12,e++);let s=t+2;s>12&&(s-=12,e++);let r=g.fromParts(e,t,1),a=g.fromParts(e,s,1),n=g.fromParts(e,s,a.getDaysInMonth());return[r,n]},nextYear:()=>{let i=g.today().getYear()+1,t=g.fromParts(i,1,1),e=g.fromParts(i,12,31);return[t,e]},next14Days:()=>{let i=g.today(),t=g.today().incrementDays(13);return[i,t]},next30Days:()=>{let i=g.today(),t=g.today().incrementDays(29);return[i,t]},next3Months:()=>{let i=g.today(),t=g.today().getDay(),e=g.today().getMonth()+3,s=g.today().getYear();e>12&&(e-=12,s++);let r=g.fromParts(s,e,t).incrementDays(-1);return[i,r]},next6Months:()=>{let i=g.today(),t=g.today().getDay(),e=g.today().getMonth()+6,s=g.today().getYear();e>12&&(e-=12,s++);let r=g.fromParts(s,e,t).incrementDays(-1);return[i,r]},allTime:i=>{if(!i.min)throw new Error("Min date is required for allTime preset");let t=i.min,e=g.today();return[t,e]}};var zi=class{constructor(t,e,s,r){this.month=t,this.year=e,this.config=s,this.observable=r}generateOffsetState(t){return new Xs(this,t)}canNavigatePrevious(){let[t,e]=new g(this.year,this.month).addMonths(-1).toParts();return!(this.config.min&&g.fromParts(t,e).isBefore(g.firstDayOfMonth(this.config.min)))}canNavigateNext(){let[t,e]=new g(this.year,this.month).addMonths(this.config.months).toParts();return!(this.config.max&&g.fromParts(t,e).isAfter(this.config.max))}nextMonth(){this.canNavigateNext()&&this.adjustMonth(1)}previousMonth(){this.adjustMonth(-1)}setMonth(t){t&&(this.isWithinMinAndMax(t,this.year)&&(this.month=t),this.observable.notify($.VIEW_CHANGE))}setYear(t){if(!t)return;let e=this.month;this.isWithinMinAndMax(e,t)||(this.config.min&&g.fromParts(t,e).isBefore(g.firstDayOfMonth(this.config.min))?e=this.config.min.getMonth():this.config.max&&g.fromParts(t,e).isAfter(this.config.max)&&(e=this.config.max.getMonth())),this.isWithinMinAndMax(e,t)&&(this.month=e,this.year=t),this.observable.notify($.VIEW_CHANGE)}setDate(t){t&&(this.isWithinMinAndMax(t.getMonth(),t.getYear())&&(this.month=t.getMonth(),this.year=t.getYear()),this.observable.notify($.VIEW_CHANGE))}isWithinMinAndMax(t,e){return!(this.config.min&&g.fromParts(e,t).isBefore(g.firstDayOfMonth(this.config.min))||this.config.max&&g.fromParts(e,t).isAfter(this.config.max))}adjustMonth(t){let[e,s]=new g(this.year,this.month).addMonths(t).toParts();this.config.min&&g.fromParts(e,s).isBefore(g.firstDayOfMonth(this.config.min))||this.config.max&&g.fromParts(e,s).isAfter(this.config.max)||([this.month,this.year]=[s,e],this.observable.notify($.VIEW_CHANGE))}},Xs=class{constructor(t,e=0){this.offset=e,this.viewState=t}get month(){let[,t]=new g(this.viewState.year,this.viewState.month).addMonths(this.offset).toParts();return t}get year(){let[t]=new g(this.viewState.year,this.viewState.month).addMonths(this.offset).toParts();return t}};var Gi=class{constructor(t,e,s){this.min=s.min,this.max=s.max,this.unavailable=s.unavailable,this.selectable=t,this.metadata=e}isBetweenMinMax(t){return t.isBetween(this.min,this.max)}isUnavailable(t){return this.unavailable.some(e=>e.isSameDay(t))||this.metadata.unavailable(t)}isBlocked(t){return!this.selectable.isSelectable(t)}isValid(t){return this.isBetweenMinMax(t)&&!this.isUnavailable(t)&&!this.isBlocked(t)}};var Ki=class{constructor(t){this.metadata={},this.observable=t}resetFromJSON(t){this.reset(JSON.parse(t))}appendFromJSON(t){this.append(JSON.parse(t))}append(t){this.metadata={...this.metadata,...t},this.observable.notify($.VIEW_CHANGE)}reset(t){this.metadata=t,this.observable.notify($.VIEW_CHANGE)}get(t){return this.metadata[t.toIsoDateString()]}has(t){return this.metadata[t.toIsoDateString()]!==void 0}subtext(t){return this.metadata[t.toIsoDateString()]?.subtext}
125details(t){return this.metadata[t.toIsoDateString()]?.details}variant(t){return this.metadata[t.toIsoDateString()]?.variant}unavailable(t){return!!this.metadata[t.toIsoDateString()]?.unavailable}};var js=class extends T{boot(){let t=this.closest("ui-date-picker")||this;this.querySelectorAll("[data-appended]").forEach(l=>l.remove());let[e,s]=Xl(this,t);this.observable=new Me;let r=t.hasAttribute("locale")?t.getAttribute("locale"):Ai();this.config={mode:t.getAttribute("mode")==="range"?ot.RANGE:t.hasAttribute("multiple")?ot.MULTIPLE:ot.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(l=>{this.config.months=l,this.observable.notify($.VIEW_CHANGE)}),this.selectable=Bi.createFromValueStringAttribute(t.getAttribute("value"),this.config,this.observable),this.metadata=new Ki(this.observable),this.validator=new Gi(this.selectable,this.metadata,this.config);let a=t.hasAttribute("open-to")&&(t.hasAttribute("force-open-to")||this.selectable.lowerBound()===null)?this.getOpenTo(t):this.selectable.lowerBound(()=>g.today());if(this.viewState=new zi(a.getMonth(),a.getYear(),this.config,this.observable),this._disableable=new V(this,{disableWithParent:!1}),!this.hasAttribute("static")){let{enable:l,disable:u}=Kl(this,this.selectable,this.viewState,this.validator);this._disableable.onInitAndChange(d=>{d?u():l()})}this._controllable=new Y(this,{bubbles:!0}),this._submittable=new Q(this,{name:this.getAttribute("name"),value:this.selectable.getValue()});let n=G();this._controllable.initial(l=>l&&this.selectable.setValue(l)),this._controllable.getter(()=>this.selectable.getValue()),this._controllable.setter(n(l=>{this.selectable.setValue(l)}
125)),this.observable.subscribe($.SELECTION,n(()=>{this.dispatchEvent(new Event("select",{bubbles:!1,cancelable:!0})),this._controllable.dispatch()})),this.observable.subscribe($.SELECTION,()=>{this._submittable.update(this.selectable.getValue())}),this.observable.subscribe($.SELECTION,()=>{this.anchorSelection(t)}),this.observable.subscribe($.VIEW_CHANGE,()=>{this.dispatchEvent(new Event("navigate",{bubbles:!1,cancelable:!0}))}),queueMicrotask(()=>{this.closest("ui-date-picker")?.bootWithCalendar(this)}),new MutationObserver(l=>{l.forEach(u=>{["unavailable","max","min"].includes(u.attributeName)&&(this.config.unavailable=this.getUnavailableDates(t),this.config.min=this.getMinDate(t),this.config.max=this.getMaxDate(t),this.validator.unavailable=this.config.unavailable,this.validator.min=this.config.min,this.validator.max=this.config.max,this.observable.notify($.VIEW_CHANGE))})}).observe(t,{attributes:!0})}getOpenTo(t){if(!t.hasAttribute("open-to"))return;let e=t.getAttribute("open-to");return e=e==="today"?g.today():g.fromIsoDateString(e),this.validator.isBetweenMinMax(e)?e:this.config.min}navigateNext(){this.viewState.nextMonth()}navigatePrevious(){this.viewState.previousMonth()}anchorSelection(t){let e=document.activeElement;this.contains(e)&&e.closest("[data-date]")!==null||t.hasAttribute("force-open-to")||this.viewState.setDate(this.selectable.lowerBound(g.today()))}appendMetadata(t){this.metadata.append(t)}resetMetadata(t={}){this.metadata.reset(t)}visibleDateRange(){return[g.fromParts(this.viewState.year,this.viewState.month,1).toIsoDateString(),g.fromParts(this.viewState.year,this.viewState.month+1,0).toIsoDateString()]}getUnavailableDates(t){return t.hasAttribute("unavailable")?t.getAttribute("unavailable").split(",").map(e=>g.fromIsoDateString(e.trim())):[]}getMinDate(t){return t.hasAttribute("min")?t.getAttribute("min")==="today"?g.today():g.fromIsoDateString(t.getAttribute("min")):null}getMaxDate(t){return t.hasAttribute("max")?t.getAttribute("max")==="today"?g.today():g.fromIsoDateString(t.getAttribute("max")):null}},Js=class extends T{boot(){let t=this.closest("ui-calendar");this._disableable=t._disableable,xe(this,()=>this._disableable.isDisabled(),()=>t.navigatePrevious());let e=()=>{t.viewState.canNavigatePrevious()&&!this._disableable.isDisabled()?x(this,"disabled"):h(this,"disabled","")};t.observable.subscribe($.VIEW_CHANGE,e),this._disableable.onInitAndChange(()=>{e()})}},Zs=class extends T{boot(){let t=this.closest("ui-calendar");this._disableable=t._disableable,xe(this,()=>this._disableable.isDisabled(),()=>t.navigateNext());let e=()=>{t.viewState.canNavigateNext()&&!this._disableable.isDisabled()?x(this,"disabled"):h(this,"disabled","")};t.observable.subscribe($.VIEW_CHANGE,e),this._disableable.onInitAndChange(()=>{e()})}},Qs=class extends T{boot(){let t=this.closest("ui-calendar");this._disableable=t._disableable,this.offset=this.hasAttribute("offset")?parseInt(this.getAttribute("offset")):0,this.config=t.config,this.viewState=t.viewState,this.offsetState=this.viewState.generateOffsetState(this.offset),this.validator=t.validator;let e=this.querySelector("select"),s=this.hasAttribute("display")?this.getAttribute("display"):"long";if(e)this.renderSelectOptions(e,s),e.value=this.viewState.month,e.addEventListener("change",this._disableable.enabled(()=>{this.viewState.setMonth(parseInt(e.value))})),t.observable.subscribe($.VIEW_CHANGE,()=>{this.renderSelectOptions(e,s),e.value=this.viewState.month}),this._disableable.onInitAndChange(r=>{r?h(e,"disabled",""):x(e,"disabled")});else{let r=()=>this.textContent=new Intl.DateTimeFormat(this.config.locale,{month:this.hasAttribute("display")?this.getAttribute("display"):"long",timeZone:"UTC"}).format(new g(this.offsetState.year,this.offsetState.month).getDate());r(),this.viewState.observable.subscribe($.VIEW_CHANGE,()=>r())}}renderSelectOptions(t,e){let r=Array.from({length:12},(a,n)=>n+1).map(a=>{let n=new g(this.viewState.year,a),o=new g(this.viewState.year,a+1,0);return!this.validator.isBetweenMinMax(n)&&!this.validator.isBetweenMinMax(o)?null:{month:a,label:new Intl.DateTimeFormat(this.config.locale,{month:e,timeZone:"UTC"}).format(new g(2024,a).getDate())}}
125).filter(Boolean);at(t.querySelector("template"),a=>{if(r.length===0){let n=this.viewState.month,o=new Intl.DateTimeFormat(this.config.locale,{month:e,timeZone:"UTC"}).format(new g(2024,n).getDate()),l=a({slots:{default:o}});return l.setAttribute("value",n),l}return r.map(n=>{let o=a({slots:{default:n.label}});return o.setAttribute("value",n.month),o})})}},tr=class extends T{boot(){let t=this.closest("ui-calendar");this._disableable=t._disableable,this.offset=this.hasAttribute("offset")?parseInt(this.getAttribute("offset")):0,this.config=t.config,this.viewState=t.viewState,this.offsetState=this.viewState.generateOffsetState(this.offset),this.numberOfPastYears=100,this.numberOfFutureYears=10,this.validator=t.validator;let e=this.querySelector("select");if(e)this.config.min&&(this.numberOfPastYears=this.viewState.year-this.config.min.getYear()),this.config.max&&(this.numberOfFutureYears=this.config.max.getYear()-this.viewState.year),this.renderSelectOptions(e),e.value=this.viewState.year,e.addEventListener("change",this._disableable.enabled(()=>{this.viewState.setYear(parseInt(e.value))})),t.observable.subscribe($.VIEW_CHANGE,()=>{this.yearIsLessThanMinimum(this.viewState.year)&&(this.numberOfPastYears+=100,this.renderSelectOptions(e)),this.yearIsGreaterThanMaximum(this.viewState.year)&&(this.numberOfFutureYears+=10,this.renderSelectOptions(e)),e.value=this.viewState.year}),this._disableable.onInitAndChange(s=>{s?h(e,"disabled",""):x(e,"disabled")});else{let s=()=>this.textContent=new Intl.DateTimeFormat(this.config.locale,{year:this.hasAttribute("display")?this.getAttribute("display"):"numeric",timeZone:"UTC"}).format(new g(this.offsetState.year,this.offsetState.month).getDate());s(),this.viewState.observable.subscribe($.VIEW_CHANGE,()=>s())}}yearIsLessThanMinimum(t){return t<this.minimumYear()}yearIsGreaterThanMaximum(t){return t>this.maximumYear()}minimumYear(){return new Date().getFullYear()-this.numberOfPastYears}maximumYear(){return new Date().getFullYear()+this.numberOfFutureYears}renderSelectOptions(t){let e=new Date().getFullYear(),r=Array.from({length:this.numberOfPastYears+this.numberOfFutureYears+1},(a,n)=>e-this.numberOfPastYears+n).map(a=>{let n=new g(a,1),o=new g(a,12,31);return this.config.min&&o.isBefore(this.config.min)||this.config.max&&n.isAfter(this.config.max)?null:a}).filter(Boolean);at(t.querySelector("template"),a=>{if(r.length===0){let n=this.viewState.year;return a({slots:{default:n}})}return r.map(n=>a({slots:{default:n}}))})}},er=class extends T{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=>Xa(a,this.config,a.offsetState,this.metadata)),s=()=>this.monthEls.forEach(a=>ja(a,this._disableable.isDisabled(),this.config,a.offsetState,this.selectable,this.validator));e(),s();let r=this.config.months;this.viewState.observable.subscribe($.VIEW_CHANGE,()=>{r!==this.config.months&&(r=this.config.months,this.renderMonths()),e(),s()}),this.observable.subscribe([$.SELECTION,$.ACTIVATION],()=>{s()}),this._disableable.onChange(()=>s())}renderMonths(){let t=this.querySelector('template:not([name]), template[name="month"]');at(t,e=>{let s=Array.from({length:this.config.months}).map((r,a)=>a);return this.monthEls=s.map(r=>{let a=this.viewState.generateOffsetState(r),n=e({attrs:{"data-month":""}});n.offsetState=a;let o=n.querySelector("thead")?.set;return h(n,"role","grid"),o&&h(o,"aria-hidden","true"),n}),this.monthEls})}},ir=class extends T{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"),xe(this,()=>this._disableable.isDisabled(),()=>this.navigateAndSelectToday()),this._disableable.onInitAndChange(s=>{s?h(this,"disabled",""):x(this,"disabled")});let e=this.querySelector("template");e&&at(e,s=>s({slots:{default:g.today().getDay()}}))}navigateAndSelectToday(){let t=this.closest("ui-calendar, ui-date-picker"),e=()=>{let r=t.viewState,a=g.today();return r.year===a.getYear()&&r.month===a.getMonth()};(this.behavior==="select"||this.behavior==="auto"&&e())&&(t.config.mode===ot.RANGE?t.selectable.setValue({start:g.today().toIsoDateString(),end:g.today().toIsoDateString()}):t.config.mode===ot.MULTIPLE?t.selectable.setValue([g.today().toIsoDateString()]):t.selectable.setValue(g.today().toIsoDateString())),t.viewState.setMonth(g.today().getMonth()),t.viewState.setYear(g.today().getYear())}},sr=class extends T{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!==ot.RANGE)throw"Presets can only be used with range calendars";let e=this.firstElementChild;if(e){let s=r=>{if(e._selectable instanceof ut){let a=e._selectable.findByValue(r);return a?a?.el?.textContent:null}else if(e instanceof HTMLSelectElement)return e.querySelector(`option[value="${r}"]`)?.textContent;return null};
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($.SELECTION,()=>{let r=this.selectable.getValue();e.value=r?.preset||"custom"}),this._disableable.onInitAndChange(r=>{r?h(e,"disabled",""):x(e,"disabled")})}}},rr=class extends T{boot(){let t=this.closest("ui-calendar");this._disableable=t._disableable,this.offset=this.hasAttribute("offset")?parseInt(this.getAttribute("offset")):0,this.selectable=t.selectable,this.observable=t.observable,this.config=t.config,this.viewState=t.viewState,this.offsetState=this.viewState.generateOffsetState(this.offset);let[e,s]=this.querySelectorAll("input");this.config.mode===ot.RANGE?lr(e,s,t):nr(e,t)}};D("calendar",js);D("calendar-today",ir);D("calendar-presets",sr);D("calendar-previous",Js);D("calendar-inputs",rr);D("calendar-next",Zs);D("calendar-months",er);D("calendar-month",Qs);D("calendar-year",tr);function Kl(i,t,e,s){let r=!1,a=i.hasAttribute("readonly");return y(i,"click",n=>{if(r||a)return;let o=n.target.closest("[data-date]");if(!o)return;let l=Pe(o);s.isValid(l)&&t.select(l)}),y(i,"mouseover",n=>{if(r||a)return;let o=n.target.closest("[data-date]");if(!o)return;let l=Pe(o);s.isValid(l)&&t.activate(l)}),y(i,"mouseout",()=>{r||a||t.activate(null)}),y(i,"focusin",n=>{if(r||a)return;let o=n.target.closest("[data-date]");if(!o)return;let l=Pe(o);s.isValid(l)&&t.activate(l)}),y(i,"keydown",n=>{if(r)return;let o=n.target.closest("[data-date]");if(!o)return;let l=!0,u,d=Pe(o),c=f=>{let b=d.getCopy(),p=Math.sign(f),w=366;for(b.setDay(b.getDay()+f);!s.isValid(b)&&w>0;)b.setDay(b.getDay()+p),w--;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:l=!1}if(l){n.preventDefault(),n.stopPropagation();let f=Array.from(i.querySelectorAll("[data-date]")).find(b=>Pe(b).isSameDay(d));!f&&u&&(u==="forward"?e.nextMonth():e.previousMonth(),f=Array.from(i.querySelectorAll("[data-date]")).find(b=>Pe(b).isSameDay(d))),f?.querySelector("button,ui-button")?.focus()}}),{enable(){r=!1},disable(){r=!0}}}function Pe(i){return!i||!i.hasAttribute("data-date")?null:g.fromIsoDateString(i.getAttribute("data-date"))}function Xl(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 nr(i,t){ar(i);let e=G(),s=e(()=>{let r=t.selectable.getValue();i.value=r||""});t.observable.subscribe($.SELECTION,s),s(),i.addEventListener("change",e(()=>{let r=i.valueAsDate;r?(t.selectable.setValue(g.fromLocalDate(r).toIsoDateString()),t.viewState.setDate(g.fromLocalDate(r))):t.selectable.setValue("")}))}function lr(i,t,e){ar(i),ar(t);let s=G(),r=s(()=>{let{start:n,end:o}=e.selectable.getValue()||{};i.value=n||"",t.value=o||""}),a=s(()=>{let n=i.valueAsDate,o=t.valueAsDate;n&&o?e.selectable.setValue({start:g.fromLocalDate(n).toIsoDateString(),end:g.fromLocalDate(o).toIsoDateString()}):n?e.selectable.setValue({start:g.fromLocalDate(n).toIsoDateString(),end:null}):e.selectable.setValue({start:null,end:null})});e.observable.subscribe($.SELECTION,r),r(),i.addEventListener("change",a),t.addEventListener("change",a)}function ar(i){y(i,"change",t=>t.stopPropagation()),y(i,"input",t=>t.stopPropagation())}var Xi=class extends X{boot(){this.picker=this.closest("ui-date-picker"),this._disableable=new V(this);let t=o=>{o.preventDefault(),o.stopImmediatePropagation()};if(this._disableable.onInitAndChange(o=>{o?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}=jl(e);this.dayInput.setAttribute("placeholder",a.day),this.monthInput.setAttribute("placeholder",a.month),this.yearInput.setAttribute("placeholder",a.year),this.inputs=s.map(o=>{if(o==="day")return this.dayInput;if(o==="month")return this.monthInput;if(o==="year")return this.yearInput});let n=this.querySelector("[data-flux-date-inputs]");if(n){for(;n.firstChild;)n.removeChild(n.firstChild);
125this.inputs.forEach((o,l)=>{if(n.appendChild(o),l<this.inputs.length-1){let u=document.createElement("span");u.textContent=` ${r} `,u.style.userSelect="none",n.appendChild(u)}})}this._disableable.onInitAndChange(o=>{o?(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(),or(this.dayInput),or(this.monthInput),or(this.yearInput),this.inputs.forEach((o,l)=>{o.addEventListener("keydown",u=>{if(u.key==="ArrowRight"&&l<this.inputs.length-1)return this.inputs[l+1].focus();if(u.key==="ArrowLeft"&&l>0)return this.inputs[l-1].focus();u.key===" "&&!this.hasAttribute("data-bare")&&(u.preventDefault(),this.picker?._dialogable?.toggle())})}),ur(this.dayInput),ur(this.monthInput),ur(this.yearInput),this.initTwoDigitInputListeners(this.dayInput,{max:()=>this.maxDay(),advanceThreshold:3,handleSecondDigit:(o,l)=>{if(o===3&&l<=1)return`${o}${l}`;if(o<=2){let u=`${o}${l}`;return u==="00"?"01":u}return null}}),this.initTwoDigitInputListeners(this.monthInput,{max:12,advanceThreshold:1,handleSecondDigit:(o,l)=>o===1&&l<=2?`${o}${l}`:o===0?l===0?"01":`0${l}`:null,onValueChange:()=>this.clampDay()}),this.initYearInputListeners()}connectToPicker(t,e=null){this.picker=t,this.rangeRole=e,queueMicrotask(()=>{let s=this.picker.getAttribute("aria-labelledby"),r=this.getAttribute("aria-labelledby");s&&r&&s!==r&&h(this,"aria-labelledby",`${s} ${r}`)}),this.picker.observable.subscribe($.SELECTION,()=>{this.updateInputsFromSelectable(this.picker.selectable)}),this.updateInputsFromSelectable(this.picker.selectable),this.addEventListener("mousedown",s=>{s.target.closest("input")||s.preventDefault()}),this.hasAttribute("data-bare")||this.addEventListener("click",()=>{this.picker._dialogable.toggle()})}focus(){if(this.inputs?.length)return this.inputs[0].focus();this.querySelector("button,ui-button")?.focus()}processDate(){let t=this.dayInput.value,e=this.monthInput.value,s=this.yearInput.value;if(t===""||e===""||s==="")return;let r=parseInt(t),a=parseInt(e),n=parseInt(s);if(isNaN(r)||isNaN(a)||isNaN(n)||a<1||a>12||r<1||n<100)return;let o=new Date(n,a,0).getDate();r>o&&(r=o,this.dayInput.value=r.toString().padStart(2,"0"));let l=`${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]=l;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(l);this.picker.viewState.setDate(g.fromIsoDateString(l))}updateInputsFromSelectable(t){let e=t.getValue();if(this.rangeRole&&e&&typeof e=="object"){this.picker._rangeTriggerDates=this.picker._rangeTriggerDates||{start:null,end:null},this.picker._rangeTriggerDates[this.rangeRole]=e[this.rangeRole]||null,this.updateInputs(e[this.rangeRole]||null);return}this.updateInputs(e)}updateInputs(t){if(!t)return this.clearInputs();x(this.picker,"data-empty");let[e,s,r]=t.split("T")[0].split("-");this.dayInput.value=r.padStart(2,"0"),this.dayInput.style.color="",this.dayInput.classList.remove("font-mono"),this.monthInput.value=s.padStart(2,"0"),this.monthInput.style.color="",this.monthInput.classList.remove("font-mono"),this.yearInput.value=e.padStart(4,"0"),this.yearInput.style.color="",this.yearInput.classList.remove("font-mono")}clearInputs(){this.dayInput.value="",this.dayInput.style.color="",this.dayInput.classList.add("font-mono"),this.monthInput.value="",this.monthInput.style.color="",this.monthInput.classList.add("font-mono"),this.yearInput.value="",this.yearInput.style.color="",this.yearInput.classList.add("font-mono");let t=this.inputs.find(e=>e===document.activeElement);t&>(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"))}initTwoDigitInputListeners(t,{max:e,advanceThreshold:s,handleSecondDigit:r,onValueChange:a}){let n=!1;t.addEventListener("keydown",l=>{if(l.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="",gt(t);return}if(!["ArrowUp","ArrowDown"].includes(l.key))return;l.preventDefault(),l.stopPropagation();let u=parseInt(t.value),d=typeof e=="function"?e():e;l.key==="ArrowUp"?isNaN(u)||u>=d?u=1:u++:l.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(),gt(t)});let o=this.inputs[this.inputs.indexOf(t)+1];t.addEventListener("keydown",l=>{if(!/[0-9]/.test(l.key))return;let u=parseInt(l.key);if(t.value===""||!n){n=!0,t.value=`0${u}`,a?.(),u>s?o?.focus():gt(t);return}let d=parseInt(t.value),c=r(d,u);if(c){t.value=c,a?.(),o?.focus();return}t.value=`0${u}`,a?.(),u>s?o?.focus():gt(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="",gt(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(),gt(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():gt(this.yearInput);return}this.yearInput.value=t.padStart(4,"0"),gt(this.yearInput)}),this.yearInput.addEventListener("blur",()=>{t="",this.yearInput.value==="0000"&&(this.yearInput.value="0001"),this.clampDay(),this.processDate()})}};function jl(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(o=>["day","month","year"].includes(o.type)).map(o=>o.type),a=e.find(o=>o.type==="literal")?.value?.trim()||"/",n={day:"dd",month:"mm",year:"yyyy"};return e.forEach(o=>{o.type==="day"&&(n.day=o.value.replace(/\d/g,"d")),o.type==="month"&&(n.month=o.value.replace(/\d/g,"m")),o.type==="year"&&(n.year=o.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 or(i){i.addEventListener("focus",()=>{gt(i)}),i.addEventListener("blur",()=>{Qa(i)}),i.addEventListener("mousedown",t=>{t.preventDefault(),i.focus(),gt(i)}),i.addEventListener("mouseup",t=>{t.preventDefault(),gt(i)})}function ur(i){i.addEventListener("keydown",t=>{/[0-9]/.test(t.key)&&(Qa(i),i.classList.remove("font-mono")),!(t.ctrlKey||t.metaKey||t.altKey)&&(["Tab"].includes(t.key)||t.preventDefault())})}function gt(i){!i.value&&i.placeholder&&(i.style.color=getComputedStyle(i,"::placeholder").color,i.value=i.placeholder,i.classList.add("font-mono")),i.setSelectionRange(0,i.value.length)}function Qa(i){i.value===i.placeholder&&(i.value="",i.style.color="")}var cr=class extends X{bootWithCalendar(t){let e=t.config.mode===ot.RANGE;this.calendar=t,this._disableable=new V(this),this._disableable.onInitAndChange(b=>{this.calendar.disabled=b}),this.observable=new Me,this.selectable=new Wi(this.calendar.selectable,this.observable),this.viewState=this.calendar.viewState,this.querySelector("ui-selected-date")?.bootWithCalendar(
125),this.querySelector("ui-date-picker-select")?.bootWithCalendar();let s=this.querySelector("dialog");if(!s)return;let r=Array.from(this.querySelectorAll("ui-date-picker-trigger")).filter(b=>!s?.contains(b)),a=r[0]||null,n=r[1]||null,o=a?null:this.querySelector("input");o=s?.contains(o)?null:o;let l=a?null:Array.from(this.querySelectorAll("input")).find(b=>b!==o);l=s?.contains(l)?null:l,a||(o&&o.addEventListener("click",b=>b.preventDefault()),l&&l.addEventListener("click",b=>b.preventDefault()));let u=this.querySelector("button,ui-button");u=s?.contains(u)?null:u;let d=K(this.calendar,"calendar");if(this.triggerEl=a||o||u,!this.triggerEl)return;a?h(this.triggerEl,"role","group"):h(this.triggerEl,"role","combobox"),h(this.triggerEl,"aria-controls",d),this._disableable.onInitAndChange(b=>{b?h(this.triggerEl,"disabled",""):x(this.triggerEl,"disabled")}),this._dialogable=new Ae(s,{clickOutside:!this.hasAttribute("disable-click-outside"),triggers:a?[u].filter(Boolean):[u,o,l].filter(Boolean)}),this._closeable=new Mt(this),this._closeable.onClose(()=>this._dialogable.hide()),this._anchorable=new it(s,{reference:this.triggerEl,position:this.hasAttribute("position")?this.getAttribute("position"):void 0,gap:this.hasAttribute("gap")?this.getAttribute("gap"):void 0,offset:this.hasAttribute("offset")?this.getAttribute("offset"):void 0}),pa()&&!a&&(o&&this.showIOSOverlay(o),l&&this.showIOSOverlay(l)),this.querySelectorAll("button,ui-button").forEach(b=>{b!==this.triggerEl&&(s.contains(b)||(h(b,"aria-controls",d),h(b,"aria-haspopup","combobox"),tn(b,this._dialogable),y(b,"click",()=>this._dialogable.toggle())))}),Jl(this,this.triggerEl,s,this._dialogable,this._anchorable),a||tn(this.triggerEl,this._dialogable),to(this,this._dialogable),a||Zl(this.triggerEl,this._dialogable),eo(this,this.calendar.config.mode,this.observable,this.selectable,this._dialogable);let c=Array.from(s.querySelectorAll("ui-date-picker-trigger[data-bare]"));if(c.length===2&&e?(c[0].connectToPicker(this,"start"),c[1].connectToPicker(this,"end")):c.length===1&&c[0].connectToPicker(this),a&&n&&e)a.connectToPicker(this,"start"),n.connectToPicker(this,"end");else if(a)a.connectToPicker(this);else if(e&&s&&o&&l)hr(o),hr(l),lr(o,l,this);else if(s&&o){let b=o;hr(b),nr(b,this)}else s&&Ql(u,this._dialogable);this._controllable=new Y(this,{bubbles:!0}),this.calendar.addEventListener("change",b=>b.stopPropagation()),this.calendar.addEventListener("input",b=>b.stopPropagation()),this._submittable=new Q(this,{name:this.getAttribute("name"),value:this.selectable.getValue()});let f=G();this._controllable.initial(b=>b&&this.selectable.setValue(b)),this._controllable.getter(()=>this.selectable.getValue()),this._controllable.setter(f(b=>this.selectable.setValue(b))),this.observable.subscribe($.SELECTION,f(()=>{this.dispatchEvent(new Event("select",{bubbles:!1,cancelable:!0})),this._controllable.dispatch()})),this.observable.subscribe($.SELECTION,()=>{this._submittable.update(this.selectable.getValue())}),this.observable.subscribe($.VIEW_CHANGE,()=>{this.dispatchEvent(new Event("navigate",{bubbles:!1,cancelable:!0}))})}unmount(){if(this._dialogable?.getState()){let{unlock:t}=lt();t()}}showIOSOverlay(t){let e=document.createElement("button");e.setAttribute("data-flux-ios-overlay",""),e.setAttribute("data-appended",""),e.classList.add("absolute","
125inset-0"),t.after(e)}input(){return this.querySelector("input")}clear(){this.selectable.setValue(null),this.dispatchEvent(new CustomEvent("clear",{bubbles:!1}))}open(){this._dialogable.setState(!0)}close(){this._dialogable.setState(!1)}trigger(){return this.triggerEl}},dr=class extends T{bootWithCalendar(){if(this.picker=this.closest("ui-date-picker"),this.querySelectorAll("[data-appended]").forEach(t=>t.remove()),!this.querySelector('template[name="date"]')){let t=document.createElement("template");t.setAttribute("name","date"),t.innerHTML="<div><slot></slot></div>",this.appendChild(t)}this.templates={placeholder:this.querySelector('template[name="placeholder"]'),date:this.querySelector('template[name="date"]')},this.picker.observable.subscribe($.SELECTION,()=>{this.render(this.picker)}),this.render(this.picker)}render(t){if(this.templates.placeholder?.clearPlaceholder?.(),this.templates.date?.clearDate?.(),t.selectable.hasSelection()){let{cleanup:e}=at(this.templates.date,s=>s({slots:{default:t.selectable.display(this.picker.calendar.config.locale)}}));this.templates.date.clearDate=e}else{if(!this.templates.placeholder)return;let{cleanup:e}=at(this.templates.placeholder,s=>s({slots:{}}));this.templates.placeholder.clearPlaceholder=e}}},fr=class extends T{bootWithCalendar(){this.picker=this.closest("ui-date-picker"),this.picker.selectable.blockSyncIf(()=>this.getBoundingClientRect().width>0),xe(this,()=>this.picker._disableable.isDisabled(),()=>{this.picker.selectable.sync(),this.picker._dialogable.setState(!1)})}};D("date-picker",cr);D("date-picker-select",fr);D("selected-date",dr);D("date-picker-trigger",Xi);qe(({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 tn(i,t){h(i,"aria-haspopup","listbox");let e=()=>{h(i,"aria-expanded",t.getState()?"true":"false"),t.getState()?h(i,"data-open",""):x(i,"data-open","")};t.onChange(()=>{e()}),e()}function Jl(i,t,e,s,r){let a=()=>{Array.from([i,e]).forEach(n=>{s.getState()?h(n,"data-open",""):x(n,"data-open","")}),s.getState()&&r.reposition()};s.onChange(()=>a()),a(),s.onChange(()=>{s.getState()?i.dispatchEvent(new Event("open",{bubbles:!1,cancelable:!1})):i.dispatchEvent(new Event("close",{bubbles:!1,cancelable:!1}))})}function Zl(i,t){y(i,"keydown",e=>{["ArrowDown","ArrowUp","Escape"].includes(e.key)&&(e.key==="ArrowDown"||e.key==="ArrowUp"?t.getState()||(t.setState(!0),e.preventDefault(),e.stopImmediatePropagation()):e.key==="Escape"&&t.getState()&&t.setState(!1))})}function Ql(i,t){y(i,"click",()=>{t.setState(!t.getState())})}function hr(i){y(i,"focus",()=>i.select())}function to(i,t){let{lock:e,unlock:s}=lt(t.el);t.onChange(()=>{t.getState()?e():s()})}function eo(i,t,e,s,r){let a=t!==ot.MULTIPLE;if(i.hasAttribute("close")){let n=i.getAttribute("close");a=n.split(" ").includes("auto"),n==="manual"&&(a=!1)}a&&e.subscribe($.SELECTION,()=>{s.hasSelection()&&r.setState(!1)})}var pr=class extends X{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 Y(this),this._disableable=new V(this),this._submittable=new Q(this,{name:this.getAttribute("name"),value:this.state.getValue()}),this.state.onChange(r=>{this._submittable.update(r)}),this._controllable.initial(r=>r&&this.state.setValue(r)),this._controllable.getter(()=>this.state.getValue()),this._controllable.setter(r=>this.state.setValue(r));let s=()=>{};this._disableable.onInitAndChange(r=>{r?(s=this._disableActions(),h(this._inputEl,"disabled","")):(s(),s=()=>{},x(this._inputEl,"disabled"))}),y(this._inputEl,"input",r=>{this._controllable.dispatch(),r.stopPropagation()})}_resizeTextarea(){h(this._inputEl,"style","height: auto");let t=window.getComputedStyle(this._inputEl),e=this._inputEl.scrollHeight,s=parseFloat(t.lineHeight);isNaN(s)&&(s=parseFloat(t.fontSize)*1.2);let r=parseFloat(t.borderTopWidth),a=parseFloat(t.borderBottomWidth),n=parseFloat(t.paddingTop),o=parseFloat(t.paddingBottom),l=this.config.rows*s,u=this.config.maxRows*s;t.boxSizing==="border-box"?(e+=r+a,l+=n+o+r+a,u+=n+o+r+a):e-=n+o,e<l&&(e=l);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),o=parseFloat(e.paddingBottom),l=this.config.rows*s,u=this.config.maxRows*s;e.boxSizing==="border-box"&&(l+=n+o+r+a,u+=n+o+r+a),h(t,"style",`min-height: ${l}px; max-height: ${u}px; height: auto; overflow-y: auto;`)}_initTextarea(){this._inputEl.hasAttribute("rows")||h(this._inputEl,"rows",this.config.rows),this.hasAttribute("placeholder")&&h(this._inputEl,"placeholder",this.getAttribute("placeholder")),this._inputEl.addEventListener("input",()=>this._resizeTextarea()),this._resizeTextarea(),y(this._inputEl,"keydown",t=>this._handleSubmitKeydown(t))}_initEditor(){this.hasAttribute("placeholder")&&h(this._inputEl,"placeholder",this.getAttribute("placeholder")),this.addEventListener("flux:editor:ready",()=>{this._resizeEditor()}),y(this._inputEl,"keydown",t=>this._handleSubmitKeydown(t),{capture:!0})}_handleSubmitKeydown(t){["cmd-enter","super-enter","ctrl-enter"].includes(this.config.submit)&&(t.metaKey||t.ctrlKey)&&t.key==="Enter"?(t.preventDefault(),t.stopPropagation(),this._submittable.submitEnclosingForm()):this.config.submit==="enter"&&t.key==="Enter"&&!t.shiftKey?(t.preventDefault(),t.stopPropagation(),this._submittable.submitEnclosingForm()):this.config.submit==="shift-enter"&&t.key==="Enter"&&t.shiftKey&&(t.preventDefault(),t.stopPropagation(),this._submittable.submitEnclosingForm())}_disableActions(){let t=[];return this.querySelectorAll("button").forEach(s=>{s.hasAttribute("disabled")||(h(s,"disabled",""),t.push(()=>{dt(s,"disabled")}))}),()=>{t.forEach(s=>s()),t=[]}}};D("composer",pr);var br=class extends T{boot(){this._controllable=new Y(this),this._controllable.initial(t=>t!=null&&this.setValue(parseFloat(t))),this._controllable.getter(()=>this.currentValue),this._controllable.setter(t=>this.setValue(parseFloat(t))),h(this,"role","progressbar"),h(this,"aria-valuemin",0),this.currentValue===void 0&&this.setValue(this.hasAttribute("value")?parseFloat(this.getAttribute("value")):0),new MutationObserver(()=>this.updateVisual()).observe(this,{attributes:!0,attributeFilter:["max"]})}setValue(t){this.currentValue=t,this.updateVisual()}updateVisual(){let t=this.hasAttribute("max")?parseFloat(this.getAttribute("max")):100,e=Math.max(0,Math.min(100,this.currentValue/t*100));this.style.setProperty("--flux-progress",e),this.style.setProperty("--flux-progress-percentage",e+"%"),h(this,"aria-valuenow",this.currentValue),h(this,"aria-valuemax",t)}};D("progress",br);var mr=class extends T{boot(){let t=this.trigger(),e=this.overlay();this._disabled=this.hasAttribute("disabled"),this._popoverable=new rt(e);let s={getBoundingClientRect:()=>({x:0,y:0,width:0,height:0,top:0,left:0,right:0,bottom:0})};this._anchorable=new it(e,{reference:s,auto:!1,position:this.hasAttribute("position")?this.getAttribute("position"):void 0,gap:this.hasAttribute("gap")?this.getAttribute("gap"):void 0,offset:this.hasAttribute("offset")?this.getAttribute("offset"):void 0});let{lock:r,unlock:a}=lt(this._popoverable.el);this._popoverable.onChange(()=>{this._popoverable.getState()?r():a()}),y(t,"contextmenu",n=>{n.preventDefault(),s.getBoundingClientRect=()=>({x:n.clientX,y:n.clientY,width:0,height:0,top:n.clientY,left:n.clientX,right:n.clientX,bottom:n.clientY}),this._anchorable.reposition(),this._popoverable.setState(!0),this.hasAttribute("detail")&&h(e,"data-detail",this.getAttribute("detail"))}),this.hasAttribute("detail")&&h(e,"data-detail","")}unmount(){if(this.overlay()?._popoverable?.getState()){let{unlock:t}=lt();t()}}trigger(){return this.firstElementChild}overlay(){if(this.hasAttribute("target")){let t=this.getAttribute("target");return document.getElementById(t)}else return this.lastElementChild.matches("[popover]")&&this.lastElementChild}};D("context",mr);var _t=class extends kt{groupOfType=st;boot({options:t}){t({wrap:!1,ensureTabbable:!0})}mount(){this.options().ensureTabbable&&this.ensureTabbable()}focusFirst(){let t;t=t||this.walker().find(e=>e.hasAttribute("autofocus")),t=t||this.walker().find(e=>e.getAttribute("tabindex")==="0"),t=t||this.walker().find(e=>e.getAttribute("tabindex")==="-1"),t=t||this.walker().find(e=>ca(e)),t?.focus()}focusPrev(){this.moveFocus(t=>this.options().wrap?this.walker().prevOrLast(t):this.walker().prev(t))}focusNext(){this.moveFocus(t=>this.options().wrap?this.walker().nextOrFirst(t):this.walker().next(t))}focusBySearch(t){let e=this.walker().find(s=>s.textContent.toLowerCase().trim().startsWith(t.toLowerCase()));e?.use(st).tabbable(),e?.use(st).focus()}moveFocus(t){let e=this.walker().find(r=>r.use(st).isTabbable());t(e)?.use(st).focus()}ensureTabbable(){this.walker().findOrFirst(t=>{t.use(st).isTabbable()})?.use(st).tabbable()}wipeTabbables(){this.walker().each(t=>{t.use(st).untabbable()})}untabbleOthers(t){this.walker().each(e=>{e!==t&&e.use(st).untabbable()})}walker(){return tt(this.el,(t,{skip:e,reject:s})=>{if(t[this.constructor.name]&&t!==this.el)return s();if(!t[this.groupOfType.name])return e();if(t.hasAttribute("disabled"))return s()})}},st=class extends j{groupedByType=_t;boot({options:t}){t({hover:!1,disableable:null,tabbable:!1,tabbableAttr:null})}mount(){let t=this.options().disableable;if(!t)throw"Focusable requires a Disableable instance...";this.el.hasAttribute("tabindex")||(this.options().tabbable?this.tabbable():this.untabbable()),this.pauseFocusListener=this.on("focus",t.enabled(()=>{this.focus(!1)})).pause,this.on("focus",t.enabled(()=>{ie()&&h(this.el,"data-focus","")})),this.on("blur",t.enabled(()=>{x(this.el,"data-focus")})),this.options().hover&&this.on("pointerenter",t.enabled(()=>{this.group()?.untabbleOthers(this.el),this.tabbable()})),this.options().hover&&this.on("pointerleave",t.enabled(e=>{this.untabbable()}))}focus(t=!0){this.group()?.untabbleOthers(this.el),this.tabbable(),t&&this.pauseFocusListener(()=>{this.el.focus({focusVisible:!1})})}tabbable(){h(this.el,"tabindex","0"),this.options().tabbableAttr&&h(this.el,this.options().tabbableAttr,"")}untabbable(){h(this.el,"tabindex","-1"),this.options().tabbableAttr&&x(this.el,this.options().tabbableAttr)}isTabbable(){return this.el.getAttribute("tabindex")==="0"}};var ii=class i extends T{boot(){if(this._focusable=new _t(this,{wrap:!1,ensureTabbable:!1}),y(this,"keydown",t=>{["ArrowDown"].includes(t.key)?(t.target===this?this._focusable.focusFirst():this._focusable.focusNext(),t.preventDefault(),t.stopPropagation()):["ArrowUp"].includes(t.key)&&(t.target===this?this._focusable.focusFirst():this._focusable.focusPrev(),t.preventDefault(),t.stopPropagation())}),xi(this,t=>this._focusable.focusBySearch(t)),this.hasAttribute("popover")&&this.addEventListener("lofi-close-popovers",t=>{this.hasAttribute("keep-open")||(t.detail?.immediate?this.hidePopover():setTimeout(()=>this.hidePopover(),50))}),this.parentElement.localName==="ui-dropdown"){let t=this.parentElement;y(t.trigger(),"keydown",e=>{e.key==="ArrowDown"&&(this.fromArrowDown=!0,this.showPopover(),e.preventDefault(),e.stopPropagation())})}h(this,"role","menu"),h(this,"tabindex","-1")}mount(){this.initializeMenuItems(),new MutationObserver(e=>{this.initializeMenuItems()}).observe(this,{childList:!0,subtree:!0})}onPopoverShow(){requestAnimationFrame(()=>{this.fromArrowDown?(this._focusable.focusFirst(),this.fromArrowDown=!1):this.focus()})}onPopoverHide(){this._focusable.wipeTabbables()}initializeMenuItems(){this.walker().each(t=>{t._disableable||io(t)})}walker(){return tt(this,(t,{skip:e,reject:s})=>{if(t instanceof i||t instanceof de)return s();if(!["a","button"].includes(t.localName))return e()})}},gr=class extends T{boot(){}},vr=class extends T{boot(){let t=this;this._disableable=new V(this),this._disableable.onInitAndChange(s=>{s?h(t,"aria-disabled","true"):x(t,"aria-disabled")}),K(t,"menu-checkbox"),h(t,"role","menuitemcheckbox"),t._focusable=new st(t,{disableable:this._disableable,hover:!0,tabbableAttr:"data-active"}),t._selectable=new H(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 Y(this),this._controllable.initial(s=>s&&t._selectable.setState(s)),this._controllable.getter(()=>t._selectable.getState());let e=G();this._controllable.setter(e(s=>{this._selectable.setState(s)})),this._selectable.onChange(e(()=>{this._controllable.dispatch()})),y(t,"click",this._disableable.enabled(()=>{this.hasAttribute("keep-open")||this.dispatchEvent(new CustomEvent("lofi-close-popovers",{bubbles:!0})),t._selectable.press()})),Ar(t)}},yr=class extends T{boot(){let t=this;this._disableable=new V(this),this._disableable.onInitAndChange(e=>{e?h(t,"aria-disabled","true"):x(t,"aria-disabled")}),K(t,"menu-radio"),h(t,"role","menuitemradio"),t._focusable=new st(t,{disableable:this._disableable,hover:!0,tabbableAttr:"data-active"}),t._selectable=new H(t,{toggleable:!1,value:this.hasAttribute("value")?this.getAttribute("value"):t.textContent.trim(),label:this.hasAttribute("label")?this.getAttribute("label"):t.textContent.trim(),dataAttr:"data-checked",ariaAttr:"aria-checked",selectedInitially:this.hasAttribute("checked")}),y(t,"click",this._disableable.enabled(()=>{this.hasAttribute("keep-open")||this.dispatchEvent(new CustomEvent("lofi-close-popovers",{bubbles:!0})),t._selectable.press()})),Ar(t)}},wr=class extends T{boot(){this._selectable=new ut(this),this._controllable=new Y(this),h(this,"role","group"),this._controllable.initial(e=>e&&this._selectable.setState(e)),this._controllable.getter(()=>this._selectable.getState());let t=G();this._controllable.setter(t(e=>{this._selectable.setState(e)})),this._selectable.onChange(t(()=>{this._controllable.dispatch()})),y(this,"lofi-close-popovers",e=>{this.hasAttribute("keep-open")&&(e.preventDefault(),e.stopPropagation())})}},xr=class extends T{boot(){this._selectable=new ut(this,{multiple:!0}),this._controllable=new Y(this),h(this,"role","group"),this._controllable.initial(e=>e&&this._selectable.setState(e)),this._controllable.getter(()=>this._selectable.getState());let t=G();this._controllable.setter(t(e=>{this._selectable.setState(e)})),this._selectable.onChange(t(()=>{this._controllable.dispatch()}))}};D("menu",ii);D("submenu",gr);D("menu-checkbox",vr);D("menu-radio",yr);D("menu-radio-group",wr);D("menu-checkbox-group",xr);function Ar(i){y(i,"keydown",t=>{t.key==="Enter"&&(i.click(),t.preventDefault(),t.stopPropagation())}),y(i,"keydown",t=>{t.key===" "&&(t.preventDefault(),t.stopPropagation())}),y(i,"keyup",t=>{t.key===" "&&(i.click(),t.preventDefault(),t.stopPropagation())})}function io(i){let t=i.querySelector("a"),e=i,s=i.parentElement.matches("ui-submenu")&&i.parentElement.querySelector("ui-menu[popover]"),r=t||e;if(i._disableable=new V(i),i._disableable.onInitAndChange(a=>{a?h(r,"aria-disabled","true"):x(r,"aria-disabled")}),K(r,"menu-item"),h(r,"role","menuitem"),r._focusable=new st(r,{disableable:i._disableable,hover:!0,tabbableAttr:"data-active"}),s){s._popoverable=new rt(s,{triggers:[e]}),s._anchorable=new it(s,{reference:e,position:s.hasAttribute("position")?s.getAttribute("position"):Lt(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}=we(e,s,{gain(){s._popoverable.setState(!0)},lose(){s._popoverable.setState(!1)},focusable:!1,useSafeArea:!0});s._popoverable.onChange(()=>{s._popoverable.getState()||(a(),s._focusable.wipeTabbables()),s._popoverable.getState()?s._anchorable.reposition():s._anchorable.cleanup()}),y(e,"keydown",n=>{n.key==="Enter"&&(s._popoverable.setState(!0),setTimeout(()=>s._focusable.focusFirst()))}),y(e,"keydown",n=>{n.key==="ArrowRight"&&(s._popoverable.setState(!0),setTimeout(()=>s._focusable.focusFirst()))}),y(s,"keydown",n=>{n.key==="ArrowLeft"&&(s._popoverable.setState(!1),e.focus(),n.stopPropagation())})}else{let a=i._disableable.enabled(()=>{i.hasAttribute("keep-open")||i.dispatchEvent(new CustomEvent("lofi-close-popovers",{bubbles:!0,detail:{immediate:!0}}))});y(i,"mouseup",a),y(i,"click",n=>!n.isTrusted&&a()),Ar(e)}}var Sr=class i extends T{mount(){this._focusable=new _t(this,{wrap:!0}),this._disableable=new V(this);let t=[];this._disableable.onInitAndChange(e=>{e?(h(this,"aria-disabled","true"),this.walker().each(s=>{s.hasAttribute("disabled")||(h(s,"disabled","true"),h(s,"aria-disabled","true"),t.push(()=>{dt(s,"disabled"),dt(s,"aria-disabled")}))})):(dt(this,"aria-disabled"),t.forEach(s=>s()),t=[])}),y(this,"keydown",e=>{["ArrowRight"].includes(e.key)?(e.target===this?this._focusable.focusFirst():this._focusable.focusNext(),e.preventDefault(),e.stopPropagation()):["ArrowLeft"].includes(e.key)&&(e.target===this?this._focusable.focusFirst():this._focusable.focusPrev(),e.preventDefault(),e.stopPropagation())}),h(this,"role","toolbar"),this.initializeToolbarItems()}initializeToolbarItems(){this.walker().each(t=>{t._disableable||so(t)})}walker(){return tt(this,(t,{skip:e,reject:s})=>{if(t instanceof i||t.hasAttribute("popover")||t instanceof ii||t instanceof Ke)return s();if(!["a","button"].includes(t.localName))return e()})}};D("toolbar",Sr);function so(i){i._disableable=new V(i),i._disabled=i.hasAttribute("disabled");let s=i.querySelector("a")||i;i._disabled&&(h(s,"disabled",""),h(s,"aria-disabled","true")),!i._disabled&&(s._focusable=new st(s,{disableable:i._disableable}))}var Er=class extends T{boot(){let t=this.hasAttribute("label")?"label":"description",e=this.button(),s=this.overlay();if(e){if(!s)return}else return console.warn("ui-tooltip: no trigger element found",this);s._popoverable=new rt(s,{scope:"tooltip"}),s._anchorable=new it(s,{reference:e,position:this.hasAttribute("position")?this.getAttribute("position"):void 0,gap:this.hasAttribute("gap")?this.getAttribute("gap"):void 0,offset:this.hasAttribute("offset")?this.getAttribute("offset"):void 0}),s._popoverable.onChange(()=>{s._popoverable.getState()?s._anchorable.reposition():s._anchorable.cleanup()}),this._disableable=new V(this);let r;this._disableable.onInitAndChange(u=>{r&&(r(),r=null),u||(r=we(this,s,{gain(){s._popoverable.setState(!0)},lose(){s._popoverable.setState(!1)},focusable:!0,useSafeArea:!1}).remove)}),new MutationObserver(()=>{this.getAttribute("draggable")==="true"&&s._popoverable.setState(!1)}).observe(this,{attributeFilter:["draggable"]});let n=K(s,"tooltip"),o=this.hasAttribute("interactive"),l=this.hasAttribute("label")||e.textContent.trim()==="";o?(h(e,"aria-controls",n),h(e,"aria-expanded","false"),s._popoverable.onChange(()=>{s._popoverable.getState()?h(e,"aria-expanded","true"):h(e,"aria-expanded","false")})):(l?h(e,"aria-labelledby",n):h(e,"aria-describedby",n),h(s,"aria-hidden","true")),h(s,"role","tooltip")}button(){return this.firstElementChild}overlay(){return this.lastElementChild!==this.button()&&this.lastElementChild.tagName!=="TEMPLATE"&&this.lastElementChild}};D("tooltip",Er);var J={STATE_CHANGED:"stateChanged",DESKTOP_COLLAPSED:"desktopCollapsed",DESKTOP_EXPANDED:"desktopExpanded",MOBILE_COLLAPSED:"mobileCollapsed",MOBILE_EXPANDED:"mobileExpanded",VIEWPORT_ENTER_MOBILE:"viewportEnterMobile",VIEWPORT_ENTER_DESKTOP:"viewportEnterDesktop"},_r=class extends T{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 Ht,this.state={active:!1,viewportDesktop:!0,viewportMobile:!1,collapsedMobile:!0,collapsedDesktop:!1},this.config.sticky&&this.setStickyPositionStyles(),this.hasAttribute("collapsible")){let t=this.getAttribute("collapsible");t==="true"?this.config.collapsible=!0:t==="false"?this.config.collapsible=!1:t==="mobile"&&(this.config.collapsible="mobile")}this.config.persist&&this.config.collapsible&&(this.state.collapsedDesktop=JSON.parse(localStorage.getItem("flux-sidebar-collapsed-desktop"))),this.removeAttribute("data-flux-sidebar-cloak"),this.observable.subscribe(J.VIEWPORT_ENTER_DESKTOP,()=>{let t=bs(this,"transition","none");setTimeout(t),this.state.viewportDesktop=!0,this.state.viewportMobile=!1,this.observable.notify(J.STATE_CHANGED)}),this.observable.subscribe(J.VIEWPORT_ENTER_MOBILE,()=>{let t=bs(this,"transition","none");setTimeout(t),this.state.viewportDesktop=!1,this.state.viewportMobile=!0,this.observable.notify(J.STATE_CHANGED)}),this.observable.subscribe(J.DESKTOP_COLLAPSED,()=>{this.state.collapsedDesktop=!0,this.observable.notify(J.STATE_CHANGED)}),this.observable.subscribe(J.DESKTOP_EXPANDED,()=>{this.state.collapsedDesktop=!1,this.observable.notify(J.STATE_CHANGED)}),this.observable.subscribe(J.MOBILE_COLLAPSED,()=>{this.state.collapsedMobile=!0,this.observable.notify(J.STATE_CHANGED)}),this.observable.subscribe(J.MOBILE_EXPANDED,()=>{this.state.collapsedMobile=!1,this.observable.notify(J.STATE_CHANGED)}),this.observable.subscribe(J.STATE_CHANGED,()=>{this.config.persist&&localStorage.setItem("flux-sidebar-collapsed-desktop",JSON.stringify(this.state.collapsedDesktop)),this.updateDataAttributes(this)}),new kr(this.observable,this.config),document.addEventListener("flux-sidebar-toggle",()=>{this.state.viewportDesktop?this.state.collapsedDesktop?this.observable.notify(J.DESKTOP_EXPANDED):this.observable.notify(J.DESKTOP_COLLAPSED):this.state.collapsedMobile?this.observable.notify(J.MOBILE_EXPANDED):this.observable.notify(J.MOBILE_COLLAPSED)}),this.addEventListener("click",t=>{t.target===this&&this.state.collapsedDesktop&&this.observable.notify(J.DESKTOP_EXPANDED)}),this.addEventListener("mouseenter",t=>{this.state.active=!0,this.observable.notify(J.STATE_CHANGED)}),this.addEventListener("mouseleave",t=>{this.state.active=!1,this.observable.notify(J.STATE_CHANGED)}),this.addEventListener("focusin",t=>{this.state.active=!0,this.observable.notify(J.STATE_CHANGED)}),this.addEventListener("focusout",t=>{this.state.active=!1,this.observable.notify(J.STATE_CHANGED)})}setStickyPositionStyles(){let t=this.offsetTop,e=window.pageYOffset;e>0&&(window.scrollTo(window.scrollX,0),t=this.offsetTop,window.scrollTo(window.scrollX,e)),this.style.position="sticky",this.style.top=t+"px",this.style.maxHeight=`calc(100dvh - ${t}px)`}updateDataAttributes(t){let e=this.config.collapsible===!0;e&&(this.state.active?h(t,"data-flux-sidebar-active",""):dt(t,"data-flux-sidebar-active")),this.state.viewportDesktop?(dt(t,"data-flux-sidebar-on-mobile"),h(t,"data-flux-sidebar-on-desktop",""),dt(t,"data-flux-sidebar-collapsed-mobile"),this.state.collapsedDesktop?e&&h(t,"data-flux-sidebar-collapsed-desktop",""):dt(t,"data-flux-sidebar-collapsed-desktop")):(dt(t,"data-flux-sidebar-on-desktop"),h(t,"data-flux-sidebar-on-mobile",""),dt(t,"data-flux-sidebar-collapsed-desktop"),this.state.collapsedMobile?h(t,"data-flux-sidebar-collapsed-mobile",""):dt(t,"data-flux-sidebar-collapsed-mobile"))}},kr=class{constructor(t,{breakpoint:e}){this.observable=t,this.breakpoint=e,this.watchForViewportChanges()}watchForViewportChanges(){let t=typeof this.breakpoint=="number"?`${this.breakpoint}px`:this.breakpoint,e=matchMedia(`(min-width: ${t})`);e.matches?this.observable.notify(J.VIEWPORT_ENTER_DESKTOP):this.observable.notify(J.VIEWPORT_ENTER_MOBILE),e.addEventListener("change",()=>{e.matches?this.observable.notify(J.VIEWPORT_ENTER_DESKTOP):this.observable.notify(J.VIEWPORT_ENTER_MOBILE)})}},Cr=class extends T{mount(){let t=this.querySelector("button,ui-button");y(t||this,"click",()=>{this.dispatchEvent(new CustomEvent("flux-sidebar-toggle",{bubbles:!0}))}),queueMicrotask(()=>{let e=document.querySelector("ui-sidebar");e.updateDataAttributes(this),e.observable.subscribe(J.STATE_CHANGED,(
131)=>{e.updateDataAttributes(this)})})}};D("sidebar",_r);D("sidebar-toggle",Cr);var Dr=class extends T{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(ji(s[t]+e,this.config.min,this.config.max))},onChange:t=>{this.state.onChanges.push(t)}},this._controllable=new Y(this),this._disableable=new V(this),this._submittable=new Q(this,{name:this.getAttribute("name"),value:this.state.getValue()}),this.state.onChange(t=>{this.repositionThumbsAndIndicator(),this.updateTicks(),this._submittable.update(t),this.config.range&&(this.inputEls[0].ariaValueText=`${t[0]} ${this.config.rangeStartString}`,this.inputEls[1].ariaValueText=`${t[1]} ${this.config.rangeEndString}`)}),this._controllable.initial(t=>t&&this.state.setValue(t)),this._controllable.getter(()=>this.state.getValue()),this._controllable.setter(t=>this.state.setValue(t)),this._disableable.onInitAndChange(t=>{t?this.inputEls.forEach(e=>e.setAttribute("disabled","")):this.inputEls.forEach(e=>e.removeAttribute("disabled"))}),this.setNativeInputAttributes(),this.setInitialValue(),this.setupExtraInputIfExists(),this.repositionTicks(),this.registerNativeInputListeners(),this.registerPointerListeners(),this.registerMutationObserver(),new ResizeObserver(()=>{this.repositionThumbsAndIndicator(),this.repositionTicks()}).observe(this)}mount(){this.setupFieldIfExists()}setNativeInputAttributes(){for(let t=0;t<this.inputEls.length;t++)this.inputEls[t].setAttribute("min",this.config.min),this.inputEls[t].setAttribute("max",this.config.max),this.inputEls[t].setAttribute("step",this.config.step)}setInitialValue(){this.hasAttribute("value")?this.state.setValueFromString(this.getAttribute("value")):this.state.setValue(this.state.getValue())}setupExtraInputIfExists(){let t=this.closest("ui-field")?.querySelector("[data-flux-input] > input");t&&(this.extraInput=t,this._disableable.onInitAndChange(e=>{e?h(t,"disabled",""):x(t,"disabled")}))}setupFieldIfExists(){let t=this.closest("ui-field");t&&queueMicrotask(()=>{t.label&&y(t.label,"click",()=>this.inputEls[0].focus()),t.label&&this.extraInput&&h(this.extraInput,"aria-labelledby",t.label.id),t.description&&this.extraInput&&h(this.extraInput,"aria-describedby",t.description.id);for(let e=0;e<this.inputEls.length;e++)t.label&&h(this.inputEls[e],"aria-labelledby",t.label.id),t.description&&h(this.inputEls[e],"aria-describedby",t.description.id)})}registerNativeInputListeners(){for(let t=0;t<this.inputEls.length;t++)y(this.inputEls[t],"input",e=>{e.stopPropagation()}),y(this.inputEls[t],"change",e=>{let s=parseFloat(e.target.value);this.config.range?(s=this.constrainRangeValue(t,s),this.state.setValueInRange(t,s)):this.state.setValue(s),this._controllable.dispatch(),e.stopPropagation()}),y(this.inputEls[t],"keydown",e=>{if(e.shiftKey){switch(e.key){case"ArrowUp":this.state.increment(t,this.config.bigStep);break;case"ArrowDown":this.state.increment(t,this.config.bigStep*-1);break;case"ArrowRight":this.state.increment(t,this.config.bigStep*(Lt(this)?-1:1));break;case"ArrowLeft":this.state.increment(t,this.config.bigStep*(Lt(this)?1:-1));break;default:return}this._controllable.dispatch(),e.preventDefault()}}
131),y(this.inputEls[t],"focus",()=>this.raiseThumb(t)),y(this.inputEls[t],"blur",()=>this.lowerThumb(t))}registerPointerListeners(){y(this,"pointerdown",t=>{if(this._disableable.isDisabled()||t.button!==0)return;let e=this.getThumbIndexFromX(t.clientX),s=this.thumbs[e].getBoundingClientRect(),r=s.left+s.width/2,a=0;Math.abs(t.clientX-r)<s.width/2&&(a=t.clientX-r);let n=this.state.getValueAsArray(),o=this.state.getValueAsArray(),l=u=>{let d=this.getValueFromX(u.clientX-a);this.config.range&&(d=this.constrainRangeValue(e,d));let c=[...o];c[e]=d,o.toString()!==c.toString()&&(o=c,this.config.range?this.state.setValueInRange(e,d):this.state.setValue(d),this.dispatchEvent(new Event("input",{bubbles:!1,cancelable:!0})))};l(t),this.setPointerCapture(t.pointerId),requestAnimationFrame(()=>{this.inputEls[e].focus()}),document.addEventListener("pointermove",l),document.addEventListener("pointerup",u=>{document.removeEventListener("pointermove",l),this.releasePointerCapture(u.pointerId),requestAnimationFrame(()=>{this.lowerThumb(e)}),n.toString()!==o.toString()&&this.dispatchEvent(new Event("change",{bubbles:!1,cancelable:!0}))},{once:!0})})}registerMutationObserver(){new MutationObserver(()=>{this.config.min=this.min(),this.config.max=this.max(),this.config.step=this.step(),this.config.bigStep=this.bigStep(),this.config.minStepsBetween=this.minStepsBetween(),this.setNativeInputAttributes(),this.repositionThumbsAndIndicator(),this.repositionTicks()}).observe(this,{attributes:!0,attributeFilter:["min","max","step","big-step","min-steps-between"]})}repositionThumbsAndIndicator(){if(this.config.range){let t=this.state.getValue(),e=this.getPercentageFromValue(t[0]),s=this.getPercentageFromValue(t[1]);this.thumbs[0].style.insetInlineStart=e+"%",this.thumbs[1].style.insetInlineStart=s+"%",this.indicator.style.insetInlineStart=e+"%",this.indicator.style.insetInlineEnd=100-s+"%"}else{let t=this.state.getValue(),e=this.getPercentageFromValue(t);this.thumbs[0].style.insetInlineStart=e+"%",this.indicator.style.insetInlineStart=0,this.indicator.style.insetInlineEnd=100-e+"%"}}
131repositionTicks(){this.querySelectorAll("[data-flux-slider-tick]").forEach(t=>{let e=parseFloat(t.getAttribute("data-value"));if(isNaN(e))return;let s=this.getPercentageFromValue(e);h(t,"style",`inset-inline-start: ${s}%`)})}updateTicks(){let t=this.state.getValueAsArray(),e=this.config.range?t:[this.state.min,t[0]];this.querySelectorAll("[data-flux-slider-tick]").forEach(s=>{let r=parseFloat(s.getAttribute("data-value"));if(!isNaN(r)){for(let a=0;a<t.length;a++)t[a]==r?h(s,"data-current",""):x(s,"data-current");r>=e[0]||r<=e[1]?h(s,"data-active",""):x(s,"data-active")}})}raiseThumb(t){this.thumbs[t].style.zIndex=10}lowerThumb(t){this.thumbs[t].style.zIndex=null}getThumbIndexFromX(t){let e,s;for(let r=0;r<this.thumbs.length;r++){let a=this.thumbs[r].getBoundingClientRect(),n=(a.left+a.right)/2,o=Math.abs(n-t);s&&Math.abs(s-o)<a.width/2&&this.getBoundingClientRect().right-a.right<a.width/4||(s===void 0||o<=s)&&(s=o,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=ji(e/s,0,100),a=this.getBoundingClientRect(),o=this.thumbs[0].getBoundingClientRect().width/2;return((a.width-o*2)*r+o)/a.width*100}getValueFromX(t){let e=this.config.min,s=this.config.max,r=this.config.step,a=this.getBoundingClientRect(),o=this.thumbs[0].getBoundingClientRect().width/2,l=a.width-o*2,u=a.left+o,d=t-u,c=ji(d/l,0,1);c=Lt(this)?1-c:c;let f=(s-e)*c+e;return f=ro(f,r,e),f=ji(f,e,s),f}constrainRangeValue(t,e){let s=[...this.state.getValue()];return s[t]=e,(s[1]-s[0])/this.config.step<this.config.minStepsBetween?[s[1]-this.config.minStepsBetween*this.config.step,s[0]+this.config.minStepsBetween*this.config.step][t]:e}range(){return this.hasAttribute("range")}min(){return this.hasAttribute("min")?parseFloat(this.getAttribute("min")):0}max(){return this.hasAttribute("max")?parseFloat(this.getAttribute("max")):100}step(){if(!this.hasAttribute("step"))return 1;let t=parseFloat(this.getAttribute("step"));return t<=0||isNaN(t)?1:t}bigStep(){if(!this.hasAttribute("big-step"))return this.step();let t=parseFloat(this.getAttribute("big-step"));return t<=0||isNaN(t)?this.step():t}minStepsBetween(){return this.hasAttribute("min-steps-between")?parseFloat(this.getAttribute("min-steps-between")):0}rangeStartString(){return this.getAttribute("data-flux-aria-range-start")||"start range"}rangeEndString(){return this.getAttribute("data-flux-aria-range-end")||"end range"}};function ji(i,t,e){return Math.min(Math.max(i,t),e)}function ro(i,t,e){let s;if(Math.abs(t)>=1)s=t.toString().split(".")[1]?.length||0;else{let a=t.toExponential().split("e-"),n=a[0].split(".")[1];s=(n?n.length:0)+parseInt(a[1],10)}let r=Math.round((i-e)/t)*t+e;return Number(r.toFixed(s))}D("slider",Dr);var Ir=class extends X{boot(){let t=this;this._disableable=new V(this),this._selectable=new H(t,{toggleable:!0,dataAttr:"data-checked",ariaAttr:"aria-checked",value:this.hasAttribute("value")?this.getAttribute("value"):null,label:this.hasAttribute("label")?this.getAttribute("label"):null,selectedInitially:this.hasAttribute("checked")}),this._submittable=new Q(this,{name:this.getAttribute("name"),value:this.getAttribute("value")??"on",includeWhenEmpty:!1,shouldUpdateValue:!1}),this.value=this._selectable.getValue(),this._detangled=G(),this._selectable.onChange(this._detangled(()=>{this.dispatchEvent(new Event("input",{bubbles:!1,cancelable:!0})),this.dispatchEvent(new Event("change",{bubbles:!1,cancelable:!0}))})),h(t,"role","switch"),this._selectable.onInitAndChange(()=>{this._submittable.update(this._selectable.getState())}),this._disableable.onInitAndChange(e=>{e?x(t,"tabindex","0"):h(t,"tabindex","0")}),y(t,"click",this._disableable.disabled(e=>{e.preventDefault(),e.stopPropagation()}),{capture:!0}),y(t,"click",this._disableable.enabled(e=>{this._selectable.press()})),y(t,"keydown",this._disableable.enabled(e=>{e.key==="Enter"&&(this._selectable.press(),e.preventDefault(),e.stopPropagation())})),y(t,"keydown",this._disableable.enabled(e=>{e.key===" "&&(e.preventDefault(),e.stopPropagation())})),y(t,"keyup",this._disableable.enabled(e=>{e.key===" "&&(this._selectable.press(),e.preventDefault(),e.stopPropagation())})),ao(t)}get checked(){return this._selectable.isSelected()}set checked(t){this._detangled(()=>{t?this._selectable.select():this._selectable.deselect()})()}};function ao(i){i.closest("label")?.addEventListener("click",t=>{i.contains(t.target)||i.click()})}D("switch",Ir);var Tr=class i extends T{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 X)&&this.hasAttribute("disabled")&&this.control.setAttribute("disabled","")))}associateDescriptionWithControl(t){t&&this.description&&(this.control=t,!this.control.hasAttribute("aria-describedby")&&h(this.elOrButton(this.control),"aria-describedby",this.description.id))}associateLabel(t){this.label=t,y(t,"click",e=>{["a","button","ui-button"].includes(e.target.localName)||this.focusOrTogggle(this.control)}),this.control&&this.associateLabelWithControl(this.control)}associateDescription(t){this.description=t,this.control&&this.associateDescriptionWithControl(this.control)}fieldWalker(){return tt(this,(t,{skip:e,reject:s})=>{if(t instanceof i&&t!==this||t.parentElement.localName==="ui-editor"&&t!==this)return s()})}isControl(t){return!!(t instanceof X||t.matches("input, textarea, select"))}focusOrTogggle(t){if(!t||t.disabled||t.hasAttribute("disabled"))return;t.localName==="input"&&["checkbox","radio"].includes(t.type)||["ui-switch","ui-radio","ui-checkbox"].includes(t.localName)?(t.click(),t.focus()):t.localName==="input"&&["file"].includes(t.type)?t.click():["ui-select","ui-date-picker","ui-time-picker","ui-otp"].includes(t.localName)?t.trigger()?.focus():["ui-editor"].includes(t.localName)?t.focus():["ui-composer"].includes(t.localName)?t.focusInput():t.focus()}elOrButton(t){return t instanceof T&&t.firstElementChild instanceof HTMLButtonElement?t.firstElementChild:t}},Lr=class extends T{mount(){K(this,"label"),h(this,"aria-hidden","true"),this.closest("ui-field")?.associateLabel(this)}},Mr=class extends T{mount(){K(this,"description"),h(this,"aria-hidden","true"),this.closest("ui-field")?.associateDescription(this)}};D("field",Tr);D("label",Lr);D("description",Mr);var Pr=class extends T{mount(){let t=K(this,"legend"),e=this.closest("fieldset");e&&h(e,"aria-labelledby",t)}};D("legend",Pr);function nn(i){let t={time:co,linear:lo,categorical:no},e=0,s=0,r={},a=(o,l,u)=>{let d=`${o}-${l}`;for(let c in r)c.startsWith(`${o}-`)&&!c.endsWith(String(l))&&delete r[c];
131return r[d]||(r[d]=u()),r[d]},n={locale:i.locale,data:[],stacksMetadata:i.stacksMetadata,groupsMetadata:i.groupsMetadata,width:i.width,height:i.height,inset:i.inset,axes:{x:{axis:"x",key:i.axes.x.key,format:i.axes.x.format,inset:{start:0,end:0},position:i.axes.x.position||"bottom",tickStart:i.axes.x.tickStart,tickEnd:i.axes.x.tickEnd,tickCount:i.axes.x.tickCount,tickStep:i.axes.x.tickStep,tickValues:i.axes.x.tickValues,tickSuffix:i.axes.x.tickSuffix,tickPrefix:i.axes.x.tickPrefix,asArea:i.axes.x.asArea,get rawValues(){return a("x.rawValues",e,()=>n.data.map(o=>o[this.key]))},get type(){return a("x.type",e,()=>i.axes.x.scale||(this.rawValues.every(o=>uo(o))?"time":"categorical"))},get interval(){return a("x.interval",e,()=>i.axes.x.interval||"auto")},get values(){return a("x.values",e,()=>this.rawValues.map(o=>this.type==="time"?Zi(o):this.type==="linear"?Number(o):o))},get points(){return a("x.points",e+s,()=>n.data.map(o=>{let{start:l,center:u,end:d,width:c}=this.scale(o[this.key],{area:this.asArea});return{start:l,center:u,end:d,width:c,datum:o}}))},get ticks(){return a("x.ticks",e,()=>{let o=en(n.data,this,Ji(this.type,this.values)),l=sn(o,this.type,this.format,this.tickSuffix,this.tickPrefix,this.interval,n.locale);return o.map((u,d)=>({value:u,label:l[d]}))})},get domain(){return a("x.domain",e,()=>Ji(this.type,[...this.ticks.map(o=>o.value),...this.values]))},get range(){return a("x.range",s,()=>[n.inset.left+this.inset.start,n.width-n.inset.right-this.inset.end])},get scale(){return a("x.scale",s+e,()=>t[this.type](this.domain,this.range,this.values))}},y:{axis:"y",keys:i.axes.y.keys,format:i.axes.y.format,inset:{start:0,end:0},position:i.axes.y.position||"left",tickStart:i.axes.y.tickStart,tickEnd:i.axes.y.tickEnd,tickCount:i.axes.y.tickCount,tickStep:i.axes.y.tickStep,tickValues:i.axes.y.tickValues,tickSuffix:i.axes.y.tickSuffix,tickPrefix:i.axes.y.tickPrefix,get values(){return a("y.values",e,()=>{let o=n.data.flatMap(d=>n.groupsMetadata.reduce((c,f)=>(f.children.forEach(b=>{if(b.type==="bar"){if(!b.field||d[b.field]===void 0)return;c.push(d[b.field])}if(b.type==="stack"){let p=Number(b.gap.replace("px","")),w=0,A=0,_=!1,L=!1;b.children.forEach(O=>{if(O.type==="bar"){if(!O.field||d[O.field]===void 0)return;let E=d[O.field];E>=0?(_&&(w+=p),w+=E,_=!0):(L&&(A-=p),A+=E,L=!0)}}),_&&c.push(w),L&&c.push(A)}}),c),[])),l=n.data.flatMap(d=>n.stacksMetadata.reduce((c,f)=>{let b=Number(f.gap.replace("px","")),p=0,w=0,A=!1,_=!1;return f.children.forEach(L=>{if(L.type==="bar"){if(!L.field||d[L.field]===void 0)return;let O=d[L.field];O>=0?(A&&(p+=b),p+=O,A=!0):(_&&(w-=b),w+=O,_=!0)}}),A&&c.push(p),_&&c.push(w),c},[])),u=n.data.flatMap(d=>this.keys.reduce((c,f)=>(d[f]===void 0||c.push(d[f]),c),[]));return[...o,...l,...u]})},get type(){return a("y.type",e,()=>i.axes.y.scale||"linear")},get interval(){return a("y.interval",e,()=>i.axes.y.interval||"auto")},get ticks(){return a("y.ticks",e,()=>{let o=en(n.data,this,Ji(this.type,this.values)),l=sn(o,this.type,this.format,this.tickSuffix,this.tickPrefix,this.interval,n.locale);return o.map((u,d)=>({value:u,label:l[d]}))})},get domain(){return a("y.domain",e,()=>Ji(this.type,[...this.ticks.map(o=>o.value),...this.values]))},get range(){return a("y.range",s,()=>[n.height-n.inset.bottom-this.inset.end,n.inset.top+this.inset.start])},get scale(){return a("y.scale",s+e,()=>t[this.type](this.domain,this.range,this.values))}}},get series(){return a("series",e+s,()=>this.axes.y.keys.reduce((o,l)=>{if(!n.data[0].hasOwnProperty(l))return console.warn(`ui-chart: series field "${l}" does not exist`),o;let u=n.data.map(c=>({x:n.axes.x.scale(c[n.axes.x.key],{area:n.axes.x.asArea}).center,y:n.axes.y.scale(c[l]).center,datum:c})),d={field:l,values:n.data.map(c=>c[l]),bars({barWidth:c,minHeight:f,radius:b}){let{start:p,center:w,width:A}=n.axes.x.scale(n.axes.x.domain[0],{area:n.axes.x.asArea}),_=b;c.match(/^(\d+)%$/)?c=A*Number(c.replace("%",""))/100:c=Number(c.replace("px",""));let L=(A-c)/2;return n.data.map(O=>{let E=O[l],{start:m}=n.axes.x.scale(O[n.axes.x.key],{area:n.axes.x.asArea}),q=m+L,S=E>=0?n.axes.y.scale(E).center:n.axes.y.scale(0).center,N=E>=0?n.axes.y.scale(0).center-S:n.axes.y.scale(E).center-S,F=c,v=_;return N<f&&(S-=f-N,N=f),E<0&&(v={topLeft:v.bottomLeft,topRight:v.bottomRight,bottomRight:v.topRight,bottomLeft:v.topLeft}),{x:q,y:S,width:F,height:N,path:()=>Oe(q,S,F,N,v)}})},linePath(c="smooth"){let f=this.points.map(b=>[b.x,b.y]);return{smooth:rn,none:an}[c](f)},areaPath(c="smooth"){let f={smooth:rn,none:an}[c](this.points.map(_=>[_.x,_.y])),b=this.points[0].x,p=this.points[this.points.length-1].x,w=n.axes.y.scale(n.axes.y.domain[0]).center;return`${f} L${p},${w} L${b},${w} Z`},points:u};return o[l]=d,o},{}))},get stackedSeries(){return a("stackedSeries",e+s,()=>{let o={},l=[];return n.stacksMetadata.map(u=>
131(u.children.forEach(c=>{if(c.type==="bar"){if(!c.field)return;if(!n.data[0].hasOwnProperty(c.field)){console.warn(`ui-chart: series field "${c.field}" does not exist`);return}o[c.field]=n.data.map(f=>f[c.field]),l.push(c)}}),{bars(){let{start:c,center:f,width:b}=n.axes.x.scale(n.axes.x.domain[0],{area:n.axes.x.asArea}),p=u.width??"90%";p.match(/^(\d+)%$/)?p=b*Number(p.replace("%",""))/100:p=Number(p.replace("px",""));let w=(b-p)/2,A=Number(u.gap.replace("px","")),_=[],L=[],O=u.radius,E=[],m=[];return O&&l.forEach(q=>{q.type==="bar"&&o[q.field].forEach((S,N)=>{S>=0?(E[N]=q.field,m[N]===void 0&&(m[N]=q.field)):(m[N]=q.field,E[N]===void 0&&(E[N]=q.field))})}),l.reduce((q,S)=>{if(S.type==="bar"){let N=[];o[S.field].forEach((F,v)=>{_[v]===void 0&&(_[v]=0,L[v]=0);let{start:M}=n.axes.x.scale(n.data[v][n.axes.x.key],{area:n.axes.x.asArea}),k=M+w,C=F>=0?n.axes.y.scale(F).center:n.axes.y.scale(0).center,I=F>=0?n.axes.y.scale(0).center-C:n.axes.y.scale(F).center-C,P=p,B=Number(S.minHeight.replace("px","")),W=S.radius;if(O){let U=S.field===E[v],z=S.field===m[v],Z={topLeft:0,topRight:0,bottomLeft:0,bottomRight:0};U&&(Z.topLeft=O.topLeft,Z.topRight=O.topRight),z&&(Z.bottomLeft=O.bottomLeft,Z.bottomRight=O.bottomRight),F<0?W={topLeft:Z.bottomLeft,topRight:Z.bottomRight,bottomLeft:Z.topLeft,bottomRight:Z.topRight}:W=Z}C=F>=0?C-_[v]:C+L[v],I<B&&(C-=B-I,I=B),F<0&&(W={topLeft:W.bottomLeft,topRight:W.bottomRight,bottomRight:W.topRight,bottomLeft:W.topLeft});let R={x:k,y:C,width:P,height:I,path:()=>Oe(k,C,P,I,W)};F>=0?_[v]+=I+A:L[v]+=I+A,N.push(R)}),q[S.field]=N}return q},{})}}))})},get groupedSeries(){return a("groupedSeries",e+s,()=>n.groupsMetadata.map(o=>{let l={},u=[];return o.children.forEach(c=>{if(c.type==="bar"){if(!c.field)return;if(!n.data[0].hasOwnProperty(c.field)){console.warn(`ui-chart: series field "${c.field}" does not exist`);return}l[c.field]=n.data.map(f=>f[c.field]),u.push(c)}else if(c.type==="stack"){let f=[];if(c.children.forEach(b=>{if(b.type==="bar"){if(!b.field)return;if(!n.data[0].hasOwnProperty(b.field)){console.warn(`ui-chart: series field "${b.field}" does not exist`);return}l[b.field]=n.data.map(p=>p[b.field]),f.push(b)}}),f.length>0){let b={...c,children:f};u.push(b)}}}),{keys:u,values:l,bars(){let{start:c,center:f,width:b}=n.axes.x.scale(n.axes.x.domain[0],{area:n.axes.x.asArea}),p=o.width??"90%";p.match(/^(\d+)%$/)?p=b*Number(p.replace("%",""))/100:p=Number(p.replace("px",""));let w=(b-p)/2,A=o.gap??"2%";A.match(/^(\d+)%$/)?A=p*Number(A.replace("%",""))/100:A=Number(A.replace("px",""));let _=u.length,L=A*(_-1),O=_,E=u.reduce((S,N)=>(N.width&&(N.width.match(/^(\d+)%$/)?S+=p*Number(N.width.replace("%",""))/100:S+=Number(N.width.replace("px","")),O--),S),0),m=O>0?(p-E-L)/O:0;m===0&&(w=(b-(E+L))/2);let q=w;return u.reduce((S,N,F)=>{let v=m;if(N.width&&(N.width.match(/^(\d+)%$/)?v=p*Number(N.width.replace("%",""))/100:v=Number(N.width.replace("px",""))),F>0&&(q+=A),N.type==="bar"){let M=[];l[N.field].forEach((k,C)=>{let{start:I}=n.axes.x.scale(n.data[C][n.axes.x.key],{area:n.axes.x.asArea}),P=I+q,B=k>=0?n.axes.y.scale(k).center:n.axes.y.scale(0).center,W=k>=0?n.axes.y.scale(0).center-B:n.axes.y.scale(k).center-B,R=Number(N.minHeight.replace("px","")),U=N.radius;W<R&&(B-=R-W,W=R),k<0&&(U={topLeft:U.bottomLeft,topRight:U.bottomRight,bottomRight:U.topRight,bottomLeft:U.topLeft});let z={x:P,y:B,width:v,height:W,path:()=>Oe(P,B,v,W,U)};M.push(z)}),S[N.field]=M}if(N.type==="stack"){let M=[],k=Number(N.gap.replace("px","")),C=[],I=[],P=N.radius,B=[],W=[];P&&N.children.forEach(R=>{R.type==="bar"&&l[R.field].forEach((U,z)=>{U>=0?(B[z]=R.field,W[z]===void 0&&(W[z]=R.field)):(W[z]=R.field,B[z]===void 0&&(B[z]=R.field))})}),N.children.forEach(R=>{if(R.type==="bar"){let U=[];l[R.field].forEach((z,Z)=>{C[Z]===void 0&&(C[Z]=0,I[Z]=0);let{start:si}=n.axes.x.scale(n.data[Z][n.axes.x.key],{area:n.axes.x.asArea}),Bt=si+q,nt=z>=0?n.axes.y.scale(z).center:n.axes.y.scale(0).center,Jt=z>=0?n.axes.y.scale(0).center-nt:n.axes.y.scale(z).center-nt,es=Number(R.minHeight.replace("px","")),Wt=R.radius;if(P){let bn=R.field===B[Z],mn=R.field===W[Z],Dt={topLeft:0,topRight:0,bottomLeft:0,bottomRight:0};bn&&(Dt.topLeft=P.topLeft,Dt.topRight=P.topRight),mn&&(Dt.bottomLeft=P.bottomLeft,Dt.bottomRight=P.bottomRight),z<0?Wt={topLeft:Dt.bottomLeft,topRight:Dt.bottomRight,bottomLeft:Dt.topLeft,bottomRight:Dt.topRight}:Wt=Dt}Jt<es&&(nt-=es-Jt,Jt=es),nt=z>=0?nt-C[Z]:nt+I[Z],z<0&&(Wt={topLeft:Wt.bottomLeft,topRight:Wt.bottomRight,bottomRight:Wt.topRight,bottomLeft:Wt.topLeft});let pn={x:Bt,y:nt,width:v,height:Jt,path:()=>Oe(Bt,nt,v,Jt,Wt)};z>=0?C[Z]+=Jt+k:I[Z]+=Jt+k,U.push(pn)}),S[R.field]=U}})}return q+=v,S},{})}}}))},closestXPoint(o){return this.closestXPoints(o)[0]},closestXPoints(o){return a("closestXPoints",e+s+o,()=>{let l=[],u=1/0,d=null;
131return this.axes.x.points.forEach(c=>{let f=Math.abs(c.center-o);f<u&&(u=f,d=c)}),d&&l.push(d),l})},updateDimensions(o,l){this.width=o.width,this.height=o.height,this.inset=l,s++},updateData(o){let l=JSON.parse(JSON.stringify(o));l[0]!==void 0&&typeof l[0]!="object"&&(l=l.map((u,d)=>({value:u}))),l.every(u=>u.index)||l.forEach((u,d)=>{u.index=d}),this.data=l,e++}};return n.updateData(i.data),n}function Ji(i,t){let e=[...new Set(t)];return i==="time"?ho(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 en(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,o=t.tickStart===0||t.tickStart==="0"?0:t.tickStart||"auto",l=t.tickEnd===0||t.tickEnd==="0"?0:t.tickEnd||"auto";o==="auto"&&r>0&&a>0&&(r=0),l!=="auto"&&l!=="max"&&!isNaN(Number(l))&&(a=Number(l));let u=Number(t.interval),d;if(t.interval==="auto"||Number.isNaN(u)){let p=(a-r)/(n-1),w=Math.pow(10,Math.floor(Math.log10(p))),A=p/w;A<1.5?d=1:A<3?d=2:A<7?d=5:d=10,d*=w}else d=u;let c;o==="auto"?c=Math.floor(r/d)*d:o==="min"?c=r:c=Number(o);let f=c;for(;f<=a+d*.1;)f>=r-d*.1&&s.push(f),f+=d;if(l==="max")Math.abs(s[s.length-1]-e[1])>d*.1&&s.push(e[1]);else if(l!=="auto"&&!isNaN(Number(l))){let b=Number(l),p=s.length;s=Array.from({length:p},(w,A)=>c+(b-c)*(A/(p-1)))}if(s.length>n*2){let b=Math.ceil(s.length/n);s=s.filter((p,w)=>w%b===0)}}else if(t.type==="time"){let[r,a]=ln(e[0],e[1],t.tickCount,t.interval,t.asArea);return a}else if(t.type==="categorical"&&(i.forEach(r=>{let a=r[t.key];s.push(a)}),t.tickCount&&s.length>t.tickCount)){let r=Math.ceil(s.length/t.tickCount);s=s.filter((a,n)=>n%r===0)}return s}function sn(i,t,e,s,r,a,n){let o=[];return t==="time"?(e||([e]=ln(i[0],i[i.length-1],null,a)),e={...e,timeZone:"UTC"},o=i.map(l=>new Date(l).toLocaleString(n,e))):t==="linear"?e?o=i.map(l=>l.toLocaleString(n,e)):o=i.map(l=>l.toLocaleString(n)):o=i.map(l=>l+""),r&&(o=o.map(l=>r+l)),s&&(o=o.map(l=>l+s)),o}function no(i,t,e){let s=[...new Set(e)],r=s.length,a=new Map(s.map((n,o)=>[n,o]));return function(n,{area:o=!1}={}){if(n==null)return;let l=a.get(n);if(l===void 0)return;if(o){let c=(t[1]-t[0])/(o?r:r-1),f=t[0]+l*c,b=f+c/2,p=f+c;return{start:f,center:b,end:p,width:c}}let u=(t[1]-t[0])/(r-1),d=t[0]+l*u;return{start:d,center:d,end:d,width:0}}}function lo(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 rn(i){if(i.length<2)return"";let t=l=>l<0?-1:1,e=(l,u,d,c,f,b)=>{let p=d-l,w=f-d,A=(c-u)/(p||w<0&&-0),_=(b-c)/(w||p<0&&-0),L=(A*w+_*p)/(p+w);return(t(A)+t(_))*Math.min(Math.abs(A),Math.abs(_),.5*Math.abs(L))||0},s=(l,u,d,c,f)=>{let b=d-l;return b?(3*(c-u)/b-f)/2:f},r=`M${i[0][0]},${i[0][1]}`;if(i.length===2)return r+`L${i[1][0]},${i[1][1]}`;for(let l=0;l<i.length-2;l++){let u=i[l],d=i[l+1];if(u[0]===d[0]&&u[1]===d[1])continue;
131let c=i[l+2],f=e(u[0],u[1],d[0],d[1],c[0],c[1]),b=(d[0]-u[0])/3,p=u[0]+b,w=u[1]+b*(l===0?s(u[0],u[1],d[0],d[1],f):i[l-1]?e(i[l-1][0],i[l-1][1],u[0],u[1],d[0],d[1]):f),A=d[0]-b,_=d[1]-b*f;r+=`C${p},${w} ${A},${_} ${d[0]},${d[1]}`}let a=i.length,n=i[a-1],o=i[a-2];if(!(n[0]===o[0]&&n[1]===o[1])){let l=e(i[a-3][0],i[a-3][1],o[0],o[1],n[0],n[1]),u=(n[0]-o[0])/3,d=o[0]+u,c=o[1]+u*l,f=n[0]-u,b=n[1]-u*s(o[0],o[1],n[0],n[1],l);r+=`C${d},${c} ${f},${b} ${n[0]},${n[1]}`}return r}function oo(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,o=i[s+1]||r,l=a[0]+(o[0]-n[0])*t,u=a[1]+(o[1]-n[1])*t,d=r[0]-(o[0]-n[0])*t,c=r[1]-(o[1]-n[1])*t;e+=` C ${l} ${u}, ${d} ${c}, ${r[0]} ${r[1]}`}return e}function an(i){return oo(i,0)}function Oe(i,t,e,s,r=null){let a=r?.topLeft??0,n=r?.topRight??0,o=r?.bottomRight??0,l=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),o=Math.min(o,u),l=Math.min(l,u),a===0&&n===0&&o===0&&l===0)return`M${i},${t} h${e} v${s} h-${e} v-${s}`;let d=t,c=t+s,f=a>0,b=n>0,p=o>0,w=l>0,A=i,_=i+e,L="";return f?(L+=`M${A},${d+a}`,L+=`A${a},${a} 0 0 1 ${A+a},${d}`):L+=`M${A},${d}`,b?(L+=`H${_-n}`,L+=`A${n},${n} 0 0 1 ${_},${d+n}`):L+=`H${_}`,p?(L+=`V${c-o}`,L+=`A${o},${o} 0 0 1 ${_-o},${c}`):L+=`V${c}`,w?(L+=`H${A+l}`,L+=`A${l},${l} 0 0 1 ${A},${c-l}`):L+=`H${A}`,L+=`V${d+(f?a:0)}`,L+="Z",L}function uo(i){return i instanceof Date||typeof i=="string"&&i.includes("-")&&!isNaN(Date.parse(i))}function ho(i){return i.sort((t,e)=>typeof t=="string"?t.localeCompare(e):t-e),[Zi(i[0]),Zi(i[i.length-1])]}function co(i,t,e){let s=new Date(i[0]).getTime(),a=new Date(i[1]).getTime()-s,n=t[1]-t[0],l=(e?[...new Set(e)]:[]).length;return function(u,{area:d=!1}={}){if(!u)return;let c=Zi(u);if(isNaN(c.getTime()))return;let f=(c.getTime()-s)/a;if(d){let p=Math.floor(f*l);p=Math.min(Math.max(0,p),l-1);let w=n/l,A=t[0]+p*w,_=A+w/2,L=A+w;return{start:A,center:_,end:L,width:w}}let b=t[0]+f*n;return{start:b,center:b,end:b,width:0}}}function ln(i,t,e,s,r=!1){let a=i,n=t,u=(n-a)/1e3/60,d=u/60,c=d/24,f=c/30,b=c/365,p,w,A;switch(s){case"second":p={hour:"numeric",minute:"numeric",second:"numeric"},w=E=>new Date(Date.UTC(E.getUTCFullYear(),E.getUTCMonth(),E.getUTCDate(),E.getUTCHours(),E.getUTCMinutes(),E.getUTCSeconds()+1)),A=new Date(Date.UTC(a.getUTCFullYear(),a.getUTCMonth(),a.getUTCDate(),a.getUTCHours(),a.getUTCMinutes(),a.getUTCSeconds()));break;case"minute":p={hour:"numeric",minute:"numeric"},w=E=>new Date(Date.UTC(E.getUTCFullYear(),E.getUTCMonth(),E.getUTCDate(),E.getUTCHours(),E.getUTCMinutes()+1)),A=new Date(Date.UTC(a.getUTCFullYear(),a.getUTCMonth(),a.getUTCDate(),a.getUTCHours(),a.getUTCMinutes()));break;case"hour":p={hour:"numeric",minute:"numeric"},w=E=>new Date(Date.UTC(E.getUTCFullYear(),E.getUTCMonth(),E.getUTCDate(),E.getUTCHours()+1)),A=new Date(Date.UTC(a.getUTCFullYear(),a.getUTCMonth(),a.getUTCDate(),a.getUTCHours()));break;case"day":p={day:"numeric"},w=E=>new Date(Date.UTC(E.getUTCFullYear(),E.getUTCMonth(),E.getUTCDate()+1)),A=new Date(Date.UTC(a.getUTCFullYear(),a.getUTCMonth(),a.getUTCDate()));break;case"week":p={day:"numeric",month:"short"},w=E=>new Date(Date.UTC(E.getUTCFullYear(),E.getUTCMonth(),E.getUTCDate()+7)),A=new Date(Date.UTC(a.getUTCFullYear(),a.getUTCMonth(),a.getUTCDate()));break;case"month":p={month:"short",day:"numeric"},w=E=>new Date(Date.UTC(E.getUTCFullYear(),E.getUTCMonth()+1,1)),A=new Date(Date.UTC(a.getUTCFullYear(),a.getUTCMonth(),1));break;case"year":p={year:"numeric"},w=E=>new Date(Date.UTC(E.getUTCFullYear()+1,0,1)),A=new Date(Date.UTC(a.getUTCFullYear(),0,1));break;default:}if(!w)if(d<1){p={hour:"numeric",minute:"numeric"};let E=e?Math.max(1,Math.floor(u/(e-1))):1;w=m=>new Date(Date.UTC(m.getUTCFullYear(),m.getUTCMonth(),m.getUTCDate(),m.getUTCHours(),m.getUTCMinutes()+E)),A=new Date(Date.UTC(a.getUTCFullYear(),a.getUTCMonth(),a.getUTCDate(),a.getUTCHours()))}else if(c<1){p={hour:"numeric"};let E=e?Math.max(1,Math.floor(d/(e-1))):1;w=m=>new Date(Date.UTC(m.getUTCFullYear(),m.getUTCMonth(),m.getUTCDate(),m.getUTCHours()+E)),A=new Date(Date.UTC(a.getUTCFullYear(),a.getUTCMonth(),a.getUTCDate(),0))}else if(c<=7){p={weekday:"short",hour:"numeric"};let E=e?Math.max(1,Math.floor(d/(e-1))):6;w=m=>new Date(Date.UTC(m.getUTCFullYear(),m.getUTCMonth(),m.getUTCDate(),m.getUTCHours()+E)),A=new Date(Date.UTC(a.getUTCFullYear(),a.getUTCMonth(),a.getUTCDate(),0))}else if(c<=30){p={month:"short",day:"numeric"};let E=e?Math.max(1,Math.floor(c/(e-1))):1;w=m=>new Date(Date.UTC(m.getUTCFullYear(),m.getUTCMonth(),m.getUTCDate()+E)),A=new Date(Date.UTC(a.getUTCFullYear(),a.getUTCMonth(),a.getUTCDate()))}else if(f<=6){p={month:"short",day:"numeric"};let E=e?Math.max(1,Math.floor(c/(e-1))):7;w=m=>new Date(Date.UTC(m.getUTCFullYear(),m.getUTCMonth(),m.getUTCDate()+E)),A=new Date(Date.UTC(a.getUTCFullYear(),a.getUTCMonth(),a.getUTCDate()))}else if(b<2){p={month:"short"};let E=e?Math.max(1,Math.floor(f/(e-1))):1;w=m=>new Date(Date.UTC(m.getUTCFullYear(),m.getUTCMonth()+E,1)),A=new Date(Date.UTC(a.getUTCFullYear(),a.getUTCMonth()))}else{p={year:"numeric"};let E=e?Math.max(1,Math.floor(b/(e-1))):1;w=m=>new Date(Date.UTC(m.getUTCFullYear()+E,0,1)),A=new Date(Date.UTC(a.getUTCFullYear(),0,1))}let _=a;if(r){let E=w(A);for(;E<=a;)A=E,E=w(A);_=A}let L=[_],O=_;for(;O<=n;)O=w(O),O<=n&&L.push(new Date(O.getTime()));return[p,L]}function Zi(i){if(i instanceof Date)return i;let{year:t,month:e,day:s,hour:r,minute:a,second:n,millisecond:o}=fo(i);return new Date(Date.UTC(t,e-1,s,r,a,n,o))}function fo(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 Or=class extends HTMLElement{constructor(){super(),this.querySelectorAll("[data-appended]").forEach(s=>s.remove());let t=this.querySelector('template[name="svg"]'),e=Si(t);t.after(e),this.init(t,e)}init(t,e){this._initialized||(this._data=this.hasAttribute("value")?JSON.parse(this.getAttribute("value")):[],this._observable=new Ht,this._selectable={getState:()=>this._data,setState:S=>{this._data=S,this._observable.notify("data",this._data)}},this._controllable=new Y(this),this._controllable.initial(S=>S&&this._selectable.setState(S)),this._controllable.getter(()=>this._selectable.getState()),this._controllable.setter(S=>{this._selectable.setState(S)}),this._initialized=!0);let s=this.hasAttribute("locale")?this.getAttribute("locale"):Ai(),r=!1,a={svg:t,bars:{},lines:{},areas:{},points:{},groups:[],stacks:[],cursor:t.content.querySelector('template[name="cursor"]'),zeroLine:t.content.querySelector('template[name="zero-line"]'),axes:{x:{template:t.content.querySelector('template[name="axis"][axis="x"]'),axisLine
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(S=>{a.groups.push(S)}),t.content.querySelectorAll('template[name="stack"]:not(template[name="group"] template[name="stack"])').forEach(S=>{a.stacks.push(S)}),t.content.querySelectorAll('template[name="bar"]:not(template[name="stack"] template[name="bar"]):not(template[name="group"] template[name="bar"])').forEach(S=>{a.bars[S.getAttribute("field")]=S,r=!0}),t.content.querySelectorAll('template[name="line"]').forEach(S=>{a.lines[S.getAttribute("field")]=S}),t.content.querySelectorAll('template[name="area"]').forEach(S=>{a.areas[S.getAttribute("field")]=S}),t.content.querySelectorAll('template[name="point"]').forEach(S=>{a.points[S.getAttribute("field")]=S});let n=()=>{},o=()=>{},l=()=>{},u=()=>{},d=null,c="line",f=null,b=null,p=null,w=[];t.content.querySelectorAll('template[name="stack"]:not(template[name="group"] template[name="stack"])').forEach(S=>{let N={width:S.getAttribute("width")??"90%",gap:S.getAttribute("gap")??"0",radius:S.hasAttribute("radius")?fe(S.getAttribute("radius")):null,children:[]};S.querySelectorAll('template[name="bar"]').forEach(F=>{let v={type:"bar",field:F.getAttribute("field"),width:F.getAttribute("width"),minHeight:F.getAttribute("min-height")??"0",radius:fe(F.getAttribute("radius")??"0")};N.children.push(v),r=!0}),w.push(N)});let A=[];t.content.querySelectorAll('template[name="group"]').forEach(S=>{let N={width:S.getAttribute("width")??"90%",gap:S.getAttribute("gap")??"2%",children:[]};S.querySelectorAll('template[name="stack"], template[name="bar"]:not(template[name="stack"] template[name="bar"])').forEach(F=>{let v={};F.getAttribute("name")==="stack"?(v={type:"stack",width:F.getAttribute("width"),gap:F.getAttribute("gap")??"0",radius:F.hasAttribute("radius")?fe(F.getAttribute("radius")):null,children:[]},F.querySelectorAll('template[name="bar"]').forEach(M=>{let k={type:"bar",field:M.getAttribute("field"),width:M.getAttribute("width"),minHeight:M.getAttribute("min-height")??"0",radius:fe(M.getAttribute("radius")??"0")};v.children.push(k),r=!0})):F.getAttribute("name")==="bar"&&(v={type:"bar",field:F.getAttribute("field"),width:F.getAttribute("width"),minHeight:F.getAttribute("min-height")??"0",radius:fe(F.getAttribute("radius")??"4 0")},r=!0),N.children.push(v)}),A.push(N)}),f=document.createElementNS("http://www.w3.org/2000/svg","rect"),f.setAttribute("data-overlay",""),f.setAttribute("fill","none"),f.setAttribute("pointer-events","all"),f.addEventListener("mousemove",fs(function(S){n(S),o(S),l(S),u(S)},1)),f.addEventListener("mouseleave",()=>{n(null),o(null),l(null),u(null)}),e.appendChild(f),a.cursor&&(d=ct(a.cursor),d.setAttribute("data-cursor",""),e.appendChild(d));let _={left:8,right:8,top:8,bottom:8};if(a.svg?.hasAttribute("gutter")){let S=a.svg?.getAttribute("gutter").split(" ").map(N=>N.replace("px","")).map(Number);S.length===1?(_.top=S[0],_.right=S[0],_.bottom=S[0],_.left=S[0]):S.length===2?(_.top=S[0],_.right=S[1],_.bottom=S[0],_.left=S[1]):S.length===3?(_.top=S[0],_.right=S[1],_.bottom=S[2],_.left=S[1]):S.length===4&&(_.top=S[0],_.right=S[1],_.bottom=S[2],_.left=S[3])}let[L,O]=po(e,r),E=e.parentElement.getBoundingClientRect();if(E.width===0||E.height===0){let S=new ResizeObserver(N=>{let F=N[0];F.contentRect.width>0&&F.contentRect.height>0&&(S.disconnect(),this.init(t,e))});S.observe(e.parentElement);return}a.tooltip&&(b=Si(a.tooltip),a.tooltip.after(b)),a.summary&&(p=Si(a.summary),a.summary.after(p));let m=nn({locale:s,data:this._data,stacksMetadata:w,groupsMetadata:A,width:E.width,height:E.height,inset:{left:0,right:0,top:0,bottom:0}
131,axes:{x:{key:L,format:a.axes.x.template?.hasAttribute("format")?JSON.parse(a.axes.x.template?.getAttribute("format")):null,scale:a.axes.x.template?.getAttribute("scale"),interval:a.axes.x.template?.getAttribute("interval"),position:a.axes.x.template?.getAttribute("position"),tickCount:a.axes.x.template?.getAttribute("tick-count")||a.axes.x.tickLabel?.getAttribute("target-tick-count"),tickStart:a.axes.x.template?.getAttribute("tick-start"),tickEnd:a.axes.x.template?.getAttribute("tick-end"),tickStep:a.axes.x.template?.getAttribute("tick-step")?Number(a.axes.x.template?.getAttribute("tick-step")):null,tickSuffix:a.axes.x.template?.getAttribute("tick-suffix"),tickPrefix:a.axes.x.template?.getAttribute("tick-prefix"),tickValues:a.axes.x.template?.hasAttribute("tick-values")?JSON.parse(a.axes.x.template?.getAttribute("tick-values")):null,asArea:r||a.cursor?.innerHTML?.match(/type="([^"]+)"/)?.[1]==="area"},y:{keys:O,format:a.axes.y.template?.hasAttribute("format")?JSON.parse(a.axes.y.template?.getAttribute("format")):null,scale:a.axes.y.template?.getAttribute("scale"),interval:a.axes.y.template?.getAttribute("interval"),position:a.axes.y.template?.getAttribute("position"),tickCount:a.axes.y.template?.getAttribute("tick-count")||a.axes.y.tickLabel?.getAttribute("target-tick-count"),tickStart:a.axes.y.template?.getAttribute("tick-start"),tickEnd:a.axes.y.template?.getAttribute("tick-end"),tickStep:a.axes.y.template?.getAttribute("tick-step")?Number(a.axes.y.template?.getAttribute("tick-step")):null,tickSuffix:a.axes.y.template?.getAttribute("tick-suffix"),tickPrefix:a.axes.y.template?.getAttribute("tick-prefix"),tickValues:a.axes.y.template?.hasAttribute("tick-values")?JSON.parse(a.axes.y.template?.getAttribute("tick-values")):null}}}),q=(S=!0)=>{if(h(e,"viewBox",`0 0 ${m.width} ${m.height}`),m.data.length===0)return;if(m.data.length===1){console.warn("ui-chart: chart only has one data point so it cannot be rendered.");return}if(m.data[0][m.axes.x.key]===void 0){console.warn(`ui-chart: axis field "${m.axes.x.key}" does not exist`);return}if(Object.entries(m.series).forEach(([v,M])=>{let k=e.querySelector(`[data-bar-group][data-series="${v}"]`),C=a.bars[v];if(C){let I=C.hasAttribute("width")?C.getAttribute("width"):"90%",P=fe(C.hasAttribute("radius")?C.getAttribute("radius"):"8 0"),B=C.hasAttribute("min-height")?Number(C.getAttribute("min-height")):0;k?.remove(),k=document.createElementNS("http://www.w3.org/2000/svg","g"),k.setAttribute("data-bar-group",""),k.setAttribute("data-series",v),M.bars({barWidth:I,minHeight:B,radius:P}
131).forEach(W=>{let R=ct(C);R.setAttribute("data-bar",""),R.setAttribute("data-series",v),R.setAttribute("d",W.path(P)),k.appendChild(R)}),e.appendChild(k)}}),Object.entries(m.stackedSeries).forEach(([v,M])=>{let k=e.querySelector(`[data-stack][data-stack-index="${v}"]`),C=a.stacks[v];if(!C)return;k?.remove(),k=document.createElementNS("http://www.w3.org/2000/svg","g"),k.setAttribute("data-stack",""),k.setAttribute("data-stack-index",v);let I={bars:{}};C.querySelectorAll('template[name="bar"]').forEach(P=>{I.bars[P.getAttribute("field")]=P}),Object.entries(M.bars()).forEach(([P,B])=>{let W=I.bars[P],R=document.createElementNS("http://www.w3.org/2000/svg","g");R.setAttribute("data-bar-group",""),R.setAttribute("data-series",P),B.forEach(U=>{let z=ct(W);z.setAttribute("data-bar",""),z.setAttribute("data-series",P),z.setAttribute("d",U.path()),R.appendChild(z)}),k.appendChild(R)}),e.appendChild(k)}),Object.entries(m.groupedSeries).forEach(([v,M])=>{let k=e.querySelector(`[data-group][data-group-index="${v}"]`),C=a.groups[v];if(!C)return;k?.remove(),k=document.createElementNS("http://www.w3.org/2000/svg","g"),k.setAttribute("data-group",""),k.setAttribute("data-group-index",v);let I={bars:{}};C.querySelectorAll('template[name="bar"]').forEach(P=>{I.bars[P.getAttribute("field")]=P}),Object.entries(M.bars()).forEach(([P,B])=>{let W=I.bars[P],R=document.createElementNS("http://www.w3.org/2000/svg","g");R.setAttribute("data-bar-group",""),R.setAttribute("data-series",P),B.forEach(U=>{let z=ct(W);z.setAttribute("data-bar",""),z.setAttribute("data-series",P),z.setAttribute("d",U.path()),R.appendChild(z)}),k.appendChild(R)}),e.appendChild(k)}),Object.entries(m.series).forEach(([v,M])=>{let k=e.querySelector(`[data-line][data-series="${v}"]`),C=a.lines[v];if(C){let I=C.getAttribute("curve")||"smooth";if(k)k.setAttribute("d",M.linePath(I));else{let P=ct(C);P.setAttribute("data-line",""),P.setAttribute("data-series",v),P.setAttribute("d",M.linePath(I)),e.appendChild(P)}}}),Object.entries(m.series).forEach(([v,M])=>{let k=e.querySelector(`[data-area][data-series="${v}"]`),C=a.areas[v];if(C){let I=C.getAttribute("curve")||"smooth";if(k)k.setAttribute("d",M.areaPath(I));else{let P=ct(C);P.setAttribute("data-area",""),P.setAttribute("data-series",v),P.setAttribute("d",M.areaPath(I)),e.appendChild(P)}}}),Object.entries(m.series).forEach(([v,M])=>
131{let k=e.querySelector(`[data-point-group][data-series="${v}"]`),C=a.points[v];C&&(e.querySelector(`[data-point-group][data-series="${v}"]`)?.remove(),k=document.createElementNS("http://www.w3.org/2000/svg","g"),k.setAttribute("data-point-group",""),k.setAttribute("data-series",v),M.points.forEach(I=>{if(!isFinite(I.y))return;let P=ct(C);P.setAttribute("data-point",""),P.setAttribute("data-series",v),P.setAttribute("cx",I.x),P.setAttribute("cy",I.y),k.appendChild(P)}),e.appendChild(k))}),u=v=>{e.querySelectorAll("[data-point-group]").forEach(M=>{if(M.querySelectorAll("[data-point]").forEach(k=>k.removeAttribute("data-active")),v){let k=v.clientX-e.getBoundingClientRect().left,C=v.clientY-e.getBoundingClientRect().top;k>=m.inset.left&&k<=m.width-m.inset.right&&C>=m.inset.top&&C<=m.height-m.inset.bottom&&m.closestXPoints(k).forEach(P=>{M.querySelectorAll(`[data-point][cx="${P.x}"]`).forEach(B=>B.setAttribute("data-active",""))})}else M.querySelectorAll("[data-point]").forEach(k=>k.removeAttribute("data-active"))})},a.axes.x.template){if(a.axes.x.axisLine){e.querySelector('[data-axis-line][data-axis="x"]')?.remove();let v=ct(a.axes.x.axisLine);v.setAttribute("data-axis-line",""),v.setAttribute("data-axis","x"),v.setAttribute("x1",m.axes.x.scale(m.axes.x.domain[0]).center),v.setAttribute("x2",m.axes.x.scale(m.axes.x.domain[1]).center),v.setAttribute("y1",m.axes.y.scale(m.axes.y.domain[m.axes.x.position==="bottom"?0:1]).center),v.setAttribute("y2",m.axes.y.scale(m.axes.y.domain[m.axes.x.position==="bottom"?0:1]).center),e.appendChild(v)}if(a.axes.x.gridLine){e.querySelector('[data-grid-line-group][data-axis="x"]')?.remove();let v=document.createElementNS("http://www.w3.org/2000/svg","g");v.setAttribute("data-grid-line-group",""),v.setAttribute("data-axis","x"),m.axes.x.ticks.forEach(({value:M})=>{let k=ct(a.axes.x.gridLine);k.setAttribute("data-grid-line",""),k.setAttribute("data-axis","x"),k.setAttribute("x1",m.axes.x.scale(M).center),k.setAttribute("x2",m.axes.x.scale(M).center),k.setAttribute("y1",m.inset.top),k.setAttribute("y2",m.height-m.inset.bottom),v.appendChild(k)}),e.appendChild(v)}if(a.axes.x.tickMark){e.querySelector('[data-tick-mark-group][data-axis="x"]')?.remove();let v=document.createElementNS("http://www.w3.org/2000/svg","g");v.setAttribute("data-tick-mark-group",""),v.setAttribute("data-axis","x"),m.axes.x.ticks.forEach(({value:M,label:k})=>{let C={x:m.axes.x.scale(M,{area:m.axes.x.asArea}).center,y:m.axes.y.scale(m.axes.y.domain[m.axes.x.position==="bottom"?0:1]).center},I=ct(a.axes.x.tickMark);I.setAttribute("data-tick-mark",""),I.setAttribute("data-axis","x"),I.setAttribute("transform",`translate(${C.x}, ${C.y})`),v.appendChild(I)}),e.appendChild(v)}if(a.axes.x.tickLabel){e.querySelector('[data-tick-label-group][data-axis="x"]')?.remove();let v=document.createElementNS("http://www.w3.org/2000/svg","g");v.setAttribute("data-tick-label-group",""),v.setAttribute("data-axis","x"),m.axes.x.ticks.forEach(({value:M,label:k})=>{let C={x:m.axes.x.scale(M,{area:m.axes.x.asArea}).center,y:m.axes.y.scale(m.axes.y.domain[m.axes.x.position==="bottom"?0:1]).center},I=ct(a.axes.x.tickLabel);I.querySelectorAll("slot").forEach(P=>P.replaceWith(document.createTextNode(k))),I.setAttribute("data-tick-label",""),I.setAttribute("data-axis","x"),I.setAttribute("transform",`translate(${C.x}, ${C.y})`),v.appendChild(I)}),e.appendChild(v),on(v,m.axes.x)}}if(a.axes.y.template){if(a.axes.y.axisLine){e.querySelector('[data-axis-line][data-axis="y"]')?.remove();let v=ct(a.axes.y.axisLine);v.setAttribute("data-axis-line",""),v.setAttribute("data-axis","y"),v.setAttribute("x1",m.axes.x.scale(m.axes.x.domain[m.axes.y.position==="left"?0:1]).center),v.setAttribute("x2",m.axes.x.scale(m.axes.x.domain[m.axes.y.position==="left"?0:1]).center),v.setAttribute("y1",m.axes.y.scale(m.axes.y.domain[0]).center),v.setAttribute("y2",m.axes.y.scale(m.axes.y.domain[1]).center),e.appendChild(v)}if(a.axes.y.gridLine){e.querySelector('[data-grid-line-group][data-axis="y"]')?.remove();let v=document.createElementNS("http://www.w3.org/2000/svg","g");v.setAttribute("data-grid-line-group",""),v.setAttribute("data-axis","y"),m.axes.y.ticks.forEach(({value:M,label:k})=>{let C={x:m.axes.x.scale(m.axes.x.domain[0]).center,y:m.axes.y.scale(M).center},I=ct(a.axes.y.gridLine);I.setAttribute("data-grid-line",""),I.setAttribute("data-axis","y"),I.setAttribute("x1",m.inset.left),I.setAttribute("x2",m.width-m.inset.right),I.setAttribute("y1",C.y),I.setAttribute("y2",C.y),v.appendChild(I)}),e.appendChild(v)}if(a.axes.y.tickMark){e.querySelector('[data-tick-mark-group][data-axis="y"]')?.remove();
131let v=document.createElementNS("http://www.w3.org/2000/svg","g");v.setAttribute("data-tick-mark-group",""),v.setAttribute("data-axis","y"),m.axes.y.ticks.forEach(({value:M,label:k})=>{let C={x:m.axes.x.scale(m.axes.x.domain[m.axes.y.position==="left"?0:1]).center,y:m.axes.y.scale(M).center},I=ct(a.axes.y.tickMark);I.setAttribute("data-tick-mark",""),I.setAttribute("data-axis","y"),I.setAttribute("transform",`translate(${C.x}, ${C.y})`),v.appendChild(I)}),e.appendChild(v)}if(a.axes.y.tickLabel){e.querySelector('[data-tick-label-group][data-axis="y"]')?.remove();let v=document.createElementNS("http://www.w3.org/2000/svg","g");v.setAttribute("data-tick-label-group",""),v.setAttribute("data-axis","y"),m.axes.y.ticks.forEach(({value:M,label:k})=>{let C={x:m.axes.x.scale(m.axes.x.domain[m.axes.y.position==="left"?0:1]).center,y:m.axes.y.scale(M).center},I=ct(a.axes.y.tickLabel);I.querySelectorAll("slot").forEach(P=>P.replaceWith(document.createTextNode(k))),I.setAttribute("data-tick-label",""),I.setAttribute("data-axis","y"),I.setAttribute("transform",`translate(${C.x}, ${C.y})`),v.appendChild(I)}),e.appendChild(v),on(v,m.axes.y)}}if(a.zeroLine&&m.axes.y.domain[0]<0&&m.axes.y.domain[1]>0){e.querySelector('[data-zero-line][data-axis="y"]')?.remove();let v=ct(a.zeroLine);v.setAttribute("data-zero-line",""),v.setAttribute("data-axis","y"),v.setAttribute("x1",m.axes.x.scale(m.axes.x.domain[0]).center),v.setAttribute("x2",m.axes.x.scale(m.axes.x.domain[1]).center),v.setAttribute("y1",m.axes.y.scale(0).center),v.setAttribute("y2",m.axes.y.scale(0).center),e.appendChild(v)}if(f&&(f.setAttribute("width",m.width),f.setAttribute("height",m.height),f.setAttribute("x",0),f.setAttribute("y",0)),d){c=d.getAttribute("type")??"line";let v=M=>{if(c==="area"){d.setAttribute("opacity","0.1");let P=M.start,B=m.axes.y.scale(m.axes.y.domain[1]).center,W=M.width,R=m.axes.y.scale(m.axes.y.domain[0]).center-m.axes.y.scale(m.axes.y.domain[1]).center,U=fe(d.getAttribute("radius")??"0");d.setAttribute("fill","currentColor"),d.setAttribute("stroke","none"),d.setAttribute("d",Oe(P,B,W,R,U));return}d.setAttribute("opacity","1");let k=M.center,C=m.axes.y.scale(m.axes.y.domain[0]).center,I=m.axes.y.scale(m.axes.y.domain[1]).center;d.setAttribute("d",`M ${k} ${C} L ${k} ${I}`)};n=M=>{if(M){let k=e.getBoundingClientRect(),C=M.clientX-k.left,I=M.clientY-k.top;if(C>=m.inset.left&&C<=m.width-m.inset.right&&I>=m.inset.top&&I<=m.height-m.inset.bottom){let P=m.closestXPoint(C);v(P)}else d.setAttribute("opacity","0")}else d.setAttribute("opacity","0")}}b&&(o=v=>{if(v===null)x(b,"data-active");else{let M=v.clientX-e.getBoundingClientRect().left,k=v.clientY-e.getBoundingClientRect().top;if(M>=m.inset.left&&M<=m.width-m.inset.right&&k>=m.inset.top&&k<=m.height-m.inset.bottom){let C=m.closestXPoint(M);if(C){h(b,"data-active","");let I=b.getBoundingClientRect(),P=e.getBoundingClientRect(),B=P.width-(C.center+I.width+15),W=P.height-(k+I.height+15),R=B<0?C.center-I.width-15:C.center+15,U=W<0?k-I.height-15:k+15;b.style.transform=`translate(${R}px, ${U}px)`;let z=a.tooltip.content.cloneNode(!0).firstElementChild;z.querySelectorAll("slot").forEach(Z=>{let si=Z.getAttribute("field");if(si){let Bt=Z.hasAttribute("format")?JSON.parse(Z.getAttribute("format")):null,nt=C.datum[si];if(Bt===null)return Z.textContent=nt;Bt={...Bt,timeZone:"UTC"},un(nt)?nt=Number(nt).toLocaleString(m.locale,Bt):hn(nt)&&(nt=new Date(nt).toLocaleDateString(m.locale,Bt)),Z.textContent=nt}}),b.innerHTML=z.innerHTML}else x(b,"data-active")}else x(b,"data-active")}}),p&&(l=v=>{let M=null;if(v!==null){let k=v.clientX-e.getBoundingClientRect().left,C=v.clientY-e.getBoundingClientRect().top;k>=m.inset.left&&k<=m.width-m.inset.right&&C>=m.inset.top&&C<=m.height-m.inset.bottom&&(M=m.closestXPoint(k))}if(M=M||m.closestXPoint(m.axes.x.range[1]),M){let k=a.summary.content.cloneNode(!0).firstElementChild;k.querySelectorAll("slot").forEach(C=>{let I=C.getAttribute("field");if(I){let P=C.hasAttribute("format")?JSON.parse(C.getAttribute("format")):{};P={...P,timeZone:"UTC"};let B=C.hasAttribute("fallback")&&v===null?C.getAttribute("fallback"):M.datum[I];
131un(B)?B=Number(B).toLocaleString(m.locale,P):hn(B)&&(B=new Date(B).toLocaleString(m.locale,P)),C.textContent=B}}),p.innerHTML=k.innerHTML}},l(null)),e.appendChild(f),e.querySelectorAll("[data-grid-line-group]").forEach(v=>f.before(v)),e.querySelectorAll("[data-axis-line]").forEach(v=>f.before(v)),c==="area"&&e.querySelectorAll("[data-cursor]").forEach(v=>f.before(v));let N=0,F=0;if(t.content.querySelectorAll('template[name="group"], template[name="stack"]:not(template[name="group"] template[name="stack"]), template[name="bar"]:not(template[name="stack"] template[name="bar"]):not(template[name="group"] template[name="bar"]), template[name="line"], template[name="area"], template[name="point"]').forEach(v=>{let M=v.getAttribute("name"),k=v.getAttribute("field"),C;M==="group"?(C=e.querySelector(`[data-group][data-group-index="${N}"]`),N++):M==="stack"?(C=e.querySelector(`[data-stack][data-stack-index="${F}"]`),F++):M==="bar"?C=e.querySelector(`[data-bar-group][data-series="${k}"]`):M==="point"?C=e.querySelector(`[data-point-group][data-series="${k}"]`):C=e.querySelector(`[data-${M}][data-series="${k}"]`),C&&f.before(C)}),e.querySelectorAll("[data-zero-line]").forEach(v=>f.before(v)),c==="line"&&e.querySelectorAll("[data-cursor]").forEach(v=>f.before(v)),S){let v=dn(e);bo(e,m,_,v),m.updateDimensions({width:m.width,height:m.height},{left:_.left+v.left,right:_.right+v.right,top:_.top+v.top,bottom:_.bottom+v.bottom}),q(!1)}};this._observable.subscribe("resize",()=>{let S=e.parentElement.getBoundingClientRect();S.width===0||S.height===0||(m.updateDimensions({width:S.width,height:S.height},{left:0,right:0,top:0,bottom:0}),q(),d&&d.setAttribute("opacity","0"))}),this._observable.subscribe("data",()=>{m.updateData(this._data),m.updateDimensions({width:m.width,height:m.height},{left:0,right:0,top:0,bottom:0}),q()}),new ResizeObserver(()=>{this._observable.notify("resize")}).observe(this),new MutationObserver(S=>{S.forEach(N=>{N.attributeName==="value"&&this._selectable.setState(this.hasAttribute("value")?JSON.parse(this.getAttribute("value")):[])})}).observe(this,{attributes:!0,attributeFilter:["value"]})}};customElements.define("ui-chart",Or);function po(i,t=!1){let e=null,s=[];return i.querySelectorAll('template[name="line"], template[name="area"], template[name="point"], template[name="bar"]:not(template[name="stack"] template[name="bar"]):not(template[name="group"] template[name="bar"])').forEach(r=>{s.push(r.getAttribute("field")||"value")}),i.querySelectorAll('template[name="axis"][axis="x"]').forEach(r=>{e=r.getAttribute("field")||"index"}),s=Array.from(new Set(s)),e===null&&(e="index"),s.length===0&&!t&&(s=["value"]),[e,s]}function ct(i){let t=document.createElementNS("http://www.w3.org/2000/svg","svg");return t.setAttribute("xmlns","http://www.w3.org/2000/svg"),t.setAttribute("version","1.1"),t.innerHTML=i.innerHTML,t.firstElementChild}function bo(i,t,e,s){let r=i.querySelector('[data-tick-label-group][data-axis="x"]');if(!r||t.axes.x.type!=="categorical"||Nr(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(o=>o.style.display!=="none");for(let o=0;o<n.length-1;o++){let l=n[o].getBoundingClientRect();if(n[o+1].getBoundingClientRect().left-l.right-a/Math.max(1,n.length-1)<20){let c=cn(r),f=dn(i);s.bottom=Math.max(s.bottom,f.bottom),c();return}}}function on(i,t){if(Nr(i,t)){if(t.axis==="x"&&t.type==="categorical")cn(i);else if(t.axis==="x"&&t.type==="time"){let e=mo(i);if(!Nr(i,t))return;e(),go(i)}}}function Nr(i,t){let e=Array.from(i.children);e=e.filter(s=>s.style.display!="none");for(let s=0;s<e.length;s++){let r=e[s],a=e[s+1];if(!a)break;let n=r.getBoundingClientRect(),o=a.getBoundingClientRect(),l=20;if(t.axis==="y"){if(n.bottom+l<o.top)return!0}else if(n.right+l>o.left)return!0}return!1}function cn(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 o=a.matches("text")?a:a.querySelector("text");o&&(o.style.transform="rotate(-45deg)",o.style.textAnchor="end",t.push(()=>{o.style.transform=null,o.style.textAnchor=null}))})}),()=>
131t.forEach(e=>e())}function mo(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 go(i){let t=Array.from(i.children);t.forEach((n,o)=>{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,o)=>{n.style.display="inline"})}function un(i){return typeof i=="number"||typeof i=="string"&&!isNaN(Number(i))}function hn(i){return i instanceof Date||typeof i=="string"&&!isNaN(Date.parse(i))}function dn(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 fe(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 Rr=class extends T{boot(){h(this,"role","button"),this._disableable=new V(this),this._disableable.onInitAndChange(t=>{t?x(this,"tabindex","0"):h(this,"tabindex","0")}),this._buttonType=this.getAttribute("type")||"button"}mount(){y(this,"keydown",t=>{t.key==="Enter"&&(t.preventDefault(),this.disabled||this.click()),t.key===" "&&t.preventDefault()}),y(this,"keyup",t=>{t.key===" "&&(t.preventDefault(),t.stopPropagation(),this.disabled||this.click())}),y(this,"click",()=>{this.disabled||(this._buttonType==="submit"?this._handleSubmit():this._buttonType==="reset"&&this._handleReset())})}_handleSubmit(){let t=this.closest("form");t&&t.requestSubmit()}_handleReset(){let t=this.closest("form");t&&t.reset()}};D("button",Rr);var Fr=class extends T{mount(){let t=this.querySelector("button,ui-button");y(t,"click",()=>{yi(this,s=>!!s._closeable)?._closeable?.close()})}};D("close",Fr);var Vr=class extends T{toasts=[];initiallyExpanded=!1;expanded=!1;mount(){this.initiallyExpanded=this.hasAttribute("expanded");let t=this.getAttribute("position")||"bottom right";this.verticalPosition=t.match(/\b(top|bottom)\b/)?.[0]||"bottom",this.horizontalPosition=t.match(/\b(left|start|center|right|end)\b/)?.[0]||"right",this.horizontalPosition==="left"?this.horizontalPosition="start":this.horizontalPosition==="right"&&(this.horizontalPosition="end"),h(this,"role","status")}showToast(t={}){let e=this.querySelector("ui-toast");if(!e)return console.warn("ui-toast-group: no ui-toast element found",this);this.matches(":popover-open")&&this.hidePopover(),this.showPopover();let s=Number(t.duration===void 0?5e3:t.duration),r=e.prepareToastTemplate(t),a=r.firstElementChild,n={timeout:null,el:r,height:null,contentEl:a,contentHeight:null},o=()=>{this.animateIn(n),this.updateList()},l=()=>{this.animateOut(n),this.updateList()};this.toasts.unshift(n),this.appendChild(r),o(),r.hideToast=l;let u=s!==0&&ps(()=>{n.timeout=null,l()},s);u&&(n.timeout=u),r.destroyToast=()=>{n.timeout&&(n.timeout.cancel(),n.timeout=null);let d=this.toasts.indexOf(n);d>-1&&this.toasts.splice(d,1),r.remove(),this.toasts.length===0&&(this.expanded=!1),this.updateList()},r.addEventListener("mouseenter",()=>{this.pauseTimeouts(),this.initiallyExpanded||(this.expanded=!0,this.updateList())}),r.addEventListener("mouseleave",()=>{this.resumeTimeouts(),this.initiallyExpanded||(this.expanded=!1,this.updateList())}),r._closeable=new Mt(r),r._closeable.onClose(()=>r.destroyToast())}pauseTimeouts(){for(let t of this.toasts)t.timeout?.pause()}resumeTimeouts(){for(let t of this.toasts)t.timeout?.resume()}animateIn(t){let r=1.5*((this.verticalPosition==="top"?"bottom":"top")==="top"?1:-1);t.contentEl.style.opacity=0,t.contentEl.style.transform=`translateY(${r}rem)`,t.el.style.zIndex=5001,t.contentEl.offsetHeight,t.contentHeight=t.contentEl.offsetHeight,t.height=t.el.offsetHeight,t.contentEl.style.opacity=100,t.contentEl.style.transform="translateY(0)"}animateOut(t){let s=.5*(this.verticalPosition==="top"?1:-1);t.contentEl.style.transform=`translateY(${s}rem)`,t.contentEl.style.opacity=0;let r=this.toasts.indexOf(t);r>-1&&this.toasts.splice(r,1);let a=()=>{t.el.remove(),this.toasts.length===0&&(this.expanded=!1)};t.contentEl.getAnimations().length?t.contentEl.addEventListener("transitionend",()=>{a()},{once:!0}):a()}updateList(){this.initiallyExpanded||this.expanded?this.expand():this.collapse()}expand(){let t=0;for(let e of this.toasts){let s=this.verticalPosition==="top"?1:-1;e.el.style.transform=`translateY(${s*t}px)`,e.el.style.opacity=100,e.contentEl.style.height=`${e.contentHeight}
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,l=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(${l}px)`,t++}}},qr=class extends T{mount(){this.closest("ui-toast-group")||(h(this,"role","status"),document.addEventListener("keydown",t=>{t.key==="Escape"&&this.hideToast()}),this.defaultPosition=this.getAttribute("position")||"bottom end")}showToast(t={}){let e=this.template().nextElementSibling;e&&e.destroyToast();let s=Number(t.duration===void 0?5e3:t.duration),r=t.dataset?.position??this.defaultPosition;t.dataset?.position!==void 0&&delete t.dataset.position,this.setAttribute("position",r);let a=this.prepareToastTemplate(t),n=()=>{this.showPopover(),a.classList.add("showing")},o=()=>{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=o;let l=s!==0&&ps(()=>{o()},s);a.destroyToast=()=>{l&&l.cancel(),a.remove(),this.hidePopover()},a.addEventListener("mouseenter",()=>{l&&l.pause()}),a.addEventListener("mouseleave",()=>{l&&l.resume()}),a._closeable=new Mt(a),a._closeable.onClose(()=>a.destroyToast())}hideToast(){let t=this.template().nextElementSibling;t&&t.destroyToast()}template(){return this.querySelector("template")}prepareToastTemplate(t){let e=t.slots||{},s=t.dataset||{},r=this.template();if(!r)return console.warn("ui-toast: no template element found",this);let a=r.content.cloneNode(!0).firstElementChild;return a.setAttribute("aria-atomic","true"),Object.entries(e).forEach(([n,o])=>{[null,void 0,!1].includes(o)||a.querySelectorAll(`slot[name="${n}"]`).forEach(l=>{l.replaceWith(document.createTextNode(o))})}),Object.entries(s).forEach(([n,o])=>{a.dataset[n]=o}),a.querySelectorAll("slot").forEach(n=>n.remove()),a}};D("toast-group",Vr);D("toast",qr);var $r=class i extends X{boot(){this._disableable=new V(this),this._disableable.onInitAndChange(t=>{this.walker().each(e=>{e.disabled=t})}),this._selectable=new ut(this),this._controllable=new Y(this,{disabled:this._disabled,bubbles:!0}),this._focusable=new _t(this,{wrap:!0}),this._submittable=new Q(this,{name:this.getAttribute("name"),value:this._selectable.getState(),includeWhenEmpty:!1}),this._controllable.initial(t=>t&&this._selectable.setState(t)),this._controllable.getter(()=>this._selectable.getState()),this._detangled=G(),this._controllable.setter(this._detangled(t=>{this._selectable.setState(t)})),this._selectable.onChange(this._detangled(()=>{this._controllable.dispatch()})),this._selectable.onInitAndChange(()=>{this._submittable.update(this._selectable.getState())}),y(this,"keydown",t=>{["ArrowDown","ArrowRight"].includes(t.key)?(this._focusable.focusNext(),t.preventDefault(),t.stopPropagation()):["ArrowUp","ArrowLeft"].includes(t.key)&&(this._focusable.focusPrev(),t.preventDefault(),t.stopPropagation())}),h(this,"role","radiogroup"),queueMicrotask(()=>{this._submittable.update(this._selectable.getState())})}walker(){return tt(this,(t,{skip:e,reject:s})=>{if(t instanceof i)return s();if(t.localName!=="ui-radio")return e()})}},Br=class extends X{boot(){let t=this;this._disableable=new V(this),this._selectable=new H(t,{value:this.hasAttribute("value")?this.getAttribute("value"):Math.random().toString(36).substring(2,10),label:this.hasAttribute("label")?this.getAttribute("label"):null,selectedInitially:this.hasAttribute("checked"),dataAttr:"data-checked",ariaAttr:"aria-checked"}),this._selectable.onChange(()=>{this._selectable.isSelected()&&this._focusable.focus(!1)}),this._disableable.onChange(e=>{e?this._focusable.untabbable():this._selectable.isSelected()&&this._focusable.tabbable()}),h(t,"role","radio"),this._focusable=new st(t,{disableable:this._disableable,tabbableAttr:"data-active"}),y(t,"click",this._disableable.disabled(e=>{e.preventDefault(),e.stopPropagation()}),{capture:!0}),y(t,"click",this._disableable.enabled(e=>{this._selectable.press()})),y(t,"keydown",this._disableable.enabled(e=>{e.key==="Enter"&&this.closest("form")?.requestSubmit()})),y(t,"keydown",this._disableable.enabled(e=>{e.key===" "&&(e.preventDefault(),e.stopPropagation())})),y(t,"keyup",this._disableable.enabled(e=>{e.key===" "&&(this._selectable.press(),e.preventDefault(),e.stopPropagation())})),vo(t),y(t,"focus",e=>{ie()&&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 vo(i){i.closest("label")?.addEventListener("click",t=>{i.contains(t.target)||i.click()})}D("radio-group",$r);D("radio",Br);var Wr=class extends T{boot(){y(this,"scroll",t=>{this.updateAttributes()},{passive:!0}),new ResizeObserver(()=>{this.updateAttributes()}).observe(this)}mount(){queueMicrotask(()=>{this.updateAttributes()})}updateAttributes(){this.scrollLeft>12?h(this,"data-scrolled-right",""):x(this,"data-scrolled-right"),this.scrollWidth-this.clientWidth-this.scrollLeft>12?h(this,"data-scrolled-left",""):x(this,"data-scrolled-left")}};D("table-scroll-area",Wr);var Qi=class i extends T{boot(){this._disabled=this.hasAttribute("disabled")}mount(){this.walkPanels(t=>fn(t)),new MutationObserver(t=>{this.walkPanels(e=>fn(e))}).observe(this,{childList:!0})}showPanel(t){this.walkPanels(e=>{e.getAttribute("name")===t?e.show():e.hide()})}getPanel(t){return this.walkPanels((e,s)=>{e.getAttribute("name")===t&&s(e)})}walkPanels(t){let e=!1,s;for(let r of this.children)if(!(r instanceof i)&&!(r instanceof ts)&&(t(r,a=>{e=!0,s=a}),e))break;return s}},Hr=class extends T{boot(){y(this,"scroll",t=>{this.updateScrollVariable()},{passive:!0}),new ResizeObserver(()=>{this.updateScrollVariable()}).observe(this)}updateScrollVariable(){let t=Math.abs(this.scrollLeft)/(this.scrollWidth-this.clientWidth)*100;this.style.setProperty("--flux-scroll-percentage",t+"%")}},ts=class i extends X{boot(){this._focusable=new _t(this,{wrap:!0}),this._selectableGroup=new ut(this),this._controllable=new Y(this,{disabled:this._disabled}),this._controllable.initial(e=>e&&this._selectableGroup.setState(e)),this._controllable.getter(()=>this._selectableGroup.getState());let t=G();this._controllable.setter(t(e=>{this._selectableGroup.setState(e)})),this._selectableGroup.onChange(t(()=>{this._controllable.dispatch()})),y(this,"keydown",e=>
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")||(yo(t),t._initialized=!0)})}walker(){return tt(this,(t,{skip:e,reject:s})=>{if(t instanceof Qi||t instanceof i)return s();if(!["a","button"].includes(t.localName))return e()})}};function yo(i){i._disableable=new V(i);let t=i.matches("a")?i:null,e=t||i;i._disableable.onInitAndChange(r=>{r?h(e,"aria-disabled","true"):x(e,"aria-disabled")});let s=K(e,"tab");if(h(e,"role","tab"),e._focusable=new st(e,{disableable:i._disableable,tabbableAttr:"data-active"}),!t){let r=i.getAttribute("name");i._selectable=new H(i,{value:r||Math.random().toString(36).substring(2,10),label:i.hasAttribute("label")?i.getAttribute("label"):i.textContent.trim(),selectedInitially:i.hasAttribute("selected"),toggleable:!1}),y(i,"click",()=>i._selectable.press()),i._selectable.onInitAndChange(()=>{let n=i.closest("ui-tab-group")?.getPanel(r);i._selectable.getState()?n?.show():n?.hide(),i._selectable.getState()&&i._focusable.focus(!1)});let a=null;i.closest("ui-tab-group")?.hasAttribute("manual")||(y(i,"pointerdown",()=>{clearTimeout(a),a=setTimeout(()=>a=null)}),y(i,"focus",()=>{a||i._selectable.select()})),queueMicrotask(()=>{let n=i.closest("ui-tab-group");if(!n)return;let o=n.getPanel(r);if(!o)throw new Error("Could not find panel...");h(i,"aria-controls",o.id),h(o,"aria-labelledby",i.id)})}}function fn(i){i._initialized||(K(i,"tab-panel"),h(i,"role","tabpanel"),i.hasAttribute("tabindex")||h(i,"tabindex","-1"),i.show=()=>{h(i,"data-selected",""),h(i,"tabindex","0")},i.hide=()=>{x(i,"data-selected"),h(i,"tabindex","-1")},i._initialized=!0)}D("tab-group",Qi);D("tabs-scroll-area",Hr);D("tabs",ts);var Ur=class extends X{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 Y(this),this._controllable.initial(e=>e&&this.state.setValue(e)),this._controllable.getter(()=>this.state.getValue());let t=G();this._controllable.setter(t(e=>this.state.setValue(e))),this.state.onChange(t(()=>this._controllable.dispatch())),this._submittable=new Q(this,{name:this.getAttribute("name"),value:this.state.getValue()}),this.state.onChange(e=>{this._submittable.update(e),e.length===this.length&&this.config.autoSubmit&&this.closest("form")?.requestSubmit(),Array.from(this.inputEls).findIndex(r=>r===document.activeElement)>this.nextIndex()&&this.focusIndex(this.nextIndex())}),this._disableable=new V(this),this._disableable.onInitAndChange(e=>{for(let s of this.inputEls)e?h(s,"disabled",e):x(s,"disabled")}),this.updateTabIndexes(this.nextIndex());for(let e=0;e<this.length;e++){h(this.inputEls[e],"autocomplete",e===0?this.config.autocomplete:"off"),h(this.inputEls[e],"aria-label",this.config.inputAriaLabelTemplate.replace("{current}",e+1).replace("{total}",this.length));let s;y(this.inputEls[e],"beforeinput",r=>{s=r.target.value}),y(this.inputEls[e],"input",r=>{r.stopPropagation();let a=r.target.value;if(a.length>1){this.state.setValue(a),this.focusIndex(this.nextIndex()),r.preventDefault();return}if(a==""){this.state.reapply(),e<this.nextIndex()?this.focusIndex(e):this.focusPrev(e);return}if(this.invalidCharacters().test(a)){r.target.value=s,this.focusIndex(e);return}this.config.mode!=="numeric"&&(r.target.value=a.toUpperCase()),this.inputEls[e].blur(),this.state.notify(),this.focusNext(e)}),y(this.inputEls[e],"keydown",r=>{["Backspace","Delete","Clear"].includes(r.key)?r.target.value===""&&requestAnimationFrame(()=>this.focusPrev(e)):r.key==="ArrowRight"?(this.focusNext(e),r.preventDefault()):r.key==="ArrowLeft"&&(this.focusPrev(e),r.preventDefault())}),y(this.inputEls[e],"pointerdown",r=>{this.focusIndex(Math.min(e,this.nextIndex())),r.preventDefault()}),y(this.inputEls[e],"focus",r=>{r.target.setSelectionRange(0,1),this.updateTabIndexes(e)})}}trigger(){return this.inputEls[this.nextIndex()]}focusIndex(t){let e=this.inputEls[t];document.activeElement===e&&e.blur(),e.focus()}focusPrev(t){this.focusIndex(Math.max(0,t-1))}focusNext(t){this.focusIndex(Math.min(t+1,this.nextIndex()))}nextIndex(){return Math.min(this.state.length,this.length-1)}updateTabIndexes(t){for(let e=0;e<this.length;e++)e===t?h(this.inputEls[e],"tabindex","0"):h(this.inputEls[e],"tabindex","-1")}invalidCharacters(){switch(this.config.mode){case"numeric":return/[^\d]/g;case"alpha":return/[^a-zA-Z]/g;case"alphanumeric":return/[^a-zA-Z0-9]/g;default:throw new Error(`Unknown OTP input mode "${this.config.mode}"`)}}};D("otp",Ur);document.addEventListener("alpine:init",()=>{let i=window.Alpine,t=window.Flux?.applyAppearance;t||(t=()=>{window.Flux.appearance=null,window.localStorage.removeItem("flux.appearance")});let e=i.reactive({toast(...r){let a={slots:{},dataset:{}};typeof r[0]=="string"&&(a.slots.text=r.shift()),typeof r[0]=="string"&&(a.slots.heading=a.slots.text,a.slots.text=r.shift());let n=r.shift()||{};n.text&&(a.slots.text=n.text),n.heading&&(a.slots.heading=n.heading),n.variant&&(a.dataset.variant=n.variant),n.position&&(a.dataset.position=n.position),n.duration!==void 0&&(a.duration=n.duration),document.dispatchEvent(new CustomEvent("toast-show",{detail:a}))},modal(r){return{show(){document.dispatchEvent(new CustomEvent("modal-show",{detail:{name:r}}))},close(){document.dispatchEvent(new CustomEvent("modal-close",{detail:{name:r}}))}}},modals(){return{close(){document.dispatchEvent(new CustomEvent("modal-close",{detail:{}}))}}},appearance:window.localStorage.getItem("flux.appearance")||"system",systemAppearanceChanged:1,get dark(){return JSON.stringify(e.systemAppearanceChanged),e.appearance==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches:e.appearance==="dark"},set dark(r){let a=this.dark;r!==a&&(r?e.appearance="dark":e.appearance="light")}});window.Flux=e,i.magic("flux",()=>e),i.effect(()=>{t(e.appearance)}),document.addEventListener("livewire:navigating",r=>{r.detail.onSwap(()=>{t(e.appearance)})}),window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",()=>{e.systemAppearanceChanged++,t(e.appearance)}),i.data("fluxInputClearable",()=>({clear(){let r=this.$el.closest("[data-flux-input]").querySelector("input");r.value="",r.dispatchEvent(new Event("input",{bubbles:!1})),r.dispatchEvent(new Event("change",{bubbles:!1})),r.dispatchEvent(new CustomEvent("clear",{bubbles:!1})),r.focus()}}
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()}}))});!la()&&!oa()&&ua();})();
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.