import{A as ke,n as G,h as ye,y as ne,e as se,B as C}from"./B-4V-jI8.js";import{i as Ie}from"./DRSikRWz.js";import{aY as ce,a5 as le,a7 as De}from"./c625DOTJ.js";function mt(t,e,n,r=!0){const o=e-n;return o<=0?r?t[t.length-1]:t[0]:t[o]}function yt(t,e,n,r=!0){const o=e+n;return o>t.length-1?r?t[0]:t[t.length-1]:t[o]}function gt(t,e,n=!0){return e===t.length-1?n?t[0]:t[e]:t[e+1]}function wt(t,e,n=!0){return e<=0?n?t[t.length-1]:t[0]:t[e-1]}function Ae(t){return t[t.length-1]}function Tt(t,e){return t.map((n,r)=>t[(e+r)%t.length])}function Nt(t,e,n=ke){const r=e.findIndex(o=>n(o,t));return r!==-1?e.splice(r,1):e.push(t),e}function Oe(t){return new Promise(e=>setTimeout(e,t))}const J="data-melt-scroll-lock";function fe(t,e){if(!t)return;const n=t.style.cssText;return Object.assign(t.style,e),()=>{t.style.cssText=n}}function Ce(t,e,n){if(!t)return;const r=t.style.getPropertyValue(e);return t.style.setProperty(e,n),()=>{r?t.style.setProperty(e,r):t.style.removeProperty(e)}}function Re(t){const e=t.getBoundingClientRect().left;return Math.round(e)+t.scrollLeft?"paddingLeft":"paddingRight"}function Et(t){const e=document,n=e.defaultView??window,{documentElement:r,body:o}=e;if(o.hasAttribute(J))return G;o.setAttribute(J,"");const a=n.innerWidth-r.clientWidth,f=()=>Ce(r,"--scrollbar-width",`${a}px`),l=Re(r),v=n.getComputedStyle(o)[l],w=()=>fe(o,{overflow:"hidden",[l]:`calc(${v} + ${a}px)`}),p=()=>{const{scrollX:F,scrollY:m,visualViewport:S}=n,I=(S==null?void 0:S.offsetLeft)??0,P=(S==null?void 0:S.offsetTop)??0,k=fe(o,{position:"fixed",overflow:"hidden",top:`${-(m-Math.floor(P))}px`,left:`${-(F-Math.floor(I))}px`,right:"0",[l]:`calc(${v} + ${a}px)`});return()=>{k==null||k(),n.scrollTo(F,m)}},T=[f(),Ie()?p():w()];return()=>{T.forEach(F=>F==null?void 0:F()),o.removeAttribute(J)}}function xe(t){let e=t.parentElement;for(;ye(e)&&!e.hasAttribute("data-portal");)e=e.parentElement;return e||"body"}function Ft(t,e){return e!==void 0?e:xe(t)==="body"?document.body:null}/*! * tabbable 6.2.0 * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE */var ge=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[href]:not([inert])","button:not([inert])","[tabindex]:not(slot):not([inert])","audio[controls]:not([inert])","video[controls]:not([inert])",'[contenteditable]:not([contenteditable="false"]):not([inert])',"details>summary:first-of-type:not([inert])","details:not([inert])"],W=ge.join(","),we=typeof Element>"u",x=we?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,U=!we&&Element.prototype.getRootNode?function(t){var e;return t==null||(e=t.getRootNode)===null||e===void 0?void 0:e.call(t)}:function(t){return t==null?void 0:t.ownerDocument},Y=function t(e,n){var r;n===void 0&&(n=!0);var o=e==null||(r=e.getAttribute)===null||r===void 0?void 0:r.call(e,"inert"),s=o===""||o==="true",a=s||n&&e&&t(e.parentNode);return a},Le=function(e){var n,r=e==null||(n=e.getAttribute)===null||n===void 0?void 0:n.call(e,"contenteditable");return r===""||r==="true"},Te=function(e,n,r){if(Y(e))return[];var o=Array.prototype.slice.apply(e.querySelectorAll(W));return n&&x.call(e,W)&&o.unshift(e),o=o.filter(r),o},Ne=function t(e,n,r){for(var o=[],s=Array.from(e);s.length;){var a=s.shift();if(!Y(a,!1))if(a.tagName==="SLOT"){var f=a.assignedElements(),l=f.length?f:a.children,v=t(l,!0,r);r.flatten?o.push.apply(o,v):o.push({scopeParent:a,candidates:v})}else{var w=x.call(a,W);w&&r.filter(a)&&(n||!e.includes(a))&&o.push(a);var p=a.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(a),T=!Y(p,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(a));if(p&&T){var F=t(p===!0?a.children:p.children,!0,r);r.flatten?o.push.apply(o,F):o.push({scopeParent:a,candidates:F})}else s.unshift.apply(s,a.children)}}return o},Ee=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},R=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||Le(e))&&!Ee(e)?0:e.tabIndex},Me=function(e,n){var r=R(e);return r<0&&n&&!Ee(e)?0:r},Be=function(e,n){return e.tabIndex===n.tabIndex?e.documentOrder-n.documentOrder:e.tabIndex-n.tabIndex},Fe=function(e){return e.tagName==="INPUT"},je=function(e){return Fe(e)&&e.type==="hidden"},Ke=function(e){var n=e.tagName==="DETAILS"&&Array.prototype.slice.apply(e.children).some(function(r){return r.tagName==="SUMMARY"});return n},$e=function(e,n){for(var r=0;rsummary:first-of-type"),a=s?e.parentElement:e;if(x.call(a,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="legacy-full"){if(typeof o=="function"){for(var f=e;e;){var l=e.parentElement,v=U(e);if(l&&!l.shadowRoot&&o(l)===!0)return de(e);e.assignedSlot?e=e.assignedSlot:!l&&v!==e.ownerDocument?e=v.host:e=l}e=f}if(Ve(e))return!e.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return de(e);return!1},Ue=function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var n=e.parentElement;n;){if(n.tagName==="FIELDSET"&&n.disabled){for(var r=0;r=0)},Xe=function t(e){var n=[],r=[];return e.forEach(function(o,s){var a=!!o.scopeParent,f=a?o.scopeParent:o,l=Me(f,a),v=a?t(o.candidates):f;l===0?a?n.push.apply(n,v):n.push(f):r.push({documentOrder:s,tabIndex:l,item:o,isScope:a,content:v})}),r.sort(Be).reduce(function(o,s){return s.isScope?o.push.apply(o,s.content):o.push(s.content),o},[]).concat(n)},He=function(e,n){n=n||{};var r;return n.getShadowRoot?r=Ne([e],n.includeContainer,{filter:ee.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:Ye}):r=Te(e,n.includeContainer,ee.bind(null,n)),Xe(r)},Ze=function(e,n){n=n||{};var r;return n.getShadowRoot?r=Ne([e],n.includeContainer,{filter:X.bind(null,n),flatten:!0,getShadowRoot:n.getShadowRoot}):r=Te(e,n.includeContainer,X.bind(null,n)),r},L=function(e,n){if(n=n||{},!e)throw new Error("No node provided");return x.call(e,W)===!1?!1:ee(n,e)},ze=ge.concat("iframe").join(","),Q=function(e,n){if(n=n||{},!e)throw new Error("No node provided");return x.call(e,ze)===!1?!1:X(n,e)};/*! * focus-trap 7.6.4 * @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE */function te(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n0){var r=e[e.length-1];r!==n&&r._setPausedState(!0)}var o=e.indexOf(n);o===-1||e.splice(o,1),e.push(n)},deactivateTrap:function(e,n){var r=e.indexOf(n);r!==-1&&e.splice(r,1),e.length>0&&!e[e.length-1]._isManuallyPaused()&&e[e.length-1]._setPausedState(!1)}},ot=function(e){return e.tagName&&e.tagName.toLowerCase()==="input"&&typeof e.select=="function"},ut=function(e){return(e==null?void 0:e.key)==="Escape"||(e==null?void 0:e.key)==="Esc"||(e==null?void 0:e.keyCode)===27},q=function(e){return(e==null?void 0:e.key)==="Tab"||(e==null?void 0:e.keyCode)===9},st=function(e){return q(e)&&!e.shiftKey},ct=function(e){return q(e)&&e.shiftKey},he=function(e){return setTimeout(e,0)},$=function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o1&&arguments[1]!==void 0?arguments[1]:{},c=u.hasFallback,b=c===void 0?!1:c,h=u.params,g=h===void 0?[]:h,d=s[i];if(typeof d=="function"&&(d=d.apply(void 0,nt(g))),d===!0&&(d=void 0),!d){if(d===void 0||d===!1)return d;throw new Error("`".concat(i,"` was specified but was not a node, or did not return a node"))}var N=d;if(typeof d=="string"){try{N=r.querySelector(d)}catch(E){throw new Error("`".concat(i,'` appears to be an invalid selector; error="').concat(E.message,'"'))}if(!N&&!b)throw new Error("`".concat(i,"` as selector refers to no known node"))}return N},p=function(){var i=w("initialFocus",{hasFallback:!0});if(i===!1)return!1;if(i===void 0||i&&!Q(i,s.tabbableOptions))if(v(r.activeElement)>=0)i=r.activeElement;else{var u=a.tabbableGroups[0],c=u&&u.firstTabbableNode;i=c||w("fallbackFocus")}else i===null&&(i=w("fallbackFocus"));if(!i)throw new Error("Your focus-trap needs to have at least one focusable element");return i},T=function(){if(a.containerGroups=a.containers.map(function(i){var u=He(i,s.tabbableOptions),c=Ze(i,s.tabbableOptions),b=u.length>0?u[0]:void 0,h=u.length>0?u[u.length-1]:void 0,g=c.find(function(E){return L(E)}),d=c.slice().reverse().find(function(E){return L(E)}),N=!!u.find(function(E){return R(E)>0});return{container:i,tabbableNodes:u,focusableNodes:c,posTabIndexesFound:N,firstTabbableNode:b,lastTabbableNode:h,firstDomTabbableNode:g,lastDomTabbableNode:d,nextTabbableNode:function(O){var j=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,A=u.indexOf(O);return A<0?j?c.slice(c.indexOf(O)+1).find(function(K){return L(K)}):c.slice(0,c.indexOf(O)).reverse().find(function(K){return L(K)}):u[A+(j?1:-1)]}}}),a.tabbableGroups=a.containerGroups.filter(function(i){return i.tabbableNodes.length>0}),a.tabbableGroups.length<=0&&!w("fallbackFocus"))throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times");if(a.containerGroups.find(function(i){return i.posTabIndexesFound})&&a.containerGroups.length>1)throw new Error("At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps.")},F=function(i){var u=i.activeElement;if(u)return u.shadowRoot&&u.shadowRoot.activeElement!==null?F(u.shadowRoot):u},m=function(i){if(i!==!1&&i!==F(document)){if(!i||!i.focus){m(p());return}i.focus({preventScroll:!!s.preventScroll}),a.mostRecentlyFocusedNode=i,ot(i)&&i.select()}},S=function(i){var u=w("setReturnFocus",{params:[i]});return u||(u===!1?!1:i)},I=function(i){var u=i.target,c=i.event,b=i.isBackward,h=b===void 0?!1:b;u=u||_(c),T();var g=null;if(a.tabbableGroups.length>0){var d=v(u,c),N=d>=0?a.containerGroups[d]:void 0;if(d<0)h?g=a.tabbableGroups[a.tabbableGroups.length-1].lastTabbableNode:g=a.tabbableGroups[0].firstTabbableNode;else if(h){var E=a.tabbableGroups.findIndex(function(Z){var z=Z.firstTabbableNode;return u===z});if(E<0&&(N.container===u||Q(u,s.tabbableOptions)&&!L(u,s.tabbableOptions)&&!N.nextTabbableNode(u,!1))&&(E=d),E>=0){var O=E===0?a.tabbableGroups.length-1:E-1,j=a.tabbableGroups[O];g=R(u)>=0?j.lastTabbableNode:j.lastDomTabbableNode}else q(c)||(g=N.nextTabbableNode(u,!1))}else{var A=a.tabbableGroups.findIndex(function(Z){var z=Z.lastTabbableNode;return u===z});if(A<0&&(N.container===u||Q(u,s.tabbableOptions)&&!L(u,s.tabbableOptions)&&!N.nextTabbableNode(u))&&(A=d),A>=0){var K=A===a.tabbableGroups.length-1?0:A+1,ue=a.tabbableGroups[K];g=R(u)>=0?ue.firstTabbableNode:ue.firstDomTabbableNode}else q(c)||(g=N.nextTabbableNode(u))}}else g=w("fallbackFocus");return g},P=function(i){var u=_(i);if(!(v(u,i)>=0)){if($(s.clickOutsideDeactivates,i)){f.deactivate({returnFocus:s.returnFocusOnDeactivate});return}$(s.allowOutsideClick,i)||i.preventDefault()}},k=function(i){var u=_(i),c=v(u,i)>=0;if(c||u instanceof Document)c&&(a.mostRecentlyFocusedNode=u);else{i.stopImmediatePropagation();var b,h=!0;if(a.mostRecentlyFocusedNode)if(R(a.mostRecentlyFocusedNode)>0){var g=v(a.mostRecentlyFocusedNode),d=a.containerGroups[g].tabbableNodes;if(d.length>0){var N=d.findIndex(function(E){return E===a.mostRecentlyFocusedNode});N>=0&&(s.isKeyForward(a.recentNavEvent)?N+1=0&&(b=d[N-1],h=!1))}}else a.containerGroups.some(function(E){return E.tabbableNodes.some(function(O){return R(O)>0})})||(h=!1);else h=!1;h&&(b=I({target:a.mostRecentlyFocusedNode,isBackward:s.isKeyBackward(a.recentNavEvent)})),m(b||a.mostRecentlyFocusedNode||p())}a.recentNavEvent=void 0},D=function(i){var u=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;a.recentNavEvent=i;var c=I({event:i,isBackward:u});c&&(q(i)&&i.preventDefault(),m(c))},M=function(i){(s.isKeyForward(i)||s.isKeyBackward(i))&&D(i,s.isKeyBackward(i))},re=function(i){ut(i)&&$(s.escapeDeactivates,i)!==!1&&(i.preventDefault(),f.deactivate())},ae=function(i){var u=_(i);v(u,i)>=0||$(s.clickOutsideDeactivates,i)||$(s.allowOutsideClick,i)||(i.preventDefault(),i.stopImmediatePropagation())},ie=function(){if(a.active)return pe.activateTrap(o,f),a.delayInitialFocusTimer=s.delayInitialFocus?he(function(){m(p())}):m(p()),r.addEventListener("focusin",k,!0),r.addEventListener("mousedown",P,{capture:!0,passive:!1}),r.addEventListener("touchstart",P,{capture:!0,passive:!1}),r.addEventListener("click",ae,{capture:!0,passive:!1}),r.addEventListener("keydown",M,{capture:!0,passive:!1}),r.addEventListener("keydown",re),f},oe=function(){if(a.active)return r.removeEventListener("focusin",k,!0),r.removeEventListener("mousedown",P,!0),r.removeEventListener("touchstart",P,!0),r.removeEventListener("click",ae,!0),r.removeEventListener("keydown",M,!0),r.removeEventListener("keydown",re),f},Pe=function(i){var u=i.some(function(c){var b=Array.from(c.removedNodes);return b.some(function(h){return h===a.mostRecentlyFocusedNode})});u&&m(p())},H=typeof window<"u"&&"MutationObserver"in window?new MutationObserver(Pe):void 0,B=function(){H&&(H.disconnect(),a.active&&!a.paused&&a.containers.map(function(i){H.observe(i,{subtree:!0,childList:!0})}))};return f={get active(){return a.active},get paused(){return a.paused},activate:function(i){if(a.active)return this;var u=l(i,"onActivate"),c=l(i,"onPostActivate"),b=l(i,"checkCanFocusTrap");b||T(),a.active=!0,a.paused=!1,a.nodeFocusedBeforeActivation=r.activeElement,u==null||u();var h=function(){b&&T(),ie(),B(),c==null||c()};return b?(b(a.containers.concat()).then(h,h),this):(h(),this)},deactivate:function(i){if(!a.active)return this;var u=be({onDeactivate:s.onDeactivate,onPostDeactivate:s.onPostDeactivate,checkCanReturnFocus:s.checkCanReturnFocus},i);clearTimeout(a.delayInitialFocusTimer),a.delayInitialFocusTimer=void 0,oe(),a.active=!1,a.paused=!1,B(),pe.deactivateTrap(o,f);var c=l(u,"onDeactivate"),b=l(u,"onPostDeactivate"),h=l(u,"checkCanReturnFocus"),g=l(u,"returnFocus","returnFocusOnDeactivate");c==null||c();var d=function(){he(function(){g&&m(S(a.nodeFocusedBeforeActivation)),b==null||b()})};return g&&h?(h(S(a.nodeFocusedBeforeActivation)).then(d,d),this):(d(),this)},pause:function(i){return a.active?(a.manuallyPaused=!0,this._setPausedState(!0,i)):this},unpause:function(i){return a.active?(a.manuallyPaused=!1,o[o.length-1]!==this?this:this._setPausedState(!1,i)):this},updateContainerElements:function(i){var u=[].concat(i).filter(Boolean);return a.containers=u.map(function(c){return typeof c=="string"?r.querySelector(c):c}),a.active&&T(),B(),this}},Object.defineProperties(f,{_isManuallyPaused:{value:function(){return a.manuallyPaused}},_setPausedState:{value:function(i,u){if(a.paused===i)return this;if(a.paused=i,i){var c=l(u,"onPause"),b=l(u,"onPostPause");c==null||c(),oe(),B(),b==null||b()}else{var h=l(u,"onUnpause"),g=l(u,"onPostUnpause");h==null||h(),T(),ie(),B(),g==null||g()}return this}}}),f.updateContainerElements(e),f};function St(t={}){let e;const{immediate:n,...r}=t,o=le(!1),s=le(!1),a=p=>e==null?void 0:e.activate(p),f=p=>{e==null||e.deactivate(p)},l=()=>{e&&(e.pause(),s.set(!0))},v=()=>{e&&(e.unpause(),s.set(!1))};return{useFocusTrap:p=>(e=ft(p,{...r,onActivate(){var T;o.set(!0),(T=t.onActivate)==null||T.call(t)},onDeactivate(){var T;o.set(!1),(T=t.onDeactivate)==null||T.call(t)}}),n&&a(),{destroy(){f(),e=void 0}}),hasFocus:ce(o),isPaused:ce(s),activate:a,deactivate:f,pause:l,unpause:v}}const V=[],Pt=(t,e)=>{let n=G;function r(){const s=V.indexOf(t);s>=0&&V.splice(s,1)}function o(s){n();const{open:a,onClose:f,shouldCloseOnInteractOutside:l,closeOnInteractOutside:v}=s;Oe(100).then(()=>{a?V.push(t):r()});function w(){return Ae(V)===t}function p(){w()&&f&&(f(),r())}function T(m){const S=m.target;ne(S)&&S&&w()&&(m.preventDefault(),m.stopPropagation(),m.stopImmediatePropagation())}function F(m){l!=null&&l(m)&&w()&&(m.preventDefault(),m.stopPropagation(),m.stopImmediatePropagation(),p())}n=dt(t,{onInteractOutsideStart:T,onInteractOutside:v?F:void 0,enabled:a}).destroy}return o(e),{update:o,destroy(){r(),n()}}},kt=(t,e="body")=>{let n;if(!ye(e)&&typeof e!="string")return{destroy:G};async function r(s){if(e=s,typeof e=="string"){if(n=document.querySelector(e),n===null&&(await De(),n=document.querySelector(e)),n===null)throw new Error(`No element found matching css selector: "${e}"`)}else if(e instanceof HTMLElement)n=e;else throw new TypeError(`Unknown portal target type: ${e===null?"null":typeof e}. Allowed types: string (CSS selector) or HTMLElement.`);t.dataset.portal="",n.appendChild(t),t.hidden=!1}function o(){t.remove()}return r(e),{update:r,destroy:o}},dt=(t,e)=>{let n=G,r=G,o=!1,s=!1,a=!1;function f(w){n(),r();const{onInteractOutside:p,onInteractOutsideStart:T,enabled:F}=w;if(!F)return;function m(P){p&&me(P,t)&&(T==null||T(P));const k=P.target;ne(k)&&Se(t,k)&&(s=!0),o=!0}function S(P){p==null||p(P)}const I=vt(t);if(typeof PointerEvent<"u"){const P=k=>{r();const D=M=>{l(M)&&S(M),v()};if(k.pointerType==="touch"){r=C(I,"click",D,{capture:!0,once:!0});return}D(k)};n=se(C(I,"pointerdown",m,!0),C(I,"pointerup",P,!0))}else{const P=D=>{a?a=!1:l(D)&&S(D),v()},k=D=>{a=!0,l(D)&&S(D),v()};n=se(C(I,"mousedown",m,!0),C(I,"mouseup",P,!0),C(I,"touchstart",m,!0),C(I,"touchend",k,!0))}}function l(w){return!!(o&&!s&&me(w,t))}function v(){o=!1,s=!1}return f(e),{update:f,destroy(){n(),r()}}};function me(t,e){if("button"in t&&t.button>0)return!1;const n=t.target;if(!ne(n))return!1;const r=n.ownerDocument;return!r||!r.documentElement.contains(n)?!1:e&&!Se(e,n)}function Se(t,e){return t===e||t.contains(e)}function vt(t){return(t==null?void 0:t.ownerDocument)??document}export{kt as a,mt as b,St as c,yt as f,Ft as g,Ae as l,gt as n,wt as p,Et as r,Oe as s,Nt as t,Pt as u,Tt as w};