monobill-mintui 0.1.7 → 0.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../src/components/button/Button.ts"],"names":[],"mappings":"AAEA,OAAO,kBAAkB,CAAA;AACzB,OAAO,eAAe,CAAA;AAEtB,KAAK,aAAa,GAAG,OAAO,GAAG,OAAO,GAAG,MAAM,CAAA;AAC/C,KAAK,UAAU,GAAG,SAAS,GAAG,QAAQ,GAAG,MAAM,GAAG,SAAS,GAAG,QAAQ,CAAA;AACtE,KAAK,UAAU,GAAG,QAAQ,GAAG,QAAQ,CAAA;AACrC,KAAK,YAAY,GAAG,MAAM,GAAG,OAAO,CAAA;AAMpC,cAAM,UAAW,SAAQ,WAAW;IAClC,MAAM,KAAK,kBAAkB,IAAI,MAAM,EAAE,CAExC;IAED,OAAO,CAAC,OAAO,CAAiC;IAChD,OAAO,CAAC,aAAa,CAAwC;IAC7D,OAAO,CAAC,gBAAgB,CAAiB;;IAOzC,iBAAiB,IAAI,IAAI;IAczB,oBAAoB,IAAI,IAAI;IAI5B,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAM9F,UAAU,IAAI,aAAa;IAI3B,OAAO,IAAI,UAAU;IAIrB,UAAU,IAAI,OAAO;IAIrB,SAAS,IAAI,OAAO;IAIpB,OAAO,IAAI,UAAU;IASrB,WAAW,IAAI,OAAO;IAItB,eAAe,IAAI,YAAY;IAI/B,OAAO,IAAI,MAAM;IAIjB,UAAU,IAAI,OAAO;IAiCrB,gBAAgB,IAAI,MAAM;IA4U1B,MAAM,IAAI,IAAI;IAuOd,mBAAmB,IAAI,IAAI;IAmB3B,oBAAoB,IAAI,IAAI;IAgB5B,OAAO,CAAC,gBAAgB,CAIvB;IAED,OAAO,CAAC,cAAc,CAIrB;IAED,OAAO,CAAC,iBAAiB,CAIxB;IAED,OAAO,CAAC,iBAAiB,CAIxB;IAED,OAAO,CAAC,eAAe,CAItB;IAED,OAAO,CAAC,kBAAkB,CAIzB;IAED,WAAW,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI;CAuChC;AAOD,eAAe,UAAU,CAAA"}
1
+ {"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../src/components/button/Button.ts"],"names":[],"mappings":"AAEA,OAAO,kBAAkB,CAAA;AACzB,OAAO,eAAe,CAAA;AAEtB,KAAK,aAAa,GAAG,OAAO,GAAG,OAAO,GAAG,MAAM,CAAA;AAC/C,KAAK,UAAU,GAAG,SAAS,GAAG,QAAQ,GAAG,MAAM,GAAG,SAAS,GAAG,QAAQ,CAAA;AACtE,KAAK,UAAU,GAAG,QAAQ,GAAG,QAAQ,CAAA;AACrC,KAAK,YAAY,GAAG,MAAM,GAAG,OAAO,CAAA;AAMpC,cAAM,UAAW,SAAQ,WAAW;IAClC,MAAM,KAAK,kBAAkB,IAAI,MAAM,EAAE,CAExC;IAED,OAAO,CAAC,OAAO,CAAiC;IAChD,OAAO,CAAC,aAAa,CAAwC;IAC7D,OAAO,CAAC,gBAAgB,CAAiB;;IAOzC,iBAAiB,IAAI,IAAI;IAczB,oBAAoB,IAAI,IAAI;IAI5B,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAM9F,UAAU,IAAI,aAAa;IAI3B,OAAO,IAAI,UAAU;IAIrB,UAAU,IAAI,OAAO;IAWrB,SAAS,IAAI,OAAO;IAWpB,OAAO,IAAI,UAAU;IASrB,WAAW,IAAI,OAAO;IAItB,eAAe,IAAI,YAAY;IAI/B,OAAO,IAAI,MAAM;IAIjB,UAAU,IAAI,OAAO;IAiCrB,gBAAgB,IAAI,MAAM;IA4U1B,MAAM,IAAI,IAAI;IAuOd,mBAAmB,IAAI,IAAI;IAmB3B,oBAAoB,IAAI,IAAI;IAgB5B,OAAO,CAAC,gBAAgB,CAIvB;IAED,OAAO,CAAC,cAAc,CAIrB;IAED,OAAO,CAAC,iBAAiB,CAIxB;IAED,OAAO,CAAC,iBAAiB,CAIxB;IAED,OAAO,CAAC,eAAe,CAItB;IAED,OAAO,CAAC,kBAAkB,CAIzB;IAED,WAAW,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI;CAuChC;AAOD,eAAe,UAAU,CAAA"}
package/dist/index.cjs CHANGED
@@ -41,7 +41,7 @@
41
41
  ></animate>
42
42
  </circle>
43
43
  </svg>
