monobill-mintui 0.6.613 → 0.6.615
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.
- package/README.md +9 -9
- package/bin/mint-ui.js +5 -5
- package/dist/back-button.css +1 -1
- package/dist/components/alert/browser.js +3 -3
- package/dist/components/alert/index.cjs +1 -1
- package/dist/components/alert/index.js +3 -3
- package/dist/components/back-button/browser.js +2 -2
- package/dist/components/back-button/index.cjs +1 -1
- package/dist/components/back-button/index.js +2 -2
- package/dist/components/bottom-navigation/browser.js +2 -2
- package/dist/components/bottom-navigation/index.cjs +1 -1
- package/dist/components/bottom-navigation/index.js +2 -2
- package/dist/components/button/browser.js +1 -1
- package/dist/components/button/index.cjs +1 -1
- package/dist/components/button/index.js +1 -1
- package/dist/components/chart/browser.js +2 -0
- package/dist/components/chart/index.cjs +1 -1
- package/dist/components/chart/index.js +2 -0
- package/dist/components/checkbox/browser.js +2 -2
- package/dist/components/checkbox/index.cjs +1 -1
- package/dist/components/checkbox/index.js +2 -2
- package/dist/components/chip/browser.js +1 -1
- package/dist/components/chip/index.cjs +1 -1
- package/dist/components/chip/index.js +1 -1
- package/dist/components/chunks/{button-B0Yt0MX1.js → button-BZ25puI2.js} +2 -2
- package/dist/components/chunks/{button-BlbLHMts.js → button-CgYC1lB7.js} +1 -1
- package/dist/components/chunks/caret-down-C5a1fGvt.js +1 -0
- package/dist/components/chunks/{caret-down-Ch6IfR7r.js → caret-down-CDGP3GB2.js} +1 -1
- package/dist/components/chunks/caret-right-BMyWflHN.js +1 -0
- package/dist/components/chunks/{caret-right-CVOgr4nk.js → caret-right-CQ5hBjsy.js} +1 -1
- package/dist/components/chunks/{caret-up-D_6oa7o1.js → caret-up-1paz-pnI.js} +1 -1
- package/dist/components/chunks/caret-up-BJAyfrty.js +1 -0
- package/dist/components/chunks/{chip-B04bJM4r.js → chip-Bb1Epj5C.js} +1 -1
- package/dist/components/chunks/{chip-B9whjEvW.js → chip-p6RXdzHa.js} +3 -3
- package/dist/components/chunks/close-Bg0kqvrY.js +1 -0
- package/dist/components/chunks/{close-Dg6U0IjZ.js → close-y8q0rMSE.js} +1 -1
- package/dist/components/chunks/{icon-gQAtsERy.js → icon-B01tq_aJ.js} +112 -110
- package/dist/components/chunks/icon-BcsWL4kZ.js +27 -0
- package/dist/components/chunks/icon-DNWs0suS.js +1 -0
- package/dist/components/chunks/icon-uMo_iGkX.js +1 -0
- package/dist/components/chunks/{input-8bbXzpa5.js → input-BzrCXBg4.js} +4 -4
- package/dist/components/chunks/{input-BoiREc6Y.js → input-DnVgj6QV.js} +1 -1
- package/dist/components/chunks/{modal-B8gNdwEl.js → modal-DZDugqmr.js} +2 -2
- package/dist/components/chunks/{modal-WYWvk2lZ.js → modal-VN2fwehS.js} +1 -1
- package/dist/components/chunks/search-C5jD2OC-.js +1 -0
- package/dist/components/chunks/{search-ANUKQi0r.js → search-Dd28O4mG.js} +1 -1
- package/dist/components/confirm-action/browser.js +2 -2
- package/dist/components/confirm-action/index.cjs +1 -1
- package/dist/components/confirm-action/index.js +2 -2
- package/dist/components/date-picker/browser.js +4 -4
- package/dist/components/date-picker/index.cjs +1 -1
- package/dist/components/date-picker/index.js +4 -4
- package/dist/components/dropzone/browser.js +3 -3
- package/dist/components/dropzone/index.cjs +1 -1
- package/dist/components/dropzone/index.js +3 -3
- package/dist/components/icon/browser.js +1 -1
- package/dist/components/icon/index.cjs +1 -1
- package/dist/components/icon/index.js +1 -1
- package/dist/components/input/browser.js +1 -1
- package/dist/components/input/index.cjs +1 -1
- package/dist/components/input/index.js +1 -1
- package/dist/components/modal/browser.js +1 -1
- package/dist/components/modal/index.cjs +1 -1
- package/dist/components/modal/index.js +1 -1
- package/dist/components/navigation/browser.js +33 -30
- package/dist/components/navigation/index.cjs +1 -1
- package/dist/components/navigation/index.js +33 -30
- package/dist/components/off-canvas/browser.js +2 -2
- package/dist/components/off-canvas/index.cjs +1 -1
- package/dist/components/off-canvas/index.js +2 -2
- package/dist/components/resource-table/browser.js +7 -7
- package/dist/components/resource-table/index.cjs +1 -1
- package/dist/components/resource-table/index.js +7 -7
- package/dist/components/search/browser.js +7 -7
- package/dist/components/search/index.cjs +1 -1
- package/dist/components/search/index.js +7 -7
- package/dist/components/select/browser.js +4 -4
- package/dist/components/select/index.cjs +1 -1
- package/dist/components/select/index.js +4 -4
- package/dist/components/side-navigation/browser.js +4 -4
- package/dist/components/side-navigation/index.cjs +1 -1
- package/dist/components/side-navigation/index.js +4 -4
- package/dist/components/switch/browser.js +2 -2
- package/dist/components/switch/index.cjs +1 -1
- package/dist/components/switch/index.js +2 -2
- package/dist/components/tags/browser.js +3 -3
- package/dist/components/tags/index.cjs +1 -1
- package/dist/components/tags/index.js +3 -3
- package/dist/components/time-picker/browser.js +2 -2
- package/dist/components/time-picker/index.cjs +1 -1
- package/dist/components/time-picker/index.js +2 -2
- package/dist/icon.css +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.css +228 -5
- package/dist/index.js +41 -34
- package/dist/link.css +1 -1
- package/dist/modal.css +1 -1
- package/dist/navigation-search.json +1124 -0
- package/dist/navigation.css +1 -1
- package/dist/search-demo.json +9 -0
- package/dist/search-long-demo.json +34 -0
- package/dist/theme.css +223 -0
- package/package.json +1 -1
- package/dist/components/chunks/caret-down-BN9cl4o4.js +0 -1
- package/dist/components/chunks/caret-right-CDUwqoen.js +0 -1
- package/dist/components/chunks/caret-up-3XCuTXSE.js +0 -1
- package/dist/components/chunks/close-5tYlQdkk.js +0 -1
- package/dist/components/chunks/icon-C0OLmjDY.js +0 -1
- package/dist/components/chunks/icon-CyzR9aVl.js +0 -1
- package/dist/components/chunks/icon-dG8sLTBn.js +0 -27
- package/dist/components/chunks/search-B3egXuw4.js +0 -1
|
@@ -6,10 +6,10 @@ import '../../spinner.css'
|
|
|
6
6
|
import '../../popover.css'
|
|
7
7
|
import '../../stack.css'
|
|
8
8
|
import '../../tags.css'
|
|
9
|
-
import "../chunks/icon-
|
|
9
|
+
import "../chunks/icon-B01tq_aJ.js";
|
|
10
10
|
import { t as e } from "../chunks/register-element-BFYmIynH.js";
|
|
11
|
-
import "../chunks/button-
|
|
12
|
-
import "../chunks/chip-
|
|
11
|
+
import "../chunks/button-BZ25puI2.js";
|
|
12
|
+
import "../chunks/chip-p6RXdzHa.js";
|
|
13
13
|
import "../chunks/popover-gviDCspV.js";
|
|
14
14
|
//#region src/components/tags/Tags.ts
|
|
15
15
|
var t = class extends HTMLElement {
|
|
@@ -17,10 +17,10 @@ __mintLoadStyle('popover', '../../popover.css')
|
|
|
17
17
|
__mintLoadStyle('stack', '../../stack.css')
|
|
18
18
|
__mintLoadStyle('text', '../../text.css')
|
|
19
19
|
__mintLoadStyle('time-picker', '../../time-picker.css')
|
|
20
|
-
import "../chunks/icon-
|
|
20
|
+
import "../chunks/icon-B01tq_aJ.js";
|
|
21
21
|
import { t as e } from "../chunks/register-element-BFYmIynH.js";
|
|
22
22
|
import "../chunks/text-BHkEs8U5.js";
|
|
23
|
-
import "../chunks/input-
|
|
23
|
+
import "../chunks/input-BzrCXBg4.js";
|
|
24
24
|
import "../chunks/popover-gviDCspV.js";
|
|
25
25
|
//#region src/components/time-picker/TimePicker.ts
|
|
26
26
|
var t = class extends HTMLElement {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`../chunks/icon-dG8sLTBn.js`);const e=require(`../chunks/register-element-tCL_F1YI.js`);require(`../chunks/text-BmHZbBMo.js`),require(`../chunks/input-BoiREc6Y.js`),require(`../chunks/popover-BeaGf_JC.js`);var t=class extends HTMLElement{constructor(...e){super(...e),this._triggerId=`mint-time-picker-trigger-${Math.random().toString(36).slice(2,10)}`,this._popover=null,this._popoverObserver=null,this._inputEl=null,this._hiddenInput=null,this._single={hour:9,minute:0,second:0,meridiem:`AM`},this._rangeStart={hour:9,minute:0,second:0,meridiem:`AM`},this._rangeEnd={hour:5,minute:0,second:0,meridiem:`PM`},this._invalidFromInput=!1}static get observedAttributes(){return[`value`,`label`,`info`,`disabled`,`id`,`name`,`required`,`readonly`,`range`,`hours`,`minutes`,`seconds`,`error`,`error-message`]}connectedCallback(){this.classList.add(`mint-time-picker-host`),this._parseAndApplyValue(this.getAttribute(`value`)||``),this.render()}disconnectedCallback(){this._popoverObserver&&=(this._popoverObserver.disconnect(),null)}attributeChangedCallback(e,t,n){if(t!==n){if(e===`value`){if(this._parseAndApplyValue(n||``),this._syncHiddenInput(),this._syncInputValue(),this._popover){let e=this._popover.querySelector(`[data-mint-time-picker-body="true"]`);e&&this._buildPopoverContent(e)}return}e!==`error`&&e!==`error-message`&&(this._invalidFromInput=!1),this.render()}}get value(){return this.getValue()}set value(e){this.setValue(e||``)}getValue(){return this.getAttribute(`value`)||``}setValue(e){e?this.setAttribute(`value`,e):this.removeAttribute(`value`),this._parseAndApplyValue(e||``),this._syncHiddenInput(),this._syncInputValue()}isRange(){return this.getAttribute(`range`)===`true`}isHoursEnabled(){let e=this.getAttribute(`hours`);return e===null?!0:e!==`false`}isMinutesEnabled(){let e=this.getAttribute(`minutes`);return e===null?!0:e!==`false`}isSecondsEnabled(){let e=this.getAttribute(`seconds`);return e===null?!1:e!==`false`}isDisabled(){return this.getAttribute(`disabled`)===`true`}isReadonly(){return this.getAttribute(`readonly`)===`true`}isRequired(){return this.getAttribute(`required`)===`true`}hasExternalError(){return this.getAttribute(`error`)===`true`}getExternalErrorMessage(){return this.getAttribute(`error-message`)||``}getLabel(){return this.getAttribute(`label`)||``}getInfo(){return this.getAttribute(`info`)||``}getName(){return this.getAttribute(`name`)||``}_getEffectiveError(){return{hasError:this.hasExternalError(),message:this.getExternalErrorMessage()}}_formatParts(e){let t=this.isHoursEnabled(),n=this.isMinutesEnabled(),r=this.isSecondsEnabled(),i=[];return t&&i.push(e.hour.toString()),n&&i.push(e.minute.toString().padStart(2,`0`)),r&&i.push(e.second.toString().padStart(2,`0`)),t?`${i.join(`:`)} ${e.meridiem.toLowerCase()}`:i.join(`:`)}_to24Hour(e){let t=e.hour%12;return e.meridiem===`PM`&&(t+=12),{hour:t,minute:e.minute,second:e.second}}_formatParts24(e){let t=this.isHoursEnabled(),n=this.isMinutesEnabled(),r=this.isSecondsEnabled(),i=this._to24Hour(e),a=[];return t&&a.push(i.hour.toString().padStart(2,`0`)),n&&a.push(i.minute.toString().padStart(2,`0`)),r&&a.push(i.second.toString().padStart(2,`0`)),a.join(`:`)}_getDisplayValue(){return this.isRange()?`${this._formatParts(this._rangeStart)} - ${this._formatParts(this._rangeEnd)}`:this._formatParts(this._single)}_getOutputValue(){return this.isRange()?`${this._formatParts24(this._rangeStart)} - ${this._formatParts24(this._rangeEnd)}`:this._formatParts24(this._single)}_getExpectedFormat(){let e=this.isHoursEnabled(),t=this.isMinutesEnabled(),n=this.isSecondsEnabled(),r=[];e&&r.push(`h`),t&&r.push(`mm`),n&&r.push(`ss`);let i=e?`${r.join(`:`)} am/pm`:r.join(`:`);return this.isRange()?`${i} - ${i}`:i}_syncHiddenInput(){this._hiddenInput&&(this._hiddenInput.value=this.getValue()||this._getOutputValue())}_syncInputValue(){this._inputEl&&(this._inputEl.value=this._getDisplayValue(),typeof this._inputEl.render==`function`&&this._inputEl.render())}_emitChangeFromPicker(){let e=this._getOutputValue();this._invalidFromInput=!1,this.setAttribute(`value`,e),this._syncHiddenInput(),this._syncInputValue(),this.dispatchEvent(new Event(`input`,{bubbles:!0,composed:!0})),this.dispatchEvent(new Event(`change`,{bubbles:!0}))}_parseSingle(e){let t=this.isHoursEnabled(),n=this.isMinutesEnabled(),r=this.isSecondsEnabled(),i=e.trim();if(t){let e=i.match(/^(\d{1,2})(?::(\d{2}))?(?::(\d{2}))?\s*(am|pm)$/i);if(!e)return null;let t=Number(e[1]),a=Number(e[2]??0),o=Number(e[3]??0),s=e[4].toUpperCase();return t<1||t>12||n&&(a<0||a>59)||r&&(o<0||o>59)?null:{hour:t,minute:a,second:o,meridiem:s}}let a=i.match(/^(\d{2})(?::(\d{2}))?$/);if(!a)return null;let o=Number(a[1]),s=Number(a[2]??0);return n&&(o<0||o>59)||r&&(s<0||s>59)?null:{hour:12,minute:o,second:s,meridiem:`AM`}}_parseSingleOutput24(e){let t=this.isHoursEnabled(),n=this.isMinutesEnabled(),r=this.isSecondsEnabled(),i=e.trim();if(t){let e=i.match(/^(\d{2})(?::(\d{2}))?(?::(\d{2}))?$/);if(!e)return null;let t=Number(e[1]),a=Number(e[2]??0),o=Number(e[3]??0);if(t<0||t>23||n&&(a<0||a>59)||r&&(o<0||o>59))return null;let s=t>=12?`PM`:`AM`;return{hour:t%12==0?12:t%12,minute:a,second:o,meridiem:s}}let a=i.match(/^(\d{2})(?::(\d{2}))?$/);if(!a)return null;let o=Number(a[1]),s=Number(a[2]??0);return n&&(o<0||o>59)||r&&(s<0||s>59)?null:{hour:12,minute:o,second:s,meridiem:`AM`}}_parseAndApplyValue(e){if(!e)return!1;if(this.isRange()){let[t,n]=e.split(`-`).map(e=>e.trim()),r=this._parseSingleOutput24(t||``),i=this._parseSingleOutput24(n||``);return!r||!i?!1:(this._rangeStart=r,this._rangeEnd=i,!0)}let t=this._parseSingleOutput24(e);return t?(this._single=t,!0):!1}_parseAndApplyDisplayValue(e){if(!e)return!1;if(this.isRange()){let[t,n]=e.split(`-`).map(e=>e.trim()),r=this._parseSingle(t||``),i=this._parseSingle(n||``);return!r||!i?!1:(this._rangeStart=r,this._rangeEnd=i,!0)}let t=this._parseSingle(e);return t?(this._single=t,!0):!1}_handleTypedValue(e){let t=e.trim();if(!t){this._invalidFromInput=!1,this.removeAttribute(`value`),this._syncHiddenInput(),this._syncInputValue();return}if(!this._parseAndApplyDisplayValue(t)){this._invalidFromInput=!0,this.removeAttribute(`value`),this._inputEl&&(this._inputEl.value=``),this._syncHiddenInput(),this.render(),this.dispatchEvent(new Event(`input`,{bubbles:!0,composed:!0})),this.dispatchEvent(new Event(`change`,{bubbles:!0}));return}this._invalidFromInput=!1;let n=this._getOutputValue();this.setAttribute(`value`,n),this._syncHiddenInput(),this._syncInputValue(),this.dispatchEvent(new Event(`input`,{bubbles:!0,composed:!0})),this.dispatchEvent(new Event(`change`,{bubbles:!0}))}_buildColumn(e,t,n,r=!0,i=`standard`,a=`Time`){let o=document.createElement(`div`);return o.className=`mint-time-picker-column mint-time-picker-column-${i}${r?` mint-time-picker-column-divider`:``}`,o.setAttribute(`role`,`group`),o.setAttribute(`aria-label`,a),e.forEach(e=>{let r=document.createElement(`button`);r.type=`button`;let i=e===t;r.className=`mint-time-picker-option${i?` is-selected`:``}`,r.dataset.selected=i?`true`:`false`,r.setAttribute(`aria-pressed`,String(i)),r.setAttribute(`aria-label`,`${a}: ${e}`),r.textContent=e,r.addEventListener(`click`,()=>n(e)),o.appendChild(r)}),o}_centerSelectedInColumn(e,t=0){let n=e.querySelector(`button[data-selected="true"]`);if(!n)return;let r=n.offsetTop-(e.clientHeight/2-n.clientHeight/2)-t;e.scrollTop=Math.max(0,r)}_centerAllColumnsInPopoverBody(){if(!this._popover)return;let e=this._popover.querySelector(`[data-mint-time-picker-body="true"]`);if(!e)return;let t=Array.from(e.querySelectorAll(`.mint-time-picker-column`)),n=this.isRange()?20:0;t.forEach(e=>this._centerSelectedInColumn(e,n))}_setupPopoverOpenObserver(){this._popover&&(this._popoverObserver&&=(this._popoverObserver.disconnect(),null),this._popoverObserver=new MutationObserver(()=>{this._popover?.getAttribute(`open`)===`true`&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{this._centerAllColumnsInPopoverBody()})})}),this._popoverObserver.observe(this._popover,{attributes:!0,attributeFilter:[`open`]}))}_buildPickerSet(e,t,n){let r=this.isHoursEnabled(),i=this.isMinutesEnabled(),a=this.isSecondsEnabled(),o=document.createElement(`div`),s=(r?1:0)+(i?1:0)+(a?1:0)+(r?1:0);o.className=`mint-time-picker-wheel`,o.style.gridTemplateColumns=`repeat(${Math.max(s,1)}, minmax(0, 1fr))`;let c=Array.from({length:12},(e,t)=>(t+1).toString().padStart(2,`0`)),l=Array.from({length:60},(e,t)=>t.toString().padStart(2,`0`)),u=Array.from({length:60},(e,t)=>t.toString().padStart(2,`0`)),d=[`AM`,`PM`],f=[];r&&f.push(this._buildColumn(c,t.hour.toString().padStart(2,`0`),e=>{n({...t,hour:Number(e)})},!0,`tall`,`Hour`)),i&&f.push(this._buildColumn(l,t.minute.toString().padStart(2,`0`),e=>{n({...t,minute:Number(e)})},!0,`tall`,`Minute`)),a&&f.push(this._buildColumn(u,t.second.toString().padStart(2,`0`),e=>{n({...t,second:Number(e)})},!0,`tall`,`Second`)),r&&f.push(this._buildColumn(d,t.meridiem,e=>{n({...t,meridiem:e})},!0,`compact`,`Meridiem`)),f.forEach((e,t)=>{t===f.length-1&&e.classList.remove(`mint-time-picker-column-divider`),o.appendChild(e)}),e.appendChild(o)}_buildPopoverContent(e){if(e.innerHTML=``,!this.isRange()){this._buildPickerSet(e,this._single,t=>{this._single=t,this._emitChangeFromPicker(),this._buildPopoverContent(e)});return}let t=document.createElement(`div`);t.className=`mint-time-picker-range`;let n=document.createElement(`div`),r=document.createElement(`mint-text`);r.setAttribute(`variant`,`muted`),r.className=`mint-time-picker-range-label`,r.textContent=`Start`,n.appendChild(r),this._buildPickerSet(n,this._rangeStart,t=>{this._rangeStart=t,this._emitChangeFromPicker(),this._buildPopoverContent(e)});let i=document.createElement(`div`),a=document.createElement(`mint-text`);a.setAttribute(`variant`,`muted`),a.className=`mint-time-picker-range-label`,a.textContent=`End`,i.appendChild(a),this._buildPickerSet(i,this._rangeEnd,t=>{this._rangeEnd=t,this._emitChangeFromPicker(),this._buildPopoverContent(e)}),t.appendChild(n),t.appendChild(i),e.appendChild(t),requestAnimationFrame(()=>{this._centerAllColumnsInPopoverBody()})}render(){let e=this.isDisabled(),t=this.isReadonly(),n=this._getEffectiveError();this.innerHTML=``;let r=document.createElement(`div`);r.className=`mint-time-picker-control`,this._inputEl=document.createElement(`mint-input`),this._inputEl.id=this._triggerId,this._inputEl.classList.add(`mint-time-picker-trigger`),this._inputEl.setAttribute(`type`,`text`),this._inputEl.setAttribute(`icon`,`clock`),this._inputEl.setAttribute(`placeholder`,this._getExpectedFormat()),this._inputEl.setAttribute(`label`,this.getLabel()),this._inputEl.setAttribute(`info`,this.getInfo()),this._inputEl.setAttribute(`value`,this._getDisplayValue()),this._inputEl.setAttribute(`error`,n.hasError?`true`:`false`),this._inputEl.setAttribute(`error-message`,n.message||``),e&&this._inputEl.setAttribute(`disabled`,`true`),t&&this._inputEl.setAttribute(`readonly`,`true`),this._inputEl.addEventListener(`change`,n=>{if(e||t)return;let r=n.target;this._handleTypedValue((r?.value||``).toString())}),this._inputEl.addEventListener(`blur`,n=>{if(e||t)return;let r=n.target;this._handleTypedValue((r?.value||``).toString())},!0),r.appendChild(this._inputEl),this._hiddenInput=document.createElement(`input`),this._hiddenInput.type=`hidden`,this._hiddenInput.name=this.getName(),this._hiddenInput.required=this.isRequired(),r.appendChild(this._hiddenInput),this._syncHiddenInput(),this._popover=document.createElement(`mint-popover`),this._popover.setAttribute(`trigger-id`,this._triggerId),this._popover.setAttribute(`direction`,`down`),this._popover.setAttribute(`padding`,`0`),this._popover.setAttribute(`distance`,`6px`),(e||t)&&this._popover.setAttribute(`open`,`false`);let i=document.createElement(`div`);i.setAttribute(`data-mint-time-picker-body`,`true`),i.className=`mint-time-picker-popover`,this._buildPopoverContent(i),this._popover.appendChild(i),r.appendChild(this._popover),this._setupPopoverOpenObserver(),this.appendChild(r)}};customElements.get(`mint-time-picker`)||e.t(`mint-time-picker`,t),module.exports=t;
|
|
1
|
+
require(`../chunks/icon-BcsWL4kZ.js`);const e=require(`../chunks/register-element-tCL_F1YI.js`);require(`../chunks/text-BmHZbBMo.js`),require(`../chunks/input-DnVgj6QV.js`),require(`../chunks/popover-BeaGf_JC.js`);var t=class extends HTMLElement{constructor(...e){super(...e),this._triggerId=`mint-time-picker-trigger-${Math.random().toString(36).slice(2,10)}`,this._popover=null,this._popoverObserver=null,this._inputEl=null,this._hiddenInput=null,this._single={hour:9,minute:0,second:0,meridiem:`AM`},this._rangeStart={hour:9,minute:0,second:0,meridiem:`AM`},this._rangeEnd={hour:5,minute:0,second:0,meridiem:`PM`},this._invalidFromInput=!1}static get observedAttributes(){return[`value`,`label`,`info`,`disabled`,`id`,`name`,`required`,`readonly`,`range`,`hours`,`minutes`,`seconds`,`error`,`error-message`]}connectedCallback(){this.classList.add(`mint-time-picker-host`),this._parseAndApplyValue(this.getAttribute(`value`)||``),this.render()}disconnectedCallback(){this._popoverObserver&&=(this._popoverObserver.disconnect(),null)}attributeChangedCallback(e,t,n){if(t!==n){if(e===`value`){if(this._parseAndApplyValue(n||``),this._syncHiddenInput(),this._syncInputValue(),this._popover){let e=this._popover.querySelector(`[data-mint-time-picker-body="true"]`);e&&this._buildPopoverContent(e)}return}e!==`error`&&e!==`error-message`&&(this._invalidFromInput=!1),this.render()}}get value(){return this.getValue()}set value(e){this.setValue(e||``)}getValue(){return this.getAttribute(`value`)||``}setValue(e){e?this.setAttribute(`value`,e):this.removeAttribute(`value`),this._parseAndApplyValue(e||``),this._syncHiddenInput(),this._syncInputValue()}isRange(){return this.getAttribute(`range`)===`true`}isHoursEnabled(){let e=this.getAttribute(`hours`);return e===null?!0:e!==`false`}isMinutesEnabled(){let e=this.getAttribute(`minutes`);return e===null?!0:e!==`false`}isSecondsEnabled(){let e=this.getAttribute(`seconds`);return e===null?!1:e!==`false`}isDisabled(){return this.getAttribute(`disabled`)===`true`}isReadonly(){return this.getAttribute(`readonly`)===`true`}isRequired(){return this.getAttribute(`required`)===`true`}hasExternalError(){return this.getAttribute(`error`)===`true`}getExternalErrorMessage(){return this.getAttribute(`error-message`)||``}getLabel(){return this.getAttribute(`label`)||``}getInfo(){return this.getAttribute(`info`)||``}getName(){return this.getAttribute(`name`)||``}_getEffectiveError(){return{hasError:this.hasExternalError(),message:this.getExternalErrorMessage()}}_formatParts(e){let t=this.isHoursEnabled(),n=this.isMinutesEnabled(),r=this.isSecondsEnabled(),i=[];return t&&i.push(e.hour.toString()),n&&i.push(e.minute.toString().padStart(2,`0`)),r&&i.push(e.second.toString().padStart(2,`0`)),t?`${i.join(`:`)} ${e.meridiem.toLowerCase()}`:i.join(`:`)}_to24Hour(e){let t=e.hour%12;return e.meridiem===`PM`&&(t+=12),{hour:t,minute:e.minute,second:e.second}}_formatParts24(e){let t=this.isHoursEnabled(),n=this.isMinutesEnabled(),r=this.isSecondsEnabled(),i=this._to24Hour(e),a=[];return t&&a.push(i.hour.toString().padStart(2,`0`)),n&&a.push(i.minute.toString().padStart(2,`0`)),r&&a.push(i.second.toString().padStart(2,`0`)),a.join(`:`)}_getDisplayValue(){return this.isRange()?`${this._formatParts(this._rangeStart)} - ${this._formatParts(this._rangeEnd)}`:this._formatParts(this._single)}_getOutputValue(){return this.isRange()?`${this._formatParts24(this._rangeStart)} - ${this._formatParts24(this._rangeEnd)}`:this._formatParts24(this._single)}_getExpectedFormat(){let e=this.isHoursEnabled(),t=this.isMinutesEnabled(),n=this.isSecondsEnabled(),r=[];e&&r.push(`h`),t&&r.push(`mm`),n&&r.push(`ss`);let i=e?`${r.join(`:`)} am/pm`:r.join(`:`);return this.isRange()?`${i} - ${i}`:i}_syncHiddenInput(){this._hiddenInput&&(this._hiddenInput.value=this.getValue()||this._getOutputValue())}_syncInputValue(){this._inputEl&&(this._inputEl.value=this._getDisplayValue(),typeof this._inputEl.render==`function`&&this._inputEl.render())}_emitChangeFromPicker(){let e=this._getOutputValue();this._invalidFromInput=!1,this.setAttribute(`value`,e),this._syncHiddenInput(),this._syncInputValue(),this.dispatchEvent(new Event(`input`,{bubbles:!0,composed:!0})),this.dispatchEvent(new Event(`change`,{bubbles:!0}))}_parseSingle(e){let t=this.isHoursEnabled(),n=this.isMinutesEnabled(),r=this.isSecondsEnabled(),i=e.trim();if(t){let e=i.match(/^(\d{1,2})(?::(\d{2}))?(?::(\d{2}))?\s*(am|pm)$/i);if(!e)return null;let t=Number(e[1]),a=Number(e[2]??0),o=Number(e[3]??0),s=e[4].toUpperCase();return t<1||t>12||n&&(a<0||a>59)||r&&(o<0||o>59)?null:{hour:t,minute:a,second:o,meridiem:s}}let a=i.match(/^(\d{2})(?::(\d{2}))?$/);if(!a)return null;let o=Number(a[1]),s=Number(a[2]??0);return n&&(o<0||o>59)||r&&(s<0||s>59)?null:{hour:12,minute:o,second:s,meridiem:`AM`}}_parseSingleOutput24(e){let t=this.isHoursEnabled(),n=this.isMinutesEnabled(),r=this.isSecondsEnabled(),i=e.trim();if(t){let e=i.match(/^(\d{2})(?::(\d{2}))?(?::(\d{2}))?$/);if(!e)return null;let t=Number(e[1]),a=Number(e[2]??0),o=Number(e[3]??0);if(t<0||t>23||n&&(a<0||a>59)||r&&(o<0||o>59))return null;let s=t>=12?`PM`:`AM`;return{hour:t%12==0?12:t%12,minute:a,second:o,meridiem:s}}let a=i.match(/^(\d{2})(?::(\d{2}))?$/);if(!a)return null;let o=Number(a[1]),s=Number(a[2]??0);return n&&(o<0||o>59)||r&&(s<0||s>59)?null:{hour:12,minute:o,second:s,meridiem:`AM`}}_parseAndApplyValue(e){if(!e)return!1;if(this.isRange()){let[t,n]=e.split(`-`).map(e=>e.trim()),r=this._parseSingleOutput24(t||``),i=this._parseSingleOutput24(n||``);return!r||!i?!1:(this._rangeStart=r,this._rangeEnd=i,!0)}let t=this._parseSingleOutput24(e);return t?(this._single=t,!0):!1}_parseAndApplyDisplayValue(e){if(!e)return!1;if(this.isRange()){let[t,n]=e.split(`-`).map(e=>e.trim()),r=this._parseSingle(t||``),i=this._parseSingle(n||``);return!r||!i?!1:(this._rangeStart=r,this._rangeEnd=i,!0)}let t=this._parseSingle(e);return t?(this._single=t,!0):!1}_handleTypedValue(e){let t=e.trim();if(!t){this._invalidFromInput=!1,this.removeAttribute(`value`),this._syncHiddenInput(),this._syncInputValue();return}if(!this._parseAndApplyDisplayValue(t)){this._invalidFromInput=!0,this.removeAttribute(`value`),this._inputEl&&(this._inputEl.value=``),this._syncHiddenInput(),this.render(),this.dispatchEvent(new Event(`input`,{bubbles:!0,composed:!0})),this.dispatchEvent(new Event(`change`,{bubbles:!0}));return}this._invalidFromInput=!1;let n=this._getOutputValue();this.setAttribute(`value`,n),this._syncHiddenInput(),this._syncInputValue(),this.dispatchEvent(new Event(`input`,{bubbles:!0,composed:!0})),this.dispatchEvent(new Event(`change`,{bubbles:!0}))}_buildColumn(e,t,n,r=!0,i=`standard`,a=`Time`){let o=document.createElement(`div`);return o.className=`mint-time-picker-column mint-time-picker-column-${i}${r?` mint-time-picker-column-divider`:``}`,o.setAttribute(`role`,`group`),o.setAttribute(`aria-label`,a),e.forEach(e=>{let r=document.createElement(`button`);r.type=`button`;let i=e===t;r.className=`mint-time-picker-option${i?` is-selected`:``}`,r.dataset.selected=i?`true`:`false`,r.setAttribute(`aria-pressed`,String(i)),r.setAttribute(`aria-label`,`${a}: ${e}`),r.textContent=e,r.addEventListener(`click`,()=>n(e)),o.appendChild(r)}),o}_centerSelectedInColumn(e,t=0){let n=e.querySelector(`button[data-selected="true"]`);if(!n)return;let r=n.offsetTop-(e.clientHeight/2-n.clientHeight/2)-t;e.scrollTop=Math.max(0,r)}_centerAllColumnsInPopoverBody(){if(!this._popover)return;let e=this._popover.querySelector(`[data-mint-time-picker-body="true"]`);if(!e)return;let t=Array.from(e.querySelectorAll(`.mint-time-picker-column`)),n=this.isRange()?20:0;t.forEach(e=>this._centerSelectedInColumn(e,n))}_setupPopoverOpenObserver(){this._popover&&(this._popoverObserver&&=(this._popoverObserver.disconnect(),null),this._popoverObserver=new MutationObserver(()=>{this._popover?.getAttribute(`open`)===`true`&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{this._centerAllColumnsInPopoverBody()})})}),this._popoverObserver.observe(this._popover,{attributes:!0,attributeFilter:[`open`]}))}_buildPickerSet(e,t,n){let r=this.isHoursEnabled(),i=this.isMinutesEnabled(),a=this.isSecondsEnabled(),o=document.createElement(`div`),s=(r?1:0)+(i?1:0)+(a?1:0)+(r?1:0);o.className=`mint-time-picker-wheel`,o.style.gridTemplateColumns=`repeat(${Math.max(s,1)}, minmax(0, 1fr))`;let c=Array.from({length:12},(e,t)=>(t+1).toString().padStart(2,`0`)),l=Array.from({length:60},(e,t)=>t.toString().padStart(2,`0`)),u=Array.from({length:60},(e,t)=>t.toString().padStart(2,`0`)),d=[`AM`,`PM`],f=[];r&&f.push(this._buildColumn(c,t.hour.toString().padStart(2,`0`),e=>{n({...t,hour:Number(e)})},!0,`tall`,`Hour`)),i&&f.push(this._buildColumn(l,t.minute.toString().padStart(2,`0`),e=>{n({...t,minute:Number(e)})},!0,`tall`,`Minute`)),a&&f.push(this._buildColumn(u,t.second.toString().padStart(2,`0`),e=>{n({...t,second:Number(e)})},!0,`tall`,`Second`)),r&&f.push(this._buildColumn(d,t.meridiem,e=>{n({...t,meridiem:e})},!0,`compact`,`Meridiem`)),f.forEach((e,t)=>{t===f.length-1&&e.classList.remove(`mint-time-picker-column-divider`),o.appendChild(e)}),e.appendChild(o)}_buildPopoverContent(e){if(e.innerHTML=``,!this.isRange()){this._buildPickerSet(e,this._single,t=>{this._single=t,this._emitChangeFromPicker(),this._buildPopoverContent(e)});return}let t=document.createElement(`div`);t.className=`mint-time-picker-range`;let n=document.createElement(`div`),r=document.createElement(`mint-text`);r.setAttribute(`variant`,`muted`),r.className=`mint-time-picker-range-label`,r.textContent=`Start`,n.appendChild(r),this._buildPickerSet(n,this._rangeStart,t=>{this._rangeStart=t,this._emitChangeFromPicker(),this._buildPopoverContent(e)});let i=document.createElement(`div`),a=document.createElement(`mint-text`);a.setAttribute(`variant`,`muted`),a.className=`mint-time-picker-range-label`,a.textContent=`End`,i.appendChild(a),this._buildPickerSet(i,this._rangeEnd,t=>{this._rangeEnd=t,this._emitChangeFromPicker(),this._buildPopoverContent(e)}),t.appendChild(n),t.appendChild(i),e.appendChild(t),requestAnimationFrame(()=>{this._centerAllColumnsInPopoverBody()})}render(){let e=this.isDisabled(),t=this.isReadonly(),n=this._getEffectiveError();this.innerHTML=``;let r=document.createElement(`div`);r.className=`mint-time-picker-control`,this._inputEl=document.createElement(`mint-input`),this._inputEl.id=this._triggerId,this._inputEl.classList.add(`mint-time-picker-trigger`),this._inputEl.setAttribute(`type`,`text`),this._inputEl.setAttribute(`icon`,`clock`),this._inputEl.setAttribute(`placeholder`,this._getExpectedFormat()),this._inputEl.setAttribute(`label`,this.getLabel()),this._inputEl.setAttribute(`info`,this.getInfo()),this._inputEl.setAttribute(`value`,this._getDisplayValue()),this._inputEl.setAttribute(`error`,n.hasError?`true`:`false`),this._inputEl.setAttribute(`error-message`,n.message||``),e&&this._inputEl.setAttribute(`disabled`,`true`),t&&this._inputEl.setAttribute(`readonly`,`true`),this._inputEl.addEventListener(`change`,n=>{if(e||t)return;let r=n.target;this._handleTypedValue((r?.value||``).toString())}),this._inputEl.addEventListener(`blur`,n=>{if(e||t)return;let r=n.target;this._handleTypedValue((r?.value||``).toString())},!0),r.appendChild(this._inputEl),this._hiddenInput=document.createElement(`input`),this._hiddenInput.type=`hidden`,this._hiddenInput.name=this.getName(),this._hiddenInput.required=this.isRequired(),r.appendChild(this._hiddenInput),this._syncHiddenInput(),this._popover=document.createElement(`mint-popover`),this._popover.setAttribute(`trigger-id`,this._triggerId),this._popover.setAttribute(`direction`,`down`),this._popover.setAttribute(`padding`,`0`),this._popover.setAttribute(`distance`,`6px`),(e||t)&&this._popover.setAttribute(`open`,`false`);let i=document.createElement(`div`);i.setAttribute(`data-mint-time-picker-body`,`true`),i.className=`mint-time-picker-popover`,this._buildPopoverContent(i),this._popover.appendChild(i),r.appendChild(this._popover),this._setupPopoverOpenObserver(),this.appendChild(r)}};customElements.get(`mint-time-picker`)||e.t(`mint-time-picker`,t),module.exports=t;
|
|
@@ -5,10 +5,10 @@ import '../../popover.css'
|
|
|
5
5
|
import '../../stack.css'
|
|
6
6
|
import '../../text.css'
|
|
7
7
|
import '../../time-picker.css'
|
|
8
|
-
import "../chunks/icon-
|
|
8
|
+
import "../chunks/icon-B01tq_aJ.js";
|
|
9
9
|
import { t as e } from "../chunks/register-element-BFYmIynH.js";
|
|
10
10
|
import "../chunks/text-BHkEs8U5.js";
|
|
11
|
-
import "../chunks/input-
|
|
11
|
+
import "../chunks/input-BzrCXBg4.js";
|
|
12
12
|
import "../chunks/popover-gviDCspV.js";
|
|
13
13
|
//#region src/components/time-picker/TimePicker.ts
|
|
14
14
|
var t = class extends HTMLElement {
|
package/dist/icon.css
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/* mint-ui component style: icon */
|
|
2
2
|
/*! tailwindcss v4.2.2 | MIT License | https://tailwindcss.com */
|
|
3
|
-
@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-border-style:solid;--tw-leading:initial;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial}}}@layer utilities{.fixed{position:fixed}.static{position:static}.end{inset-inline-end:var(--spacing,.25rem)}.container{width:100%}@media (width>=40rem){.container{max-width:40rem}}@media (width>=48rem){.container{max-width:48rem}}@media (width>=64rem){.container{max-width:64rem}}@media (width>=80rem){.container{max-width:80rem}}@media (width>=96rem){.container{max-width:96rem}}.m-0{margin:calc(var(--spacing,.25rem) * 0)}.box-border{box-sizing:border-box}.grid{display:grid}.hidden{display:none}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.table{display:table}.h-3{height:calc(var(--spacing,.25rem) * 3)}.h-
|
|
3
|
+
@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-border-style:solid;--tw-leading:initial;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial}}}@layer components{mint-icon{vertical-align:middle;background-color:currentColor;width:1.2em;height:1.2em;display:inline-block;-webkit-mask-position:50%;mask-position:50%;-webkit-mask-size:contain;mask-size:contain;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}}@layer utilities{.fixed{position:fixed}.static{position:static}.end{inset-inline-end:var(--spacing,.25rem)}.container{width:100%}@media (width>=40rem){.container{max-width:40rem}}@media (width>=48rem){.container{max-width:48rem}}@media (width>=64rem){.container{max-width:64rem}}@media (width>=80rem){.container{max-width:80rem}}@media (width>=96rem){.container{max-width:96rem}}.m-0{margin:calc(var(--spacing,.25rem) * 0)}.box-border{box-sizing:border-box}.grid{display:grid}.hidden{display:none}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.table{display:table}.h-3{height:calc(var(--spacing,.25rem) * 3)}.h-5{height:calc(var(--spacing,.25rem) * 5)}.h-\[1\.3em\]{height:1.3em}.h-\[1em\]{height:1em}.w-3{width:calc(var(--spacing,.25rem) * 3)}.w-5{width:calc(var(--spacing,.25rem) * 5)}.w-\[1\.3em\]{width:1.3em}.w-\[1em\]{width:1em}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.items-center{align-items:center}.rounded{border-radius:.25rem}.border-0{border-style:var(--tw-border-style);border-width:0}.p-0{padding:calc(var(--spacing,.25rem) * 0)}.leading-none{--tw-leading:1;line-height:1}.text-gray-100{color:var(--color-gray-100,oklch(96.7% .003 264.542))}.text-gray-900{color:var(--color-gray-900,oklch(21% .034 264.665))}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}
|
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});var e=!1,t=!1,n=null,r=null;function i(){if(e||typeof window>`u`||typeof document>`u`||!window.matchMedia)return;e=!0;let i=document.documentElement;if(t=!i.dataset.mintTheme&&!i.classList.contains(`dark`)&&!i.classList.contains(`light`),!t)return;n=window.matchMedia(`(prefers-color-scheme: dark)`);let a=()=>{if(!t)return;let e=n?.matches??!1;r=e,i.classList.toggle(`dark`,e),requestAnimationFrame(()=>{r=null})};a();let o=()=>a();n.addEventListener?n.addEventListener(`change`,o):n.addListener(o),new MutationObserver(e=>{if(!t)return;let a=e.some(e=>e.attributeName===`class`);if(e.some(e=>e.attributeName===`data-mint-theme`)&&i.dataset.mintTheme){t=!1;return}a&&i.classList.contains(`dark`)!==(n?.matches??!1)?t=!1:a&&r!==null&&(r=null)}).observe(i,{attributes:!0,attributeFilter:[`class`,`data-mint-theme`]})}function a(e,t){if(i(),customElements.get(e))return;let n=t.observedAttributes??[],r=t.prototype;for(let e of n){let t=e.replace(/-([a-z])/g,(e,t)=>t.toUpperCase());t in r||Object.defineProperty(r,t,{configurable:!0,enumerable:!0,get(){let t=this.getAttribute(e);return t===`true`?!0:t===`false`?!1:t},set(t){t==null||t===!1?this.removeAttribute(e):this.setAttribute(e,String(t))}})}customElements.define(e,t)}var o=new Map;function s(e){o.set(e.name,e)}function c(e){return o.get(e)}var l=class extends HTMLElement{static get observedAttributes(){return[`name`]}constructor(){super(),this._darkModeObserver=null}connectedCallback(){this.render(),this._observeDarkMode()}attributeChangedCallback(e,t,n){t!==n&&this.render()}disconnectedCallback(){this._darkModeObserver&&=(this._darkModeObserver.disconnect(),null)}_observeDarkMode(){if(!this._darkModeObserver){if(this._darkModeObserver=new MutationObserver(e=>{for(let t of e)if(t.type===`attributes`&&[`class`,`data-mint-theme`].includes(t.attributeName)){this.render();break}}),!document.documentElement)return;this._darkModeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`,`data-mint-theme`]})}}getName(){return this.getAttribute(`name`)||``}getIconDataUrl(e){let t=e.customSvg||`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${e.viewBox}" fill="none" stroke="currentColor" stroke-width="2"${e.strokeLinecap?` stroke-linecap="${e.strokeLinecap}"`:``}${e.strokeLinejoin?` stroke-linejoin="${e.strokeLinejoin}"`:``}><path d="${e.path}" /></svg>`;return`url("data:image/svg+xml,${encodeURIComponent(t)}")`}render(){let e=this.getName();if(!e){this.innerHTML=``,this.style.maskImage=``,this.style.webkitMaskImage=``;return}let t=c(e);if(!t){console.warn(`Icon "${e}" not found. Make sure you've imported the icon: import '
|
|
1
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});var e=!1,t=!1,n=null,r=null;function i(){if(e||typeof window>`u`||typeof document>`u`||!window.matchMedia)return;e=!0;let i=document.documentElement;if(t=!i.dataset.mintTheme&&!i.classList.contains(`dark`)&&!i.classList.contains(`light`),!t)return;n=window.matchMedia(`(prefers-color-scheme: dark)`);let a=()=>{if(!t)return;let e=n?.matches??!1;r=e,i.classList.toggle(`dark`,e),requestAnimationFrame(()=>{r=null})};a();let o=()=>a();n.addEventListener?n.addEventListener(`change`,o):n.addListener(o),new MutationObserver(e=>{if(!t)return;let a=e.some(e=>e.attributeName===`class`);if(e.some(e=>e.attributeName===`data-mint-theme`)&&i.dataset.mintTheme){t=!1;return}a&&i.classList.contains(`dark`)!==(n?.matches??!1)?t=!1:a&&r!==null&&(r=null)}).observe(i,{attributes:!0,attributeFilter:[`class`,`data-mint-theme`]})}function a(e,t){if(i(),customElements.get(e))return;let n=t.observedAttributes??[],r=t.prototype;for(let e of n){let t=e.replace(/-([a-z])/g,(e,t)=>t.toUpperCase());t in r||Object.defineProperty(r,t,{configurable:!0,enumerable:!0,get(){let t=this.getAttribute(e);return t===`true`?!0:t===`false`?!1:t},set(t){t==null||t===!1?this.removeAttribute(e):this.setAttribute(e,String(t))}})}customElements.define(e,t)}var o=new Map;function s(e){o.set(e.name,e)}function c(e){return o.get(e)}var l=class extends HTMLElement{static get observedAttributes(){return[`name`]}constructor(){super(),this._darkModeObserver=null,this._defaultWidthClass=null,this._defaultHeightClass=null}connectedCallback(){this.render(),this._observeDarkMode()}attributeChangedCallback(e,t,n){t!==n&&this.render()}disconnectedCallback(){this._darkModeObserver&&=(this._darkModeObserver.disconnect(),null)}_observeDarkMode(){if(!this._darkModeObserver){if(this._darkModeObserver=new MutationObserver(e=>{for(let t of e)if(t.type===`attributes`&&[`class`,`data-mint-theme`].includes(t.attributeName)){this.render();break}}),!document.documentElement)return;this._darkModeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`,`data-mint-theme`]})}}getName(){return this.getAttribute(`name`)||``}getIconDataUrl(e){let t=e.customSvg||`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${e.viewBox}" fill="none" stroke="currentColor" stroke-width="2"${e.strokeLinecap?` stroke-linecap="${e.strokeLinecap}"`:``}${e.strokeLinejoin?` stroke-linejoin="${e.strokeLinejoin}"`:``}><path d="${e.path}" /></svg>`;return`url("data:image/svg+xml,${encodeURIComponent(t)}")`}render(){let e=this.getName();if(!e){this.innerHTML=``,this.style.maskImage=``,this.style.webkitMaskImage=``;return}let t=c(e);if(!t){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}let n=this.closest(`mint-button`)||this.parentElement?.closest(`mint-button`),r=this.closest(`mint-switch`)||this.parentElement?.closest(`mint-switch`),i,a;r?(i=`w-3`,a=`h-3`):n?(i=`w-5`,a=`h-5`):(i=`w-[1.3em]`,a=`h-[1.3em]`);let o=(e,t)=>Array.from(this.classList).some(n=>n===t?!1:n.split(`:`).pop().replace(/^!/,``).startsWith(`${e}-`)),s=o(`w`,this._defaultWidthClass),l=o(`h`,this._defaultHeightClass);this._defaultWidthClass&&this.classList.remove(this._defaultWidthClass),this._defaultHeightClass&&this.classList.remove(this._defaultHeightClass),this._defaultWidthClass=null,this._defaultHeightClass=null,s||(this._defaultWidthClass=i,this.classList.add(i)),l||(this._defaultHeightClass=a,this.classList.add(a)),this.style.display=`inline-block`;let u=this.getIconDataUrl(t);this.style.maskImage=u,this.style.webkitMaskImage=u,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=``}};typeof customElements<`u`&&!customElements.get(`mint-icon`)&&a(`mint-icon`,l);var u={name:`ai`,viewBox:`0 0 24 24`,path:`M13 3.5H7.5a4 4 0 00-4 4v9a4 4 0 004 4h9a4 4 0 004-4V12M7.6 15.5l2-6.2h1.2l2 6.2m-3.2-2h2.2m3.5-4.2v6.2`,customSvg:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none">
|
|
2
2
|
<path d="M13 3.5H7.5a4 4 0 0 0-4 4v9a4 4 0 0 0 4 4h9a4 4 0 0 0 4-4V12" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/>
|
|
3
3
|
<path d="m7.6 15.5 2-6.2h1.2l2 6.2m-3.2-2h2.2m3.5-4.2v6.2" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"/>
|
|
4
4
|
<path d="M17 1.5c.5 2.3 1.2 3 3.5 3.5-2.3.5-3 1.2-3.5 3.5-.5-2.3-1.2-3-3.5-3.5 2.3-.5 3-1.2 3.5-3.5Z" fill="currentColor"/>
|
|
@@ -101,7 +101,7 @@ Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{val
|
|
|
101
101
|
</header>
|
|
102
102
|
<main part="body" class="mint-page-body"><slot></slot></main>
|
|
103
103
|
</div>
|
|
104
|
-
`,this._headingElement=this._root.querySelector(`.mint-page-heading`),this._backButton=this._root.querySelector(`.mint-page-back`),this._backButton.addEventListener(`click`,e=>this._handleBack(e))}connectedCallback(){this.render()}attributeChangedCallback(e,t,n){t!==n&&this.isConnected&&this.render()}getHeading(){return this.getAttribute(`heading`)||``}getFallbackHref(){return this.getAttribute(`fallback-href`)||`/`}shouldShowBackButton(){return this.getAttribute(`show-back-button`)===`true`}isContainered(){return this.hasAttribute(`containered`)&&this.getAttribute(`containered`)!==`false`}render(){this._headingElement.textContent=this.getHeading(),this._backButton.hidden=!this.shouldShowBackButton()}_handleBack(e){e.preventDefault();let t=document.referrer,n=!!(t&&(()=>{try{return new URL(t).origin===window.location.origin}catch{return!1}})()),r={url:n?t:this.getFallbackHref(),isFromReferrer:n,referrer:t||null,fallbackHref:this.getFallbackHref()},i=new CustomEvent(`back`,{detail:r,bubbles:!0,cancelable:!0,composed:!0});this.dispatchEvent(i)&&(n&&window.history.length>1?window.history.back():window.location.href=this.getFallbackHref())}};typeof customElements<`u`&&!customElements.get(`mint-page`)&&a(`mint-page`,Ut);var Wt=class extends HTMLElement{constructor(){super()}};typeof customElements<`u`&&!customElements.get(`mint-grid`)&&a(`mint-grid`,Wt);var Gt=class extends HTMLElement{static get observedAttributes(){return[`id`,`heading`,`open`]}constructor(){super(),this._overlay=null,this._modal=null,this._header=null,this._headingSlot=null,this._bodySlot=null,this._actionsSlot=null,this._closeButton=null,this._triggerElement=null,this._triggerPoint=null,this._renderedOpen=!1,this._lastPointerPoint=null,this._pointerDownHandler=null,this._darkModeObserver=null,this._exitTimer=null,this._backdropTimer=null}connectedCallback(){this.isOpen()||this.classList.add(`mint-hidden`),this.render(),this._observeDarkMode(),this._pointerDownHandler=e=>{this._lastPointerPoint={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()}},document.addEventListener(`pointerdown`,this._pointerDownHandler,!0)}disconnectedCallback(){this._pointerDownHandler&&=(document.removeEventListener(`pointerdown`,this._pointerDownHandler,!0),null),this._exitTimer&&=(clearTimeout(this._exitTimer),null),this._backdropTimer&&=(clearTimeout(this._backdropTimer),null),this._darkModeObserver&&=(this._darkModeObserver.disconnect(),null)}attributeChangedCallback(e,t,n){t!==n&&(e===`open`&&n!==null&&!this._triggerElement&&(this._triggerElement=this._findTriggerElement(),this._triggerPoint=this._findTriggerPoint(this._triggerElement)),this.render())}getId(){return this.getAttribute(`id`)||``}getHeading(){return this.getAttribute(`heading`)||``}isOpen(){return this.hasAttribute(`open`)}open(e){this._triggerElement=this._findTriggerElement(e),this._triggerPoint=this._findTriggerPoint(this._triggerElement),this.setAttribute(`open`,``)}close(){this.removeAttribute(`open`)}render(){let e=this.getId(),t=this.getHeading(),n=this.isOpen();if(e&&(this.id=e),this._overlay||(this._overlay=document.createElement(`div`),this._overlay.className=`mint-modal-overlay`,this._overlay.addEventListener(`click`,()=>this.close()),this.appendChild(this._overlay)),this._modal||(this._modal=document.createElement(`div`),this._modal.className=`mint-modal-shell`,this.appendChild(this._modal)),n){let e=this._modal.querySelector(`.modal-content`);e||(e=document.createElement(`div`),e.className=`modal-content`,this._modal.appendChild(e)),this._renderedOpen||(this._renderedOpen=!0,this._animateEnter())}else this._renderedOpen&&(this._renderedOpen=!1,this._animateExit());let r=this._modal.querySelector(`.modal-content`);r||(r=document.createElement(`div`),r.className=`modal-content`,this._modal.appendChild(r)),this._header||(this._header=document.createElement(`div`),this._header.className=`mint-modal-header`,r.appendChild(this._header)),this._headingSlot||(this._headingSlot=document.createElement(`div`),this._headingSlot.className=`mint-modal-heading`,this._headingSlot.setAttribute(`slot`,`heading`),this._header.appendChild(this._headingSlot));let i=this._headingSlot.querySelector(`mint-text`);t?(i||(i=document.createElement(`mint-text`),i.setAttribute(`size`,`sub-heading`),i.setAttribute(`bold`,``),this._headingSlot.appendChild(i)),i.textContent=t):i&&i.remove(),Array.from(this.children).filter(e=>e!==this._overlay&&e!==this._modal&&e!==this._headingSlot&&e.getAttribute(`slot`)===`heading`).forEach(e=>{e.parentElement!==this._headingSlot&&this._headingSlot.appendChild(e)}),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=`mint-modal-body`,this._bodySlot.setAttribute(`slot`,`body`),r.appendChild(this._bodySlot)),Array.from(this.children).filter(e=>e!==this._overlay&&e!==this._modal&&e!==this._bodySlot&&e.getAttribute(`slot`)===`body`).forEach(e=>{e.parentElement!==this._bodySlot&&this._bodySlot.appendChild(e)}),this._actionsSlot||(this._actionsSlot=document.createElement(`div`),this._actionsSlot.className=`mint-modal-actions`,this._actionsSlot.setAttribute(`slot`,`actions`),r.appendChild(this._actionsSlot));let a=this._actionsSlot.querySelector(`mint-stack`);a||(a=document.createElement(`mint-stack`),a.setAttribute(`direction`,`horizontal`),a.className=`mint-actions-stack`,this._actionsSlot.appendChild(a)),Array.from(this.children).filter(e=>e!==this._overlay&&e!==this._modal&&e!==this._actionsSlot&&e.getAttribute(`slot`)===`actions`).forEach(e=>{Array.from(e.children).forEach(e=>{e.parentElement!==a&&a.appendChild(e)}),e.parentElement&&e.remove()}),Array.from(this.children).forEach(e=>{e!==this._overlay&&e!==this._modal&&e.getAttribute(`slot`)!==`heading`&&e.getAttribute(`slot`)!==`body`&&e.getAttribute(`slot`)!==`actions`&&e!==this._headingSlot&&e!==this._bodySlot&&e!==this._actionsSlot&&e.parentElement!==this._bodySlot&&this._bodySlot.appendChild(e)}),this._updateBackgroundColor()}_updateBackgroundColor(){if(!this._modal)return;document.documentElement?.classList.contains(`dark`)||document.documentElement?.dataset.mintTheme;let e=this._modal.querySelector(`.modal-content`);e&&(e.style.background=`var(--mint-color-surface-raised)`)}_observeDarkMode(){if(!this._darkModeObserver){if(this._darkModeObserver=new MutationObserver(()=>{this._updateBackgroundColor()}),!document.documentElement)return;this._darkModeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`,`data-mint-theme`]})}}_animateEnter(){let e=this._modal?.querySelector(`.modal-content`);e&&(this._exitTimer&&=(clearTimeout(this._exitTimer),null),this._backdropTimer&&=(clearTimeout(this._backdropTimer),null),this.classList.remove(`mint-modal-closing`),this.classList.remove(`mint-modal-open`),this.classList.add(`mint-modal-open`),this.classList.remove(`mint-hidden`),e.style.transform=`none`,e.style.opacity=`0`,e.style.transition=`none`,requestAnimationFrame(()=>{if(!this.isOpen())return;let t=window.getComputedStyle(e).borderRadius;this._setTransformOrigin(e),e.style.borderRadius=`50%`,e.style.transform=`scale(0.1, 0.2)`,e.style.opacity=`0.9`,e.getBoundingClientRect(),e.style.transition=`opacity 320ms ease-out, transform 360ms cubic-bezier(0.2, 0.8, 0.2, 1), border-radius 360ms cubic-bezier(0.2, 0.8, 0.2, 1)`,requestAnimationFrame(()=>{this.isOpen()&&(e.style.transform=`scale(1)`,e.style.opacity=`1`,e.style.borderRadius=t)})}))}_findTriggerElement(e){if(typeof e==`string`){let t=document.getElementById(e);return t&&!this.contains(t)?t:null}if(e instanceof HTMLElement)return e.isConnected&&!this.contains(e)?e:null;let t=this.getAttribute(`trigger-id`);if(t){let e=document.getElementById(t);if(e&&!this.contains(e))return e}let n=document.activeElement;return n instanceof HTMLElement&&n.isConnected&&n!==document.body&&!this.contains(n)?n:null}_findTriggerPoint(e){if(!e)return null;let t=this._lastPointerPoint;if(!t||Date.now()-t.time>1e3)return null;let n=t.target instanceof Node?t.target:null;return n===e||n&&e.contains(n)?{x:t.x,y:t.y}:null}_setTransformOrigin(e){let t=this._findTriggerElement(this._triggerElement);this._triggerElement=t;let n=this._findTriggerPoint(t);if(n){let t=e.getBoundingClientRect();e.style.transformOrigin=`${n.x-t.left}px ${n.y-t.top}px`,this._triggerPoint=n;return}this._triggerPoint={x:window.innerWidth/2,y:0};let r=e.getBoundingClientRect();e.style.transformOrigin=`${this._triggerPoint.x-r.left}px ${this._triggerPoint.y-r.top}px`}_animateExit(){this.classList.remove(`mint-modal-open`),this._backdropTimer&&=(clearTimeout(this._backdropTimer),null);let e=this._modal?.querySelector(`.modal-content`);if(!e){this.classList.add(`mint-hidden`),this.classList.remove(`mint-modal-closing`);return}this._exitTimer&&clearTimeout(this._exitTimer),this.classList.add(`mint-modal-closing`),e.style.transition=`opacity 220ms ease-in, transform 260ms cubic-bezier(0.4, 0, 1, 1), border-radius 260ms cubic-bezier(0.4, 0, 1, 1)`,e.style.borderRadius=`50%`,e.style.transform=`scale(0.1, 0.2)`,e.style.opacity=`0.9`,this._exitTimer=setTimeout(()=>{this._exitTimer=null,!this.isOpen()&&(this.classList.add(`mint-hidden`),this.classList.remove(`mint-modal-closing`),e.style.transform=``,e.style.opacity=``,e.style.borderRadius=``,e.style.transition=``)},280)}};typeof customElements<`u`&&!customElements.get(`mint-modal`)&&a(`mint-modal`,Gt);var Kt=new Set([`up`,`down`,`left`,`right`]),qt=class extends HTMLElement{static get observedAttributes(){return[`direction`,`open`,`trigger-id`,`trigger-toggle`,`trigger-align`,`padding`,`hover`,`distance`]}constructor(){super(),this._trigger=null,this._triggerLookupTimer=null,this._clickHandler=null,this._hoverEnterHandler=null,this._hoverLeaveHandler=null,this._outsideHandler=null,this._escapeHandler=null,this._positionHandler=null,this._scrollHandler=null,this._resizeObserver=null,this._hoverCloseTimer=null,this._closeAnimationTimer=null,this._blobAnimation=null}connectedCallback(){this.render(),this._setupTrigger()}disconnectedCallback(){this._removeTrigger(),this._removeOpenListeners(),clearTimeout(this._hoverCloseTimer),clearTimeout(this._closeAnimationTimer),this._blobAnimation?.cancel()}attributeChangedCallback(e,t,n){t===n||!this.isConnected||((e===`trigger-id`||e===`trigger-toggle`||e===`hover`)&&this._setupTrigger(),this.render())}getDirection(){let e=this.getAttribute(`direction`)||`down`;return Kt.has(e)?e:`down`}getTriggerId(){return this.getAttribute(`trigger-id`)||``}isOpen(){return this.hasAttribute(`open`)&&this.getAttribute(`open`)!==`false`}isHoverEnabled(){return this.hasAttribute(`hover`)&&this.getAttribute(`hover`)!==`false`}isTriggerToggleEnabled(){return this.getAttribute(`trigger-toggle`)!==`false`}open(){this.setAttribute(`open`,`true`)}close(){this.removeAttribute(`open`)}_removeTrigger(){clearTimeout(this._triggerLookupTimer),this._triggerLookupTimer=null,this._trigger&&(this._clickHandler&&this._trigger.removeEventListener(`click`,this._clickHandler),this._hoverEnterHandler&&this._trigger.removeEventListener(`mouseenter`,this._hoverEnterHandler),this._hoverLeaveHandler&&this._trigger.removeEventListener(`mouseleave`,this._hoverLeaveHandler),this._hoverEnterHandler&&this.removeEventListener(`mouseenter`,this._hoverEnterHandler),this._hoverLeaveHandler&&this.removeEventListener(`mouseleave`,this._hoverLeaveHandler),this._trigger.removeAttribute(`aria-haspopup`),this._trigger.removeAttribute(`aria-expanded`),this._trigger=null,this._clickHandler=this._hoverEnterHandler=this._hoverLeaveHandler=null)}_setupTrigger(){this._removeTrigger();let e=this.getTriggerId();if(e){if(this._trigger=document.getElementById(e),!this._trigger){this._triggerLookupTimer=setTimeout(()=>{this.isConnected&&this.getTriggerId()===e&&!this._trigger&&this._setupTrigger()},40);return}this._trigger.setAttribute(`aria-haspopup`,`true`),this._trigger.setAttribute(`aria-expanded`,String(this.isOpen())),this.isTriggerToggleEnabled()&&(this._clickHandler=e=>{this._trigger?.tagName===`A`&&e.preventDefault(),this.isOpen()?this.close():this.open()},this._trigger.addEventListener(`click`,this._clickHandler)),this.isHoverEnabled()&&(this._hoverEnterHandler=()=>{clearTimeout(this._hoverCloseTimer),this.open()},this._hoverLeaveHandler=()=>this._scheduleHoverClose(),this._trigger.addEventListener(`mouseenter`,this._hoverEnterHandler),this._trigger.addEventListener(`mouseleave`,this._hoverLeaveHandler),this.addEventListener(`mouseenter`,this._hoverEnterHandler),this.addEventListener(`mouseleave`,this._hoverLeaveHandler))}}_scheduleHoverClose(){clearTimeout(this._hoverCloseTimer),this._hoverCloseTimer=setTimeout(()=>{!this._trigger?.matches(`:hover`)&&!this.matches(`:hover`)&&this.close()},140)}_removeOpenListeners(){this._outsideHandler&&document.removeEventListener(`click`,this._outsideHandler),this._escapeHandler&&document.removeEventListener(`keydown`,this._escapeHandler),this._positionHandler&&window.removeEventListener(`resize`,this._positionHandler),this._scrollHandler&&window.removeEventListener(`scroll`,this._scrollHandler,!0),this._resizeObserver?.disconnect(),this._resizeObserver=null,this._outsideHandler=this._escapeHandler=this._positionHandler=this._scrollHandler=null}_setOpenListeners(){if(!this._outsideHandler){if(this._outsideHandler=e=>{let t=e.composedPath();t.includes(this)||t.includes(this._trigger)||(e.target instanceof Element?e.target:null)?.closest(`[data-keep-popover-open]`)||this.close()},this._escapeHandler=e=>{e.key===`Escape`&&(this.close(),this._trigger?.focus?.())},this._positionHandler=()=>{this.isOpen()&&this._position()},this._scrollHandler=()=>{this.isOpen()&&this._position({allowViewportFlip:!1,clampToViewport:!1})},typeof ResizeObserver<`u`&&this._trigger){this._resizeObserver=new ResizeObserver(()=>{this.isOpen()&&this._position()}),this._resizeObserver.observe(this);let e=this._trigger,t=0;for(;e&&e!==document.documentElement&&t<8;)this._resizeObserver.observe(e),e=e.parentElement,t+=1}setTimeout(()=>{this.isOpen()&&this._outsideHandler&&document.addEventListener(`click`,this._outsideHandler)},0),document.addEventListener(`keydown`,this._escapeHandler),window.addEventListener(`resize`,this._positionHandler),window.addEventListener(`scroll`,this._scrollHandler,!0)}}_position({allowViewportFlip:e=!0,clampToViewport:t=!0}={}){let n=document.getElementById(this.getTriggerId());n&&n!==this._trigger&&this._setupTrigger();let r=n||this._trigger;if(!r)return;let i=r.getBoundingClientRect(),a={width:this.offsetWidth,height:this.offsetHeight},o=this._distancePx(),s=e?this.getDirection():this.dataset.direction||this.getDirection(),c=0,l=0,u=this.getAttribute(`trigger-align`)||`center`;if(s===`down`||s===`up`){let t=i.bottom+o,n=i.top-a.height-o;e&&s===`down`&&t+a.height>innerHeight-12&&n>=12?s=`up`:e&&s===`up`&&n<12&&t+a.height<=innerHeight-12&&(s=`down`),c=s===`down`?t:n,l=u===`start`?i.left:u===`end`?i.right-a.width:i.left+(i.width-a.width)/2}else{let t=i.right+o,n=i.left-a.width-o;e&&s===`right`&&t+a.width>innerWidth-12&&n>=12?s=`left`:e&&s===`left`&&n<12&&t+a.width<=innerWidth-12&&(s=`right`),l=s===`right`?t:n,c=u===`start`?i.top:u===`end`?i.bottom-a.height:i.top+(i.height-a.height)/2}let d=t?Math.max(12,Math.min(c,innerHeight-a.height-12)):c,f=t?Math.max(12,Math.min(l,innerWidth-a.width-12)):l;this.style.top=`${d}px`,this.style.left=`${f}px`,this.dataset.direction=s,this.style.setProperty(`--mint-popover-origin-x`,`${i.left+i.width/2-f}px`),this.style.setProperty(`--mint-popover-origin-y`,`${i.top+i.height/2-d}px`)}_distancePx(){let e=(this.getAttribute(`distance`)||`8px`).trim(),t=Number.parseFloat(e);return Number.isFinite(t)?e.endsWith(`rem`)?t*(parseFloat(getComputedStyle(document.documentElement).fontSize)||16):Math.max(0,t):8}_animateBlob(e){if(this._blobAnimation?.cancel(),this._blobAnimation=null,typeof this.animate!=`function`)return 0;let t=getComputedStyle(this).borderRadius||`.75rem`;if(matchMedia(`(prefers-reduced-motion: reduce)`).matches)return 0;let n=e?380:280,r=[{transform:`scale(.035, .035)`,borderRadius:`50%`,opacity:.94,offset:0},{transform:`scale(.3, .42)`,borderRadius:`50%`,opacity:1,offset:.58},{transform:`scale(1.035, .96)`,borderRadius:`1rem`,offset:.9},{transform:`scale(1)`,borderRadius:t,offset:1}],i=e?r:[...r].reverse().map(({offset:e,...t})=>({...t,offset:1-e}));return this._blobAnimation=this.animate(i,{duration:n,easing:e?`cubic-bezier(.2, .8, .2, 1)`:`cubic-bezier(.4, 0, .8, .2)`,fill:`both`}),n}render(){let e=this.isOpen(),t=this.hasAttribute(`data-open`)||this.dataset.state===`closing`,n=this.hasAttribute(`data-open`);if(this.toggleAttribute(`data-open`,e),this.setAttribute(`aria-hidden`,String(!e)),this._trigger&&this._trigger.setAttribute(`aria-expanded`,String(e)),e){clearTimeout(this._closeAnimationTimer);let e=!n||this.dataset.state===`closing`;e&&(this._blobAnimation?.cancel(),this._blobAnimation=null),this.dataset.state=`open`,this._setOpenListeners(),this._position(),e&&this._animateBlob(!0),requestAnimationFrame(()=>requestAnimationFrame(()=>{this.isOpen()&&this._position()}))}else if(this._removeOpenListeners(),t){this.dataset.state=`closing`;let e=this._animateBlob(!1);e?this._closeAnimationTimer=setTimeout(()=>{this.dataset.state===`closing`&&(this._blobAnimation?.cancel(),this._blobAnimation=null,this.dataset.state=`closed`)},e):this.dataset.state=`closed`}else this.dataset.state=`closed`}};typeof customElements<`u`&&!customElements.get(`mint-popover`)&&a(`mint-popover`,qt),s({name:`check`,viewBox:`0 0 24 24`,path:`M5 13l4 4L19 7`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`3.2`});var Jt=class extends HTMLElement{static get observedAttributes(){return[`checked`,`disabled`,`label`,`info`,`id`,`name`,`value`]}constructor(){super(),this._checkbox=null,this._checked=!1,this._clickHandler=null}connectedCallback(){let e=this.getAttribute(`checked`);this._checked=e!==null&&e!==`false`,this.render()}disconnectedCallback(){this.removeEventListeners()}attributeChangedCallback(e,t,n){e===`checked`&&(this._checked=n!==null&&n!==`false`,this._checkbox&&(this._checkbox.checked=this._checked)),t!==n&&(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(){return`mint-checkbox-control`}render(){let e=this.getLabel(),t=this.getInfo(),n=this.isDisabled(),r=this.querySelector(`.mint-checkbox-wrapper`);r||(r=document.createElement(`div`),r.className=`mint-checkbox-wrapper`,this.insertBefore(r,this.firstChild)),this._checkbox?this._checkbox.parentElement!==r&&r.appendChild(this._checkbox):(this._checkbox=document.createElement(`input`),this._checkbox.type=`checkbox`,r.appendChild(this._checkbox),this.setupEventListeners()),this._checkbox.className=`mint-input-overlay`,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=n,this._changeHandler||this.setupEventListeners();let i=this.getId();i?this._checkbox.id=i:this._checkbox.removeAttribute(`id`);let a=this.getName();a?this._checkbox.name=a:this._checkbox.removeAttribute(`name`);let o=this.getValue();o?this._checkbox.value=o:this._checkbox.removeAttribute(`value`),e?this._checkbox.setAttribute(`aria-label`,e):this._checkbox.removeAttribute(`aria-label`),r.className=`mint-checkbox-wrapper ${this.getCheckboxClasses()}`,r.style.pointerEvents=`none`,this._checkbox.style.pointerEvents=`auto`;let s=r.querySelector(`mint-icon`);s||(s=document.createElement(`mint-icon`),s.setAttribute(`name`,`check`),s.className=`mint-checkbox-check`,s.style.transition=`opacity 200ms ease-out, transform 200ms ease-out`,s.style.zIndex=`1`,r.appendChild(s)),this.updateVisualState();let c=this.querySelector(`.mint-checkbox-label-container`);if(e||t){c||(c=document.createElement(`div`),c.className=`mint-checkbox-label-container`,this.appendChild(c));let r=c.querySelector(`.mint-checkbox-label`);e?(r||(r=document.createElement(`span`),r.className=`mint-checkbox-label`,c.insertBefore(r,c.firstChild)),r.textContent=e,n?r.style.opacity=`0.5`:r.style.opacity=``):r&&r.remove();let i=c.querySelector(`.mint-checkbox-info`);if(t?(i||(i=document.createElement(`span`),i.className=`mint-checkbox-info`,c.appendChild(i)),i.textContent=t,n?i.style.opacity=`0.5`:i.style.opacity=``):i&&i.remove(),n)c.style.cursor=`default`,c._clickHandler&&(c.removeEventListener(`click`,c._clickHandler),c._clickHandler=null);else{c.style.cursor=`pointer`;let e=c._clickHandler;e&&c.removeEventListener(`click`,e),c._clickHandler=e=>{this._checkbox&&(e.target===this._checkbox||this._checkbox.contains(e.target)||e.composedPath().includes(this._checkbox))||this.toggle()},c.addEventListener(`click`,c._clickHandler)}}else c&&c.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();let 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();let t=this.querySelector(`.mint-checkbox-wrapper`);t&&!this.isDisabled()&&(t.classList.add(`mint-checkbox-active`),this._checked?(t.style.backgroundColor=`var(--mint-color-primary)`,t.style.boxShadow=`inset 0 2px 4px rgba(0, 0, 0, 0.3)`):(t.style.backgroundColor=`var(--mint-color-surface-hover)`,t.style.boxShadow=`inset 0 2px 4px rgba(0, 0, 0, 0.1)`))},this._mouseupHandler=e=>{e.stopPropagation();let t=this.querySelector(`.mint-checkbox-wrapper`);t&&(t.classList.remove(`mint-checkbox-active`),t.style.backgroundColor=``,t.style.boxShadow=``)},this._mouseleaveHandler=e=>{let 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._touchstartHandler=e=>{e.stopPropagation();let t=this.querySelector(`.mint-checkbox-wrapper`);t&&!this.isDisabled()&&(t.classList.add(`mint-checkbox-active`),this._checked?(t.style.backgroundColor=`var(--mint-color-primary)`,t.style.boxShadow=`inset 0 2px 4px rgba(0, 0, 0, 0.3)`):(t.style.backgroundColor=`var(--mint-color-surface-hover)`,t.style.boxShadow=`inset 0 2px 4px rgba(0, 0, 0, 0.1)`))},this._touchendHandler=e=>{e.stopPropagation();let 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),null),this._mousedownHandler&&=(this._checkbox.removeEventListener(`mousedown`,this._mousedownHandler),null),this._mouseupHandler&&=(this._checkbox.removeEventListener(`mouseup`,this._mouseupHandler),null),this._mouseleaveHandler&&=(this._checkbox.removeEventListener(`mouseleave`,this._mouseleaveHandler),null),this._touchstartHandler&&=(this._checkbox.removeEventListener(`touchstart`,this._touchstartHandler),null),this._touchendHandler&&=(this._checkbox.removeEventListener(`touchend`,this._touchendHandler),null))}updateVisualState(){let e=this.querySelector(`.mint-checkbox-wrapper`),t=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();let e=new CustomEvent(`change`,{detail:{checked:this._checked},bubbles:!0,cancelable:!0});this.dispatchEvent(e)}}};typeof customElements<`u`&&!customElements.get(`mint-checkbox`)&&a(`mint-checkbox`,Jt);var Yt=class extends HTMLElement{static get observedAttributes(){return[`checked`,`disabled`,`label`,`info`,`id`,`name`,`value`,`required`]}constructor(){super(),this._radio=null,this._checked=!1,this._groupMode=!1,this._groupChangeHandler=null,this._groupObserver=null}connectedCallback(){if(this._activateGroupModeIfNeeded(),this._groupObserver=new MutationObserver(()=>this._activateGroupModeIfNeeded()),this._groupObserver.observe(this,{childList:!0,subtree:!0}),this._groupMode)return;let e=this.getAttribute(`checked`);this._checked=e!==null&&e!==`false`,this.render()}disconnectedCallback(){this.removeEventListeners(),this._groupChangeHandler&&=(this.removeEventListener(`choice-option-change`,this._groupChangeHandler),null),this._groupObserver?.disconnect(),this._groupObserver=null}attributeChangedCallback(e,t,n){if(this._groupMode){t!==n&&this.renderGroup();return}e===`checked`&&(this._checked=n!==null&&n!==`false`,this._radio&&(this._radio.checked=this._checked)),t!==n&&(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._groupMode?this.querySelector(`mint-choice-option input[type="radio"]:checked`)?.value||this.getAttribute(`value`)||``:this.getAttribute(`value`)||``}set value(e){this.setValue(e)}get value(){return this.getValue()}setValue(e){if(!this._groupMode){e?this.setAttribute(`value`,e):this.removeAttribute(`value`);return}let t=e==null?``:String(e);this.querySelectorAll(`mint-choice-option`).forEach(e=>{let n=e.getAttribute(`value`)===t,r=e.querySelector(`input[type="radio"]`);r&&(r.checked=n),e.toggleAttribute(`checked`,n)}),t?this.setAttribute(`value`,t):this.removeAttribute(`value`)}renderGroup(){this.classList.add(`mint-choice-group`),this.setAttribute(`role`,`radiogroup`);let e=this.getAttribute(`label`)||``,t=this.querySelector(`:scope > .mint-choice-group-label`);e&&!t&&(t=document.createElement(`div`),t.className=`mint-choice-group-label`,this.insertBefore(t,this.firstChild)),t&&(e?t.textContent=e:t.remove());let n=this.querySelector(`:scope > .mint-choice-options`);n||(n=document.createElement(`div`),n.className=`mint-choice-options`,t?.parentElement===this?this.insertBefore(n,t.nextSibling):this.insertBefore(n,this.firstChild)),Array.from(this.children).filter(e=>e.tagName===`MINT-CHOICE-OPTION`&&e.parentElement!==n).forEach(e=>n.appendChild(e)),this.querySelectorAll(`mint-choice-option`).forEach(e=>e.render());let r=this.getAttribute(`value`);r&&this.setValue(r)}_activateGroupModeIfNeeded(){this._groupMode||!this.querySelector(`mint-choice-option`)||(this._groupMode=!0,this.removeEventListeners(),this.querySelector(`.mint-choice-wrapper`)?.remove(),this.querySelector(`.mint-choice-label-container`)?.remove(),this._radio=null,this._groupChangeHandler=e=>{let t=e.target.closest?.(`mint-choice-option`);if(!t||!this.contains(t))return;let n=t.getAttribute(`value`)||``;n?this.setAttribute(`value`,n):this.removeAttribute(`value`),this.dispatchEvent(new Event(`input`,{bubbles:!0,composed:!0})),this.dispatchEvent(new Event(`change`,{bubbles:!0,composed:!0}))},this.addEventListener(`choice-option-change`,this._groupChangeHandler),this.renderGroup())}getChoiceClasses(){return`mint-choice-control`}render(){if(this._groupMode){this.renderGroup();return}let e=this.getLabel(),t=this.getInfo(),n=this.isDisabled(),r=this.querySelector(`.mint-choice-wrapper`);r||(r=document.createElement(`div`),r.className=`mint-choice-wrapper`,this.insertBefore(r,this.firstChild)),this._radio?this._radio.parentElement!==r&&r.appendChild(this._radio):(this._radio=document.createElement(`input`),this._radio.type=`radio`,r.appendChild(this._radio),this.setupEventListeners()),this._radio.className=`mint-input-overlay`,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=n,this._changeHandler||this.setupEventListeners();let i=this.getId();i?this._radio.id=i:this._radio.removeAttribute(`id`);let a=this.getName();a?this._radio.name=a:this._radio.removeAttribute(`name`);let o=this.getValue();o?this._radio.value=o:this._radio.removeAttribute(`value`),e?this._radio.setAttribute(`aria-label`,e):this._radio.removeAttribute(`aria-label`),r.className=`mint-choice-wrapper ${this.getChoiceClasses()}`,r.style.pointerEvents=`none`,this._radio.style.pointerEvents=`auto`;let s=r.querySelector(`.mint-choice-indicator`);s||(s=document.createElement(`div`),s.className=`mint-choice-indicator`,s.style.transition=`opacity 200ms ease-out, transform 200ms ease-out`,s.style.zIndex=`1`,r.appendChild(s)),s.style.opacity=this._checked?`1`:`0`,s.style.transform=this._checked?`scale(1)`:`scale(0.8)`,this.updateVisualState();let c=this.querySelector(`.mint-choice-label-container`);if(e||t){c||(c=document.createElement(`div`),c.className=`mint-choice-label-container`,this.appendChild(c));let r=c.querySelector(`.mint-choice-label`);e?(r||(r=document.createElement(`span`),r.className=`mint-choice-label`,c.insertBefore(r,c.firstChild)),r.textContent=e,n?r.style.opacity=`0.5`:r.style.opacity=``):r&&r.remove();let i=c.querySelector(`.mint-choice-info`);if(t?(i||(i=document.createElement(`span`),i.className=`mint-choice-info`,c.appendChild(i)),i.textContent=t,n?i.style.opacity=`0.5`:i.style.opacity=``):i&&i.remove(),n)c.style.cursor=`default`,c._clickHandler&&(c.removeEventListener(`click`,c._clickHandler),c._clickHandler=null);else{c.style.cursor=`pointer`;let e=c._clickHandler;e&&c.removeEventListener(`click`,e),c._clickHandler=e=>{this._radio&&(e.target===this._radio||this._radio.contains(e.target)||e.composedPath().includes(this._radio))||this.select()},c.addEventListener(`click`,c._clickHandler)}}else c&&c.remove()}setupEventListeners(){this.removeEventListeners(),this._radio&&(this._changeHandler=e=>{e.stopPropagation();let 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){let e=this._radio.name;e&&document.querySelectorAll(`input[type="radio"][name="${e}"]`).forEach(e=>{if(e!==this._radio){let t=e.closest(`mint-choice`);t&&t.updateVisualState&&(t._checked=e.checked,e.checked?t.hasAttribute(`checked`)||t.setAttribute(`checked`,``):t.hasAttribute(`checked`)&&t.removeAttribute(`checked`),t.updateVisualState())}})}if(t!==this._checked){let e=new CustomEvent(`change`,{detail:{checked:this._checked,value:this.getValue()},bubbles:!0,cancelable:!0});this.dispatchEvent(e)}},this._radio.addEventListener(`change`,this._changeHandler),this._groupChangeHandler=e=>{e.target!==this._radio&&e.target.type===`radio`&&e.target.name===this._radio.name&&e.target.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=>{let t=this._radio.name;t&&document.querySelectorAll(`input[type="radio"][name="${t}"]`).forEach(e=>{if(e!==this._radio){let t=e.closest(`mint-choice`);t&&t.updateVisualState&&(t._checked=e.checked,e.checked?t.hasAttribute(`checked`)||t.setAttribute(`checked`,``):t.hasAttribute(`checked`)&&t.removeAttribute(`checked`),t.updateVisualState())}}),requestAnimationFrame(()=>{this._checked=this._radio.checked,this.updateVisualState()})},this._radio.addEventListener(`click`,this._clickHandler),this._mousedownHandler=e=>{e.stopPropagation();let t=this.querySelector(`.mint-choice-wrapper`);t&&!this.isDisabled()&&(t.classList.add(`mint-choice-active`),this._checked?(t.style.backgroundColor=`var(--mint-color-primary)`,t.style.boxShadow=`inset 0 2px 4px rgba(0, 0, 0, 0.3)`):(t.style.backgroundColor=`var(--mint-color-surface-hover)`,t.style.boxShadow=`inset 0 2px 4px rgba(0, 0, 0, 0.1)`))},this._mouseupHandler=e=>{e.stopPropagation();let t=this.querySelector(`.mint-choice-wrapper`);t&&(t.classList.remove(`mint-choice-active`),t.style.backgroundColor=``,t.style.boxShadow=``)},this._mouseleaveHandler=e=>{let 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();let t=this.querySelector(`.mint-choice-wrapper`);t&&!this.isDisabled()&&(t.classList.add(`mint-choice-active`),this._checked?(t.style.backgroundColor=`var(--mint-color-primary)`,t.style.boxShadow=`inset 0 2px 4px rgba(0, 0, 0, 0.3)`):(t.style.backgroundColor=`var(--mint-color-surface-hover)`,t.style.boxShadow=`inset 0 2px 4px rgba(0, 0, 0, 0.1)`))},this._touchendHandler=e=>{e.stopPropagation();let 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))}removeEventListeners(){this._radio&&(this._changeHandler&&=(this._radio.removeEventListener(`change`,this._changeHandler),null),this._groupChangeHandler&&=(document.removeEventListener(`change`,this._groupChangeHandler),null),this._clickHandler&&=(this._radio.removeEventListener(`click`,this._clickHandler),null),this._mousedownHandler&&=(this._radio.removeEventListener(`mousedown`,this._mousedownHandler),null),this._mouseupHandler&&=(this._radio.removeEventListener(`mouseup`,this._mouseupHandler),null),this._mouseleaveHandler&&=(this._radio.removeEventListener(`mouseleave`,this._mouseleaveHandler),null),this._touchstartHandler&&=(this._radio.removeEventListener(`touchstart`,this._touchstartHandler),null),this._touchendHandler&&=(this._radio.removeEventListener(`touchend`,this._touchendHandler),null))}updateVisualState(){let e=this.querySelector(`.mint-choice-wrapper`),t=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`,``);let e=this._radio.name;e&&document.querySelectorAll(`input[type="radio"][name="${e}"]`).forEach(e=>{if(e!==this._radio){let t=e.closest(`mint-choice`);t&&t.updateVisualState&&(t._checked=e.checked,e.checked?t.hasAttribute(`checked`)||t.setAttribute(`checked`,``):t.hasAttribute(`checked`)&&t.removeAttribute(`checked`),t.updateVisualState())}}),this.updateVisualState();let t=new CustomEvent(`change`,{detail:{checked:this._checked,value:this.getValue()},bubbles:!0,cancelable:!0});this.dispatchEvent(t)}}},Xt=class extends HTMLElement{static get observedAttributes(){return[`value`,`checked`,`disabled`]}constructor(){super(),this._labelText=``,this._radio=null,this._changeHandler=null}connectedCallback(){this.render()}attributeChangedCallback(e,t,n){t!==n&&this.isConnected&&this.render()}render(){let e=this.closest(`mint-choice`),t=this.querySelector(`.mint-choice-option-label`);this._labelText||=t?.textContent?.trim()||this.textContent.trim();let n=this.querySelector(`:scope > .mint-choice-option-control`);n||(n=document.createElement(`label`),n.className=`mint-choice-option-control`,this.replaceChildren(n)),this._radio||(this._radio=document.createElement(`input`),this._radio.type=`radio`,this._radio.className=`mint-choice-option-input`,n.appendChild(this._radio),this._changeHandler=()=>{this._radio?.checked&&e&&(e.setValue(this.getAttribute(`value`)||``),e.dispatchEvent(new CustomEvent(`choice-option-change`,{detail:{value:this.getAttribute(`value`)||``,option:this},bubbles:!1})))},this._radio.addEventListener(`change`,this._changeHandler)),this._radio.name=e?.getAttribute(`name`)||``,this._radio.value=this.getAttribute(`value`)||``,this._radio.disabled=this.hasAttribute(`disabled`)||e?.hasAttribute(`disabled`)||!1,this._radio.required=e?.hasAttribute(`required`)||!1,this._radio.checked=this.hasAttribute(`checked`)||e?.getAttribute(`value`)===this._radio.value;let r=n.querySelector(`.mint-choice-option-label`);r||(r=document.createElement(`span`),r.className=`mint-choice-option-label`,n.appendChild(r)),r.textContent=this._labelText}};typeof customElements<`u`&&!customElements.get(`mint-choice`)&&a(`mint-choice`,Yt),typeof customElements<`u`&&!customElements.get(`mint-choice-option`)&&a(`mint-choice-option`,Xt),s({name:`arrow-left`,viewBox:`0 0 24 24`,path:`M19 12H5m7-7l-7 7 7 7`,strokeLinecap:`round`,strokeLinejoin:`round`});var Zt=class extends HTMLElement{static get observedAttributes(){return[`variant`,`tone`,`disabled`,`loading`,`button-type`,`type`,`full-width`,`icon-position`,`icon`]}constructor(){super(),this._button=null,this._clickHandler=null,this._isHandlingClick=!1}connectedCallback(){this.render(),this._button&&this.setupEventListeners()}disconnectedCallback(){this.removeEventListeners()}attributeChangedCallback(e,t,n){t!==n&&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(`type`)||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(){if(!(this.getIcon()||this._button?.querySelector(`[slot="icon"], .mint-button-icon, mint-icon`)))return!1;let e=this._button?.querySelector(`.mint-button-content`);if(e&&e.textContent.trim())return!1;if(this._button){for(let e=this._button.firstChild;e;e=e.nextSibling)if(e.nodeType===Node.TEXT_NODE&&e.textContent.trim()||e.nodeType===Node.ELEMENT_NODE&&e.tagName!==`MINT-ICON`&&e.tagName!==`MINT-SPINNER`&&!e.querySelector?.(`mint-spinner`)&&!e.hasAttribute?.(`slot`)&&e.className!==`mint-button-icon`&&!(e.className===`mr-2`&&e.querySelector(`mint-spinner`))&&e.textContent.trim())return!1}return!0}getButtonClasses(){return[`mint-button-core`,`mint-button-`+this.getVariant(),`mint-button-tone-`+this.getTone(),this.isIconOnly()?`mint-button-icon-only`:``,this.isFullWidth()?`mint-button-full-width`:``].filter(Boolean).join(` `)}render(){let 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 n=this._button.querySelector(`mint-spinner`);if(this.isLoading())if(n)n.setAttribute(`data-button-variant`,this.getVariant()),n.setAttribute(`data-button-tone`,this.getTone()),n.render();else{let e=document.createElement(`span`);e.className=`mint-spinner-wrap`;let t=document.createElement(`mint-spinner`);t.setAttribute(`size`,`default`),t.setAttribute(`data-button-variant`,this.getVariant()),t.setAttribute(`data-button-tone`,this.getTone()),t.style.width=`0.875rem`,t.style.height=`0.875rem`,e.appendChild(t),this._button.insertBefore(e,this._button.firstChild)}else n&&n.parentElement?.remove();for(;this.firstChild&&this.firstChild!==this._button;)this._button.appendChild(this.firstChild);let r=this.getIcon(),i=this._button.querySelector(`[slot="icon"], .mint-button-icon, mint-icon`);r?(i&&i.tagName!==`MINT-ICON`&&(i.remove(),i=null),!i||i.tagName!==`MINT-ICON`?(i=document.createElement(`mint-icon`),i.setAttribute(`name`,r),i.className=`mint-button-icon`):i.setAttribute(`name`,r)):i&&i.tagName===`MINT-ICON`&&(i.remove(),i=null),i||=this._button.querySelector(`[slot="icon"], .mint-button-icon`);let a=this.getIconPosition(),o=this._button.querySelector(`.mint-button-content`);if(o){let e=i&&i.tagName===`MINT-ICON`;if(i&&!i.parentElement){let t=this._button.querySelector(`mint-spinner`)?.parentElement;e||a===`left`?t?t.insertAdjacentElement(`afterend`,i):this._button.insertBefore(i,o):o.insertAdjacentElement(`afterend`,i)}else if(i&&(e||a===`left`)&&i.nextSibling!==o){i.remove();let e=this._button.querySelector(`mint-spinner`)?.parentElement;e?e.insertAdjacentElement(`afterend`,i):this._button.insertBefore(i,o)}else i&&!e&&a===`right`&&i.previousSibling!==o&&(i.remove(),o.insertAdjacentElement(`afterend`,i))}else{let e=[];for(let t=this._button.firstChild;t;t=t.nextSibling)t.tagName!==`MINT-SPINNER`&&!t.querySelector?.(`mint-spinner`)&&t!==i&&!t.hasAttribute?.(`slot`)&&!(t.className===`mr-2`&&t.querySelector(`mint-spinner`))&&e.push(t);if(e.length>0){o=document.createElement(`span`),o.className=`mint-button-content`,e.forEach(e=>{o.appendChild(e)});let t=this._button.querySelector(`mint-spinner`)?.parentElement;i&&a===`left`?t?(t.insertAdjacentElement(`afterend`,i),i.insertAdjacentElement(`afterend`,o)):(this._button.insertBefore(i,this._button.firstChild),i.insertAdjacentElement(`afterend`,o)):i&&a===`right`?t?(t.insertAdjacentElement(`afterend`,o),o.insertAdjacentElement(`afterend`,i)):(this._button.insertBefore(o,this._button.firstChild),o.insertAdjacentElement(`afterend`,i)):t?t.insertAdjacentElement(`afterend`,o):this._button.insertBefore(o,this._button.firstChild)}else if(i&&i.tagName===`MINT-ICON`&&!i.parentElement){let e=this._button.querySelector(`mint-spinner`)?.parentElement;e?e.insertAdjacentElement(`afterend`,i):this._button.insertBefore(i,this._button.firstChild)}}let s=this.isIconOnly();i&&(i.classList.contains(`mint-button-icon`)||i.classList.add(`mint-button-icon`),i.classList.remove(`mint-icon-leading`,`mint-icon-trailing`),s?i.tagName===`MINT-ICON`?(i.style.width=`1rem`,i.style.height=`1rem`,i.style.maxWidth=`1rem`,i.style.maxHeight=`1rem`,i.style.flexShrink=`0`):(i.style.maxWidth=`1rem`,i.style.maxHeight=`1rem`,i.style.flexShrink=`0`,i.tagName===`svg`&&(i.style.width=`1rem`,i.style.height=`1rem`)):a===`left`?i.classList.add(`mint-icon-leading`):i.classList.add(`mint-icon-trailing`));let c=this.getButtonClasses();this._button.className=c}setupEventListeners(){this._button&&!this._clickHandler&&(this._clickHandler=this.handleClick.bind(this),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),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))}_handleMouseDown=()=>{this._button&&!this.isDisabled()&&!this.isLoading()&&this._button.classList.add(`mint-button-active`)};_handleMouseUp=()=>{this._button&&this._button.classList.remove(`mint-button-active`)};_handleMouseLeave=()=>{this._button&&this._button.classList.remove(`mint-button-active`)};_handleTouchStart=()=>{this._button&&!this.isDisabled()&&!this.isLoading()&&this._button.classList.add(`mint-button-active`)};_handleTouchEnd=()=>{this._button&&this._button.classList.remove(`mint-button-active`)};_handleTouchCancel=()=>{this._button&&this._button.classList.remove(`mint-button-active`)};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})}};typeof customElements<`u`&&!customElements.get(`mint-button`)&&a(`mint-button`,Zt);var Qt=class extends HTMLElement{static get observedAttributes(){return[`href`,`fallback-href`]}constructor(){super(),this._historyDepth=0,this._maxBackAttempts=10,this._backAttempts=0}connectedCallback(){this.render(),this._setupHistoryTracking()}attributeChangedCallback(e,t,n){t!==n&&this.render()}_setupHistoryTracking(){window.addEventListener(`popstate`,()=>{this._backAttempts=0}),this._historyDepth=window.history.length}getFallbackHref(){return this.getAttribute(`fallback-href`)||this.getAttribute(`href`)||`/`}handleClick(e){if(e.preventDefault(),e.stopPropagation(),window.history.length>1&&this._backAttempts<this._maxBackAttempts&&this._backAttempts===0){this._backAttempts++;let e=window.location.href,t=Date.now();window.history.back(),setTimeout(()=>{Date.now()-t,window.location.href===e?this._navigateToFallback():setTimeout(()=>{this._backAttempts=0},500)},200)}else this._navigateToFallback()}_navigateToFallback(){let e=this.getFallbackHref();if(this._backAttempts=0,e.startsWith(`/`)&&!e.startsWith(`//`))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))}};typeof customElements<`u`&&!customElements.get(`mint-back-button`)&&a(`mint-back-button`,Qt);var $t=0,en=class extends HTMLElement{static get observedAttributes(){return[`brand`,`brand-href`,`direction`,`label`,`open`]}constructor(){super(),this._built=!1,this._brand=null,this._brandLink=null,this._items=null,this._toggle=null,this._toggleLabel=null,this._mobileActions=null,this._mobileActionNodes=[],this._instanceId=++$t,this._dropdowns=[],this._content=null,this._actions=null,this._activeDropdown=null,this._layoutObserver=null}connectedCallback(){this._built||this._build(),this._observeDropdowns(),this._syncResponsiveDropdowns(),this._syncMobileActions(),typeof ResizeObserver<`u`&&(this._layoutObserver=new ResizeObserver(()=>{this._syncResponsiveDropdowns(),this._syncMobileActions()}),this._layoutObserver.observe(this)),this._syncAttributes()}disconnectedCallback(){for(let e of this._dropdowns)e.observer?.disconnect();this._layoutObserver?.disconnect(),this._layoutObserver=null}attributeChangedCallback(e,t,n){t===n||!this._built||(e===`open`?this._syncOpenState():this._syncAttributes())}getDirection(){return this.getAttribute(`direction`)===`vertical`?`vertical`:`horizontal`}getBrand(){return this.getAttribute(`brand`)||``}getBrandHref(){return this.getAttribute(`brand-href`)||`/`}getLabel(){return this.getAttribute(`label`)||`Primary navigation`}_build(){let e=Array.from(this.childNodes),t=e.find(e=>e.nodeType===Node.ELEMENT_NODE&&e.getAttribute(`slot`)===`brand`),n=e.filter(e=>e.nodeType===Node.ELEMENT_NODE&&[`actions`,`mobile-actions`].includes(e.getAttribute(`slot`)));this._mobileActionNodes=n.filter(e=>e.getAttribute(`slot`)===`mobile-actions`);let r=e.filter(e=>e!==t&&!n.includes(e));this.replaceChildren();let i=document.createElement(`div`);i.className=`mint-navigation-shell`;let a=document.createElement(`div`);a.className=`mint-navigation-bar`,this._brand=document.createElement(`div`),this._brand.className=`mint-navigation-brand`,t?(t.removeAttribute(`slot`),this._brand.appendChild(t)):this.getBrand()&&(this._brandLink=document.createElement(`mint-link`),this._brandLink.className=`mint-navigation-brand-link`,this._brandLink.textContent=this.getBrand(),this._brandLink.setAttribute(`href`,this.getBrandHref()),this._brand.appendChild(this._brandLink)),this._toggle=document.createElement(`mint-button`),this._toggle.className=`mint-navigation-toggle`,this._toggle.setAttribute(`aria-expanded`,`false`),this._toggle.addEventListener(`click`,()=>this.toggleMenu()),this._toggleLabel=document.createElement(`span`),this._toggleLabel.className=`mint-navigation-visually-hidden`,this._toggleLabel.textContent=`Open navigation menu`,this._toggle.append(this._toggleLabel),this._toggle.setAttribute(`variant`,`ghost`),this._toggle.setAttribute(`tone`,`action`),this._toggle.setAttribute(`button-type`,`button`),this._toggle.setAttribute(`icon`,`menu`),this._mobileActions=document.createElement(`div`),this._mobileActions.className=`mint-navigation-mobile-actions`,a.append(this._brand,this._mobileActions,this._toggle);let o=document.createElement(`div`);this._content=o,o.className=`mint-navigation-content`,this._items=document.createElement(`nav`),this._items.className=`mint-navigation-items`,this._items.setAttribute(`aria-label`,this.getLabel()),this._items.addEventListener(`click`,e=>{e.target.closest(`a, mint-link`)&&this.closeMenu()});let s=0;for(let e of r)if(e.nodeType!==Node.ELEMENT_NODE)this._items.appendChild(e);else if(e.tagName===`DETAILS`){let t=this._createDropdown(e,s++);this._items.append(t.trigger,t.popover),this._registerDropdown(t.trigger,t.popover)}else{let t=this._toMintLink(e);if(this._items.appendChild(t),t.nodeType===Node.ELEMENT_NODE&&t.tagName===`MINT-POPOVER`){let e=t.getAttribute(`trigger-id`),n=Array.from(this._items.querySelectorAll(`mint-button`)).find(t=>t.id===e);this._registerDropdown(n,t)}}let c=document.createElement(`div`);this._actions=c,c.className=`mint-navigation-actions`;for(let e of n)e.removeAttribute(`slot`),c.appendChild(e);let l=document.createElement(`section`);l.className=`mint-navigation-submenu`,l.setAttribute(`aria-label`,`Navigation submenu`);let u=document.createElement(`div`);u.className=`mint-navigation-submenu-header`;let d=document.createElement(`mint-button`);d.className=`mint-navigation-submenu-back`,d.setAttribute(`variant`,`ghost`),d.setAttribute(`tone`,`action`),d.setAttribute(`button-type`,`button`),d.setAttribute(`icon`,`arrow-left`),d.setAttribute(`aria-label`,`Back to main navigation`),d.addEventListener(`click`,()=>this._closeSubmenu());let f=document.createElement(`h3`);f.className=`mint-navigation-submenu-title`,u.append(d,f);let p=document.createElement(`nav`);p.className=`mint-navigation-submenu-items`,p.addEventListener(`click`,e=>{e.target.closest(`a, mint-link`)&&this.closeMenu()}),l.append(u,p),this._submenu=l,this._submenuTitle=f,this._submenuItems=p;for(let e of this._dropdowns)p.append(...e.submenuItems);o.append(this._items,c,l),i.append(a,o),this.appendChild(i),this._built=!0,this._syncMobileActions()}_syncMobileActions(){if(!this._mobileActions||!this._actions)return;let e=this._isMobileLayout()?this._mobileActions:this._actions;for(let t of this._mobileActionNodes)e.appendChild(t)}_toMintLink(e){if(e.nodeType!==Node.ELEMENT_NODE||e.tagName!==`A`)return e;let t=document.createElement(`mint-link`);for(;e.firstChild;)t.appendChild(e.firstChild);for(let n of Array.from(e.attributes))n.name!==`slot`&&t.setAttribute(n.name,n.value);return t}_createDropdown(e,t){let n=e.querySelector(`:scope > summary`),r=document.createElement(`mint-button`),i=`mint-navigation-${this._instanceId}-dropdown-${t}`,a=`${i}-popover`;if(r.id=i,r.className=`mint-navigation-dropdown-trigger`,r.setAttribute(`aria-haspopup`,`dialog`),r.setAttribute(`aria-expanded`,`false`),r.setAttribute(`aria-controls`,a),n){for(;n.firstChild;)r.appendChild(n.firstChild);n.remove()}else r.textContent=e.getAttribute(`label`)||`More`;r.setAttribute(`variant`,`ghost`),r.setAttribute(`tone`,`action`),r.setAttribute(`button-type`,`button`),r.setAttribute(`icon-position`,`right`);let o=document.createElement(`mint-popover`);o.id=a,o.className=`mint-navigation-dropdown`,o.setAttribute(`trigger-id`,i),o.setAttribute(`direction`,`down`),o.setAttribute(`aria-label`,`${r.textContent.trim()} links`);for(let t of Array.from(e.childNodes))o.appendChild(this._toMintLink(t));return{trigger:r,popover:o,observer:null}}_registerDropdown(e,t){if(!e||!t)return;t.id||=`mint-navigation-${this._instanceId}-popover-${this._dropdowns.length}`,e.classList.add(`mint-navigation-dropdown-trigger`),e.setAttribute(`aria-haspopup`,`dialog`),e.setAttribute(`aria-expanded`,String(t.hasAttribute(`open`))),e.setAttribute(`aria-controls`,t.id),t.classList.add(`mint-navigation-dropdown`),t.hasAttribute(`role`)||t.setAttribute(`role`,`group`),t.hasAttribute(`aria-label`)||t.setAttribute(`aria-label`,`${e.textContent.trim()} links`);let n=Array.from(t.querySelectorAll(`mint-link`)).map(e=>e.cloneNode(!0)),r={trigger:e,popover:t,observer:null,triggerId:t.getAttribute(`trigger-id`)||e.id,submenuItems:n};e.addEventListener(`click`,()=>{this._isMobileLayout()&&this._openSubmenu(r)}),this._dropdowns.push(r)}_observeDropdowns(){for(let e of this._dropdowns)e.observer||(e.observer=new MutationObserver(()=>{e.trigger.setAttribute(`aria-expanded`,String(e.popover.hasAttribute(`open`)))}),e.observer.observe(e.popover,{attributes:!0,attributeFilter:[`open`]}))}_isMobileLayout(){return this.getBoundingClientRect().width<=640}_syncResponsiveDropdowns(){let e=this._isMobileLayout();for(let t of this._dropdowns)e?(t.popover.hasAttribute(`open`)&&t.popover.close(),t.popover.getAttribute(`trigger-id`)&&t.popover.setAttribute(`trigger-id`,``)):t.triggerId&&t.popover.getAttribute(`trigger-id`)!==t.triggerId&&t.popover.setAttribute(`trigger-id`,t.triggerId);!e&&this._activeDropdown&&this._closeSubmenu()}_openSubmenu(e){this._isMobileLayout()&&(this._activeDropdown&&this._activeDropdown!==e&&this._activeDropdown.trigger.setAttribute(`aria-expanded`,`false`),this._activeDropdown=e,e.trigger.setAttribute(`aria-expanded`,`true`),this._submenuTitle.textContent=e.trigger.textContent.trim(),this._submenuItems.replaceChildren(...e.submenuItems),this._content.setAttribute(`data-submenu-open`,``))}_closeSubmenu(){this._activeDropdown?.trigger.setAttribute(`aria-expanded`,`false`),this._activeDropdown=null,this._content?.removeAttribute(`data-submenu-open`)}_syncAttributes(){if(this._brandLink){this._brandLink.setAttribute(`href`,this.getBrandHref());let e=this._brandLink.querySelector(`a`);e?e.textContent=this.getBrand():this._brandLink.textContent=this.getBrand()}this._items&&this._items.setAttribute(`aria-label`,this.getLabel()),this._syncOpenState()}_syncOpenState(){if(!this._toggle)return;let e=this.hasAttribute(`open`);this._toggle.setAttribute(`aria-expanded`,String(e));let t=e?`Close navigation menu`:`Open navigation menu`;this._toggle.setAttribute(`aria-label`,t),this._toggleLabel&&(this._toggleLabel.textContent=t),this._toggle.setAttribute(`icon`,e?`close`:`menu`)}openMenu(){this.setAttribute(`open`,``)}closeMenu(){this._closeSubmenu(),this.removeAttribute(`open`)}toggleMenu(){this.hasAttribute(`open`)?this.closeMenu():this.openMenu()}};typeof customElements<`u`&&!customElements.get(`mint-navigation`)&&a(`mint-navigation`,en),s({name:`info`,viewBox:`0 0 24 24`,path:`M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z`,strokeLinecap:`round`,strokeLinejoin:`round`}),s({name:`success`,viewBox:`0 0 24 24`,path:`M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z`,strokeLinecap:`round`,strokeLinejoin:`round`}),s({name:`warning`,viewBox:`0 0 24 24`,path:`M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z`,strokeLinecap:`round`,strokeLinejoin:`round`}),s({name:`error`,viewBox:`0 0 24 24`,path:`M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z`,strokeLinecap:`round`,strokeLinejoin:`round`}),s({name:`close`,viewBox:`0 0 24 24`,path:`M6 18L18 6M6 6l12 12`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`3.2`});var tn=class extends HTMLElement{static get observedAttributes(){return[`heading`,`dismissable`,`tone`]}constructor(){super(),this._headingElement=null,this._iconElement=null,this._dismissButton=null,this._headerWrapper=null,this._bodyWrapper=null,this._dismissHandler=null,this._rendering=!1,this._childObserver=null,this._normalizingChildren=!1}connectedCallback(){this.render()}disconnectedCallback(){this._childObserver?.disconnect(),this._dismissButton?.removeEventListener(`click`,this._dismissHandler),this._dismissHandler=null}get heading(){return this.getAttribute(`heading`)??``}set heading(e){this.setAttribute(`heading`,String(e??``))}get tone(){return this.getTone()}set tone(e){this.setAttribute(`tone`,e)}get dismissable(){return this.isDismissable()}set dismissable(e){this.setAttribute(`dismissable`,String(!!e))}get dismissible(){return this.dismissable}set dismissible(e){this.dismissable=e}cleanupDismissListener(){this._dismissButton&&this._dismissHandler&&this._dismissButton.removeEventListener(`click`,this._dismissHandler),this._dismissHandler=null}attributeChangedCallback(e,t,n){t!==n&&this.render()}getHeading(){return this.getAttribute(`heading`)||``}getTone(){let e=this.getAttribute(`tone`);return e===`info`||e===`success`||e===`warning`||e===`danger`?e:`info`}isDismissable(){return this.getAttribute(`dismissable`)===`true`}getIconName(){switch(this.getTone()){case`info`:return`info`;case`success`:return`success`;case`warning`:return`warning`;case`danger`:return`error`;default:return`info`}}getAriaLive(){return this.getTone()===`danger`?`assertive`:`polite`}render(){if(!(this._rendering||!this.isConnected)){this._rendering=!0;try{this.renderContent()}finally{this._rendering=!1}}}renderContent(){this._childObserver?.disconnect();let e=this.getTone(),t=this.getHeading(),n=this.isDismissable(),r=this.getAriaLive();this.setAttribute(`role`,e===`danger`?`alert`:`status`),this.setAttribute(`aria-live`,r),e===`danger`?this.setAttribute(`aria-atomic`,`true`):this.removeAttribute(`aria-atomic`);let i=[];for(this._bodyWrapper?Array.from(this._bodyWrapper.childNodes).forEach(e=>{i.push(e)}):Array.from(this.childNodes).forEach(e=>{e!==this._headerWrapper&&e!==this._bodyWrapper&&e!==this._iconElement&&e!==this._headingElement&&e!==this._dismissButton&&i.push(e)}),this.cleanupDismissListener();this.firstChild;)this.removeChild(this.firstChild);if(this._headerWrapper=null,this._bodyWrapper=null,this._iconElement=null,this._headingElement=null,this._dismissButton=null,this._headerWrapper=document.createElement(`div`),this._headerWrapper.className=`mint-alert-header`,this._iconElement=document.createElement(`mint-icon`),this._iconElement.setAttribute(`name`,this.getIconName()),this._iconElement.className=`mint-alert-icon`,this._headerWrapper.appendChild(this._iconElement),this._headingElement=document.createElement(`mint-text`),this._headingElement.className=`mint-alert-heading`,this._headingElement.textContent=t||``,this._headerWrapper.appendChild(this._headingElement),n){this._dismissButton=document.createElement(`button`),this._dismissButton.className=`mint-alert-dismiss`,this._dismissButton.setAttribute(`aria-label`,`Dismiss alert`),this._dismissButton.setAttribute(`type`,`button`);let e=document.createElement(`mint-icon`);e.setAttribute(`name`,`close`),e.className=`mint-alert-close-icon`,this._dismissButton.appendChild(e),this._dismissHandler=e=>{e.preventDefault(),e.stopPropagation(),this.dispatchEvent(new CustomEvent(`dismissed`,{bubbles:!0,composed:!0})),this.remove()},this._dismissButton.addEventListener(`click`,this._dismissHandler),this._headerWrapper.appendChild(this._dismissButton)}this._bodyWrapper=document.createElement(`div`),this._bodyWrapper.className=`mint-alert-body`,i.forEach(e=>{this._bodyWrapper.appendChild(e)}),this.appendChild(this._headerWrapper),this.appendChild(this._bodyWrapper),this._childObserver||=new MutationObserver(()=>this.normalizeConsumerChildren()),this._childObserver.observe(this,{childList:!0})}normalizeConsumerChildren(){if(!(this._normalizingChildren||!this._bodyWrapper)){this._normalizingChildren=!0;try{Array.from(this.childNodes).forEach(e=>{e!==this._headerWrapper&&e!==this._bodyWrapper&&this._bodyWrapper.appendChild(e)})}finally{this._normalizingChildren=!1}}}};customElements.get(`mint-alert`)||a(`mint-alert`,tn);var H=class extends HTMLElement{constructor(...e){super(...e),this._lastScrollY=0,this._scrollHandler=null}connectedCallback(){this.classList.add(`mint-bottom-navigation`),this.setAttribute(`role`,`navigation`),this.hasAttribute(`aria-label`)||this.setAttribute(`aria-label`,`Primary`),this._lastScrollY=window.scrollY,this.hasAttribute(`data-preview`)||this._attachScrollListener()}disconnectedCallback(){this._detachScrollListener()}_attachScrollListener(){this._scrollHandler||(this._scrollHandler=()=>{let e=window.scrollY;if(e<=8){this.classList.remove(`is-hidden`),this._lastScrollY=e;return}let t=e-this._lastScrollY;Math.abs(t)<4||(t>0?this.classList.add(`is-hidden`):this.classList.remove(`is-hidden`),this._lastScrollY=e)},window.addEventListener(`scroll`,this._scrollHandler,{passive:!0}))}_detachScrollListener(){this._scrollHandler&&=(window.removeEventListener(`scroll`,this._scrollHandler),null)}};customElements.get(`mint-bottom-navigation`)||a(`mint-bottom-navigation`,H);var nn=class extends HTMLElement{constructor(...e){super(...e),this._root=null}static get observedAttributes(){return[`icon`,`label`,`href`,`active`]}connectedCallback(){this.classList.add(`mint-bottom-nav-item`),this.render()}attributeChangedCallback(e,t,n){t!==n&&this.render()}_isActive(){return this.hasAttribute(`active`)&&this.getAttribute(`active`)!==`false`}_getLabel(){return this.getAttribute(`label`)||``}_getIcon(){return this.getAttribute(`icon`)||``}_getHref(){return this.getAttribute(`href`)}render(){let e=this._getHref(),t=this._getLabel(),n=this._getIcon(),r=this._isActive(),i;e?(i=document.createElement(`a`),i.href=e):(i=document.createElement(`button`),i.type=`button`),i.className=`mint-bottom-nav-link`,i.setAttribute(`aria-current`,r?`page`:`false`);let a=n.split(`-`).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `);i.setAttribute(`aria-label`,t||a||`Navigation item`);let o=document.createElement(`span`);if(o.className=`mint-bottom-nav-icon`,n){let e=document.createElement(`mint-icon`);e.setAttribute(`name`,n),e.className=`mint-bottom-nav-icon-glyph`,o.appendChild(e)}let s=document.createElement(`span`);s.className=`mint-bottom-nav-label`,s.textContent=t,i.appendChild(o),i.appendChild(s),this.replaceChildren(i),this._root=i}};customElements.get(`mint-bottom-nav-item`)||a(`mint-bottom-nav-item`,nn);var rn=H,an=class e extends HTMLElement{static get observedAttributes(){return[`type`,`data`,`width`,`height`,`show-legend`,`show-grid`,`show-tooltip`,`curve-tension`]}static{this.MAX_CACHE_SIZE=100}constructor(){super(),this._chartContainer=null,this._svg=null,this._tooltip=null,this._chartType=`line`,this._chartData=null,this._width=800,this._height=400,this._padding={top:20,right:20,bottom:60,left:60},this._showLegend=!0,this._showGrid=!0,this._showTooltip=!0,this._curveTension=.5,this._dataObserver=null,this._darkModeObserver=null,this._tooltipHideTimeout=null,this._lastTooltipContent=``,this._activeXValue=null,this._pinnedXValue=null,this._tooltipAnimationFrame=null,this._cachedTooltipContent=new Map,this._cachedXPositions=new Map,this._verticalLine=null,this._plotPoints=new Map,this._resizeObserver=null,this._windowResizeHandler=null,this._pieChartTimeouts=new Set,this._pieChartTooltipShown=!1,this._pieChartClickOutsideHandler=null,this._pieChartGroup=null,this._chartClickOutsideHandler=null,this._chartTooltipScrollHandler=null,this._cachedBounds={bounds:null,dataHash:``},this._cachedYRange={range:null,dataHash:``},this._cachedXValues={values:null,dataHash:``},this._renderScheduled=!1,this._animateNextRender=!1,this._observedDataReference=null,this._observedDataFingerprint=``,this._datasetVisibility=new Map,this._widthValue=`100%`,this._heightValue=400,this._defaultColors=[`#2563eb`,`#3b82f6`,`#0d9488`,`#7c3aed`,`#d97706`,`#059669`,`#dc2626`,`#c026d3`],this._legendHeight=0,this._rotatedLabelHeight=0}connectedCallback(){this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`,`block`,`w-full`),this._setupDataObserver(),this._setupDarkModeObserver(),this._setupResizeObserver(),requestAnimationFrame(()=>{requestAnimationFrame(()=>{this.render()})})}_setupDataObserver(){let e=()=>{if(!this.isConnected)return;let e=this.data,t=null;e&&typeof e==`object`&&!Array.isArray(e)&&`datasets`in e&&(t=e);let n=``;if(t)try{n=JSON.stringify(t)}catch{n=``}t&&(t!==this._observedDataReference||n&&n!==this._observedDataFingerprint)&&(this._observedDataReference=t,this._observedDataFingerprint=n,this._chartData=t,this._animateNextRender=!0,this._cachedBounds.dataHash=``,this._cachedYRange.dataHash=``,this._cachedXValues.dataHash=``,this.render())};requestAnimationFrame(()=>{e(),requestAnimationFrame(()=>{e()})});let t=setInterval(()=>{if(!this.isConnected){clearInterval(t);return}e()},250);this._dataCheckInterval=t}_setupDarkModeObserver(){this._darkModeObserver=new MutationObserver(()=>{this.isConnected&&this.render()}),this._darkModeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`]})}disconnectedCallback(){if(this._tooltip&&this._tooltip.parentNode&&(this._tooltip.parentNode.removeChild(this._tooltip),this._tooltip=null),this._tooltipHideTimeout!==null&&(clearTimeout(this._tooltipHideTimeout),this._tooltipHideTimeout=null),this._pieChartTimeouts.forEach(e=>clearTimeout(e)),this._pieChartTimeouts.clear(),this._pieChartClickOutsideHandler&&=(document.removeEventListener(`click`,this._pieChartClickOutsideHandler,!0),null),this._chartClickOutsideHandler&&=(document.removeEventListener(`click`,this._chartClickOutsideHandler,!0),null),this._pieChartTooltipShown=!1,this._pieChartGroup=null,this._pinnedXValue=null,this._tooltipAnimationFrame!==null&&(cancelAnimationFrame(this._tooltipAnimationFrame),this._tooltipAnimationFrame=null),this._dataObserver&&=(this._dataObserver.disconnect(),null),this._darkModeObserver&&=(this._darkModeObserver.disconnect(),null),this._dataCheckInterval&&=(clearInterval(this._dataCheckInterval),null),this._svg&&(this._chartTooltipMouseMove&&=(this._svg.removeEventListener(`mousemove`,this._chartTooltipMouseMove),null),this._chartTooltipMouseLeave&&=(this._svg.removeEventListener(`mouseleave`,this._chartTooltipMouseLeave),null),this._chartTooltipTouchStart&&=(this._svg.removeEventListener(`touchstart`,this._chartTooltipTouchStart),null),this._chartTooltipTouchMove&&=(this._svg.removeEventListener(`touchmove`,this._chartTooltipTouchMove),null),this._chartTooltipTouchEnd&&=(this._svg.removeEventListener(`touchend`,this._chartTooltipTouchEnd),null)),this._chartTooltipScrollHandler){window.removeEventListener(`scroll`,this._chartTooltipScrollHandler,!0),this._chartContainer&&this._chartContainer.removeEventListener(`scroll`,this._chartTooltipScrollHandler,!0);let e=this.parentElement;for(;e;)e.removeEventListener(`scroll`,this._chartTooltipScrollHandler,!0),e=e.parentElement;this._chartTooltipScrollHandler=null}this._resizeObserver&&=(this._resizeObserver.disconnect(),null),this._windowResizeHandler&&=(window.removeEventListener(`resize`,this._windowResizeHandler),null),this._cachedTooltipContent.clear(),this._cachedXPositions.clear(),this._plotPoints.clear(),this._cachedBounds={bounds:null,dataHash:``},this._cachedYRange={range:null,dataHash:``},this._cachedXValues={values:null,dataHash:``}}_handleResize(){if(!this.isConnected)return;let e=this.getBoundingClientRect(),t=e.width||this.parentElement?.clientWidth||800,n=e.height||this.parentElement?.clientHeight||400,r=this._calculateDimension(this._widthValue,t,t),i=this._calculateDimension(this._heightValue,n,400);(r!==this._width||i!==this._height)&&(this._width=r,this._height=i,this.render())}_setupResizeObserver(){this._resizeObserver&&=(this._resizeObserver.disconnect(),null),this._windowResizeHandler&&=(window.removeEventListener(`resize`,this._windowResizeHandler),null);let e=null,t=()=>{e&&clearTimeout(e),e=window.setTimeout(()=>{this._handleResize()},100)};this._windowResizeHandler=t,this._resizeObserver=new ResizeObserver(()=>{t()}),this._resizeObserver.observe(this),window.addEventListener(`resize`,t)}attributeChangedCallback(e,t,n){if(t!==n){if(e===`data`){if(n)try{this._chartData=JSON.parse(n)}catch(e){console.error(`mint-chart: Invalid data JSON`,e),this._chartData=null}else this._chartData=null;this._invalidateDataCaches(),this._animateNextRender=!0}(e===`width`||e===`height`)&&this.isConnected&&(t&&t.endsWith(`%`))!==(n&&n.endsWith(`%`))&&this._setupResizeObserver(),this.isConnected&&requestAnimationFrame(()=>{this.render()})}}get type(){let e=this.getAttribute(`type`)||`line`;return e===`line`||e===`bar`||e===`area`||e===`pie`?e:`line`}set type(e){this.setAttribute(`type`,e)}get data(){return this._chartData}set data(e){if(typeof e==`string`)try{this._chartData=JSON.parse(e)}catch(e){console.error(`mint-chart: Invalid data JSON`,e),this._chartData=null}else this._chartData=e;this._invalidateDataCaches(),this._animateNextRender=!0,this.isConnected&&requestAnimationFrame(()=>{this.render()})}get width(){let e=this.getAttribute(`width`);if(!e)return this._widthValue;if(e.endsWith(`%`))return e;let t=parseInt(e,10);return isNaN(t)?this._widthValue:t}set width(e){this.setAttribute(`width`,e.toString())}get height(){let e=this.getAttribute(`height`);if(!e)return this._heightValue;if(e.endsWith(`%`))return e;let t=parseInt(e,10);return isNaN(t)?this._heightValue:t}set height(e){this.setAttribute(`height`,e.toString())}_calculateDimension(e,t,n){if(typeof e==`number`)return e;if(typeof e==`string`&&e.endsWith(`%`)){let n=parseFloat(e);if(!isNaN(n))return t*n/100}return n}_scheduleRender(){this._animateNextRender=!0,this._syncObservedData(),!this._renderScheduled&&(this._renderScheduled=!0,requestAnimationFrame(()=>{this._renderScheduled=!1,this.render()}))}_invalidateDataCaches(){this._cachedBounds.dataHash=``,this._cachedYRange.dataHash=``,this._cachedXValues.dataHash=``,this._cachedTooltipContent?.clear()}_syncObservedData(){this._observedDataReference=this._chartData;try{this._observedDataFingerprint=this._chartData?JSON.stringify(this._chartData):``}catch{this._observedDataFingerprint=``}}_isDatasetVisible(e,t){if(e.id){let t=this._datasetVisibility.get(e.id);if(t!==void 0)return t}return e.visible!==!1}_initializeDatasetVisibility(){this._chartData&&this._chartData.datasets.forEach((e,t)=>{e.id&&(this._datasetVisibility.has(e.id)||this._datasetVisibility.set(e.id,e.visible!==!1))})}render(){if(!this.isConnected)return;let e=this._animateNextRender&&!window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches&&this._svg?this._svg.cloneNode(!0):null;this._animateNextRender=!1,this._plotPoints.clear(),this._activeXValue=null,this._cachedTooltipContent?.clear(),this._cachedXPositions?.clear(),this._chartType=this.type;let t=this.data;if(t&&typeof t==`object`&&!Array.isArray(t)&&`datasets`in t&&(this._chartData=t),!this._chartData){let e=this.getAttribute(`data`);if(e)try{this._chartData=JSON.parse(e)}catch(e){console.error(`mint-chart: Invalid data JSON`,e),this._chartData=null}}this._widthValue=this.width,this._heightValue=this.height;let n=this.getBoundingClientRect(),r=n.width||this.parentElement?.clientWidth||800,i=n.height||this.parentElement?.clientHeight||400;this._width=this._calculateDimension(this._widthValue,r,r),this._height=this._calculateDimension(this._heightValue,i,400),this._showLegend=this.getAttribute(`show-legend`)!==`false`,this._showGrid=this.getAttribute(`show-grid`)!==`false`,this._showTooltip=this.getAttribute(`show-tooltip`)!==`false`;let a=this.getAttribute(`curve-tension`);if(a!==null){let e=parseFloat(a);this._curveTension=isNaN(e)?.5:Math.max(0,Math.min(1,e))}else this._curveTension=.5;if(!this._chartData||!this._chartData.datasets||this._chartData.datasets.length===0){this.innerHTML=`<div class="p-4 text-gray-500">No chart data provided</div>`;return}this.innerHTML=``,this._chartContainer=document.createElement(`div`),this._chartContainer.className=`relative w-full`,this._chartContainer.style.position=`relative`,typeof this._widthValue==`string`&&this._widthValue.endsWith(`%`)?this._chartContainer.style.width=this._widthValue:this._chartContainer.style.width=`${this._width}px`,typeof this._heightValue==`string`&&this._heightValue.endsWith(`%`)?this._chartContainer.style.height=this._heightValue:this._chartContainer.style.height=`${this._height}px`,this.appendChild(this._chartContainer),this._svg=document.createElementNS(`http://www.w3.org/2000/svg`,`svg`),this._svg.setAttribute(`width`,this._width.toString()),this._svg.setAttribute(`height`,this._height.toString()),this._svg.setAttribute(`viewBox`,`0 0 ${this._width} ${this._height}`),this._svg.setAttribute(`class`,`w-full h-full`),this._svg.setAttribute(`role`,`img`);let o=this._chartData.datasets.map(e=>e.name).filter(Boolean),s=this.getAttribute(`aria-label`)?.trim()||`${this.type} chart${o.length?` showing ${o.join(`, `)}`:``}. ${Math.max(0,...this._chartData.datasets.map(e=>e.data.length))} data points.`,c=`${this.id||`mint-chart-${Math.random().toString(36).slice(2,10)}`}-data`;this._svg.setAttribute(`aria-label`,s),this._svg.setAttribute(`aria-describedby`,c),this._chartContainer&&this._svg&&(e&&(e.style.position=`absolute`,e.style.inset=`0`,e.style.width=`100%`,e.style.height=`100%`,e.style.pointerEvents=`none`,e.style.zIndex=`1`,e.style.opacity=`1`,e.style.transition=`opacity 260ms ease`,this._chartContainer.appendChild(e),this._svg.style.position=`relative`,this._svg.style.zIndex=`0`,this._svg.style.opacity=`0`,this._svg.style.transition=`opacity 260ms ease`),this._chartContainer.appendChild(this._svg));let l=document.createElement(`table`);l.id=c,Object.assign(l.style,{position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,border:`0`});let u=document.createElement(`caption`);u.textContent=`Data for ${s}`,l.appendChild(u);let d=document.createElement(`thead`),f=document.createElement(`tr`),p=document.createElement(`th`);p.scope=`col`,p.textContent=`Category`,f.appendChild(p),this._chartData.datasets.forEach(e=>{let t=document.createElement(`th`);t.scope=`col`,t.textContent=e.name||`Series`,f.appendChild(t)}),d.appendChild(f),l.appendChild(d);let m=document.createElement(`tbody`),h=Math.max(0,...this._chartData.datasets.map(e=>e.data.length));for(let e=0;e<h;e+=1){let t=document.createElement(`tr`),n=document.createElement(`th`);n.scope=`row`,n.textContent=String(this._chartData.datasets.find(t=>t.data[e])?.data[e]?.x??e+1),t.appendChild(n),this._chartData.datasets.forEach(n=>{let r=document.createElement(`td`),i=n.data[e];r.textContent=i?this._formatValue(i.y,n):``,t.appendChild(r)}),m.appendChild(t)}switch(l.appendChild(m),this.appendChild(l),this._showTooltip&&this._createTooltip(),this._initializeDatasetVisibility(),this._calculateRotatedLabelHeight(),this._showLegend?this._legendHeight=this._calculateLegendHeight():this._legendHeight=0,this._showLegend&&this._renderLegend(),this._chartType!==`pie`&&this._pieChartClickOutsideHandler&&(document.removeEventListener(`click`,this._pieChartClickOutsideHandler,!0),this._pieChartClickOutsideHandler=null,this._pieChartTooltipShown=!1,this._pieChartGroup=null),this._pinnedXValue=null,this._chartType){case`line`:this._renderLineChart();break;case`bar`:this._renderBarChart();break;case`area`:this._renderAreaChart();break;case`pie`:this._renderPieChart();break}if(this._showTooltip&&this._chartType!==`pie`&&(this._setupChartTooltip(),this._setupTooltipScrollHandler()),this._createVerticalLine(),e&&this._svg){let t=this._svg;requestAnimationFrame(()=>requestAnimationFrame(()=>{t.isConnected&&(e.style.opacity=`0`,t.style.opacity=`1`,window.setTimeout(()=>e.remove(),280))}))}}_createTooltip(){this._tooltip&&this._tooltip.parentNode&&this._tooltip.parentNode.removeChild(this._tooltip),this._tooltip=document.createElement(`div`),this._tooltip.className=`fixed pointer-events-none z-50 bg-gray-900 dark:bg-mint-elevated text-white text-xs rounded px-2 py-1 shadow-lg opacity-0`,this._tooltip.style.display=`none`,document.body.appendChild(this._tooltip)}_showTooltipAt(e,t,n){if(!this._tooltip)return;this._tooltipHideTimeout!==null&&(clearTimeout(this._tooltipHideTimeout),this._tooltipHideTimeout=null),this._lastTooltipContent!==n&&(this._tooltip.innerHTML=n,this._lastTooltipContent=n),(this._tooltip.style.display===`none`||this._tooltip.style.opacity===`0`)&&(this._tooltip.style.display=`block`,this._tooltip.style.opacity=`1`,this._tooltip.style.padding=`8px 12px`);let r=this._tooltip.getBoundingClientRect(),i=window.innerWidth,a=window.innerHeight,o=e+10,s=t-r.height-8;o+r.width>i&&(o=e-r.width-10),o<0&&(o=10),s<0&&(s=t+20),s+r.height>a&&(s=t-r.height-8,s<0&&(s=10));let c=`${o}px`,l=`${s}px`;this._tooltip.style.left!==c&&(this._tooltip.style.left=c),this._tooltip.style.top!==l&&(this._tooltip.style.top=l)}_hideTooltip(){this._tooltip&&(this._tooltipHideTimeout!==null&&(clearTimeout(this._tooltipHideTimeout),this._tooltipHideTimeout=null),this._tooltip.style.opacity=`0`,this._tooltipHideTimeout=window.setTimeout(()=>{this._tooltip&&(this._tooltip.style.display=`none`),this._tooltipHideTimeout=null},200))}_createVerticalLine(){if(!this._svg)return;this._verticalLine&&this._verticalLine.parentNode&&this._verticalLine.parentNode.removeChild(this._verticalLine),this._verticalLine=document.createElementNS(`http://www.w3.org/2000/svg`,`line`);let e=document.documentElement.classList.contains(`dark`);this._verticalLine.setAttribute(`stroke`,e?`#9ca3af`:`#6b7280`),this._verticalLine.setAttribute(`stroke-width`,`1`),this._verticalLine.setAttribute(`stroke-dasharray`,`4,2`),this._verticalLine.style.opacity=`0`,this._verticalLine.style.pointerEvents=`none`;let t=this._svg.querySelector(`.chart-legend`);t&&t.parentNode?t.parentNode.insertBefore(this._verticalLine,t):this._svg.appendChild(this._verticalLine)}_showVerticalLineAtX(e,t){if(!this._verticalLine)return;let n=this._chartType===`bar`?this._scaleXForBarChart(e,t):this._scaleX(e,t);this._verticalLine.setAttribute(`x1`,n.toString()),this._verticalLine.setAttribute(`y1`,t.y.toString()),this._verticalLine.setAttribute(`x2`,n.toString()),this._verticalLine.setAttribute(`y2`,(t.y+t.height).toString()),this._verticalLine.style.opacity=`1`}_hideVerticalLine(){this._verticalLine&&(this._verticalLine.style.opacity=`0`)}_showPlotPointsForX(e){this._plotPoints.forEach(e=>{e.forEach(e=>{e.style.opacity=`0`})});let t=String(e),n=this._plotPoints.get(t);n&&n.forEach(e=>{e.style.opacity=`1`})}_hidePlotPoints(){this._plotPoints.forEach(e=>{e.forEach(e=>{e.style.opacity=`0`})})}_calculateMaxYAxisLabelWidth(){if(!this._showGrid||!this._chartData)return 0;let e=document.createElement(`canvas`).getContext(`2d`);if(!e)return 60;e.font=`12px system-ui, -apple-system, sans-serif`;let t=this._showLegend?Math.max(this._legendHeight,60):0,n=this._height-t,r=Math.floor(n/35),i=Math.min(5,r),a=0;for(let t=0;t<=i;t++){let n=this._getYRange(),r=n.max-(n.max-n.min)/i*t,o=this._formatYAxisValue(r),s=e.measureText(o);a=Math.max(a,s.width)}return Math.ceil(a)+20}_getChartBounds(){let e=this._calculateMaxYAxisLabelWidth(),t=`${this._width}-${this._height}-${this._showGrid}-${this._showLegend}-${this._legendHeight}-${e}-${this._rotatedLabelHeight}`;if(this._cachedBounds.bounds&&this._cachedBounds.dataHash===t)return this._cachedBounds.bounds;let n=0,r=0;this._showGrid&&(n=e+10);let i=(this._rotatedLabelHeight>0?30:20)+this._rotatedLabelHeight+12,a=i;this._showLegend&&(a=i+20+Math.max(this._legendHeight,60));let o=this._height-0-n-0,s=o-a,c=1;if(s<100&&a>0){let e=o-100;e>0?(c=Math.min(1,e/a),c=Math.max(.5,c)):c=.5}r=a*c;let l=this._width*.3,u=n,d=1;n>l&&(d=l/n,u=l);let f={width:(this._width-u-0)*d,height:this._height-0-r,x:u,y:0};return this._cachedBounds={bounds:f,dataHash:t},f}_getAllDataPoints(){if(!this._chartData)return[];let e=[];return this._chartData.datasets.forEach((t,n)=>{this._isDatasetVisible(t,n)&&e.push(...t.data)}),e}_getXValues(){if(!this._chartData)return[];let e=JSON.stringify(this._chartData.labels)+JSON.stringify(this._chartData.datasets.map(e=>e.data.map(e=>e.x)));if(this._cachedXValues.values&&this._cachedXValues.dataHash===e)return this._cachedXValues.values;if(this._chartData.labels&&this._chartData.labels.length>0)return this._cachedXValues={values:this._chartData.labels,dataHash:e},this._chartData.labels;let t=new Set;this._chartData.datasets.forEach((e,n)=>{this._isDatasetVisible(e,n)&&e.data.forEach(e=>{t.add(e.x)})});let n=Array.from(t).sort((e,t)=>{if(typeof e==`number`&&typeof t==`number`)return e-t;let n=String(e),r=String(t),i=/^([A-Za-z]{3})\s+(\d{4})$/,a=n.match(i),o=r.match(i);if(a&&o){let e=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],t=e.indexOf(a[1]),n=e.indexOf(o[1]),r=parseInt(a[2]),i=parseInt(o[2]);return r===i?t-n:r-i}return n.localeCompare(r)});return this._cachedXValues={values:n,dataHash:e},n}_getYRange(){if(!this._chartData)return{min:0,max:100};let e=JSON.stringify(this._chartData.datasets.map(e=>e.data.map(e=>e.y)));if(this._cachedYRange.range&&this._cachedYRange.dataHash===e)return this._cachedYRange.range;let t=this._getAllDataPoints();if(t.length===0){let t={min:0,max:100};return this._cachedYRange={range:t,dataHash:e},t}let n=t.map(e=>e.y),r=Math.min(...n),i=Math.max(...n),a=(i-r)*.1,o={min:Math.max(0,r-a),max:i+a};return this._cachedYRange={range:o,dataHash:e},o}_hasDecimalValues(){return this._getAllDataPoints().some(e=>e.y%1!=0)}_formatValueByString(e,t){switch(t.toLowerCase()){case`currency`:case`currency-usd`:return new Intl.NumberFormat(`en-US`,{style:`currency`,currency:`USD`}).format(e);case`currency-eur`:return new Intl.NumberFormat(`en-US`,{style:`currency`,currency:`EUR`}).format(e);case`currency-gbp`:return new Intl.NumberFormat(`en-US`,{style:`currency`,currency:`GBP`}).format(e);case`number`:case`number-with-commas`:return new Intl.NumberFormat(`en-US`).format(e);case`percent`:return new Intl.NumberFormat(`en-US`,{style:`percent`,minimumFractionDigits:1}).format(e/100);default:return this._hasDecimalValues()&&e%1!=0?e.toFixed(1):Math.round(e).toString()}}_formatXAxisValue(e){if(this._chartData?.formatXAxis){if(typeof this._chartData.formatXAxis==`function`)return this._chartData.formatXAxis(e);if(typeof this._chartData.formatXAxis==`string`)return String(e)}return String(e)}_escapeHtmlForTooltip(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}_tooltipXHeadingHtml(e){return`<strong>${this._escapeHtmlForTooltip(this._formatXAxisValue(e))}</strong><br/>`}_formatYAxisValue(e){if(this._chartData?.formatYAxis){if(typeof this._chartData.formatYAxis==`function`)return this._chartData.formatYAxis(e);if(typeof this._chartData.formatYAxis==`string`)return this._formatValueByString(e,this._chartData.formatYAxis)}if(this._chartData?.datasets?.[0]?.formatValue){if(typeof this._chartData.datasets[0].formatValue==`function`)return this._chartData.datasets[0].formatValue(e);if(typeof this._chartData.datasets[0].formatValue==`string`)return this._formatValueByString(e,this._chartData.datasets[0].formatValue)}return this._hasDecimalValues()&&e%1!=0?e.toFixed(1):Math.round(e).toString()}_formatValue(e,t){if(t.formatValue){if(typeof t.formatValue==`function`)return t.formatValue(e);if(typeof t.formatValue==`string`)return this._formatValueByString(e,t.formatValue)}return String(e)}_getAllDatasetsAtX(e){if(!this._chartData)return[];let t=[];return this._chartData.datasets.forEach((n,r)=>{if(!this._isDatasetVisible(n,r))return;let i=n.data.find(t=>String(t.x)===String(e));if(i){let e=this._getDatasetColor(n,r),a=this._formatValue(i.y,n);t.push({name:n.name,value:i.y,color:e,formattedValue:a})}}),t}_findNearestXValue(e){if(!this._chartData)return null;let t=this._getChartBounds(),n=this._getXValues();if(n.length===0)return null;let r=this._chartType===`bar`,i=null,a=1/0;return n.forEach(n=>{let o=r?this._scaleXForBarChart(n,t):this._scaleX(n,t),s=Math.abs(e-o);s<a&&(a=s,i=n)}),i}_setupTooltipScrollHandler(){if(this._chartTooltipScrollHandler){window.removeEventListener(`scroll`,this._chartTooltipScrollHandler,!0),this._chartContainer&&this._chartContainer.removeEventListener(`scroll`,this._chartTooltipScrollHandler,!0);let e=this.parentElement;for(;e;)e.removeEventListener(`scroll`,this._chartTooltipScrollHandler,!0),e=e.parentElement}this._chartTooltipScrollHandler=()=>{this._hideTooltip(),this._pinnedXValue=null},window.addEventListener(`scroll`,this._chartTooltipScrollHandler,!0),this._chartContainer&&this._chartContainer.addEventListener(`scroll`,this._chartTooltipScrollHandler,!0);let e=this.parentElement;for(;e;){let t=window.getComputedStyle(e),n=t.overflow,r=t.overflowY;(n===`auto`||n===`scroll`||r===`auto`||r===`scroll`)&&e.addEventListener(`scroll`,this._chartTooltipScrollHandler,!0),e=e.parentElement}}_setupChartTooltip(){if(!this._svg||!this._showTooltip)return;this._chartTooltipMouseMove&&this._svg.removeEventListener(`mousemove`,this._chartTooltipMouseMove),this._chartTooltipMouseLeave&&this._svg.removeEventListener(`mouseleave`,this._chartTooltipMouseLeave),this._chartTooltipClick&&this._svg.removeEventListener(`click`,this._chartTooltipClick),this._chartTooltipTouchStart&&this._svg.removeEventListener(`touchstart`,this._chartTooltipTouchStart),this._chartTooltipTouchMove&&this._svg.removeEventListener(`touchmove`,this._chartTooltipTouchMove),this._chartTooltipTouchEnd&&this._svg.removeEventListener(`touchend`,this._chartTooltipTouchEnd),this._cachedTooltipContent.clear(),this._cachedXPositions.clear();let t=this._getChartBounds(),n=0,r=0,i=i=>{!this._chartContainer||!this._svg||(n=i.clientX,r=i.clientY,this._tooltipAnimationFrame!==null&&cancelAnimationFrame(this._tooltipAnimationFrame),this._tooltipAnimationFrame=requestAnimationFrame(()=>{if(this._tooltipAnimationFrame=null,!this._svg)return;let i=this._svg.getBoundingClientRect(),a=n-i.left,o=r-i.top;if(a<t.x||a>t.x+t.width||o<t.y||o>t.y+t.height){this._hideTooltip(),this._hidePlotPoints(),this._hideVerticalLine(),this._activeXValue=null;return}let s=this._findNearestXValue(a);if(!s){this._hideTooltip(),this._hidePlotPoints(),this._hideVerticalLine(),this._activeXValue=null;return}if(this._pinnedXValue!==null&&this._pinnedXValue===s){let e=this._pinnedXValue,i=this._getAllDatasetsAtX(e);if(i.length>0){this._activeXValue=e,this._showPlotPointsForX(e),this._showVerticalLineAtX(e,t);let a=this._cachedTooltipContent.get(e);a||(a=this._tooltipXHeadingHtml(e),i.forEach(e=>{a+=`<div style="display: flex; align-items: center; gap: 6px; margin-top: 4px;">
|
|
104
|
+
`,this._headingElement=this._root.querySelector(`.mint-page-heading`),this._backButton=this._root.querySelector(`.mint-page-back`),this._backButton.addEventListener(`click`,e=>this._handleBack(e))}connectedCallback(){this.render()}attributeChangedCallback(e,t,n){t!==n&&this.isConnected&&this.render()}getHeading(){return this.getAttribute(`heading`)||``}getFallbackHref(){return this.getAttribute(`fallback-href`)||`/`}shouldShowBackButton(){return this.getAttribute(`show-back-button`)===`true`}isContainered(){return this.hasAttribute(`containered`)&&this.getAttribute(`containered`)!==`false`}render(){this._headingElement.textContent=this.getHeading(),this._backButton.hidden=!this.shouldShowBackButton()}_handleBack(e){e.preventDefault();let t=document.referrer,n=!!(t&&(()=>{try{return new URL(t).origin===window.location.origin}catch{return!1}})()),r={url:n?t:this.getFallbackHref(),isFromReferrer:n,referrer:t||null,fallbackHref:this.getFallbackHref()},i=new CustomEvent(`back`,{detail:r,bubbles:!0,cancelable:!0,composed:!0});this.dispatchEvent(i)&&(n&&window.history.length>1?window.history.back():window.location.href=this.getFallbackHref())}};typeof customElements<`u`&&!customElements.get(`mint-page`)&&a(`mint-page`,Ut);var Wt=class extends HTMLElement{constructor(){super()}};typeof customElements<`u`&&!customElements.get(`mint-grid`)&&a(`mint-grid`,Wt);var Gt=class extends HTMLElement{static get observedAttributes(){return[`id`,`heading`,`open`]}constructor(){super(),this._overlay=null,this._modal=null,this._header=null,this._headingSlot=null,this._bodySlot=null,this._actionsSlot=null,this._closeButton=null,this._triggerElement=null,this._triggerPoint=null,this._renderedOpen=!1,this._lastPointerPoint=null,this._pointerDownHandler=null,this._darkModeObserver=null,this._exitTimer=null,this._backdropTimer=null}connectedCallback(){this.isOpen()||this.classList.add(`mint-hidden`),this.render(),this._observeDarkMode(),this._pointerDownHandler=e=>{this._lastPointerPoint={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()}},document.addEventListener(`pointerdown`,this._pointerDownHandler,!0)}disconnectedCallback(){this._pointerDownHandler&&=(document.removeEventListener(`pointerdown`,this._pointerDownHandler,!0),null),this._exitTimer&&=(clearTimeout(this._exitTimer),null),this._backdropTimer&&=(clearTimeout(this._backdropTimer),null),this._darkModeObserver&&=(this._darkModeObserver.disconnect(),null)}attributeChangedCallback(e,t,n){t!==n&&(e===`open`&&n!==null&&!this._triggerElement&&(this._triggerElement=this._findTriggerElement(),this._triggerPoint=this._findTriggerPoint(this._triggerElement)),this.render())}getId(){return this.getAttribute(`id`)||``}getHeading(){return this.getAttribute(`heading`)||``}isOpen(){return this.hasAttribute(`open`)}open(e){this._triggerElement=this._findTriggerElement(e),this._triggerPoint=this._findTriggerPoint(this._triggerElement),this.setAttribute(`open`,``)}close(){this.removeAttribute(`open`)}render(){let e=this.getId(),t=this.getHeading(),n=this.isOpen();if(e&&(this.id=e),this._overlay||(this._overlay=document.createElement(`div`),this._overlay.className=`mint-modal-overlay`,this._overlay.addEventListener(`click`,()=>this.close()),this.appendChild(this._overlay)),this._modal||(this._modal=document.createElement(`div`),this._modal.className=`mint-modal-shell`,this.appendChild(this._modal)),n){let e=this._modal.querySelector(`.modal-content`);e||(e=document.createElement(`div`),e.className=`modal-content`,this._modal.appendChild(e)),this._renderedOpen||(this._renderedOpen=!0,this._animateEnter())}else this._renderedOpen&&(this._renderedOpen=!1,this._animateExit());let r=this._modal.querySelector(`.modal-content`);r||(r=document.createElement(`div`),r.className=`modal-content`,this._modal.appendChild(r)),this._header||(this._header=document.createElement(`div`),this._header.className=`mint-modal-header`,r.appendChild(this._header)),this._headingSlot||(this._headingSlot=document.createElement(`div`),this._headingSlot.className=`mint-modal-heading`,this._headingSlot.setAttribute(`slot`,`heading`),this._header.appendChild(this._headingSlot));let i=this._headingSlot.querySelector(`mint-text`);t?(i||(i=document.createElement(`mint-text`),i.setAttribute(`size`,`sub-heading`),i.setAttribute(`bold`,``),this._headingSlot.appendChild(i)),i.textContent=t):i&&i.remove(),Array.from(this.children).filter(e=>e!==this._overlay&&e!==this._modal&&e!==this._headingSlot&&e.getAttribute(`slot`)===`heading`).forEach(e=>{e.parentElement!==this._headingSlot&&this._headingSlot.appendChild(e)}),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=`mint-modal-body`,this._bodySlot.setAttribute(`slot`,`body`),r.appendChild(this._bodySlot)),Array.from(this.children).filter(e=>e!==this._overlay&&e!==this._modal&&e!==this._bodySlot&&e.getAttribute(`slot`)===`body`).forEach(e=>{e.parentElement!==this._bodySlot&&this._bodySlot.appendChild(e)}),this._actionsSlot||(this._actionsSlot=document.createElement(`div`),this._actionsSlot.className=`mint-modal-actions`,this._actionsSlot.setAttribute(`slot`,`actions`),r.appendChild(this._actionsSlot));let a=this._actionsSlot.querySelector(`mint-stack`);a||(a=document.createElement(`mint-stack`),a.setAttribute(`direction`,`horizontal`),a.className=`mint-actions-stack`,this._actionsSlot.appendChild(a)),Array.from(this.children).filter(e=>e!==this._overlay&&e!==this._modal&&e!==this._actionsSlot&&e.getAttribute(`slot`)===`actions`).forEach(e=>{Array.from(e.children).forEach(e=>{e.parentElement!==a&&a.appendChild(e)}),e.parentElement&&e.remove()}),Array.from(this.children).forEach(e=>{e!==this._overlay&&e!==this._modal&&e.getAttribute(`slot`)!==`heading`&&e.getAttribute(`slot`)!==`body`&&e.getAttribute(`slot`)!==`actions`&&e!==this._headingSlot&&e!==this._bodySlot&&e!==this._actionsSlot&&e.parentElement!==this._bodySlot&&this._bodySlot.appendChild(e)}),this._updateBackgroundColor()}_updateBackgroundColor(){if(!this._modal)return;document.documentElement?.classList.contains(`dark`)||document.documentElement?.dataset.mintTheme;let e=this._modal.querySelector(`.modal-content`);e&&(e.style.background=`var(--mint-color-surface-raised)`)}_observeDarkMode(){if(!this._darkModeObserver){if(this._darkModeObserver=new MutationObserver(()=>{this._updateBackgroundColor()}),!document.documentElement)return;this._darkModeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`,`data-mint-theme`]})}}_animateEnter(){let e=this._modal?.querySelector(`.modal-content`);e&&(this._exitTimer&&=(clearTimeout(this._exitTimer),null),this._backdropTimer&&=(clearTimeout(this._backdropTimer),null),this.classList.remove(`mint-modal-closing`),this.classList.remove(`mint-modal-open`),this.classList.add(`mint-modal-open`),this.classList.remove(`mint-hidden`),e.style.transform=`none`,e.style.opacity=`0`,e.style.transition=`none`,requestAnimationFrame(()=>{if(!this.isOpen())return;let t=window.getComputedStyle(e).borderRadius;this._setTransformOrigin(e),e.style.borderRadius=`50%`,e.style.transform=`scale(0.1, 0.2)`,e.style.opacity=`0.9`,e.getBoundingClientRect(),e.style.transition=`opacity 320ms ease-out, transform 360ms cubic-bezier(0.2, 0.8, 0.2, 1), border-radius 360ms cubic-bezier(0.2, 0.8, 0.2, 1)`,requestAnimationFrame(()=>{this.isOpen()&&(e.style.transform=`scale(1)`,e.style.opacity=`1`,e.style.borderRadius=t)})}))}_findTriggerElement(e){if(typeof e==`string`){let t=document.getElementById(e);return t&&!this.contains(t)?t:null}if(e instanceof HTMLElement)return e.isConnected&&!this.contains(e)?e:null;let t=this.getAttribute(`trigger-id`);if(t){let e=document.getElementById(t);if(e&&!this.contains(e))return e}let n=document.activeElement;return n instanceof HTMLElement&&n.isConnected&&n!==document.body&&!this.contains(n)?n:null}_findTriggerPoint(e){if(!e)return null;let t=this._lastPointerPoint;if(!t||Date.now()-t.time>1e3)return null;let n=t.target instanceof Node?t.target:null;return n===e||n&&e.contains(n)?{x:t.x,y:t.y}:null}_setTransformOrigin(e){let t=this._findTriggerElement(this._triggerElement);this._triggerElement=t;let n=this._findTriggerPoint(t);if(n){let t=e.getBoundingClientRect();e.style.transformOrigin=`${n.x-t.left}px ${n.y-t.top}px`,this._triggerPoint=n;return}this._triggerPoint={x:window.innerWidth/2,y:0};let r=e.getBoundingClientRect();e.style.transformOrigin=`${this._triggerPoint.x-r.left}px ${this._triggerPoint.y-r.top}px`}_animateExit(){this.classList.remove(`mint-modal-open`),this._backdropTimer&&=(clearTimeout(this._backdropTimer),null);let e=this._modal?.querySelector(`.modal-content`);if(!e){this.classList.add(`mint-hidden`),this.classList.remove(`mint-modal-closing`);return}this._exitTimer&&clearTimeout(this._exitTimer),this.classList.add(`mint-modal-closing`),e.style.transition=`opacity 220ms ease-in, transform 260ms cubic-bezier(0.4, 0, 1, 1), border-radius 260ms cubic-bezier(0.4, 0, 1, 1)`,e.style.borderRadius=`50%`,e.style.transform=`scale(0.1, 0.2)`,e.style.opacity=`0.9`,this._exitTimer=setTimeout(()=>{this._exitTimer=null,!this.isOpen()&&(this.classList.add(`mint-hidden`),this.classList.remove(`mint-modal-closing`),e.style.transform=``,e.style.opacity=``,e.style.borderRadius=``,e.style.transition=``)},280)}};typeof customElements<`u`&&!customElements.get(`mint-modal`)&&a(`mint-modal`,Gt);var Kt=new Set([`up`,`down`,`left`,`right`]),qt=class extends HTMLElement{static get observedAttributes(){return[`direction`,`open`,`trigger-id`,`trigger-toggle`,`trigger-align`,`padding`,`hover`,`distance`]}constructor(){super(),this._trigger=null,this._triggerLookupTimer=null,this._clickHandler=null,this._hoverEnterHandler=null,this._hoverLeaveHandler=null,this._outsideHandler=null,this._escapeHandler=null,this._positionHandler=null,this._scrollHandler=null,this._resizeObserver=null,this._hoverCloseTimer=null,this._closeAnimationTimer=null,this._blobAnimation=null}connectedCallback(){this.render(),this._setupTrigger()}disconnectedCallback(){this._removeTrigger(),this._removeOpenListeners(),clearTimeout(this._hoverCloseTimer),clearTimeout(this._closeAnimationTimer),this._blobAnimation?.cancel()}attributeChangedCallback(e,t,n){t===n||!this.isConnected||((e===`trigger-id`||e===`trigger-toggle`||e===`hover`)&&this._setupTrigger(),this.render())}getDirection(){let e=this.getAttribute(`direction`)||`down`;return Kt.has(e)?e:`down`}getTriggerId(){return this.getAttribute(`trigger-id`)||``}isOpen(){return this.hasAttribute(`open`)&&this.getAttribute(`open`)!==`false`}isHoverEnabled(){return this.hasAttribute(`hover`)&&this.getAttribute(`hover`)!==`false`}isTriggerToggleEnabled(){return this.getAttribute(`trigger-toggle`)!==`false`}open(){this.setAttribute(`open`,`true`)}close(){this.removeAttribute(`open`)}_removeTrigger(){clearTimeout(this._triggerLookupTimer),this._triggerLookupTimer=null,this._trigger&&(this._clickHandler&&this._trigger.removeEventListener(`click`,this._clickHandler),this._hoverEnterHandler&&this._trigger.removeEventListener(`mouseenter`,this._hoverEnterHandler),this._hoverLeaveHandler&&this._trigger.removeEventListener(`mouseleave`,this._hoverLeaveHandler),this._hoverEnterHandler&&this.removeEventListener(`mouseenter`,this._hoverEnterHandler),this._hoverLeaveHandler&&this.removeEventListener(`mouseleave`,this._hoverLeaveHandler),this._trigger.removeAttribute(`aria-haspopup`),this._trigger.removeAttribute(`aria-expanded`),this._trigger=null,this._clickHandler=this._hoverEnterHandler=this._hoverLeaveHandler=null)}_setupTrigger(){this._removeTrigger();let e=this.getTriggerId();if(e){if(this._trigger=document.getElementById(e),!this._trigger){this._triggerLookupTimer=setTimeout(()=>{this.isConnected&&this.getTriggerId()===e&&!this._trigger&&this._setupTrigger()},40);return}this._trigger.setAttribute(`aria-haspopup`,`true`),this._trigger.setAttribute(`aria-expanded`,String(this.isOpen())),this.isTriggerToggleEnabled()&&(this._clickHandler=e=>{this._trigger?.tagName===`A`&&e.preventDefault(),this.isOpen()?this.close():this.open()},this._trigger.addEventListener(`click`,this._clickHandler)),this.isHoverEnabled()&&(this._hoverEnterHandler=()=>{clearTimeout(this._hoverCloseTimer),this.open()},this._hoverLeaveHandler=()=>this._scheduleHoverClose(),this._trigger.addEventListener(`mouseenter`,this._hoverEnterHandler),this._trigger.addEventListener(`mouseleave`,this._hoverLeaveHandler),this.addEventListener(`mouseenter`,this._hoverEnterHandler),this.addEventListener(`mouseleave`,this._hoverLeaveHandler))}}_scheduleHoverClose(){clearTimeout(this._hoverCloseTimer),this._hoverCloseTimer=setTimeout(()=>{!this._trigger?.matches(`:hover`)&&!this.matches(`:hover`)&&this.close()},140)}_removeOpenListeners(){this._outsideHandler&&document.removeEventListener(`click`,this._outsideHandler),this._escapeHandler&&document.removeEventListener(`keydown`,this._escapeHandler),this._positionHandler&&window.removeEventListener(`resize`,this._positionHandler),this._scrollHandler&&window.removeEventListener(`scroll`,this._scrollHandler,!0),this._resizeObserver?.disconnect(),this._resizeObserver=null,this._outsideHandler=this._escapeHandler=this._positionHandler=this._scrollHandler=null}_setOpenListeners(){if(!this._outsideHandler){if(this._outsideHandler=e=>{let t=e.composedPath();t.includes(this)||t.includes(this._trigger)||(e.target instanceof Element?e.target:null)?.closest(`[data-keep-popover-open]`)||this.close()},this._escapeHandler=e=>{e.key===`Escape`&&(this.close(),this._trigger?.focus?.())},this._positionHandler=()=>{this.isOpen()&&this._position()},this._scrollHandler=()=>{this.isOpen()&&this._position({allowViewportFlip:!1,clampToViewport:!1})},typeof ResizeObserver<`u`&&this._trigger){this._resizeObserver=new ResizeObserver(()=>{this.isOpen()&&this._position()}),this._resizeObserver.observe(this);let e=this._trigger,t=0;for(;e&&e!==document.documentElement&&t<8;)this._resizeObserver.observe(e),e=e.parentElement,t+=1}setTimeout(()=>{this.isOpen()&&this._outsideHandler&&document.addEventListener(`click`,this._outsideHandler)},0),document.addEventListener(`keydown`,this._escapeHandler),window.addEventListener(`resize`,this._positionHandler),window.addEventListener(`scroll`,this._scrollHandler,!0)}}_position({allowViewportFlip:e=!0,clampToViewport:t=!0}={}){let n=document.getElementById(this.getTriggerId());n&&n!==this._trigger&&this._setupTrigger();let r=n||this._trigger;if(!r)return;let i=r.getBoundingClientRect(),a={width:this.offsetWidth,height:this.offsetHeight},o=this._distancePx(),s=e?this.getDirection():this.dataset.direction||this.getDirection(),c=0,l=0,u=this.getAttribute(`trigger-align`)||`center`;if(s===`down`||s===`up`){let t=i.bottom+o,n=i.top-a.height-o;e&&s===`down`&&t+a.height>innerHeight-12&&n>=12?s=`up`:e&&s===`up`&&n<12&&t+a.height<=innerHeight-12&&(s=`down`),c=s===`down`?t:n,l=u===`start`?i.left:u===`end`?i.right-a.width:i.left+(i.width-a.width)/2}else{let t=i.right+o,n=i.left-a.width-o;e&&s===`right`&&t+a.width>innerWidth-12&&n>=12?s=`left`:e&&s===`left`&&n<12&&t+a.width<=innerWidth-12&&(s=`right`),l=s===`right`?t:n,c=u===`start`?i.top:u===`end`?i.bottom-a.height:i.top+(i.height-a.height)/2}let d=t?Math.max(12,Math.min(c,innerHeight-a.height-12)):c,f=t?Math.max(12,Math.min(l,innerWidth-a.width-12)):l;this.style.top=`${d}px`,this.style.left=`${f}px`,this.dataset.direction=s,this.style.setProperty(`--mint-popover-origin-x`,`${i.left+i.width/2-f}px`),this.style.setProperty(`--mint-popover-origin-y`,`${i.top+i.height/2-d}px`)}_distancePx(){let e=(this.getAttribute(`distance`)||`8px`).trim(),t=Number.parseFloat(e);return Number.isFinite(t)?e.endsWith(`rem`)?t*(parseFloat(getComputedStyle(document.documentElement).fontSize)||16):Math.max(0,t):8}_animateBlob(e){if(this._blobAnimation?.cancel(),this._blobAnimation=null,typeof this.animate!=`function`)return 0;let t=getComputedStyle(this).borderRadius||`.75rem`;if(matchMedia(`(prefers-reduced-motion: reduce)`).matches)return 0;let n=e?380:280,r=[{transform:`scale(.035, .035)`,borderRadius:`50%`,opacity:.94,offset:0},{transform:`scale(.3, .42)`,borderRadius:`50%`,opacity:1,offset:.58},{transform:`scale(1.035, .96)`,borderRadius:`1rem`,offset:.9},{transform:`scale(1)`,borderRadius:t,offset:1}],i=e?r:[...r].reverse().map(({offset:e,...t})=>({...t,offset:1-e}));return this._blobAnimation=this.animate(i,{duration:n,easing:e?`cubic-bezier(.2, .8, .2, 1)`:`cubic-bezier(.4, 0, .8, .2)`,fill:`both`}),n}render(){let e=this.isOpen(),t=this.hasAttribute(`data-open`)||this.dataset.state===`closing`,n=this.hasAttribute(`data-open`);if(this.toggleAttribute(`data-open`,e),this.setAttribute(`aria-hidden`,String(!e)),this._trigger&&this._trigger.setAttribute(`aria-expanded`,String(e)),e){clearTimeout(this._closeAnimationTimer);let e=!n||this.dataset.state===`closing`;e&&(this._blobAnimation?.cancel(),this._blobAnimation=null),this.dataset.state=`open`,this._setOpenListeners(),this._position(),e&&this._animateBlob(!0),requestAnimationFrame(()=>requestAnimationFrame(()=>{this.isOpen()&&this._position()}))}else if(this._removeOpenListeners(),t){this.dataset.state=`closing`;let e=this._animateBlob(!1);e?this._closeAnimationTimer=setTimeout(()=>{this.dataset.state===`closing`&&(this._blobAnimation?.cancel(),this._blobAnimation=null,this.dataset.state=`closed`)},e):this.dataset.state=`closed`}else this.dataset.state=`closed`}};typeof customElements<`u`&&!customElements.get(`mint-popover`)&&a(`mint-popover`,qt),s({name:`check`,viewBox:`0 0 24 24`,path:`M5 13l4 4L19 7`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`3.2`});var Jt=class extends HTMLElement{static get observedAttributes(){return[`checked`,`disabled`,`label`,`info`,`id`,`name`,`value`]}constructor(){super(),this._checkbox=null,this._checked=!1,this._clickHandler=null}connectedCallback(){let e=this.getAttribute(`checked`);this._checked=e!==null&&e!==`false`,this.render()}disconnectedCallback(){this.removeEventListeners()}attributeChangedCallback(e,t,n){e===`checked`&&(this._checked=n!==null&&n!==`false`,this._checkbox&&(this._checkbox.checked=this._checked)),t!==n&&(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(){return`mint-checkbox-control`}render(){let e=this.getLabel(),t=this.getInfo(),n=this.isDisabled(),r=this.querySelector(`.mint-checkbox-wrapper`);r||(r=document.createElement(`div`),r.className=`mint-checkbox-wrapper`,this.insertBefore(r,this.firstChild)),this._checkbox?this._checkbox.parentElement!==r&&r.appendChild(this._checkbox):(this._checkbox=document.createElement(`input`),this._checkbox.type=`checkbox`,r.appendChild(this._checkbox),this.setupEventListeners()),this._checkbox.className=`mint-input-overlay`,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=n,this._changeHandler||this.setupEventListeners();let i=this.getId();i?this._checkbox.id=i:this._checkbox.removeAttribute(`id`);let a=this.getName();a?this._checkbox.name=a:this._checkbox.removeAttribute(`name`);let o=this.getValue();o?this._checkbox.value=o:this._checkbox.removeAttribute(`value`),e?this._checkbox.setAttribute(`aria-label`,e):this._checkbox.removeAttribute(`aria-label`),r.className=`mint-checkbox-wrapper ${this.getCheckboxClasses()}`,r.style.pointerEvents=`none`,this._checkbox.style.pointerEvents=`auto`;let s=r.querySelector(`mint-icon`);s||(s=document.createElement(`mint-icon`),s.setAttribute(`name`,`check`),s.className=`mint-checkbox-check`,s.style.transition=`opacity 200ms ease-out, transform 200ms ease-out`,s.style.zIndex=`1`,r.appendChild(s)),this.updateVisualState();let c=this.querySelector(`.mint-checkbox-label-container`);if(e||t){c||(c=document.createElement(`div`),c.className=`mint-checkbox-label-container`,this.appendChild(c));let r=c.querySelector(`.mint-checkbox-label`);e?(r||(r=document.createElement(`span`),r.className=`mint-checkbox-label`,c.insertBefore(r,c.firstChild)),r.textContent=e,n?r.style.opacity=`0.5`:r.style.opacity=``):r&&r.remove();let i=c.querySelector(`.mint-checkbox-info`);if(t?(i||(i=document.createElement(`span`),i.className=`mint-checkbox-info`,c.appendChild(i)),i.textContent=t,n?i.style.opacity=`0.5`:i.style.opacity=``):i&&i.remove(),n)c.style.cursor=`default`,c._clickHandler&&(c.removeEventListener(`click`,c._clickHandler),c._clickHandler=null);else{c.style.cursor=`pointer`;let e=c._clickHandler;e&&c.removeEventListener(`click`,e),c._clickHandler=e=>{this._checkbox&&(e.target===this._checkbox||this._checkbox.contains(e.target)||e.composedPath().includes(this._checkbox))||this.toggle()},c.addEventListener(`click`,c._clickHandler)}}else c&&c.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();let 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();let t=this.querySelector(`.mint-checkbox-wrapper`);t&&!this.isDisabled()&&(t.classList.add(`mint-checkbox-active`),this._checked?(t.style.backgroundColor=`var(--mint-color-primary)`,t.style.boxShadow=`inset 0 2px 4px rgba(0, 0, 0, 0.3)`):(t.style.backgroundColor=`var(--mint-color-surface-hover)`,t.style.boxShadow=`inset 0 2px 4px rgba(0, 0, 0, 0.1)`))},this._mouseupHandler=e=>{e.stopPropagation();let t=this.querySelector(`.mint-checkbox-wrapper`);t&&(t.classList.remove(`mint-checkbox-active`),t.style.backgroundColor=``,t.style.boxShadow=``)},this._mouseleaveHandler=e=>{let 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._touchstartHandler=e=>{e.stopPropagation();let t=this.querySelector(`.mint-checkbox-wrapper`);t&&!this.isDisabled()&&(t.classList.add(`mint-checkbox-active`),this._checked?(t.style.backgroundColor=`var(--mint-color-primary)`,t.style.boxShadow=`inset 0 2px 4px rgba(0, 0, 0, 0.3)`):(t.style.backgroundColor=`var(--mint-color-surface-hover)`,t.style.boxShadow=`inset 0 2px 4px rgba(0, 0, 0, 0.1)`))},this._touchendHandler=e=>{e.stopPropagation();let 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),null),this._mousedownHandler&&=(this._checkbox.removeEventListener(`mousedown`,this._mousedownHandler),null),this._mouseupHandler&&=(this._checkbox.removeEventListener(`mouseup`,this._mouseupHandler),null),this._mouseleaveHandler&&=(this._checkbox.removeEventListener(`mouseleave`,this._mouseleaveHandler),null),this._touchstartHandler&&=(this._checkbox.removeEventListener(`touchstart`,this._touchstartHandler),null),this._touchendHandler&&=(this._checkbox.removeEventListener(`touchend`,this._touchendHandler),null))}updateVisualState(){let e=this.querySelector(`.mint-checkbox-wrapper`),t=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();let e=new CustomEvent(`change`,{detail:{checked:this._checked},bubbles:!0,cancelable:!0});this.dispatchEvent(e)}}};typeof customElements<`u`&&!customElements.get(`mint-checkbox`)&&a(`mint-checkbox`,Jt);var Yt=class extends HTMLElement{static get observedAttributes(){return[`checked`,`disabled`,`label`,`info`,`id`,`name`,`value`,`required`]}constructor(){super(),this._radio=null,this._checked=!1,this._groupMode=!1,this._groupChangeHandler=null,this._groupObserver=null}connectedCallback(){if(this._activateGroupModeIfNeeded(),this._groupObserver=new MutationObserver(()=>this._activateGroupModeIfNeeded()),this._groupObserver.observe(this,{childList:!0,subtree:!0}),this._groupMode)return;let e=this.getAttribute(`checked`);this._checked=e!==null&&e!==`false`,this.render()}disconnectedCallback(){this.removeEventListeners(),this._groupChangeHandler&&=(this.removeEventListener(`choice-option-change`,this._groupChangeHandler),null),this._groupObserver?.disconnect(),this._groupObserver=null}attributeChangedCallback(e,t,n){if(this._groupMode){t!==n&&this.renderGroup();return}e===`checked`&&(this._checked=n!==null&&n!==`false`,this._radio&&(this._radio.checked=this._checked)),t!==n&&(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._groupMode?this.querySelector(`mint-choice-option input[type="radio"]:checked`)?.value||this.getAttribute(`value`)||``:this.getAttribute(`value`)||``}set value(e){this.setValue(e)}get value(){return this.getValue()}setValue(e){if(!this._groupMode){e?this.setAttribute(`value`,e):this.removeAttribute(`value`);return}let t=e==null?``:String(e);this.querySelectorAll(`mint-choice-option`).forEach(e=>{let n=e.getAttribute(`value`)===t,r=e.querySelector(`input[type="radio"]`);r&&(r.checked=n),e.toggleAttribute(`checked`,n)}),t?this.setAttribute(`value`,t):this.removeAttribute(`value`)}renderGroup(){this.classList.add(`mint-choice-group`),this.setAttribute(`role`,`radiogroup`);let e=this.getAttribute(`label`)||``,t=this.querySelector(`:scope > .mint-choice-group-label`);e&&!t&&(t=document.createElement(`div`),t.className=`mint-choice-group-label`,this.insertBefore(t,this.firstChild)),t&&(e?t.textContent=e:t.remove());let n=this.querySelector(`:scope > .mint-choice-options`);n||(n=document.createElement(`div`),n.className=`mint-choice-options`,t?.parentElement===this?this.insertBefore(n,t.nextSibling):this.insertBefore(n,this.firstChild)),Array.from(this.children).filter(e=>e.tagName===`MINT-CHOICE-OPTION`&&e.parentElement!==n).forEach(e=>n.appendChild(e)),this.querySelectorAll(`mint-choice-option`).forEach(e=>e.render());let r=this.getAttribute(`value`);r&&this.setValue(r)}_activateGroupModeIfNeeded(){this._groupMode||!this.querySelector(`mint-choice-option`)||(this._groupMode=!0,this.removeEventListeners(),this.querySelector(`.mint-choice-wrapper`)?.remove(),this.querySelector(`.mint-choice-label-container`)?.remove(),this._radio=null,this._groupChangeHandler=e=>{let t=e.target.closest?.(`mint-choice-option`);if(!t||!this.contains(t))return;let n=t.getAttribute(`value`)||``;n?this.setAttribute(`value`,n):this.removeAttribute(`value`),this.dispatchEvent(new Event(`input`,{bubbles:!0,composed:!0})),this.dispatchEvent(new Event(`change`,{bubbles:!0,composed:!0}))},this.addEventListener(`choice-option-change`,this._groupChangeHandler),this.renderGroup())}getChoiceClasses(){return`mint-choice-control`}render(){if(this._groupMode){this.renderGroup();return}let e=this.getLabel(),t=this.getInfo(),n=this.isDisabled(),r=this.querySelector(`.mint-choice-wrapper`);r||(r=document.createElement(`div`),r.className=`mint-choice-wrapper`,this.insertBefore(r,this.firstChild)),this._radio?this._radio.parentElement!==r&&r.appendChild(this._radio):(this._radio=document.createElement(`input`),this._radio.type=`radio`,r.appendChild(this._radio),this.setupEventListeners()),this._radio.className=`mint-input-overlay`,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=n,this._changeHandler||this.setupEventListeners();let i=this.getId();i?this._radio.id=i:this._radio.removeAttribute(`id`);let a=this.getName();a?this._radio.name=a:this._radio.removeAttribute(`name`);let o=this.getValue();o?this._radio.value=o:this._radio.removeAttribute(`value`),e?this._radio.setAttribute(`aria-label`,e):this._radio.removeAttribute(`aria-label`),r.className=`mint-choice-wrapper ${this.getChoiceClasses()}`,r.style.pointerEvents=`none`,this._radio.style.pointerEvents=`auto`;let s=r.querySelector(`.mint-choice-indicator`);s||(s=document.createElement(`div`),s.className=`mint-choice-indicator`,s.style.transition=`opacity 200ms ease-out, transform 200ms ease-out`,s.style.zIndex=`1`,r.appendChild(s)),s.style.opacity=this._checked?`1`:`0`,s.style.transform=this._checked?`scale(1)`:`scale(0.8)`,this.updateVisualState();let c=this.querySelector(`.mint-choice-label-container`);if(e||t){c||(c=document.createElement(`div`),c.className=`mint-choice-label-container`,this.appendChild(c));let r=c.querySelector(`.mint-choice-label`);e?(r||(r=document.createElement(`span`),r.className=`mint-choice-label`,c.insertBefore(r,c.firstChild)),r.textContent=e,n?r.style.opacity=`0.5`:r.style.opacity=``):r&&r.remove();let i=c.querySelector(`.mint-choice-info`);if(t?(i||(i=document.createElement(`span`),i.className=`mint-choice-info`,c.appendChild(i)),i.textContent=t,n?i.style.opacity=`0.5`:i.style.opacity=``):i&&i.remove(),n)c.style.cursor=`default`,c._clickHandler&&(c.removeEventListener(`click`,c._clickHandler),c._clickHandler=null);else{c.style.cursor=`pointer`;let e=c._clickHandler;e&&c.removeEventListener(`click`,e),c._clickHandler=e=>{this._radio&&(e.target===this._radio||this._radio.contains(e.target)||e.composedPath().includes(this._radio))||this.select()},c.addEventListener(`click`,c._clickHandler)}}else c&&c.remove()}setupEventListeners(){this.removeEventListeners(),this._radio&&(this._changeHandler=e=>{e.stopPropagation();let 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){let e=this._radio.name;e&&document.querySelectorAll(`input[type="radio"][name="${e}"]`).forEach(e=>{if(e!==this._radio){let t=e.closest(`mint-choice`);t&&t.updateVisualState&&(t._checked=e.checked,e.checked?t.hasAttribute(`checked`)||t.setAttribute(`checked`,``):t.hasAttribute(`checked`)&&t.removeAttribute(`checked`),t.updateVisualState())}})}if(t!==this._checked){let e=new CustomEvent(`change`,{detail:{checked:this._checked,value:this.getValue()},bubbles:!0,cancelable:!0});this.dispatchEvent(e)}},this._radio.addEventListener(`change`,this._changeHandler),this._groupChangeHandler=e=>{e.target!==this._radio&&e.target.type===`radio`&&e.target.name===this._radio.name&&e.target.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=>{let t=this._radio.name;t&&document.querySelectorAll(`input[type="radio"][name="${t}"]`).forEach(e=>{if(e!==this._radio){let t=e.closest(`mint-choice`);t&&t.updateVisualState&&(t._checked=e.checked,e.checked?t.hasAttribute(`checked`)||t.setAttribute(`checked`,``):t.hasAttribute(`checked`)&&t.removeAttribute(`checked`),t.updateVisualState())}}),requestAnimationFrame(()=>{this._checked=this._radio.checked,this.updateVisualState()})},this._radio.addEventListener(`click`,this._clickHandler),this._mousedownHandler=e=>{e.stopPropagation();let t=this.querySelector(`.mint-choice-wrapper`);t&&!this.isDisabled()&&(t.classList.add(`mint-choice-active`),this._checked?(t.style.backgroundColor=`var(--mint-color-primary)`,t.style.boxShadow=`inset 0 2px 4px rgba(0, 0, 0, 0.3)`):(t.style.backgroundColor=`var(--mint-color-surface-hover)`,t.style.boxShadow=`inset 0 2px 4px rgba(0, 0, 0, 0.1)`))},this._mouseupHandler=e=>{e.stopPropagation();let t=this.querySelector(`.mint-choice-wrapper`);t&&(t.classList.remove(`mint-choice-active`),t.style.backgroundColor=``,t.style.boxShadow=``)},this._mouseleaveHandler=e=>{let 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();let t=this.querySelector(`.mint-choice-wrapper`);t&&!this.isDisabled()&&(t.classList.add(`mint-choice-active`),this._checked?(t.style.backgroundColor=`var(--mint-color-primary)`,t.style.boxShadow=`inset 0 2px 4px rgba(0, 0, 0, 0.3)`):(t.style.backgroundColor=`var(--mint-color-surface-hover)`,t.style.boxShadow=`inset 0 2px 4px rgba(0, 0, 0, 0.1)`))},this._touchendHandler=e=>{e.stopPropagation();let 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))}removeEventListeners(){this._radio&&(this._changeHandler&&=(this._radio.removeEventListener(`change`,this._changeHandler),null),this._groupChangeHandler&&=(document.removeEventListener(`change`,this._groupChangeHandler),null),this._clickHandler&&=(this._radio.removeEventListener(`click`,this._clickHandler),null),this._mousedownHandler&&=(this._radio.removeEventListener(`mousedown`,this._mousedownHandler),null),this._mouseupHandler&&=(this._radio.removeEventListener(`mouseup`,this._mouseupHandler),null),this._mouseleaveHandler&&=(this._radio.removeEventListener(`mouseleave`,this._mouseleaveHandler),null),this._touchstartHandler&&=(this._radio.removeEventListener(`touchstart`,this._touchstartHandler),null),this._touchendHandler&&=(this._radio.removeEventListener(`touchend`,this._touchendHandler),null))}updateVisualState(){let e=this.querySelector(`.mint-choice-wrapper`),t=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`,``);let e=this._radio.name;e&&document.querySelectorAll(`input[type="radio"][name="${e}"]`).forEach(e=>{if(e!==this._radio){let t=e.closest(`mint-choice`);t&&t.updateVisualState&&(t._checked=e.checked,e.checked?t.hasAttribute(`checked`)||t.setAttribute(`checked`,``):t.hasAttribute(`checked`)&&t.removeAttribute(`checked`),t.updateVisualState())}}),this.updateVisualState();let t=new CustomEvent(`change`,{detail:{checked:this._checked,value:this.getValue()},bubbles:!0,cancelable:!0});this.dispatchEvent(t)}}},Xt=class extends HTMLElement{static get observedAttributes(){return[`value`,`checked`,`disabled`]}constructor(){super(),this._labelText=``,this._radio=null,this._changeHandler=null}connectedCallback(){this.render()}attributeChangedCallback(e,t,n){t!==n&&this.isConnected&&this.render()}render(){let e=this.closest(`mint-choice`),t=this.querySelector(`.mint-choice-option-label`);this._labelText||=t?.textContent?.trim()||this.textContent.trim();let n=this.querySelector(`:scope > .mint-choice-option-control`);n||(n=document.createElement(`label`),n.className=`mint-choice-option-control`,this.replaceChildren(n)),this._radio||(this._radio=document.createElement(`input`),this._radio.type=`radio`,this._radio.className=`mint-choice-option-input`,n.appendChild(this._radio),this._changeHandler=()=>{this._radio?.checked&&e&&(e.setValue(this.getAttribute(`value`)||``),e.dispatchEvent(new CustomEvent(`choice-option-change`,{detail:{value:this.getAttribute(`value`)||``,option:this},bubbles:!1})))},this._radio.addEventListener(`change`,this._changeHandler)),this._radio.name=e?.getAttribute(`name`)||``,this._radio.value=this.getAttribute(`value`)||``,this._radio.disabled=this.hasAttribute(`disabled`)||e?.hasAttribute(`disabled`)||!1,this._radio.required=e?.hasAttribute(`required`)||!1,this._radio.checked=this.hasAttribute(`checked`)||e?.getAttribute(`value`)===this._radio.value;let r=n.querySelector(`.mint-choice-option-label`);r||(r=document.createElement(`span`),r.className=`mint-choice-option-label`,n.appendChild(r)),r.textContent=this._labelText}};typeof customElements<`u`&&!customElements.get(`mint-choice`)&&a(`mint-choice`,Yt),typeof customElements<`u`&&!customElements.get(`mint-choice-option`)&&a(`mint-choice-option`,Xt),s({name:`arrow-left`,viewBox:`0 0 24 24`,path:`M19 12H5m7-7l-7 7 7 7`,strokeLinecap:`round`,strokeLinejoin:`round`});var Zt=class extends HTMLElement{static get observedAttributes(){return[`variant`,`tone`,`disabled`,`loading`,`button-type`,`type`,`full-width`,`icon-position`,`icon`]}constructor(){super(),this._button=null,this._clickHandler=null,this._isHandlingClick=!1}connectedCallback(){this.render(),this._button&&this.setupEventListeners()}disconnectedCallback(){this.removeEventListeners()}attributeChangedCallback(e,t,n){t!==n&&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(`type`)||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(){if(!(this.getIcon()||this._button?.querySelector(`[slot="icon"], .mint-button-icon, mint-icon`)))return!1;let e=this._button?.querySelector(`.mint-button-content`);if(e&&e.textContent.trim())return!1;if(this._button){for(let e=this._button.firstChild;e;e=e.nextSibling)if(e.nodeType===Node.TEXT_NODE&&e.textContent.trim()||e.nodeType===Node.ELEMENT_NODE&&e.tagName!==`MINT-ICON`&&e.tagName!==`MINT-SPINNER`&&!e.querySelector?.(`mint-spinner`)&&!e.hasAttribute?.(`slot`)&&e.className!==`mint-button-icon`&&!(e.className===`mr-2`&&e.querySelector(`mint-spinner`))&&e.textContent.trim())return!1}return!0}getButtonClasses(){return[`mint-button-core`,`mint-button-`+this.getVariant(),`mint-button-tone-`+this.getTone(),this.isIconOnly()?`mint-button-icon-only`:``,this.isFullWidth()?`mint-button-full-width`:``].filter(Boolean).join(` `)}render(){let 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 n=this._button.querySelector(`mint-spinner`);if(this.isLoading())if(n)n.setAttribute(`data-button-variant`,this.getVariant()),n.setAttribute(`data-button-tone`,this.getTone()),n.render();else{let e=document.createElement(`span`);e.className=`mint-spinner-wrap`;let t=document.createElement(`mint-spinner`);t.setAttribute(`size`,`default`),t.setAttribute(`data-button-variant`,this.getVariant()),t.setAttribute(`data-button-tone`,this.getTone()),t.style.width=`0.875rem`,t.style.height=`0.875rem`,e.appendChild(t),this._button.insertBefore(e,this._button.firstChild)}else n&&n.parentElement?.remove();for(;this.firstChild&&this.firstChild!==this._button;)this._button.appendChild(this.firstChild);let r=this.getIcon(),i=this._button.querySelector(`[slot="icon"], .mint-button-icon, mint-icon`);r?(i&&i.tagName!==`MINT-ICON`&&(i.remove(),i=null),!i||i.tagName!==`MINT-ICON`?(i=document.createElement(`mint-icon`),i.setAttribute(`name`,r),i.className=`mint-button-icon`):i.setAttribute(`name`,r)):i&&i.tagName===`MINT-ICON`&&(i.remove(),i=null),i||=this._button.querySelector(`[slot="icon"], .mint-button-icon`);let a=this.getIconPosition(),o=this._button.querySelector(`.mint-button-content`);if(o){let e=i&&i.tagName===`MINT-ICON`;if(i&&!i.parentElement){let t=this._button.querySelector(`mint-spinner`)?.parentElement;e||a===`left`?t?t.insertAdjacentElement(`afterend`,i):this._button.insertBefore(i,o):o.insertAdjacentElement(`afterend`,i)}else if(i&&(e||a===`left`)&&i.nextSibling!==o){i.remove();let e=this._button.querySelector(`mint-spinner`)?.parentElement;e?e.insertAdjacentElement(`afterend`,i):this._button.insertBefore(i,o)}else i&&!e&&a===`right`&&i.previousSibling!==o&&(i.remove(),o.insertAdjacentElement(`afterend`,i))}else{let e=[];for(let t=this._button.firstChild;t;t=t.nextSibling)t.tagName!==`MINT-SPINNER`&&!t.querySelector?.(`mint-spinner`)&&t!==i&&!t.hasAttribute?.(`slot`)&&!(t.className===`mr-2`&&t.querySelector(`mint-spinner`))&&e.push(t);if(e.length>0){o=document.createElement(`span`),o.className=`mint-button-content`,e.forEach(e=>{o.appendChild(e)});let t=this._button.querySelector(`mint-spinner`)?.parentElement;i&&a===`left`?t?(t.insertAdjacentElement(`afterend`,i),i.insertAdjacentElement(`afterend`,o)):(this._button.insertBefore(i,this._button.firstChild),i.insertAdjacentElement(`afterend`,o)):i&&a===`right`?t?(t.insertAdjacentElement(`afterend`,o),o.insertAdjacentElement(`afterend`,i)):(this._button.insertBefore(o,this._button.firstChild),o.insertAdjacentElement(`afterend`,i)):t?t.insertAdjacentElement(`afterend`,o):this._button.insertBefore(o,this._button.firstChild)}else if(i&&i.tagName===`MINT-ICON`&&!i.parentElement){let e=this._button.querySelector(`mint-spinner`)?.parentElement;e?e.insertAdjacentElement(`afterend`,i):this._button.insertBefore(i,this._button.firstChild)}}let s=this.isIconOnly();i&&(i.classList.contains(`mint-button-icon`)||i.classList.add(`mint-button-icon`),i.classList.remove(`mint-icon-leading`,`mint-icon-trailing`),s?i.tagName===`MINT-ICON`?(i.style.width=`1rem`,i.style.height=`1rem`,i.style.maxWidth=`1rem`,i.style.maxHeight=`1rem`,i.style.flexShrink=`0`):(i.style.maxWidth=`1rem`,i.style.maxHeight=`1rem`,i.style.flexShrink=`0`,i.tagName===`svg`&&(i.style.width=`1rem`,i.style.height=`1rem`)):a===`left`?i.classList.add(`mint-icon-leading`):i.classList.add(`mint-icon-trailing`));let c=this.getButtonClasses();this._button.className=c}setupEventListeners(){this._button&&!this._clickHandler&&(this._clickHandler=this.handleClick.bind(this),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),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))}_handleMouseDown=()=>{this._button&&!this.isDisabled()&&!this.isLoading()&&this._button.classList.add(`mint-button-active`)};_handleMouseUp=()=>{this._button&&this._button.classList.remove(`mint-button-active`)};_handleMouseLeave=()=>{this._button&&this._button.classList.remove(`mint-button-active`)};_handleTouchStart=()=>{this._button&&!this.isDisabled()&&!this.isLoading()&&this._button.classList.add(`mint-button-active`)};_handleTouchEnd=()=>{this._button&&this._button.classList.remove(`mint-button-active`)};_handleTouchCancel=()=>{this._button&&this._button.classList.remove(`mint-button-active`)};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})}};typeof customElements<`u`&&!customElements.get(`mint-button`)&&a(`mint-button`,Zt);var Qt=class extends HTMLElement{static get observedAttributes(){return[`href`,`fallback-href`]}constructor(){super(),this._historyDepth=0,this._maxBackAttempts=10,this._backAttempts=0}connectedCallback(){this.render(),this._setupHistoryTracking()}attributeChangedCallback(e,t,n){t!==n&&this.render()}_setupHistoryTracking(){window.addEventListener(`popstate`,()=>{this._backAttempts=0}),this._historyDepth=window.history.length}getFallbackHref(){return this.getAttribute(`fallback-href`)||this.getAttribute(`href`)||`/`}handleClick(e){if(e.preventDefault(),e.stopPropagation(),window.history.length>1&&this._backAttempts<this._maxBackAttempts&&this._backAttempts===0){this._backAttempts++;let e=window.location.href,t=Date.now();window.history.back(),setTimeout(()=>{Date.now()-t,window.location.href===e?this._navigateToFallback():setTimeout(()=>{this._backAttempts=0},500)},200)}else this._navigateToFallback()}_navigateToFallback(){let e=this.getFallbackHref();if(this._backAttempts=0,e.startsWith(`/`)&&!e.startsWith(`//`))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))}};typeof customElements<`u`&&!customElements.get(`mint-back-button`)&&a(`mint-back-button`,Qt);var $t=0,en=class extends HTMLElement{static get observedAttributes(){return[`brand`,`brand-href`,`direction`,`label`,`open`,`fixed`]}constructor(){super(),this._built=!1,this._brand=null,this._brandLink=null,this._leadingActions=null,this._items=null,this._toggle=null,this._toggleLabel=null,this._mobileActions=null,this._mobileActionNodes=[],this._instanceId=++$t,this._dropdowns=[],this._content=null,this._actions=null,this._activeDropdown=null,this._layoutObserver=null}connectedCallback(){this._built||this._build(),this._observeDropdowns(),this._syncResponsiveDropdowns(),this._syncMobileActions(),typeof ResizeObserver<`u`&&(this._layoutObserver=new ResizeObserver(()=>{this._syncResponsiveDropdowns(),this._syncMobileActions()}),this._layoutObserver.observe(this)),this._syncAttributes()}disconnectedCallback(){for(let e of this._dropdowns)e.observer?.disconnect();this._layoutObserver?.disconnect(),this._layoutObserver=null}attributeChangedCallback(e,t,n){t===n||!this._built||(e===`open`?this._syncOpenState():this._syncAttributes())}getDirection(){return this.getAttribute(`direction`)===`vertical`?`vertical`:`horizontal`}getBrand(){return this.getAttribute(`brand`)||``}getBrandHref(){return this.getAttribute(`brand-href`)||`/`}getLabel(){return this.getAttribute(`label`)||`Primary navigation`}_build(){let e=Array.from(this.childNodes),t=e.find(e=>e.nodeType===Node.ELEMENT_NODE&&e.getAttribute(`slot`)===`brand`),n=e.filter(e=>e.nodeType===Node.ELEMENT_NODE&&e.getAttribute(`slot`)===`leading-actions`),r=e.filter(e=>e.nodeType===Node.ELEMENT_NODE&&[`actions`,`mobile-actions`].includes(e.getAttribute(`slot`)));this._mobileActionNodes=r.filter(e=>e.getAttribute(`slot`)===`mobile-actions`);let i=e.filter(e=>e!==t&&!n.includes(e)&&!r.includes(e));this.replaceChildren();let a=document.createElement(`div`);a.className=`mint-navigation-shell`;let o=document.createElement(`div`);o.className=`mint-navigation-bar`,this._leadingActions=document.createElement(`div`),this._leadingActions.className=`mint-navigation-leading-actions`;for(let e of n)e.removeAttribute(`slot`),this._leadingActions.appendChild(e);this._brand=document.createElement(`div`),this._brand.className=`mint-navigation-brand`,t?(t.removeAttribute(`slot`),this._brand.appendChild(t)):this.getBrand()&&(this._brandLink=document.createElement(`mint-link`),this._brandLink.className=`mint-navigation-brand-link`,this._brandLink.textContent=this.getBrand(),this._brandLink.setAttribute(`href`,this.getBrandHref()),this._brand.appendChild(this._brandLink)),this._toggle=document.createElement(`mint-button`),this._toggle.className=`mint-navigation-toggle`,this._toggle.setAttribute(`aria-expanded`,`false`),this._toggle.addEventListener(`click`,()=>this.toggleMenu()),this._toggleLabel=document.createElement(`span`),this._toggleLabel.className=`mint-navigation-visually-hidden`,this._toggleLabel.textContent=`Open navigation menu`,this._toggle.append(this._toggleLabel),this._toggle.setAttribute(`variant`,`ghost`),this._toggle.setAttribute(`tone`,`action`),this._toggle.setAttribute(`button-type`,`button`),this._toggle.setAttribute(`icon`,`menu`),this._mobileActions=document.createElement(`div`),this._mobileActions.className=`mint-navigation-mobile-actions`,o.append(this._leadingActions,this._brand,this._mobileActions,this._toggle);let s=document.createElement(`div`);this._content=s,s.className=`mint-navigation-content`,this._items=document.createElement(`nav`),this._items.className=`mint-navigation-items`,this._items.setAttribute(`aria-label`,this.getLabel()),this._items.addEventListener(`click`,e=>{e.target.closest(`a, mint-link`)&&this.closeMenu()});let c=0;for(let e of i)if(e.nodeType!==Node.ELEMENT_NODE)this._items.appendChild(e);else if(e.tagName===`DETAILS`){let t=this._createDropdown(e,c++);this._items.append(t.trigger,t.popover),this._registerDropdown(t.trigger,t.popover)}else{let t=this._toMintLink(e);if(this._items.appendChild(t),t.nodeType===Node.ELEMENT_NODE&&t.tagName===`MINT-POPOVER`){let e=t.getAttribute(`trigger-id`),n=Array.from(this._items.querySelectorAll(`mint-button`)).find(t=>t.id===e);this._registerDropdown(n,t)}}let l=document.createElement(`div`);this._actions=l,l.className=`mint-navigation-actions`;for(let e of r)e.removeAttribute(`slot`),l.appendChild(e);let u=document.createElement(`section`);u.className=`mint-navigation-submenu`,u.setAttribute(`aria-label`,`Navigation submenu`);let d=document.createElement(`div`);d.className=`mint-navigation-submenu-header`;let f=document.createElement(`mint-button`);f.className=`mint-navigation-submenu-back`,f.setAttribute(`variant`,`ghost`),f.setAttribute(`tone`,`action`),f.setAttribute(`button-type`,`button`),f.setAttribute(`icon`,`arrow-left`),f.setAttribute(`aria-label`,`Back to main navigation`),f.addEventListener(`click`,()=>this._closeSubmenu());let p=document.createElement(`h3`);p.className=`mint-navigation-submenu-title`,d.append(f,p);let m=document.createElement(`nav`);m.className=`mint-navigation-submenu-items`,m.addEventListener(`click`,e=>{e.target.closest(`a, mint-link`)&&this.closeMenu()}),u.append(d,m),this._submenu=u,this._submenuTitle=p,this._submenuItems=m;for(let e of this._dropdowns)m.append(...e.submenuItems);s.append(this._items,l,u),a.append(o,s),this.appendChild(a),this._built=!0,this._syncMobileActions()}_syncMobileActions(){if(!this._mobileActions||!this._actions)return;let e=this._isMobileLayout()?this._mobileActions:this._actions;for(let t of this._mobileActionNodes)e.appendChild(t)}_toMintLink(e){if(e.nodeType!==Node.ELEMENT_NODE||e.tagName!==`A`)return e;let t=document.createElement(`mint-link`);for(;e.firstChild;)t.appendChild(e.firstChild);for(let n of Array.from(e.attributes))n.name!==`slot`&&t.setAttribute(n.name,n.value);return t}_createDropdown(e,t){let n=e.querySelector(`:scope > summary`),r=document.createElement(`mint-button`),i=`mint-navigation-${this._instanceId}-dropdown-${t}`,a=`${i}-popover`;if(r.id=i,r.className=`mint-navigation-dropdown-trigger`,r.setAttribute(`aria-haspopup`,`dialog`),r.setAttribute(`aria-expanded`,`false`),r.setAttribute(`aria-controls`,a),n){for(;n.firstChild;)r.appendChild(n.firstChild);n.remove()}else r.textContent=e.getAttribute(`label`)||`More`;r.setAttribute(`variant`,`ghost`),r.setAttribute(`tone`,`action`),r.setAttribute(`button-type`,`button`),r.setAttribute(`icon-position`,`right`);let o=document.createElement(`mint-popover`);o.id=a,o.className=`mint-navigation-dropdown`,o.setAttribute(`trigger-id`,i),o.setAttribute(`direction`,`down`),o.setAttribute(`aria-label`,`${r.textContent.trim()} links`);for(let t of Array.from(e.childNodes))o.appendChild(this._toMintLink(t));return{trigger:r,popover:o,observer:null}}_registerDropdown(e,t){if(!e||!t)return;t.id||=`mint-navigation-${this._instanceId}-popover-${this._dropdowns.length}`,e.classList.add(`mint-navigation-dropdown-trigger`),e.setAttribute(`aria-haspopup`,`dialog`),e.setAttribute(`aria-expanded`,String(t.hasAttribute(`open`))),e.setAttribute(`aria-controls`,t.id),t.classList.add(`mint-navigation-dropdown`),t.hasAttribute(`role`)||t.setAttribute(`role`,`group`),t.hasAttribute(`aria-label`)||t.setAttribute(`aria-label`,`${e.textContent.trim()} links`);let n=Array.from(t.querySelectorAll(`mint-link`)).map(e=>e.cloneNode(!0)),r={trigger:e,popover:t,observer:null,triggerId:t.getAttribute(`trigger-id`)||e.id,submenuItems:n};e.addEventListener(`click`,()=>{this._isMobileLayout()&&this._openSubmenu(r)}),this._dropdowns.push(r)}_observeDropdowns(){for(let e of this._dropdowns)e.observer||(e.observer=new MutationObserver(()=>{e.trigger.setAttribute(`aria-expanded`,String(e.popover.hasAttribute(`open`)))}),e.observer.observe(e.popover,{attributes:!0,attributeFilter:[`open`]}))}_isMobileLayout(){return this.getBoundingClientRect().width<=640}_syncResponsiveDropdowns(){let e=this._isMobileLayout();for(let t of this._dropdowns)e?(t.popover.hasAttribute(`open`)&&t.popover.close(),t.popover.getAttribute(`trigger-id`)&&t.popover.setAttribute(`trigger-id`,``)):t.triggerId&&t.popover.getAttribute(`trigger-id`)!==t.triggerId&&t.popover.setAttribute(`trigger-id`,t.triggerId);!e&&this._activeDropdown&&this._closeSubmenu()}_openSubmenu(e){this._isMobileLayout()&&(this._activeDropdown&&this._activeDropdown!==e&&this._activeDropdown.trigger.setAttribute(`aria-expanded`,`false`),this._activeDropdown=e,e.trigger.setAttribute(`aria-expanded`,`true`),this._submenuTitle.textContent=e.trigger.textContent.trim(),this._submenuItems.replaceChildren(...e.submenuItems),this._content.setAttribute(`data-submenu-open`,``))}_closeSubmenu(){this._activeDropdown?.trigger.setAttribute(`aria-expanded`,`false`),this._activeDropdown=null,this._content?.removeAttribute(`data-submenu-open`)}_syncAttributes(){if(this._brandLink){this._brandLink.setAttribute(`href`,this.getBrandHref());let e=this._brandLink.querySelector(`a`);e?e.textContent=this.getBrand():this._brandLink.textContent=this.getBrand()}this._items&&this._items.setAttribute(`aria-label`,this.getLabel()),this._syncOpenState()}_syncOpenState(){if(!this._toggle)return;let e=this.hasAttribute(`open`);this._toggle.setAttribute(`aria-expanded`,String(e));let t=e?`Close navigation menu`:`Open navigation menu`;this._toggle.setAttribute(`aria-label`,t),this._toggleLabel&&(this._toggleLabel.textContent=t),this._toggle.setAttribute(`icon`,e?`close`:`menu`)}openMenu(){this.setAttribute(`open`,``)}closeMenu(){this._closeSubmenu(),this.removeAttribute(`open`)}toggleMenu(){this.hasAttribute(`open`)?this.closeMenu():this.openMenu()}};typeof customElements<`u`&&!customElements.get(`mint-navigation`)&&a(`mint-navigation`,en),s({name:`info`,viewBox:`0 0 24 24`,path:`M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z`,strokeLinecap:`round`,strokeLinejoin:`round`}),s({name:`success`,viewBox:`0 0 24 24`,path:`M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z`,strokeLinecap:`round`,strokeLinejoin:`round`}),s({name:`warning`,viewBox:`0 0 24 24`,path:`M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z`,strokeLinecap:`round`,strokeLinejoin:`round`}),s({name:`error`,viewBox:`0 0 24 24`,path:`M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z`,strokeLinecap:`round`,strokeLinejoin:`round`}),s({name:`close`,viewBox:`0 0 24 24`,path:`M6 18L18 6M6 6l12 12`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`3.2`});var tn=class extends HTMLElement{static get observedAttributes(){return[`heading`,`dismissable`,`tone`]}constructor(){super(),this._headingElement=null,this._iconElement=null,this._dismissButton=null,this._headerWrapper=null,this._bodyWrapper=null,this._dismissHandler=null,this._rendering=!1,this._childObserver=null,this._normalizingChildren=!1}connectedCallback(){this.render()}disconnectedCallback(){this._childObserver?.disconnect(),this._dismissButton?.removeEventListener(`click`,this._dismissHandler),this._dismissHandler=null}get heading(){return this.getAttribute(`heading`)??``}set heading(e){this.setAttribute(`heading`,String(e??``))}get tone(){return this.getTone()}set tone(e){this.setAttribute(`tone`,e)}get dismissable(){return this.isDismissable()}set dismissable(e){this.setAttribute(`dismissable`,String(!!e))}get dismissible(){return this.dismissable}set dismissible(e){this.dismissable=e}cleanupDismissListener(){this._dismissButton&&this._dismissHandler&&this._dismissButton.removeEventListener(`click`,this._dismissHandler),this._dismissHandler=null}attributeChangedCallback(e,t,n){t!==n&&this.render()}getHeading(){return this.getAttribute(`heading`)||``}getTone(){let e=this.getAttribute(`tone`);return e===`info`||e===`success`||e===`warning`||e===`danger`?e:`info`}isDismissable(){return this.getAttribute(`dismissable`)===`true`}getIconName(){switch(this.getTone()){case`info`:return`info`;case`success`:return`success`;case`warning`:return`warning`;case`danger`:return`error`;default:return`info`}}getAriaLive(){return this.getTone()===`danger`?`assertive`:`polite`}render(){if(!(this._rendering||!this.isConnected)){this._rendering=!0;try{this.renderContent()}finally{this._rendering=!1}}}renderContent(){this._childObserver?.disconnect();let e=this.getTone(),t=this.getHeading(),n=this.isDismissable(),r=this.getAriaLive();this.setAttribute(`role`,e===`danger`?`alert`:`status`),this.setAttribute(`aria-live`,r),e===`danger`?this.setAttribute(`aria-atomic`,`true`):this.removeAttribute(`aria-atomic`);let i=[];for(this._bodyWrapper?Array.from(this._bodyWrapper.childNodes).forEach(e=>{i.push(e)}):Array.from(this.childNodes).forEach(e=>{e!==this._headerWrapper&&e!==this._bodyWrapper&&e!==this._iconElement&&e!==this._headingElement&&e!==this._dismissButton&&i.push(e)}),this.cleanupDismissListener();this.firstChild;)this.removeChild(this.firstChild);if(this._headerWrapper=null,this._bodyWrapper=null,this._iconElement=null,this._headingElement=null,this._dismissButton=null,this._headerWrapper=document.createElement(`div`),this._headerWrapper.className=`mint-alert-header`,this._iconElement=document.createElement(`mint-icon`),this._iconElement.setAttribute(`name`,this.getIconName()),this._iconElement.className=`mint-alert-icon`,this._headerWrapper.appendChild(this._iconElement),this._headingElement=document.createElement(`mint-text`),this._headingElement.className=`mint-alert-heading`,this._headingElement.textContent=t||``,this._headerWrapper.appendChild(this._headingElement),n){this._dismissButton=document.createElement(`button`),this._dismissButton.className=`mint-alert-dismiss`,this._dismissButton.setAttribute(`aria-label`,`Dismiss alert`),this._dismissButton.setAttribute(`type`,`button`);let e=document.createElement(`mint-icon`);e.setAttribute(`name`,`close`),e.className=`mint-alert-close-icon`,this._dismissButton.appendChild(e),this._dismissHandler=e=>{e.preventDefault(),e.stopPropagation(),this.dispatchEvent(new CustomEvent(`dismissed`,{bubbles:!0,composed:!0})),this.remove()},this._dismissButton.addEventListener(`click`,this._dismissHandler),this._headerWrapper.appendChild(this._dismissButton)}this._bodyWrapper=document.createElement(`div`),this._bodyWrapper.className=`mint-alert-body`,i.forEach(e=>{this._bodyWrapper.appendChild(e)}),this.appendChild(this._headerWrapper),this.appendChild(this._bodyWrapper),this._childObserver||=new MutationObserver(()=>this.normalizeConsumerChildren()),this._childObserver.observe(this,{childList:!0})}normalizeConsumerChildren(){if(!(this._normalizingChildren||!this._bodyWrapper)){this._normalizingChildren=!0;try{Array.from(this.childNodes).forEach(e=>{e!==this._headerWrapper&&e!==this._bodyWrapper&&this._bodyWrapper.appendChild(e)})}finally{this._normalizingChildren=!1}}}};customElements.get(`mint-alert`)||a(`mint-alert`,tn);var H=class extends HTMLElement{constructor(...e){super(...e),this._lastScrollY=0,this._scrollHandler=null}connectedCallback(){this.classList.add(`mint-bottom-navigation`),this.setAttribute(`role`,`navigation`),this.hasAttribute(`aria-label`)||this.setAttribute(`aria-label`,`Primary`),this._lastScrollY=window.scrollY,this.hasAttribute(`data-preview`)||this._attachScrollListener()}disconnectedCallback(){this._detachScrollListener()}_attachScrollListener(){this._scrollHandler||(this._scrollHandler=()=>{let e=window.scrollY;if(e<=8){this.classList.remove(`is-hidden`),this._lastScrollY=e;return}let t=e-this._lastScrollY;Math.abs(t)<4||(t>0?this.classList.add(`is-hidden`):this.classList.remove(`is-hidden`),this._lastScrollY=e)},window.addEventListener(`scroll`,this._scrollHandler,{passive:!0}))}_detachScrollListener(){this._scrollHandler&&=(window.removeEventListener(`scroll`,this._scrollHandler),null)}};customElements.get(`mint-bottom-navigation`)||a(`mint-bottom-navigation`,H);var nn=class extends HTMLElement{constructor(...e){super(...e),this._root=null}static get observedAttributes(){return[`icon`,`label`,`href`,`active`]}connectedCallback(){this.classList.add(`mint-bottom-nav-item`),this.render()}attributeChangedCallback(e,t,n){t!==n&&this.render()}_isActive(){return this.hasAttribute(`active`)&&this.getAttribute(`active`)!==`false`}_getLabel(){return this.getAttribute(`label`)||``}_getIcon(){return this.getAttribute(`icon`)||``}_getHref(){return this.getAttribute(`href`)}render(){let e=this._getHref(),t=this._getLabel(),n=this._getIcon(),r=this._isActive(),i;e?(i=document.createElement(`a`),i.href=e):(i=document.createElement(`button`),i.type=`button`),i.className=`mint-bottom-nav-link`,i.setAttribute(`aria-current`,r?`page`:`false`);let a=n.split(`-`).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `);i.setAttribute(`aria-label`,t||a||`Navigation item`);let o=document.createElement(`span`);if(o.className=`mint-bottom-nav-icon`,n){let e=document.createElement(`mint-icon`);e.setAttribute(`name`,n),e.className=`mint-bottom-nav-icon-glyph`,o.appendChild(e)}let s=document.createElement(`span`);s.className=`mint-bottom-nav-label`,s.textContent=t,i.appendChild(o),i.appendChild(s),this.replaceChildren(i),this._root=i}};customElements.get(`mint-bottom-nav-item`)||a(`mint-bottom-nav-item`,nn);var rn=H,an=class e extends HTMLElement{static get observedAttributes(){return[`type`,`data`,`width`,`height`,`show-legend`,`show-grid`,`show-tooltip`,`curve-tension`]}static{this.MAX_CACHE_SIZE=100}constructor(){super(),this._chartContainer=null,this._svg=null,this._tooltip=null,this._chartType=`line`,this._chartData=null,this._width=800,this._height=400,this._padding={top:20,right:20,bottom:60,left:60},this._showLegend=!0,this._showGrid=!0,this._showTooltip=!0,this._curveTension=.5,this._dataObserver=null,this._darkModeObserver=null,this._tooltipHideTimeout=null,this._lastTooltipContent=``,this._activeXValue=null,this._pinnedXValue=null,this._tooltipAnimationFrame=null,this._cachedTooltipContent=new Map,this._cachedXPositions=new Map,this._verticalLine=null,this._plotPoints=new Map,this._resizeObserver=null,this._windowResizeHandler=null,this._pieChartTimeouts=new Set,this._pieChartTooltipShown=!1,this._pieChartClickOutsideHandler=null,this._pieChartGroup=null,this._chartClickOutsideHandler=null,this._chartTooltipScrollHandler=null,this._cachedBounds={bounds:null,dataHash:``},this._cachedYRange={range:null,dataHash:``},this._cachedXValues={values:null,dataHash:``},this._renderScheduled=!1,this._animateNextRender=!1,this._observedDataReference=null,this._observedDataFingerprint=``,this._datasetVisibility=new Map,this._widthValue=`100%`,this._heightValue=400,this._defaultColors=[`#2563eb`,`#3b82f6`,`#0d9488`,`#7c3aed`,`#d97706`,`#059669`,`#dc2626`,`#c026d3`],this._legendHeight=0,this._rotatedLabelHeight=0}connectedCallback(){this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`,`block`,`w-full`),this._setupDataObserver(),this._setupDarkModeObserver(),this._setupResizeObserver(),requestAnimationFrame(()=>{requestAnimationFrame(()=>{this.render()})})}_setupDataObserver(){let e=()=>{if(!this.isConnected)return;let e=this.data,t=null;e&&typeof e==`object`&&!Array.isArray(e)&&`datasets`in e&&(t=e);let n=``;if(t)try{n=JSON.stringify(t)}catch{n=``}t&&(t!==this._observedDataReference||n&&n!==this._observedDataFingerprint)&&(this._observedDataReference=t,this._observedDataFingerprint=n,this._chartData=t,this._animateNextRender=!0,this._cachedBounds.dataHash=``,this._cachedYRange.dataHash=``,this._cachedXValues.dataHash=``,this.render())};requestAnimationFrame(()=>{e(),requestAnimationFrame(()=>{e()})});let t=setInterval(()=>{if(!this.isConnected){clearInterval(t);return}e()},250);this._dataCheckInterval=t}_setupDarkModeObserver(){this._darkModeObserver=new MutationObserver(()=>{this.isConnected&&this.render()}),this._darkModeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`]})}disconnectedCallback(){if(this._tooltip&&this._tooltip.parentNode&&(this._tooltip.parentNode.removeChild(this._tooltip),this._tooltip=null),this._tooltipHideTimeout!==null&&(clearTimeout(this._tooltipHideTimeout),this._tooltipHideTimeout=null),this._pieChartTimeouts.forEach(e=>clearTimeout(e)),this._pieChartTimeouts.clear(),this._pieChartClickOutsideHandler&&=(document.removeEventListener(`click`,this._pieChartClickOutsideHandler,!0),null),this._chartClickOutsideHandler&&=(document.removeEventListener(`click`,this._chartClickOutsideHandler,!0),null),this._pieChartTooltipShown=!1,this._pieChartGroup=null,this._pinnedXValue=null,this._tooltipAnimationFrame!==null&&(cancelAnimationFrame(this._tooltipAnimationFrame),this._tooltipAnimationFrame=null),this._dataObserver&&=(this._dataObserver.disconnect(),null),this._darkModeObserver&&=(this._darkModeObserver.disconnect(),null),this._dataCheckInterval&&=(clearInterval(this._dataCheckInterval),null),this._svg&&(this._chartTooltipMouseMove&&=(this._svg.removeEventListener(`mousemove`,this._chartTooltipMouseMove),null),this._chartTooltipMouseLeave&&=(this._svg.removeEventListener(`mouseleave`,this._chartTooltipMouseLeave),null),this._chartTooltipTouchStart&&=(this._svg.removeEventListener(`touchstart`,this._chartTooltipTouchStart),null),this._chartTooltipTouchMove&&=(this._svg.removeEventListener(`touchmove`,this._chartTooltipTouchMove),null),this._chartTooltipTouchEnd&&=(this._svg.removeEventListener(`touchend`,this._chartTooltipTouchEnd),null)),this._chartTooltipScrollHandler){window.removeEventListener(`scroll`,this._chartTooltipScrollHandler,!0),this._chartContainer&&this._chartContainer.removeEventListener(`scroll`,this._chartTooltipScrollHandler,!0);let e=this.parentElement;for(;e;)e.removeEventListener(`scroll`,this._chartTooltipScrollHandler,!0),e=e.parentElement;this._chartTooltipScrollHandler=null}this._resizeObserver&&=(this._resizeObserver.disconnect(),null),this._windowResizeHandler&&=(window.removeEventListener(`resize`,this._windowResizeHandler),null),this._cachedTooltipContent.clear(),this._cachedXPositions.clear(),this._plotPoints.clear(),this._cachedBounds={bounds:null,dataHash:``},this._cachedYRange={range:null,dataHash:``},this._cachedXValues={values:null,dataHash:``}}_handleResize(){if(!this.isConnected)return;let e=this.getBoundingClientRect(),t=e.width||this.parentElement?.clientWidth||800,n=e.height||this.parentElement?.clientHeight||400,r=this._calculateDimension(this._widthValue,t,t),i=this._calculateDimension(this._heightValue,n,400);(r!==this._width||i!==this._height)&&(this._width=r,this._height=i,this.render())}_setupResizeObserver(){this._resizeObserver&&=(this._resizeObserver.disconnect(),null),this._windowResizeHandler&&=(window.removeEventListener(`resize`,this._windowResizeHandler),null);let e=null,t=()=>{e&&clearTimeout(e),e=window.setTimeout(()=>{this._handleResize()},100)};this._windowResizeHandler=t,this._resizeObserver=new ResizeObserver(()=>{t()}),this._resizeObserver.observe(this),window.addEventListener(`resize`,t)}attributeChangedCallback(e,t,n){if(t!==n){if(e===`data`){if(n)try{this._chartData=JSON.parse(n)}catch(e){console.error(`mint-chart: Invalid data JSON`,e),this._chartData=null}else this._chartData=null;this._invalidateDataCaches(),this._animateNextRender=!0}(e===`width`||e===`height`)&&this.isConnected&&(t&&t.endsWith(`%`))!==(n&&n.endsWith(`%`))&&this._setupResizeObserver(),this.isConnected&&requestAnimationFrame(()=>{this.render()})}}get type(){let e=this.getAttribute(`type`)||`line`;return e===`line`||e===`bar`||e===`area`||e===`pie`?e:`line`}set type(e){this.setAttribute(`type`,e)}get data(){return this._chartData}set data(e){if(typeof e==`string`)try{this._chartData=JSON.parse(e)}catch(e){console.error(`mint-chart: Invalid data JSON`,e),this._chartData=null}else this._chartData=e;this._invalidateDataCaches(),this._animateNextRender=!0,this.isConnected&&requestAnimationFrame(()=>{this.render()})}get width(){let e=this.getAttribute(`width`);if(!e)return this._widthValue;if(e.endsWith(`%`))return e;let t=parseInt(e,10);return isNaN(t)?this._widthValue:t}set width(e){this.setAttribute(`width`,e.toString())}get height(){let e=this.getAttribute(`height`);if(!e)return this._heightValue;if(e.endsWith(`%`))return e;let t=parseInt(e,10);return isNaN(t)?this._heightValue:t}set height(e){this.setAttribute(`height`,e.toString())}_calculateDimension(e,t,n){if(typeof e==`number`)return e;if(typeof e==`string`&&e.endsWith(`%`)){let n=parseFloat(e);if(!isNaN(n))return t*n/100}return n}_scheduleRender(){this._animateNextRender=!0,this._syncObservedData(),!this._renderScheduled&&(this._renderScheduled=!0,requestAnimationFrame(()=>{this._renderScheduled=!1,this.render()}))}_invalidateDataCaches(){this._cachedBounds.dataHash=``,this._cachedYRange.dataHash=``,this._cachedXValues.dataHash=``,this._cachedTooltipContent?.clear()}_syncObservedData(){this._observedDataReference=this._chartData;try{this._observedDataFingerprint=this._chartData?JSON.stringify(this._chartData):``}catch{this._observedDataFingerprint=``}}_isDatasetVisible(e,t){if(e.id){let t=this._datasetVisibility.get(e.id);if(t!==void 0)return t}return e.visible!==!1}_initializeDatasetVisibility(){this._chartData&&this._chartData.datasets.forEach((e,t)=>{e.id&&(this._datasetVisibility.has(e.id)||this._datasetVisibility.set(e.id,e.visible!==!1))})}render(){if(!this.isConnected)return;let e=this._animateNextRender&&!window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches&&this._svg?this._svg.cloneNode(!0):null;this._animateNextRender=!1,this._plotPoints.clear(),this._activeXValue=null,this._cachedTooltipContent?.clear(),this._cachedXPositions?.clear(),this._chartType=this.type;let t=this.data;if(t&&typeof t==`object`&&!Array.isArray(t)&&`datasets`in t&&(this._chartData=t),!this._chartData){let e=this.getAttribute(`data`);if(e)try{this._chartData=JSON.parse(e)}catch(e){console.error(`mint-chart: Invalid data JSON`,e),this._chartData=null}}this._widthValue=this.width,this._heightValue=this.height;let n=this.getBoundingClientRect(),r=n.width||this.parentElement?.clientWidth||800,i=n.height||this.parentElement?.clientHeight||400;this._width=this._calculateDimension(this._widthValue,r,r),this._height=this._calculateDimension(this._heightValue,i,400),this._showLegend=this.getAttribute(`show-legend`)!==`false`,this._showGrid=this.getAttribute(`show-grid`)!==`false`,this._showTooltip=this.getAttribute(`show-tooltip`)!==`false`;let a=this.getAttribute(`curve-tension`);if(a!==null){let e=parseFloat(a);this._curveTension=isNaN(e)?.5:Math.max(0,Math.min(1,e))}else this._curveTension=.5;if(!this._chartData||!this._chartData.datasets||this._chartData.datasets.length===0){this.innerHTML=`<div class="p-4 text-gray-500">No chart data provided</div>`;return}this.innerHTML=``,this._chartContainer=document.createElement(`div`),this._chartContainer.className=`relative w-full`,this._chartContainer.style.position=`relative`,typeof this._widthValue==`string`&&this._widthValue.endsWith(`%`)?this._chartContainer.style.width=this._widthValue:this._chartContainer.style.width=`${this._width}px`,typeof this._heightValue==`string`&&this._heightValue.endsWith(`%`)?this._chartContainer.style.height=this._heightValue:this._chartContainer.style.height=`${this._height}px`,this.appendChild(this._chartContainer),this._svg=document.createElementNS(`http://www.w3.org/2000/svg`,`svg`),this._svg.setAttribute(`width`,this._width.toString()),this._svg.setAttribute(`height`,this._height.toString()),this._svg.setAttribute(`viewBox`,`0 0 ${this._width} ${this._height}`),this._svg.setAttribute(`class`,`w-full h-full`),this._svg.setAttribute(`role`,`img`);let o=this._chartData.datasets.map(e=>e.name).filter(Boolean),s=this.getAttribute(`aria-label`)?.trim()||`${this.type} chart${o.length?` showing ${o.join(`, `)}`:``}. ${Math.max(0,...this._chartData.datasets.map(e=>e.data.length))} data points.`,c=`${this.id||`mint-chart-${Math.random().toString(36).slice(2,10)}`}-data`;this._svg.setAttribute(`aria-label`,s),this._svg.setAttribute(`aria-describedby`,c),this._chartContainer&&this._svg&&(e&&(e.style.position=`absolute`,e.style.inset=`0`,e.style.width=`100%`,e.style.height=`100%`,e.style.pointerEvents=`none`,e.style.zIndex=`1`,e.style.opacity=`1`,e.style.transition=`opacity 260ms ease`,this._chartContainer.appendChild(e),this._svg.style.position=`relative`,this._svg.style.zIndex=`0`,this._svg.style.opacity=`0`,this._svg.style.transition=`opacity 260ms ease`),this._chartContainer.appendChild(this._svg));let l=document.createElement(`table`);l.id=c,Object.assign(l.style,{position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,top:`0`,left:`0`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,border:`0`});let u=document.createElement(`caption`);u.textContent=`Data for ${s}`,l.appendChild(u);let d=document.createElement(`thead`),f=document.createElement(`tr`),p=document.createElement(`th`);p.scope=`col`,p.textContent=`Category`,f.appendChild(p),this._chartData.datasets.forEach(e=>{let t=document.createElement(`th`);t.scope=`col`,t.textContent=e.name||`Series`,f.appendChild(t)}),d.appendChild(f),l.appendChild(d);let m=document.createElement(`tbody`),h=Math.max(0,...this._chartData.datasets.map(e=>e.data.length));for(let e=0;e<h;e+=1){let t=document.createElement(`tr`),n=document.createElement(`th`);n.scope=`row`,n.textContent=String(this._chartData.datasets.find(t=>t.data[e])?.data[e]?.x??e+1),t.appendChild(n),this._chartData.datasets.forEach(n=>{let r=document.createElement(`td`),i=n.data[e];r.textContent=i?this._formatValue(i.y,n):``,t.appendChild(r)}),m.appendChild(t)}switch(l.appendChild(m),this.appendChild(l),this._showTooltip&&this._createTooltip(),this._initializeDatasetVisibility(),this._calculateRotatedLabelHeight(),this._showLegend?this._legendHeight=this._calculateLegendHeight():this._legendHeight=0,this._showLegend&&this._renderLegend(),this._chartType!==`pie`&&this._pieChartClickOutsideHandler&&(document.removeEventListener(`click`,this._pieChartClickOutsideHandler,!0),this._pieChartClickOutsideHandler=null,this._pieChartTooltipShown=!1,this._pieChartGroup=null),this._pinnedXValue=null,this._chartType){case`line`:this._renderLineChart();break;case`bar`:this._renderBarChart();break;case`area`:this._renderAreaChart();break;case`pie`:this._renderPieChart();break}if(this._showTooltip&&this._chartType!==`pie`&&(this._setupChartTooltip(),this._setupTooltipScrollHandler()),this._createVerticalLine(),e&&this._svg){let t=this._svg;requestAnimationFrame(()=>requestAnimationFrame(()=>{t.isConnected&&(e.style.opacity=`0`,t.style.opacity=`1`,window.setTimeout(()=>e.remove(),280))}))}}_createTooltip(){this._tooltip&&this._tooltip.parentNode&&this._tooltip.parentNode.removeChild(this._tooltip),this._tooltip=document.createElement(`div`),this._tooltip.className=`fixed pointer-events-none z-50 bg-gray-900 dark:bg-mint-elevated text-white text-xs rounded px-2 py-1 shadow-lg opacity-0`,this._tooltip.style.display=`none`,document.body.appendChild(this._tooltip)}_showTooltipAt(e,t,n){if(!this._tooltip)return;this._tooltipHideTimeout!==null&&(clearTimeout(this._tooltipHideTimeout),this._tooltipHideTimeout=null),this._lastTooltipContent!==n&&(this._tooltip.innerHTML=n,this._lastTooltipContent=n),(this._tooltip.style.display===`none`||this._tooltip.style.opacity===`0`)&&(this._tooltip.style.display=`block`,this._tooltip.style.opacity=`1`,this._tooltip.style.padding=`8px 12px`);let r=this._tooltip.getBoundingClientRect(),i=window.innerWidth,a=window.innerHeight,o=e+10,s=t-r.height-8;o+r.width>i&&(o=e-r.width-10),o<0&&(o=10),s<0&&(s=t+20),s+r.height>a&&(s=t-r.height-8,s<0&&(s=10));let c=`${o}px`,l=`${s}px`;this._tooltip.style.left!==c&&(this._tooltip.style.left=c),this._tooltip.style.top!==l&&(this._tooltip.style.top=l)}_hideTooltip(){this._tooltip&&(this._tooltipHideTimeout!==null&&(clearTimeout(this._tooltipHideTimeout),this._tooltipHideTimeout=null),this._tooltip.style.opacity=`0`,this._tooltipHideTimeout=window.setTimeout(()=>{this._tooltip&&(this._tooltip.style.display=`none`),this._tooltipHideTimeout=null},200))}_createVerticalLine(){if(!this._svg)return;this._verticalLine&&this._verticalLine.parentNode&&this._verticalLine.parentNode.removeChild(this._verticalLine),this._verticalLine=document.createElementNS(`http://www.w3.org/2000/svg`,`line`);let e=document.documentElement.classList.contains(`dark`);this._verticalLine.setAttribute(`stroke`,e?`#9ca3af`:`#6b7280`),this._verticalLine.setAttribute(`stroke-width`,`1`),this._verticalLine.setAttribute(`stroke-dasharray`,`4,2`),this._verticalLine.style.opacity=`0`,this._verticalLine.style.pointerEvents=`none`;let t=this._svg.querySelector(`.chart-legend`);t&&t.parentNode?t.parentNode.insertBefore(this._verticalLine,t):this._svg.appendChild(this._verticalLine)}_showVerticalLineAtX(e,t){if(!this._verticalLine)return;let n=this._chartType===`bar`?this._scaleXForBarChart(e,t):this._scaleX(e,t);this._verticalLine.setAttribute(`x1`,n.toString()),this._verticalLine.setAttribute(`y1`,t.y.toString()),this._verticalLine.setAttribute(`x2`,n.toString()),this._verticalLine.setAttribute(`y2`,(t.y+t.height).toString()),this._verticalLine.style.opacity=`1`}_hideVerticalLine(){this._verticalLine&&(this._verticalLine.style.opacity=`0`)}_showPlotPointsForX(e){this._plotPoints.forEach(e=>{e.forEach(e=>{e.style.opacity=`0`})});let t=String(e),n=this._plotPoints.get(t);n&&n.forEach(e=>{e.style.opacity=`1`})}_hidePlotPoints(){this._plotPoints.forEach(e=>{e.forEach(e=>{e.style.opacity=`0`})})}_calculateMaxYAxisLabelWidth(){if(!this._showGrid||!this._chartData)return 0;let e=document.createElement(`canvas`).getContext(`2d`);if(!e)return 60;e.font=`12px system-ui, -apple-system, sans-serif`;let t=this._showLegend?Math.max(this._legendHeight,60):0,n=this._height-t,r=Math.floor(n/35),i=Math.min(5,r),a=0;for(let t=0;t<=i;t++){let n=this._getYRange(),r=n.max-(n.max-n.min)/i*t,o=this._formatYAxisValue(r),s=e.measureText(o);a=Math.max(a,s.width)}return Math.ceil(a)+20}_getChartBounds(){let e=this._calculateMaxYAxisLabelWidth(),t=`${this._width}-${this._height}-${this._showGrid}-${this._showLegend}-${this._legendHeight}-${e}-${this._rotatedLabelHeight}`;if(this._cachedBounds.bounds&&this._cachedBounds.dataHash===t)return this._cachedBounds.bounds;let n=0,r=0;this._showGrid&&(n=e+10);let i=(this._rotatedLabelHeight>0?30:20)+this._rotatedLabelHeight+12,a=i;this._showLegend&&(a=i+20+Math.max(this._legendHeight,60));let o=this._height-0-n-0,s=o-a,c=1;if(s<100&&a>0){let e=o-100;e>0?(c=Math.min(1,e/a),c=Math.max(.5,c)):c=.5}r=a*c;let l=this._width*.3,u=n,d=1;n>l&&(d=l/n,u=l);let f={width:(this._width-u-0)*d,height:this._height-0-r,x:u,y:0};return this._cachedBounds={bounds:f,dataHash:t},f}_getAllDataPoints(){if(!this._chartData)return[];let e=[];return this._chartData.datasets.forEach((t,n)=>{this._isDatasetVisible(t,n)&&e.push(...t.data)}),e}_getXValues(){if(!this._chartData)return[];let e=JSON.stringify(this._chartData.labels)+JSON.stringify(this._chartData.datasets.map(e=>e.data.map(e=>e.x)));if(this._cachedXValues.values&&this._cachedXValues.dataHash===e)return this._cachedXValues.values;if(this._chartData.labels&&this._chartData.labels.length>0)return this._cachedXValues={values:this._chartData.labels,dataHash:e},this._chartData.labels;let t=new Set;this._chartData.datasets.forEach((e,n)=>{this._isDatasetVisible(e,n)&&e.data.forEach(e=>{t.add(e.x)})});let n=Array.from(t).sort((e,t)=>{if(typeof e==`number`&&typeof t==`number`)return e-t;let n=String(e),r=String(t),i=/^([A-Za-z]{3})\s+(\d{4})$/,a=n.match(i),o=r.match(i);if(a&&o){let e=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],t=e.indexOf(a[1]),n=e.indexOf(o[1]),r=parseInt(a[2]),i=parseInt(o[2]);return r===i?t-n:r-i}return n.localeCompare(r)});return this._cachedXValues={values:n,dataHash:e},n}_getYRange(){if(!this._chartData)return{min:0,max:100};let e=JSON.stringify(this._chartData.datasets.map(e=>e.data.map(e=>e.y)));if(this._cachedYRange.range&&this._cachedYRange.dataHash===e)return this._cachedYRange.range;let t=this._getAllDataPoints();if(t.length===0){let t={min:0,max:100};return this._cachedYRange={range:t,dataHash:e},t}let n=t.map(e=>e.y),r=Math.min(...n),i=Math.max(...n),a=(i-r)*.1,o={min:Math.max(0,r-a),max:i+a};return this._cachedYRange={range:o,dataHash:e},o}_hasDecimalValues(){return this._getAllDataPoints().some(e=>e.y%1!=0)}_formatValueByString(e,t){switch(t.toLowerCase()){case`currency`:case`currency-usd`:return new Intl.NumberFormat(`en-US`,{style:`currency`,currency:`USD`}).format(e);case`currency-eur`:return new Intl.NumberFormat(`en-US`,{style:`currency`,currency:`EUR`}).format(e);case`currency-gbp`:return new Intl.NumberFormat(`en-US`,{style:`currency`,currency:`GBP`}).format(e);case`number`:case`number-with-commas`:return new Intl.NumberFormat(`en-US`).format(e);case`percent`:return new Intl.NumberFormat(`en-US`,{style:`percent`,minimumFractionDigits:1}).format(e/100);default:return this._hasDecimalValues()&&e%1!=0?e.toFixed(1):Math.round(e).toString()}}_formatXAxisValue(e){if(this._chartData?.formatXAxis){if(typeof this._chartData.formatXAxis==`function`)return this._chartData.formatXAxis(e);if(typeof this._chartData.formatXAxis==`string`)return String(e)}return String(e)}_escapeHtmlForTooltip(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}_tooltipXHeadingHtml(e){return`<strong>${this._escapeHtmlForTooltip(this._formatXAxisValue(e))}</strong><br/>`}_formatYAxisValue(e){if(this._chartData?.formatYAxis){if(typeof this._chartData.formatYAxis==`function`)return this._chartData.formatYAxis(e);if(typeof this._chartData.formatYAxis==`string`)return this._formatValueByString(e,this._chartData.formatYAxis)}if(this._chartData?.datasets?.[0]?.formatValue){if(typeof this._chartData.datasets[0].formatValue==`function`)return this._chartData.datasets[0].formatValue(e);if(typeof this._chartData.datasets[0].formatValue==`string`)return this._formatValueByString(e,this._chartData.datasets[0].formatValue)}return this._hasDecimalValues()&&e%1!=0?e.toFixed(1):Math.round(e).toString()}_formatValue(e,t){if(t.formatValue){if(typeof t.formatValue==`function`)return t.formatValue(e);if(typeof t.formatValue==`string`)return this._formatValueByString(e,t.formatValue)}return String(e)}_getAllDatasetsAtX(e){if(!this._chartData)return[];let t=[];return this._chartData.datasets.forEach((n,r)=>{if(!this._isDatasetVisible(n,r))return;let i=n.data.find(t=>String(t.x)===String(e));if(i){let e=this._getDatasetColor(n,r),a=this._formatValue(i.y,n);t.push({name:n.name,value:i.y,color:e,formattedValue:a})}}),t}_findNearestXValue(e){if(!this._chartData)return null;let t=this._getChartBounds(),n=this._getXValues();if(n.length===0)return null;let r=this._chartType===`bar`,i=null,a=1/0;return n.forEach(n=>{let o=r?this._scaleXForBarChart(n,t):this._scaleX(n,t),s=Math.abs(e-o);s<a&&(a=s,i=n)}),i}_setupTooltipScrollHandler(){if(this._chartTooltipScrollHandler){window.removeEventListener(`scroll`,this._chartTooltipScrollHandler,!0),this._chartContainer&&this._chartContainer.removeEventListener(`scroll`,this._chartTooltipScrollHandler,!0);let e=this.parentElement;for(;e;)e.removeEventListener(`scroll`,this._chartTooltipScrollHandler,!0),e=e.parentElement}this._chartTooltipScrollHandler=()=>{this._hideTooltip(),this._pinnedXValue=null},window.addEventListener(`scroll`,this._chartTooltipScrollHandler,!0),this._chartContainer&&this._chartContainer.addEventListener(`scroll`,this._chartTooltipScrollHandler,!0);let e=this.parentElement;for(;e;){let t=window.getComputedStyle(e),n=t.overflow,r=t.overflowY;(n===`auto`||n===`scroll`||r===`auto`||r===`scroll`)&&e.addEventListener(`scroll`,this._chartTooltipScrollHandler,!0),e=e.parentElement}}_setupChartTooltip(){if(!this._svg||!this._showTooltip)return;this._chartTooltipMouseMove&&this._svg.removeEventListener(`mousemove`,this._chartTooltipMouseMove),this._chartTooltipMouseLeave&&this._svg.removeEventListener(`mouseleave`,this._chartTooltipMouseLeave),this._chartTooltipClick&&this._svg.removeEventListener(`click`,this._chartTooltipClick),this._chartTooltipTouchStart&&this._svg.removeEventListener(`touchstart`,this._chartTooltipTouchStart),this._chartTooltipTouchMove&&this._svg.removeEventListener(`touchmove`,this._chartTooltipTouchMove),this._chartTooltipTouchEnd&&this._svg.removeEventListener(`touchend`,this._chartTooltipTouchEnd),this._cachedTooltipContent.clear(),this._cachedXPositions.clear();let t=this._getChartBounds(),n=0,r=0,i=i=>{!this._chartContainer||!this._svg||(n=i.clientX,r=i.clientY,this._tooltipAnimationFrame!==null&&cancelAnimationFrame(this._tooltipAnimationFrame),this._tooltipAnimationFrame=requestAnimationFrame(()=>{if(this._tooltipAnimationFrame=null,!this._svg)return;let i=this._svg.getBoundingClientRect(),a=n-i.left,o=r-i.top;if(a<t.x||a>t.x+t.width||o<t.y||o>t.y+t.height){this._hideTooltip(),this._hidePlotPoints(),this._hideVerticalLine(),this._activeXValue=null;return}let s=this._findNearestXValue(a);if(!s){this._hideTooltip(),this._hidePlotPoints(),this._hideVerticalLine(),this._activeXValue=null;return}if(this._pinnedXValue!==null&&this._pinnedXValue===s){let e=this._pinnedXValue,i=this._getAllDatasetsAtX(e);if(i.length>0){this._activeXValue=e,this._showPlotPointsForX(e),this._showVerticalLineAtX(e,t);let a=this._cachedTooltipContent.get(e);a||(a=this._tooltipXHeadingHtml(e),i.forEach(e=>{a+=`<div style="display: flex; align-items: center; gap: 6px; margin-top: 4px;">
|
|
105
105
|
<span style="display: inline-block; width: 12px; height: 12px; background-color: ${e.color}; border-radius: 2px;"></span>
|
|
106
106
|
<span>${e.name}: ${e.formattedValue}</span>
|
|
107
107
|
</div>`}),this._cachedTooltipContent.set(e,a)),this._updateTooltipPosition(n,r),this._lastTooltipContent!==a&&this._showTooltipAt(n,r,a);return}}if(this._activeXValue===s){this._updateTooltipPosition(n,r);return}let c=this._getAllDatasetsAtX(s);if(c.length===0){this._hideTooltip(),this._hidePlotPoints(),this._hideVerticalLine();return}this._activeXValue=s,this._showPlotPointsForX(s),this._showVerticalLineAtX(s,t);let l=this._cachedTooltipContent.get(s);if(!l){if(l=this._tooltipXHeadingHtml(s),c.forEach(e=>{l+=`<div style="display: flex; align-items: center; gap: 6px; margin-top: 4px;">
|