44
- `;this.innerHTML=l.trim()}}customElements.get("mint-spinner")||customElements.define("mint-spinner",P);class O extends HTMLElement{constructor(){super(),this._darkModeObserver=null}static get observedAttributes(){return["name"]}connectedCallback(){this.classList.add("box-border","m-0","p-0","border-0","inline-flex","items-center","leading-none"),this.render(),this._observeDarkMode()}attributeChangedCallback(e,t,i){t!==i&&this.render()}disconnectedCallback(){this._darkModeObserver&&(this._darkModeObserver.disconnect(),this._darkModeObserver=null)}_observeDarkMode(){this._darkModeObserver||(this._darkModeObserver=new MutationObserver(e=>{for(const t of e)if(t.type==="attributes"&&t.attributeName==="class"){this.render();break}}),this._darkModeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}))}getName(){return this.getAttribute("name")||""}getIconUrl(){var t;const e=(t=document.querySelector('meta[name="mint-icon-base-url"]'))==null?void 0:t.getAttribute("content");return e?e==="local"?`/icons/${this.getName()}.svg`:e==="cdn"?`https://assets.gomonobill.com/mintui/icons/${this.getName()}.svg`:`${e.endsWith("/")?e:`${e}/`}${this.getName()}.svg`:`https://assets.gomonobill.com/mintui/icons/${this.getName()}.svg`}render(){var c,l,o;const e=this.getName();if(!e){this.innerHTML="",this.style.maskImage="",this.style.webkitMaskImage="";return}if(!re.getIcon(e)){console.warn(`Icon "${e}" not found. Make sure you've imported the icon: import '@monobill-mintui/icon/icons/${e}'`),this.innerHTML="",this.style.maskImage="",this.style.webkitMaskImage="";return}const i=this.closest("mint-button")||((c=this.parentElement)==null?void 0:c.closest("mint-button")),s=this.closest("mint-switch")||((l=this.parentElement)==null?void 0:l.closest("mint-switch")),r=this.closest("mint-select")||((o=this.parentElement)==null?void 0:o.closest("mint-select"));if(!Array.from(this.classList).some(d=>d.startsWith("w-")||d.startsWith("h-"))&&!r){let d;s?d="w-3 h-3":i?d="w-5 h-5":d="w-[1.3em] h-[1.3em]",this.classList.remove("w-4","h-4","w-5","h-5","w-[1em]","h-[1em]","w-[1.3em]","h-[1.3em]","w-3","h-3"),d.split(" ").forEach(h=>{h&&this.classList.add(h)})}const a=this.getIconUrl();if(this.style.maskImage=`url(${a})`,this.style.webkitMaskImage=`url(${a})`,this.style.maskSize="contain",this.style.webkitMaskSize="contain",this.style.maskRepeat="no-repeat",this.style.webkitMaskRepeat="no-repeat",this.style.maskPosition="center",this.style.webkitMaskPosition="center",this.style.aspectRatio="1 / 1",this.style.backgroundColor="currentColor",this.innerHTML="",s)this.classList.remove("text-gray-100","text-gray-900"),this.classList.add("text-gray-900");else if(i)this.classList.remove("text-gray-100","text-gray-900");else{const h=document.documentElement.classList.contains("dark")?"text-gray-100":"text-gray-900";this.classList.remove("text-gray-100","text-gray-900"),this.classList.add(h)}}}customElements.get("mint-icon")||customElements.define("mint-icon",O);class F extends HTMLElement{constructor(){super(),this._button=null,this._clickHandler=null,this._isHandlingClick=!1,this._handleMouseDown=()=>{this._button&&!this.isDisabled()&&!this.isLoading()&&this._button.classList.add("mint-button-active")},this._handleMouseUp=()=>{this._button&&this._button.classList.remove("mint-button-active")},this._handleMouseLeave=()=>{this._button&&this._button.classList.remove("mint-button-active")},this._handleTouchStart=()=>{this._button&&!this.isDisabled()&&!this.isLoading()&&this._button.classList.add("mint-button-active")},this._handleTouchEnd=()=>{this._button&&this._button.classList.remove("mint-button-active")},this._handleTouchCancel=()=>{this._button&&this._button.classList.remove("mint-button-active")}}static get observedAttributes(){return["variant","tone","disabled","loading","button-type","full-width","icon-position","icon"]}connectedCallback(){this.classList.add("box-border","m-0","p-0","border-0","align-baseline","inline-block"),this.render(),this._button&&this.setupEventListeners(),this.isFullWidth()&&this.classList.add("w-full")}disconnectedCallback(){this.removeEventListeners()}attributeChangedCallback(e,t,i){t!==i&&this.render()}getVariant(){return this.getAttribute("variant")||"solid"}getTone(){return this.getAttribute("tone")||"neutral"}isDisabled(){return this.hasAttribute("disabled")}isLoading(){return this.hasAttribute("loading")}getType(){return(this.getAttribute("button-type")||"default")==="submit"?"submit":"button"}isFullWidth(){return this.hasAttribute("full-width")}getIconPosition(){return this.getAttribute("icon-position")||"left"}getIcon(){return this.getAttribute("icon")||""}isIconOnly(){var i,s,r,n,a;if(!(this.getIcon()||((i=this._button)==null?void 0:i.querySelector('[slot="icon"], .mint-button-icon, mint-icon'))))return!1;const t=(s=this._button)==null?void 0:s.querySelector(".mint-button-content");if(t&&((r=t.textContent)!=null&&r.trim()))return!1;if(this._button)for(let c=this._button.firstChild;c;c=c.nextSibling){if(c.nodeType===Node.TEXT_NODE&&((n=c.textContent)!=null&&n.trim()))return!1;if(c.nodeType===Node.ELEMENT_NODE){const l=c;if(l.tagName!=="MINT-ICON"&&l.tagName!=="MINT-SPINNER"&&!l.querySelector("mint-spinner")&&!l.hasAttribute("slot")&&l.className!=="mint-button-icon"&&!(l.className==="mr-2"&&l.querySelector("mint-spinner"))&&(a=l.textContent)!=null&&a.trim())return!1}}return!0}getButtonClasses(){const e=this.isIconOnly(),t=this.getVariant(),i=["inline-flex","items-center","justify-center","font-medium","rounded-lg","box-border",...e?["p-1.5","aspect-square","w-[2rem]","h-[2rem]"]:["px-3.5","py-1.5","min-h-[2rem]"],"text-sm","transition-all","duration-200","outline-none","focus:outline-none","focus-visible:ring-2","focus-visible:ring-offset-1","[&.mint-button-active>*]:scale-95","[&>*]:transition-transform","[&>*]:duration-100","disabled:opacity-50","disabled:cursor-not-allowed"],s=this.getTone(),r={"solid-action":["bg-slate-800","dark:bg-slate-600","text-white","hover:bg-slate-950","dark:hover:bg-slate-700","active:bg-slate-900","active:shadow-[inset_0_2px_4px_rgba(0,0,0,0.3)]","dark:active:bg-slate-700","disabled:active:bg-slate-800","dark:disabled:active:bg-slate-600","disabled:active:shadow-none","focus-visible:ring-gray-400","dark:focus-visible:ring-gray-500","shadow-sm","hover:shadow","dark:shadow-gray-900/50","border-2","border-transparent"],"solid-neutral":["bg-white","dark:bg-gray-700","text-gray-900","dark:text-white","hover:bg-gray-50","dark:hover:bg-gray-600","active:bg-gray-100","active:shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]","dark:active:bg-gray-800","disabled:active:bg-white","dark:disabled:active:bg-gray-700","disabled:active:shadow-none","focus-visible:ring-gray-400","dark:focus-visible:ring-gray-500","shadow-sm","hover:shadow","dark:shadow-gray-900/50","border-2","border-gray-200","dark:border-gray-600"],"solid-info":["bg-blue-800","dark:bg-blue-600","text-white","hover:bg-blue-950","dark:hover:bg-blue-700","active:bg-blue-900","active:shadow-[inset_0_2px_4px_rgba(0,0,0,0.3)]","dark:active:bg-blue-700","disabled:active:bg-blue-800","dark:disabled:active:bg-blue-600","disabled:active:shadow-none","focus-visible:ring-gray-400","dark:focus-visible:ring-gray-500","shadow-sm","hover:shadow","dark:shadow-gray-900/50","border-2","border-transparent"],"solid-warning":["bg-amber-800","dark:bg-amber-600","text-white","hover:bg-amber-950","dark:hover:bg-amber-700","active:bg-amber-900","active:shadow-[inset_0_2px_4px_rgba(0,0,0,0.3)]","dark:active:bg-amber-700","disabled:active:bg-amber-800","dark:disabled:active:bg-amber-600","disabled:active:shadow-none","focus-visible:ring-gray-400","dark:focus-visible:ring-gray-500","shadow-sm","hover:shadow","dark:shadow-gray-900/50","border-2","border-transparent"],"solid-danger":["bg-red-800","dark:bg-red-600","text-white","hover:bg-red-950","dark:hover:bg-red-700","active:bg-red-900","active:shadow-[inset_0_2px_4px_rgba(0,0,0,0.3)]","dark:active:bg-red-700","disabled:active:bg-red-800","dark:disabled:active:bg-red-600","disabled:active:shadow-none","focus-visible:ring-gray-400","dark:focus-visible:ring-gray-500","shadow-sm","hover:shadow","dark:shadow-gray-900/50","border-2","border-transparent"],"ghost-action":["bg-transparent","text-slate-800","dark:text-slate-400","active:bg-gray-100","active:shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]","dark:active:bg-gray-800","disabled:active:bg-transparent","dark:disabled:active:bg-transparent","disabled:active:shadow-none","focus-visible:ring-gray-400","dark:focus-visible:ring-gray-500","shadow-none","hover:shadow-none","border-2","border-transparent"],"ghost-neutral":["bg-transparent","text-gray-700","dark:text-gray-200","active:bg-gray-50","active:shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]","dark:active:bg-gray-800","active:text-gray-900","dark:active:text-white","disabled:active:bg-transparent","dark:disabled:active:bg-transparent","disabled:active:shadow-none","focus-visible:ring-gray-400","dark:focus-visible:ring-gray-500","shadow-none","hover:shadow-none","border-2","border-transparent"],"ghost-info":["bg-transparent","text-blue-800","dark:text-blue-400","active:bg-gray-100","active:shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]","dark:active:bg-gray-800","disabled:active:bg-transparent","dark:disabled:active:bg-transparent","disabled:active:shadow-none","focus-visible:ring-gray-400","dark:focus-visible:ring-gray-500","shadow-none","hover:shadow-none","border-2","border-transparent"],"ghost-warning":["bg-transparent","text-amber-800","dark:text-amber-400","active:bg-gray-100","active:shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]","dark:active:bg-gray-800","disabled:active:bg-transparent","dark:disabled:active:bg-transparent","disabled:active:shadow-none","focus-visible:ring-gray-400","dark:focus-visible:ring-gray-500","shadow-none","hover:shadow-none","border-2","border-transparent"],"ghost-danger":["bg-transparent","text-red-800","dark:text-red-400","active:bg-gray-100","active:shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]","dark:active:bg-gray-800","disabled:active:bg-transparent","dark:disabled:active:bg-transparent","disabled:active:shadow-none","focus-visible:ring-gray-400","dark:focus-visible:ring-gray-500","shadow-none","hover:shadow-none","border-2","border-transparent"],"link-action":["bg-transparent","text-slate-800","dark:text-slate-400","hover:text-slate-950","dark:hover:text-slate-200","active:text-slate-900","dark:active:text-slate-300","disabled:active:bg-transparent","dark:disabled:active:bg-transparent","disabled:active:shadow-none","focus-visible:ring-gray-400","dark:focus-visible:ring-gray-500","shadow-none","hover:shadow-none","border-2","border-transparent"],"link-neutral":["bg-transparent","text-gray-700","dark:text-gray-300","hover:text-gray-900","dark:hover:text-gray-100","active:text-gray-950","dark:active:text-gray-200","disabled:active:bg-transparent","dark:disabled:active:bg-transparent","disabled:active:shadow-none","focus-visible:ring-gray-400","dark:focus-visible:ring-gray-500","shadow-none","hover:shadow-none","border-2","border-transparent"],"link-info":["bg-transparent","text-blue-800","dark:text-blue-400","hover:text-blue-950","dark:hover:text-blue-300","active:text-blue-900","dark:active:text-blue-200","disabled:active:bg-transparent","dark:disabled:active:bg-transparent","disabled:active:shadow-none","focus-visible:ring-gray-400","dark:focus-visible:ring-gray-500","shadow-none","hover:shadow-none","border-2","border-transparent"],"link-warning":["bg-transparent","text-amber-800","dark:text-amber-400","hover:text-amber-950","dark:hover:text-amber-300","active:text-amber-900","dark:active:text-amber-200","disabled:active:bg-transparent","dark:disabled:active:bg-transparent","disabled:active:shadow-none","focus-visible:ring-gray-400","dark:focus-visible:ring-gray-500","shadow-none","hover:shadow-none","border-2","border-transparent"],"link-danger":["bg-transparent","text-red-800","dark:text-red-400","hover:text-red-950","dark:hover:text-red-300","active:text-red-900","dark:active:text-red-200","disabled:active:bg-transparent","dark:disabled:active:bg-transparent","disabled:active:shadow-none","focus-visible:ring-gray-400","dark:focus-visible:ring-gray-500","shadow-none","hover:shadow-none","border-2","border-transparent"]},n=`${t}-${s}`,a=r[n]||r["solid-neutral"],c=[...i,...a];return this.isFullWidth()&&c.push("w-full"),c.join(" ")}render(){var o,d,h,u,b;const e=this.isDisabled()||this.isLoading(),t=this.getType();if(!this._button){for(this._button=document.createElement("button");this.firstChild;)this._button.appendChild(this.firstChild);this.appendChild(this._button),this.setupEventListeners()}this._button.type=t,this._button.disabled=e;let i=this._button.querySelector("mint-spinner");if(this.isLoading())if(i)i.setAttribute("data-button-variant",this.getVariant()),i.setAttribute("data-button-tone",this.getTone()),"render"in i&&typeof i.render=="function"&&i.render();else{const f=document.createElement("span");f.className="mr-2 inline-flex items-center";const _=document.createElement("mint-spinner");_.setAttribute("size","default"),_.setAttribute("data-button-variant",this.getVariant()),_.setAttribute("data-button-tone",this.getTone()),_.style.width="0.875rem",_.style.height="0.875rem",f.appendChild(_),this._button.insertBefore(f,this._button.firstChild)}else i&&((o=i.parentElement)==null||o.remove());for(;this.firstChild&&this.firstChild!==this._button;)this._button.appendChild(this.firstChild);const s=this.getIcon();let r=this._button.querySelector('[slot="icon"], .mint-button-icon, mint-icon');s?(r&&r.tagName!=="MINT-ICON"&&(r.remove(),r=null),!r||r.tagName!=="MINT-ICON"?(r=document.createElement("mint-icon"),r.setAttribute("name",s),r.className="mint-button-icon"):r.setAttribute("name",s)):r&&r.tagName==="MINT-ICON"&&(r.remove(),r=null),r||(r=this._button.querySelector('[slot="icon"], .mint-button-icon'));const n=this.getIconPosition();let a=this._button.querySelector(".mint-button-content");if(a){const f=r&&r.tagName==="MINT-ICON";if(r&&!r.parentElement){const _=(u=this._button.querySelector("mint-spinner"))==null?void 0:u.parentElement;f||n==="left"?_?_.insertAdjacentElement("afterend",r):this._button.insertBefore(r,a):a.insertAdjacentElement("afterend",r)}else if(r&&(f||n==="left")&&r.nextSibling!==a){r.remove();const _=(b=this._button.querySelector("mint-spinner"))==null?void 0:b.parentElement;_?_.insertAdjacentElement("afterend",r):this._button.insertBefore(r,a)}else r&&!f&&n==="right"&&r.previousSibling!==a&&(r.remove(),a.insertAdjacentElement("afterend",r))}else{const f=[];for(let _=this._button.firstChild;_;_=_.nextSibling){if(_.nodeType!==Node.ELEMENT_NODE){f.push(_);continue}const m=_;m.tagName!=="MINT-SPINNER"&&!m.querySelector("mint-spinner")&&_!==r&&!m.hasAttribute("slot")&&!(m.className==="mr-2"&&m.querySelector("mint-spinner"))&&f.push(_)}if(f.length>0){a=document.createElement("span"),a.className="mint-button-content inline-flex items-center",f.forEach(m=>{a.appendChild(m)});const _=(d=this._button.querySelector("mint-spinner"))==null?void 0:d.parentElement;r&&n==="left"?_?(_.insertAdjacentElement("afterend",r),r.insertAdjacentElement("afterend",a)):(this._button.insertBefore(r,this._button.firstChild),r.insertAdjacentElement("afterend",a)):r&&n==="right"?_?(_.insertAdjacentElement("afterend",a),a.insertAdjacentElement("afterend",r)):(this._button.insertBefore(a,this._button.firstChild),a.insertAdjacentElement("afterend",r)):_?_.insertAdjacentElement("afterend",a):this._button.insertBefore(a,this._button.firstChild)}else if(r&&r.tagName==="MINT-ICON"&&!r.parentElement){const _=(h=this._button.querySelector("mint-spinner"))==null?void 0:h.parentElement;_?_.insertAdjacentElement("afterend",r):this._button.insertBefore(r,this._button.firstChild)}}const c=this.isIconOnly();r&&(r.classList.contains("mint-button-icon")||r.classList.add("mint-button-icon"),r.classList.remove("mr-1.5","ml-1.5"),c?r.tagName==="MINT-ICON"?(r.style.width="1rem",r.style.height="1rem",r.style.maxWidth="1rem",r.style.maxHeight="1rem",r.style.flexShrink="0"):(r.style.maxWidth="1rem",r.style.maxHeight="1rem",r.style.flexShrink="0",r.tagName==="svg"&&(r.style.width="1rem",r.style.height="1rem")):n==="left"?r.classList.add("mr-1.5"):r.classList.add("ml-1.5"));const l=this.getButtonClasses();this._button.className=l}setupEventListeners(){this._button&&!this._clickHandler&&(this._clickHandler=this.handleClick.bind(this),this._clickHandler&&this._button.addEventListener("click",this._clickHandler,!0),this._button.addEventListener("mousedown",this._handleMouseDown),this._button.addEventListener("mouseup",this._handleMouseUp),this._button.addEventListener("mouseleave",this._handleMouseLeave),this._button.addEventListener("touchstart",this._handleTouchStart),this._button.addEventListener("touchend",this._handleTouchEnd),this._button.addEventListener("touchcancel",this._handleTouchCancel))}removeEventListeners(){this._button&&(this._clickHandler&&(this._button.removeEventListener("click",this._clickHandler,!0),this._clickHandler=null),this._button.removeEventListener("mousedown",this._handleMouseDown),this._button.removeEventListener("mouseup",this._handleMouseUp),this._button.removeEventListener("mouseleave",this._handleMouseLeave),this._button.removeEventListener("touchstart",this._handleTouchStart),this._button.removeEventListener("touchend",this._handleTouchEnd),this._button.removeEventListener("touchcancel",this._handleTouchCancel))}handleClick(e){if(this.isDisabled()||this.isLoading()){e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation();return}if(e.stopPropagation(),e.stopImmediatePropagation(),this._isHandlingClick){e.preventDefault();return}this._isHandlingClick=!0,e.preventDefault(),this.dispatchEvent(new CustomEvent("click",{detail:{originalEvent:e},bubbles:!0,cancelable:!0,composed:!0})),requestAnimationFrame(()=>{this._isHandlingClick=!1})}}customElements.get("mint-button")||customElements.define("mint-button",F);class q extends HTMLElement{constructor(){super(),this._button=null,this._checked=!1}static get observedAttributes(){return["checked","disabled","label","icon"]}connectedCallback(){this.classList.add("box-border","m-0","p-0","border-0","align-baseline","inline-block","flex","items-center"),this._checked=this.hasAttribute("checked"),this.render()}disconnectedCallback(){this.removeEventListeners()}attributeChangedCallback(e,t,i){e==="checked"&&(this._checked=i!==null),t!==i&&this.render()}get checked(){return this._checked}set checked(e){e?this.setAttribute("checked",""):this.removeAttribute("checked"),this._checked=!!e,this.render()}isDisabled(){return this.hasAttribute("disabled")}getLabel(){return this.getAttribute("label")||""}getIcon(){return this.getAttribute("icon")||""}hasIcon(){return!!this.getIcon()}getSwitchClasses(){const e=["relative","inline-flex","items-center","rounded-full","h-5","w-10","border","transition-colors","duration-200","ease-in-out","outline-none","focus:outline-none","focus-visible:ring-2","focus-visible:ring-offset-1","focus-visible:ring-gray-400","dark:focus-visible:ring-gray-500","active:shadow-[inset_0_2px_4px_rgba(0,0,0,0.3)]","disabled:opacity-50","disabled:cursor-not-allowed"],t=this._checked?["bg-slate-950","dark:bg-slate-600","border-slate-700","dark:border-slate-500"]:["bg-slate-200","dark:bg-slate-400","border-slate-300","dark:border-slate-500"];return[...e,...t].join(" ")}getThumbClasses(){const e=["relative","inline-block","rounded-full","bg-white","dark:bg-gray-50","h-4","w-4","shadow-lg","transform","transition-transform","duration-200","ease-in-out","pointer-events-none","overflow-hidden"],t=this._checked?"translate-x-5":"translate-x-0.5";return[...e,t].join(" ")}getIconClasses(){return["absolute","inset-0","flex","items-center","justify-center","pointer-events-none"].join(" ")}render(){const e=this.getSwitchClasses(),t=this.getThumbClasses(),i=this.getLabel(),s=this.getIcon();this._button||(this._button=document.createElement("button"),this.appendChild(this._button),this.setupEventListeners()),this._button.className=e,this._button.disabled=this.isDisabled(),this._button.setAttribute("aria-checked",String(this._checked)),this._button.setAttribute("aria-label",i),this._button.setAttribute("role","switch"),this._button.type="button";let r=this._button.querySelector("span");r||(r=document.createElement("span"),this._button.appendChild(r)),r.className=t;const n=r.querySelector("span");if(s){let a=n;a||(a=document.createElement("span"),a.className=this.getIconClasses(),r.appendChild(a));let c=a.querySelector("mint-icon");c||(c=document.createElement("mint-icon"),a.appendChild(c)),c.setAttribute("name",s)}else n&&n.remove()}setupEventListeners(){this._button&&this._button.addEventListener("click",this.handleToggle.bind(this))}removeEventListeners(){this._button&&this._button.removeEventListener("click",this.handleToggle.bind(this))}handleToggle(e){this.isDisabled()||(this.checked=!this._checked,this.dispatchEvent(new CustomEvent("change",{detail:{checked:this._checked},bubbles:!0,cancelable:!0})),this.dispatchEvent(new CustomEvent("toggle",{detail:{checked:this._checked},bubbles:!0,cancelable:!0})))}}customElements.get("mint-switch")||customElements.define("mint-switch",q);class B extends HTMLElement{constructor(){super(),this._darkModeObserver=null,this._userClasses=new Set}static get observedAttributes(){return["variant","size","bold","underline","strike","italic","display"]}connectedCallback(){this.classList.add("box-border","m-0","p-0","border-0","align-baseline"),this._captureUserClasses(),this.render(),this._observeDarkMode()}_captureUserClasses(){Array.from(this.classList).forEach(t=>this._userClasses.add(t))}attributeChangedCallback(e,t,i){t!==i&&this.render()}disconnectedCallback(){this._darkModeObserver&&(this._darkModeObserver.disconnect(),this._darkModeObserver=null)}_observeDarkMode(){this._darkModeObserver||(this._darkModeObserver=new MutationObserver(()=>{this.render()}),this._darkModeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}))}getVariant(){return this.getAttribute("variant")||"default"}getSize(){return this.getAttribute("size")||"regular"}isBold(){return this.hasAttribute("bold")}isUnderline(){return this.hasAttribute("underline")}isStrike(){return this.hasAttribute("strike")}isItalic(){return this.hasAttribute("italic")}getDisplay(){return this.hasAttribute("display")?this.getAttribute("display"):this.getSize()==="regular"?"inline-block":"block"}getTextClasses(){const e=this.getSize(),t=this.getVariant(),i=document.documentElement.classList.contains("dark"),s={heading:["font-semibold"],"sub-heading":["font-medium"],regular:[]},r={default:i?["text-gray-100"]:["text-gray-900"],muted:i?["text-gray-400"]:["text-gray-400"],danger:i?["text-red-400"]:["text-red-600"],success:i?["text-green-400"]:["text-green-600"]},n=[];this.isBold()&&n.push("font-bold"),this.isUnderline()&&n.push("underline"),this.isStrike()&&n.push("line-through"),this.isItalic()&&n.push("italic");const a=this.getDisplay();return[a==="block"?"block":a==="inline"?"inline":"inline-block",...s[e]||s.regular,...r[t]||r.default,...n].join(" ")}render(){const e=this.getSize(),t=["text-gray-100","text-gray-900","text-gray-400","text-red-400","text-red-600","text-green-400","text-green-600"],i=["text-2xl","text-lg","text-sm"];i.forEach(l=>{this.classList.remove(l),this._userClasses.delete(l)}),t.forEach(l=>{this.classList.remove(l),this._userClasses.delete(l)});const s=this.getTextClasses().split(" ").filter(l=>l.trim());Array.from(this.classList).forEach(l=>{!t.includes(l)&&!i.includes(l)&&this._userClasses.add(l)});const n=[...new Set([...s,...Array.from(this._userClasses)])];this.className=n.join(" ");const a={heading:"clamp(1.25rem, 2.5vw + 0.5rem, 1.5rem)","sub-heading":"clamp(1rem, 1.5vw + 0.5rem, 1.125rem)",regular:"clamp(0.875rem, 1vw + 0.5rem, 0.875rem)"},c=a[e]||a.regular;this.style.setProperty("font-size",c)}}customElements.get("mint-text")||customElements.define("mint-text",B);class z extends HTMLElement{constructor(){super(),this._childObserver=null}static get observedAttributes(){return["direction","text-align","gap"]}connectedCallback(){this.classList.add("box-border","m-0","p-0","border-0","align-baseline","block"),this.render(),this.getTextAlign()&&this._observeChildren()}attributeChangedCallback(e,t,i){t!==i&&(this.render(),e==="text-align"&&this._observeChildren())}_observeChildren(){this._childObserver||(this._childObserver=new MutationObserver(()=>{const e=this.getTextAlign();e&&this._applyTextAlignToChildren(e)}),this._childObserver.observe(this,{childList:!0,subtree:!1}))}disconnectedCallback(){this._childObserver&&(this._childObserver.disconnect(),this._childObserver=null)}getDirection(){return(this.getAttribute("direction")||"vertical")==="horizontal"?"horizontal":"vertical"}getGap(){const e=this.getAttribute("gap")||"3";return parseFloat(e)}getTextAlign(){const e=this.getAttribute("text-align")||"";return["left","center","right","justify"].includes(e)?e:""}getStackClasses(){const e=this.getDirection(),t=this.getTextAlign(),i=this.getGap(),s=["flex",e==="horizontal"?"flex-row":"flex-col",`gap-${i}`];return t&&(s.push(`text-${t}`),s.push(`[&>*]:text-${t}`),s.push(`[&>*_.mint-button-content]:text-${t}`),t==="left"?(s.push("[&>mint-button]:!justify-start"),s.push("[&>mint-button>button]:!justify-start")):t==="right"?(s.push("[&>mint-button]:!justify-end"),s.push("[&>mint-button>button]:!justify-end")):t==="center"&&(s.push("[&>mint-button]:!justify-center"),s.push("[&>mint-button>button]:!justify-center"))),s.join(" ")}render(){const e=this.getStackClasses(),t=this.getTextAlign();["flex","flex-row","flex-col","gap-1","gap-2","gap-3","text-left","text-center","text-right","text-justify","[&>*]:text-left","[&>*]:text-center","[&>*]:text-right","[&>*]:text-justify","[&>*_.mint-button-content]:text-left","[&>*_.mint-button-content]:text-center","[&>*_.mint-button-content]:text-right","[&>*_.mint-button-content]:text-justify","[&>mint-button]:!justify-start","[&>mint-button]:!justify-center","[&>mint-button]:!justify-end","[&>mint-button>button]:!justify-start","[&>mint-button>button]:!justify-center","[&>mint-button>button]:!justify-end"].forEach(r=>this.classList.remove(r)),e.split(" ").forEach(r=>{r&&this.classList.add(r)}),["box-border","m-0","p-0","border-0","align-baseline","block"].forEach(r=>{this.classList.contains(r)||this.classList.add(r)}),t?this._applyTextAlignToChildren(t):this._removeTextAlignFromChildren()}_applyTextAlignToChildren(e){Array.from(this.children).forEach(i=>{if(i.tagName==="MINT-BUTTON"){const s=i.querySelector("button");if(s){s.classList.remove("justify-start","justify-center","justify-end"),e==="left"?s.classList.add("justify-start"):e==="right"?s.classList.add("justify-end"):e==="center"&&s.classList.add("justify-center");const r=s.querySelector(".mint-button-content");r&&(r.classList.remove("text-left","text-center","text-right","text-justify"),r.classList.add(`text-${e}`))}}else i.classList.remove("text-left","text-center","text-right","text-justify"),i.classList.add(`text-${e}`)})}_removeTextAlignFromChildren(){Array.from(this.children).forEach(t=>{if(t.tagName==="MINT-BUTTON"){const i=t.querySelector("button");if(i){i.classList.remove("justify-start","justify-end"),i.classList.add("justify-center");const s=i.querySelector(".mint-button-content");s&&s.classList.remove("text-left","text-center","text-right","text-justify")}}else t.classList.remove("text-left","text-center","text-right","text-justify")})}}customElements.get("mint-stack")||customElements.define("mint-stack",z);class V extends HTMLElement{static get observedAttributes(){return[]}constructor(){super()}connectedCallback(){this.classList.add("box-border","m-0","p-0","border-0","align-baseline","block"),this.render()}attributeChangedCallback(e,t,i){t!==i&&this.render()}render(){this.classList.add("rounded-lg","shadow","bg-white","dark:bg-gray-800","border","border-gray-200","dark:border-gray-700","overflow-hidden","transition-colors","duration-200")}}customElements.get("mint-card")||customElements.define("mint-card",V);class R extends HTMLElement{constructor(){super(),this._link=null,this._contentObserver=null}static get observedAttributes(){return["href","target"]}connectedCallback(){this.classList.add("box-border","m-0","p-0","border-0","align-baseline","inline-block"),this.render(),this._observeContent()}disconnectedCallback(){this._contentObserver&&(this._contentObserver.disconnect(),this._contentObserver=null)}_observeContent(){this._contentObserver||(this._contentObserver=new MutationObserver(()=>{this._link&&this._link.querySelectorAll("mint-text").forEach(t=>{t.classList.contains("underline")||t.classList.add("underline")})}),this._contentObserver.observe(this,{childList:!0,subtree:!0}))}attributeChangedCallback(e,t,i){t!==i&&this.render()}getHref(){return this.getAttribute("href")||"#"}getTarget(){return this.getAttribute("target")||""}hasIcon(){var e;return!!(this.querySelector("mint-icon")||(e=this._link)!=null&&e.querySelector("mint-icon"))}render(){const e=this.getHref(),t=this.getTarget();if(!this._link){for(this._link=document.createElement("a");this.firstChild;)this._link.appendChild(this.firstChild);this.appendChild(this._link)}this._link.href=e,t?(this._link.target=t,t==="_blank"&&(this._link.rel="noopener noreferrer")):(this._link.removeAttribute("target"),this._link.removeAttribute("rel"));const i=this.hasIcon(),s=["text-slate-800","dark:text-slate-200","underline","hover:text-slate-950","dark:hover:text-slate-100","transition-colors","duration-200","focus-visible:outline-none","focus-visible:ring-2","focus-visible:ring-offset-1","focus-visible:ring-gray-400","dark:focus-visible:ring-gray-500","rounded"];i&&s.push("inline-flex","items-center","gap-2"),this._link.className=s.join(" "),this._link.querySelectorAll("mint-text").forEach(a=>{a.classList.contains("underline")||a.classList.add("underline")}),["box-border","m-0","p-0","border-0","align-baseline","inline-block"].forEach(a=>{this.classList.contains(a)||this.classList.add(a)})}}customElements.get("mint-link")||customElements.define("mint-link",R);class W extends HTMLElement{constructor(){super(),this._button=null,this._historyDepth=0,this._maxBackAttempts=10,this._backAttempts=0,this._initialUrl="",this._initialOrigin="",this._popstateHandler=null}static get observedAttributes(){return["href","fallback-href"]}connectedCallback(){this.classList.add("box-border","m-0","p-0","border-0","align-baseline","inline-block","flex","items-center","justify-center"),this.render(),this._setupHistoryTracking()}disconnectedCallback(){this._popstateHandler&&(window.removeEventListener("popstate",this._popstateHandler),this._popstateHandler=null)}attributeChangedCallback(e,t,i){t!==i&&this.render()}_setupHistoryTracking(){this._initialUrl=window.location.href,this._initialOrigin=window.location.origin,this._historyDepth=window.history.length,this._popstateHandler||(this._popstateHandler=e=>{this._backAttempts=0,setTimeout(()=>{const t=window.location.origin,i=window.location.href;if(t!==this._initialOrigin){this._navigateToFallback();return}if(i.startsWith("chrome://")||i.startsWith("about:")||i.startsWith("edge://")||i==="about:blank"||i==="about:newtab"){this._navigateToFallback();return}},0)},window.addEventListener("popstate",this._popstateHandler))}getFallbackHref(){return this.getAttribute("fallback-href")||this.getAttribute("href")||"/"}handleClick(e){if(e.preventDefault(),e.stopPropagation(),this._wouldBackLeaveApp()){this._navigateToFallback();return}if(window.history.length>1&&this._backAttempts<this._maxBackAttempts&&this._backAttempts===0){this._backAttempts++;const s=window.location.href,r=window.location.origin;window.history.back(),setTimeout(()=>{if(window.location.href===s)this._navigateToFallback();else{if(window.location.origin!==r){this._navigateToFallback();return}const n=window.location.href;if(n.startsWith("chrome://")||n.startsWith("about:")||n.startsWith("edge://")||n==="about:blank"||n==="about:newtab"){this._navigateToFallback();return}setTimeout(()=>{this._backAttempts=0},500)}},200)}else this._navigateToFallback()}_wouldBackLeaveApp(){const e=document.referrer,t=window.location.origin;if(window.history.length<=1||!e&&window.history.length<=2)return!0;if(e)try{if(new URL(e).origin!==t&&window.history.length<=2)return!0}catch{if(window.history.length<=2)return!0}return!1}_navigateToFallback(){var t,i,s;const e=this.getFallbackHref();if(this._backAttempts=0,e.startsWith("/")&&!e.startsWith("//")){const r=document.querySelector("#app");if((s=(i=(t=r==null?void 0:r.__vue_app__)==null?void 0:t.config)==null?void 0:i.globalProperties)!=null&&s.$router)try{r.__vue_app__.config.globalProperties.$router.push(e);return}catch{}try{window.history.pushState({},"",e),window.dispatchEvent(new PopStateEvent("popstate"));return}catch{}}window.location.href=e}render(){this._button||(this._button=document.createElement("mint-button"),this._button.setAttribute("variant","neutral"),this._button.setAttribute("icon","arrow-left"),this._button.addEventListener("click",e=>this.handleClick(e)),this.appendChild(this._button))}}customElements.get("mint-back-button")||customElements.define("mint-back-button",W);class j extends HTMLElement{constructor(){super(),this._pageContainer=null,this._header=null,this._titleElement=null,this._headingText=null,this._actionsSlot=null,this._bodySlot=null,this._darkModeObserver=null}static get observedAttributes(){return["heading","fallback-href","show-back-button","containered"]}connectedCallback(){this.classList.add("box-border","m-0","p-0","border-0","align-baseline","block"),this.render(),this._observeDarkMode()}attributeChangedCallback(e,t,i){t!==i&&this.render()}disconnectedCallback(){this._darkModeObserver&&(this._darkModeObserver.disconnect(),this._darkModeObserver=null)}getHeading(){return this.getAttribute("heading")||""}getFallbackHref(){return this.getAttribute("fallback-href")||"/"}shouldShowBackButton(){return this.hasAttribute("show-back-button")}render(){const e=this.getHeading();this._pageContainer||(this._pageContainer=document.createElement("div"),this.appendChild(this._pageContainer)),this._applyContainerClasses(),this._header||(this._header=document.createElement("div"),this._header.className="flex justify-between mb-8",this._pageContainer.appendChild(this._header)),this._titleElement||(this._titleElement=document.createElement("div"),this._titleElement.className="flex gap-4 min-w-0 flex-1",this._header.appendChild(this._titleElement));let t=this._titleElement.querySelector("mint-back-button");if(this.shouldShowBackButton()){t||(t=document.createElement("mint-back-button"),this._titleElement.insertBefore(t,this._titleElement.firstChild));const n=this.getFallbackHref();t.setAttribute("fallback-href",n)}else t&&(t.remove(),t=null);e?(this._headingText?(this._headingText.classList.add("truncate","min-w-0"),t&&t.parentElement===this._titleElement?this._headingText.previousSibling!==t&&this._titleElement.insertBefore(this._headingText,t.nextSibling):this._headingText.previousSibling&&this._titleElement.insertBefore(this._headingText,this._titleElement.firstChild)):(this._headingText=document.createElement("mint-text"),this._headingText.setAttribute("size","heading"),this._headingText.setAttribute("bold",""),this._headingText.classList.add("truncate","min-w-0"),t&&t.parentElement===this._titleElement?this._titleElement.insertBefore(this._headingText,t.nextSibling):this._titleElement.insertBefore(this._headingText,this._titleElement.firstChild)),this._headingText.textContent=e):this._headingText&&(this._headingText.remove(),this._headingText=null),this._actionsSlot?this._actionsSlot.classList.contains("ml-4")||this._actionsSlot.classList.add("ml-4"):(this._actionsSlot=document.createElement("div"),this._actionsSlot.className="flex gap-2 items-center ml-4",this._actionsSlot.setAttribute("slot","actions"),this._header.appendChild(this._actionsSlot)),Array.from(this.children).filter(n=>n!==this._pageContainer&&n!==this._actionsSlot&&n.getAttribute("slot")==="actions").forEach(n=>{this._actionsSlot&&n.parentElement!==this._actionsSlot&&this._actionsSlot.appendChild(n)}),this._bodySlot||(this._bodySlot=document.createElement("div"),this._pageContainer.appendChild(this._bodySlot)),Array.from(this.children).forEach(n=>{n!==this._pageContainer&&n.getAttribute("slot")!=="actions"&&n!==this._actionsSlot&&n!==this._header&&n!==this._bodySlot&&n!==this._headingText&&n.parentElement!==this._bodySlot&&n.parentElement!==this._pageContainer&&this._bodySlot.appendChild(n)}),this._updateBackgroundColor()}_applyContainerClasses(){this._pageContainer&&(this._pageContainer.classList.add("min-h-screen","p-8","transition-colors","duration-200"),this.hasAttribute("containered")?this._pageContainer.classList.add("max-w-6xl","mx-auto","w-full"):this._pageContainer.classList.remove("max-w-6xl","mx-auto"))}_updateBackgroundColor(){if(!this._pageContainer)return;document.documentElement.classList.contains("dark")?(this._pageContainer.classList.remove("bg-gray-20"),this._pageContainer.classList.add("bg-gray-900")):(this._pageContainer.classList.remove("bg-gray-900"),this._pageContainer.classList.add("bg-gray-20"))}_observeDarkMode(){this._darkModeObserver||(this._darkModeObserver=new MutationObserver(()=>{this._updateBackgroundColor()}),this._darkModeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}))}}customElements.get("mint-page")||customElements.define("mint-page",j);class $ extends HTMLElement{static get observedAttributes(){return["columns","sm","md","lg","xl","gap"]}constructor(){super()}connectedCallback(){this.classList.add("box-border","m-0","p-0","border-0","align-baseline","block"),this.render()}attributeChangedCallback(e,t,i){t!==i&&this.render()}getColumns(){return this.getAttribute("columns")||"1"}getSm(){return this.getAttribute("sm")}getMd(){return this.getAttribute("md")}getLg(){return this.getAttribute("lg")}getXl(){return this.getAttribute("xl")}getGap(){return"3"}getGridClasses(){const e=["grid"],t=this.getColumns();e.push(`grid-cols-${t}`);const i=this.getSm();i&&e.push(`sm:grid-cols-${i}`);const s=this.getMd();s&&e.push(`md:grid-cols-${s}`);const r=this.getLg();r&&e.push(`lg:grid-cols-${r}`);const n=this.getXl();n&&e.push(`xl:grid-cols-${n}`);const a=this.getGap();return e.push(`gap-${a}`),e}render(){Array.from(this.classList).filter(i=>i.startsWith("grid-cols-")||i.startsWith("sm:grid-cols-")||i.startsWith("md:grid-cols-")||i.startsWith("lg:grid-cols-")||i.startsWith("xl:grid-cols-")||i.startsWith("gap-")).forEach(i=>this.classList.remove(i)),this.classList.contains("grid")||this.classList.add("grid"),this.getGridClasses().forEach(i=>{i&&i!=="grid"&&this.classList.add(i)})}}customElements.get("mint-grid")||customElements.define("mint-grid",$);class Y extends HTMLElement{constructor(){super(),this._overlay=null,this._modal=null,this._header=null,this._headingSlot=null,this._bodySlot=null,this._actionsSlot=null,this._closeButton=null,this._darkModeObserver=null}static get observedAttributes(){return["id","heading","open"]}connectedCallback(){this.classList.add("box-border","m-0","p-0","border-0","align-baseline","fixed","inset-0","z-50"),this.isOpen()||this.classList.add("hidden"),this.render(),this._observeDarkMode()}disconnectedCallback(){this._darkModeObserver&&(this._darkModeObserver.disconnect(),this._darkModeObserver=null)}attributeChangedCallback(e,t,i){t!==i&&this.render()}getId(){return this.getAttribute("id")||""}getHeading(){return this.getAttribute("heading")||""}isOpen(){return this.hasAttribute("open")}open(){this.setAttribute("open","")}close(){this.removeAttribute("open")}render(){const e=this.getId(),t=this.getHeading(),i=this.isOpen();if(e&&(this.id=e),this._overlay||(this._overlay=document.createElement("div"),this._overlay.className="fixed inset-0 bg-black bg-opacity-50 transition-opacity duration-200 z-40",this._overlay.addEventListener("click",()=>this.close()),this.appendChild(this._overlay)),this._modal||(this._modal=document.createElement("div"),this._modal.className="fixed inset-0 flex items-center justify-center p-2 pointer-events-none z-50",this.appendChild(this._modal)),i){let d=this._modal.querySelector(".modal-content");d||(d=document.createElement("div"),d.className="modal-content bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-2xl w-full max-h-[90vh] flex flex-col pointer-events-auto transition-all duration-200 ease-out transform",this._modal.appendChild(d)),this._animateEnter()}else this._animateExit();let s=this._modal.querySelector(".modal-content");s||(s=document.createElement("div"),s.className="modal-content bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-2xl w-full max-h-[90vh] flex flex-col pointer-events-auto transition-all duration-200 ease-out transform",this._modal.appendChild(s)),this._header||(this._header=document.createElement("div"),this._header.className="flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-700",s.appendChild(this._header)),this._headingSlot||(this._headingSlot=document.createElement("div"),this._headingSlot.className="flex-1",this._headingSlot.setAttribute("slot","heading"),this._header.appendChild(this._headingSlot));let r=this._headingSlot.querySelector("mint-text");t?(r||(r=document.createElement("mint-text"),r.setAttribute("size","sub-heading"),r.setAttribute("bold",""),this._headingSlot.appendChild(r)),r.textContent=t):r&&r.remove(),Array.from(this.children).filter(d=>d!==this._overlay&&d!==this._modal&&d!==this._headingSlot&&d.getAttribute("slot")==="heading").forEach(d=>{this._headingSlot&&d.parentElement!==this._headingSlot&&this._headingSlot.appendChild(d)}),this._closeButton||(this._closeButton=document.createElement("mint-button"),this._closeButton.setAttribute("variant","ghost"),this._closeButton.setAttribute("icon","close"),this._closeButton.addEventListener("click",()=>this.close()),this._header.appendChild(this._closeButton)),this._bodySlot||(this._bodySlot=document.createElement("div"),this._bodySlot.className="flex-1 overflow-y-auto p-4",this._bodySlot.setAttribute("slot","body"),s.appendChild(this._bodySlot)),Array.from(this.children).filter(d=>d!==this._overlay&&d!==this._modal&&d!==this._bodySlot&&d.getAttribute("slot")==="body").forEach(d=>{this._bodySlot&&d.parentElement!==this._bodySlot&&this._bodySlot.appendChild(d)}),this._actionsSlot||(this._actionsSlot=document.createElement("div"),this._actionsSlot.className="p-4 border-t border-gray-200 dark:border-gray-700",this._actionsSlot.setAttribute("slot","actions"),s.appendChild(this._actionsSlot));let c=this._actionsSlot.querySelector("mint-stack");c||(c=document.createElement("mint-stack"),c.setAttribute("direction","horizontal"),c.className="justify-end",this._actionsSlot.appendChild(c)),Array.from(this.children).filter(d=>d!==this._overlay&&d!==this._modal&&d!==this._actionsSlot&&d.getAttribute("slot")==="actions").forEach(d=>{Array.from(d.children).forEach(u=>{u.parentElement!==c&&c.appendChild(u)}),d.parentElement&&d.remove()}),Array.from(this.children).forEach(d=>{d!==this._overlay&&d!==this._modal&&d.getAttribute("slot")!=="heading"&&d.getAttribute("slot")!=="body"&&d.getAttribute("slot")!=="actions"&&d!==this._headingSlot&&d!==this._bodySlot&&d!==this._actionsSlot&&d.parentElement!==this._bodySlot&&this._bodySlot.appendChild(d)}),this._updateBackgroundColor()}_updateBackgroundColor(){if(!this._modal)return;const e=document.documentElement.classList.contains("dark"),t=this._modal.querySelector(".modal-content");t&&(e?(t.classList.remove("bg-white"),t.classList.add("bg-gray-800")):(t.classList.remove("bg-gray-800"),t.classList.add("bg-white")))}_observeDarkMode(){this._darkModeObserver||(this._darkModeObserver=new MutationObserver(()=>{this._updateBackgroundColor()}),this._darkModeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}))}_animateEnter(){var t;const e=(t=this._modal)==null?void 0:t.querySelector(".modal-content");e&&(e.style.transform="scale(0.97) translateY(10px)",e.style.opacity="0",e.style.transition="all 200ms ease-out",this.classList.remove("hidden"),requestAnimationFrame(()=>{requestAnimationFrame(()=>{e.style.transform="scale(1) translateY(0)",e.style.opacity="1"})}))}_animateExit(){var t;const e=(t=this._modal)==null?void 0:t.querySelector(".modal-content");if(!e){this.classList.add("hidden");return}e.style.transition="all 200ms ease-in",e.style.transform="scale(0.97) translateY(10px)",e.style.opacity="0",setTimeout(()=>{this.classList.add("hidden"),e.style.transform="",e.style.opacity="",e.style.transition=""},200)}}customElements.get("mint-modal")||customElements.define("mint-modal",Y);class U extends HTMLElement{constructor(){super(),this._overlay=null,this._popover=null,this._triggerElement=null,this._darkModeObserver=null,this._clickOutsideHandler=null,this._triggerClickHandler=null,this._triggerHoverEnterHandler=null,this._triggerHoverLeaveHandler=null,this._popoverHoverEnterHandler=null,this._popoverHoverLeaveHandler=null,this._hoverCloseTimeout=null,this._scrollHandler=null,this._resizeHandler=null}static get observedAttributes(){return["id","direction","open","trigger-id","padding","hover"]}connectedCallback(){this.classList.add("box-border","m-0","p-0","border-0","align-baseline","fixed","top-0","left-0","z-50","pointer-events-none"),this.isOpen()||this.classList.add("hidden"),this.render(),this._setupTrigger(),this._observeDarkMode()}disconnectedCallback(){this._darkModeObserver&&(this._darkModeObserver.disconnect(),this._darkModeObserver=null),this._clickOutsideHandler&&(document.removeEventListener("click",this._clickOutsideHandler),this._clickOutsideHandler=null),this._triggerClickHandler&&this._triggerElement&&(this._triggerElement.removeEventListener("click",this._triggerClickHandler,!0),this._triggerClickHandler=null),this._removeHoverListeners(),this._scrollHandler&&(window.removeEventListener("scroll",this._scrollHandler,!0),this._scrollHandler=null),this._resizeHandler&&(window.removeEventListener("resize",this._resizeHandler),this._resizeHandler=null)}attributeChangedCallback(e,t,i){t!==i&&(this.render(),(e==="trigger-id"||e==="hover")&&this._setupTrigger(),e==="open"&&this.isOpen()&&this._closeOtherPopovers())}getId(){return this.getAttribute("id")||""}getPadding(){const e=this.getAttribute("padding")||"4";return{0:"p-0","0.5":"p-0.5",1:"p-1","1.5":"p-1.5",2:"p-2","2.5":"p-2.5",3:"p-3","3.5":"p-3.5",4:"p-4",5:"p-5",6:"p-6",8:"p-8",10:"p-10",12:"p-12",16:"p-16",20:"p-20",24:"p-24"}[e]||"p-4"}getDirection(){return this.getAttribute("direction")||"down"}getTriggerId(){return this.getAttribute("trigger-id")||""}isHoverEnabled(){return this.hasAttribute("hover")}isOpen(){return this.hasAttribute("open")}open(){this.setAttribute("open","")}close(){this.removeAttribute("open")}_setupTrigger(){const e=this.getTriggerId();this._triggerClickHandler&&this._triggerElement&&(this._triggerElement.removeEventListener("click",this._triggerClickHandler,!0),this._triggerClickHandler=null),this._removeHoverListeners(),e&&(this._triggerElement=document.getElementById(e),this._triggerElement?(this._attachTriggerListener(),this.isHoverEnabled()&&this._attachHoverListeners()):setTimeout(()=>{this._triggerElement=document.getElementById(e),this._triggerElement&&(this._attachTriggerListener(),this.isHoverEnabled()&&this._attachHoverListeners())},10))}_attachTriggerListener(){if(this._triggerElement&&!this._triggerClickHandler){const e=this;this._triggerClickHandler=function(t){t.stopImmediatePropagation(),t.preventDefault(),e.hasAttribute("open")?e.removeAttribute("open"):e.setAttribute("open","")},this._triggerElement.addEventListener("click",this._triggerClickHandler,!0)}}_attachHoverListeners(){if(!this.isHoverEnabled()||!this._triggerElement)return;this._removeHoverListeners();const e=this;this._triggerHoverEnterHandler=function(){e._cancelHoverClose(),e.open()},this._triggerHoverLeaveHandler=function(t){var s;const i=t.relatedTarget;i&&(e.contains(i)||(s=e._triggerElement)!=null&&s.contains(i))||e._scheduleHoverClose()},this._triggerElement.addEventListener("mouseenter",this._triggerHoverEnterHandler),this._triggerElement.addEventListener("mouseleave",this._triggerHoverLeaveHandler),this._popover&&(this._popoverHoverEnterHandler=function(){e._cancelHoverClose()},this._popoverHoverLeaveHandler=function(t){var s;const i=t.relatedTarget;i&&(e.contains(i)||(s=e._triggerElement)!=null&&s.contains(i))||e._scheduleHoverClose()},this._popover.addEventListener("mouseenter",this._popoverHoverEnterHandler),this._popover.addEventListener("mouseleave",this._popoverHoverLeaveHandler))}_removeHoverListeners(){this._triggerElement&&this._triggerHoverEnterHandler&&this._triggerElement.removeEventListener("mouseenter",this._triggerHoverEnterHandler),this._triggerElement&&this._triggerHoverLeaveHandler&&this._triggerElement.removeEventListener("mouseleave",this._triggerHoverLeaveHandler),this._popover&&this._popoverHoverEnterHandler&&this._popover.removeEventListener("mouseenter",this._popoverHoverEnterHandler),this._popover&&this._popoverHoverLeaveHandler&&this._popover.removeEventListener("mouseleave",this._popoverHoverLeaveHandler),this._triggerHoverEnterHandler=null,this._triggerHoverLeaveHandler=null,this._popoverHoverEnterHandler=null,this._popoverHoverLeaveHandler=null,this._cancelHoverClose()}_scheduleHoverClose(){this._cancelHoverClose(),this._hoverCloseTimeout=window.setTimeout(()=>{this._isHovering()||this.close()},120)}_cancelHoverClose(){this._hoverCloseTimeout!==null&&(clearTimeout(this._hoverCloseTimeout),this._hoverCloseTimeout=null)}_isHovering(){const e=this._triggerElement?this._triggerElement.matches(":hover"):!1,t=this._popover?this._popover.matches(":hover"):!1;return e||t}_calculatePosition(){if(!this._triggerElement||!this._popover)return{top:0,left:0,direction:"down"};const e=this._triggerElement.getBoundingClientRect(),t=this._popover.querySelector(".popover-content");if(!t)return{top:0,left:0,direction:"down"};this.classList.contains("hidden")&&(this.classList.remove("hidden"),this._popover.style.visibility="hidden");const s=t.getBoundingClientRect(),r=window.innerWidth,n=window.innerHeight,a=8;let c=this.getDirection(),l=0,o=0;switch(c){case"down":if(l=e.bottom+a,o=e.left+e.width/2-s.width/2,l+s.height>n){const d=e.top-s.height-a;d>=0?(c="up",l=d):(l=Math.max(0,n-s.height-a),l+s.height>n&&(l=0))}o<0&&(o=a),o+s.width>r&&(o=Math.max(a,r-s.width-a),o+s.width>r&&(o=r-s.width));break;case"up":if(l=e.top-s.height-a,o=e.left+e.width/2-s.width/2,l<0){const d=e.bottom+a;d+s.height<=n?(c="down",l=d):(l=Math.min(n-s.height-a,n-s.height),l<0&&(l=n-s.height))}o<0&&(o=a),o+s.width>r&&(o=Math.max(a,r-s.width-a),o+s.width>r&&(o=r-s.width));break;case"right":if(l=e.top+e.height/2-s.height/2,o=e.right+a,o+s.width>r){const d=e.left-s.width-a;d>=0?(c="left",o=d):(o=Math.max(0,r-s.width-a),o+s.width>r&&(o=r-s.width))}l<0&&(l=a),l+s.height>n&&(l=Math.max(a,n-s.height-a),l+s.height>n&&(l=n-s.height));break;case"left":if(l=e.top+e.height/2-s.height/2,o=e.left-s.width-a,o<0){const d=e.right+a;d+s.width<=r?(c="right",o=d):(o=Math.min(r-s.width-a,r-s.width),o<0&&(o=0))}l<0&&(l=a),l+s.height>n&&(l=Math.max(a,n-s.height-a),l+s.height>n&&(l=n-s.height));break}return{top:l,left:o,direction:c}}render(){const e=this.getId(),t=this.isOpen(),i=this.getPadding();if(e&&(this.id=e),t){if(this.classList.remove("hidden"),this.style.pointerEvents="auto",!this._clickOutsideHandler){const n=this;this._clickOutsideHandler=function(a){const c=a.composedPath(),l=c.includes(n);if(!(n._triggerElement&&c.includes(n._triggerElement))&&!l){n.close();return}},setTimeout(()=>{document.addEventListener("click",this._clickOutsideHandler,!1)},100)}}else this.classList.add("hidden"),this.style.pointerEvents="none",this._clickOutsideHandler&&(document.removeEventListener("click",this._clickOutsideHandler,!1),this._clickOutsideHandler=null);this._overlay||(this._overlay=document.createElement("div"),this._overlay.className="fixed inset-0 pointer-events-none z-40",this.appendChild(this._overlay)),this._popover||(this._popover=document.createElement("div"),this._popover.className="fixed z-50 pointer-events-auto",this.appendChild(this._popover)),this.isHoverEnabled()&&this._attachHoverListeners();let s=this._popover.querySelector(".popover-content");if(!s)s=document.createElement("div"),s.className=`popover-content bg-white dark:bg-gray-800 rounded-lg shadow-xl ${i} transition-all duration-200 ease-out transform`,this._popover.appendChild(s);else{const n=s.className.split(" "),a=["p-0","p-0.5","p-1","p-1.5","p-2","p-2.5","p-3","p-3.5","p-4","p-5","p-6","p-8","p-10","p-12","p-16","p-20","p-24"],c=n.filter(l=>!a.includes(l));s.className=[...c,i].join(" ")}Array.from(this.children).forEach(n=>{n!==this._overlay&&n!==this._popover&&n.parentElement===this&&s.appendChild(n)}),t?(this._triggerElement||this._setupTrigger(),this._setupPositionListeners(),this.offsetHeight,this._triggerElement?this._updatePosition(s):(this._popover.style.top="50%",this._popover.style.left="50%",this._popover.style.transform="translate(-50%, -50%)",this._popover.style.visibility="visible",this._popover.style.display="block",s.style.transform="scale(0.97) translateY(10px)",s.style.opacity="0",s.style.transition="all 200ms ease-out",requestAnimationFrame(()=>{requestAnimationFrame(()=>{s.style.transform="scale(1) translateY(0)",s.style.opacity="1"})}))):!t&&s&&(this._removePositionListeners(),s.style.opacity!=="0"&&s.style.opacity!==""&&(s.style.transition="all 200ms ease-in",s.style.transform="scale(0.97) translateY(10px)",s.style.opacity="0",setTimeout(()=>{s.style.transform="",s.style.opacity="",s.style.transition="",this._popover.style.visibility="",this._popover.style.display=""},200))),this._updateBackgroundColor()}_updateBackgroundColor(){if(!this._popover)return;const e=document.documentElement.classList.contains("dark"),t=this._popover.querySelector(".popover-content");t&&(e?(t.classList.remove("bg-white"),t.classList.add("bg-gray-800")):(t.classList.remove("bg-gray-800"),t.classList.add("bg-white")))}_observeDarkMode(){this._darkModeObserver||(this._darkModeObserver=new MutationObserver(()=>{this._updateBackgroundColor()}),this._darkModeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}))}_updatePosition(e){if(!this._triggerElement||!this._popover)return;const t=this._popover.style.visibility!=="hidden";t||(this._popover.style.visibility="hidden",this._popover.style.display="block",this._popover.style.top="0",this._popover.style.left="0"),this._popover.offsetHeight;const i=this._calculatePosition();this._popover.style.top=`${i.top}px`,this._popover.style.left=`${i.left}px`,t||(this._popover.style.visibility="visible",e&&(!e.style.opacity||e.style.opacity==="")&&(e.style.transform="scale(0.97) translateY(10px)",e.style.opacity="0",e.style.transition="all 200ms ease-out",requestAnimationFrame(()=>{requestAnimationFrame(()=>{e.style.transform="scale(1) translateY(0)",e.style.opacity="1"})})))}_setupPositionListeners(){if(!this._scrollHandler&&this.isOpen()){const e=this;this._scrollHandler=function(){if(e.isOpen()&&e._popover){const t=e._popover.querySelector(".popover-content");t&&e._updatePosition(t)}},window.addEventListener("scroll",this._scrollHandler,!0)}if(!this._resizeHandler&&this.isOpen()){const e=this;this._resizeHandler=function(){if(e.isOpen()&&e._popover){const t=e._popover.querySelector(".popover-content");t&&e._updatePosition(t)}},window.addEventListener("resize",this._resizeHandler)}}_removePositionListeners(){this._scrollHandler&&(window.removeEventListener("scroll",this._scrollHandler,!0),this._scrollHandler=null),this._resizeHandler&&(window.removeEventListener("resize",this._resizeHandler),this._resizeHandler=null)}_closeOtherPopovers(){Array.from(document.querySelectorAll("mint-popover[open]")).forEach(t=>{if(t!==this){const i=t;typeof i.close=="function"?i.close():t.removeAttribute("open")}})}}customElements.get("mint-popover")||customElements.define("mint-popover",U);class G extends HTMLElement{constructor(){super(),this._checkbox=null,this._checked=!1,this._clickHandler=null,this._changeHandler=null,this._mousedownHandler=null,this._mouseupHandler=null,this._mouseleaveHandler=null,this._touchstartHandler=null,this._touchendHandler=null,this._focusHandler=null,this._blurHandler=null}static get observedAttributes(){return["checked","disabled","label","info","id","name","value"]}connectedCallback(){this.classList.add("box-border","m-0","p-0","border-0","align-baseline","inline-flex","items-start","gap-2");const e=this.getAttribute("checked");this._checked=e!==null&&e!=="false",this.render()}disconnectedCallback(){this.removeEventListeners()}attributeChangedCallback(e,t,i){e==="checked"&&(this._checked=i!==null&&i!=="false",this._checkbox&&(this._checkbox.checked=this._checked)),t!==i&&(this.render(),e==="checked"&&this._checkbox&&this.updateVisualState())}get checked(){return this._checked}set checked(e){e?this.setAttribute("checked",""):this.removeAttribute("checked"),this._checked=!!e,this._checkbox&&(this._checkbox.checked=this._checked),this.updateVisualState()}isDisabled(){return this.hasAttribute("disabled")}getLabel(){return this.getAttribute("label")||""}getInfo(){return this.getAttribute("info")||""}getId(){return this.getAttribute("id")||""}getName(){return this.getAttribute("name")||""}getValue(){return this.getAttribute("value")||""}getCheckboxClasses(){const e=["relative","inline-flex","items-center","justify-center","flex-shrink-0","w-5","h-5","rounded","border-2","transition-all","duration-200","outline-none","focus:outline-none","focus-visible:ring-2","focus-visible:ring-offset-1","focus-visible:ring-gray-400","dark:focus-visible:ring-gray-500","cursor-pointer","disabled:opacity-40","disabled:cursor-not-allowed"],t=this._checked?["bg-slate-800","dark:bg-slate-600","border-slate-800","dark:border-slate-600"]:["bg-white","dark:bg-gray-700","border-gray-300","dark:border-gray-500"];return[...e,...t].join(" ")}render(){const e=this.getLabel(),t=this.getInfo(),i=this.isDisabled();let s=this.querySelector(".mint-checkbox-wrapper");s||(s=document.createElement("div"),s.className="mint-checkbox-wrapper",this.insertBefore(s,this.firstChild)),this._checkbox?this._checkbox.parentElement!==s&&s.appendChild(this._checkbox):(this._checkbox=document.createElement("input"),this._checkbox.type="checkbox",s.appendChild(this._checkbox),this.setupEventListeners()),this._checkbox.className="absolute inset-0 w-full h-full opacity-0 cursor-pointer",this._checkbox.style.cssText="position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; z-index: 10; pointer-events: auto; margin: 0; padding: 0;",this._checkbox.checked=this._checked,this._checkbox.disabled=i,this._changeHandler||this.setupEventListeners();const r=this.getId();r?this._checkbox.id=r:this._checkbox.removeAttribute("id");const n=this.getName();n?this._checkbox.name=n:this._checkbox.removeAttribute("name");const a=this.getValue();a?this._checkbox.value=a:this._checkbox.removeAttribute("value"),e?this._checkbox.setAttribute("aria-label",e):this._checkbox.removeAttribute("aria-label"),s.className=`mint-checkbox-wrapper ${this.getCheckboxClasses()}`,s.style.pointerEvents="none",this._checkbox.style.pointerEvents="auto";let c=s.querySelector("mint-icon");c||(c=document.createElement("mint-icon"),c.setAttribute("name","check"),c.className="w-3.5 h-3.5 text-white pointer-events-none absolute inset-0 m-auto",c.style.transition="opacity 200ms ease-out, transform 200ms ease-out",c.style.zIndex="1",s.appendChild(c)),this.updateVisualState();let l=this.querySelector(".mint-checkbox-label-container");if(e||t){l||(l=document.createElement("div"),l.className="mint-checkbox-label-container flex flex-col gap-0.5 flex-1",this.appendChild(l));let o=l.querySelector(".mint-checkbox-label");e?(o||(o=document.createElement("span"),o.className="mint-checkbox-label text-sm font-medium text-gray-900 dark:text-gray-100 cursor-pointer select-none",l.insertBefore(o,l.firstChild)),o.textContent=e,i?o.classList.add("opacity-40"):o.classList.remove("opacity-40")):o&&o.remove();let d=l.querySelector(".mint-checkbox-info");if(t?(d||(d=document.createElement("span"),d.className="mint-checkbox-info text-xs text-gray-500 dark:text-gray-400 cursor-pointer select-none",l.appendChild(d)),d.textContent=t,i?d.classList.add("opacity-40"):d.classList.remove("opacity-40")):d&&d.remove(),i)l.style.cursor="default",l._clickHandler&&(l.removeEventListener("click",l._clickHandler),l._clickHandler=null);else{l.style.cursor="pointer";const h=l._clickHandler;h&&l.removeEventListener("click",h),l._clickHandler=u=>{this._checkbox&&(u.target===this._checkbox||this._checkbox.contains(u.target)||u.composedPath().includes(this._checkbox))||this.toggle()},l.addEventListener("click",l._clickHandler)}}else l&&l.remove()}setupEventListeners(){this.removeEventListeners(),this._checkbox&&(this._changeHandler=e=>{e.stopPropagation(),this._checked=this._checkbox.checked,this._checked?this.hasAttribute("checked")||this.setAttribute("checked",""):this.hasAttribute("checked")&&this.removeAttribute("checked"),this.updateVisualState();const t=new CustomEvent("change",{detail:{checked:this._checked,value:this.getValue()},bubbles:!0,cancelable:!0});this.dispatchEvent(t)},this._checkbox.addEventListener("change",this._changeHandler),this._mousedownHandler=e=>{e.stopPropagation();const t=this.querySelector(".mint-checkbox-wrapper");t&&!this.isDisabled()&&(t.classList.add("mint-checkbox-active"),this._checked?(t.style.backgroundColor="rgb(15 23 42)",t.style.boxShadow="inset 0 2px 4px rgba(0, 0, 0, 0.3)"):(t.style.backgroundColor="rgb(243 244 246)",t.style.boxShadow="inset 0 2px 4px rgba(0, 0, 0, 0.1)"),document.documentElement.classList.contains("dark")&&(this._checked?t.style.backgroundColor="rgb(51 65 85)":t.style.backgroundColor="rgb(31 41 55)"))},this._mouseupHandler=e=>{e.stopPropagation();const t=this.querySelector(".mint-checkbox-wrapper");t&&(t.classList.remove("mint-checkbox-active"),t.style.backgroundColor="",t.style.boxShadow="")},this._mouseleaveHandler=e=>{const t=this.querySelector(".mint-checkbox-wrapper");t&&(t.classList.remove("mint-checkbox-active"),t.style.backgroundColor="",t.style.boxShadow="")},this._checkbox.addEventListener("mousedown",this._mousedownHandler),this._checkbox.addEventListener("mouseup",this._mouseupHandler),this._checkbox.addEventListener("mouseleave",this._mouseleaveHandler),this._focusHandler=e=>{const t=this.querySelector(".mint-checkbox-wrapper");t&&this._checkbox&&requestAnimationFrame(()=>{this._checkbox&&this._checkbox.matches(":focus-visible")&&(t==null||t.classList.add("ring-2","ring-offset-1","ring-gray-400","dark:ring-gray-500"))})},this._blurHandler=()=>{const e=this.querySelector(".mint-checkbox-wrapper");e&&e.classList.remove("ring-2","ring-offset-1","ring-gray-400","dark:ring-gray-500")},this._checkbox.addEventListener("focus",this._focusHandler),this._checkbox.addEventListener("blur",this._blurHandler),this._touchstartHandler=e=>{e.stopPropagation();const t=this.querySelector(".mint-checkbox-wrapper");t&&!this.isDisabled()&&(t.classList.add("mint-checkbox-active"),this._checked?(t.style.backgroundColor="rgb(15 23 42)",t.style.boxShadow="inset 0 2px 4px rgba(0, 0, 0, 0.3)"):(t.style.backgroundColor="rgb(243 244 246)",t.style.boxShadow="inset 0 2px 4px rgba(0, 0, 0, 0.1)"),document.documentElement.classList.contains("dark")&&(this._checked?t.style.backgroundColor="rgb(51 65 85)":t.style.backgroundColor="rgb(31 41 55)"))},this._touchendHandler=e=>{e.stopPropagation();const t=this.querySelector(".mint-checkbox-wrapper");t&&(t.classList.remove("mint-checkbox-active"),t.style.backgroundColor="",t.style.boxShadow="")},this._checkbox.addEventListener("touchstart",this._touchstartHandler),this._checkbox.addEventListener("touchend",this._touchendHandler))}removeEventListeners(){this._checkbox&&(this._changeHandler&&(this._checkbox.removeEventListener("change",this._changeHandler),this._changeHandler=null),this._mousedownHandler&&(this._checkbox.removeEventListener("mousedown",this._mousedownHandler),this._mousedownHandler=null),this._mouseupHandler&&(this._checkbox.removeEventListener("mouseup",this._mouseupHandler),this._mouseupHandler=null),this._mouseleaveHandler&&(this._checkbox.removeEventListener("mouseleave",this._mouseleaveHandler),this._mouseleaveHandler=null),this._touchstartHandler&&(this._checkbox.removeEventListener("touchstart",this._touchstartHandler),this._touchstartHandler=null),this._touchendHandler&&(this._checkbox.removeEventListener("touchend",this._touchendHandler),this._touchendHandler=null),this._focusHandler&&(this._checkbox.removeEventListener("focus",this._focusHandler),this._focusHandler=null),this._blurHandler&&(this._checkbox.removeEventListener("blur",this._blurHandler),this._blurHandler=null))}updateVisualState(){const e=this.querySelector(".mint-checkbox-wrapper"),t=e==null?void 0:e.querySelector("mint-icon");t&&(t.style.opacity=this._checked?"1":"0",t.style.transform=this._checked?"scale(1)":"scale(0.8)"),e&&(e.className=`mint-checkbox-wrapper ${this.getCheckboxClasses()}`,e.classList.contains("mint-checkbox-active")||(e.style.backgroundColor="",e.style.boxShadow=""))}toggle(){if(this._checkbox&&!this.isDisabled()){this._checkbox.checked=!this._checked,this._checked=this._checkbox.checked,this._checked?this.hasAttribute("checked")||this.setAttribute("checked",""):this.hasAttribute("checked")&&this.removeAttribute("checked"),this.updateVisualState();const e=new CustomEvent("change",{detail:{checked:this._checked},bubbles:!0,cancelable:!0});this.dispatchEvent(e)}}}customElements.get("mint-checkbox")||customElements.define("mint-checkbox",G);class J extends HTMLElement{constructor(){super(),this._radio=null,this._checked=!1,this._changeHandler=null,this._groupChangeHandler=null,this._clickHandler=null,this._mousedownHandler=null,this._mouseupHandler=null,this._mouseleaveHandler=null,this._touchstartHandler=null,this._touchendHandler=null,this._focusHandler=null,this._blurHandler=null}static get observedAttributes(){return["checked","disabled","label","info","id","name","value"]}connectedCallback(){this.classList.add("box-border","m-0","p-0","border-0","align-baseline","inline-flex","items-start","gap-2");const e=this.getAttribute("checked");this._checked=e!==null&&e!=="false",this.render()}disconnectedCallback(){this.removeEventListeners()}attributeChangedCallback(e,t,i){e==="checked"&&(this._checked=i!==null&&i!=="false",this._radio&&(this._radio.checked=this._checked)),t!==i&&(this.render(),e==="checked"&&this._radio&&this.updateVisualState())}get checked(){return this._checked}set checked(e){e?this.setAttribute("checked",""):this.removeAttribute("checked"),this._checked=!!e,this._radio&&(this._radio.checked=this._checked),this.updateVisualState()}isDisabled(){return this.hasAttribute("disabled")}getLabel(){return this.getAttribute("label")||""}getInfo(){return this.getAttribute("info")||""}getId(){return this.getAttribute("id")||""}getName(){return this.getAttribute("name")||""}getValue(){return this.getAttribute("value")||""}getChoiceClasses(){const e=["relative","inline-flex","items-center","justify-center","flex-shrink-0","w-5","h-5","rounded-full","border-2","transition-all","duration-200","outline-none","focus:outline-none","focus-visible:ring-2","focus-visible:ring-offset-1","focus-visible:ring-gray-400","dark:focus-visible:ring-gray-500","cursor-pointer","disabled:opacity-40","disabled:cursor-not-allowed"],t=this._checked?["bg-slate-800","dark:bg-slate-600","border-slate-800","dark:border-slate-600"]:["bg-white","dark:bg-gray-700","border-gray-300","dark:border-gray-500"];return[...e,...t].join(" ")}render(){const e=this.getLabel(),t=this.getInfo(),i=this.isDisabled();let s=this.querySelector(".mint-choice-wrapper");s||(s=document.createElement("div"),s.className="mint-choice-wrapper",this.insertBefore(s,this.firstChild)),this._radio?this._radio.parentElement!==s&&s.appendChild(this._radio):(this._radio=document.createElement("input"),this._radio.type="radio",s.appendChild(this._radio),this.setupEventListeners()),this._radio.className="absolute inset-0 w-full h-full opacity-0 cursor-pointer",this._radio.style.cssText="position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; z-index: 10; pointer-events: auto; margin: 0; padding: 0;",this._radio.checked=this._checked,this._radio.disabled=i,this._changeHandler||this.setupEventListeners();const r=this.getId();r?this._radio.id=r:this._radio.removeAttribute("id");const n=this.getName();n?this._radio.name=n:this._radio.removeAttribute("name");const a=this.getValue();a?this._radio.value=a:this._radio.removeAttribute("value"),e?this._radio.setAttribute("aria-label",e):this._radio.removeAttribute("aria-label"),s.className=`mint-choice-wrapper ${this.getChoiceClasses()}`,s.style.pointerEvents="none",this._radio.style.pointerEvents="auto";let c=s.querySelector(".mint-choice-indicator");c||(c=document.createElement("div"),c.className="mint-choice-indicator w-2.5 h-2.5 rounded-full bg-white pointer-events-none absolute inset-0 m-auto",c.style.transition="opacity 200ms ease-out, transform 200ms ease-out",c.style.zIndex="1",s.appendChild(c)),c.style.opacity=this._checked?"1":"0",c.style.transform=this._checked?"scale(1)":"scale(0.8)",this.updateVisualState();let l=this.querySelector(".mint-choice-label-container");if(e||t){l||(l=document.createElement("div"),l.className="mint-choice-label-container flex flex-col gap-0.5 flex-1",this.appendChild(l));let o=l.querySelector(".mint-choice-label");e?(o||(o=document.createElement("span"),o.className="mint-choice-label text-sm font-medium text-gray-900 dark:text-gray-100 cursor-pointer select-none",l.insertBefore(o,l.firstChild)),o.textContent=e,i?o.classList.add("opacity-40"):o.classList.remove("opacity-40")):o&&o.remove();let d=l.querySelector(".mint-choice-info");if(t?(d||(d=document.createElement("span"),d.className="mint-choice-info text-xs text-gray-500 dark:text-gray-400 cursor-pointer select-none",l.appendChild(d)),d.textContent=t,i?d.classList.add("opacity-40"):d.classList.remove("opacity-40")):d&&d.remove(),i)l.style.cursor="default",l._clickHandler&&(l.removeEventListener("click",l._clickHandler),l._clickHandler=null);else{l.style.cursor="pointer";const h=l._clickHandler;h&&l.removeEventListener("click",h),l._clickHandler=u=>{this._radio&&(u.target===this._radio||this._radio.contains(u.target)||u.composedPath().includes(this._radio))||this.select()},l.addEventListener("click",l._clickHandler)}}else l&&l.remove()}setupEventListeners(){this.removeEventListeners(),this._radio&&(this._changeHandler=e=>{e.stopPropagation();const t=this._checked;if(this._checked=this._radio.checked,this._checked?this.hasAttribute("checked")||this.setAttribute("checked",""):this.hasAttribute("checked")&&this.removeAttribute("checked"),this.updateVisualState(),this._checked&&this._radio){const i=this._radio.name;i&&document.querySelectorAll(`input[type="radio"][name="${i}"]`).forEach(r=>{if(r!==this._radio){const n=r.closest("mint-choice");n&&n.updateVisualState&&(n._checked=r.checked,r.checked?n.hasAttribute("checked")||n.setAttribute("checked",""):n.hasAttribute("checked")&&n.removeAttribute("checked"),n.updateVisualState())}})}if(t!==this._checked){const i=new CustomEvent("change",{detail:{checked:this._checked,value:this.getValue()},bubbles:!0,cancelable:!0});this.dispatchEvent(i)}},this._radio.addEventListener("change",this._changeHandler),this._groupChangeHandler=e=>{const t=e.target;t!==this._radio&&t.type==="radio"&&t.name===this._radio.name&&t.checked&&setTimeout(()=>{this._radio&&this._radio.checked!==this._checked&&(this._checked=this._radio.checked,this._checked?this.hasAttribute("checked")||this.setAttribute("checked",""):this.hasAttribute("checked")&&this.removeAttribute("checked"),this.updateVisualState())},0)},document.addEventListener("change",this._groupChangeHandler,!0),this._clickHandler=e=>{const t=this._radio.name;t&&document.querySelectorAll(`input[type="radio"][name="${t}"]`).forEach(s=>{if(s!==this._radio){const r=s.closest("mint-choice");r&&r.updateVisualState&&(r._checked=s.checked,s.checked?r.hasAttribute("checked")||r.setAttribute("checked",""):r.hasAttribute("checked")&&r.removeAttribute("checked"),r.updateVisualState())}}),requestAnimationFrame(()=>{this._radio&&(this._checked=this._radio.checked,this.updateVisualState())})},this._radio.addEventListener("click",this._clickHandler),this._mousedownHandler=e=>{e.stopPropagation();const t=this.querySelector(".mint-choice-wrapper");t&&!this.isDisabled()&&(t.classList.add("mint-choice-active"),this._checked?(t.style.backgroundColor="rgb(15 23 42)",t.style.boxShadow="inset 0 2px 4px rgba(0, 0, 0, 0.3)"):(t.style.backgroundColor="rgb(243 244 246)",t.style.boxShadow="inset 0 2px 4px rgba(0, 0, 0, 0.1)"),document.documentElement.classList.contains("dark")&&(this._checked?t.style.backgroundColor="rgb(51 65 85)":t.style.backgroundColor="rgb(31 41 55)"))},this._mouseupHandler=e=>{e.stopPropagation();const t=this.querySelector(".mint-choice-wrapper");t&&(t.classList.remove("mint-choice-active"),t.style.backgroundColor="",t.style.boxShadow="")},this._mouseleaveHandler=e=>{const t=this.querySelector(".mint-choice-wrapper");t&&(t.classList.remove("mint-choice-active"),t.style.backgroundColor="",t.style.boxShadow="")},this._radio.addEventListener("mousedown",this._mousedownHandler),this._radio.addEventListener("mouseup",this._mouseupHandler),this._radio.addEventListener("mouseleave",this._mouseleaveHandler),this._touchstartHandler=e=>{e.stopPropagation();const t=this.querySelector(".mint-choice-wrapper");t&&!this.isDisabled()&&(t.classList.add("mint-choice-active"),this._checked?(t.style.backgroundColor="rgb(15 23 42)",t.style.boxShadow="inset 0 2px 4px rgba(0, 0, 0, 0.3)"):(t.style.backgroundColor="rgb(243 244 246)",t.style.boxShadow="inset 0 2px 4px rgba(0, 0, 0, 0.1)"),document.documentElement.classList.contains("dark")&&(this._checked?t.style.backgroundColor="rgb(51 65 85)":t.style.backgroundColor="rgb(31 41 55)"))},this._touchendHandler=e=>{e.stopPropagation();const t=this.querySelector(".mint-choice-wrapper");t&&(t.classList.remove("mint-choice-active"),t.style.backgroundColor="",t.style.boxShadow="")},this._radio.addEventListener("touchstart",this._touchstartHandler),this._radio.addEventListener("touchend",this._touchendHandler),this._focusHandler=e=>{const t=this.querySelector(".mint-choice-wrapper");t&&this._radio&&requestAnimationFrame(()=>{this._radio&&this._radio.matches(":focus-visible")&&(t==null||t.classList.add("ring-2","ring-offset-1","ring-gray-400","dark:ring-gray-500"))})},this._blurHandler=()=>{const e=this.querySelector(".mint-choice-wrapper");e&&e.classList.remove("ring-2","ring-offset-1","ring-gray-400","dark:ring-gray-500")},this._radio.addEventListener("focus",this._focusHandler),this._radio.addEventListener("blur",this._blurHandler))}removeEventListeners(){this._radio&&(this._changeHandler&&(this._radio.removeEventListener("change",this._changeHandler),this._changeHandler=null),this._groupChangeHandler&&(document.removeEventListener("change",this._groupChangeHandler,!0),this._groupChangeHandler=null),this._clickHandler&&(this._radio.removeEventListener("click",this._clickHandler),this._clickHandler=null),this._mousedownHandler&&(this._radio.removeEventListener("mousedown",this._mousedownHandler),this._mousedownHandler=null),this._mouseupHandler&&(this._radio.removeEventListener("mouseup",this._mouseupHandler),this._mouseupHandler=null),this._mouseleaveHandler&&(this._radio.removeEventListener("mouseleave",this._mouseleaveHandler),this._mouseleaveHandler=null),this._touchstartHandler&&(this._radio.removeEventListener("touchstart",this._touchstartHandler),this._touchstartHandler=null),this._touchendHandler&&(this._radio.removeEventListener("touchend",this._touchendHandler),this._touchendHandler=null),this._focusHandler&&(this._radio.removeEventListener("focus",this._focusHandler),this._focusHandler=null),this._blurHandler&&(this._radio.removeEventListener("blur",this._blurHandler),this._blurHandler=null))}updateVisualState(){const e=this.querySelector(".mint-choice-wrapper"),t=e==null?void 0:e.querySelector(".mint-choice-indicator");t&&(t.style.opacity=this._checked?"1":"0",t.style.transform=this._checked?"scale(1)":"scale(0.8)"),e&&(e.className=`mint-choice-wrapper ${this.getChoiceClasses()}`,e.classList.contains("mint-choice-active")||(e.style.backgroundColor="",e.style.boxShadow=""))}select(){if(this._radio&&!this.isDisabled()){this._radio.checked=!0,this._radio.dispatchEvent(new Event("change",{bubbles:!0})),this._checked=!0,this.hasAttribute("checked")||this.setAttribute("checked","");const e=this._radio.name;e&&document.querySelectorAll(`input[type="radio"][name="${e}"]`).forEach(s=>{if(s!==this._radio){const r=s.closest("mint-choice");r&&r.updateVisualState&&(r._checked=s.checked,s.checked?r.hasAttribute("checked")||r.setAttribute("checked",""):r.hasAttribute("checked")&&r.removeAttribute("checked"),r.updateVisualState())}}),this.updateVisualState();const t=new CustomEvent("change",{detail:{checked:this._checked,value:this.getValue()},bubbles:!0,cancelable:!0});this.dispatchEvent(t)}}}customElements.get("mint-choice")||customElements.define("mint-choice",J);class X extends HTMLElement{constructor(){super(),this._input=null,this._textarea=null,this._element=null,this._wrapper=null,this._icon=null,this._colorPicker=null,this._colorTextInput=null,this._colorContainer=null,this._colorPickerWrapper=null,this._numberSpinnerContainer=null,this._numberIncrementButton=null,this._numberDecrementButton=null,this._focusHandler=null,this._blurHandler=null,this._clickHandler=null,this._clickOutsideHandler=null}static get observedAttributes(){return["type","placeholder","value","disabled","id","name","required","readonly","rows","icon","label","info","error","error-message"]}connectedCallback(){this.classList.add("box-border","m-0","p-0","border-0","align-baseline","inline-block"),this.getLabel()||console.error('mint-input: The "label" attribute is required. Please provide a label for the input.'),this.render()}disconnectedCallback(){this.removeEventListeners()}attributeChangedCallback(e,t,i){if(t!==i){if(e==="error"||e==="error-message"){this._renderErrorState(),this._element&&(this._element.className=this.getInputClasses()),this._colorTextInput&&(this._colorTextInput.className=this.getInputClasses());return}this.render()}}getType(){return this.getAttribute("type")||"text"}getRows(){const e=this.getAttribute("rows");return e?parseInt(e,10):3}_getNormalizedType(){const e=this.getType();return e==="datetime"?"datetime-local":e==="money"?"text":e==="textarea"?"textarea":e}_isTextarea(){return this.getType()==="textarea"}_isMoney(){return this.getType()==="money"}_isColor(){return this.getType()==="color"}_isNumber(){return this.getType()==="number"}getPlaceholder(){return this.getAttribute("placeholder")||""}getValue(){var e,t,i;return this._isColor()?((e=this._colorPicker)==null?void 0:e.value)||((t=this._colorTextInput)==null?void 0:t.value)||this.getAttribute("value")||"#000000":((i=this._element)==null?void 0:i.value)||this.getAttribute("value")||""}set value(e){this._isColor()?(this._colorPicker&&(this._colorPicker.value=e||"#000000"),this._colorTextInput&&(this._colorTextInput.value=e||"#000000")):this._element&&(this._element.value=e),e?this.setAttribute("value",e):this.removeAttribute("value")}get value(){return this.getValue()}isDisabled(){return this.hasAttribute("disabled")}isReadonly(){return this.hasAttribute("readonly")}isRequired(){return this.hasAttribute("required")}hasError(){return this.hasAttribute("error")}getErrorMessage(){return this.getAttribute("error-message")||""}getId(){return this.getAttribute("id")||""}getName(){return this.getAttribute("name")||""}getIcon(){return this.getAttribute("icon")||""}getLabel(){return this.getAttribute("label")||""}getInfo(){return this.getAttribute("info")||""}getInputClasses(){const e=this._isTextarea(),t=!!this.getIcon(),i=this._isColor(),s=this._isNumber(),r=this.hasError(),n=["w-full",t||i?"pl-10":"px-3.5",t||i?"pr-3.5":s?"pr-10":"",e?"py-2":"py-1.5",e?"min-h-[6rem]":"min-h-[2rem]","text-sm","font-medium","rounded-lg","box-border","bg-white","dark:bg-gray-700","text-gray-900","dark:text-white",e?"transition-colors transition-opacity":"transition-all","duration-200","outline-none","focus:outline-none","disabled:opacity-40","disabled:cursor-not-allowed","readonly:cursor-default",e?"resize-y":"",s?"[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none":""],a=["border-2",r?"border-red-300 dark:border-red-300":"border-gray-200 dark:border-gray-600"],c=["focus-visible:ring-2","focus-visible:ring-offset-1",r?"focus-visible:ring-red-400 dark:focus-visible:ring-red-500":"focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500"];return[...n,...a,...c].filter(Boolean).join(" ")}render(){var v,x,S,y;this.getType();const e=this._getNormalizedType(),t=this._isTextarea(),i=this._isMoney(),s=this._isColor(),r=this.getPlaceholder(),n=this.isDisabled(),a=this.isReadonly(),c=this.isRequired(),l=this.getId(),o=this.getName(),d=this.getAttribute("value")||(s?"#000000":""),h=this.getRows(),u=this.getIcon(),b=this.getLabel(),f=this.getInfo();if(s){this._input&&(this._input.remove(),this._input=null),this._textarea&&(this._textarea.remove(),this._textarea=null),this._wrapper||(this._wrapper=document.createElement("div"),this._wrapper.className="relative w-full",this.appendChild(this._wrapper)),this._colorContainer&&(this._colorContainer.remove(),this._colorContainer=null),this._colorPickerWrapper&&!s&&(this._colorPickerWrapper.remove(),this._colorPickerWrapper=null),this._colorPickerWrapper||(this._colorPickerWrapper=document.createElement("div"),this._colorPickerWrapper.className="mint-color-picker-wrapper absolute left-[.65rem] top-1/2 -translate-y-1/2 w-6 h-6 rounded cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500",this._colorPickerWrapper.style.backgroundColor=d||"#000000",this._wrapper.appendChild(this._colorPickerWrapper),this._colorPicker=document.createElement("input"),this._colorPicker.type="color",this._colorPicker.className="absolute inset-0 w-full h-full opacity-0 cursor-pointer",this._colorPicker.style.cssText="position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; z-index: 10; pointer-events: auto; margin: 0; padding: 0; border: none;",this._colorPickerWrapper.appendChild(this._colorPicker),this._focusHandler=p=>{this._colorPickerWrapper&&this._colorPicker&&this._colorPicker.matches(":focus-visible")&&requestAnimationFrame(()=>{var k;this._colorPicker&&this._colorPicker.matches(":focus-visible")&&((k=this._colorPickerWrapper)==null||k.classList.add("ring-2","ring-offset-1","ring-gray-400","dark:ring-gray-500"))})},this._blurHandler=()=>{this._colorPickerWrapper&&this._colorPickerWrapper.classList.remove("ring-2","ring-offset-1","ring-gray-400","dark:ring-gray-500")},this._colorPicker.addEventListener("focus",this._focusHandler),this._colorPicker.addEventListener("blur",this._blurHandler),this._colorPicker.addEventListener("input",()=>{var k;const p=((k=this._colorPicker)==null?void 0:k.value)||"#000000";this._colorPickerWrapper&&(this._colorPickerWrapper.style.backgroundColor=p),this._colorTextInput&&(this._colorTextInput.value=p),this.setAttribute("value",p),this.dispatchEvent(new CustomEvent("input",{detail:{value:p},bubbles:!0,cancelable:!0}))}),this._colorPicker.addEventListener("change",()=>{var k;const p=((k=this._colorPicker)==null?void 0:k.value)||"#000000";this._colorPickerWrapper&&(this._colorPickerWrapper.style.backgroundColor=p),this.setAttribute("value",p),this.dispatchEvent(new CustomEvent("change",{detail:{value:p},bubbles:!0,cancelable:!0}))})),this._colorTextInput||(this._colorTextInput=document.createElement("input"),this._colorTextInput.type="text",this._colorTextInput.className=this.getInputClasses(),this._colorTextInput.placeholder=r||"#000000",this._colorTextInput.pattern="^#[0-9A-Fa-f]{6}$",this._wrapper.appendChild(this._colorTextInput),this._colorTextInput.addEventListener("input",()=>{var k;const p=((k=this._colorTextInput)==null?void 0:k.value)||"";/^#[0-9A-Fa-f]{6}$/.test(p)&&(this._colorPicker&&(this._colorPicker.value=p),this.setAttribute("value",p),this.dispatchEvent(new CustomEvent("input",{detail:{value:p},bubbles:!0,cancelable:!0})))}),this._colorTextInput.addEventListener("blur",()=>{var k,E;const p=((k=this._colorTextInput)==null?void 0:k.value)||"";/^#[0-9A-Fa-f]{6}$/.test(p)?(this._colorPicker&&(this._colorPicker.value=p),this.setAttribute("value",p)):this._colorPicker&&this._colorTextInput&&(this._colorTextInput.value=this._colorPicker.value),this.dispatchEvent(new CustomEvent("change",{detail:{value:((E=this._colorPicker)==null?void 0:E.value)||"#000000"},bubbles:!0,cancelable:!0}))}));const g=d||"#000000";if(this._colorPicker&&this._colorPicker.value!==g&&(this._colorPicker.value=g),this._colorPickerWrapper&&(this._colorPickerWrapper.style.backgroundColor=g),this._colorTextInput&&this._colorTextInput.value!==g&&(this._colorTextInput.value=g),this._colorPicker&&(this._colorPicker.disabled=n),this._colorPickerWrapper&&(n?(this._colorPickerWrapper.classList.add("opacity-40","cursor-not-allowed"),this._colorPickerWrapper.classList.remove("cursor-pointer")):(this._colorPickerWrapper.classList.remove("opacity-40","cursor-not-allowed"),this._colorPickerWrapper.classList.add("cursor-pointer"))),this._colorTextInput&&(this._colorTextInput.disabled=n,this._colorTextInput.readOnly=a,this._colorTextInput.required=c),this._colorTextInput){const p=this._colorTextInput;l?p.id=l:p.removeAttribute("id"),o?p.name=o:p.removeAttribute("name"),p.setAttribute("aria-invalid",this.hasError()?"true":"false"),this._element=p}this._renderErrorState();return}if(this._wrapper||(this._wrapper=document.createElement("div"),this._wrapper.className="relative w-full",this.appendChild(this._wrapper)),this._colorContainer&&(this._colorContainer.remove(),this._colorContainer=null,this._colorPicker=null,this._colorTextInput=null),this._colorPickerWrapper&&!s&&(this._colorPickerWrapper.remove(),this._colorPickerWrapper=null,this._colorPicker=null,this._colorTextInput=null),u&&!t?this._icon?this._icon.setAttribute("name",u):(this._icon=document.createElement("mint-icon"),this._icon.setAttribute("name",u),this._icon.className="absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400 dark:text-gray-500 pointer-events-none",this._wrapper.appendChild(this._icon)):this._icon&&(this._icon.remove(),this._icon=null),this._isNumber()&&!t){if(!this._numberSpinnerContainer){this._numberSpinnerContainer=document.createElement("div"),this._numberSpinnerContainer.className="absolute right-1 top-1/2 -translate-y-1/2 flex flex-col h-8 pointer-events-none",this._wrapper.appendChild(this._numberSpinnerContainer),this._numberIncrementButton=document.createElement("button"),this._numberIncrementButton.type="button",this._numberIncrementButton.className="flex items-center justify-center w-5 h-4 text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 disabled:opacity-40 disabled:cursor-not-allowed transition-colors pointer-events-auto bg-gray-100 dark:bg-gray-600 active:bg-gray-200 dark:active:bg-gray-500 rounded";const g=document.createElement("mint-icon");g.setAttribute("name","caret-up"),g.className="w-[1rem] h-[1rem]",this._numberIncrementButton.appendChild(g),this._numberSpinnerContainer.appendChild(this._numberIncrementButton),this._numberDecrementButton=document.createElement("button"),this._numberDecrementButton.type="button",this._numberDecrementButton.className="flex items-center justify-center w-5 h-4 text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 disabled:opacity-40 disabled:cursor-not-allowed transition-colors pointer-events-auto bg-gray-100 dark:bg-gray-600 active:bg-gray-200 dark:active:bg-gray-500 rounded";const p=document.createElement("mint-icon");p.setAttribute("name","caret-down"),p.className="w-[1rem] h-[1rem]",this._numberDecrementButton.appendChild(p),this._numberSpinnerContainer.appendChild(this._numberDecrementButton),this._numberIncrementButton.addEventListener("click",k=>{if(k.preventDefault(),k.stopPropagation(),this._input&&!this._input.disabled&&!this._input.readOnly){const E=parseFloat(this._input.value)||0,I=parseFloat(this._input.step)||1,C=this._input.min?parseFloat(this._input.min):void 0,w=this._input.max?parseFloat(this._input.max):void 0;let L=E+I;w!==void 0&&L>w&&(L=w),C!==void 0&&L<C&&(L=C),this._input.value=L.toString(),this.setAttribute("value",L.toString()),this._input.dispatchEvent(new Event("input",{bubbles:!0})),this._input.dispatchEvent(new Event("change",{bubbles:!0}))}}),this._numberDecrementButton.addEventListener("click",k=>{if(k.preventDefault(),k.stopPropagation(),this._input&&!this._input.disabled&&!this._input.readOnly){const E=parseFloat(this._input.value)||0,I=parseFloat(this._input.step)||1,C=this._input.min?parseFloat(this._input.min):void 0,w=this._input.max?parseFloat(this._input.max):void 0;let L=E-I;C!==void 0&&L<C&&(L=C),w!==void 0&&L>w&&(L=w),this._input.value=L.toString(),this.setAttribute("value",L.toString()),this._input.dispatchEvent(new Event("input",{bubbles:!0})),this._input.dispatchEvent(new Event("change",{bubbles:!0}))}})}this._numberIncrementButton&&(this._numberIncrementButton.disabled=n||a),this._numberDecrementButton&&(this._numberDecrementButton.disabled=n||a)}else this._numberSpinnerContainer&&(this._numberSpinnerContainer.remove(),this._numberSpinnerContainer=null,this._numberIncrementButton=null,this._numberDecrementButton=null);if(t){if(this._input&&(this._input.remove(),this._input=null),this._textarea||(this._textarea=document.createElement("textarea"),this._wrapper.appendChild(this._textarea),this.setupEventListeners()),this._element=this._textarea,this._textarea.placeholder=r,this._textarea.disabled=n,this._textarea.readOnly=a,this._textarea.required=c,this._textarea.rows=h,this._textarea.setAttribute("aria-invalid",this.hasError()?"true":"false"),d!==this._textarea.value&&(this._textarea.value=d),l?this._textarea.id=l:this._textarea.removeAttribute("id"),o?this._textarea.name=o:this._textarea.removeAttribute("name"),this._textarea.className=this.getInputClasses(),this.firstChild&&this.firstChild!==this._wrapper&&this.firstChild.nodeType===Node.TEXT_NODE){const g=this.firstChild.textContent;g&&!this._textarea.value&&(this._textarea.value=g.trim()),this.removeChild(this.firstChild)}}else if(this._textarea&&(this._textarea.remove(),this._textarea=null),this._input||(this._input=document.createElement("input"),this._wrapper.appendChild(this._input),this.setupEventListeners()),this._element=this._input,this._input.type=e,this._input.placeholder=r,this._input.disabled=n,this._input.readOnly=a,this._input.required=c,this._input.setAttribute("aria-invalid",this.hasError()?"true":"false"),i?(this._input.inputMode="decimal",this._input.pattern="[0-9]*\\.?[0-9]*"):(this._input.removeAttribute("inputmode"),this._input.removeAttribute("pattern")),d!==this._input.value&&(this._input.value=d),l?this._input.id=l:this._input.removeAttribute("id"),o?this._input.name=o:this._input.removeAttribute("name"),this._input.className=this.getInputClasses(),this.firstChild&&this.firstChild!==this._wrapper&&this.firstChild.nodeType===Node.TEXT_NODE){const g=this.firstChild.textContent;g&&!this._input.value&&(this._input.value=g.trim()),this.removeChild(this.firstChild)}let m=this.querySelector(".mint-input-label-container");if(b||f){m||(m=document.createElement("div"),m.className="mint-input-label-container flex flex-col gap-0.5 mb-[.25rem]",this._wrapper&&this._wrapper.parentElement===this?this.insertBefore(m,this._wrapper):this.insertBefore(m,this.firstChild));let g=m.querySelector(".mint-input-label");if(b){g||(g=document.createElement("label"),g.className="mint-input-label text-sm font-medium text-gray-900 dark:text-gray-100 select-none",m.insertBefore(g,m.firstChild)),g.textContent=b;const k=l||((v=this._element)==null?void 0:v.id)||((x=this._colorTextInput)==null?void 0:x.id)||((S=this._input)==null?void 0:S.id)||((y=this._textarea)==null?void 0:y.id);if(k)g.setAttribute("for",k);else{const E=`mint-input-${Math.random().toString(36).substr(2,9)}`;this._element?this._element.id=E:this._colorTextInput?this._colorTextInput.id=E:this._input?this._input.id=E:this._textarea&&(this._textarea.id=E),g.setAttribute("for",E)}n?g.classList.add("opacity-40"):g.classList.remove("opacity-40")}else g&&g.remove();let p=m.querySelector(".mint-input-info");f?(p||(p=document.createElement("span"),p.className="mint-input-info text-xs text-gray-500 dark:text-gray-400 select-none",m.appendChild(p)),p.textContent=f,n?p.classList.add("opacity-40"):p.classList.remove("opacity-40")):p&&p.remove()}else m&&m.remove();this._renderErrorState()}_renderErrorState(){const e=this.hasError(),t=this.getErrorMessage();let i=this.querySelector(".mint-input-error");e&&t?(i||(i=document.createElement("div"),i.className="mint-input-error mt-1 text-xs text-red-600 dark:text-red-400",this.appendChild(i)),i.textContent=t):i&&i.remove()}setupEventListeners(){this._element&&(this._element.addEventListener("input",()=>{var t;const e=((t=this._element)==null?void 0:t.value)||"";e?this.setAttribute("value",e):this.removeAttribute("value"),this.dispatchEvent(new CustomEvent("input",{detail:{value:e},bubbles:!0,cancelable:!0}))}),this._element.addEventListener("blur",()=>{var t;const e=((t=this._element)==null?void 0:t.value)||"";e?this.setAttribute("value",e):this.removeAttribute("value"),this.dispatchEvent(new CustomEvent("change",{detail:{value:e},bubbles:!0,cancelable:!0}))}))}removeEventListeners(){this._colorPicker&&(this._focusHandler&&(this._colorPicker.removeEventListener("focus",this._focusHandler),this._focusHandler=null),this._blurHandler&&(this._colorPicker.removeEventListener("blur",this._blurHandler),this._blurHandler=null))}focus(){var e;this._isColor()&&this._colorTextInput?this._colorTextInput.focus():(e=this._element)==null||e.focus()}blur(){var e;this._isColor()&&this._colorTextInput?this._colorTextInput.blur():(e=this._element)==null||e.blur()}}customElements.get("mint-input")||customElements.define("mint-input",X);class K extends HTMLElement{constructor(){super(),this._input=null,this._textInput=null,this._popover=null,this._calendarContainer=null,this._iconButton=null,this._hiddenInput=null,this._startPartInputs=[],this._endPartInputs=[],this._displayEl=null,this._inputsWrapperEl=null,this._fieldsContainer=null,this._resetHandler=null,this._isInputMode=!1,this._currentMonth=new Date().getMonth(),this._currentYear=new Date().getFullYear(),this._viewMode="calendar",this._selectedStartDate=null,this._selectedEndDate=null,this._isRange=!1,this._popoverObserver=null,this._focusTrapHandler=null,this._escapeHandler=null}static get observedAttributes(){return["value","label","info","disabled","id","name","required","readonly","format","min","max","range","shortcuts","display-format","error","error-message"]}connectedCallback(){this.classList.add("box-border","m-0","p-0","border-0","align-baseline","inline-block"),this.render(),this._setupPopoverWithRetry(),this._attachFormResetListener()}disconnectedCallback(){if(this._popoverObserver&&(this._popoverObserver.disconnect(),this._popoverObserver=null),this._removeFocusTrap(),this._resetHandler){const e=this.closest("form");e&&e.removeEventListener("reset",this._resetHandler),this._resetHandler=null}}attributeChangedCallback(e,t,i){if(t!==i){if(e==="error"||e==="error-message"){const s=this.hasError(),r=this.getErrorMessage();this._applyErrorVisuals(s,r,this.isDisabled());return}this.render(),this._input&&this._setupPopoverWithRetry()}}getValue(){return this.getAttribute("value")||""}setValue(e){e?(this.setAttribute("value",e),this._textInput&&(this._textInput.value=e),this._parseValue(e)):(this.removeAttribute("value"),this._textInput&&(this._textInput.value=""),this._selectedStartDate=null,this._selectedEndDate=null),this._buildCalendar(),this._updateDisplayText()}getFormat(){return this.getAttribute("format")||"mm/dd/yyyy"}getLabel(){return this.getAttribute("label")||""}getInfo(){return this.getAttribute("info")||""}isDisabled(){return this.hasAttribute("disabled")}isReadonly(){return this.hasAttribute("readonly")}isRequired(){return this.hasAttribute("required")}hasError(){return this.hasAttribute("error")}getErrorMessage(){return this.getAttribute("error-message")||""}isRange(){return this.hasAttribute("range")}getId(){return this.getAttribute("id")||""}getName(){return this.getAttribute("name")||""}getMin(){return this.getAttribute("min")||""}getMax(){return this.getAttribute("max")||""}getDisplayFormat(){return this.getAttribute("display-format")||"F j, Y"}getShortcuts(){const e=this.getAttribute("shortcuts");if(!e)return[];try{const t=JSON.parse(e);if(Array.isArray(t))return t.map(i=>({label:i.label,action:this._createShortcutAction(i.action)}))}catch{const i=e.trim();if(i&&typeof window[i]=="function"){const s=window[i]();if(Array.isArray(s))return s.map(r=>({label:r.label,action:typeof r.action=="function"?r.action:this._createShortcutAction(r.action)}))}}return[]}_createShortcutAction(e){return typeof e=="function"?e:typeof e=="string"&&typeof window[e]=="function"?window[e]:()=>null}_getDefaultShortcuts(){const e=[{label:"Today",action:()=>new Date}];return this._isRange&&e.push({label:"This Week",action:()=>{const t=new Date,i=t.getDay(),s=new Date(t);s.setDate(t.getDate()-i),s.setHours(0,0,0,0);const r=new Date(s);return r.setDate(s.getDate()+6),r.setHours(23,59,59,999),{start:s,end:r}}},{label:"This Month",action:()=>{const t=new Date,i=new Date(t.getFullYear(),t.getMonth(),1),s=new Date(t.getFullYear(),t.getMonth()+1,0);return s.setHours(23,59,59,999),{start:i,end:s}}}),e}_getFormatTokens(e){const t=[];let i=0;const s=e.toLowerCase();for(;i<s.length;){const r=s[i];if(r==="d"||r==="m"||r==="y"){let n=1,a=i+1;for(;a<s.length&&s[a]===r;)n++,a++;t.push({type:"part",part:r,len:n}),i=a}else t.push({type:"sep",value:e[i]}),i++}return t}_createPartInput(e,t,i,s,r){const n=document.createElement("input");return n.type="text",n.inputMode="numeric",n.pattern="\\d*",n.maxLength=e,n.placeholder=t,n.className="bg-transparent border-none outline-none text-center text-sm font-medium p-0 m-0 focus:outline-none focus:ring-0 disabled:opacity-40 disabled:cursor-not-allowed",n.disabled=i,n.readOnly=s,n.required=r,e===4?n.className+=" w-[40px]":e===2&&(n.className+=" w-[30px]"),n}_buildValueFromParts(e,t){let i=0;return t.map(s=>{var n;if(s.type==="sep")return s.value;const r=((n=e[i])==null?void 0:n.value)||"";return i++,r}).join("")}_applyDateToParts(e,t,i,s){if(!t.length)return;if(!e){t.forEach(c=>c.value="");return}const r=this._formatDate(e,s);let n=0,a=0;i.forEach(c=>{if(c.type==="sep")n+=c.value.length;else{const l=r.substr(n,c.len);t[a]&&(t[a].value=l),a++,n+=c.len}})}_syncHiddenInput(){if(!this._hiddenInput)return;const e=this.getFormat(),t=this._getFormatTokens(e),i=this._buildValueFromParts(this._startPartInputs,t);if(this._isRange){const s=this._buildValueFromParts(this._endPartInputs,t);this._hiddenInput.value=s?`${i} - ${s}`:i}else this._hiddenInput.value=i}_focusNext(e,t){if(t+1<e.length){const i=e[t+1];i.focus(),i.setSelectionRange(0,i.value.length)}}_focusPrev(e,t){if(t-1>=0){const i=e[t-1];i.focus(),i.setSelectionRange(i.value.length,i.value.length)}}_attachPartInputHandlers(e,t,i){e.forEach((s,r)=>{const n=s.maxLength||2;s.addEventListener("input",()=>{s.value=s.value.replace(/\D/g,"").slice(0,n),s.value.length>=n&&this._focusNext(e,r),this._syncHiddenInput()}),s.addEventListener("keydown",a=>{a.key==="Backspace"&&s.selectionStart===0&&s.selectionEnd===0&&this._focusPrev(e,r),a.key==="ArrowLeft"&&s.selectionStart===0&&s.selectionEnd===0&&(this._focusPrev(e,r),a.preventDefault()),a.key==="ArrowRight"&&s.selectionStart===s.value.length&&s.selectionEnd===s.value.length&&(this._focusNext(e,r),a.preventDefault())}),s.addEventListener("blur",a=>{var l;this._syncHiddenInput();const c=a.relatedTarget;c&&i.contains(c)||(this._handleBlur(((l=this._hiddenInput)==null?void 0:l.value)||""),this._exitInputMode())})})}_splitRangeInput(e,t){const i=e.split(/\s*-\s*/);return i.length>=2?[i[0],i.slice(1).join("-")]:[e]}_parseValue(e){const t=this.getFormat(),i=this._getFormatTokens(t);if(this._isRange){const[s,r]=this._splitRangeInput(e,t),n=s?this._parseDateString(s,t):null,a=r?this._parseDateString(r,t):null;if(n&&a){const[c,l]=n<=a?[n,a]:[a,n];this._selectedStartDate=c,this._selectedEndDate=l,this._currentMonth=c.getMonth(),this._currentYear=c.getFullYear()}else n&&(this._selectedStartDate=n,this._selectedEndDate=null,this._currentMonth=n.getMonth(),this._currentYear=n.getFullYear());this._applyDateToParts(this._selectedStartDate,this._startPartInputs,i,t),this._applyDateToParts(this._selectedEndDate,this._endPartInputs,i,t)}else{const s=this._parseDateString(e,t);s&&!isNaN(s.getTime())?(this._selectedStartDate=s,this._selectedEndDate=null,this._currentMonth=s.getMonth(),this._currentYear=s.getFullYear(),this._applyDateToParts(s,this._startPartInputs,i,t)):this._applyDateToParts(null,this._startPartInputs,i,t)}this._syncHiddenInput(),this._updateDisplayText()}_parseDateString(e,t){const i=/[\/\-\.\s]+/;if(i.test(e)){const _=e.split(i).filter(v=>v.length>0),m=t.split(/[\/\-\.\s]+/).filter(v=>v.length>0);if(_.length===m.length){let v=0,x=0,S=0;for(let y=0;y<m.length;y++){const g=m[y].toLowerCase(),p=_[y];if(g.includes("d"))v=parseInt(p,10);else if(g.includes("m"))x=parseInt(p,10)-1;else if(g.includes("y")){let k=parseInt(p,10);const E=g.length,I=p.length;I===2&&E===4?k=Math.floor(new Date().getFullYear()/100)*100+k:I===2&&E===2&&(k=Math.floor(new Date().getFullYear()/100)*100+k),S=k}}if(v&&x>=0&&x<=11&&S){const y=new Date(S,x,v);if(!isNaN(y.getTime())&&y.getDate()===v&&y.getMonth()===x&&y.getFullYear()===S)return y}}}const r=e.replace(/[\/\-\.]/g,""),n=t.replace(/[\/\-\.]/g,"").toLowerCase();let a=n.indexOf("d"),c=n.indexOf("m"),l=n.indexOf("y");const o=[{char:"d",index:a},{char:"m",index:c},{char:"y",index:l}].sort((_,m)=>_.index-m.index);let d=0,h=0,u=0,b=0;n.length,r.length;for(const _ of o)if(_.char==="d"){const m=n.lastIndexOf("d")-n.indexOf("d")+1,v=r.substr(b,m);if(v.length===0)return null;d=parseInt(v,10),b+=v.length}else if(_.char==="m"){const m=n.lastIndexOf("m")-n.indexOf("m")+1,v=r.substr(b,m);if(v.length===0)return null;h=parseInt(v,10)-1,b+=v.length}else if(_.char==="y"){const m=n.lastIndexOf("y")-n.indexOf("y")+1,v=r.substr(b),x=Math.min(m,v.length),S=v.substr(0,x);if(S.length===0)return null;let y=parseInt(S,10);x===2&&m===4?y=Math.floor(new Date().getFullYear()/100)*100+y:x===2&&m===2&&(y=Math.floor(new Date().getFullYear()/100)*100+y),u=y,b+=x}if(!d||h<0||h>11||!u)return null;const f=new Date(u,h,d);return isNaN(f.getTime())||f.getDate()!==d||f.getMonth()!==h||f.getFullYear()!==u?null:f}_formatDate(e,t){const i=e.getDate(),s=e.getMonth()+1,r=e.getFullYear(),n=t.toLowerCase();let a=t;return n.includes("dd")?a=a.replace(/dd/gi,String(i).padStart(2,"0")):n.includes("d")&&(a=a.replace(/d/gi,String(i))),n.includes("mm")?a=a.replace(/mm/gi,String(s).padStart(2,"0")):n.includes("m")&&(a=a.replace(/m/gi,String(s))),n.includes("yyyy")?a=a.replace(/yyyy/gi,String(r)):n.includes("yy")&&(a=a.replace(/yy/gi,String(r).substr(2))),a}_formatDatePhp(e,t){const i=e.getDate(),s=e.getMonth()+1,r=e.getFullYear(),n=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],a=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],c=["January","February","March","April","May","June","July","August","September","October","November","December"],l=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],o=(u,b=2)=>u.toString().padStart(b,"0"),d=u=>{const b=u%10,f=u%100;return b===1&&f!==11?"st":b===2&&f!==12?"nd":b===3&&f!==13?"rd":"th"};let h="";for(let u=0;u<t.length;u++){const b=t[u];if(b==="\\"&&u+1<t.length){h+=t[u+1],u++;continue}switch(b){case"Y":h+=r.toString();break;case"y":h+=r.toString().slice(-2);break;case"m":h+=o(s);break;case"n":h+=s.toString();break;case"M":h+=l[s-1];break;case"F":h+=c[s-1];break;case"d":h+=o(i);break;case"j":h+=i.toString();break;case"D":h+=a[e.getDay()];break;case"l":h+=n[e.getDay()];break;case"S":h+=d(i);break;default:h+=b;break}}return h}_validateDateString(e,t){const i=this._parseDateString(e,t);return i!==null&&!isNaN(i.getTime())}render(){const e=this.getLabel(),t=this.getInfo(),i=this.getValue(),s=this.isDisabled(),r=this.isReadonly(),n=this.isRequired(),a=this.getId(),c=this.getName(),l=this.getFormat(),o=this.hasError(),d=this.getErrorMessage();this._isRange=this.isRange(),this._input||(this._input=document.createElement("div"),this._input.className="relative w-full",this.appendChild(this._input));let h=this.querySelector(".mint-date-picker-label-container");if(e||t){h||(h=document.createElement("div"),h.className="mint-date-picker-label-container flex flex-col gap-0.5 mb-[.25rem]",this.insertBefore(h,this._input));let m=h.querySelector(".mint-date-picker-label");e?(m||(m=document.createElement("label"),m.className="mint-date-picker-label text-sm font-medium text-gray-900 dark:text-gray-100 select-none",h.insertBefore(m,h.firstChild)),m.textContent=e,a&&this._textInput&&m.setAttribute("for",a)):m&&m.remove();let v=h.querySelector(".mint-date-picker-info");t?(v||(v=document.createElement("span"),v.className="mint-date-picker-info text-xs text-gray-500 dark:text-gray-400 select-none",h.appendChild(v)),v.textContent=t):v&&v.remove()}else h&&h.remove();this._hiddenInput||(this._hiddenInput=document.createElement("input"),this._hiddenInput.type="hidden",this._hiddenInput.value=i||"",this._textInput=this._hiddenInput,this._input.appendChild(this._hiddenInput)),a&&(this._hiddenInput.id=a),c&&(this._hiddenInput.name=c),this._hiddenInput.value=i||"",this._hiddenInput.setAttribute("aria-invalid",o?"true":"false");let u=this._input.querySelector(".mint-date-fields");u||(u=document.createElement("div"),this._input.appendChild(u)),this._fieldsContainer=u,this._applyErrorVisuals(o,d,s),u.innerHTML="",this._displayEl=document.createElement("div"),this._displayEl.className="flex-1 text-gray-900 dark:text-white cursor-text select-none focus:outline-none",this._displayEl.tabIndex=s?-1:0,this._displayEl.addEventListener("click",()=>{s||r||this._enterInputMode()}),this._displayEl.addEventListener("keydown",m=>{s||r||(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),this._enterInputMode())}),this._inputsWrapperEl=document.createElement("div"),this._inputsWrapperEl.className="flex items-center gap-1 w-full";const b=this._getFormatTokens(l);this._startPartInputs=[],this._endPartInputs=[];const f=m=>{const v=document.createDocumentFragment();return b.forEach(x=>{if(x.type==="sep"){const S=document.createElement("span");S.textContent=x.value,S.className="text-gray-400 dark:text-gray-500 select-none",v.appendChild(S)}else{const S=x.part==="d"?"dd":x.part==="m"?"mm":x.len===2?"yy":"yyyy",y=this._createPartInput(x.len,S,s,r,n);m==="start"?this._startPartInputs.push(y):this._endPartInputs.push(y),v.appendChild(y)}}),v};if(this._inputsWrapperEl.appendChild(f("start")),this._isRange){const m=document.createElement("span");m.textContent=" - ",m.className="text-gray-400 dark:text-gray-500 select-none",this._inputsWrapperEl.appendChild(m),this._inputsWrapperEl.appendChild(f("end"))}const _=document.createElement("div");if(_.className="flex flex-col w-full",this._displayEl.style.display=this._isInputMode?"none":"flex",this._inputsWrapperEl.style.display=this._isInputMode?"flex":"none",_.appendChild(this._displayEl),_.appendChild(this._inputsWrapperEl),u.appendChild(_),u.addEventListener("click",()=>{this._isInputMode||s||r||this._enterInputMode()}),this._attachPartInputHandlers(this._startPartInputs,b,u),this._isRange&&this._attachPartInputHandlers(this._endPartInputs,b,u),this._parseValue(i),this._syncHiddenInput(),this._updateDisplayText(),this._iconButton)this._iconButton.disabled=s||r,!s&&!r?this._iconButton.tabIndex=0:this._iconButton.tabIndex=-1;else{this._iconButton=document.createElement("button"),this._iconButton.type="button",this._iconButton.tabIndex=0,this._iconButton.className="absolute left-2 top-2 text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 cursor-pointer z-10 focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500 pointer-events-auto disabled:opacity-40 disabled:cursor-not-allowed flex items-center justify-center rounded-sm";const m=`date-icon-${Math.random().toString(36).substr(2,9)}`;this._iconButton.id=m;const v=document.createElement("mint-icon");v.setAttribute("name","calendar"),v.className="w-4 h-4 pointer-events-none",this._iconButton.appendChild(v),this._iconButton.addEventListener("click",()=>{s||r||this._enterInputMode()}),this._input.prepend(this._iconButton),this._iconButton.disabled=s||r}this._renderErrorState(o,d)}_renderErrorState(e,t){let i=this.querySelector(".mint-date-picker-error");e&&t?(i||(i=document.createElement("div"),i.className="mint-date-picker-error mt-1 text-xs text-red-600 dark:text-red-400",this.appendChild(i)),i.textContent=t):i&&i.remove()}_applyErrorVisuals(e,t,i){if(this._renderErrorState(e,t),this._fieldsContainer){const s=this._getFieldContainerClass(e,i);this._fieldsContainer.className=s}this._hiddenInput&&this._hiddenInput.setAttribute("aria-invalid",e?"true":"false")}_attachFormResetListener(){const e=this.closest("form");!e||this._resetHandler||(this._resetHandler=()=>{this.setValue(""),this._clearPartInputs(this._startPartInputs),this._clearPartInputs(this._endPartInputs),this._isInputMode=!1,this._updateDisplayText(),this._applyErrorVisuals(!1,"",this.isDisabled())},e.addEventListener("reset",this._resetHandler))}_clearPartInputs(e){e.forEach(t=>{t.value=""})}_getFieldContainerClass(e,t){return["mint-date-fields relative w-full pl-10 pr-3.5 py-1.5 min-h-[2rem] text-sm font-medium rounded-lg box-border bg-white dark:bg-gray-700 text-gray-900 dark:text-white","border-2",e?"border-red-300 dark:border-red-300":"border-gray-200 dark:border-gray-600","transition-all duration-200 outline-none focus-within:ring-2 focus-within:ring-offset-1",e?"focus-within:ring-red-400 dark:focus-within:ring-red-500":"focus-within:ring-gray-400 dark:focus-within:ring-gray-500","flex items-center gap-1"].join(" ")+(t?" opacity-40 cursor-not-allowed":"")}_handleInputChange(e){}_cleanInputValue(e,t){return e}_handleBlur(e){const t=this.getFormat();if(!e){this.setValue(""),this._updateDisplayText();return}if(this._isRange){const[i,s]=this._splitRangeInput(e,t),r=i?this._parseDateString(i,t):null,n=s?this._parseDateString(s,t):null;if(r&&n){const[a,c]=r<=n?[r,n]:[n,r],l=this._formatDate(a,t),o=this._formatDate(c,t),d=`${l} - ${o}`;this.setValue(d),this._applyDateToParts(a,this._startPartInputs,this._getFormatTokens(t),t),this._applyDateToParts(c,this._endPartInputs,this._getFormatTokens(t),t),this._selectedStartDate=a,this._selectedEndDate=c,this._currentMonth=a.getMonth(),this._currentYear=a.getFullYear()}else if(r){const a=this._formatDate(r,t);this.setValue(a),this._applyDateToParts(r,this._startPartInputs,this._getFormatTokens(t),t),this._applyDateToParts(null,this._endPartInputs,this._getFormatTokens(t),t),this._selectedStartDate=r,this._selectedEndDate=null,this._currentMonth=r.getMonth(),this._currentYear=r.getFullYear()}else this.setValue(""),this._applyDateToParts(null,this._startPartInputs,this._getFormatTokens(t),t),this._applyDateToParts(null,this._endPartInputs,this._getFormatTokens(t),t),this._selectedStartDate=null,this._selectedEndDate=null}else if(this._validateDateString(e,t)){const i=this._parseDateString(e,t);if(i){const s=this._formatDate(i,t);this.setValue(s),this._applyDateToParts(i,this._startPartInputs,this._getFormatTokens(t),t),this._selectedStartDate=i,this._selectedEndDate=null,this._currentMonth=i.getMonth(),this._currentYear=i.getFullYear()}}else this.setValue(""),this._applyDateToParts(null,this._startPartInputs,this._getFormatTokens(t),t),this._selectedStartDate=null,this._selectedEndDate=null}_setupPopoverWithRetry(e=0){if(!this._iconButton){e<10&&requestAnimationFrame(()=>{this._setupPopoverWithRetry(e+1)});return}const t=10,i=this._iconButton.id;i&&this._iconButton.isConnected?document.getElementById(i)?this._createPopover(i):e<t&&requestAnimationFrame(()=>{this._setupPopoverWithRetry(e+1)}):e<t&&requestAnimationFrame(()=>{this._setupPopoverWithRetry(e+1)})}_createPopover(e){if(!e)return;if(!document.getElementById(e)){setTimeout(()=>{this._createPopover(e)},50);return}if(!this._popover)this._popover=document.createElement("mint-popover"),this._popover.setAttribute("direction","down"),this._popover.setAttribute("padding","0"),this.parentNode?this.parentNode.insertBefore(this._popover,this.nextSibling):document.body.appendChild(this._popover),requestAnimationFrame(()=>{requestAnimationFrame(()=>{this._popover&&this._popover.isConnected&&(this._popover.setAttribute("trigger-id",e),this._popoverObserver||(this._popoverObserver=new MutationObserver(i=>{i.forEach(s=>{var r;if(s.type==="attributes"&&s.attributeName==="open")if((r=this._popover)==null?void 0:r.hasAttribute("open"))requestAnimationFrame(()=>{this._buildCalendar();const a=this._popover;typeof a.render=="function"&&a.render(),this._setupFocusTrap()});else{if(this._removeFocusTrap(),this._iconButton&&!this._iconButton.disabled&&requestAnimationFrame(()=>{var a;(a=this._iconButton)==null||a.focus()}),this._viewMode="calendar",this._selectedStartDate)this._currentMonth=this._selectedStartDate.getMonth(),this._currentYear=this._selectedStartDate.getFullYear();else{const a=new Date;this._currentMonth=a.getMonth(),this._currentYear=a.getFullYear()}requestAnimationFrame(()=>{this._buildCalendar()})}})}),this._popoverObserver.observe(this._popover,{attributes:!0,attributeFilter:["open"]})),requestAnimationFrame(()=>{this._buildCalendar()}))})});else{if(this._popover.getAttribute("trigger-id")!==e){this._popover.setAttribute("trigger-id",e);const s=this._popover;typeof s._setupTrigger=="function"&&s._setupTrigger()}this._buildCalendar()}}_buildCalendar(){if(!this._popover)return;this._calendarContainer&&this._calendarContainer.parentNode&&this._calendarContainer.remove(),this._calendarContainer=document.createElement("div"),this._calendarContainer.className="mint-date-calendar bg-white dark:bg-gray-800 rounded-lg p-4 w-[22rem] md:w-auto md:min-w-[28rem]",this._viewMode==="calendar"?this._buildCalendarView():this._viewMode==="month"?this._buildMonthView():this._viewMode==="year"&&this._buildYearView();const e=this._popover.querySelector(".popover-content");if(e){for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(this._calendarContainer)}else this._popover.appendChild(this._calendarContainer)}_buildCalendarView(){if(!this._calendarContainer)return;const e=this._getDaysInMonth(this._currentMonth,this._currentYear),t=this._getFirstDayOfMonth(this._currentMonth,this._currentYear),i=["January","February","March","April","May","June","July","August","September","October","November","December"],s=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],r=this.getShortcuts(),n=r.length>0;this._calendarContainer.className=n?"mint-date-calendar bg-white dark:bg-gray-800 rounded-lg p-4 w-[18rem] md:w-auto md:min-w-[28rem]":"mint-date-calendar bg-white dark:bg-gray-800 rounded-lg p-4 w-[18rem] md:min-w-[18rem]";const a=document.createElement("div");a.className="flex flex-col md:flex-row md:gap-6 md:items-start";const c=document.createElement("div");c.className="flex-1 min-w-0";const l=document.createElement("div");l.className="flex items-center justify-between mb-4";const o=document.createElement("button");o.type="button",o.tabIndex=0,o.className="p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-600 dark:text-gray-300 transition-colors flex items-center focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500",o.setAttribute("data-keep-popover-open","true");const d=document.createElement("mint-icon");d.setAttribute("name","caret-left"),d.className="w-4 h-4",o.appendChild(d),o.addEventListener("click",()=>{this._currentMonth===0?(this._currentMonth=11,this._currentYear--):this._currentMonth--,this._buildCalendar()}),l.appendChild(o);const h=document.createElement("div");h.className="flex items-center gap-2";const u=document.createElement("button");u.type="button",u.tabIndex=0,u.className="text-sm font-medium text-gray-900 dark:text-gray-100 hover:text-gray-600 dark:hover:text-gray-300 transition-colors flex items-center focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500",u.setAttribute("data-keep-popover-open","true"),u.textContent=i[this._currentMonth],u.addEventListener("click",()=>{this._viewMode="month",this._buildCalendar()}),h.appendChild(u);const b=document.createElement("button");b.type="button",b.tabIndex=0,b.className="text-sm font-medium text-gray-900 dark:text-gray-100 hover:text-gray-600 dark:hover:text-gray-300 transition-colors flex items-center focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500",b.setAttribute("data-keep-popover-open","true"),b.textContent=String(this._currentYear),b.addEventListener("click",()=>{this._viewMode="year",this._buildCalendar()}),h.appendChild(b),l.appendChild(h);const f=document.createElement("button");f.type="button",f.tabIndex=0,f.className="p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-600 dark:text-gray-300 transition-colors flex items-center focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500",f.setAttribute("data-keep-popover-open","true");const _=document.createElement("mint-icon");_.setAttribute("name","caret-right"),_.className="w-4 h-4",f.appendChild(_),f.addEventListener("click",()=>{this._currentMonth===11?(this._currentMonth=0,this._currentYear++):this._currentMonth++,this._buildCalendar()}),l.appendChild(f);const m=document.createElement("div");m.className="grid grid-cols-7 mb-2",s.forEach(y=>{const g=document.createElement("div");g.className="text-xs font-medium text-gray-500 dark:text-gray-400 text-center py-1",g.textContent=y,m.appendChild(g)});const v=document.createElement("div");v.className="grid grid-cols-7";for(let y=0;y<t;y++){const g=document.createElement("div");g.className="w-8 h-8",v.appendChild(g)}const x=this.getMin()?this._parseDateString(this.getMin(),this.getFormat()):null,S=this.getMax()?this._parseDateString(this.getMax(),this.getFormat()):null;for(let y=1;y<=e;y++){const g=new Date(this._currentYear,this._currentMonth,y),p=this._isToday(g),k=this._isDateSelected(g),E=this._isDateInRange(g),I=x&&g<x||S&&g>S;let C="rounded-md";if(this._isRange&&this._selectedStartDate&&this._selectedEndDate){const L=this._isSameDate(g,this._selectedStartDate),M=this._isSameDate(g,this._selectedEndDate);L&&M?C="rounded-md":L?C="rounded-l-md":M?C="rounded-r-md":E&&(C="rounded-none")}else k&&!this._isRange&&(C="rounded-md");const w=document.createElement("button");w.type="button",w.disabled=!!I,w.tabIndex=I?-1:0,w.className=`w-full h-8 ${C} border-0 text-sm font-medium transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500 ${k?"bg-slate-800 dark:bg-slate-600 text-white":E?"bg-slate-100 dark:bg-slate-700 text-slate-800 dark:text-slate-200":p?"text-gray-900 dark:text-gray-100 font-semibold":"text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700"} ${I?"opacity-40 cursor-not-allowed":""}`,w.textContent=y.toString(),I||w.addEventListener("click",()=>{this._handleDateClick(g)}),v.appendChild(w)}if(n){const y=document.createElement("div");y.className="mb-4 pb-4 border-b border-gray-200 dark:border-gray-700 md:mb-0 md:pb-0 md:border-b-0 md:border-r md:border-r-gray-200 dark:md:border-r-gray-700 md:pr-6 md:mr-0 md:w-32 md:flex-shrink-0 md:h-full md:flex md:flex-col";const g=document.createElement("div");g.className="relative md:relative md:flex-1 md:min-h-0";const p=document.createElement("div");p.className="flex gap-2 overflow-x-auto pb-1 md:flex-col md:overflow-x-visible md:overflow-y-auto md:pb-0 md:gap-2",p.style.scrollbarWidth="none",p.style.msOverflowStyle="none",p.style.setProperty("-webkit-overflow-scrolling","touch");const k=document.createElement("style");k.textContent=`
44
+ `;this.innerHTML=l.trim()}}customElements.get("mint-spinner")||customElements.define("mint-spinner",P);class O extends HTMLElement{constructor(){super(),this._darkModeObserver=null}static get observedAttributes(){return["name"]}connectedCallback(){this.classList.add("box-border","m-0","p-0","border-0","inline-flex","items-center","leading-none"),this.render(),this._observeDarkMode()}attributeChangedCallback(e,t,i){t!==i&&this.render()}disconnectedCallback(){this._darkModeObserver&&(this._darkModeObserver.disconnect(),this._darkModeObserver=null)}_observeDarkMode(){this._darkModeObserver||(this._darkModeObserver=new MutationObserver(e=>{for(const t of e)if(t.type==="attributes"&&t.attributeName==="class"){this.render();break}}),this._darkModeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}))}getName(){return this.getAttribute("name")||""}getIconUrl(){var t;const e=(t=document.querySelector('meta[name="mint-icon-base-url"]'))==null?void 0:t.getAttribute("content");return e?e==="local"?`/icons/${this.getName()}.svg`:e==="cdn"?`https://assets.gomonobill.com/mintui/icons/${this.getName()}.svg`:`${e.endsWith("/")?e:`${e}/`}${this.getName()}.svg`:`https://assets.gomonobill.com/mintui/icons/${this.getName()}.svg`}render(){var c,l,o;const e=this.getName();if(!e){this.innerHTML="",this.style.maskImage="",this.style.webkitMaskImage="";return}if(!re.getIcon(e)){console.warn(`Icon "${e}" not found. Make sure you've imported the icon: import '@monobill-mintui/icon/icons/${e}'`),this.innerHTML="",this.style.maskImage="",this.style.webkitMaskImage="";return}const i=this.closest("mint-button")||((c=this.parentElement)==null?void 0:c.closest("mint-button")),s=this.closest("mint-switch")||((l=this.parentElement)==null?void 0:l.closest("mint-switch")),r=this.closest("mint-select")||((o=this.parentElement)==null?void 0:o.closest("mint-select"));if(!Array.from(this.classList).some(d=>d.startsWith("w-")||d.startsWith("h-"))&&!r){let d;s?d="w-3 h-3":i?d="w-5 h-5":d="w-[1.3em] h-[1.3em]",this.classList.remove("w-4","h-4","w-5","h-5","w-[1em]","h-[1em]","w-[1.3em]","h-[1.3em]","w-3","h-3"),d.split(" ").forEach(h=>{h&&this.classList.add(h)})}const a=this.getIconUrl();if(this.style.maskImage=`url(${a})`,this.style.webkitMaskImage=`url(${a})`,this.style.maskSize="contain",this.style.webkitMaskSize="contain",this.style.maskRepeat="no-repeat",this.style.webkitMaskRepeat="no-repeat",this.style.maskPosition="center",this.style.webkitMaskPosition="center",this.style.aspectRatio="1 / 1",this.style.backgroundColor="currentColor",this.innerHTML="",s)this.classList.remove("text-gray-100","text-gray-900"),this.classList.add("text-gray-900");else if(i)this.classList.remove("text-gray-100","text-gray-900");else{const h=document.documentElement.classList.contains("dark")?"text-gray-100":"text-gray-900";this.classList.remove("text-gray-100","text-gray-900"),this.classList.add(h)}}}customElements.get("mint-icon")||customElements.define("mint-icon",O);class F extends HTMLElement{constructor(){super(),this._button=null,this._clickHandler=null,this._isHandlingClick=!1,this._handleMouseDown=()=>{this._button&&!this.isDisabled()&&!this.isLoading()&&this._button.classList.add("mint-button-active")},this._handleMouseUp=()=>{this._button&&this._button.classList.remove("mint-button-active")},this._handleMouseLeave=()=>{this._button&&this._button.classList.remove("mint-button-active")},this._handleTouchStart=()=>{this._button&&!this.isDisabled()&&!this.isLoading()&&this._button.classList.add("mint-button-active")},this._handleTouchEnd=()=>{this._button&&this._button.classList.remove("mint-button-active")},this._handleTouchCancel=()=>{this._button&&this._button.classList.remove("mint-button-active")}}static get observedAttributes(){return["variant","tone","disabled","loading","button-type","full-width","icon-position","icon"]}connectedCallback(){this.classList.add("box-border","m-0","p-0","border-0","align-baseline","inline-block"),this.render(),this._button&&this.setupEventListeners(),this.isFullWidth()&&this.classList.add("w-full")}disconnectedCallback(){this.removeEventListeners()}attributeChangedCallback(e,t,i){t!==i&&this.render()}getVariant(){return this.getAttribute("variant")||"solid"}getTone(){return this.getAttribute("tone")||"neutral"}isDisabled(){const e=this.getAttribute("disabled");return e===null?!1:e!=="false"}isLoading(){const e=this.getAttribute("loading");return e===null?!1:e!=="false"}getType(){return(this.getAttribute("button-type")||"default")==="submit"?"submit":"button"}isFullWidth(){return this.hasAttribute("full-width")}getIconPosition(){return this.getAttribute("icon-position")||"left"}getIcon(){return this.getAttribute("icon")||""}isIconOnly(){var i,s,r,n,a;if(!(this.getIcon()||((i=this._button)==null?void 0:i.querySelector('[slot="icon"], .mint-button-icon, mint-icon'))))return!1;const t=(s=this._button)==null?void 0:s.querySelector(".mint-button-content");if(t&&((r=t.textContent)!=null&&r.trim()))return!1;if(this._button)for(let c=this._button.firstChild;c;c=c.nextSibling){if(c.nodeType===Node.TEXT_NODE&&((n=c.textContent)!=null&&n.trim()))return!1;if(c.nodeType===Node.ELEMENT_NODE){const l=c;if(l.tagName!=="MINT-ICON"&&l.tagName!=="MINT-SPINNER"&&!l.querySelector("mint-spinner")&&!l.hasAttribute("slot")&&l.className!=="mint-button-icon"&&!(l.className==="mr-2"&&l.querySelector("mint-spinner"))&&(a=l.textContent)!=null&&a.trim())return!1}}return!0}getButtonClasses(){const e=this.isIconOnly(),t=this.getVariant(),i=["inline-flex","items-center","justify-center","font-medium","rounded-lg","box-border",...e?["p-1.5","aspect-square","w-[2rem]","h-[2rem]"]:["px-3.5","py-1.5","min-h-[2rem]"],"text-sm","transition-all","duration-200","outline-none","focus:outline-none","focus-visible:ring-2","focus-visible:ring-offset-1","[&.mint-button-active>*]:scale-95","[&>*]:transition-transform","[&>*]:duration-100","disabled:opacity-50","disabled:cursor-not-allowed"],s=this.getTone(),r={"solid-action":["bg-slate-800","dark:bg-slate-600","text-white","hover:bg-slate-950","dark:hover:bg-slate-700","active:bg-slate-900","active:shadow-[inset_0_2px_4px_rgba(0,0,0,0.3)]","dark:active:bg-slate-700","disabled:active:bg-slate-800","dark:disabled:active:bg-slate-600","disabled:active:shadow-none","focus-visible:ring-gray-400","dark:focus-visible:ring-gray-500","shadow-sm","hover:shadow","dark:shadow-gray-900/50","border-2","border-transparent"],"solid-neutral":["bg-white","dark:bg-gray-700","text-gray-900","dark:text-white","hover:bg-gray-50","dark:hover:bg-gray-600","active:bg-gray-100","active:shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]","dark:active:bg-gray-800","disabled:active:bg-white","dark:disabled:active:bg-gray-700","disabled:active:shadow-none","focus-visible:ring-gray-400","dark:focus-visible:ring-gray-500","shadow-sm","hover:shadow","dark:shadow-gray-900/50","border-2","border-gray-200","dark:border-gray-600"],"solid-info":["bg-blue-800","dark:bg-blue-600","text-white","hover:bg-blue-950","dark:hover:bg-blue-700","active:bg-blue-900","active:shadow-[inset_0_2px_4px_rgba(0,0,0,0.3)]","dark:active:bg-blue-700","disabled:active:bg-blue-800","dark:disabled:active:bg-blue-600","disabled:active:shadow-none","focus-visible:ring-gray-400","dark:focus-visible:ring-gray-500","shadow-sm","hover:shadow","dark:shadow-gray-900/50","border-2","border-transparent"],"solid-warning":["bg-amber-800","dark:bg-amber-600","text-white","hover:bg-amber-950","dark:hover:bg-amber-700","active:bg-amber-900","active:shadow-[inset_0_2px_4px_rgba(0,0,0,0.3)]","dark:active:bg-amber-700","disabled:active:bg-amber-800","dark:disabled:active:bg-amber-600","disabled:active:shadow-none","focus-visible:ring-gray-400","dark:focus-visible:ring-gray-500","shadow-sm","hover:shadow","dark:shadow-gray-900/50","border-2","border-transparent"],"solid-danger":["bg-red-800","dark:bg-red-600","text-white","hover:bg-red-950","dark:hover:bg-red-700","active:bg-red-900","active:shadow-[inset_0_2px_4px_rgba(0,0,0,0.3)]","dark:active:bg-red-700","disabled:active:bg-red-800","dark:disabled:active:bg-red-600","disabled:active:shadow-none","focus-visible:ring-gray-400","dark:focus-visible:ring-gray-500","shadow-sm","hover:shadow","dark:shadow-gray-900/50","border-2","border-transparent"],"ghost-action":["bg-transparent","text-slate-800","dark:text-slate-400","active:bg-gray-100","active:shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]","dark:active:bg-gray-800","disabled:active:bg-transparent","dark:disabled:active:bg-transparent","disabled:active:shadow-none","focus-visible:ring-gray-400","dark:focus-visible:ring-gray-500","shadow-none","hover:shadow-none","border-2","border-transparent"],"ghost-neutral":["bg-transparent","text-gray-700","dark:text-gray-200","active:bg-gray-50","active:shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]","dark:active:bg-gray-800","active:text-gray-900","dark:active:text-white","disabled:active:bg-transparent","dark:disabled:active:bg-transparent","disabled:active:shadow-none","focus-visible:ring-gray-400","dark:focus-visible:ring-gray-500","shadow-none","hover:shadow-none","border-2","border-transparent"],"ghost-info":["bg-transparent","text-blue-800","dark:text-blue-400","active:bg-gray-100","active:shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]","dark:active:bg-gray-800","disabled:active:bg-transparent","dark:disabled:active:bg-transparent","disabled:active:shadow-none","focus-visible:ring-gray-400","dark:focus-visible:ring-gray-500","shadow-none","hover:shadow-none","border-2","border-transparent"],"ghost-warning":["bg-transparent","text-amber-800","dark:text-amber-400","active:bg-gray-100","active:shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]","dark:active:bg-gray-800","disabled:active:bg-transparent","dark:disabled:active:bg-transparent","disabled:active:shadow-none","focus-visible:ring-gray-400","dark:focus-visible:ring-gray-500","shadow-none","hover:shadow-none","border-2","border-transparent"],"ghost-danger":["bg-transparent","text-red-800","dark:text-red-400","active:bg-gray-100","active:shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]","dark:active:bg-gray-800","disabled:active:bg-transparent","dark:disabled:active:bg-transparent","disabled:active:shadow-none","focus-visible:ring-gray-400","dark:focus-visible:ring-gray-500","shadow-none","hover:shadow-none","border-2","border-transparent"],"link-action":["bg-transparent","text-slate-800","dark:text-slate-400","hover:text-slate-950","dark:hover:text-slate-200","active:text-slate-900","dark:active:text-slate-300","disabled:active:bg-transparent","dark:disabled:active:bg-transparent","disabled:active:shadow-none","focus-visible:ring-gray-400","dark:focus-visible:ring-gray-500","shadow-none","hover:shadow-none","border-2","border-transparent"],"link-neutral":["bg-transparent","text-gray-700","dark:text-gray-300","hover:text-gray-900","dark:hover:text-gray-100","active:text-gray-950","dark:active:text-gray-200","disabled:active:bg-transparent","dark:disabled:active:bg-transparent","disabled:active:shadow-none","focus-visible:ring-gray-400","dark:focus-visible:ring-gray-500","shadow-none","hover:shadow-none","border-2","border-transparent"],"link-info":["bg-transparent","text-blue-800","dark:text-blue-400","hover:text-blue-950","dark:hover:text-blue-300","active:text-blue-900","dark:active:text-blue-200","disabled:active:bg-transparent","dark:disabled:active:bg-transparent","disabled:active:shadow-none","focus-visible:ring-gray-400","dark:focus-visible:ring-gray-500","shadow-none","hover:shadow-none","border-2","border-transparent"],"link-warning":["bg-transparent","text-amber-800","dark:text-amber-400","hover:text-amber-950","dark:hover:text-amber-300","active:text-amber-900","dark:active:text-amber-200","disabled:active:bg-transparent","dark:disabled:active:bg-transparent","disabled:active:shadow-none","focus-visible:ring-gray-400","dark:focus-visible:ring-gray-500","shadow-none","hover:shadow-none","border-2","border-transparent"],"link-danger":["bg-transparent","text-red-800","dark:text-red-400","hover:text-red-950","dark:hover:text-red-300","active:text-red-900","dark:active:text-red-200","disabled:active:bg-transparent","dark:disabled:active:bg-transparent","disabled:active:shadow-none","focus-visible:ring-gray-400","dark:focus-visible:ring-gray-500","shadow-none","hover:shadow-none","border-2","border-transparent"]},n=`${t}-${s}`,a=r[n]||r["solid-neutral"],c=[...i,...a];return this.isFullWidth()&&c.push("w-full"),c.join(" ")}render(){var o,d,h,u,b;const e=this.isDisabled()||this.isLoading(),t=this.getType();if(!this._button){for(this._button=document.createElement("button");this.firstChild;)this._button.appendChild(this.firstChild);this.appendChild(this._button),this.setupEventListeners()}this._button.type=t,this._button.disabled=e;let i=this._button.querySelector("mint-spinner");if(this.isLoading())if(i)i.setAttribute("data-button-variant",this.getVariant()),i.setAttribute("data-button-tone",this.getTone()),"render"in i&&typeof i.render=="function"&&i.render();else{const f=document.createElement("span");f.className="mr-2 inline-flex items-center";const _=document.createElement("mint-spinner");_.setAttribute("size","default"),_.setAttribute("data-button-variant",this.getVariant()),_.setAttribute("data-button-tone",this.getTone()),_.style.width="0.875rem",_.style.height="0.875rem",f.appendChild(_),this._button.insertBefore(f,this._button.firstChild)}else i&&((o=i.parentElement)==null||o.remove());for(;this.firstChild&&this.firstChild!==this._button;)this._button.appendChild(this.firstChild);const s=this.getIcon();let r=this._button.querySelector('[slot="icon"], .mint-button-icon, mint-icon');s?(r&&r.tagName!=="MINT-ICON"&&(r.remove(),r=null),!r||r.tagName!=="MINT-ICON"?(r=document.createElement("mint-icon"),r.setAttribute("name",s),r.className="mint-button-icon"):r.setAttribute("name",s)):r&&r.tagName==="MINT-ICON"&&(r.remove(),r=null),r||(r=this._button.querySelector('[slot="icon"], .mint-button-icon'));const n=this.getIconPosition();let a=this._button.querySelector(".mint-button-content");if(a){const f=r&&r.tagName==="MINT-ICON";if(r&&!r.parentElement){const _=(u=this._button.querySelector("mint-spinner"))==null?void 0:u.parentElement;f||n==="left"?_?_.insertAdjacentElement("afterend",r):this._button.insertBefore(r,a):a.insertAdjacentElement("afterend",r)}else if(r&&(f||n==="left")&&r.nextSibling!==a){r.remove();const _=(b=this._button.querySelector("mint-spinner"))==null?void 0:b.parentElement;_?_.insertAdjacentElement("afterend",r):this._button.insertBefore(r,a)}else r&&!f&&n==="right"&&r.previousSibling!==a&&(r.remove(),a.insertAdjacentElement("afterend",r))}else{const f=[];for(let _=this._button.firstChild;_;_=_.nextSibling){if(_.nodeType!==Node.ELEMENT_NODE){f.push(_);continue}const m=_;m.tagName!=="MINT-SPINNER"&&!m.querySelector("mint-spinner")&&_!==r&&!m.hasAttribute("slot")&&!(m.className==="mr-2"&&m.querySelector("mint-spinner"))&&f.push(_)}if(f.length>0){a=document.createElement("span"),a.className="mint-button-content inline-flex items-center",f.forEach(m=>{a.appendChild(m)});const _=(d=this._button.querySelector("mint-spinner"))==null?void 0:d.parentElement;r&&n==="left"?_?(_.insertAdjacentElement("afterend",r),r.insertAdjacentElement("afterend",a)):(this._button.insertBefore(r,this._button.firstChild),r.insertAdjacentElement("afterend",a)):r&&n==="right"?_?(_.insertAdjacentElement("afterend",a),a.insertAdjacentElement("afterend",r)):(this._button.insertBefore(a,this._button.firstChild),a.insertAdjacentElement("afterend",r)):_?_.insertAdjacentElement("afterend",a):this._button.insertBefore(a,this._button.firstChild)}else if(r&&r.tagName==="MINT-ICON"&&!r.parentElement){const _=(h=this._button.querySelector("mint-spinner"))==null?void 0:h.parentElement;_?_.insertAdjacentElement("afterend",r):this._button.insertBefore(r,this._button.firstChild)}}const c=this.isIconOnly();r&&(r.classList.contains("mint-button-icon")||r.classList.add("mint-button-icon"),r.classList.remove("mr-1.5","ml-1.5"),c?r.tagName==="MINT-ICON"?(r.style.width="1rem",r.style.height="1rem",r.style.maxWidth="1rem",r.style.maxHeight="1rem",r.style.flexShrink="0"):(r.style.maxWidth="1rem",r.style.maxHeight="1rem",r.style.flexShrink="0",r.tagName==="svg"&&(r.style.width="1rem",r.style.height="1rem")):n==="left"?r.classList.add("mr-1.5"):r.classList.add("ml-1.5"));const l=this.getButtonClasses();this._button.className=l}setupEventListeners(){this._button&&!this._clickHandler&&(this._clickHandler=this.handleClick.bind(this),this._clickHandler&&this._button.addEventListener("click",this._clickHandler,!0),this._button.addEventListener("mousedown",this._handleMouseDown),this._button.addEventListener("mouseup",this._handleMouseUp),this._button.addEventListener("mouseleave",this._handleMouseLeave),this._button.addEventListener("touchstart",this._handleTouchStart),this._button.addEventListener("touchend",this._handleTouchEnd),this._button.addEventListener("touchcancel",this._handleTouchCancel))}removeEventListeners(){this._button&&(this._clickHandler&&(this._button.removeEventListener("click",this._clickHandler,!0),this._clickHandler=null),this._button.removeEventListener("mousedown",this._handleMouseDown),this._button.removeEventListener("mouseup",this._handleMouseUp),this._button.removeEventListener("mouseleave",this._handleMouseLeave),this._button.removeEventListener("touchstart",this._handleTouchStart),this._button.removeEventListener("touchend",this._handleTouchEnd),this._button.removeEventListener("touchcancel",this._handleTouchCancel))}handleClick(e){if(this.isDisabled()||this.isLoading()){e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation();return}if(e.stopPropagation(),e.stopImmediatePropagation(),this._isHandlingClick){e.preventDefault();return}this._isHandlingClick=!0,e.preventDefault(),this.dispatchEvent(new CustomEvent("click",{detail:{originalEvent:e},bubbles:!0,cancelable:!0,composed:!0})),requestAnimationFrame(()=>{this._isHandlingClick=!1})}}customElements.get("mint-button")||customElements.define("mint-button",F);class q extends HTMLElement{constructor(){super(),this._button=null,this._checked=!1}static get observedAttributes(){return["checked","disabled","label","icon"]}connectedCallback(){this.classList.add("box-border","m-0","p-0","border-0","align-baseline","inline-block","flex","items-center"),this._checked=this.hasAttribute("checked"),this.render()}disconnectedCallback(){this.removeEventListeners()}attributeChangedCallback(e,t,i){e==="checked"&&(this._checked=i!==null),t!==i&&this.render()}get checked(){return this._checked}set checked(e){e?this.setAttribute("checked",""):this.removeAttribute("checked"),this._checked=!!e,this.render()}isDisabled(){return this.hasAttribute("disabled")}getLabel(){return this.getAttribute("label")||""}getIcon(){return this.getAttribute("icon")||""}hasIcon(){return!!this.getIcon()}getSwitchClasses(){const e=["relative","inline-flex","items-center","rounded-full","h-5","w-10","border","transition-colors","duration-200","ease-in-out","outline-none","focus:outline-none","focus-visible:ring-2","focus-visible:ring-offset-1","focus-visible:ring-gray-400","dark:focus-visible:ring-gray-500","active:shadow-[inset_0_2px_4px_rgba(0,0,0,0.3)]","disabled:opacity-50","disabled:cursor-not-allowed"],t=this._checked?["bg-slate-950","dark:bg-slate-600","border-slate-700","dark:border-slate-500"]:["bg-slate-200","dark:bg-slate-400","border-slate-300","dark:border-slate-500"];return[...e,...t].join(" ")}getThumbClasses(){const e=["relative","inline-block","rounded-full","bg-white","dark:bg-gray-50","h-4","w-4","shadow-lg","transform","transition-transform","duration-200","ease-in-out","pointer-events-none","overflow-hidden"],t=this._checked?"translate-x-5":"translate-x-0.5";return[...e,t].join(" ")}getIconClasses(){return["absolute","inset-0","flex","items-center","justify-center","pointer-events-none"].join(" ")}render(){const e=this.getSwitchClasses(),t=this.getThumbClasses(),i=this.getLabel(),s=this.getIcon();this._button||(this._button=document.createElement("button"),this.appendChild(this._button),this.setupEventListeners()),this._button.className=e,this._button.disabled=this.isDisabled(),this._button.setAttribute("aria-checked",String(this._checked)),this._button.setAttribute("aria-label",i),this._button.setAttribute("role","switch"),this._button.type="button";let r=this._button.querySelector("span");r||(r=document.createElement("span"),this._button.appendChild(r)),r.className=t;const n=r.querySelector("span");if(s){let a=n;a||(a=document.createElement("span"),a.className=this.getIconClasses(),r.appendChild(a));let c=a.querySelector("mint-icon");c||(c=document.createElement("mint-icon"),a.appendChild(c)),c.setAttribute("name",s)}else n&&n.remove()}setupEventListeners(){this._button&&this._button.addEventListener("click",this.handleToggle.bind(this))}removeEventListeners(){this._button&&this._button.removeEventListener("click",this.handleToggle.bind(this))}handleToggle(e){this.isDisabled()||(this.checked=!this._checked,this.dispatchEvent(new CustomEvent("change",{detail:{checked:this._checked},bubbles:!0,cancelable:!0})),this.dispatchEvent(new CustomEvent("toggle",{detail:{checked:this._checked},bubbles:!0,cancelable:!0})))}}customElements.get("mint-switch")||customElements.define("mint-switch",q);class B extends HTMLElement{constructor(){super(),this._darkModeObserver=null,this._userClasses=new Set}static get observedAttributes(){return["variant","size","bold","underline","strike","italic","display"]}connectedCallback(){this.classList.add("box-border","m-0","p-0","border-0","align-baseline"),this._captureUserClasses(),this.render(),this._observeDarkMode()}_captureUserClasses(){Array.from(this.classList).forEach(t=>this._userClasses.add(t))}attributeChangedCallback(e,t,i){t!==i&&this.render()}disconnectedCallback(){this._darkModeObserver&&(this._darkModeObserver.disconnect(),this._darkModeObserver=null)}_observeDarkMode(){this._darkModeObserver||(this._darkModeObserver=new MutationObserver(()=>{this.render()}),this._darkModeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}))}getVariant(){return this.getAttribute("variant")||"default"}getSize(){return this.getAttribute("size")||"regular"}isBold(){return this.hasAttribute("bold")}isUnderline(){return this.hasAttribute("underline")}isStrike(){return this.hasAttribute("strike")}isItalic(){return this.hasAttribute("italic")}getDisplay(){return this.hasAttribute("display")?this.getAttribute("display"):this.getSize()==="regular"?"inline-block":"block"}getTextClasses(){const e=this.getSize(),t=this.getVariant(),i=document.documentElement.classList.contains("dark"),s={heading:["font-semibold"],"sub-heading":["font-medium"],regular:[]},r={default:i?["text-gray-100"]:["text-gray-900"],muted:i?["text-gray-400"]:["text-gray-400"],danger:i?["text-red-400"]:["text-red-600"],success:i?["text-green-400"]:["text-green-600"]},n=[];this.isBold()&&n.push("font-bold"),this.isUnderline()&&n.push("underline"),this.isStrike()&&n.push("line-through"),this.isItalic()&&n.push("italic");const a=this.getDisplay();return[a==="block"?"block":a==="inline"?"inline":"inline-block",...s[e]||s.regular,...r[t]||r.default,...n].join(" ")}render(){const e=this.getSize(),t=["text-gray-100","text-gray-900","text-gray-400","text-red-400","text-red-600","text-green-400","text-green-600"],i=["text-2xl","text-lg","text-sm"];i.forEach(l=>{this.classList.remove(l),this._userClasses.delete(l)}),t.forEach(l=>{this.classList.remove(l),this._userClasses.delete(l)});const s=this.getTextClasses().split(" ").filter(l=>l.trim());Array.from(this.classList).forEach(l=>{!t.includes(l)&&!i.includes(l)&&this._userClasses.add(l)});const n=[...new Set([...s,...Array.from(this._userClasses)])];this.className=n.join(" ");const a={heading:"clamp(1.25rem, 2.5vw + 0.5rem, 1.5rem)","sub-heading":"clamp(1rem, 1.5vw + 0.5rem, 1.125rem)",regular:"clamp(0.875rem, 1vw + 0.5rem, 0.875rem)"},c=a[e]||a.regular;this.style.setProperty("font-size",c)}}customElements.get("mint-text")||customElements.define("mint-text",B);class z extends HTMLElement{constructor(){super(),this._childObserver=null}static get observedAttributes(){return["direction","text-align","gap"]}connectedCallback(){this.classList.add("box-border","m-0","p-0","border-0","align-baseline","block"),this.render(),this.getTextAlign()&&this._observeChildren()}attributeChangedCallback(e,t,i){t!==i&&(this.render(),e==="text-align"&&this._observeChildren())}_observeChildren(){this._childObserver||(this._childObserver=new MutationObserver(()=>{const e=this.getTextAlign();e&&this._applyTextAlignToChildren(e)}),this._childObserver.observe(this,{childList:!0,subtree:!1}))}disconnectedCallback(){this._childObserver&&(this._childObserver.disconnect(),this._childObserver=null)}getDirection(){return(this.getAttribute("direction")||"vertical")==="horizontal"?"horizontal":"vertical"}getGap(){const e=this.getAttribute("gap")||"3";return parseFloat(e)}getTextAlign(){const e=this.getAttribute("text-align")||"";return["left","center","right","justify"].includes(e)?e:""}getStackClasses(){const e=this.getDirection(),t=this.getTextAlign(),i=this.getGap(),s=["flex",e==="horizontal"?"flex-row":"flex-col",`gap-${i}`];return t&&(s.push(`text-${t}`),s.push(`[&>*]:text-${t}`),s.push(`[&>*_.mint-button-content]:text-${t}`),t==="left"?(s.push("[&>mint-button]:!justify-start"),s.push("[&>mint-button>button]:!justify-start")):t==="right"?(s.push("[&>mint-button]:!justify-end"),s.push("[&>mint-button>button]:!justify-end")):t==="center"&&(s.push("[&>mint-button]:!justify-center"),s.push("[&>mint-button>button]:!justify-center"))),s.join(" ")}render(){const e=this.getStackClasses(),t=this.getTextAlign();["flex","flex-row","flex-col","gap-1","gap-2","gap-3","text-left","text-center","text-right","text-justify","[&>*]:text-left","[&>*]:text-center","[&>*]:text-right","[&>*]:text-justify","[&>*_.mint-button-content]:text-left","[&>*_.mint-button-content]:text-center","[&>*_.mint-button-content]:text-right","[&>*_.mint-button-content]:text-justify","[&>mint-button]:!justify-start","[&>mint-button]:!justify-center","[&>mint-button]:!justify-end","[&>mint-button>button]:!justify-start","[&>mint-button>button]:!justify-center","[&>mint-button>button]:!justify-end"].forEach(r=>this.classList.remove(r)),e.split(" ").forEach(r=>{r&&this.classList.add(r)}),["box-border","m-0","p-0","border-0","align-baseline","block"].forEach(r=>{this.classList.contains(r)||this.classList.add(r)}),t?this._applyTextAlignToChildren(t):this._removeTextAlignFromChildren()}_applyTextAlignToChildren(e){Array.from(this.children).forEach(i=>{if(i.tagName==="MINT-BUTTON"){const s=i.querySelector("button");if(s){s.classList.remove("justify-start","justify-center","justify-end"),e==="left"?s.classList.add("justify-start"):e==="right"?s.classList.add("justify-end"):e==="center"&&s.classList.add("justify-center");const r=s.querySelector(".mint-button-content");r&&(r.classList.remove("text-left","text-center","text-right","text-justify"),r.classList.add(`text-${e}`))}}else i.classList.remove("text-left","text-center","text-right","text-justify"),i.classList.add(`text-${e}`)})}_removeTextAlignFromChildren(){Array.from(this.children).forEach(t=>{if(t.tagName==="MINT-BUTTON"){const i=t.querySelector("button");if(i){i.classList.remove("justify-start","justify-end"),i.classList.add("justify-center");const s=i.querySelector(".mint-button-content");s&&s.classList.remove("text-left","text-center","text-right","text-justify")}}else t.classList.remove("text-left","text-center","text-right","text-justify")})}}customElements.get("mint-stack")||customElements.define("mint-stack",z);class V extends HTMLElement{static get observedAttributes(){return[]}constructor(){super()}connectedCallback(){this.classList.add("box-border","m-0","p-0","border-0","align-baseline","block"),this.render()}attributeChangedCallback(e,t,i){t!==i&&this.render()}render(){this.classList.add("rounded-lg","shadow","bg-white","dark:bg-gray-800","border","border-gray-200","dark:border-gray-700","overflow-hidden","transition-colors","duration-200")}}customElements.get("mint-card")||customElements.define("mint-card",V);class R extends HTMLElement{constructor(){super(),this._link=null,this._contentObserver=null}static get observedAttributes(){return["href","target"]}connectedCallback(){this.classList.add("box-border","m-0","p-0","border-0","align-baseline","inline-block"),this.render(),this._observeContent()}disconnectedCallback(){this._contentObserver&&(this._contentObserver.disconnect(),this._contentObserver=null)}_observeContent(){this._contentObserver||(this._contentObserver=new MutationObserver(()=>{this._link&&this._link.querySelectorAll("mint-text").forEach(t=>{t.classList.contains("underline")||t.classList.add("underline")})}),this._contentObserver.observe(this,{childList:!0,subtree:!0}))}attributeChangedCallback(e,t,i){t!==i&&this.render()}getHref(){return this.getAttribute("href")||"#"}getTarget(){return this.getAttribute("target")||""}hasIcon(){var e;return!!(this.querySelector("mint-icon")||(e=this._link)!=null&&e.querySelector("mint-icon"))}render(){const e=this.getHref(),t=this.getTarget();if(!this._link){for(this._link=document.createElement("a");this.firstChild;)this._link.appendChild(this.firstChild);this.appendChild(this._link)}this._link.href=e,t?(this._link.target=t,t==="_blank"&&(this._link.rel="noopener noreferrer")):(this._link.removeAttribute("target"),this._link.removeAttribute("rel"));const i=this.hasIcon(),s=["text-slate-800","dark:text-slate-200","underline","hover:text-slate-950","dark:hover:text-slate-100","transition-colors","duration-200","focus-visible:outline-none","focus-visible:ring-2","focus-visible:ring-offset-1","focus-visible:ring-gray-400","dark:focus-visible:ring-gray-500","rounded"];i&&s.push("inline-flex","items-center","gap-2"),this._link.className=s.join(" "),this._link.querySelectorAll("mint-text").forEach(a=>{a.classList.contains("underline")||a.classList.add("underline")}),["box-border","m-0","p-0","border-0","align-baseline","inline-block"].forEach(a=>{this.classList.contains(a)||this.classList.add(a)})}}customElements.get("mint-link")||customElements.define("mint-link",R);class W extends HTMLElement{constructor(){super(),this._button=null,this._historyDepth=0,this._maxBackAttempts=10,this._backAttempts=0,this._initialUrl="",this._initialOrigin="",this._popstateHandler=null}static get observedAttributes(){return["href","fallback-href"]}connectedCallback(){this.classList.add("box-border","m-0","p-0","border-0","align-baseline","inline-block","flex","items-center","justify-center"),this.render(),this._setupHistoryTracking()}disconnectedCallback(){this._popstateHandler&&(window.removeEventListener("popstate",this._popstateHandler),this._popstateHandler=null)}attributeChangedCallback(e,t,i){t!==i&&this.render()}_setupHistoryTracking(){this._initialUrl=window.location.href,this._initialOrigin=window.location.origin,this._historyDepth=window.history.length,this._popstateHandler||(this._popstateHandler=e=>{this._backAttempts=0,setTimeout(()=>{const t=window.location.origin,i=window.location.href;if(t!==this._initialOrigin){this._navigateToFallback();return}if(i.startsWith("chrome://")||i.startsWith("about:")||i.startsWith("edge://")||i==="about:blank"||i==="about:newtab"){this._navigateToFallback();return}},0)},window.addEventListener("popstate",this._popstateHandler))}getFallbackHref(){return this.getAttribute("fallback-href")||this.getAttribute("href")||"/"}handleClick(e){if(e.preventDefault(),e.stopPropagation(),this._wouldBackLeaveApp()){this._navigateToFallback();return}if(window.history.length>1&&this._backAttempts<this._maxBackAttempts&&this._backAttempts===0){this._backAttempts++;const s=window.location.href,r=window.location.origin;window.history.back(),setTimeout(()=>{if(window.location.href===s)this._navigateToFallback();else{if(window.location.origin!==r){this._navigateToFallback();return}const n=window.location.href;if(n.startsWith("chrome://")||n.startsWith("about:")||n.startsWith("edge://")||n==="about:blank"||n==="about:newtab"){this._navigateToFallback();return}setTimeout(()=>{this._backAttempts=0},500)}},200)}else this._navigateToFallback()}_wouldBackLeaveApp(){const e=document.referrer,t=window.location.origin;if(window.history.length<=1||!e&&window.history.length<=2)return!0;if(e)try{if(new URL(e).origin!==t&&window.history.length<=2)return!0}catch{if(window.history.length<=2)return!0}return!1}_navigateToFallback(){var t,i,s;const e=this.getFallbackHref();if(this._backAttempts=0,e.startsWith("/")&&!e.startsWith("//")){const r=document.querySelector("#app");if((s=(i=(t=r==null?void 0:r.__vue_app__)==null?void 0:t.config)==null?void 0:i.globalProperties)!=null&&s.$router)try{r.__vue_app__.config.globalProperties.$router.push(e);return}catch{}try{window.history.pushState({},"",e),window.dispatchEvent(new PopStateEvent("popstate"));return}catch{}}window.location.href=e}render(){this._button||(this._button=document.createElement("mint-button"),this._button.setAttribute("variant","neutral"),this._button.setAttribute("icon","arrow-left"),this._button.addEventListener("click",e=>this.handleClick(e)),this.appendChild(this._button))}}customElements.get("mint-back-button")||customElements.define("mint-back-button",W);class j extends HTMLElement{constructor(){super(),this._pageContainer=null,this._header=null,this._titleElement=null,this._headingText=null,this._actionsSlot=null,this._bodySlot=null,this._darkModeObserver=null}static get observedAttributes(){return["heading","fallback-href","show-back-button","containered"]}connectedCallback(){this.classList.add("box-border","m-0","p-0","border-0","align-baseline","block"),this.render(),this._observeDarkMode()}attributeChangedCallback(e,t,i){t!==i&&this.render()}disconnectedCallback(){this._darkModeObserver&&(this._darkModeObserver.disconnect(),this._darkModeObserver=null)}getHeading(){return this.getAttribute("heading")||""}getFallbackHref(){return this.getAttribute("fallback-href")||"/"}shouldShowBackButton(){return this.hasAttribute("show-back-button")}render(){const e=this.getHeading();this._pageContainer||(this._pageContainer=document.createElement("div"),this.appendChild(this._pageContainer)),this._applyContainerClasses(),this._header||(this._header=document.createElement("div"),this._header.className="flex justify-between mb-8",this._pageContainer.appendChild(this._header)),this._titleElement||(this._titleElement=document.createElement("div"),this._titleElement.className="flex gap-4 min-w-0 flex-1",this._header.appendChild(this._titleElement));let t=this._titleElement.querySelector("mint-back-button");if(this.shouldShowBackButton()){t||(t=document.createElement("mint-back-button"),this._titleElement.insertBefore(t,this._titleElement.firstChild));const n=this.getFallbackHref();t.setAttribute("fallback-href",n)}else t&&(t.remove(),t=null);e?(this._headingText?(this._headingText.classList.add("truncate","min-w-0"),t&&t.parentElement===this._titleElement?this._headingText.previousSibling!==t&&this._titleElement.insertBefore(this._headingText,t.nextSibling):this._headingText.previousSibling&&this._titleElement.insertBefore(this._headingText,this._titleElement.firstChild)):(this._headingText=document.createElement("mint-text"),this._headingText.setAttribute("size","heading"),this._headingText.setAttribute("bold",""),this._headingText.classList.add("truncate","min-w-0"),t&&t.parentElement===this._titleElement?this._titleElement.insertBefore(this._headingText,t.nextSibling):this._titleElement.insertBefore(this._headingText,this._titleElement.firstChild)),this._headingText.textContent=e):this._headingText&&(this._headingText.remove(),this._headingText=null),this._actionsSlot?this._actionsSlot.classList.contains("ml-4")||this._actionsSlot.classList.add("ml-4"):(this._actionsSlot=document.createElement("div"),this._actionsSlot.className="flex gap-2 items-center ml-4",this._actionsSlot.setAttribute("slot","actions"),this._header.appendChild(this._actionsSlot)),Array.from(this.children).filter(n=>n!==this._pageContainer&&n!==this._actionsSlot&&n.getAttribute("slot")==="actions").forEach(n=>{this._actionsSlot&&n.parentElement!==this._actionsSlot&&this._actionsSlot.appendChild(n)}),this._bodySlot||(this._bodySlot=document.createElement("div"),this._pageContainer.appendChild(this._bodySlot)),Array.from(this.children).forEach(n=>{n!==this._pageContainer&&n.getAttribute("slot")!=="actions"&&n!==this._actionsSlot&&n!==this._header&&n!==this._bodySlot&&n!==this._headingText&&n.parentElement!==this._bodySlot&&n.parentElement!==this._pageContainer&&this._bodySlot.appendChild(n)}),this._updateBackgroundColor()}_applyContainerClasses(){this._pageContainer&&(this._pageContainer.classList.add("min-h-screen","p-8","transition-colors","duration-200"),this.hasAttribute("containered")?this._pageContainer.classList.add("max-w-6xl","mx-auto","w-full"):this._pageContainer.classList.remove("max-w-6xl","mx-auto"))}_updateBackgroundColor(){if(!this._pageContainer)return;document.documentElement.classList.contains("dark")?(this._pageContainer.classList.remove("bg-gray-20"),this._pageContainer.classList.add("bg-gray-900")):(this._pageContainer.classList.remove("bg-gray-900"),this._pageContainer.classList.add("bg-gray-20"))}_observeDarkMode(){this._darkModeObserver||(this._darkModeObserver=new MutationObserver(()=>{this._updateBackgroundColor()}),this._darkModeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}))}}customElements.get("mint-page")||customElements.define("mint-page",j);class $ extends HTMLElement{static get observedAttributes(){return["columns","sm","md","lg","xl","gap"]}constructor(){super()}connectedCallback(){this.classList.add("box-border","m-0","p-0","border-0","align-baseline","block"),this.render()}attributeChangedCallback(e,t,i){t!==i&&this.render()}getColumns(){return this.getAttribute("columns")||"1"}getSm(){return this.getAttribute("sm")}getMd(){return this.getAttribute("md")}getLg(){return this.getAttribute("lg")}getXl(){return this.getAttribute("xl")}getGap(){return"3"}getGridClasses(){const e=["grid"],t=this.getColumns();e.push(`grid-cols-${t}`);const i=this.getSm();i&&e.push(`sm:grid-cols-${i}`);const s=this.getMd();s&&e.push(`md:grid-cols-${s}`);const r=this.getLg();r&&e.push(`lg:grid-cols-${r}`);const n=this.getXl();n&&e.push(`xl:grid-cols-${n}`);const a=this.getGap();return e.push(`gap-${a}`),e}render(){Array.from(this.classList).filter(i=>i.startsWith("grid-cols-")||i.startsWith("sm:grid-cols-")||i.startsWith("md:grid-cols-")||i.startsWith("lg:grid-cols-")||i.startsWith("xl:grid-cols-")||i.startsWith("gap-")).forEach(i=>this.classList.remove(i)),this.classList.contains("grid")||this.classList.add("grid"),this.getGridClasses().forEach(i=>{i&&i!=="grid"&&this.classList.add(i)})}}customElements.get("mint-grid")||customElements.define("mint-grid",$);class Y extends HTMLElement{constructor(){super(),this._overlay=null,this._modal=null,this._header=null,this._headingSlot=null,this._bodySlot=null,this._actionsSlot=null,this._closeButton=null,this._darkModeObserver=null}static get observedAttributes(){return["id","heading","open"]}connectedCallback(){this.classList.add("box-border","m-0","p-0","border-0","align-baseline","fixed","inset-0","z-50"),this.isOpen()||this.classList.add("hidden"),this.render(),this._observeDarkMode()}disconnectedCallback(){this._darkModeObserver&&(this._darkModeObserver.disconnect(),this._darkModeObserver=null)}attributeChangedCallback(e,t,i){t!==i&&this.render()}getId(){return this.getAttribute("id")||""}getHeading(){return this.getAttribute("heading")||""}isOpen(){return this.hasAttribute("open")}open(){this.setAttribute("open","")}close(){this.removeAttribute("open")}render(){const e=this.getId(),t=this.getHeading(),i=this.isOpen();if(e&&(this.id=e),this._overlay||(this._overlay=document.createElement("div"),this._overlay.className="fixed inset-0 bg-black bg-opacity-50 transition-opacity duration-200 z-40",this._overlay.addEventListener("click",()=>this.close()),this.appendChild(this._overlay)),this._modal||(this._modal=document.createElement("div"),this._modal.className="fixed inset-0 flex items-center justify-center p-2 pointer-events-none z-50",this.appendChild(this._modal)),i){let d=this._modal.querySelector(".modal-content");d||(d=document.createElement("div"),d.className="modal-content bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-2xl w-full max-h-[90vh] flex flex-col pointer-events-auto transition-all duration-200 ease-out transform",this._modal.appendChild(d)),this._animateEnter()}else this._animateExit();let s=this._modal.querySelector(".modal-content");s||(s=document.createElement("div"),s.className="modal-content bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-2xl w-full max-h-[90vh] flex flex-col pointer-events-auto transition-all duration-200 ease-out transform",this._modal.appendChild(s)),this._header||(this._header=document.createElement("div"),this._header.className="flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-700",s.appendChild(this._header)),this._headingSlot||(this._headingSlot=document.createElement("div"),this._headingSlot.className="flex-1",this._headingSlot.setAttribute("slot","heading"),this._header.appendChild(this._headingSlot));let r=this._headingSlot.querySelector("mint-text");t?(r||(r=document.createElement("mint-text"),r.setAttribute("size","sub-heading"),r.setAttribute("bold",""),this._headingSlot.appendChild(r)),r.textContent=t):r&&r.remove(),Array.from(this.children).filter(d=>d!==this._overlay&&d!==this._modal&&d!==this._headingSlot&&d.getAttribute("slot")==="heading").forEach(d=>{this._headingSlot&&d.parentElement!==this._headingSlot&&this._headingSlot.appendChild(d)}),this._closeButton||(this._closeButton=document.createElement("mint-button"),this._closeButton.setAttribute("variant","ghost"),this._closeButton.setAttribute("icon","close"),this._closeButton.addEventListener("click",()=>this.close()),this._header.appendChild(this._closeButton)),this._bodySlot||(this._bodySlot=document.createElement("div"),this._bodySlot.className="flex-1 overflow-y-auto p-4",this._bodySlot.setAttribute("slot","body"),s.appendChild(this._bodySlot)),Array.from(this.children).filter(d=>d!==this._overlay&&d!==this._modal&&d!==this._bodySlot&&d.getAttribute("slot")==="body").forEach(d=>{this._bodySlot&&d.parentElement!==this._bodySlot&&this._bodySlot.appendChild(d)}),this._actionsSlot||(this._actionsSlot=document.createElement("div"),this._actionsSlot.className="p-4 border-t border-gray-200 dark:border-gray-700",this._actionsSlot.setAttribute("slot","actions"),s.appendChild(this._actionsSlot));let c=this._actionsSlot.querySelector("mint-stack");c||(c=document.createElement("mint-stack"),c.setAttribute("direction","horizontal"),c.className="justify-end",this._actionsSlot.appendChild(c)),Array.from(this.children).filter(d=>d!==this._overlay&&d!==this._modal&&d!==this._actionsSlot&&d.getAttribute("slot")==="actions").forEach(d=>{Array.from(d.children).forEach(u=>{u.parentElement!==c&&c.appendChild(u)}),d.parentElement&&d.remove()}),Array.from(this.children).forEach(d=>{d!==this._overlay&&d!==this._modal&&d.getAttribute("slot")!=="heading"&&d.getAttribute("slot")!=="body"&&d.getAttribute("slot")!=="actions"&&d!==this._headingSlot&&d!==this._bodySlot&&d!==this._actionsSlot&&d.parentElement!==this._bodySlot&&this._bodySlot.appendChild(d)}),this._updateBackgroundColor()}_updateBackgroundColor(){if(!this._modal)return;const e=document.documentElement.classList.contains("dark"),t=this._modal.querySelector(".modal-content");t&&(e?(t.classList.remove("bg-white"),t.classList.add("bg-gray-800")):(t.classList.remove("bg-gray-800"),t.classList.add("bg-white")))}_observeDarkMode(){this._darkModeObserver||(this._darkModeObserver=new MutationObserver(()=>{this._updateBackgroundColor()}),this._darkModeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}))}_animateEnter(){var t;const e=(t=this._modal)==null?void 0:t.querySelector(".modal-content");e&&(e.style.transform="scale(0.97) translateY(10px)",e.style.opacity="0",e.style.transition="all 200ms ease-out",this.classList.remove("hidden"),requestAnimationFrame(()=>{requestAnimationFrame(()=>{e.style.transform="scale(1) translateY(0)",e.style.opacity="1"})}))}_animateExit(){var t;const e=(t=this._modal)==null?void 0:t.querySelector(".modal-content");if(!e){this.classList.add("hidden");return}e.style.transition="all 200ms ease-in",e.style.transform="scale(0.97) translateY(10px)",e.style.opacity="0",setTimeout(()=>{this.classList.add("hidden"),e.style.transform="",e.style.opacity="",e.style.transition=""},200)}}customElements.get("mint-modal")||customElements.define("mint-modal",Y);class U extends HTMLElement{constructor(){super(),this._overlay=null,this._popover=null,this._triggerElement=null,this._darkModeObserver=null,this._clickOutsideHandler=null,this._triggerClickHandler=null,this._triggerHoverEnterHandler=null,this._triggerHoverLeaveHandler=null,this._popoverHoverEnterHandler=null,this._popoverHoverLeaveHandler=null,this._hoverCloseTimeout=null,this._scrollHandler=null,this._resizeHandler=null}static get observedAttributes(){return["id","direction","open","trigger-id","padding","hover"]}connectedCallback(){this.classList.add("box-border","m-0","p-0","border-0","align-baseline","fixed","top-0","left-0","z-50","pointer-events-none"),this.isOpen()||this.classList.add("hidden"),this.render(),this._setupTrigger(),this._observeDarkMode()}disconnectedCallback(){this._darkModeObserver&&(this._darkModeObserver.disconnect(),this._darkModeObserver=null),this._clickOutsideHandler&&(document.removeEventListener("click",this._clickOutsideHandler),this._clickOutsideHandler=null),this._triggerClickHandler&&this._triggerElement&&(this._triggerElement.removeEventListener("click",this._triggerClickHandler,!0),this._triggerClickHandler=null),this._removeHoverListeners(),this._scrollHandler&&(window.removeEventListener("scroll",this._scrollHandler,!0),this._scrollHandler=null),this._resizeHandler&&(window.removeEventListener("resize",this._resizeHandler),this._resizeHandler=null)}attributeChangedCallback(e,t,i){t!==i&&(this.render(),(e==="trigger-id"||e==="hover")&&this._setupTrigger(),e==="open"&&this.isOpen()&&this._closeOtherPopovers())}getId(){return this.getAttribute("id")||""}getPadding(){const e=this.getAttribute("padding")||"4";return{0:"p-0","0.5":"p-0.5",1:"p-1","1.5":"p-1.5",2:"p-2","2.5":"p-2.5",3:"p-3","3.5":"p-3.5",4:"p-4",5:"p-5",6:"p-6",8:"p-8",10:"p-10",12:"p-12",16:"p-16",20:"p-20",24:"p-24"}[e]||"p-4"}getDirection(){return this.getAttribute("direction")||"down"}getTriggerId(){return this.getAttribute("trigger-id")||""}isHoverEnabled(){return this.hasAttribute("hover")}isOpen(){return this.hasAttribute("open")}open(){this.setAttribute("open","")}close(){this.removeAttribute("open")}_setupTrigger(){const e=this.getTriggerId();this._triggerClickHandler&&this._triggerElement&&(this._triggerElement.removeEventListener("click",this._triggerClickHandler,!0),this._triggerClickHandler=null),this._removeHoverListeners(),e&&(this._triggerElement=document.getElementById(e),this._triggerElement?(this._attachTriggerListener(),this.isHoverEnabled()&&this._attachHoverListeners()):setTimeout(()=>{this._triggerElement=document.getElementById(e),this._triggerElement&&(this._attachTriggerListener(),this.isHoverEnabled()&&this._attachHoverListeners())},10))}_attachTriggerListener(){if(this._triggerElement&&!this._triggerClickHandler){const e=this;this._triggerClickHandler=function(t){t.stopImmediatePropagation(),t.preventDefault(),e.hasAttribute("open")?e.removeAttribute("open"):e.setAttribute("open","")},this._triggerElement.addEventListener("click",this._triggerClickHandler,!0)}}_attachHoverListeners(){if(!this.isHoverEnabled()||!this._triggerElement)return;this._removeHoverListeners();const e=this;this._triggerHoverEnterHandler=function(){e._cancelHoverClose(),e.open()},this._triggerHoverLeaveHandler=function(t){var s;const i=t.relatedTarget;i&&(e.contains(i)||(s=e._triggerElement)!=null&&s.contains(i))||e._scheduleHoverClose()},this._triggerElement.addEventListener("mouseenter",this._triggerHoverEnterHandler),this._triggerElement.addEventListener("mouseleave",this._triggerHoverLeaveHandler),this._popover&&(this._popoverHoverEnterHandler=function(){e._cancelHoverClose()},this._popoverHoverLeaveHandler=function(t){var s;const i=t.relatedTarget;i&&(e.contains(i)||(s=e._triggerElement)!=null&&s.contains(i))||e._scheduleHoverClose()},this._popover.addEventListener("mouseenter",this._popoverHoverEnterHandler),this._popover.addEventListener("mouseleave",this._popoverHoverLeaveHandler))}_removeHoverListeners(){this._triggerElement&&this._triggerHoverEnterHandler&&this._triggerElement.removeEventListener("mouseenter",this._triggerHoverEnterHandler),this._triggerElement&&this._triggerHoverLeaveHandler&&this._triggerElement.removeEventListener("mouseleave",this._triggerHoverLeaveHandler),this._popover&&this._popoverHoverEnterHandler&&this._popover.removeEventListener("mouseenter",this._popoverHoverEnterHandler),this._popover&&this._popoverHoverLeaveHandler&&this._popover.removeEventListener("mouseleave",this._popoverHoverLeaveHandler),this._triggerHoverEnterHandler=null,this._triggerHoverLeaveHandler=null,this._popoverHoverEnterHandler=null,this._popoverHoverLeaveHandler=null,this._cancelHoverClose()}_scheduleHoverClose(){this._cancelHoverClose(),this._hoverCloseTimeout=window.setTimeout(()=>{this._isHovering()||this.close()},120)}_cancelHoverClose(){this._hoverCloseTimeout!==null&&(clearTimeout(this._hoverCloseTimeout),this._hoverCloseTimeout=null)}_isHovering(){const e=this._triggerElement?this._triggerElement.matches(":hover"):!1,t=this._popover?this._popover.matches(":hover"):!1;return e||t}_calculatePosition(){if(!this._triggerElement||!this._popover)return{top:0,left:0,direction:"down"};const e=this._triggerElement.getBoundingClientRect(),t=this._popover.querySelector(".popover-content");if(!t)return{top:0,left:0,direction:"down"};this.classList.contains("hidden")&&(this.classList.remove("hidden"),this._popover.style.visibility="hidden");const s=t.getBoundingClientRect(),r=window.innerWidth,n=window.innerHeight,a=8;let c=this.getDirection(),l=0,o=0;switch(c){case"down":if(l=e.bottom+a,o=e.left+e.width/2-s.width/2,l+s.height>n){const d=e.top-s.height-a;d>=0?(c="up",l=d):(l=Math.max(0,n-s.height-a),l+s.height>n&&(l=0))}o<0&&(o=a),o+s.width>r&&(o=Math.max(a,r-s.width-a),o+s.width>r&&(o=r-s.width));break;case"up":if(l=e.top-s.height-a,o=e.left+e.width/2-s.width/2,l<0){const d=e.bottom+a;d+s.height<=n?(c="down",l=d):(l=Math.min(n-s.height-a,n-s.height),l<0&&(l=n-s.height))}o<0&&(o=a),o+s.width>r&&(o=Math.max(a,r-s.width-a),o+s.width>r&&(o=r-s.width));break;case"right":if(l=e.top+e.height/2-s.height/2,o=e.right+a,o+s.width>r){const d=e.left-s.width-a;d>=0?(c="left",o=d):(o=Math.max(0,r-s.width-a),o+s.width>r&&(o=r-s.width))}l<0&&(l=a),l+s.height>n&&(l=Math.max(a,n-s.height-a),l+s.height>n&&(l=n-s.height));break;case"left":if(l=e.top+e.height/2-s.height/2,o=e.left-s.width-a,o<0){const d=e.right+a;d+s.width<=r?(c="right",o=d):(o=Math.min(r-s.width-a,r-s.width),o<0&&(o=0))}l<0&&(l=a),l+s.height>n&&(l=Math.max(a,n-s.height-a),l+s.height>n&&(l=n-s.height));break}return{top:l,left:o,direction:c}}render(){const e=this.getId(),t=this.isOpen(),i=this.getPadding();if(e&&(this.id=e),t){if(this.classList.remove("hidden"),this.style.pointerEvents="auto",!this._clickOutsideHandler){const n=this;this._clickOutsideHandler=function(a){const c=a.composedPath(),l=c.includes(n);if(!(n._triggerElement&&c.includes(n._triggerElement))&&!l){n.close();return}},setTimeout(()=>{document.addEventListener("click",this._clickOutsideHandler,!1)},100)}}else this.classList.add("hidden"),this.style.pointerEvents="none",this._clickOutsideHandler&&(document.removeEventListener("click",this._clickOutsideHandler,!1),this._clickOutsideHandler=null);this._overlay||(this._overlay=document.createElement("div"),this._overlay.className="fixed inset-0 pointer-events-none z-40",this.appendChild(this._overlay)),this._popover||(this._popover=document.createElement("div"),this._popover.className="fixed z-50 pointer-events-auto",this.appendChild(this._popover)),this.isHoverEnabled()&&this._attachHoverListeners();let s=this._popover.querySelector(".popover-content");if(!s)s=document.createElement("div"),s.className=`popover-content bg-white dark:bg-gray-800 rounded-lg shadow-xl ${i} transition-all duration-200 ease-out transform`,this._popover.appendChild(s);else{const n=s.className.split(" "),a=["p-0","p-0.5","p-1","p-1.5","p-2","p-2.5","p-3","p-3.5","p-4","p-5","p-6","p-8","p-10","p-12","p-16","p-20","p-24"],c=n.filter(l=>!a.includes(l));s.className=[...c,i].join(" ")}Array.from(this.children).forEach(n=>{n!==this._overlay&&n!==this._popover&&n.parentElement===this&&s.appendChild(n)}),t?(this._triggerElement||this._setupTrigger(),this._setupPositionListeners(),this.offsetHeight,this._triggerElement?this._updatePosition(s):(this._popover.style.top="50%",this._popover.style.left="50%",this._popover.style.transform="translate(-50%, -50%)",this._popover.style.visibility="visible",this._popover.style.display="block",s.style.transform="scale(0.97) translateY(10px)",s.style.opacity="0",s.style.transition="all 200ms ease-out",requestAnimationFrame(()=>{requestAnimationFrame(()=>{s.style.transform="scale(1) translateY(0)",s.style.opacity="1"})}))):!t&&s&&(this._removePositionListeners(),s.style.opacity!=="0"&&s.style.opacity!==""&&(s.style.transition="all 200ms ease-in",s.style.transform="scale(0.97) translateY(10px)",s.style.opacity="0",setTimeout(()=>{s.style.transform="",s.style.opacity="",s.style.transition="",this._popover.style.visibility="",this._popover.style.display=""},200))),this._updateBackgroundColor()}_updateBackgroundColor(){if(!this._popover)return;const e=document.documentElement.classList.contains("dark"),t=this._popover.querySelector(".popover-content");t&&(e?(t.classList.remove("bg-white"),t.classList.add("bg-gray-800")):(t.classList.remove("bg-gray-800"),t.classList.add("bg-white")))}_observeDarkMode(){this._darkModeObserver||(this._darkModeObserver=new MutationObserver(()=>{this._updateBackgroundColor()}),this._darkModeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}))}_updatePosition(e){if(!this._triggerElement||!this._popover)return;const t=this._popover.style.visibility!=="hidden";t||(this._popover.style.visibility="hidden",this._popover.style.display="block",this._popover.style.top="0",this._popover.style.left="0"),this._popover.offsetHeight;const i=this._calculatePosition();this._popover.style.top=`${i.top}px`,this._popover.style.left=`${i.left}px`,t||(this._popover.style.visibility="visible",e&&(!e.style.opacity||e.style.opacity==="")&&(e.style.transform="scale(0.97) translateY(10px)",e.style.opacity="0",e.style.transition="all 200ms ease-out",requestAnimationFrame(()=>{requestAnimationFrame(()=>{e.style.transform="scale(1) translateY(0)",e.style.opacity="1"})})))}_setupPositionListeners(){if(!this._scrollHandler&&this.isOpen()){const e=this;this._scrollHandler=function(){if(e.isOpen()&&e._popover){const t=e._popover.querySelector(".popover-content");t&&e._updatePosition(t)}},window.addEventListener("scroll",this._scrollHandler,!0)}if(!this._resizeHandler&&this.isOpen()){const e=this;this._resizeHandler=function(){if(e.isOpen()&&e._popover){const t=e._popover.querySelector(".popover-content");t&&e._updatePosition(t)}},window.addEventListener("resize",this._resizeHandler)}}_removePositionListeners(){this._scrollHandler&&(window.removeEventListener("scroll",this._scrollHandler,!0),this._scrollHandler=null),this._resizeHandler&&(window.removeEventListener("resize",this._resizeHandler),this._resizeHandler=null)}_closeOtherPopovers(){Array.from(document.querySelectorAll("mint-popover[open]")).forEach(t=>{if(t!==this){const i=t;typeof i.close=="function"?i.close():t.removeAttribute("open")}})}}customElements.get("mint-popover")||customElements.define("mint-popover",U);class G extends HTMLElement{constructor(){super(),this._checkbox=null,this._checked=!1,this._clickHandler=null,this._changeHandler=null,this._mousedownHandler=null,this._mouseupHandler=null,this._mouseleaveHandler=null,this._touchstartHandler=null,this._touchendHandler=null,this._focusHandler=null,this._blurHandler=null}static get observedAttributes(){return["checked","disabled","label","info","id","name","value"]}connectedCallback(){this.classList.add("box-border","m-0","p-0","border-0","align-baseline","inline-flex","items-start","gap-2");const e=this.getAttribute("checked");this._checked=e!==null&&e!=="false",this.render()}disconnectedCallback(){this.removeEventListeners()}attributeChangedCallback(e,t,i){e==="checked"&&(this._checked=i!==null&&i!=="false",this._checkbox&&(this._checkbox.checked=this._checked)),t!==i&&(this.render(),e==="checked"&&this._checkbox&&this.updateVisualState())}get checked(){return this._checked}set checked(e){e?this.setAttribute("checked",""):this.removeAttribute("checked"),this._checked=!!e,this._checkbox&&(this._checkbox.checked=this._checked),this.updateVisualState()}isDisabled(){return this.hasAttribute("disabled")}getLabel(){return this.getAttribute("label")||""}getInfo(){return this.getAttribute("info")||""}getId(){return this.getAttribute("id")||""}getName(){return this.getAttribute("name")||""}getValue(){return this.getAttribute("value")||""}getCheckboxClasses(){const e=["relative","inline-flex","items-center","justify-center","flex-shrink-0","w-5","h-5","rounded","border-2","transition-all","duration-200","outline-none","focus:outline-none","focus-visible:ring-2","focus-visible:ring-offset-1","focus-visible:ring-gray-400","dark:focus-visible:ring-gray-500","cursor-pointer","disabled:opacity-40","disabled:cursor-not-allowed"],t=this._checked?["bg-slate-800","dark:bg-slate-600","border-slate-800","dark:border-slate-600"]:["bg-white","dark:bg-gray-700","border-gray-300","dark:border-gray-500"];return[...e,...t].join(" ")}render(){const e=this.getLabel(),t=this.getInfo(),i=this.isDisabled();let s=this.querySelector(".mint-checkbox-wrapper");s||(s=document.createElement("div"),s.className="mint-checkbox-wrapper",this.insertBefore(s,this.firstChild)),this._checkbox?this._checkbox.parentElement!==s&&s.appendChild(this._checkbox):(this._checkbox=document.createElement("input"),this._checkbox.type="checkbox",s.appendChild(this._checkbox),this.setupEventListeners()),this._checkbox.className="absolute inset-0 w-full h-full opacity-0 cursor-pointer",this._checkbox.style.cssText="position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; z-index: 10; pointer-events: auto; margin: 0; padding: 0;",this._checkbox.checked=this._checked,this._checkbox.disabled=i,this._changeHandler||this.setupEventListeners();const r=this.getId();r?this._checkbox.id=r:this._checkbox.removeAttribute("id");const n=this.getName();n?this._checkbox.name=n:this._checkbox.removeAttribute("name");const a=this.getValue();a?this._checkbox.value=a:this._checkbox.removeAttribute("value"),e?this._checkbox.setAttribute("aria-label",e):this._checkbox.removeAttribute("aria-label"),s.className=`mint-checkbox-wrapper ${this.getCheckboxClasses()}`,s.style.pointerEvents="none",this._checkbox.style.pointerEvents="auto";let c=s.querySelector("mint-icon");c||(c=document.createElement("mint-icon"),c.setAttribute("name","check"),c.className="w-3.5 h-3.5 text-white pointer-events-none absolute inset-0 m-auto",c.style.transition="opacity 200ms ease-out, transform 200ms ease-out",c.style.zIndex="1",s.appendChild(c)),this.updateVisualState();let l=this.querySelector(".mint-checkbox-label-container");if(e||t){l||(l=document.createElement("div"),l.className="mint-checkbox-label-container flex flex-col gap-0.5 flex-1",this.appendChild(l));let o=l.querySelector(".mint-checkbox-label");e?(o||(o=document.createElement("span"),o.className="mint-checkbox-label text-sm font-medium text-gray-900 dark:text-gray-100 cursor-pointer select-none",l.insertBefore(o,l.firstChild)),o.textContent=e,i?o.classList.add("opacity-40"):o.classList.remove("opacity-40")):o&&o.remove();let d=l.querySelector(".mint-checkbox-info");if(t?(d||(d=document.createElement("span"),d.className="mint-checkbox-info text-xs text-gray-500 dark:text-gray-400 cursor-pointer select-none",l.appendChild(d)),d.textContent=t,i?d.classList.add("opacity-40"):d.classList.remove("opacity-40")):d&&d.remove(),i)l.style.cursor="default",l._clickHandler&&(l.removeEventListener("click",l._clickHandler),l._clickHandler=null);else{l.style.cursor="pointer";const h=l._clickHandler;h&&l.removeEventListener("click",h),l._clickHandler=u=>{this._checkbox&&(u.target===this._checkbox||this._checkbox.contains(u.target)||u.composedPath().includes(this._checkbox))||this.toggle()},l.addEventListener("click",l._clickHandler)}}else l&&l.remove()}setupEventListeners(){this.removeEventListeners(),this._checkbox&&(this._changeHandler=e=>{e.stopPropagation(),this._checked=this._checkbox.checked,this._checked?this.hasAttribute("checked")||this.setAttribute("checked",""):this.hasAttribute("checked")&&this.removeAttribute("checked"),this.updateVisualState();const t=new CustomEvent("change",{detail:{checked:this._checked,value:this.getValue()},bubbles:!0,cancelable:!0});this.dispatchEvent(t)},this._checkbox.addEventListener("change",this._changeHandler),this._mousedownHandler=e=>{e.stopPropagation();const t=this.querySelector(".mint-checkbox-wrapper");t&&!this.isDisabled()&&(t.classList.add("mint-checkbox-active"),this._checked?(t.style.backgroundColor="rgb(15 23 42)",t.style.boxShadow="inset 0 2px 4px rgba(0, 0, 0, 0.3)"):(t.style.backgroundColor="rgb(243 244 246)",t.style.boxShadow="inset 0 2px 4px rgba(0, 0, 0, 0.1)"),document.documentElement.classList.contains("dark")&&(this._checked?t.style.backgroundColor="rgb(51 65 85)":t.style.backgroundColor="rgb(31 41 55)"))},this._mouseupHandler=e=>{e.stopPropagation();const t=this.querySelector(".mint-checkbox-wrapper");t&&(t.classList.remove("mint-checkbox-active"),t.style.backgroundColor="",t.style.boxShadow="")},this._mouseleaveHandler=e=>{const t=this.querySelector(".mint-checkbox-wrapper");t&&(t.classList.remove("mint-checkbox-active"),t.style.backgroundColor="",t.style.boxShadow="")},this._checkbox.addEventListener("mousedown",this._mousedownHandler),this._checkbox.addEventListener("mouseup",this._mouseupHandler),this._checkbox.addEventListener("mouseleave",this._mouseleaveHandler),this._focusHandler=e=>{const t=this.querySelector(".mint-checkbox-wrapper");t&&this._checkbox&&requestAnimationFrame(()=>{this._checkbox&&this._checkbox.matches(":focus-visible")&&(t==null||t.classList.add("ring-2","ring-offset-1","ring-gray-400","dark:ring-gray-500"))})},this._blurHandler=()=>{const e=this.querySelector(".mint-checkbox-wrapper");e&&e.classList.remove("ring-2","ring-offset-1","ring-gray-400","dark:ring-gray-500")},this._checkbox.addEventListener("focus",this._focusHandler),this._checkbox.addEventListener("blur",this._blurHandler),this._touchstartHandler=e=>{e.stopPropagation();const t=this.querySelector(".mint-checkbox-wrapper");t&&!this.isDisabled()&&(t.classList.add("mint-checkbox-active"),this._checked?(t.style.backgroundColor="rgb(15 23 42)",t.style.boxShadow="inset 0 2px 4px rgba(0, 0, 0, 0.3)"):(t.style.backgroundColor="rgb(243 244 246)",t.style.boxShadow="inset 0 2px 4px rgba(0, 0, 0, 0.1)"),document.documentElement.classList.contains("dark")&&(this._checked?t.style.backgroundColor="rgb(51 65 85)":t.style.backgroundColor="rgb(31 41 55)"))},this._touchendHandler=e=>{e.stopPropagation();const t=this.querySelector(".mint-checkbox-wrapper");t&&(t.classList.remove("mint-checkbox-active"),t.style.backgroundColor="",t.style.boxShadow="")},this._checkbox.addEventListener("touchstart",this._touchstartHandler),this._checkbox.addEventListener("touchend",this._touchendHandler))}removeEventListeners(){this._checkbox&&(this._changeHandler&&(this._checkbox.removeEventListener("change",this._changeHandler),this._changeHandler=null),this._mousedownHandler&&(this._checkbox.removeEventListener("mousedown",this._mousedownHandler),this._mousedownHandler=null),this._mouseupHandler&&(this._checkbox.removeEventListener("mouseup",this._mouseupHandler),this._mouseupHandler=null),this._mouseleaveHandler&&(this._checkbox.removeEventListener("mouseleave",this._mouseleaveHandler),this._mouseleaveHandler=null),this._touchstartHandler&&(this._checkbox.removeEventListener("touchstart",this._touchstartHandler),this._touchstartHandler=null),this._touchendHandler&&(this._checkbox.removeEventListener("touchend",this._touchendHandler),this._touchendHandler=null),this._focusHandler&&(this._checkbox.removeEventListener("focus",this._focusHandler),this._focusHandler=null),this._blurHandler&&(this._checkbox.removeEventListener("blur",this._blurHandler),this._blurHandler=null))}updateVisualState(){const e=this.querySelector(".mint-checkbox-wrapper"),t=e==null?void 0:e.querySelector("mint-icon");t&&(t.style.opacity=this._checked?"1":"0",t.style.transform=this._checked?"scale(1)":"scale(0.8)"),e&&(e.className=`mint-checkbox-wrapper ${this.getCheckboxClasses()}`,e.classList.contains("mint-checkbox-active")||(e.style.backgroundColor="",e.style.boxShadow=""))}toggle(){if(this._checkbox&&!this.isDisabled()){this._checkbox.checked=!this._checked,this._checked=this._checkbox.checked,this._checked?this.hasAttribute("checked")||this.setAttribute("checked",""):this.hasAttribute("checked")&&this.removeAttribute("checked"),this.updateVisualState();const e=new CustomEvent("change",{detail:{checked:this._checked},bubbles:!0,cancelable:!0});this.dispatchEvent(e)}}}customElements.get("mint-checkbox")||customElements.define("mint-checkbox",G);class J extends HTMLElement{constructor(){super(),this._radio=null,this._checked=!1,this._changeHandler=null,this._groupChangeHandler=null,this._clickHandler=null,this._mousedownHandler=null,this._mouseupHandler=null,this._mouseleaveHandler=null,this._touchstartHandler=null,this._touchendHandler=null,this._focusHandler=null,this._blurHandler=null}static get observedAttributes(){return["checked","disabled","label","info","id","name","value"]}connectedCallback(){this.classList.add("box-border","m-0","p-0","border-0","align-baseline","inline-flex","items-start","gap-2");const e=this.getAttribute("checked");this._checked=e!==null&&e!=="false",this.render()}disconnectedCallback(){this.removeEventListeners()}attributeChangedCallback(e,t,i){e==="checked"&&(this._checked=i!==null&&i!=="false",this._radio&&(this._radio.checked=this._checked)),t!==i&&(this.render(),e==="checked"&&this._radio&&this.updateVisualState())}get checked(){return this._checked}set checked(e){e?this.setAttribute("checked",""):this.removeAttribute("checked"),this._checked=!!e,this._radio&&(this._radio.checked=this._checked),this.updateVisualState()}isDisabled(){return this.hasAttribute("disabled")}getLabel(){return this.getAttribute("label")||""}getInfo(){return this.getAttribute("info")||""}getId(){return this.getAttribute("id")||""}getName(){return this.getAttribute("name")||""}getValue(){return this.getAttribute("value")||""}getChoiceClasses(){const e=["relative","inline-flex","items-center","justify-center","flex-shrink-0","w-5","h-5","rounded-full","border-2","transition-all","duration-200","outline-none","focus:outline-none","focus-visible:ring-2","focus-visible:ring-offset-1","focus-visible:ring-gray-400","dark:focus-visible:ring-gray-500","cursor-pointer","disabled:opacity-40","disabled:cursor-not-allowed"],t=this._checked?["bg-slate-800","dark:bg-slate-600","border-slate-800","dark:border-slate-600"]:["bg-white","dark:bg-gray-700","border-gray-300","dark:border-gray-500"];return[...e,...t].join(" ")}render(){const e=this.getLabel(),t=this.getInfo(),i=this.isDisabled();let s=this.querySelector(".mint-choice-wrapper");s||(s=document.createElement("div"),s.className="mint-choice-wrapper",this.insertBefore(s,this.firstChild)),this._radio?this._radio.parentElement!==s&&s.appendChild(this._radio):(this._radio=document.createElement("input"),this._radio.type="radio",s.appendChild(this._radio),this.setupEventListeners()),this._radio.className="absolute inset-0 w-full h-full opacity-0 cursor-pointer",this._radio.style.cssText="position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; z-index: 10; pointer-events: auto; margin: 0; padding: 0;",this._radio.checked=this._checked,this._radio.disabled=i,this._changeHandler||this.setupEventListeners();const r=this.getId();r?this._radio.id=r:this._radio.removeAttribute("id");const n=this.getName();n?this._radio.name=n:this._radio.removeAttribute("name");const a=this.getValue();a?this._radio.value=a:this._radio.removeAttribute("value"),e?this._radio.setAttribute("aria-label",e):this._radio.removeAttribute("aria-label"),s.className=`mint-choice-wrapper ${this.getChoiceClasses()}`,s.style.pointerEvents="none",this._radio.style.pointerEvents="auto";let c=s.querySelector(".mint-choice-indicator");c||(c=document.createElement("div"),c.className="mint-choice-indicator w-2.5 h-2.5 rounded-full bg-white pointer-events-none absolute inset-0 m-auto",c.style.transition="opacity 200ms ease-out, transform 200ms ease-out",c.style.zIndex="1",s.appendChild(c)),c.style.opacity=this._checked?"1":"0",c.style.transform=this._checked?"scale(1)":"scale(0.8)",this.updateVisualState();let l=this.querySelector(".mint-choice-label-container");if(e||t){l||(l=document.createElement("div"),l.className="mint-choice-label-container flex flex-col gap-0.5 flex-1",this.appendChild(l));let o=l.querySelector(".mint-choice-label");e?(o||(o=document.createElement("span"),o.className="mint-choice-label text-sm font-medium text-gray-900 dark:text-gray-100 cursor-pointer select-none",l.insertBefore(o,l.firstChild)),o.textContent=e,i?o.classList.add("opacity-40"):o.classList.remove("opacity-40")):o&&o.remove();let d=l.querySelector(".mint-choice-info");if(t?(d||(d=document.createElement("span"),d.className="mint-choice-info text-xs text-gray-500 dark:text-gray-400 cursor-pointer select-none",l.appendChild(d)),d.textContent=t,i?d.classList.add("opacity-40"):d.classList.remove("opacity-40")):d&&d.remove(),i)l.style.cursor="default",l._clickHandler&&(l.removeEventListener("click",l._clickHandler),l._clickHandler=null);else{l.style.cursor="pointer";const h=l._clickHandler;h&&l.removeEventListener("click",h),l._clickHandler=u=>{this._radio&&(u.target===this._radio||this._radio.contains(u.target)||u.composedPath().includes(this._radio))||this.select()},l.addEventListener("click",l._clickHandler)}}else l&&l.remove()}setupEventListeners(){this.removeEventListeners(),this._radio&&(this._changeHandler=e=>{e.stopPropagation();const t=this._checked;if(this._checked=this._radio.checked,this._checked?this.hasAttribute("checked")||this.setAttribute("checked",""):this.hasAttribute("checked")&&this.removeAttribute("checked"),this.updateVisualState(),this._checked&&this._radio){const i=this._radio.name;i&&document.querySelectorAll(`input[type="radio"][name="${i}"]`).forEach(r=>{if(r!==this._radio){const n=r.closest("mint-choice");n&&n.updateVisualState&&(n._checked=r.checked,r.checked?n.hasAttribute("checked")||n.setAttribute("checked",""):n.hasAttribute("checked")&&n.removeAttribute("checked"),n.updateVisualState())}})}if(t!==this._checked){const i=new CustomEvent("change",{detail:{checked:this._checked,value:this.getValue()},bubbles:!0,cancelable:!0});this.dispatchEvent(i)}},this._radio.addEventListener("change",this._changeHandler),this._groupChangeHandler=e=>{const t=e.target;t!==this._radio&&t.type==="radio"&&t.name===this._radio.name&&t.checked&&setTimeout(()=>{this._radio&&this._radio.checked!==this._checked&&(this._checked=this._radio.checked,this._checked?this.hasAttribute("checked")||this.setAttribute("checked",""):this.hasAttribute("checked")&&this.removeAttribute("checked"),this.updateVisualState())},0)},document.addEventListener("change",this._groupChangeHandler,!0),this._clickHandler=e=>{const t=this._radio.name;t&&document.querySelectorAll(`input[type="radio"][name="${t}"]`).forEach(s=>{if(s!==this._radio){const r=s.closest("mint-choice");r&&r.updateVisualState&&(r._checked=s.checked,s.checked?r.hasAttribute("checked")||r.setAttribute("checked",""):r.hasAttribute("checked")&&r.removeAttribute("checked"),r.updateVisualState())}}),requestAnimationFrame(()=>{this._radio&&(this._checked=this._radio.checked,this.updateVisualState())})},this._radio.addEventListener("click",this._clickHandler),this._mousedownHandler=e=>{e.stopPropagation();const t=this.querySelector(".mint-choice-wrapper");t&&!this.isDisabled()&&(t.classList.add("mint-choice-active"),this._checked?(t.style.backgroundColor="rgb(15 23 42)",t.style.boxShadow="inset 0 2px 4px rgba(0, 0, 0, 0.3)"):(t.style.backgroundColor="rgb(243 244 246)",t.style.boxShadow="inset 0 2px 4px rgba(0, 0, 0, 0.1)"),document.documentElement.classList.contains("dark")&&(this._checked?t.style.backgroundColor="rgb(51 65 85)":t.style.backgroundColor="rgb(31 41 55)"))},this._mouseupHandler=e=>{e.stopPropagation();const t=this.querySelector(".mint-choice-wrapper");t&&(t.classList.remove("mint-choice-active"),t.style.backgroundColor="",t.style.boxShadow="")},this._mouseleaveHandler=e=>{const t=this.querySelector(".mint-choice-wrapper");t&&(t.classList.remove("mint-choice-active"),t.style.backgroundColor="",t.style.boxShadow="")},this._radio.addEventListener("mousedown",this._mousedownHandler),this._radio.addEventListener("mouseup",this._mouseupHandler),this._radio.addEventListener("mouseleave",this._mouseleaveHandler),this._touchstartHandler=e=>{e.stopPropagation();const t=this.querySelector(".mint-choice-wrapper");t&&!this.isDisabled()&&(t.classList.add("mint-choice-active"),this._checked?(t.style.backgroundColor="rgb(15 23 42)",t.style.boxShadow="inset 0 2px 4px rgba(0, 0, 0, 0.3)"):(t.style.backgroundColor="rgb(243 244 246)",t.style.boxShadow="inset 0 2px 4px rgba(0, 0, 0, 0.1)"),document.documentElement.classList.contains("dark")&&(this._checked?t.style.backgroundColor="rgb(51 65 85)":t.style.backgroundColor="rgb(31 41 55)"))},this._touchendHandler=e=>{e.stopPropagation();const t=this.querySelector(".mint-choice-wrapper");t&&(t.classList.remove("mint-choice-active"),t.style.backgroundColor="",t.style.boxShadow="")},this._radio.addEventListener("touchstart",this._touchstartHandler),this._radio.addEventListener("touchend",this._touchendHandler),this._focusHandler=e=>{const t=this.querySelector(".mint-choice-wrapper");t&&this._radio&&requestAnimationFrame(()=>{this._radio&&this._radio.matches(":focus-visible")&&(t==null||t.classList.add("ring-2","ring-offset-1","ring-gray-400","dark:ring-gray-500"))})},this._blurHandler=()=>{const e=this.querySelector(".mint-choice-wrapper");e&&e.classList.remove("ring-2","ring-offset-1","ring-gray-400","dark:ring-gray-500")},this._radio.addEventListener("focus",this._focusHandler),this._radio.addEventListener("blur",this._blurHandler))}removeEventListeners(){this._radio&&(this._changeHandler&&(this._radio.removeEventListener("change",this._changeHandler),this._changeHandler=null),this._groupChangeHandler&&(document.removeEventListener("change",this._groupChangeHandler,!0),this._groupChangeHandler=null),this._clickHandler&&(this._radio.removeEventListener("click",this._clickHandler),this._clickHandler=null),this._mousedownHandler&&(this._radio.removeEventListener("mousedown",this._mousedownHandler),this._mousedownHandler=null),this._mouseupHandler&&(this._radio.removeEventListener("mouseup",this._mouseupHandler),this._mouseupHandler=null),this._mouseleaveHandler&&(this._radio.removeEventListener("mouseleave",this._mouseleaveHandler),this._mouseleaveHandler=null),this._touchstartHandler&&(this._radio.removeEventListener("touchstart",this._touchstartHandler),this._touchstartHandler=null),this._touchendHandler&&(this._radio.removeEventListener("touchend",this._touchendHandler),this._touchendHandler=null),this._focusHandler&&(this._radio.removeEventListener("focus",this._focusHandler),this._focusHandler=null),this._blurHandler&&(this._radio.removeEventListener("blur",this._blurHandler),this._blurHandler=null))}updateVisualState(){const e=this.querySelector(".mint-choice-wrapper"),t=e==null?void 0:e.querySelector(".mint-choice-indicator");t&&(t.style.opacity=this._checked?"1":"0",t.style.transform=this._checked?"scale(1)":"scale(0.8)"),e&&(e.className=`mint-choice-wrapper ${this.getChoiceClasses()}`,e.classList.contains("mint-choice-active")||(e.style.backgroundColor="",e.style.boxShadow=""))}select(){if(this._radio&&!this.isDisabled()){this._radio.checked=!0,this._radio.dispatchEvent(new Event("change",{bubbles:!0})),this._checked=!0,this.hasAttribute("checked")||this.setAttribute("checked","");const e=this._radio.name;e&&document.querySelectorAll(`input[type="radio"][name="${e}"]`).forEach(s=>{if(s!==this._radio){const r=s.closest("mint-choice");r&&r.updateVisualState&&(r._checked=s.checked,s.checked?r.hasAttribute("checked")||r.setAttribute("checked",""):r.hasAttribute("checked")&&r.removeAttribute("checked"),r.updateVisualState())}}),this.updateVisualState();const t=new CustomEvent("change",{detail:{checked:this._checked,value:this.getValue()},bubbles:!0,cancelable:!0});this.dispatchEvent(t)}}}customElements.get("mint-choice")||customElements.define("mint-choice",J);class X extends HTMLElement{constructor(){super(),this._input=null,this._textarea=null,this._element=null,this._wrapper=null,this._icon=null,this._colorPicker=null,this._colorTextInput=null,this._colorContainer=null,this._colorPickerWrapper=null,this._numberSpinnerContainer=null,this._numberIncrementButton=null,this._numberDecrementButton=null,this._focusHandler=null,this._blurHandler=null,this._clickHandler=null,this._clickOutsideHandler=null}static get observedAttributes(){return["type","placeholder","value","disabled","id","name","required","readonly","rows","icon","label","info","error","error-message"]}connectedCallback(){this.classList.add("box-border","m-0","p-0","border-0","align-baseline","inline-block"),this.getLabel()||console.error('mint-input: The "label" attribute is required. Please provide a label for the input.'),this.render()}disconnectedCallback(){this.removeEventListeners()}attributeChangedCallback(e,t,i){if(t!==i){if(e==="error"||e==="error-message"){this._renderErrorState(),this._element&&(this._element.className=this.getInputClasses()),this._colorTextInput&&(this._colorTextInput.className=this.getInputClasses());return}this.render()}}getType(){return this.getAttribute("type")||"text"}getRows(){const e=this.getAttribute("rows");return e?parseInt(e,10):3}_getNormalizedType(){const e=this.getType();return e==="datetime"?"datetime-local":e==="money"?"text":e==="textarea"?"textarea":e}_isTextarea(){return this.getType()==="textarea"}_isMoney(){return this.getType()==="money"}_isColor(){return this.getType()==="color"}_isNumber(){return this.getType()==="number"}getPlaceholder(){return this.getAttribute("placeholder")||""}getValue(){var e,t,i;return this._isColor()?((e=this._colorPicker)==null?void 0:e.value)||((t=this._colorTextInput)==null?void 0:t.value)||this.getAttribute("value")||"#000000":((i=this._element)==null?void 0:i.value)||this.getAttribute("value")||""}set value(e){this._isColor()?(this._colorPicker&&(this._colorPicker.value=e||"#000000"),this._colorTextInput&&(this._colorTextInput.value=e||"#000000")):this._element&&(this._element.value=e),e?this.setAttribute("value",e):this.removeAttribute("value")}get value(){return this.getValue()}isDisabled(){return this.hasAttribute("disabled")}isReadonly(){return this.hasAttribute("readonly")}isRequired(){return this.hasAttribute("required")}hasError(){return this.hasAttribute("error")}getErrorMessage(){return this.getAttribute("error-message")||""}getId(){return this.getAttribute("id")||""}getName(){return this.getAttribute("name")||""}getIcon(){return this.getAttribute("icon")||""}getLabel(){return this.getAttribute("label")||""}getInfo(){return this.getAttribute("info")||""}getInputClasses(){const e=this._isTextarea(),t=!!this.getIcon(),i=this._isColor(),s=this._isNumber(),r=this.hasError(),n=["w-full",t||i?"pl-10":"px-3.5",t||i?"pr-3.5":s?"pr-10":"",e?"py-2":"py-1.5",e?"min-h-[6rem]":"min-h-[2rem]","text-sm","font-medium","rounded-lg","box-border","bg-white","dark:bg-gray-700","text-gray-900","dark:text-white",e?"transition-colors transition-opacity":"transition-all","duration-200","outline-none","focus:outline-none","disabled:opacity-40","disabled:cursor-not-allowed","readonly:cursor-default",e?"resize-y":"",s?"[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none":""],a=["border-2",r?"border-red-300 dark:border-red-300":"border-gray-200 dark:border-gray-600"],c=["focus-visible:ring-2","focus-visible:ring-offset-1",r?"focus-visible:ring-red-400 dark:focus-visible:ring-red-500":"focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500"];return[...n,...a,...c].filter(Boolean).join(" ")}render(){var v,x,S,y;this.getType();const e=this._getNormalizedType(),t=this._isTextarea(),i=this._isMoney(),s=this._isColor(),r=this.getPlaceholder(),n=this.isDisabled(),a=this.isReadonly(),c=this.isRequired(),l=this.getId(),o=this.getName(),d=this.getAttribute("value")||(s?"#000000":""),h=this.getRows(),u=this.getIcon(),b=this.getLabel(),f=this.getInfo();if(s){this._input&&(this._input.remove(),this._input=null),this._textarea&&(this._textarea.remove(),this._textarea=null),this._wrapper||(this._wrapper=document.createElement("div"),this._wrapper.className="relative w-full",this.appendChild(this._wrapper)),this._colorContainer&&(this._colorContainer.remove(),this._colorContainer=null),this._colorPickerWrapper&&!s&&(this._colorPickerWrapper.remove(),this._colorPickerWrapper=null),this._colorPickerWrapper||(this._colorPickerWrapper=document.createElement("div"),this._colorPickerWrapper.className="mint-color-picker-wrapper absolute left-[.65rem] top-1/2 -translate-y-1/2 w-6 h-6 rounded cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500",this._colorPickerWrapper.style.backgroundColor=d||"#000000",this._wrapper.appendChild(this._colorPickerWrapper),this._colorPicker=document.createElement("input"),this._colorPicker.type="color",this._colorPicker.className="absolute inset-0 w-full h-full opacity-0 cursor-pointer",this._colorPicker.style.cssText="position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; z-index: 10; pointer-events: auto; margin: 0; padding: 0; border: none;",this._colorPickerWrapper.appendChild(this._colorPicker),this._focusHandler=p=>{this._colorPickerWrapper&&this._colorPicker&&this._colorPicker.matches(":focus-visible")&&requestAnimationFrame(()=>{var k;this._colorPicker&&this._colorPicker.matches(":focus-visible")&&((k=this._colorPickerWrapper)==null||k.classList.add("ring-2","ring-offset-1","ring-gray-400","dark:ring-gray-500"))})},this._blurHandler=()=>{this._colorPickerWrapper&&this._colorPickerWrapper.classList.remove("ring-2","ring-offset-1","ring-gray-400","dark:ring-gray-500")},this._colorPicker.addEventListener("focus",this._focusHandler),this._colorPicker.addEventListener("blur",this._blurHandler),this._colorPicker.addEventListener("input",()=>{var k;const p=((k=this._colorPicker)==null?void 0:k.value)||"#000000";this._colorPickerWrapper&&(this._colorPickerWrapper.style.backgroundColor=p),this._colorTextInput&&(this._colorTextInput.value=p),this.setAttribute("value",p),this.dispatchEvent(new CustomEvent("input",{detail:{value:p},bubbles:!0,cancelable:!0}))}),this._colorPicker.addEventListener("change",()=>{var k;const p=((k=this._colorPicker)==null?void 0:k.value)||"#000000";this._colorPickerWrapper&&(this._colorPickerWrapper.style.backgroundColor=p),this.setAttribute("value",p),this.dispatchEvent(new CustomEvent("change",{detail:{value:p},bubbles:!0,cancelable:!0}))})),this._colorTextInput||(this._colorTextInput=document.createElement("input"),this._colorTextInput.type="text",this._colorTextInput.className=this.getInputClasses(),this._colorTextInput.placeholder=r||"#000000",this._colorTextInput.pattern="^#[0-9A-Fa-f]{6}$",this._wrapper.appendChild(this._colorTextInput),this._colorTextInput.addEventListener("input",()=>{var k;const p=((k=this._colorTextInput)==null?void 0:k.value)||"";/^#[0-9A-Fa-f]{6}$/.test(p)&&(this._colorPicker&&(this._colorPicker.value=p),this.setAttribute("value",p),this.dispatchEvent(new CustomEvent("input",{detail:{value:p},bubbles:!0,cancelable:!0})))}),this._colorTextInput.addEventListener("blur",()=>{var k,E;const p=((k=this._colorTextInput)==null?void 0:k.value)||"";/^#[0-9A-Fa-f]{6}$/.test(p)?(this._colorPicker&&(this._colorPicker.value=p),this.setAttribute("value",p)):this._colorPicker&&this._colorTextInput&&(this._colorTextInput.value=this._colorPicker.value),this.dispatchEvent(new CustomEvent("change",{detail:{value:((E=this._colorPicker)==null?void 0:E.value)||"#000000"},bubbles:!0,cancelable:!0}))}));const g=d||"#000000";if(this._colorPicker&&this._colorPicker.value!==g&&(this._colorPicker.value=g),this._colorPickerWrapper&&(this._colorPickerWrapper.style.backgroundColor=g),this._colorTextInput&&this._colorTextInput.value!==g&&(this._colorTextInput.value=g),this._colorPicker&&(this._colorPicker.disabled=n),this._colorPickerWrapper&&(n?(this._colorPickerWrapper.classList.add("opacity-40","cursor-not-allowed"),this._colorPickerWrapper.classList.remove("cursor-pointer")):(this._colorPickerWrapper.classList.remove("opacity-40","cursor-not-allowed"),this._colorPickerWrapper.classList.add("cursor-pointer"))),this._colorTextInput&&(this._colorTextInput.disabled=n,this._colorTextInput.readOnly=a,this._colorTextInput.required=c),this._colorTextInput){const p=this._colorTextInput;l?p.id=l:p.removeAttribute("id"),o?p.name=o:p.removeAttribute("name"),p.setAttribute("aria-invalid",this.hasError()?"true":"false"),this._element=p}this._renderErrorState();return}if(this._wrapper||(this._wrapper=document.createElement("div"),this._wrapper.className="relative w-full",this.appendChild(this._wrapper)),this._colorContainer&&(this._colorContainer.remove(),this._colorContainer=null,this._colorPicker=null,this._colorTextInput=null),this._colorPickerWrapper&&!s&&(this._colorPickerWrapper.remove(),this._colorPickerWrapper=null,this._colorPicker=null,this._colorTextInput=null),u&&!t?this._icon?this._icon.setAttribute("name",u):(this._icon=document.createElement("mint-icon"),this._icon.setAttribute("name",u),this._icon.className="absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400 dark:text-gray-500 pointer-events-none",this._wrapper.appendChild(this._icon)):this._icon&&(this._icon.remove(),this._icon=null),this._isNumber()&&!t){if(!this._numberSpinnerContainer){this._numberSpinnerContainer=document.createElement("div"),this._numberSpinnerContainer.className="absolute right-1 top-1/2 -translate-y-1/2 flex flex-col h-8 pointer-events-none",this._wrapper.appendChild(this._numberSpinnerContainer),this._numberIncrementButton=document.createElement("button"),this._numberIncrementButton.type="button",this._numberIncrementButton.className="flex items-center justify-center w-5 h-4 text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 disabled:opacity-40 disabled:cursor-not-allowed transition-colors pointer-events-auto bg-gray-100 dark:bg-gray-600 active:bg-gray-200 dark:active:bg-gray-500 rounded";const g=document.createElement("mint-icon");g.setAttribute("name","caret-up"),g.className="w-[1rem] h-[1rem]",this._numberIncrementButton.appendChild(g),this._numberSpinnerContainer.appendChild(this._numberIncrementButton),this._numberDecrementButton=document.createElement("button"),this._numberDecrementButton.type="button",this._numberDecrementButton.className="flex items-center justify-center w-5 h-4 text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 disabled:opacity-40 disabled:cursor-not-allowed transition-colors pointer-events-auto bg-gray-100 dark:bg-gray-600 active:bg-gray-200 dark:active:bg-gray-500 rounded";const p=document.createElement("mint-icon");p.setAttribute("name","caret-down"),p.className="w-[1rem] h-[1rem]",this._numberDecrementButton.appendChild(p),this._numberSpinnerContainer.appendChild(this._numberDecrementButton),this._numberIncrementButton.addEventListener("click",k=>{if(k.preventDefault(),k.stopPropagation(),this._input&&!this._input.disabled&&!this._input.readOnly){const E=parseFloat(this._input.value)||0,I=parseFloat(this._input.step)||1,C=this._input.min?parseFloat(this._input.min):void 0,w=this._input.max?parseFloat(this._input.max):void 0;let L=E+I;w!==void 0&&L>w&&(L=w),C!==void 0&&L<C&&(L=C),this._input.value=L.toString(),this.setAttribute("value",L.toString()),this._input.dispatchEvent(new Event("input",{bubbles:!0})),this._input.dispatchEvent(new Event("change",{bubbles:!0}))}}),this._numberDecrementButton.addEventListener("click",k=>{if(k.preventDefault(),k.stopPropagation(),this._input&&!this._input.disabled&&!this._input.readOnly){const E=parseFloat(this._input.value)||0,I=parseFloat(this._input.step)||1,C=this._input.min?parseFloat(this._input.min):void 0,w=this._input.max?parseFloat(this._input.max):void 0;let L=E-I;C!==void 0&&L<C&&(L=C),w!==void 0&&L>w&&(L=w),this._input.value=L.toString(),this.setAttribute("value",L.toString()),this._input.dispatchEvent(new Event("input",{bubbles:!0})),this._input.dispatchEvent(new Event("change",{bubbles:!0}))}})}this._numberIncrementButton&&(this._numberIncrementButton.disabled=n||a),this._numberDecrementButton&&(this._numberDecrementButton.disabled=n||a)}else this._numberSpinnerContainer&&(this._numberSpinnerContainer.remove(),this._numberSpinnerContainer=null,this._numberIncrementButton=null,this._numberDecrementButton=null);if(t){if(this._input&&(this._input.remove(),this._input=null),this._textarea||(this._textarea=document.createElement("textarea"),this._wrapper.appendChild(this._textarea),this.setupEventListeners()),this._element=this._textarea,this._textarea.placeholder=r,this._textarea.disabled=n,this._textarea.readOnly=a,this._textarea.required=c,this._textarea.rows=h,this._textarea.setAttribute("aria-invalid",this.hasError()?"true":"false"),d!==this._textarea.value&&(this._textarea.value=d),l?this._textarea.id=l:this._textarea.removeAttribute("id"),o?this._textarea.name=o:this._textarea.removeAttribute("name"),this._textarea.className=this.getInputClasses(),this.firstChild&&this.firstChild!==this._wrapper&&this.firstChild.nodeType===Node.TEXT_NODE){const g=this.firstChild.textContent;g&&!this._textarea.value&&(this._textarea.value=g.trim()),this.removeChild(this.firstChild)}}else if(this._textarea&&(this._textarea.remove(),this._textarea=null),this._input||(this._input=document.createElement("input"),this._wrapper.appendChild(this._input),this.setupEventListeners()),this._element=this._input,this._input.type=e,this._input.placeholder=r,this._input.disabled=n,this._input.readOnly=a,this._input.required=c,this._input.setAttribute("aria-invalid",this.hasError()?"true":"false"),i?(this._input.inputMode="decimal",this._input.pattern="[0-9]*\\.?[0-9]*"):(this._input.removeAttribute("inputmode"),this._input.removeAttribute("pattern")),d!==this._input.value&&(this._input.value=d),l?this._input.id=l:this._input.removeAttribute("id"),o?this._input.name=o:this._input.removeAttribute("name"),this._input.className=this.getInputClasses(),this.firstChild&&this.firstChild!==this._wrapper&&this.firstChild.nodeType===Node.TEXT_NODE){const g=this.firstChild.textContent;g&&!this._input.value&&(this._input.value=g.trim()),this.removeChild(this.firstChild)}let m=this.querySelector(".mint-input-label-container");if(b||f){m||(m=document.createElement("div"),m.className="mint-input-label-container flex flex-col gap-0.5 mb-[.25rem]",this._wrapper&&this._wrapper.parentElement===this?this.insertBefore(m,this._wrapper):this.insertBefore(m,this.firstChild));let g=m.querySelector(".mint-input-label");if(b){g||(g=document.createElement("label"),g.className="mint-input-label text-sm font-medium text-gray-900 dark:text-gray-100 select-none",m.insertBefore(g,m.firstChild)),g.textContent=b;const k=l||((v=this._element)==null?void 0:v.id)||((x=this._colorTextInput)==null?void 0:x.id)||((S=this._input)==null?void 0:S.id)||((y=this._textarea)==null?void 0:y.id);if(k)g.setAttribute("for",k);else{const E=`mint-input-${Math.random().toString(36).substr(2,9)}`;this._element?this._element.id=E:this._colorTextInput?this._colorTextInput.id=E:this._input?this._input.id=E:this._textarea&&(this._textarea.id=E),g.setAttribute("for",E)}n?g.classList.add("opacity-40"):g.classList.remove("opacity-40")}else g&&g.remove();let p=m.querySelector(".mint-input-info");f?(p||(p=document.createElement("span"),p.className="mint-input-info text-xs text-gray-500 dark:text-gray-400 select-none",m.appendChild(p)),p.textContent=f,n?p.classList.add("opacity-40"):p.classList.remove("opacity-40")):p&&p.remove()}else m&&m.remove();this._renderErrorState()}_renderErrorState(){const e=this.hasError(),t=this.getErrorMessage();let i=this.querySelector(".mint-input-error");e&&t?(i||(i=document.createElement("div"),i.className="mint-input-error mt-1 text-xs text-red-600 dark:text-red-400",this.appendChild(i)),i.textContent=t):i&&i.remove()}setupEventListeners(){this._element&&(this._element.addEventListener("input",()=>{var t;const e=((t=this._element)==null?void 0:t.value)||"";e?this.setAttribute("value",e):this.removeAttribute("value"),this.dispatchEvent(new CustomEvent("input",{detail:{value:e},bubbles:!0,cancelable:!0}))}),this._element.addEventListener("blur",()=>{var t;const e=((t=this._element)==null?void 0:t.value)||"";e?this.setAttribute("value",e):this.removeAttribute("value"),this.dispatchEvent(new CustomEvent("change",{detail:{value:e},bubbles:!0,cancelable:!0}))}))}removeEventListeners(){this._colorPicker&&(this._focusHandler&&(this._colorPicker.removeEventListener("focus",this._focusHandler),this._focusHandler=null),this._blurHandler&&(this._colorPicker.removeEventListener("blur",this._blurHandler),this._blurHandler=null))}focus(){var e;this._isColor()&&this._colorTextInput?this._colorTextInput.focus():(e=this._element)==null||e.focus()}blur(){var e;this._isColor()&&this._colorTextInput?this._colorTextInput.blur():(e=this._element)==null||e.blur()}}customElements.get("mint-input")||customElements.define("mint-input",X);class K extends HTMLElement{constructor(){super(),this._input=null,this._textInput=null,this._popover=null,this._calendarContainer=null,this._iconButton=null,this._hiddenInput=null,this._startPartInputs=[],this._endPartInputs=[],this._displayEl=null,this._inputsWrapperEl=null,this._fieldsContainer=null,this._resetHandler=null,this._isInputMode=!1,this._currentMonth=new Date().getMonth(),this._currentYear=new Date().getFullYear(),this._viewMode="calendar",this._selectedStartDate=null,this._selectedEndDate=null,this._isRange=!1,this._popoverObserver=null,this._focusTrapHandler=null,this._escapeHandler=null}static get observedAttributes(){return["value","label","info","disabled","id","name","required","readonly","format","min","max","range","shortcuts","display-format","error","error-message"]}connectedCallback(){this.classList.add("box-border","m-0","p-0","border-0","align-baseline","inline-block"),this.render(),this._setupPopoverWithRetry(),this._attachFormResetListener()}disconnectedCallback(){if(this._popoverObserver&&(this._popoverObserver.disconnect(),this._popoverObserver=null),this._removeFocusTrap(),this._resetHandler){const e=this.closest("form");e&&e.removeEventListener("reset",this._resetHandler),this._resetHandler=null}}attributeChangedCallback(e,t,i){if(t!==i){if(e==="error"||e==="error-message"){const s=this.hasError(),r=this.getErrorMessage();this._applyErrorVisuals(s,r,this.isDisabled());return}this.render(),this._input&&this._setupPopoverWithRetry()}}getValue(){return this.getAttribute("value")||""}setValue(e){e?(this.setAttribute("value",e),this._textInput&&(this._textInput.value=e),this._parseValue(e)):(this.removeAttribute("value"),this._textInput&&(this._textInput.value=""),this._selectedStartDate=null,this._selectedEndDate=null),this._buildCalendar(),this._updateDisplayText()}getFormat(){return this.getAttribute("format")||"mm/dd/yyyy"}getLabel(){return this.getAttribute("label")||""}getInfo(){return this.getAttribute("info")||""}isDisabled(){return this.hasAttribute("disabled")}isReadonly(){return this.hasAttribute("readonly")}isRequired(){return this.hasAttribute("required")}hasError(){return this.hasAttribute("error")}getErrorMessage(){return this.getAttribute("error-message")||""}isRange(){return this.hasAttribute("range")}getId(){return this.getAttribute("id")||""}getName(){return this.getAttribute("name")||""}getMin(){return this.getAttribute("min")||""}getMax(){return this.getAttribute("max")||""}getDisplayFormat(){return this.getAttribute("display-format")||"F j, Y"}getShortcuts(){const e=this.getAttribute("shortcuts");if(!e)return[];try{const t=JSON.parse(e);if(Array.isArray(t))return t.map(i=>({label:i.label,action:this._createShortcutAction(i.action)}))}catch{const i=e.trim();if(i&&typeof window[i]=="function"){const s=window[i]();if(Array.isArray(s))return s.map(r=>({label:r.label,action:typeof r.action=="function"?r.action:this._createShortcutAction(r.action)}))}}return[]}_createShortcutAction(e){return typeof e=="function"?e:typeof e=="string"&&typeof window[e]=="function"?window[e]:()=>null}_getDefaultShortcuts(){const e=[{label:"Today",action:()=>new Date}];return this._isRange&&e.push({label:"This Week",action:()=>{const t=new Date,i=t.getDay(),s=new Date(t);s.setDate(t.getDate()-i),s.setHours(0,0,0,0);const r=new Date(s);return r.setDate(s.getDate()+6),r.setHours(23,59,59,999),{start:s,end:r}}},{label:"This Month",action:()=>{const t=new Date,i=new Date(t.getFullYear(),t.getMonth(),1),s=new Date(t.getFullYear(),t.getMonth()+1,0);return s.setHours(23,59,59,999),{start:i,end:s}}}),e}_getFormatTokens(e){const t=[];let i=0;const s=e.toLowerCase();for(;i<s.length;){const r=s[i];if(r==="d"||r==="m"||r==="y"){let n=1,a=i+1;for(;a<s.length&&s[a]===r;)n++,a++;t.push({type:"part",part:r,len:n}),i=a}else t.push({type:"sep",value:e[i]}),i++}return t}_createPartInput(e,t,i,s,r){const n=document.createElement("input");return n.type="text",n.inputMode="numeric",n.pattern="\\d*",n.maxLength=e,n.placeholder=t,n.className="bg-transparent border-none outline-none text-center text-sm font-medium p-0 m-0 focus:outline-none focus:ring-0 disabled:opacity-40 disabled:cursor-not-allowed",n.disabled=i,n.readOnly=s,n.required=r,e===4?n.className+=" w-[40px]":e===2&&(n.className+=" w-[30px]"),n}_buildValueFromParts(e,t){let i=0;return t.map(s=>{var n;if(s.type==="sep")return s.value;const r=((n=e[i])==null?void 0:n.value)||"";return i++,r}).join("")}_applyDateToParts(e,t,i,s){if(!t.length)return;if(!e){t.forEach(c=>c.value="");return}const r=this._formatDate(e,s);let n=0,a=0;i.forEach(c=>{if(c.type==="sep")n+=c.value.length;else{const l=r.substr(n,c.len);t[a]&&(t[a].value=l),a++,n+=c.len}})}_syncHiddenInput(){if(!this._hiddenInput)return;const e=this.getFormat(),t=this._getFormatTokens(e),i=this._buildValueFromParts(this._startPartInputs,t);if(this._isRange){const s=this._buildValueFromParts(this._endPartInputs,t);this._hiddenInput.value=s?`${i} - ${s}`:i}else this._hiddenInput.value=i}_focusNext(e,t){if(t+1<e.length){const i=e[t+1];i.focus(),i.setSelectionRange(0,i.value.length)}}_focusPrev(e,t){if(t-1>=0){const i=e[t-1];i.focus(),i.setSelectionRange(i.value.length,i.value.length)}}_attachPartInputHandlers(e,t,i){e.forEach((s,r)=>{const n=s.maxLength||2;s.addEventListener("input",()=>{s.value=s.value.replace(/\D/g,"").slice(0,n),s.value.length>=n&&this._focusNext(e,r),this._syncHiddenInput()}),s.addEventListener("keydown",a=>{a.key==="Backspace"&&s.selectionStart===0&&s.selectionEnd===0&&this._focusPrev(e,r),a.key==="ArrowLeft"&&s.selectionStart===0&&s.selectionEnd===0&&(this._focusPrev(e,r),a.preventDefault()),a.key==="ArrowRight"&&s.selectionStart===s.value.length&&s.selectionEnd===s.value.length&&(this._focusNext(e,r),a.preventDefault())}),s.addEventListener("blur",a=>{var l;this._syncHiddenInput();const c=a.relatedTarget;c&&i.contains(c)||(this._handleBlur(((l=this._hiddenInput)==null?void 0:l.value)||""),this._exitInputMode())})})}_splitRangeInput(e,t){const i=e.split(/\s*-\s*/);return i.length>=2?[i[0],i.slice(1).join("-")]:[e]}_parseValue(e){const t=this.getFormat(),i=this._getFormatTokens(t);if(this._isRange){const[s,r]=this._splitRangeInput(e,t),n=s?this._parseDateString(s,t):null,a=r?this._parseDateString(r,t):null;if(n&&a){const[c,l]=n<=a?[n,a]:[a,n];this._selectedStartDate=c,this._selectedEndDate=l,this._currentMonth=c.getMonth(),this._currentYear=c.getFullYear()}else n&&(this._selectedStartDate=n,this._selectedEndDate=null,this._currentMonth=n.getMonth(),this._currentYear=n.getFullYear());this._applyDateToParts(this._selectedStartDate,this._startPartInputs,i,t),this._applyDateToParts(this._selectedEndDate,this._endPartInputs,i,t)}else{const s=this._parseDateString(e,t);s&&!isNaN(s.getTime())?(this._selectedStartDate=s,this._selectedEndDate=null,this._currentMonth=s.getMonth(),this._currentYear=s.getFullYear(),this._applyDateToParts(s,this._startPartInputs,i,t)):this._applyDateToParts(null,this._startPartInputs,i,t)}this._syncHiddenInput(),this._updateDisplayText()}_parseDateString(e,t){const i=/[\/\-\.\s]+/;if(i.test(e)){const _=e.split(i).filter(v=>v.length>0),m=t.split(/[\/\-\.\s]+/).filter(v=>v.length>0);if(_.length===m.length){let v=0,x=0,S=0;for(let y=0;y<m.length;y++){const g=m[y].toLowerCase(),p=_[y];if(g.includes("d"))v=parseInt(p,10);else if(g.includes("m"))x=parseInt(p,10)-1;else if(g.includes("y")){let k=parseInt(p,10);const E=g.length,I=p.length;I===2&&E===4?k=Math.floor(new Date().getFullYear()/100)*100+k:I===2&&E===2&&(k=Math.floor(new Date().getFullYear()/100)*100+k),S=k}}if(v&&x>=0&&x<=11&&S){const y=new Date(S,x,v);if(!isNaN(y.getTime())&&y.getDate()===v&&y.getMonth()===x&&y.getFullYear()===S)return y}}}const r=e.replace(/[\/\-\.]/g,""),n=t.replace(/[\/\-\.]/g,"").toLowerCase();let a=n.indexOf("d"),c=n.indexOf("m"),l=n.indexOf("y");const o=[{char:"d",index:a},{char:"m",index:c},{char:"y",index:l}].sort((_,m)=>_.index-m.index);let d=0,h=0,u=0,b=0;n.length,r.length;for(const _ of o)if(_.char==="d"){const m=n.lastIndexOf("d")-n.indexOf("d")+1,v=r.substr(b,m);if(v.length===0)return null;d=parseInt(v,10),b+=v.length}else if(_.char==="m"){const m=n.lastIndexOf("m")-n.indexOf("m")+1,v=r.substr(b,m);if(v.length===0)return null;h=parseInt(v,10)-1,b+=v.length}else if(_.char==="y"){const m=n.lastIndexOf("y")-n.indexOf("y")+1,v=r.substr(b),x=Math.min(m,v.length),S=v.substr(0,x);if(S.length===0)return null;let y=parseInt(S,10);x===2&&m===4?y=Math.floor(new Date().getFullYear()/100)*100+y:x===2&&m===2&&(y=Math.floor(new Date().getFullYear()/100)*100+y),u=y,b+=x}if(!d||h<0||h>11||!u)return null;const f=new Date(u,h,d);return isNaN(f.getTime())||f.getDate()!==d||f.getMonth()!==h||f.getFullYear()!==u?null:f}_formatDate(e,t){const i=e.getDate(),s=e.getMonth()+1,r=e.getFullYear(),n=t.toLowerCase();let a=t;return n.includes("dd")?a=a.replace(/dd/gi,String(i).padStart(2,"0")):n.includes("d")&&(a=a.replace(/d/gi,String(i))),n.includes("mm")?a=a.replace(/mm/gi,String(s).padStart(2,"0")):n.includes("m")&&(a=a.replace(/m/gi,String(s))),n.includes("yyyy")?a=a.replace(/yyyy/gi,String(r)):n.includes("yy")&&(a=a.replace(/yy/gi,String(r).substr(2))),a}_formatDatePhp(e,t){const i=e.getDate(),s=e.getMonth()+1,r=e.getFullYear(),n=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],a=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],c=["January","February","March","April","May","June","July","August","September","October","November","December"],l=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],o=(u,b=2)=>u.toString().padStart(b,"0"),d=u=>{const b=u%10,f=u%100;return b===1&&f!==11?"st":b===2&&f!==12?"nd":b===3&&f!==13?"rd":"th"};let h="";for(let u=0;u<t.length;u++){const b=t[u];if(b==="\\"&&u+1<t.length){h+=t[u+1],u++;continue}switch(b){case"Y":h+=r.toString();break;case"y":h+=r.toString().slice(-2);break;case"m":h+=o(s);break;case"n":h+=s.toString();break;case"M":h+=l[s-1];break;case"F":h+=c[s-1];break;case"d":h+=o(i);break;case"j":h+=i.toString();break;case"D":h+=a[e.getDay()];break;case"l":h+=n[e.getDay()];break;case"S":h+=d(i);break;default:h+=b;break}}return h}_validateDateString(e,t){const i=this._parseDateString(e,t);return i!==null&&!isNaN(i.getTime())}render(){const e=this.getLabel(),t=this.getInfo(),i=this.getValue(),s=this.isDisabled(),r=this.isReadonly(),n=this.isRequired(),a=this.getId(),c=this.getName(),l=this.getFormat(),o=this.hasError(),d=this.getErrorMessage();this._isRange=this.isRange(),this._input||(this._input=document.createElement("div"),this._input.className="relative w-full",this.appendChild(this._input));let h=this.querySelector(".mint-date-picker-label-container");if(e||t){h||(h=document.createElement("div"),h.className="mint-date-picker-label-container flex flex-col gap-0.5 mb-[.25rem]",this.insertBefore(h,this._input));let m=h.querySelector(".mint-date-picker-label");e?(m||(m=document.createElement("label"),m.className="mint-date-picker-label text-sm font-medium text-gray-900 dark:text-gray-100 select-none",h.insertBefore(m,h.firstChild)),m.textContent=e,a&&this._textInput&&m.setAttribute("for",a)):m&&m.remove();let v=h.querySelector(".mint-date-picker-info");t?(v||(v=document.createElement("span"),v.className="mint-date-picker-info text-xs text-gray-500 dark:text-gray-400 select-none",h.appendChild(v)),v.textContent=t):v&&v.remove()}else h&&h.remove();this._hiddenInput||(this._hiddenInput=document.createElement("input"),this._hiddenInput.type="hidden",this._hiddenInput.value=i||"",this._textInput=this._hiddenInput,this._input.appendChild(this._hiddenInput)),a&&(this._hiddenInput.id=a),c&&(this._hiddenInput.name=c),this._hiddenInput.value=i||"",this._hiddenInput.setAttribute("aria-invalid",o?"true":"false");let u=this._input.querySelector(".mint-date-fields");u||(u=document.createElement("div"),this._input.appendChild(u)),this._fieldsContainer=u,this._applyErrorVisuals(o,d,s),u.innerHTML="",this._displayEl=document.createElement("div"),this._displayEl.className="flex-1 text-gray-900 dark:text-white cursor-text select-none focus:outline-none",this._displayEl.tabIndex=s?-1:0,this._displayEl.addEventListener("click",()=>{s||r||this._enterInputMode()}),this._displayEl.addEventListener("keydown",m=>{s||r||(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),this._enterInputMode())}),this._inputsWrapperEl=document.createElement("div"),this._inputsWrapperEl.className="flex items-center gap-1 w-full";const b=this._getFormatTokens(l);this._startPartInputs=[],this._endPartInputs=[];const f=m=>{const v=document.createDocumentFragment();return b.forEach(x=>{if(x.type==="sep"){const S=document.createElement("span");S.textContent=x.value,S.className="text-gray-400 dark:text-gray-500 select-none",v.appendChild(S)}else{const S=x.part==="d"?"dd":x.part==="m"?"mm":x.len===2?"yy":"yyyy",y=this._createPartInput(x.len,S,s,r,n);m==="start"?this._startPartInputs.push(y):this._endPartInputs.push(y),v.appendChild(y)}}),v};if(this._inputsWrapperEl.appendChild(f("start")),this._isRange){const m=document.createElement("span");m.textContent=" - ",m.className="text-gray-400 dark:text-gray-500 select-none",this._inputsWrapperEl.appendChild(m),this._inputsWrapperEl.appendChild(f("end"))}const _=document.createElement("div");if(_.className="flex flex-col w-full",this._displayEl.style.display=this._isInputMode?"none":"flex",this._inputsWrapperEl.style.display=this._isInputMode?"flex":"none",_.appendChild(this._displayEl),_.appendChild(this._inputsWrapperEl),u.appendChild(_),u.addEventListener("click",()=>{this._isInputMode||s||r||this._enterInputMode()}),this._attachPartInputHandlers(this._startPartInputs,b,u),this._isRange&&this._attachPartInputHandlers(this._endPartInputs,b,u),this._parseValue(i),this._syncHiddenInput(),this._updateDisplayText(),this._iconButton)this._iconButton.disabled=s||r,!s&&!r?this._iconButton.tabIndex=0:this._iconButton.tabIndex=-1;else{this._iconButton=document.createElement("button"),this._iconButton.type="button",this._iconButton.tabIndex=0,this._iconButton.className="absolute left-2 top-2 text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 cursor-pointer z-10 focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500 pointer-events-auto disabled:opacity-40 disabled:cursor-not-allowed flex items-center justify-center rounded-sm";const m=`date-icon-${Math.random().toString(36).substr(2,9)}`;this._iconButton.id=m;const v=document.createElement("mint-icon");v.setAttribute("name","calendar"),v.className="w-4 h-4 pointer-events-none",this._iconButton.appendChild(v),this._iconButton.addEventListener("click",()=>{s||r||this._enterInputMode()}),this._input.prepend(this._iconButton),this._iconButton.disabled=s||r}this._renderErrorState(o,d)}_renderErrorState(e,t){let i=this.querySelector(".mint-date-picker-error");e&&t?(i||(i=document.createElement("div"),i.className="mint-date-picker-error mt-1 text-xs text-red-600 dark:text-red-400",this.appendChild(i)),i.textContent=t):i&&i.remove()}_applyErrorVisuals(e,t,i){if(this._renderErrorState(e,t),this._fieldsContainer){const s=this._getFieldContainerClass(e,i);this._fieldsContainer.className=s}this._hiddenInput&&this._hiddenInput.setAttribute("aria-invalid",e?"true":"false")}_attachFormResetListener(){const e=this.closest("form");!e||this._resetHandler||(this._resetHandler=()=>{this.setValue(""),this._clearPartInputs(this._startPartInputs),this._clearPartInputs(this._endPartInputs),this._isInputMode=!1,this._updateDisplayText(),this._applyErrorVisuals(!1,"",this.isDisabled())},e.addEventListener("reset",this._resetHandler))}_clearPartInputs(e){e.forEach(t=>{t.value=""})}_getFieldContainerClass(e,t){return["mint-date-fields relative w-full pl-10 pr-3.5 py-1.5 min-h-[2rem] text-sm font-medium rounded-lg box-border bg-white dark:bg-gray-700 text-gray-900 dark:text-white","border-2",e?"border-red-300 dark:border-red-300":"border-gray-200 dark:border-gray-600","transition-all duration-200 outline-none focus-within:ring-2 focus-within:ring-offset-1",e?"focus-within:ring-red-400 dark:focus-within:ring-red-500":"focus-within:ring-gray-400 dark:focus-within:ring-gray-500","flex items-center gap-1"].join(" ")+(t?" opacity-40 cursor-not-allowed":"")}_handleInputChange(e){}_cleanInputValue(e,t){return e}_handleBlur(e){const t=this.getFormat();if(!e){this.setValue(""),this._updateDisplayText();return}if(this._isRange){const[i,s]=this._splitRangeInput(e,t),r=i?this._parseDateString(i,t):null,n=s?this._parseDateString(s,t):null;if(r&&n){const[a,c]=r<=n?[r,n]:[n,r],l=this._formatDate(a,t),o=this._formatDate(c,t),d=`${l} - ${o}`;this.setValue(d),this._applyDateToParts(a,this._startPartInputs,this._getFormatTokens(t),t),this._applyDateToParts(c,this._endPartInputs,this._getFormatTokens(t),t),this._selectedStartDate=a,this._selectedEndDate=c,this._currentMonth=a.getMonth(),this._currentYear=a.getFullYear()}else if(r){const a=this._formatDate(r,t);this.setValue(a),this._applyDateToParts(r,this._startPartInputs,this._getFormatTokens(t),t),this._applyDateToParts(null,this._endPartInputs,this._getFormatTokens(t),t),this._selectedStartDate=r,this._selectedEndDate=null,this._currentMonth=r.getMonth(),this._currentYear=r.getFullYear()}else this.setValue(""),this._applyDateToParts(null,this._startPartInputs,this._getFormatTokens(t),t),this._applyDateToParts(null,this._endPartInputs,this._getFormatTokens(t),t),this._selectedStartDate=null,this._selectedEndDate=null}else if(this._validateDateString(e,t)){const i=this._parseDateString(e,t);if(i){const s=this._formatDate(i,t);this.setValue(s),this._applyDateToParts(i,this._startPartInputs,this._getFormatTokens(t),t),this._selectedStartDate=i,this._selectedEndDate=null,this._currentMonth=i.getMonth(),this._currentYear=i.getFullYear()}}else this.setValue(""),this._applyDateToParts(null,this._startPartInputs,this._getFormatTokens(t),t),this._selectedStartDate=null,this._selectedEndDate=null}_setupPopoverWithRetry(e=0){if(!this._iconButton){e<10&&requestAnimationFrame(()=>{this._setupPopoverWithRetry(e+1)});return}const t=10,i=this._iconButton.id;i&&this._iconButton.isConnected?document.getElementById(i)?this._createPopover(i):e<t&&requestAnimationFrame(()=>{this._setupPopoverWithRetry(e+1)}):e<t&&requestAnimationFrame(()=>{this._setupPopoverWithRetry(e+1)})}_createPopover(e){if(!e)return;if(!document.getElementById(e)){setTimeout(()=>{this._createPopover(e)},50);return}if(!this._popover)this._popover=document.createElement("mint-popover"),this._popover.setAttribute("direction","down"),this._popover.setAttribute("padding","0"),this.parentNode?this.parentNode.insertBefore(this._popover,this.nextSibling):document.body.appendChild(this._popover),requestAnimationFrame(()=>{requestAnimationFrame(()=>{this._popover&&this._popover.isConnected&&(this._popover.setAttribute("trigger-id",e),this._popoverObserver||(this._popoverObserver=new MutationObserver(i=>{i.forEach(s=>{var r;if(s.type==="attributes"&&s.attributeName==="open")if((r=this._popover)==null?void 0:r.hasAttribute("open"))requestAnimationFrame(()=>{this._buildCalendar();const a=this._popover;typeof a.render=="function"&&a.render(),this._setupFocusTrap()});else{if(this._removeFocusTrap(),this._iconButton&&!this._iconButton.disabled&&requestAnimationFrame(()=>{var a;(a=this._iconButton)==null||a.focus()}),this._viewMode="calendar",this._selectedStartDate)this._currentMonth=this._selectedStartDate.getMonth(),this._currentYear=this._selectedStartDate.getFullYear();else{const a=new Date;this._currentMonth=a.getMonth(),this._currentYear=a.getFullYear()}requestAnimationFrame(()=>{this._buildCalendar()})}})}),this._popoverObserver.observe(this._popover,{attributes:!0,attributeFilter:["open"]})),requestAnimationFrame(()=>{this._buildCalendar()}))})});else{if(this._popover.getAttribute("trigger-id")!==e){this._popover.setAttribute("trigger-id",e);const s=this._popover;typeof s._setupTrigger=="function"&&s._setupTrigger()}this._buildCalendar()}}_buildCalendar(){if(!this._popover)return;this._calendarContainer&&this._calendarContainer.parentNode&&this._calendarContainer.remove(),this._calendarContainer=document.createElement("div"),this._calendarContainer.className="mint-date-calendar bg-white dark:bg-gray-800 rounded-lg p-4 w-[22rem] md:w-auto md:min-w-[28rem]",this._viewMode==="calendar"?this._buildCalendarView():this._viewMode==="month"?this._buildMonthView():this._viewMode==="year"&&this._buildYearView();const e=this._popover.querySelector(".popover-content");if(e){for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(this._calendarContainer)}else this._popover.appendChild(this._calendarContainer)}_buildCalendarView(){if(!this._calendarContainer)return;const e=this._getDaysInMonth(this._currentMonth,this._currentYear),t=this._getFirstDayOfMonth(this._currentMonth,this._currentYear),i=["January","February","March","April","May","June","July","August","September","October","November","December"],s=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],r=this.getShortcuts(),n=r.length>0;this._calendarContainer.className=n?"mint-date-calendar bg-white dark:bg-gray-800 rounded-lg p-4 w-[18rem] md:w-auto md:min-w-[28rem]":"mint-date-calendar bg-white dark:bg-gray-800 rounded-lg p-4 w-[18rem] md:min-w-[18rem]";const a=document.createElement("div");a.className="flex flex-col md:flex-row md:gap-6 md:items-start";const c=document.createElement("div");c.className="flex-1 min-w-0";const l=document.createElement("div");l.className="flex items-center justify-between mb-4";const o=document.createElement("button");o.type="button",o.tabIndex=0,o.className="p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-600 dark:text-gray-300 transition-colors flex items-center focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500",o.setAttribute("data-keep-popover-open","true");const d=document.createElement("mint-icon");d.setAttribute("name","caret-left"),d.className="w-4 h-4",o.appendChild(d),o.addEventListener("click",()=>{this._currentMonth===0?(this._currentMonth=11,this._currentYear--):this._currentMonth--,this._buildCalendar()}),l.appendChild(o);const h=document.createElement("div");h.className="flex items-center gap-2";const u=document.createElement("button");u.type="button",u.tabIndex=0,u.className="text-sm font-medium text-gray-900 dark:text-gray-100 hover:text-gray-600 dark:hover:text-gray-300 transition-colors flex items-center focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500",u.setAttribute("data-keep-popover-open","true"),u.textContent=i[this._currentMonth],u.addEventListener("click",()=>{this._viewMode="month",this._buildCalendar()}),h.appendChild(u);const b=document.createElement("button");b.type="button",b.tabIndex=0,b.className="text-sm font-medium text-gray-900 dark:text-gray-100 hover:text-gray-600 dark:hover:text-gray-300 transition-colors flex items-center focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500",b.setAttribute("data-keep-popover-open","true"),b.textContent=String(this._currentYear),b.addEventListener("click",()=>{this._viewMode="year",this._buildCalendar()}),h.appendChild(b),l.appendChild(h);const f=document.createElement("button");f.type="button",f.tabIndex=0,f.className="p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-600 dark:text-gray-300 transition-colors flex items-center focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500",f.setAttribute("data-keep-popover-open","true");const _=document.createElement("mint-icon");_.setAttribute("name","caret-right"),_.className="w-4 h-4",f.appendChild(_),f.addEventListener("click",()=>{this._currentMonth===11?(this._currentMonth=0,this._currentYear++):this._currentMonth++,this._buildCalendar()}),l.appendChild(f);const m=document.createElement("div");m.className="grid grid-cols-7 mb-2",s.forEach(y=>{const g=document.createElement("div");g.className="text-xs font-medium text-gray-500 dark:text-gray-400 text-center py-1",g.textContent=y,m.appendChild(g)});const v=document.createElement("div");v.className="grid grid-cols-7";for(let y=0;y<t;y++){const g=document.createElement("div");g.className="w-8 h-8",v.appendChild(g)}const x=this.getMin()?this._parseDateString(this.getMin(),this.getFormat()):null,S=this.getMax()?this._parseDateString(this.getMax(),this.getFormat()):null;for(let y=1;y<=e;y++){const g=new Date(this._currentYear,this._currentMonth,y),p=this._isToday(g),k=this._isDateSelected(g),E=this._isDateInRange(g),I=x&&g<x||S&&g>S;let C="rounded-md";if(this._isRange&&this._selectedStartDate&&this._selectedEndDate){const L=this._isSameDate(g,this._selectedStartDate),M=this._isSameDate(g,this._selectedEndDate);L&&M?C="rounded-md":L?C="rounded-l-md":M?C="rounded-r-md":E&&(C="rounded-none")}else k&&!this._isRange&&(C="rounded-md");const w=document.createElement("button");w.type="button",w.disabled=!!I,w.tabIndex=I?-1:0,w.className=`w-full h-8 ${C} border-0 text-sm font-medium transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500 ${k?"bg-slate-800 dark:bg-slate-600 text-white":E?"bg-slate-100 dark:bg-slate-700 text-slate-800 dark:text-slate-200":p?"text-gray-900 dark:text-gray-100 font-semibold":"text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700"} ${I?"opacity-40 cursor-not-allowed":""}`,w.textContent=y.toString(),I||w.addEventListener("click",()=>{this._handleDateClick(g)}),v.appendChild(w)}if(n){const y=document.createElement("div");y.className="mb-4 pb-4 border-b border-gray-200 dark:border-gray-700 md:mb-0 md:pb-0 md:border-b-0 md:border-r md:border-r-gray-200 dark:md:border-r-gray-700 md:pr-6 md:mr-0 md:w-32 md:flex-shrink-0 md:h-full md:flex md:flex-col";const g=document.createElement("div");g.className="relative md:relative md:flex-1 md:min-h-0";const p=document.createElement("div");p.className="flex gap-2 overflow-x-auto pb-1 md:flex-col md:overflow-x-visible md:overflow-y-auto md:pb-0 md:gap-2",p.style.scrollbarWidth="none",p.style.msOverflowStyle="none",p.style.setProperty("-webkit-overflow-scrolling","touch");const k=document.createElement("style");k.textContent=`
45
45
  .mint-date-shortcuts-row::-webkit-scrollbar {
46
46
  display: none;
47
47
  }
package/dist/index.js CHANGED
@@ -190,10 +190,12 @@ class z extends HTMLElement {
190
190
  return this.getAttribute("tone") || "neutral";
191
191
  }
192
192
  isDisabled() {
193
- return this.hasAttribute("disabled");
193
+ const e = this.getAttribute("disabled");
194
+ return e === null ? !1 : e !== "false";
194
195
  }
195
196
  isLoading() {
196
- return this.hasAttribute("loading");
197
+ const e = this.getAttribute("loading");
198
+ return e === null ? !1 : e !== "false";
197
199
  }
198
200
  getType() {
199
201
  return (this.getAttribute("button-type") || "default") === "submit" ? "submit" : "button";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "monobill-mintui",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "description": "A modern framework-agnostic UI kit built as Web Components. Requires Tailwind CSS.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",