epic-modals 0.0.5 → 0.0.6

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 CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  A stunning modal library with macOS-style animations, drag, resize, and dock. Supports Svelte 5, React, and vanilla JavaScript.
4
4
 
5
- **[Live Demo](https://epicmodals.eu)**
5
+ **[Live Demo](https://epicmodals.eu)** · **[NPM](https://www.npmjs.com/package/epic-modals)**
6
6
 
7
7
  ## Installation
8
8
 
@@ -3,4 +3,5 @@ export * from './config.svelte';
3
3
  export * from './state.svelte';
4
4
  export * from './stacking.svelte';
5
5
  export * from './viewport';
6
+ export * from './utils';
6
7
  //# sourceMappingURL=index.d.ts.map
@@ -1,7 +1,4 @@
1
- /**
2
- * Core utility functions
3
- */
4
- export type ModalId = string | symbol;
1
+ import { ModalId } from './types';
5
2
  /**
6
3
  * Convert a modal ID (string or Symbol) to a string suitable for DOM attributes
7
4
  * Symbols are converted using their description property
package/dist/core.js ADDED
@@ -0,0 +1 @@
1
+ import*as t from"svelte/internal/client";const e={BASE:0,DROPDOWN:100,STICKY:200,OVERLAY:300,MODAL:400,DOCK:8e3,TOAST:9e3};let n=t.state(t.proxy(e.MODAL));function i(){t.set(n,oe().zIndex.base,!0)}function s(){const e=t.get(n);return t.set(n,t.get(n)+2),e}function o(t){const n=oe();return"MODAL"===t?n.zIndex.base:"DOCK"===t?n.zIndex.dock:"TOAST"===t?n.zIndex.toast:e[t]}function a(){t.set(n,oe().zIndex.base,!0)}const r=8;function d(t,e,n,i,s={}){const{margin:o=r,allowPartialVisibility:a=!1}=s,d="undefined"!=typeof window?window.innerWidth:1920,c="undefined"!=typeof window?window.innerHeight:1080;let u,l,f,g;return a&&n>d-2*o?(u=40-n,l=d-40):(u=o,l=Math.max(o,d-n-o)),a&&i>c-2*o?(f=40-i,g=c-40):(f=o,g=Math.max(o,c-i-o)),{x:Math.max(u,Math.min(l,t)),y:Math.max(f,Math.min(g,e))}}function c(t,e,n,i,s={}){const{margin:o=r}=s,a=("undefined"!=typeof window?window.innerWidth:1920)-2*o,c=("undefined"!=typeof window?window.innerHeight:1080)-2*o,u=Math.min(n,a),l=Math.min(i,c),f=d(t,e,u,l,s);return{x:f.x,y:f.y,width:u,height:l}}function u(t,e){return Math.max(0,Math.min(t.x+t.width,e.x+e.width)-Math.max(t.x,e.x))*Math.max(0,Math.min(t.y+t.height,e.y+e.height)-Math.max(t.y,e.y))}function l(t,e,n,i,s,o){const a={x:t-o,y:e-o,width:n+2*o,height:i+2*o};let r=0;for(const t of s)r+=u(a,t);return r}function f(t){if("undefined"==typeof document)return[];const e=[];for(const n of t)try{const t=document.querySelectorAll(n);for(const n of t){const t=n.getBoundingClientRect();t.width>0&&t.height>0&&e.push({x:t.left,y:t.top,width:t.width,height:t.height})}}catch{}return e}function g(t,e,n,i,s,o,a){const r=(s-n)/2,d=(o-i)/2,c=r-a,u=d-a,l=Math.abs(t-r)/(c||1),f=Math.abs(e-d)/(u||1),g=Math.sqrt(l*l+f*f)/Math.SQRT2,h=50,p=t-a,m=s-n-a-t,x=e-a,I=o-i-a-e;let y=0;return p<h&&(y+=.3*(1-p/h)),m<h&&(y+=.3*(1-m/h)),x<h&&(y+=.2*(1-x/h)),I<h&&(y+=.2*(1-I/h)),Math.min(1,g+y)}function h(t,e,n,i={}){const{modalGap:s=16,gridResolution:o=10,avoidBounds:a=[],avoidMargin:r=16}=i,d=i.margin??s,c="undefined"!=typeof window?window.innerWidth:1920,u="undefined"!=typeof window?window.innerHeight:1080,f=a.map(t=>({x:t.x-r,y:t.y-r,width:t.width+2*r,height:t.height+2*r})),h={x:(c-t)/2,y:(u-e)/2};if(0===n.length&&0===f.length)return h;const p=d,m=Math.max(d,c-t-d),x=d,I=Math.max(d,u-e-d);if(m<=p||I<=x)return h;const y=l(h.x,h.y,t,e,n,s),w=l(h.x,h.y,t,e,f,0);if(0===y&&0===w)return h;const z=[],M=(m-p)/o,v=(I-x)/o;for(let i=0;i<=o;i++)for(let a=0;a<=o;a++){const o=p+i*M,r=x+a*v,h=l(o,r,t,e,n,s),m=l(o,r,t,e,f,0),I=g(o,r,t,e,c,u,d);z.push({pos:{x:o,y:r},modalOverlap:h,avoidOverlap:m,centerDist:I})}const O=z.filter(t=>0===t.avoidOverlap),P=O.length>0?O:z,C=t*e,D=Math.min(...P.map(t=>t.modalOverlap))/C;return P.sort((t,e)=>{if(0===O.length&&t.avoidOverlap!==e.avoidOverlap)return t.avoidOverlap-e.avoidOverlap;const n=t.modalOverlap/C,i=e.modalOverlap/C;if(D<.3){const s=.3,o=n<=s,a=i<=s;if(o&&a)return t.centerDist+.3*n-(e.centerDist+.3*i);if(o)return-1;if(a)return 1}return.6*n+.4*t.centerDist-(.6*i+.4*e.centerDist)}),P[0].pos}function p(t,e,n,i={}){const{modalGap:s=16}=i,o=i.margin??s,a="undefined"!=typeof window?window.innerWidth:1920,r="undefined"!=typeof window?window.innerHeight:1080,d=n.reduce((t,e)=>t+e.width,0)+t,c=n.length*s,u=a-2*o;if(d+c>u)return null;const l=u-d-c;n.length;const f=l/2,g=a/2,h=[...n.map(t=>({id:t.id,width:t.width,height:t.height,currentX:t.x+t.width/2,currentY:t.y,isNew:!1})),{id:"__new__",width:t,height:e,currentX:g,currentY:(r-e)/2,isNew:!0}];h.sort((t,e)=>t.currentX-e.currentX);let p=o+f;const m=new Map;let x=null;for(const t of h){const e=p;if(t.isNew)x={x:Math.round(e),y:Math.round(t.currentY)};else{const i=n.find(e=>e.id===t.id);Math.abs(e-i.x)>5&&m.set(t.id,{x:Math.round(e),y:Math.round(i.y)})}p+=t.width+s}return x?{newModalPosition:x,existingModalMoves:m}:null}function m(t){return"symbol"==typeof t?t.description??"symbol":t}let x=t.proxy(new Map),I=t.state(0);const y=new Set;function w(){t.update(I),queueMicrotask(()=>{y.forEach(t=>t())})}function z(t){return y.add(t),()=>y.delete(t)}let M=t.state(t.proxy([])),v=t.state(t.proxy([])),O=t.state(t.proxy([])),P=t.state(t.proxy([])),C=t.state(t.proxy([])),D=t.state(t.proxy([])),k=t.state(t.proxy([])),b=t.state(t.proxy([])),A=t.state(null),T=t.proxy(new Map),F=t.state(null),W=t.proxy(new Map),H=t.proxy(new Set),B=t.proxy(new Set),R=t.state(t.proxy([])),S=null,X=null;function E(e){const n=x.get(e.id),i=(null==n?void 0:n.zIndex)??s();n?x.set(e.id,{...n,title:e.title,icon:e.icon,glow:e.glow,zIndex:i}):x.set(e.id,{...e,zIndex:i,isAnimating:!1}),w(),e.isMinimized&&!t.get(R).includes(e.id)&&t.get(R).push(e.id)}function q(e){const n=x.get(e);if(n){if(t.set(R,t.get(R).filter(t=>t!==e),!0),n.childId){const t=x.get(n.childId);t&&x.set(n.childId,{...t,parentId:void 0})}if(n.parentId){const t=x.get(n.parentId);t&&x.set(n.parentId,{...t,childId:void 0,lastChildId:n.id})}x.delete(e),w(),B.delete(e),H.delete(e)}}function Y(e){const n=x.get(e);if(!n||n.isMinimized)return;if(jt(e),n.parentId){const t=x.get(n.parentId);if(t&&!t.isMinimized)return void Y(n.parentId)}if(t.set(M,[...t.get(M),e],!0),n.position&&n.size&&X){const i=X(),s=t.get(R).indexOf(e),o=i.x+s*(i.height+8),a=i.y;t.set(A,{x:o,y:a,originX:n.position.x+n.size.width/2,originY:n.position.y+n.size.height/2},!0)}const i=n.childId;x.set(e,{...n,isMinimized:!0,lastChildId:i}),w(),t.get(R).includes(e)||t.get(R).push(e),n.childId&&ot(e)}function L(e){const n=x.get(e);if(!n||!n.isMinimized)return;x.set(e,{...n,isMinimized:!1,isOpen:!0}),w(),t.set(C,[...t.get(C),e],!0),V(e);const i=n.lastChildId||n.childId;i&&_(i)}function N(){Array.from(x.values()).filter(t=>t.isMinimized).map(t=>t.id).forEach(e=>{const n=x.get(e);if(n){x.set(e,{...n,isMinimized:!1,isOpen:!0}),t.set(C,[...t.get(C),e],!0),V(e);const i=n.lastChildId||n.childId;i&&_(i)}}),t.set(R,[],!0),w()}function _(e){const n=x.get(e);n&&n.isHiddenWithParent&&(x.set(e,{...n,isHiddenWithParent:!1}),w(),t.set(D,[...t.get(D),e],!0))}function G(t,e,n){const i=x.get(t);if(!i)return;let s=e;if((null==n?void 0:n.constrain)&&i.size&&(s=d(e.x,e.y,i.size.width,i.size.height)),x.set(t,{...i,position:s,size:(null==n?void 0:n.size)??i.size,hasBeenDragged:i.hasBeenDragged||(null==n?void 0:n.drag)||!1}),i.childId){let e=t,n=s;for(;;){const t=x.get(e);if(!(null==t?void 0:t.childId))break;const i=x.get(t.childId);if(!(null==i?void 0:i.offsetFromParent))break;const s={x:n.x+i.offsetFromParent.x,y:n.y+i.offsetFromParent.y};x.set(t.childId,{...i,position:s,hasBeenDragged:!0}),e=t.childId,n=s}}if(i.parentId&&i.offsetFromParent){const e=oe();let n=t,o=i;for(;o.parentId&&o.offsetFromParent;){const i=x.get(o.parentId);if(!i)break;const a=n===t?s:x.get(n).position,r={x:a.x-o.offsetFromParent.x,y:a.y-o.offsetFromParent.y};"animated"===e.parentChild.movementMode?W.set(o.parentId,r):x.set(o.parentId,{...i,position:r,hasBeenDragged:!0}),n=o.parentId,o=i}}w()}function K(t,e){const n=x.get(t);n&&(x.set(t,{...n,size:e}),w())}function j(t,e){const n=x.get(t);n&&(x.set(t,{...n,...e}),w())}function V(t){var e;const n=x.get(t);if(!n)return;const i=Math.max(...Array.from(x.values()).map(t=>t.zIndex),0);if(n.parentId){const s=x.get(n.parentId);s&&s.zIndex<i&&x.set(n.parentId,{...s,zIndex:i+2});const o=(null==(e=x.get(n.parentId))?void 0:e.zIndex)??i+2;return n.zIndex<=o&&x.set(t,{...n,zIndex:o+2}),void w()}if(n.zIndex<i&&(x.set(t,{...n,zIndex:i+2}),w()),n.childId){const e=x.get(n.childId),i=x.get(t);e&&i&&e.zIndex<=i.zIndex&&(x.set(n.childId,{...e,zIndex:i.zIndex+2}),w())}}function $(t){const e=x.get(t);if(!e)return!1;const n=Math.max(...Array.from(x.values()).map(t=>t.zIndex),0);return e.zIndex===n&&!e.isMinimized&&!e.isHiddenWithParent}function Q(e){t.set(R,e,!0)}function J(e,n,i){const s=n.getBoundingClientRect();T.set(e,{x:s.left+s.width/2,y:s.top+s.height/2});const o=oe();(null==i?void 0:i.parentId)&&o.features.parentChild&&t.set(F,{parentId:i.parentId,childId:e},!0),t.get(v).includes(e)||t.set(v,[...t.get(v),e],!0),w();const a=x.get(e);if(a){if(a.isOpen&&!a.isMinimized&&!a.isHiddenWithParent)return t.set(v,t.get(v).filter(t=>t!==e),!0),bt(e),void V(e);if(a.isMinimized)return t.set(v,t.get(v).filter(t=>t!==e),!0),void L(e);x.set(e,{...a,isOpen:!0}),V(e),null==S||S.push(e)}}function U(e){E(e);const n=x.get(e.id);n&&(x.set(e.id,{...n,isOpen:!0}),w()),t.set(v,[...t.get(v),e.id],!0),w(),V(e.id),null==S||S.push(e.id)}function Z(e,n=!1){const i=x.get(e);i&&(jt(e),n?t.set(P,[...t.get(P),e],!0):t.set(O,[...t.get(O),e],!0),w(),i.childId&&Z(i.childId,n),null==S||S.pop())}function tt(){Array.from(x.keys()).forEach(t=>Z(t,!0))}function et(t){const e=x.get(t);if(e){if(e.parentId){const n=x.get(e.parentId);n&&n.childId===t&&x.set(e.parentId,{...n,childId:void 0,lastChildId:t})}x.set(t,{...e,isOpen:!1,isMinimized:!1,isHiddenWithParent:!1,isTransparent:!1,position:null,size:null,hasBeenDragged:!1,parentId:void 0,childId:void 0,offsetFromParent:void 0}),w()}}function nt(t){const e=x.get(t);if(!e)return[t];const n=[t];return e.childId&&n.push(...nt(e.childId)),n}function it(e,n,i){const s=oe();if(i&&!T.has(e.id)){const t=i.getBoundingClientRect();T.set(e.id,{x:t.left+t.width/2,y:t.top+t.height/2})}const o={id:e.id,title:e.title??"",icon:e.icon??"",isOpen:!0,isMinimized:!1,isHiddenWithParent:!1,isTransparent:e.isTransparent??!1,isRejected:!1,position:e.position??null,size:e.size??null,hasBeenDragged:e.hasBeenDragged??!1,dockPosition:e.dockPosition??-1,glow:e.glow??null};if(!s.features.parentChild){E(o);const n=x.get(e.id);return n&&x.set(e.id,{...n,isOpen:!0}),t.set(v,[...t.get(v),e.id],!0),w(),void V(e.id)}const a=x.get(n);if(!a)return;a.childId&&Z(a.childId,!0),E({...o,parentId:n});const r=x.get(e.id);r&&x.set(e.id,{...r,isOpen:!0,parentId:n}),t.set(v,[...t.get(v),e.id],!0),w(),V(e.id),t.set(F,{parentId:n,childId:e.id},!0)}function st(t,e){if(!oe().features.parentChild)return;const n=x.get(t),i=x.get(e);if(!n||!i)return;let s={x:40,y:40};n.position&&i.position&&(s={x:i.position.x-n.position.x,y:i.position.y-n.position.y});const o=Math.max(i.zIndex,n.zIndex+1);x.set(t,{...n,childId:e,lastChildId:e}),x.set(e,{...i,parentId:t,offsetFromParent:s,zIndex:o}),w()}function ot(t){const e=x.get(t);if(!(null==e?void 0:e.childId))return;const n=x.get(e.childId);n&&(x.set(e.childId,{...n,isHiddenWithParent:!0}),w())}function at(t,e){const n=x.get(t);if(!(null==n?void 0:n.childId))return;const i=x.get(n.childId);if(!i||!i.offsetFromParent)return;const s={x:e.x+i.offsetFromParent.x,y:e.y+i.offsetFromParent.y};x.set(n.childId,{...i,position:s}),w()}function rt(t,e){const n=x.get(t),i=x.get(e);if(!(null==n?void 0:n.position)||!(null==i?void 0:i.position))return;const s={x:n.position.x-i.position.x,y:n.position.y-i.position.y};x.set(t,{...n,offsetFromParent:s}),w()}function dt(e){return t.get(M).includes(e)}function ct(e){return!!t.get(M).includes(e)&&(t.set(M,t.get(M).filter(t=>t!==e),!0),!0)}function ut(){return t.get(M).length>0}function lt(){return Array.from(x.keys())}function ft(t){return x.get(t)}function gt(t){const e=[];for(const[n,i]of x.entries())if(n!==t&&i.isOpen&&!i.isMinimized&&!i.isHiddenWithParent&&!i.parentId)if(i.position&&i.size)e.push({id:m(n),x:i.position.x,y:i.position.y,width:i.size.width,height:i.size.height});else{const t=document.querySelector(`[data-modal-id="${m(n)}"]`);if(t){const i=t.getBoundingClientRect();e.push({id:m(n),x:i.left,y:i.top,width:i.width,height:i.height})}}return e}function ht(t){const e=[];for(const[n,i]of x.entries())if(n!==t&&i.isOpen&&!i.isMinimized&&!i.isHiddenWithParent)if(i.position&&i.size)e.push({x:i.position.x,y:i.position.y,width:i.size.width,height:i.size.height});else{const t=document.querySelector(`[data-modal-id="${m(n)}"]`);if(t){const n=t.getBoundingClientRect();e.push({x:n.left,y:n.top,width:n.width,height:n.height})}}return e}function pt(){return t.get(I)}function mt(){const e=t.get(A);return t.set(A,null),e}function xt(e){return t.get(v).includes(e)}function It(e){return!!t.get(v).includes(e)&&(t.set(v,t.get(v).filter(t=>t!==e),!0),!0)}function yt(e){return t.get(O).includes(e)}function wt(e){return!!t.get(O).includes(e)&&(t.set(O,t.get(O).filter(t=>t!==e),!0),!0)}function zt(e){return t.get(P).includes(e)}function Mt(e){return!!t.get(P).includes(e)&&(t.set(P,t.get(P).filter(t=>t!==e),!0),!0)}function vt(e){return t.get(C).includes(e)}function Ot(e){return!!t.get(C).includes(e)&&(t.set(C,t.get(C).filter(t=>t!==e),!0),!0)}function Pt(e){return t.get(D).includes(e)}function Ct(e){return!!t.get(D).includes(e)&&(t.set(D,t.get(D).filter(t=>t!==e),!0),!0)}function Dt(e){return t.get(k).includes(e)}function kt(e){return!!t.get(k).includes(e)&&(t.set(k,t.get(k).filter(t=>t!==e),!0),!0)}function bt(e){x.get(e)&&(t.get(k).includes(e)||t.get(b).includes(e)||(t.set(k,[...t.get(k),e],!0),w()))}function At(e){t.get(b).includes(e)||t.set(b,[...t.get(b),e],!0)}function Tt(e){t.set(b,t.get(b).filter(t=>t!==e),!0)}function Ft(){return t.get(F)}function Wt(e){if(!t.get(F)||t.get(F).childId!==e)return null;const n=t.get(F);return t.set(F,null),n}function Ht(t,e){T.set(t,e)}function Bt(t){const e=T.get(t);return e&&T.delete(t),e??null}function Rt(t,e){e?H.add(t):H.delete(t)}function St(t){return H.has(t)}function Xt(t){const e=x.get(t);return void 0!==e&&e.isOpen&&!e.isMinimized&&!e.isHiddenWithParent}function Et(t){return x.has(t)}function qt(){return{get modals(){return x},get pendingMinimize(){return t.get(M)},get pendingOpen(){return t.get(v)},get pendingClose(){return t.get(O)},get pendingRestore(){return t.get(C)},get dockOrder(){return t.get(R)}}}function Yt(t){B.has(t)?B.delete(t):B.add(t);const e=x.get(t);e&&(x.set(t,{...e,isTransparent:B.has(t)}),w())}function Lt(t){B.delete(t);const e=x.get(t);e&&(x.set(t,{...e,isTransparent:!1}),w())}function Nt(t){t.animate([{transform:"translateX(0)"},{transform:"translateX(-6px)"},{transform:"translateX(6px)"},{transform:"translateX(-6px)"},{transform:"translateX(6px)"},{transform:"translateX(0)"}],{duration:300,easing:"ease-in-out"})}function _t(t){const e=W.get(t);if(!e)return;const n=x.get(t);n&&(x.set(t,{...n,isAnimatingPosition:!0,position:e}),W.delete(t),w())}function Gt(t){const e=x.get(t);e&&(x.set(t,{...e,isAnimatingPosition:!1}),w())}function Kt(t){return W.has(t)}function jt(t){W.delete(t)}function Vt(t){const e=oe().parentChild.animationDuration;for(const[e,n]of t){const t=x.get(e);t&&x.set(e,{...t,position:n,isAnimatingPosition:!0,hasBeenDragged:!0})}w(),setTimeout(()=>{for(const e of t.keys()){const t=x.get(e);t&&x.set(e,{...t,isAnimatingPosition:!1})}w()},e)}function $t(t){const e=oe();if("animated"!==e.parentChild.movementMode)return;const n=e.parentChild.animationDuration,i=[];let s=t;for(;;){const t=x.get(s);if(!(null==t?void 0:t.parentId))break;i.push({parentId:t.parentId,childId:s}),s=t.parentId}i.forEach(({parentId:t,childId:e},i)=>{setTimeout(()=>{const i=x.get(e),s=x.get(t);if(!(null==i?void 0:i.position)||!i.offsetFromParent||!s)return;const o={x:i.position.x-i.offsetFromParent.x,y:i.position.y-i.offsetFromParent.y};W.set(t,o),_t(t),setTimeout(()=>Gt(t),n)},i*n)})}function Qt(t){}function Jt(t){S=t}function Ut(t){X=t}function Zt(){return{modals:x,pendingMinimize:t.get(M),pendingOpen:t.get(v),pendingClose:t.get(O),pendingRestore:t.get(C),dockOrder:t.get(R),animatingModals:H,transparentModals:B}}function te(){x.clear(),t.get(M).length=0,t.get(v).length=0,t.get(O).length=0,t.get(P).length=0,t.get(C).length=0,t.get(D).length=0,t.set(A,null),T.clear(),t.set(F,null),W.clear(),H.clear(),B.clear(),t.get(R).length=0,S=null,X=null}const ee={features:{dock:!0,minimize:!0,transparency:!0,resize:!0,drag:!0,focusTrap:!0,animations:!0,backdrop:!0,parentChild:!0},dock:{position:"bottom",labelMode:"beside",enableReorder:!0,enableFreeDrag:!0},animations:{open:400,close:250,minimize:500,restore:400},appearance:{headerLayout:"macos",defaultWidth:"480px",defaultHeight:"auto",minWidth:280,minHeight:200},zIndex:{base:400,dock:8e3,toast:9e3},parentChild:{movementMode:"animated",animationDuration:300},positioning:{strategy:"smart",modalGap:16,avoidElements:[]},portalTarget:"#modal-portal"};let ne={...ee},ie=t.state(0);function se(){return t.get(ie)}function oe(){return ne}function ae(e){const n=ne;ne=de(ee,e),t.update(ie),n.features.dock&&!ne.features.dock&&N()}function re(){ne={...ee},t.update(ie)}function de(t,e){return{features:{...t.features,...e.features},dock:{...t.dock,...e.dock},animations:{...t.animations,...e.animations},appearance:{...t.appearance,...e.appearance},zIndex:{...t.zIndex,...e.zIndex},parentChild:{...t.parentChild,...e.parentChild},positioning:{...t.positioning,...e.positioning},portalTarget:e.portalTarget??t.portalTarget}}function ce(t){return ne.features[t]}export{st as $,Mt as A,mt as B,j as C,ct as D,Ot as E,Ct as F,wt as G,et as H,xt as I,It as J,Bt as K,Dt as L,kt as M,At as N,Tt as O,Wt as P,Ft as Q,ht as R,f as S,h as T,l as U,gt as V,p as W,Vt as X,E as Y,$ as Z,Yt as _,Xt as a,o as a0,qt as a1,St as a2,Nt as a3,ae as a4,i as a5,re as a6,a as a7,ee as a8,de as a9,g as aA,z as aa,N as ab,_ as ac,K as ad,Q as ae,U as af,tt as ag,nt as ah,ot as ai,at as aj,rt as ak,ut as al,lt as am,Ht as an,Rt as ao,_t as ap,Gt as aq,Kt as ar,jt as as,Qt as at,Jt as au,Ut as av,Zt as aw,te as ax,s as ay,u as az,J as b,Z as c,V as d,d as e,c as f,oe as g,m as h,Et as i,ft as j,se as k,pt as l,Y as m,yt as n,it as o,dt as p,Pt as q,L as r,vt as s,bt as t,Lt as u,q as v,ce as w,G as x,$t as y,zt as z};
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import*as t from"svelte/internal/client";const e={BASE:0,DROPDOWN:100,STICKY:200,OVERLAY:300,MODAL:400,DOCK:8e3,TOAST:9e3};let n=t.state(t.proxy(e.MODAL));function i(){t.set(n,re().zIndex.base,!0)}function o(){const e=t.get(n);return t.set(n,t.get(n)+2),e}function r(t){const n=re();return"MODAL"===t?n.zIndex.base:"DOCK"===t?n.zIndex.dock:"TOAST"===t?n.zIndex.toast:e[t]}function s(){t.set(n,re().zIndex.base,!0)}const d=8;function a(t,e,n,i,o={}){const{margin:r=d,allowPartialVisibility:s=!1}=o,a="undefined"!=typeof window?window.innerWidth:1920,c="undefined"!=typeof window?window.innerHeight:1080;let u,l,f,g;return s&&n>a-2*r?(u=40-n,l=a-40):(u=r,l=Math.max(r,a-n-r)),s&&i>c-2*r?(f=40-i,g=c-40):(f=r,g=Math.max(r,c-i-r)),{x:Math.max(u,Math.min(l,t)),y:Math.max(f,Math.min(g,e))}}function c(t,e,n,i,o={}){const{margin:r=d}=o,s=("undefined"!=typeof window?window.innerWidth:1920)-2*r,c=("undefined"!=typeof window?window.innerHeight:1080)-2*r,u=Math.min(n,s),l=Math.min(i,c),f=a(t,e,u,l,o);return{x:f.x,y:f.y,width:u,height:l}}function u(t,e){return Math.max(0,Math.min(t.x+t.width,e.x+e.width)-Math.max(t.x,e.x))*Math.max(0,Math.min(t.y+t.height,e.y+e.height)-Math.max(t.y,e.y))}function l(t,e,n,i,o,r){const s={x:t-r,y:e-r,width:n+2*r,height:i+2*r};let d=0;for(const t of o)d+=u(s,t);return d}function f(t){if("undefined"==typeof document)return[];const e=[];for(const n of t)try{const t=document.querySelectorAll(n);for(const n of t){const t=n.getBoundingClientRect();t.width>0&&t.height>0&&e.push({x:t.left,y:t.top,width:t.width,height:t.height})}}catch{}return e}function g(t,e,n,i,o,r,s){const d=(o-n)/2,a=(r-i)/2,c=d-s,u=a-s,l=Math.abs(t-d)/(c||1),f=Math.abs(e-a)/(u||1),g=Math.sqrt(l*l+f*f)/Math.SQRT2,h=50,p=t-s,m=o-n-s-t,x=e-s,I=r-i-s-e;let y=0;return p<h&&(y+=.3*(1-p/h)),m<h&&(y+=.3*(1-m/h)),x<h&&(y+=.2*(1-x/h)),I<h&&(y+=.2*(1-I/h)),Math.min(1,g+y)}function h(t,e,n,i={}){const{modalGap:o=16,gridResolution:r=10,avoidBounds:s=[],avoidMargin:d=16}=i,a=i.margin??o,c="undefined"!=typeof window?window.innerWidth:1920,u="undefined"!=typeof window?window.innerHeight:1080,f=s.map(t=>({x:t.x-d,y:t.y-d,width:t.width+2*d,height:t.height+2*d})),h={x:(c-t)/2,y:(u-e)/2};if(0===n.length&&0===f.length)return h;const p=a,m=Math.max(a,c-t-a),x=a,I=Math.max(a,u-e-a);if(m<=p||I<=x)return h;const y=l(h.x,h.y,t,e,n,o),w=l(h.x,h.y,t,e,f,0);if(0===y&&0===w)return h;const z=[],M=(m-p)/r,v=(I-x)/r;for(let i=0;i<=r;i++)for(let s=0;s<=r;s++){const r=p+i*M,d=x+s*v,h=l(r,d,t,e,n,o),m=l(r,d,t,e,f,0),I=g(r,d,t,e,c,u,a);z.push({pos:{x:r,y:d},modalOverlap:h,avoidOverlap:m,centerDist:I})}const O=z.filter(t=>0===t.avoidOverlap),P=O.length>0?O:z,C=t*e,D=Math.min(...P.map(t=>t.modalOverlap))/C;return P.sort((t,e)=>{if(0===O.length&&t.avoidOverlap!==e.avoidOverlap)return t.avoidOverlap-e.avoidOverlap;const n=t.modalOverlap/C,i=e.modalOverlap/C;if(D<.3){const o=.3,r=n<=o,s=i<=o;if(r&&s)return t.centerDist+.3*n-(e.centerDist+.3*i);if(r)return-1;if(s)return 1}return.6*n+.4*t.centerDist-(.6*i+.4*e.centerDist)}),P[0].pos}function p(t,e,n,i={}){const{modalGap:o=16}=i,r=i.margin??o,s="undefined"!=typeof window?window.innerWidth:1920,d="undefined"!=typeof window?window.innerHeight:1080,a=n.reduce((t,e)=>t+e.width,0)+t,c=n.length*o,u=s-2*r;if(a+c>u)return null;const l=u-a-c;n.length;const f=l/2,g=s/2,h=[...n.map(t=>({id:t.id,width:t.width,height:t.height,currentX:t.x+t.width/2,currentY:t.y,isNew:!1})),{id:"__new__",width:t,height:e,currentX:g,currentY:(d-e)/2,isNew:!0}];h.sort((t,e)=>t.currentX-e.currentX);let p=r+f;const m=new Map;let x=null;for(const t of h){const e=p;if(t.isNew)x={x:Math.round(e),y:Math.round(t.currentY)};else{const i=n.find(e=>e.id===t.id);Math.abs(e-i.x)>5&&m.set(t.id,{x:Math.round(e),y:Math.round(i.y)})}p+=t.width+o}return x?{newModalPosition:x,existingModalMoves:m}:null}function m(t){return"symbol"==typeof t?t.description??"symbol":t}let x=t.proxy(new Map),I=t.state(0);const y=new Set;function w(){t.update(I),queueMicrotask(()=>{y.forEach(t=>t())})}function z(t){return y.add(t),()=>y.delete(t)}let M=t.state(t.proxy([])),v=t.state(t.proxy([])),O=t.state(t.proxy([])),P=t.state(t.proxy([])),C=t.state(t.proxy([])),D=t.state(t.proxy([])),k=t.state(t.proxy([])),b=t.state(t.proxy([])),T=t.state(null),A=t.proxy(new Map),F=t.state(null),W=t.proxy(new Map),H=t.proxy(new Set),B=t.proxy(new Set),R=t.state(t.proxy([])),S=null,X=null;function E(e){const n=x.get(e.id),i=(null==n?void 0:n.zIndex)??o();n?x.set(e.id,{...n,title:e.title,icon:e.icon,glow:e.glow,zIndex:i}):x.set(e.id,{...e,zIndex:i,isAnimating:!1}),w(),e.isMinimized&&!t.get(R).includes(e.id)&&t.get(R).push(e.id)}function Y(e){const n=x.get(e);if(n){if(t.set(R,t.get(R).filter(t=>t!==e),!0),n.childId){const t=x.get(n.childId);t&&x.set(n.childId,{...t,parentId:void 0})}if(n.parentId){const t=x.get(n.parentId);t&&x.set(n.parentId,{...t,childId:void 0,lastChildId:n.id})}x.delete(e),w(),B.delete(e),H.delete(e)}}function q(e){const n=x.get(e);if(!n||n.isMinimized)return;if(Vt(e),n.parentId){const t=x.get(n.parentId);if(t&&!t.isMinimized)return void q(n.parentId)}if(t.set(M,[...t.get(M),e],!0),n.position&&n.size&&X){const i=X(),o=t.get(R).indexOf(e),r=i.x+o*(i.height+8),s=i.y;t.set(T,{x:r,y:s,originX:n.position.x+n.size.width/2,originY:n.position.y+n.size.height/2},!0)}const i=n.childId;x.set(e,{...n,isMinimized:!0,lastChildId:i}),w(),t.get(R).includes(e)||t.get(R).push(e),n.childId&&rt(e)}function L(e){const n=x.get(e);if(!n||!n.isMinimized)return;x.set(e,{...n,isMinimized:!1,isOpen:!0}),w(),t.set(C,[...t.get(C),e],!0),$(e);const i=n.lastChildId||n.childId;i&&_(i)}function N(){Array.from(x.values()).filter(t=>t.isMinimized).map(t=>t.id).forEach(e=>{const n=x.get(e);if(n){x.set(e,{...n,isMinimized:!1,isOpen:!0}),t.set(C,[...t.get(C),e],!0),$(e);const i=n.lastChildId||n.childId;i&&_(i)}}),t.set(R,[],!0),w()}function _(e){const n=x.get(e);n&&n.isHiddenWithParent&&(x.set(e,{...n,isHiddenWithParent:!1}),w(),t.set(D,[...t.get(D),e],!0))}function G(t,e,n){const i=x.get(t);if(!i)return;let o=e;if((null==n?void 0:n.constrain)&&i.size&&(o=a(e.x,e.y,i.size.width,i.size.height)),x.set(t,{...i,position:o,size:(null==n?void 0:n.size)??i.size,hasBeenDragged:i.hasBeenDragged||(null==n?void 0:n.drag)||!1}),i.childId){let e=t,n=o;for(;;){const t=x.get(e);if(!(null==t?void 0:t.childId))break;const i=x.get(t.childId);if(!(null==i?void 0:i.offsetFromParent))break;const o={x:n.x+i.offsetFromParent.x,y:n.y+i.offsetFromParent.y};x.set(t.childId,{...i,position:o,hasBeenDragged:!0}),e=t.childId,n=o}}if(i.parentId&&i.offsetFromParent){const e=re();let n=t,r=i;for(;r.parentId&&r.offsetFromParent;){const i=x.get(r.parentId);if(!i)break;const s=n===t?o:x.get(n).position,d={x:s.x-r.offsetFromParent.x,y:s.y-r.offsetFromParent.y};"animated"===e.parentChild.movementMode?W.set(r.parentId,d):x.set(r.parentId,{...i,position:d,hasBeenDragged:!0}),n=r.parentId,r=i}}w()}function K(t,e){const n=x.get(t);n&&(x.set(t,{...n,size:e}),w())}function V(t,e){const n=x.get(t);n&&(x.set(t,{...n,...e}),w())}function $(t){var e;const n=x.get(t);if(!n)return;const i=Math.max(...Array.from(x.values()).map(t=>t.zIndex),0);if(n.parentId){const o=x.get(n.parentId);o&&o.zIndex<i&&x.set(n.parentId,{...o,zIndex:i+2});const r=(null==(e=x.get(n.parentId))?void 0:e.zIndex)??i+2;return n.zIndex<=r&&x.set(t,{...n,zIndex:r+2}),void w()}if(n.zIndex<i&&(x.set(t,{...n,zIndex:i+2}),w()),n.childId){const e=x.get(n.childId),i=x.get(t);e&&i&&e.zIndex<=i.zIndex&&(x.set(n.childId,{...e,zIndex:i.zIndex+2}),w())}}function j(t){const e=x.get(t);if(!e)return!1;const n=Math.max(...Array.from(x.values()).map(t=>t.zIndex),0);return e.zIndex===n&&!e.isMinimized&&!e.isHiddenWithParent}function Q(e){t.set(R,e,!0)}function J(e,n,i){const o=n.getBoundingClientRect();A.set(e,{x:o.left+o.width/2,y:o.top+o.height/2});const r=re();(null==i?void 0:i.parentId)&&r.features.parentChild&&t.set(F,{parentId:i.parentId,childId:e},!0),t.get(v).includes(e)||t.set(v,[...t.get(v),e],!0),w();const s=x.get(e);if(s){if(s.isOpen&&!s.isMinimized&&!s.isHiddenWithParent)return t.set(v,t.get(v).filter(t=>t!==e),!0),bt(e),void $(e);if(s.isMinimized)return t.set(v,t.get(v).filter(t=>t!==e),!0),void L(e);x.set(e,{...s,isOpen:!0}),$(e),null==S||S.push(e)}}function U(e){E(e);const n=x.get(e.id);n&&(x.set(e.id,{...n,isOpen:!0}),w()),t.set(v,[...t.get(v),e.id],!0),w(),$(e.id),null==S||S.push(e.id)}function Z(e,n=!1){const i=x.get(e);i&&(Vt(e),n?t.set(P,[...t.get(P),e],!0):t.set(O,[...t.get(O),e],!0),w(),i.childId&&Z(i.childId,n),null==S||S.pop())}function tt(){Array.from(x.keys()).forEach(t=>Z(t,!0))}function et(t){const e=x.get(t);if(e){if(e.parentId){const n=x.get(e.parentId);n&&n.childId===t&&x.set(e.parentId,{...n,childId:void 0,lastChildId:t})}x.set(t,{...e,isOpen:!1,isMinimized:!1,isHiddenWithParent:!1,isTransparent:!1,position:null,size:null,hasBeenDragged:!1,parentId:void 0,childId:void 0,offsetFromParent:void 0}),w()}}function nt(t){const e=x.get(t);if(!e)return[t];const n=[t];return e.childId&&n.push(...nt(e.childId)),n}function it(e,n,i){const o=re();if(i&&!A.has(e.id)){const t=i.getBoundingClientRect();A.set(e.id,{x:t.left+t.width/2,y:t.top+t.height/2})}const r={id:e.id,title:e.title??"",icon:e.icon??"",isOpen:!0,isMinimized:!1,isHiddenWithParent:!1,isTransparent:e.isTransparent??!1,isRejected:!1,position:e.position??null,size:e.size??null,hasBeenDragged:e.hasBeenDragged??!1,dockPosition:e.dockPosition??-1,glow:e.glow??null};if(!o.features.parentChild){E(r);const n=x.get(e.id);return n&&x.set(e.id,{...n,isOpen:!0}),t.set(v,[...t.get(v),e.id],!0),w(),void $(e.id)}const s=x.get(n);if(!s)return;s.childId&&Z(s.childId,!0),E({...r,parentId:n});const d=x.get(e.id);d&&x.set(e.id,{...d,isOpen:!0,parentId:n}),t.set(v,[...t.get(v),e.id],!0),w(),$(e.id),t.set(F,{parentId:n,childId:e.id},!0)}function ot(t,e){if(!re().features.parentChild)return;const n=x.get(t),i=x.get(e);if(!n||!i)return;let o={x:40,y:40};n.position&&i.position&&(o={x:i.position.x-n.position.x,y:i.position.y-n.position.y});const r=Math.max(i.zIndex,n.zIndex+1);x.set(t,{...n,childId:e,lastChildId:e}),x.set(e,{...i,parentId:t,offsetFromParent:o,zIndex:r}),w()}function rt(t){const e=x.get(t);if(!(null==e?void 0:e.childId))return;const n=x.get(e.childId);n&&(x.set(e.childId,{...n,isHiddenWithParent:!0}),w())}function st(t,e){const n=x.get(t);if(!(null==n?void 0:n.childId))return;const i=x.get(n.childId);if(!i||!i.offsetFromParent)return;const o={x:e.x+i.offsetFromParent.x,y:e.y+i.offsetFromParent.y};x.set(n.childId,{...i,position:o}),w()}function dt(t,e){const n=x.get(t),i=x.get(e);if(!(null==n?void 0:n.position)||!(null==i?void 0:i.position))return;const o={x:n.position.x-i.position.x,y:n.position.y-i.position.y};x.set(t,{...n,offsetFromParent:o}),w()}function at(e){return t.get(M).includes(e)}function ct(e){return!!t.get(M).includes(e)&&(t.set(M,t.get(M).filter(t=>t!==e),!0),!0)}function ut(){return t.get(M).length>0}function lt(){return Array.from(x.keys())}function ft(t){return x.get(t)}function gt(t){const e=[];for(const[n,i]of x.entries())if(n!==t&&i.isOpen&&!i.isMinimized&&!i.isHiddenWithParent&&!i.parentId)if(i.position&&i.size)e.push({id:m(n),x:i.position.x,y:i.position.y,width:i.size.width,height:i.size.height});else{const t=document.querySelector(`[data-modal-id="${m(n)}"]`);if(t){const i=t.getBoundingClientRect();e.push({id:m(n),x:i.left,y:i.top,width:i.width,height:i.height})}}return e}function ht(t){const e=[];for(const[n,i]of x.entries())if(n!==t&&i.isOpen&&!i.isMinimized&&!i.isHiddenWithParent)if(i.position&&i.size)e.push({x:i.position.x,y:i.position.y,width:i.size.width,height:i.size.height});else{const t=document.querySelector(`[data-modal-id="${m(n)}"]`);if(t){const n=t.getBoundingClientRect();e.push({x:n.left,y:n.top,width:n.width,height:n.height})}}return e}function pt(){return t.get(I)}function mt(){const e=t.get(T);return t.set(T,null),e}function xt(e){return t.get(v).includes(e)}function It(e){return!!t.get(v).includes(e)&&(t.set(v,t.get(v).filter(t=>t!==e),!0),!0)}function yt(e){return t.get(O).includes(e)}function wt(e){return!!t.get(O).includes(e)&&(t.set(O,t.get(O).filter(t=>t!==e),!0),!0)}function zt(e){return t.get(P).includes(e)}function Mt(e){return!!t.get(P).includes(e)&&(t.set(P,t.get(P).filter(t=>t!==e),!0),!0)}function vt(e){return t.get(C).includes(e)}function Ot(e){return!!t.get(C).includes(e)&&(t.set(C,t.get(C).filter(t=>t!==e),!0),!0)}function Pt(e){return t.get(D).includes(e)}function Ct(e){return!!t.get(D).includes(e)&&(t.set(D,t.get(D).filter(t=>t!==e),!0),!0)}function Dt(e){return t.get(k).includes(e)}function kt(e){return!!t.get(k).includes(e)&&(t.set(k,t.get(k).filter(t=>t!==e),!0),!0)}function bt(e){x.get(e)&&(t.get(k).includes(e)||t.get(b).includes(e)||(t.set(k,[...t.get(k),e],!0),w()))}function Tt(e){t.get(b).includes(e)||t.set(b,[...t.get(b),e],!0)}function At(e){t.set(b,t.get(b).filter(t=>t!==e),!0)}function Ft(){return t.get(F)}function Wt(e){if(!t.get(F)||t.get(F).childId!==e)return null;const n=t.get(F);return t.set(F,null),n}function Ht(t,e){A.set(t,e)}function Bt(t){const e=A.get(t);return e&&A.delete(t),e??null}function Rt(t,e){e?H.add(t):H.delete(t)}function St(t){return H.has(t)}function Xt(t){const e=x.get(t);return void 0!==e&&e.isOpen&&!e.isMinimized&&!e.isHiddenWithParent}function Et(t){return x.has(t)}function Yt(){return{get modals(){return x},get pendingMinimize(){return t.get(M)},get pendingOpen(){return t.get(v)},get pendingClose(){return t.get(O)},get pendingRestore(){return t.get(C)},get dockOrder(){return t.get(R)}}}function qt(t){B.has(t)?B.delete(t):B.add(t);const e=x.get(t);e&&(x.set(t,{...e,isTransparent:B.has(t)}),w())}function Lt(t){B.delete(t);const e=x.get(t);e&&(x.set(t,{...e,isTransparent:!1}),w())}function Nt(t){t.animate([{transform:"translateX(0)"},{transform:"translateX(-6px)"},{transform:"translateX(6px)"},{transform:"translateX(-6px)"},{transform:"translateX(6px)"},{transform:"translateX(0)"}],{duration:300,easing:"ease-in-out"})}function _t(t){const e=W.get(t);if(!e)return;const n=x.get(t);n&&(x.set(t,{...n,isAnimatingPosition:!0,position:e}),W.delete(t),w())}function Gt(t){const e=x.get(t);e&&(x.set(t,{...e,isAnimatingPosition:!1}),w())}function Kt(t){return W.has(t)}function Vt(t){W.delete(t)}function $t(t){const e=re().parentChild.animationDuration;for(const[e,n]of t){const t=x.get(e);t&&x.set(e,{...t,position:n,isAnimatingPosition:!0,hasBeenDragged:!0})}w(),setTimeout(()=>{for(const e of t.keys()){const t=x.get(e);t&&x.set(e,{...t,isAnimatingPosition:!1})}w()},e)}function jt(t){const e=re();if("animated"!==e.parentChild.movementMode)return;const n=e.parentChild.animationDuration,i=[];let o=t;for(;;){const t=x.get(o);if(!(null==t?void 0:t.parentId))break;i.push({parentId:t.parentId,childId:o}),o=t.parentId}i.forEach(({parentId:t,childId:e},i)=>{setTimeout(()=>{const i=x.get(e),o=x.get(t);if(!(null==i?void 0:i.position)||!i.offsetFromParent||!o)return;const r={x:i.position.x-i.offsetFromParent.x,y:i.position.y-i.offsetFromParent.y};W.set(t,r),_t(t),setTimeout(()=>Gt(t),n)},i*n)})}function Qt(t){}function Jt(t){S=t}function Ut(t){X=t}function Zt(){return{modals:x,pendingMinimize:t.get(M),pendingOpen:t.get(v),pendingClose:t.get(O),pendingRestore:t.get(C),dockOrder:t.get(R),animatingModals:H,transparentModals:B}}function te(){x.clear(),t.get(M).length=0,t.get(v).length=0,t.get(O).length=0,t.get(P).length=0,t.get(C).length=0,t.get(D).length=0,t.set(T,null),A.clear(),t.set(F,null),W.clear(),H.clear(),B.clear(),t.get(R).length=0,S=null,X=null}const ee={features:{dock:!0,minimize:!0,transparency:!0,resize:!0,drag:!0,focusTrap:!0,animations:!0,backdrop:!0,parentChild:!0},dock:{position:"bottom",labelMode:"beside",enableReorder:!0,enableFreeDrag:!0},animations:{open:400,close:250,minimize:500,restore:400},appearance:{headerLayout:"macos",defaultWidth:"480px",defaultHeight:"auto",minWidth:280,minHeight:200},zIndex:{base:400,dock:8e3,toast:9e3},parentChild:{movementMode:"animated",animationDuration:300},positioning:{strategy:"smart",modalGap:16,avoidElements:[]},portalTarget:"#modal-portal"};let ne={...ee},ie=t.state(0);function oe(){return t.get(ie)}function re(){return ne}function se(e){const n=ne;ne=ae(ee,e),t.update(ie),n.features.dock&&!ne.features.dock&&N()}function de(){ne={...ee},t.update(ie)}function ae(t,e){return{features:{...t.features,...e.features},dock:{...t.dock,...e.dock},animations:{...t.animations,...e.animations},appearance:{...t.appearance,...e.appearance},zIndex:{...t.zIndex,...e.zIndex},parentChild:{...t.parentChild,...e.parentChild},positioning:{...t.positioning,...e.positioning},portalTarget:e.portalTarget??t.portalTarget}}function ce(t){return ne.features[t]}export{Zt as _getInternalState,te as _resetInternalState,o as acquireModalZIndex,$t as animateModalsToPositions,_t as animateParentToPosition,$ as bringToFront,u as calculateOverlap,g as calculatePositionScore,p as calculateRearrangement,l as calculateTotalOverlap,Gt as clearParentAnimationFlag,Vt as clearPendingParentAnimation,tt as closeAllModals,Z as closeModal,c as constrainSizeToViewport,a as constrainToViewport,Bt as consumeOpenSourcePosition,kt as consumePendingAttention,Ct as consumePendingChildRestore,wt as consumePendingClose,Mt as consumePendingForceClose,ct as consumePendingMinimize,mt as consumePendingMinimizeTarget,It as consumePendingOpen,Wt as consumePendingParentLink,Ot as consumePendingRestore,U as createModal,ee as defaultConfig,At as endAttentionAnimation,et as finalizeModalClose,h as findSmartPosition,re as getConfig,oe as getConfigVersion,f as getElementBounds,r as getLayerZIndex,ft as getModalState,Yt as getModalsStore,nt as getModalsToClose,ht as getOpenModalBounds,gt as getOpenModalBoundsWithIds,Ft as getPendingParentLink,lt as getRegisteredModalIds,pt as getStateVersion,ut as hasAnyPendingMinimize,Dt as hasPendingAttention,Pt as hasPendingChildRestore,yt as hasPendingClose,zt as hasPendingForceClose,at as hasPendingMinimize,xt as hasPendingOpen,Kt as hasPendingParentAnimation,vt as hasPendingRestore,rt as hideChildWithParent,i as initializeStacking,ce as isFeatureEnabled,St as isModalAnimating,Xt as isModalOpen,Et as isModalRegistered,j as isTopModal,ot as linkModals,ae as mergeConfig,q as minimizeModal,it as openChildModal,J as openModal,E as registerModal,Q as reorderDock,de as resetConfig,Lt as resetModalTransparency,s as resetStacking,N as restoreAllMinimizedModals,_ as restoreChildModal,L as restoreModal,dt as setChildOffsetFromParent,se as setConfig,Ut as setDockPositionGetter,Rt as setModalAnimating,Qt as setRegistryFunctions,Jt as setURLStateCallbacks,Nt as shakeElement,Tt as startAttentionAnimation,Ht as storeOpenSourcePosition,z as subscribe,qt as toggleModalTransparency,bt as triggerAttention,jt as triggerCascadingParentAnimations,Y as unregisterModal,st as updateChildPosition,V as updateModal,G as updateModalPosition,K as updateModalSize};
1
+ import{aw as a,ax as e,ay as s,X as n,ap as i,d as t,az as o,aA as d,W as r,U as l,aq as g,as as c,ag as P,c as m,f as M,e as u,K as p,M as C,F as h,G as A,A as S,D as f,B as T,J as z,P as O,E as k,af as R,a8 as F,O as I,H as b,T as y,g as L,k as V,S as x,a0 as B,j as D,a1 as E,ah as j,R as v,V as w,Q as W,am as Z,l as _,al as q,L as G,q as U,n as H,z as J,p as K,I as N,ar as Q,s as X,ai as Y,a5 as $,w as aa,a2 as ea,a as sa,i as na,Z as ia,$ as ta,a9 as oa,m as da,o as ra,b as la,Y as ga,ae as ca,a6 as Pa,u as ma,a7 as Ma,ab as ua,ac as pa,r as Ca,ak as ha,a4 as Aa,av as Sa,ao as fa,at as Ta,au as za,a3 as Oa,N as ka,an as Ra,aa as Fa,h as Ia,_ as ba,t as ya,y as La,v as Va,aj as xa,C as Ba,x as Da,ad as Ea}from"./core.js";import"./ui.js";export{a as _getInternalState,e as _resetInternalState,s as acquireModalZIndex,n as animateModalsToPositions,i as animateParentToPosition,t as bringToFront,o as calculateOverlap,d as calculatePositionScore,r as calculateRearrangement,l as calculateTotalOverlap,g as clearParentAnimationFlag,c as clearPendingParentAnimation,P as closeAllModals,m as closeModal,M as constrainSizeToViewport,u as constrainToViewport,p as consumeOpenSourcePosition,C as consumePendingAttention,h as consumePendingChildRestore,A as consumePendingClose,S as consumePendingForceClose,f as consumePendingMinimize,T as consumePendingMinimizeTarget,z as consumePendingOpen,O as consumePendingParentLink,k as consumePendingRestore,R as createModal,F as defaultConfig,I as endAttentionAnimation,b as finalizeModalClose,y as findSmartPosition,L as getConfig,V as getConfigVersion,x as getElementBounds,B as getLayerZIndex,D as getModalState,E as getModalsStore,j as getModalsToClose,v as getOpenModalBounds,w as getOpenModalBoundsWithIds,W as getPendingParentLink,Z as getRegisteredModalIds,_ as getStateVersion,q as hasAnyPendingMinimize,G as hasPendingAttention,U as hasPendingChildRestore,H as hasPendingClose,J as hasPendingForceClose,K as hasPendingMinimize,N as hasPendingOpen,Q as hasPendingParentAnimation,X as hasPendingRestore,Y as hideChildWithParent,$ as initializeStacking,aa as isFeatureEnabled,ea as isModalAnimating,sa as isModalOpen,na as isModalRegistered,ia as isTopModal,ta as linkModals,oa as mergeConfig,da as minimizeModal,ra as openChildModal,la as openModal,ga as registerModal,ca as reorderDock,Pa as resetConfig,ma as resetModalTransparency,Ma as resetStacking,ua as restoreAllMinimizedModals,pa as restoreChildModal,Ca as restoreModal,ha as setChildOffsetFromParent,Aa as setConfig,Sa as setDockPositionGetter,fa as setModalAnimating,Ta as setRegistryFunctions,za as setURLStateCallbacks,Oa as shakeElement,ka as startAttentionAnimation,Ra as storeOpenSourcePosition,Fa as subscribe,Ia as toDataId,ba as toggleModalTransparency,ya as triggerAttention,La as triggerCascadingParentAnimations,Va as unregisterModal,xa as updateChildPosition,Ba as updateModal,Da as updateModalPosition,Ea as updateModalSize};
package/dist/react.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ export { openModal, closeModal, closeAllModals, minimizeModal, restoreModal, openChildModal, bringToFront, isModalOpen, isModalRegistered, toggleModalTransparency, } from './core/state.svelte';
2
+ export { getConfig, setConfig } from './core/config.svelte';
1
3
  export { Modal } from './react/Modal';
2
4
  export type { ModalProps } from './react/Modal';
3
5
  export { ModalProvider } from './react/ModalProvider';
@@ -5,7 +7,4 @@ export type { ModalProviderProps } from './react/ModalProvider';
5
7
  export { Dock } from './react/Dock';
6
8
  export type { DockProps } from './react/Dock';
7
9
  export { useModal, useModals } from './react/useModal';
8
- export { openModal, closeModal, minimizeModal, restoreModal, bringToFront, isModalOpen, isModalRegistered, openChildModal, closeAllModals, isTopModal, reorderDock, toggleModalTransparency, } from './core/state.svelte';
9
- export { getConfig, setConfig } from './core/config.svelte';
10
- export type { ModalState, Position, Dimensions, } from './core/types';
11
10
  //# sourceMappingURL=react.d.ts.map
package/dist/react.js CHANGED
@@ -1 +1 @@
1
- var e,t,n,i,r,o,l,s,a,u,d,c,f,h,p,v,g,m,y,w,x,b,k,z,M,_,I,S,P,C,E,O,D,T,W,R,B,A,$,j,H,L,F=Object.defineProperty,N=e=>{throw TypeError(e)},q=(e,t,n)=>((e,t,n)=>t in e?F(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n),X=(e,t,n)=>t.has(e)||N("Cannot "+n),Y=(e,t,n)=>(X(e,t,"read from private field"),n?n.call(e):t.get(e)),G=(e,t,n)=>t.has(e)?N("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),U=(e,t,n,i)=>(X(e,t,"write to private field"),i?i.call(e,n):t.set(e,n),n),V=(e,t,n)=>(X(e,t,"access private method"),n);import K,{useRef as Q,useState as J,useEffect as Z,useCallback as ee,useSyncExternalStore as te}from"react";import{createPortal as ne}from"react-dom";var ie,re,oe,le={exports:{}},se={},ae={},ue=(oe||(oe=1,"production"===process.env.NODE_ENV?le.exports=function(){if(ie)return se;ie=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(t,n,i){var r=null;if(void 0!==i&&(r=""+i),void 0!==n.key&&(r=""+n.key),"key"in n)for(var o in i={},n)"key"!==o&&(i[o]=n[o]);else i=n;return n=i.ref,{$$typeof:e,type:t,key:r,ref:void 0!==n?n:null,props:i}}return se.Fragment=t,se.jsx=n,se.jsxs=n,se}():le.exports=(re||(re=1,"production"!==process.env.NODE_ENV&&function(){function e(t){if(null==t)return null;if("function"==typeof t)return t.$$typeof===M?null:t.displayName||t.name||null;if("string"==typeof t)return t;switch(t){case h:return"Fragment";case v:return"Profiler";case p:return"StrictMode";case w:return"Suspense";case x:return"SuspenseList";case z:return"Activity"}if("object"==typeof t)switch(t.tag,t.$$typeof){case f:return"Portal";case m:return t.displayName||"Context";case g:return(t._context.displayName||"Context")+".Consumer";case y:var n=t.render;return(t=t.displayName)||(t=""!==(t=n.displayName||n.name||"")?"ForwardRef("+t+")":"ForwardRef"),t;case b:return null!==(n=t.displayName||null)?n:e(t.type)||"Memo";case k:n=t._payload,t=t._init;try{return e(t(n))}catch(e){}}return null}function t(e){return""+e}function n(e){try{t(e);var n=!1}catch(e){n=!0}if(n){var i=(n=console).error,r="function"==typeof Symbol&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return i.call(n,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",r),t(e)}}function i(t){if(t===h)return"<>";if("object"==typeof t&&null!==t&&t.$$typeof===k)return"<...>";try{var n=e(t);return n?"<"+n+">":"<...>"}catch(e){return"<...>"}}function r(){return Error("react-stack-top-frame")}function o(){var t=e(this.type);return C[t]||(C[t]=!0),void 0!==(t=this.props.ref)?t:null}function l(t,i,r,l,a,d){var f,h=i.children;if(void 0!==h)if(l){if(S(h)){for(l=0;l<h.length;l++)s(h[l]);Object.freeze&&Object.freeze(h)}}else s(h);if(I.call(i,"key")){h=e(t);var p=Object.keys(i).filter(function(e){return"key"!==e});l=0<p.length?"{key: someKey, "+p.join(": ..., ")+": ...}":"{key: someKey}",D[h+l]||(p=0<p.length?"{"+p.join(": ..., ")+": ...}":"{}",D[h+l]=!0)}if(h=null,void 0!==r&&(n(r),h=""+r),function(e){if(I.call(e,"key")){var t=Object.getOwnPropertyDescriptor(e,"key").get;if(t&&t.isReactWarning)return!1}return void 0!==e.key}(i)&&(n(i.key),h=""+i.key),"key"in i)for(var v in r={},i)"key"!==v&&(r[v]=i[v]);else r=i;return h&&function(e){function t(){u||(u=!0)}t.isReactWarning=!0,Object.defineProperty(e,"key",{get:t,configurable:!0})}(r,"function"==typeof t&&(t.displayName||t.name)),function(e,t,n,i,r,l){var s=n.ref;return e={$$typeof:c,type:e,key:t,props:n,_owner:i},null!==(void 0!==s?s:null)?Object.defineProperty(e,"ref",{enumerable:!1,get:o}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:r}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:l}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}(t,h,r,null===(f=_.A)?null:f.getOwner(),a,d)}function s(e){a(e)?e._store&&(e._store.validated=1):"object"==typeof e&&null!==e&&e.$$typeof===k&&("fulfilled"===e._payload.status?a(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function a(e){return"object"==typeof e&&null!==e&&e.$$typeof===c}var u,d=K,c=Symbol.for("react.transitional.element"),f=Symbol.for("react.portal"),h=Symbol.for("react.fragment"),p=Symbol.for("react.strict_mode"),v=Symbol.for("react.profiler"),g=Symbol.for("react.consumer"),m=Symbol.for("react.context"),y=Symbol.for("react.forward_ref"),w=Symbol.for("react.suspense"),x=Symbol.for("react.suspense_list"),b=Symbol.for("react.memo"),k=Symbol.for("react.lazy"),z=Symbol.for("react.activity"),M=Symbol.for("react.client.reference"),_=d.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,I=Object.prototype.hasOwnProperty,S=Array.isArray,P=console.createTask?console.createTask:function(){return null},C={},E=(d={react_stack_bottom_frame:function(e){return e()}}).react_stack_bottom_frame.bind(d,r)(),O=P(i(r)),D={};ae.Fragment=h,ae.jsx=function(e,t,n){var r=1e4>_.recentlyCreatedOwnerStacks++;return l(e,t,n,!1,r?Error("react-stack-top-frame"):E,r?P(i(e)):O)},ae.jsxs=function(e,t,n){var r=1e4>_.recentlyCreatedOwnerStacks++;return l(e,t,n,!0,r?Error("react-stack-top-frame"):E,r?P(i(e)):O)}}()),ae)),le.exports),de=Array.isArray,ce=Array.prototype.indexOf,fe=Array.from,he=Object.defineProperty,pe=Object.getOwnPropertyDescriptor,ve=Object.getOwnPropertyDescriptors,ge=Object.prototype,me=Array.prototype,ye=Object.getPrototypeOf,we=Object.isExtensible;const xe=()=>{};function be(){var e,t;return{promise:new Promise((n,i)=>{e=n,t=i}),resolve:e,reject:t}}const ke=16,ze=512,Me=1024,_e=2048,Ie=4096,Se=8192,Pe=16384,Ce=32768,Ee=65536,Oe=1<<18,De=1<<19,Te=1<<25,We=32768,Re=1<<21,Be=1<<23,Ae=Symbol("$state"),$e=Symbol(""),je=new class extends Error{constructor(){super(...arguments),q(this,"name","StaleReactionError"),q(this,"message","The reaction that called `getAbortSignal()` was re-run or destroyed")}};function He(e){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}const Le=Symbol();function Fe(e){return e===this.v}function Ne(e,t){return e!=e?t==t:e!==t||null!==e&&"object"==typeof e||"function"==typeof e}function qe(e){return!Ne(e,this.v)}let Xe=null;function Ye(e){Xe=e}function Ge(e){return Ke().get(e)}function Ue(e,t=!1,n){Xe={p:Xe,i:!1,c:null,e:null,s:e,x:null,l:null}}function Ve(e){var t=Xe,n=t.e;if(null!==n)for(var i of(t.e=null,n))en(i);return void 0!==e&&(t.x=e),t.i=!0,Xe=t.p,e??{}}function Ke(e){return null===Xe&&He(),Xe.c??(Xe.c=new Map(function(){let e=Xe.p;for(;null!==e;){const t=e.c;if(null!==t)return t;e=e.p}return null}()||void 0))}let Qe=[];function Je(){var e=Qe;Qe=[],function(e){for(var t=0;t<e.length;t++)e[t]()}(e)}function Ze(e){if(0===Qe.length&&!ut){var t=Qe;queueMicrotask(()=>{t===Qe&&Je()})}Qe.push(e)}function et(){for(;Qe.length>0;)Je()}function tt(e){var t=zn;if(null===t)return xn.f|=Be,e;if(0===(t.f&Ce)){if(!(128&t.f))throw e;t.b.error(e)}else nt(e,t)}function nt(e,t){for(;null!==t;){if(128&t.f)try{return void t.b.error(e)}catch(t){e=t}t=t.parent}throw e}const it=new Set;let rt=null,ot=null,lt=[],st=null,at=!1,ut=!1;e=new WeakMap,t=new WeakMap,n=new WeakMap,i=new WeakMap,r=new WeakMap,o=new WeakMap,l=new WeakMap,s=new WeakSet,a=function(e,t){var n;e.f^=Me;for(var i=e.first;null!==i;){var r=i.f,l=!!(96&r),a=l&&0!==(r&Me)||0!==(r&Se)||this.skipped_effects.has(i);if(!!(128&i.f)&&(null==(n=i.b)?void 0:n.is_pending())&&(t={parent:t,effect:i,effects:[],render_effects:[]}),!a&&null!==i.fn){l?i.f^=Me:4&r?t.effects.push(i):Rn(i)&&(0!==(i.f&ke)&&Y(this,o).add(i),Hn(i));var d=i.first;if(null!==d){i=d;continue}}var c=i.parent;for(i=i.next;null===i&&null!==c;)c===t.effect&&(V(this,s,u).call(this,t.effects),V(this,s,u).call(this,t.render_effects),t=t.parent),i=c.next,c=c.parent}},u=function(e){for(const t of e)0!==(t.f&_e)?Y(this,o).add(t):0!==(t.f&Ie)&&Y(this,l).add(t),V(this,s,d).call(this,t.deps),Gn(t,Me)},d=function(e){if(null!==e)for(const t of e)2&t.f&&0!==(t.f&We)&&(t.f^=We,V(this,s,d).call(this,t.deps))},c=function(){if(0===Y(this,i)){for(const t of Y(this,e))t();Y(this,e).clear()}0===Y(this,n)&&V(this,s,f).call(this)},f=function(){var e;if(it.size>1){this.previous.clear();var t=ot,n=!0,i={parent:null,effect:null,effects:[],render_effects:[]};for(const t of it){if(t===this){n=!1;continue}const o=[];for(const[e,i]of this.current){if(t.current.has(e)){if(!n||i===t.current.get(e))continue;t.current.set(e,i)}o.push(e)}if(0===o.length)continue;const l=[...t.current.keys()].filter(e=>!this.current.has(e));if(l.length>0){var r=lt;lt=[];const n=new Set,u=new Map;for(const e of o)vt(e,l,n,u);if(lt.length>0){rt=t,t.apply();for(const n of lt)V(e=t,s,a).call(e,n,i);t.deactivate()}lt=r}}rt=null,ot=t}this.committed=!0,it.delete(this)};let dt=class d{constructor(){G(this,s),q(this,"committed",!1),q(this,"current",new Map),q(this,"previous",new Map),G(this,e,new Set),G(this,t,new Set),G(this,n,0),G(this,i,0),G(this,r,null),G(this,o,new Set),G(this,l,new Set),q(this,"skipped_effects",new Set),q(this,"is_fork",!1)}is_deferred(){return this.is_fork||Y(this,i)>0}process(e){var t;lt=[],this.apply();var n={parent:null,effect:null,effects:[],render_effects:[]};for(const t of e)V(this,s,a).call(this,t,n);this.is_fork||V(this,s,c).call(this),this.is_deferred()?(V(this,s,u).call(this,n.effects),V(this,s,u).call(this,n.render_effects)):(rt=null,pt(n.render_effects),pt(n.effects),null==(t=Y(this,r))||t.resolve()),ot=null}capture(e,t){this.previous.has(e)||this.previous.set(e,t),0===(e.f&Be)&&(this.current.set(e,e.v),null==ot||ot.set(e,e.v))}activate(){rt=this,this.apply()}deactivate(){rt===this&&(rt=null,ot=null)}flush(){if(this.activate(),lt.length>0){if(ct(),null!==rt&&rt!==this)return}else 0===Y(this,n)&&this.process([]);this.deactivate()}discard(){for(const e of Y(this,t))e(this);Y(this,t).clear()}increment(e){U(this,n,Y(this,n)+1),e&&U(this,i,Y(this,i)+1)}decrement(e){U(this,n,Y(this,n)-1),e&&U(this,i,Y(this,i)-1),this.revive()}revive(){for(const e of Y(this,o))Y(this,l).delete(e),Gn(e,_e),mt(e);for(const e of Y(this,l))Gn(e,Ie),mt(e);this.flush()}oncommit(t){Y(this,e).add(t)}ondiscard(e){Y(this,t).add(e)}settled(){return(Y(this,r)??U(this,r,be())).promise}static ensure(){if(null===rt){const e=rt=new d;it.add(rt),ut||d.enqueue(()=>{rt===e&&e.flush()})}return rt}static enqueue(e){Ze(e)}apply(){}};function ct(){var e=gn;at=!0;try{var t=0;for(mn(!0);lt.length>0;){var n=dt.ensure();t++>1e3&&ft(),n.process(lt),Pt.clear()}}finally{at=!1,mn(e),st=null}}function ft(){try{!function(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}()}catch(e){nt(e,st)}}let ht=null;function pt(e){var t=e.length;if(0!==t){for(var n=0;n<t;){var i=e[n++];if(!(24576&i.f)&&Rn(i)&&(ht=new Set,Hn(i),null===i.deps&&null===i.first&&null===i.nodes&&(null===i.teardown&&null===i.ac?dn(i):i.fn=null),(null==ht?void 0:ht.size)>0)){Pt.clear();for(const e of ht){if(24576&e.f)continue;const t=[e];let n=e.parent;for(;null!==n;)ht.has(n)&&(ht.delete(n),t.push(n)),n=n.parent;for(let e=t.length-1;e>=0;e--){const n=t[e];24576&n.f||Hn(n)}}ht.clear()}}ht=null}}function vt(e,t,n,i){if(!n.has(e)&&(n.add(e),null!==e.reactions))for(const r of e.reactions){const e=r.f;2&e?vt(r,t,n,i):4194320&e&&0===(e&_e)&&gt(r,t,i)&&(Gn(r,_e),mt(r))}}function gt(e,t,n){const i=n.get(e);if(void 0!==i)return i;if(null!==e.deps)for(const i of e.deps){if(t.includes(i))return!0;if(2&i.f&&gt(i,t,n))return n.set(i,!0),!0}return n.set(e,!1),!1}function mt(e){for(var t=st=e;null!==t.parent;){var n=(t=t.parent).f;if(at&&t===zn&&0!==(n&ke)&&0===(n&Oe))return;if(96&n){if(0===(n&Me))return;t.f^=Me}}lt.push(t)}class yt{constructor(e,t,n){G(this,C),q(this,"parent"),G(this,h,!1),G(this,p),G(this,v,null),G(this,g),G(this,m),G(this,y),G(this,w,null),G(this,x,null),G(this,b,null),G(this,k,null),G(this,z,null),G(this,M,0),G(this,_,0),G(this,I,!1),G(this,S,null),G(this,P,function(e){let t,n=0,i=Et(0);return()=>{Qt()&&(Fn(i),nn(()=>(0===n&&(t=Xn(()=>e())),n+=1,()=>{Ze(()=>{n-=1,0===n&&(null==t||t(),t=void 0,Bt(i))})})))}}(()=>(U(this,S,Et(Y(this,M))),()=>{U(this,S,null)}))),U(this,p,e),U(this,g,t),U(this,m,n),this.parent=zn.b,U(this,h,!!Y(this,g).pending),U(this,y,on(()=>{zn.b=this;var e=V(this,C,E).call(this);try{U(this,w,ln(()=>n(e)))}catch(e){this.error(e)}return Y(this,_)>0?V(this,C,D).call(this):U(this,h,!1),()=>{var e;null==(e=Y(this,z))||e.remove()}},589952))}is_pending(){return Y(this,h)||!!this.parent&&this.parent.is_pending()}has_pending_snippet(){return!!Y(this,g).pending}update_pending_count(e){V(this,C,T).call(this,e),U(this,M,Y(this,M)+e),Y(this,S)&&Wt(Y(this,S),Y(this,M))}get_effect_pending(){return Y(this,P).call(this),Fn(Y(this,S))}error(e){var t=Y(this,g).onerror;let n=Y(this,g).failed;if(Y(this,I)||!t&&!n)throw e;Y(this,w)&&(un(Y(this,w)),U(this,w,null)),Y(this,x)&&(un(Y(this,x)),U(this,x,null)),Y(this,b)&&(un(Y(this,b)),U(this,b,null));var i=!1,r=!1;const o=()=>{i||(i=!0,r&&function(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}(),dt.ensure(),U(this,M,0),null!==Y(this,b)&&cn(Y(this,b),()=>{U(this,b,null)}),U(this,h,this.has_pending_snippet()),U(this,w,V(this,C,O).call(this,()=>(U(this,I,!1),ln(()=>Y(this,m).call(this,Y(this,p)))))),Y(this,_)>0?V(this,C,D).call(this):U(this,h,!1))};var l=xn;try{kn(null),r=!0,null==t||t(e,o),r=!1}catch(e){nt(e,Y(this,y)&&Y(this,y).parent)}finally{kn(l)}n&&Ze(()=>{U(this,b,V(this,C,O).call(this,()=>{dt.ensure(),U(this,I,!0);try{return ln(()=>{n(Y(this,p),()=>e,()=>o)})}catch(e){return nt(e,Y(this,y).parent),null}finally{U(this,I,!1)}}))})}}function wt(){Mn(null),kn(null),Ye(null)}function xt(e){var t=null!==xn&&2&xn.f?xn:null;return null!==zn&&(zn.f|=De),{ctx:Xe,deps:null,effects:null,equals:Fe,f:2050,fn:e,reactions:null,rv:0,v:Le,wv:0,parent:t??zn,ac:null}}function bt(e,t){let n=zn;null===n&&function(){throw new Error("https://svelte.dev/e/async_derived_orphan")}();var i=n.b,r=void 0,o=Et(Le),l=!xn,s=new Map;return function(e){Kt(4718592,e,!0)}(()=>{var t,n=be();r=n.promise;try{Promise.resolve(e()).then(n.resolve,n.reject).then(()=>{a===rt&&a.committed&&a.deactivate(),wt()})}catch(e){n.reject(e),wt()}var a=rt;if(l){var u=!i.is_pending();i.update_pending_count(1),a.increment(u),null==(t=s.get(a))||t.reject(je),s.delete(a),s.set(a,n)}const d=(e,t=void 0)=>{if(a.activate(),t)t!==je&&(o.f|=Be,Wt(o,t));else{0!==(o.f&Be)&&(o.f^=Be),Wt(o,e);for(const[e,t]of s){if(s.delete(e),e===a)break;t.reject(je)}}l&&(i.update_pending_count(-1),a.decrement(u))};n.promise.then(d,e=>d(null,e||"unknown"))}),Jt(()=>{for(const e of s.values())e.reject(je)}),new Promise(e=>{!function t(n){function i(){n===r?e(o):t(r)}n.then(i,i)}(r)})}function kt(e){const t=xt(e);return In(t),t}function zt(e){const t=xt(e);return t.equals=qe,t}function Mt(e){var t=e.effects;if(null!==t){e.effects=null;for(var n=0;n<t.length;n+=1)un(t[n])}}function _t(e){var t,n=zn;Mn(function(e){for(var t=e.parent;null!==t;){if(!(2&t.f))return 0===(t.f&Pe)?t:null;t=t.parent}return null}(e));try{e.f&=-32769,Mt(e),t=An(e)}finally{Mn(n)}return t}function It(e){var t=_t(e);e.equals(t)||((null==rt?void 0:rt.is_fork)||(e.v=t),e.wv=Wn()),yn||(null!==ot?(Qt()||(null==rt?void 0:rt.is_fork))&&ot.set(e,t):Gn(e,0===(e.f&ze)?Ie:Me))}h=new WeakMap,p=new WeakMap,v=new WeakMap,g=new WeakMap,m=new WeakMap,y=new WeakMap,w=new WeakMap,x=new WeakMap,b=new WeakMap,k=new WeakMap,z=new WeakMap,M=new WeakMap,_=new WeakMap,I=new WeakMap,S=new WeakMap,P=new WeakMap,C=new WeakSet,E=function(){var e=Y(this,p);return Y(this,h)&&(U(this,z,Nt()),Y(this,p).before(Y(this,z)),e=Y(this,z)),e},O=function(e){var t=zn,n=xn,i=Xe;Mn(Y(this,y)),kn(Y(this,y)),Ye(Y(this,y).ctx);try{return e()}catch(e){return tt(e),null}finally{Mn(t),kn(n),Ye(i)}},D=function(){const e=Y(this,g).pending;null!==Y(this,w)&&(U(this,k,document.createDocumentFragment()),Y(this,k).append(Y(this,z)),vn(Y(this,w),Y(this,k))),null===Y(this,x)&&U(this,x,ln(()=>e(Y(this,p))))},T=function(e){var t;this.has_pending_snippet()?(U(this,_,Y(this,_)+e),0===Y(this,_)&&(U(this,h,!1),Y(this,x)&&cn(Y(this,x),()=>{U(this,x,null)}),Y(this,k)&&(Y(this,p).before(Y(this,k)),U(this,k,null)))):this.parent&&V(t=this.parent,C,T).call(t,e)};let St=new Set;const Pt=new Map;let Ct=!1;function Et(e,t){return{f:0,v:e,reactions:null,equals:Fe,rv:0,wv:0}}function Ot(e,t){const n=Et(e);return In(n),n}function Dt(e,t=!1,n=!0){const i=Et(e);return t||(i.equals=qe),i}function Tt(e,t,n=!1){return null===xn||bn&&!(131072&xn.f)||!(4325394&xn.f)||(null==_n?void 0:_n.includes(e))||function(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}(),Wt(e,n?$t(t):t)}function Wt(e,t){if(!e.equals(t)){var n=e.v;yn?Pt.set(e,t):Pt.set(e,n),e.v=t;var i=dt.ensure();i.capture(e,n),2&e.f&&(0!==(e.f&_e)&&_t(e),Gn(e,0!==(e.f&ze)?Me:Ie)),e.wv=Wn(),At(e,_e),null===zn||0===(zn.f&Me)||96&zn.f||(null===Cn?function(e){Cn=e}([e]):Cn.push(e)),!i.is_fork&&St.size>0&&!Ct&&function(){Ct=!1;var e=gn;mn(!0);const t=Array.from(St);try{for(const e of t)0!==(e.f&Me)&&Gn(e,Ie),Rn(e)&&Hn(e)}finally{mn(e)}St.clear()}()}return t}function Rt(e,t=1){var n=Fn(e),i=1===t?n++:n--;return Tt(e,n),i}function Bt(e){Tt(e,e.v+1)}function At(e,t){var n=e.reactions;if(null!==n)for(var i=n.length,r=0;r<i;r++){var o=n[r],l=o.f,s=0===(l&_e);if(s&&Gn(o,t),2&l){var a=o;null==ot||ot.delete(a),0===(l&We)&&(l&ze&&(o.f|=We),At(a,Ie))}else s&&(0!==(l&ke)&&null!==ht&&ht.add(o),mt(o))}}function $t(e){if("object"!=typeof e||null===e||Ae in e)return e;const t=ye(e);if(t!==ge&&t!==me)return e;var n=new Map,i=de(e),r=Ot(0),o=Dn,l=e=>{if(Dn===o)return e();var t=xn,n=Dn;kn(null),Tn(o);var i=e();return kn(t),Tn(n),i};return i&&n.set("length",Ot(e.length)),new Proxy(e,{defineProperty(e,t,i){"value"in i&&!1!==i.configurable&&!1!==i.enumerable&&!1!==i.writable||function(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}();var r=n.get(t);return void 0===r?r=l(()=>{var e=Ot(i.value);return n.set(t,e),e}):Tt(r,i.value,!0),!0},deleteProperty(e,t){var i=n.get(t);if(void 0===i){if(t in e){const e=l(()=>Ot(Le));n.set(t,e),Bt(r)}}else Tt(i,Le),Bt(r);return!0},get(t,i,r){var o;if(i===Ae)return e;var s=n.get(i),a=i in t;if(void 0!==s||a&&!(null==(o=pe(t,i))?void 0:o.writable)||(s=l(()=>Ot($t(a?t[i]:Le))),n.set(i,s)),void 0!==s){var u=Fn(s);return u===Le?void 0:u}return Reflect.get(t,i,r)},getOwnPropertyDescriptor(e,t){var i=Reflect.getOwnPropertyDescriptor(e,t);if(i&&"value"in i){var r=n.get(t);r&&(i.value=Fn(r))}else if(void 0===i){var o=n.get(t),l=null==o?void 0:o.v;if(void 0!==o&&l!==Le)return{enumerable:!0,configurable:!0,value:l,writable:!0}}return i},has(e,t){var i;if(t===Ae)return!0;var r=n.get(t),o=void 0!==r&&r.v!==Le||Reflect.has(e,t);return!((void 0!==r||null!==zn&&(!o||(null==(i=pe(e,t))?void 0:i.writable)))&&(void 0===r&&(r=l(()=>Ot(o?$t(e[t]):Le)),n.set(t,r)),Fn(r)===Le))&&o},set(e,t,o,s){var a,u=n.get(t),d=t in e;if(i&&"length"===t)for(var c=o;c<u.v;c+=1){var f=n.get(c+"");void 0!==f?Tt(f,Le):c in e&&(f=l(()=>Ot(Le)),n.set(c+"",f))}void 0===u?d&&!(null==(a=pe(e,t))?void 0:a.writable)||(Tt(u=l(()=>Ot(void 0)),$t(o)),n.set(t,u)):(d=u.v!==Le,Tt(u,l(()=>$t(o))));var h=Reflect.getOwnPropertyDescriptor(e,t);if((null==h?void 0:h.set)&&h.set.call(s,o),!d){if(i&&"string"==typeof t){var p=n.get("length"),v=Number(t);Number.isInteger(v)&&v>=p.v&&Tt(p,v+1)}Bt(r)}return!0},ownKeys(e){Fn(r);var t=Reflect.ownKeys(e).filter(e=>{var t=n.get(e);return void 0===t||t.v!==Le});for(var[i,o]of n)o.v===Le||i in e||t.push(i);return t},setPrototypeOf(){!function(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}()}})}var jt,Ht,Lt,Ft;function Nt(e=""){return document.createTextNode(e)}function qt(e){return Lt.call(e)}function Xt(e){return Ft.call(e)}function Yt(e,t){return qt(e)}function Gt(e,t=!1){var n=qt(e);return n instanceof Comment&&""===n.data?Xt(n):n}function Ut(e,t=1,n=!1){let i=e;for(;t--;)i=Xt(i);return i}function Vt(e){var t=xn,n=zn;kn(null),Mn(null);try{return e()}finally{kn(t),Mn(n)}}function Kt(e,t,n){var i=zn;null!==i&&0!==(i.f&Se)&&(e|=Se);var r={ctx:Xe,deps:null,nodes:null,f:e|_e|ze,first:null,fn:t,last:null,next:null,parent:i,b:i&&i.b,prev:null,teardown:null,wv:0,ac:null};if(n)try{Hn(r),r.f|=Ce}catch(e){throw un(r),e}else null!==t&&mt(r);var o=r;if(n&&null===o.deps&&null===o.teardown&&null===o.nodes&&o.first===o.last&&0===(o.f&De)&&(o=o.first,0!==(e&ke)&&0!==(e&Ee)&&null!==o&&(o.f|=Ee)),null!==o&&(o.parent=i,null!==i&&function(e,t){var n=t.last;null===n?t.last=t.first=e:(n.next=e,e.prev=n,t.last=e)}(o,i),null!==xn&&2&xn.f&&!(64&e))){var l=xn;(l.effects??(l.effects=[])).push(o)}return r}function Qt(){return null!==xn&&!bn}function Jt(e){const t=Kt(8,null,!1);return Gn(t,Me),t.teardown=e,t}function Zt(e){null===zn&&(null===xn&&function(){throw new Error("https://svelte.dev/e/effect_orphan")}(),function(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}()),yn&&function(){throw new Error("https://svelte.dev/e/effect_in_teardown")}();var t=zn.f;if(xn||!(32&t)||0!==(t&Ce))return en(e);var n=Xe;(n.e??(n.e=[])).push(e)}function en(e){return Kt(1048580,e,!1)}function tn(e){return Kt(4,e,!1)}function nn(e,t=0){return Kt(8|t,e,!0)}function rn(e,t=[],n=[],i=[]){!function(e,t,n,i){const r=xt;if(0!==n.length||0!==e.length){var o,l,s,a,u=rt,d=zn,c=(o=zn,l=xn,s=Xe,a=rt,function(e=!0){Mn(o),kn(l),Ye(s),e&&(null==a||a.activate())});e.length>0?Promise.all(e).then(()=>{c();try{return f()}finally{null==u||u.deactivate(),wt()}}):f()}else i(t.map(r));function f(){Promise.all(n.map(e=>bt(e))).then(e=>{c();try{i([...t.map(r),...e])}catch(e){0===(d.f&Pe)&&nt(e,d)}null==u||u.deactivate(),wt()}).catch(e=>{nt(e,d)})}}(i,t,n,t=>{Kt(8,()=>e(...t.map(Fn)),!0)})}function on(e,t=0){return Kt(ke|t,e,!0)}function ln(e){return Kt(524320,e,!0)}function sn(e){var t=e.teardown;if(null!==t){const e=yn,n=xn;wn(!0),kn(null);try{t.call(null)}finally{wn(e),kn(n)}}}function an(e,t=!1){var n=e.first;for(e.first=e.last=null;null!==n;){const e=n.ac;null!==e&&Vt(()=>{e.abort(je)});var i=n.next;64&n.f?n.parent=null:un(n,t),n=i}}function un(e,t=!0){var n=!1;!t&&0===(e.f&Oe)||null===e.nodes||null===e.nodes.end||(function(e,t){for(;null!==e;){var n=e===t?null:Xt(e);e.remove(),e=n}}(e.nodes.start,e.nodes.end),n=!0),an(e,t&&!n),jn(e,0),Gn(e,Pe);var i=e.nodes&&e.nodes.t;if(null!==i)for(const e of i)e.stop();sn(e);var r=e.parent;null!==r&&null!==r.first&&dn(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes=e.ac=null}function dn(e){var t=e.parent,n=e.prev,i=e.next;null!==n&&(n.next=i),null!==i&&(i.prev=n),null!==t&&(t.first===e&&(t.first=i),t.last===e&&(t.last=n))}function cn(e,t,n=!0){var i=[];fn(e,i,!0);var r=()=>{n&&un(e),t&&t()},o=i.length;if(o>0){var l=()=>--o||r();for(var s of i)s.out(l)}else r()}function fn(e,t,n){if(0===(e.f&Se)){e.f^=Se;var i=e.nodes&&e.nodes.t;if(null!==i)for(const e of i)(e.is_global||n)&&t.push(e);for(var r=e.first;null!==r;){var o=r.next;fn(r,t,!!(0!==(r.f&Ee)||32&r.f&&0!==(e.f&ke))&&n),r=o}}}function hn(e){pn(e,!0)}function pn(e,t){if(0!==(e.f&Se)){e.f^=Se,0===(e.f&Me)&&(Gn(e,_e),mt(e));for(var n=e.first;null!==n;){var i=n.next;pn(n,!!(0!==(n.f&Ee)||32&n.f)&&t),n=i}var r=e.nodes&&e.nodes.t;if(null!==r)for(const e of r)(e.is_global||t)&&e.in()}}function vn(e,t){if(e.nodes)for(var n=e.nodes.start,i=e.nodes.end;null!==n;){var r=n===i?null:Xt(n);t.append(n),n=r}}let gn=!1;function mn(e){gn=e}let yn=!1;function wn(e){yn=e}let xn=null,bn=!1;function kn(e){xn=e}let zn=null;function Mn(e){zn=e}let _n=null;function In(e){null!==xn&&(null===_n?_n=[e]:_n.push(e))}let Sn=null,Pn=0,Cn=null,En=1,On=0,Dn=On;function Tn(e){Dn=e}function Wn(){return++En}function Rn(e){var t=e.f;if(0!==(t&_e))return!0;if(2&t&&(e.f&=-32769),0!==(t&Ie)){var n=e.deps;if(null!==n)for(var i=n.length,r=0;r<i;r++){var o=n[r];if(Rn(o)&&It(o),o.wv>e.wv)return!0}0!==(t&ze)&&null===ot&&Gn(e,Me)}return!1}function Bn(e,t,n=!0){var i=e.reactions;if(null!==i&&!(null==_n?void 0:_n.includes(e)))for(var r=0;r<i.length;r++){var o=i[r];2&o.f?Bn(o,t,!1):t===o&&(n?Gn(o,_e):0!==(o.f&Me)&&Gn(o,Ie),mt(o))}}function An(e){var t,n=Sn,i=Pn,r=Cn,o=xn,l=_n,s=Xe,a=bn,u=Dn,d=e.f;Sn=null,Pn=0,Cn=null,xn=96&d?null:e,_n=null,Ye(e.ctx),bn=!1,Dn=++On,null!==e.ac&&(Vt(()=>{e.ac.abort(je)}),e.ac=null);try{e.f|=Re;var c=(0,e.fn)(),f=e.deps;if(null!==Sn){var h;if(jn(e,Pn),null!==f&&Pn>0)for(f.length=Pn+Sn.length,h=0;h<Sn.length;h++)f[Pn+h]=Sn[h];else e.deps=f=Sn;if(Qt()&&0!==(e.f&ze))for(h=Pn;h<f.length;h++)((t=f[h]).reactions??(t.reactions=[])).push(e)}else null!==f&&Pn<f.length&&(jn(e,Pn),f.length=Pn);if(!(null===Cn||bn||null===f||6146&e.f))for(h=0;h<Cn.length;h++)Bn(Cn[h],e);return null!==o&&o!==e&&(On++,null!==Cn&&(null===r?r=Cn:r.push(...Cn))),0!==(e.f&Be)&&(e.f^=Be),c}catch(e){return tt(e)}finally{e.f^=Re,Sn=n,Pn=i,Cn=r,xn=o,_n=l,Ye(s),bn=a,Dn=u}}function $n(e,t){let n=t.reactions;if(null!==n){var i=ce.call(n,e);if(-1!==i){var r=n.length-1;0===r?n=t.reactions=null:(n[i]=n[r],n.pop())}}null===n&&2&t.f&&(null===Sn||!Sn.includes(t))&&(Gn(t,Ie),0!==(t.f&ze)&&(t.f^=ze,t.f&=-32769),Mt(t),jn(t,0))}function jn(e,t){var n=e.deps;if(null!==n)for(var i=t;i<n.length;i++)$n(e,n[i])}function Hn(e){var t=e.f;if(0===(t&Pe)){Gn(e,Me);var n=zn,i=gn;zn=e,gn=!0;try{16777232&t?function(e){for(var t=e.first;null!==t;){var n=t.next;!(32&t.f)&&un(t),t=n}}(e):an(e),sn(e);var r=An(e);e.teardown="function"==typeof r?r:null,e.wv=En}finally{gn=i,zn=n}}}async function Ln(){await Promise.resolve(),function(){var e=ut;ut=!0;try{for(;;){if(et(),0===lt.length&&(null==rt||rt.flush(),0===lt.length))return void(st=null);ct()}}finally{ut=e}}()}function Fn(e){var t=!!(2&e.f);if(!(null===xn||bn||null!==zn&&0!==(zn.f&Pe)||(null==_n?void 0:_n.includes(e)))){var n=xn.deps;if(0!==(xn.f&Re))e.rv<On&&(e.rv=On,null===Sn&&null!==n&&n[Pn]===e?Pn++:null===Sn?Sn=[e]:Sn.includes(e)||Sn.push(e));else{(xn.deps??(xn.deps=[])).push(e);var i=e.reactions;null===i?e.reactions=[xn]:i.includes(xn)||i.push(xn)}}if(yn){if(Pt.has(e))return Pt.get(e);if(t){var r=e,o=r.v;return(0===(r.f&Me)&&null!==r.reactions||qn(r))&&(o=_t(r)),Pt.set(r,o),o}}else t&&(!(null==ot?void 0:ot.has(e))||(null==rt?void 0:rt.is_fork)&&!Qt())&&(Rn(r=e)&&It(r),gn&&Qt()&&0===(r.f&ze)&&Nn(r));if(null==ot?void 0:ot.has(e))return ot.get(e);if(0!==(e.f&Be))throw e.v;return e.v}function Nn(e){if(null!==e.deps){e.f^=ze;for(const t of e.deps)(t.reactions??(t.reactions=[])).push(e),2&t.f&&0===(t.f&ze)&&Nn(t)}}function qn(e){if(e.v===Le)return!0;if(null===e.deps)return!1;for(const t of e.deps){if(Pt.has(t))return!0;if(2&t.f&&qn(t))return!0}return!1}function Xn(e){var t=bn;try{return bn=!0,e()}finally{bn=t}}const Yn=-7169;function Gn(e,t){e.f=e.f&Yn|t}function Un(e,t=new Set){if(!("object"!=typeof e||null===e||e instanceof EventTarget||t.has(e))){t.add(e),e instanceof Date&&e.getTime();for(let n in e)try{Un(e[n],t)}catch(e){}const n=ye(e);if(n!==Object.prototype&&n!==Array.prototype&&n!==Map.prototype&&n!==Set.prototype&&n!==Date.prototype){const t=ve(n);for(let n in t){const i=t[n].get;if(i)try{i.call(e)}catch(e){}}}}}const Vn=["touchstart","touchmove"];function Kn(e){return Vn.includes(e)}const Qn=new Set,Jn=new Set;function Zn(e){for(var t=0;t<e.length;t++)Qn.add(e[t]);for(var n of Jn)n(e)}let ei=null;function ti(e){var t,n=this,i=n.ownerDocument,r=e.type,o=(null==(t=e.composedPath)?void 0:t.call(e))||[],l=o[0]||e.target;ei=e;var s=0,a=ei===e&&e.__root;if(a){var u=o.indexOf(a);if(-1!==u&&(n===document||n===window))return void(e.__root=n);var d=o.indexOf(n);if(-1===d)return;u<=d&&(s=u)}if((l=o[s]||e.target)!==n){he(e,"currentTarget",{configurable:!0,get:()=>l||i});var c=xn,f=zn;kn(null),Mn(null);try{for(var h,p=[];null!==l;){var v=l.assignedSlot||l.parentNode||l.host||null;try{var g=l["__"+r];null==g||l.disabled&&e.target!==l||g.call(l,e)}catch(e){h?p.push(e):h=e}if(e.cancelBubble||v===n||null===v)break;l=v}if(h){for(let e of p)queueMicrotask(()=>{throw e});throw h}}finally{e.__root=n,delete e.currentTarget,kn(c),Mn(f)}}}function ni(e,t){var n=zn;null===n.nodes&&(n.nodes={start:e,end:t,a:null,t:null})}function ii(e,t){var n,i=!!(1&t),r=!!(2&t),o=!e.startsWith("<!>");return()=>{var t,l;void 0===n&&(t=o?e:"<!>"+e,(l=document.createElement("template")).innerHTML=t.replaceAll("<!>","\x3c!----\x3e"),n=l.content,i||(n=qt(n)));var s=r||Ht?document.importNode(n,!0):n.cloneNode(!0);return i?ni(qt(s),s.lastChild):ni(s,s),s}}function ri(){var e=document.createDocumentFragment(),t=document.createComment(""),n=Nt();return e.append(t,n),ni(t,n),e}function oi(e,t){null!==e&&e.before(t)}let li=!0;function si(e,t){var n=null==t?"":"object"==typeof t?t+"":t;n!==(e.__t??(e.__t=e.nodeValue))&&(e.__t=n,e.nodeValue=n+"")}function ai(e,t){return function(e,{target:t,anchor:n,props:i={},events:r,context:o,intro:l=!0}){!function(){if(void 0===jt){jt=window,Ht=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,n=Text.prototype;Lt=pe(t,"firstChild").get,Ft=pe(t,"nextSibling").get,we(e)&&(e.__click=void 0,e.__className=void 0,e.__attributes=null,e.__style=void 0,e.__e=void 0),we(n)&&(n.__t=void 0)}}();var s=new Set,a=e=>{for(var n=0;n<e.length;n++){var i=e[n];if(!s.has(i)){s.add(i);var r=Kn(i);t.addEventListener(i,ti,{passive:r});var o=ui.get(i);void 0===o?(document.addEventListener(i,ti,{passive:r}),ui.set(i,1)):ui.set(i,o+1)}}};a(fe(Qn)),Jn.add(a);var u=void 0,d=function(){dt.ensure();const d=Kt(524352,()=>{var d=n??t.appendChild(Nt());return new yt(d,{pending:()=>{}},t=>{o&&(Ue({}),Xe.c=o),r&&(i.$$events=r),li=l,u=e(t,i)||{},li=!0,o&&Ve()}),()=>{var e;for(var i of s){t.removeEventListener(i,ti);var r=ui.get(i);0===--r?(document.removeEventListener(i,ti),ui.delete(i)):ui.set(i,r)}Jn.delete(a),d!==n&&(null==(e=d.parentNode)||e.removeChild(d))}},!0);return(e={})=>new Promise(t=>{e.outro?cn(d,()=>{un(d),t(void 0)}):(un(d),t(void 0))})}();return di.set(u,d),u}(e,t)}const ui=new Map;let di=new WeakMap;function ci(e,t){const n=di.get(e);return n?(di.delete(e),n(t)):Promise.resolve()}class fi{constructor(e,t=!0){q(this,"anchor"),G(this,W,new Map),G(this,R,new Map),G(this,B,new Map),G(this,A,new Set),G(this,$,!0),G(this,j,()=>{var e=rt;if(Y(this,W).has(e)){var t=Y(this,W).get(e),n=Y(this,R).get(t);if(n)hn(n),Y(this,A).delete(t);else{var i=Y(this,B).get(t);i&&(Y(this,R).set(t,i.effect),Y(this,B).delete(t),i.fragment.lastChild.remove(),this.anchor.before(i.fragment),n=i.effect)}for(const[t,n]of Y(this,W)){if(Y(this,W).delete(t),t===e)break;const i=Y(this,B).get(n);i&&(un(i.effect),Y(this,B).delete(n))}for(const[e,i]of Y(this,R)){if(e===t||Y(this,A).has(e))continue;const r=()=>{if(Array.from(Y(this,W).values()).includes(e)){var t=document.createDocumentFragment();vn(i,t),t.append(Nt()),Y(this,B).set(e,{effect:i,fragment:t})}else un(i);Y(this,A).delete(e),Y(this,R).delete(e)};Y(this,$)||!n?(Y(this,A).add(e),cn(i,r,!1)):r()}}}),G(this,H,e=>{Y(this,W).delete(e);const t=Array.from(Y(this,W).values());for(const[e,n]of Y(this,B))t.includes(e)||(un(n.effect),Y(this,B).delete(e))}),this.anchor=e,U(this,$,t)}ensure(e,t){var n=rt;!t||Y(this,R).has(e)||Y(this,B).has(e)||Y(this,R).set(e,ln(()=>t(this.anchor))),Y(this,W).set(n,e),Y(this,j).call(this)}}function hi(e,t,n=!1){var i=new fi(e);function r(e,t){i.ensure(e,t)}on(()=>{var e=!1;t((t,n=!0)=>{e=!0,r(n,t)}),e||r(!1,null)},n?Ee:0)}function pi(e,t){return t}function vi(e,t=!0){for(var n=0;n<e.length;n++)un(e[n],t)}var gi;function mi(e,t,n,i,r,o=null){var l=e,s=new Map;!(4&t)||(l=e.appendChild(Nt()));var a,u=null,d=zt(()=>{var e=n();return de(e)?e:null==e?[]:fe(e)}),c=!0,f={effect:on(()=>{for(var e=(a=Fn(d)).length,h=new Set,p=0;p<e;p+=1){var v=a[p],g=i(v,p),m=c?null:s.get(g);m?(m.v&&Wt(m.v,v),m.i&&Wt(m.i,p)):(m=yi(s,c?l:gi??(gi=Nt()),v,g,p,r,t,n),c||(m.e.f|=Te),s.set(g,m)),h.add(g)}0===e&&o&&!u&&(c?u=ln(()=>o(l)):(u=ln(()=>o(gi??(gi=Nt())))).f|=Te),c||(f.fallback=u,function(e,t,n,i,r){var o,l,s,a,u,d,c,f,h,p,v,g,m,y,w=!!(8&i),x=t.length,b=e.items,k=e.effect.first,z=null,M=[],_=[];if(w)for(y=0;y<x;y+=1)g=r(t[y],y),0===((m=b.get(g).e).f&Te)&&(null==(l=null==(o=m.nodes)?void 0:o.a)||l.measure(),(v??(v=new Set)).add(m));for(y=0;y<x;y+=1){if(g=r(t[y],y),m=b.get(g).e,null!==e.outrogroups)for(const t of e.outrogroups)t.pending.delete(m),t.done.delete(m);if(0!==(m.f&Te)){if(m.f^=Te,m!==k){var I=z?z.next:k;m===e.effect.last&&(e.effect.last=m.prev),m.prev&&(m.prev.next=m.next),m.next&&(m.next.prev=m.prev),xi(e,z,m),xi(e,m,I),wi(m,I,n),M=[],_=[],k=(z=m).next;continue}wi(m,null,n)}if(0!==(m.f&Se)&&(hn(m),w&&(null==(a=null==(s=m.nodes)?void 0:s.a)||a.unfix(),(v??(v=new Set)).delete(m))),m!==k){if(void 0!==p&&p.has(m)){if(M.length<_.length){var S,P=_[0];z=P.prev;var C=M[0],E=M[M.length-1];for(S=0;S<M.length;S+=1)wi(M[S],P,n);for(S=0;S<_.length;S+=1)p.delete(_[S]);xi(e,C.prev,E.next),xi(e,z,C),xi(e,E,P),k=P,z=E,y-=1,M=[],_=[]}else p.delete(m),wi(m,k,n),xi(e,m.prev,m.next),xi(e,m,null===z?e.effect.first:z.next),xi(e,z,m),z=m;continue}for(M=[],_=[];null!==k&&k!==m;)(p??(p=new Set)).add(k),_.push(k),k=k.next;if(null===k)continue}0===(m.f&Te)&&M.push(m),z=m,k=m.next}if(null!==e.outrogroups){for(const t of e.outrogroups)0===t.pending.size&&(vi(fe(t.done)),null==(u=e.outrogroups)||u.delete(t));0===e.outrogroups.size&&(e.outrogroups=null)}if(null!==k||void 0!==p){var O=[];if(void 0!==p)for(m of p)0===(m.f&Se)&&O.push(m);for(;null!==k;)0===(k.f&Se)&&k!==e.fallback&&O.push(k),k=k.next;var D=O.length;if(D>0){var T=4&i&&0===x?n:null;if(w){for(y=0;y<D;y+=1)null==(c=null==(d=O[y].nodes)?void 0:d.a)||c.measure();for(y=0;y<D;y+=1)null==(h=null==(f=O[y].nodes)?void 0:f.a)||h.fix()}!function(e,t,n){for(var i,r=t.length,o=t.length,l=0;l<r;l++){let n=t[l];cn(n,()=>{if(i){if(i.pending.delete(n),i.done.add(n),0===i.pending.size){var t=e.outrogroups;vi(fe(i.done)),t.delete(i),0===t.size&&(e.outrogroups=null)}}else o-=1},!1)}if(0===o){var s=null!==n;if(s){var a=n,u=a.parentNode;u.textContent="",u.append(a),e.items.clear()}vi(t,!s)}else i={pending:new Set(t),done:new Set},(e.outrogroups??(e.outrogroups=new Set)).add(i)}(e,O,T)}}w&&Ze(()=>{var e,t;if(void 0!==v)for(m of v)null==(t=null==(e=m.nodes)?void 0:e.a)||t.apply()})}(f,a,l,t,i),null!==u&&(0===a.length?0===(u.f&Te)?hn(u):(u.f^=Te,wi(u,null,l)):cn(u,()=>{u=null}))),Fn(d)}),items:s,outrogroups:null,fallback:u};c=!1}function yi(e,t,n,i,r,o,l,s){var a=1&l?16&l?Et(n):Dt(n,!1,!1):null,u=2&l?Et(r):null;return{v:a,i:u,e:ln(()=>(o(t,a??n,u??r,s),()=>{e.delete(i)}))}}function wi(e,t,n){if(e.nodes)for(var i=e.nodes.start,r=e.nodes.end,o=t&&0===(t.f&Te)?t.nodes.start:n;null!==i;){var l=Xt(i);if(o.before(i),i===r)return;i=l}}function xi(e,t,n){null===t?e.effect.first=n:t.next=n,null===n?e.effect.last=t:n.prev=t}function bi(e,t,...n){var i=new fi(e);on(()=>{const e=t()??null;i.ensure(e,e&&(t=>e(t,...n)))},Ee)}W=new WeakMap,R=new WeakMap,B=new WeakMap,A=new WeakMap,$=new WeakMap,j=new WeakMap,H=new WeakMap;const ki={tick:e=>requestAnimationFrame(e),now:()=>performance.now(),tasks:new Set};function zi(){const e=ki.now();ki.tasks.forEach(t=>{t.c(e)||(ki.tasks.delete(t),t.f())}),0!==ki.tasks.size&&ki.tick(zi)}function Mi(e,t){Vt(()=>{e.dispatchEvent(new CustomEvent(t))})}function _i(e){if("float"===e)return"cssFloat";if("offset"===e)return"cssOffset";if(e.startsWith("--"))return e;const t=e.split("-");return 1===t.length?t[0]:t[0]+t.slice(1).map(e=>e[0].toUpperCase()+e.slice(1)).join("")}function Ii(e){const t={},n=e.split(";");for(const e of n){const[n,i]=e.split(":");if(!n||void 0===i)break;t[_i(n.trim())]=i.trim()}return t}const Si=e=>e;function Pi(e,t,n,i){var r,o,l,s,a=!!(4&e),u=t.inert,d=t.style.overflow;function c(){return Vt(()=>o??(o=n()(t,(null==i?void 0:i())??{},{direction:"both"})))}var f={is_global:a,in(){t.inert=u,Mi(t,"introstart"),l=Ci(t,c(),s,1,()=>{Mi(t,"introend"),null==l||l.abort(),l=o=void 0,t.style.overflow=d})},out(e){t.inert=!0,Mi(t,"outrostart"),s=Ci(t,c(),l,0,()=>{Mi(t,"outroend"),null==e||e()})},stop:()=>{null==l||l.abort(),null==s||s.abort()}},h=zn;if(((r=h.nodes).t??(r.t=[])).push(f),li){var p=a;if(!p){for(var v=h.parent;v&&0!==(v.f&Ee);)for(;(v=v.parent)&&0===(v.f&ke););p=!v||0!==(v.f&Ce)}p&&tn(()=>{Xn(()=>f.in())})}}function Ci(e,t,n,i,r){var o=1===i;if("function"==typeof t){var l,s=!1;return Ze(()=>{if(!s){var a=t({direction:o?"in":"out"});l=Ci(e,a,n,i,r)}}),{abort:()=>{s=!0,null==l||l.abort()},deactivate:()=>l.deactivate(),reset:()=>l.reset(),t:()=>l.t()}}if(null==n||n.deactivate(),!(null==t?void 0:t.duration))return r(),{abort:xe,deactivate:xe,reset:xe,t:()=>i};const{delay:a=0,css:u,tick:d,easing:c=Si}=t;var f=[];if(o&&void 0===n&&(d&&d(0,1),u)){var h=Ii(u(0,1));f.push(h,h)}var p=()=>1-i,v=e.animate(f,{duration:a,fill:"forwards"});return v.onfinish=()=>{v.cancel();var o=(null==n?void 0:n.t())??1-i;null==n||n.abort();var l=i-o,s=t.duration*Math.abs(l),a=[];if(s>0){var f=!1;if(u)for(var h=Math.ceil(s/(1e3/60)),g=0;g<=h;g+=1){var m=o+l*c(g/h),y=Ii(u(m,1-m));a.push(y),f||(f="hidden"===y.overflow)}f&&(e.style.overflow="hidden"),p=()=>{var e=v.currentTime;return o+l*c(e/s)},d&&function(e){let t;0===ki.tasks.size&&ki.tick(zi),new Promise(n=>{ki.tasks.add(t={c:e,f:n})})}(()=>{if("running"!==v.playState)return!1;var e=p();return d(e,1-e),!0})}(v=e.animate(a,{duration:s,fill:"forwards"})).onfinish=()=>{p=()=>i,null==d||d(i,1-i),r()}},{abort:()=>{v&&(v.cancel(),v.effect=null,v.onfinish=xe)},deactivate:()=>{r=xe},reset:()=>{0===i&&(null==d||d(1,0))},t:()=>p()}}function Ei(e,t,n){tn(()=>{var i=Xn(()=>t(e,null==n?void 0:n())||{});if(n&&(null==i?void 0:i.update)){var r=!1,o={};nn(()=>{var e=n();!function(e){if("object"==typeof e&&e&&!(e instanceof EventTarget))if(Ae in e)Un(e);else if(!Array.isArray(e))for(let t in e){const n=e[t];"object"==typeof n&&n&&Ae in n&&Un(n)}}(e),r&&Ne(o,e)&&(o=e,i.update(e))}),r=!0}if(null==i?void 0:i.destroy)return()=>i.destroy()})}const Oi=[..." \t\n\r\f \v\ufeff"];function Di(e,t=!1){var n=t?" !important;":";",i="";for(var r in e){var o=e[r];null!=o&&""!==o&&(i+=" "+r+": "+o+n)}return i}function Ti(e){return"-"!==e[0]||"-"!==e[1]?e.toLowerCase():e}function Wi(e,t,n,i,r,o){var l=e.__className;if(l!==n||void 0===l){var s=function(e,t,n){var i=null==e?"":""+e;if(t&&(i=i?i+" "+t:t),n)for(var r in n)if(n[r])i=i?i+" "+r:r;else if(i.length)for(var o=r.length,l=0;(l=i.indexOf(r,l))>=0;){var s=l+o;0!==l&&!Oi.includes(i[l-1])||s!==i.length&&!Oi.includes(i[s])?l=s:i=(0===l?"":i.substring(0,l))+i.substring(s+1)}return""===i?null:i}(n,i,o);null==s?e.removeAttribute("class"):e.className=s,e.__className=n}else if(o&&r!==o)for(var a in o){var u=!!o[a];null!=r&&u===!!r[a]||e.classList.toggle(a,u)}return o}function Ri(e,t={},n,i){for(var r in n){var o=n[r];t[r]!==o&&(null==n[r]?e.style.removeProperty(r):e.style.setProperty(r,o,i))}}function Bi(e,t,n,i){if(e.__style!==t){var r=function(e,t){if(t){var n,i,r="";if(Array.isArray(t)?(n=t[0],i=t[1]):n=t,e){e=String(e).replaceAll(/\s*\/\*.*?\*\/\s*/g,"").trim();var o=!1,l=0,s=!1,a=[];n&&a.push(...Object.keys(n).map(Ti)),i&&a.push(...Object.keys(i).map(Ti));var u=0,d=-1;const t=e.length;for(var c=0;c<t;c++){var f=e[c];if(s?"/"===f&&"*"===e[c-1]&&(s=!1):o?o===f&&(o=!1):"/"===f&&"*"===e[c+1]?s=!0:'"'===f||"'"===f?o=f:"("===f?l++:")"===f&&l--,!s&&!1===o&&0===l)if(":"===f&&-1===d)d=c;else if(";"===f||c===t-1){if(-1!==d){var h=Ti(e.substring(u,d).trim());a.includes(h)||(";"!==f&&c++,r+=" "+e.substring(u,c).trim()+";")}u=c+1,d=-1}}}return n&&(r+=Di(n)),i&&(r+=Di(i,!0)),""===(r=r.trim())?null:r}return null==e?null:String(e)}(t,i);null==r?e.removeAttribute("style"):e.style.cssText=r,e.__style=t}else i&&(Array.isArray(i)?(Ri(e,null==n?void 0:n[0],i[0]),Ri(e,null==n?void 0:n[1],i[1],"important")):Ri(e,n,i));return i}const Ai=Symbol("is custom element"),$i=Symbol("is html");function ji(e,t,n,i){var r=function(e){return e.__attributes??(e.__attributes={[Ai]:e.nodeName.includes("-"),[$i]:"http://www.w3.org/1999/xhtml"===e.namespaceURI})}(e);r[t]!==(r[t]=n)&&("loading"===t&&(e[$e]=n),null==n?e.removeAttribute(t):"string"!=typeof n&&function(e){var t,n=e.getAttribute("is")||e.nodeName,i=Hi.get(n);if(i)return i;Hi.set(n,i=[]);for(var r=e,o=Element.prototype;o!==r;){for(var l in t=ve(r))t[l].set&&i.push(l);r=ye(r)}return i}(e).includes(t)?e[t]=n:e.setAttribute(t,n))}var Hi=new Map;function Li(e,t){return e===t||(null==e?void 0:e[Ae])===t}function Fi(e={},t,n,i){return tn(()=>{var i,r;return nn(()=>{i=r,r=[],Xn(()=>{e!==n(...r)&&(t(e,...r),i&&Li(n(...i),e)&&t(null,...i))})}),()=>{Ze(()=>{r&&Li(n(...r),e)&&t(null,...r)})}}),e}function Ni(e,t,n,i){var r=i,o=!0,l=()=>(o&&(o=!1,r=i),r);return void 0===e[t]&&void 0!==i&&l(),()=>{var n=e[t];return void 0===n?l():(o=!0,n)}}function qi(e){null===Xe&&He(),Zt(()=>{const t=Xn(e);if("function"==typeof t)return t})}"undefined"!=typeof window&&((L=window.__svelte??(window.__svelte={})).v??(L.v=new Set)).add("5");const Xi=Symbol("modal-render-icon"),Yi=Symbol("modal-id"),Gi={features:{dock:!0,minimize:!0,transparency:!0,resize:!0,drag:!0,focusTrap:!0,animations:!0,backdrop:!0,parentChild:!0},dock:{position:"bottom",labelMode:"beside",enableReorder:!0,enableFreeDrag:!0},animations:{open:400,close:250,minimize:500,restore:400},appearance:{headerLayout:"macos",defaultWidth:"480px",defaultHeight:"auto",minWidth:280,minHeight:200},zIndex:{base:400,dock:8e3,toast:9e3},parentChild:{movementMode:"animated",animationDuration:300},positioning:{strategy:"smart",modalGap:16,avoidElements:[]},portalTarget:"#modal-portal"};let Ui={...Gi},Vi=Ot(0);function Ki(){return Fn(Vi)}function Qi(){return Ui}function Ji(e){const t=Ui;var n,i;Ui={features:{...(n=Gi).features,...(i=e).features},dock:{...n.dock,...i.dock},animations:{...n.animations,...i.animations},appearance:{...n.appearance,...i.appearance},zIndex:{...n.zIndex,...i.zIndex},parentChild:{...n.parentChild,...i.parentChild},positioning:{...n.positioning,...i.positioning},portalTarget:i.portalTarget??n.portalTarget},Rt(Vi),t.features.dock&&!Ui.features.dock&&(Array.from(sr.values()).filter(e=>e.isMinimized).map(e=>e.id).forEach(e=>{const t=sr.get(e);if(t){sr.set(e,{...t,isMinimized:!1,isOpen:!0}),Tt(gr,[...Fn(gr),e],!0),Wr(e);const n=t.lastChildId||t.childId;n&&Or(n)}}),Tt(Ir,[],!0),dr())}let Zi=Ot($t(400));const er=8;function tr(e,t,n,i,r={}){const{margin:o=er,allowPartialVisibility:l=!1}=r,s="undefined"!=typeof window?window.innerWidth:1920,a="undefined"!=typeof window?window.innerHeight:1080;let u,d,c,f;return l&&n>s-2*o?(u=40-n,d=s-40):(u=o,d=Math.max(o,s-n-o)),l&&i>a-2*o?(c=40-i,f=a-40):(c=o,f=Math.max(o,a-i-o)),{x:Math.max(u,Math.min(d,e)),y:Math.max(c,Math.min(f,t))}}function nr(e,t,n,i,r={}){const{margin:o=er}=r,l=("undefined"!=typeof window?window.innerWidth:1920)-2*o,s=("undefined"!=typeof window?window.innerHeight:1080)-2*o,a=Math.min(n,l),u=Math.min(i,s),d=tr(e,t,a,u,r);return{x:d.x,y:d.y,width:a,height:u}}function ir(e,t){return Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x))*Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y))}function rr(e,t,n,i,r,o){const l={x:e-o,y:t-o,width:n+2*o,height:i+2*o};let s=0;for(const e of r)s+=ir(l,e);return s}function or(e,t,n,i,r,o,l){const s=(r-n)/2,a=(o-i)/2,u=s-l,d=a-l,c=Math.abs(e-s)/(u||1),f=Math.abs(t-a)/(d||1),h=Math.sqrt(c*c+f*f)/Math.SQRT2,p=50,v=e-l,g=r-n-l-e,m=t-l,y=o-i-l-t;let w=0;return v<p&&(w+=.3*(1-v/p)),g<p&&(w+=.3*(1-g/p)),m<p&&(w+=.2*(1-m/p)),y<p&&(w+=.2*(1-y/p)),Math.min(1,h+w)}function lr(e){return"symbol"==typeof e?e.description??"symbol":e}let sr=$t(new Map),ar=Ot(0);const ur=new Set;function dr(){Rt(ar),queueMicrotask(()=>{ur.forEach(e=>e())})}function cr(e){return ur.add(e),()=>ur.delete(e)}let fr=Ot($t([])),hr=Ot($t([])),pr=Ot($t([])),vr=Ot($t([])),gr=Ot($t([])),mr=Ot($t([])),yr=Ot($t([])),wr=Ot($t([])),xr=Ot(null),br=$t(new Map),kr=Ot(null),zr=$t(new Map),Mr=$t(new Set),_r=$t(new Set),Ir=Ot($t([]));function Sr(e){const t=sr.get(e.id),n=(null==t?void 0:t.zIndex)??function(){const e=Fn(Zi);return Tt(Zi,Fn(Zi)+2),e}();t?sr.set(e.id,{...t,title:e.title,icon:e.icon,glow:e.glow,zIndex:n}):sr.set(e.id,{...e,zIndex:n,isAnimating:!1}),dr(),e.isMinimized&&!Fn(Ir).includes(e.id)&&Fn(Ir).push(e.id)}function Pr(e){const t=sr.get(e);if(t){if(Tt(Ir,Fn(Ir).filter(t=>t!==e),!0),t.childId){const e=sr.get(t.childId);e&&sr.set(t.childId,{...e,parentId:void 0})}if(t.parentId){const e=sr.get(t.parentId);e&&sr.set(t.parentId,{...e,childId:void 0,lastChildId:t.id})}sr.delete(e),dr(),_r.delete(e),Mr.delete(e)}}function Cr(e){const t=sr.get(e);if(!t||t.isMinimized)return;if(to(e),t.parentId){const e=sr.get(t.parentId);if(e&&!e.isMinimized)return void Cr(t.parentId)}Tt(fr,[...Fn(fr),e],!0),t.position&&t.size;const n=t.childId;sr.set(e,{...t,isMinimized:!0,lastChildId:n}),dr(),Fn(Ir).includes(e)||Fn(Ir).push(e),t.childId&&function(e){const t=sr.get(e);if(!(null==t?void 0:t.childId))return;const n=sr.get(t.childId);n&&(sr.set(t.childId,{...n,isHiddenWithParent:!0}),dr())}(e)}function Er(e){const t=sr.get(e);if(!t||!t.isMinimized)return;sr.set(e,{...t,isMinimized:!1,isOpen:!0}),dr(),Tt(gr,[...Fn(gr),e],!0),Wr(e);const n=t.lastChildId||t.childId;n&&Or(n)}function Or(e){const t=sr.get(e);t&&t.isHiddenWithParent&&(sr.set(e,{...t,isHiddenWithParent:!1}),dr(),Tt(mr,[...Fn(mr),e],!0))}function Dr(e,t,n){const i=sr.get(e);if(!i)return;let r=t;if((null==n?void 0:n.constrain)&&i.size&&(r=tr(t.x,t.y,i.size.width,i.size.height)),sr.set(e,{...i,position:r,size:(null==n?void 0:n.size)??i.size,hasBeenDragged:i.hasBeenDragged||(null==n?void 0:n.drag)||!1}),i.childId){let t=e,n=r;for(;;){const e=sr.get(t);if(!(null==e?void 0:e.childId))break;const i=sr.get(e.childId);if(!(null==i?void 0:i.offsetFromParent))break;const r={x:n.x+i.offsetFromParent.x,y:n.y+i.offsetFromParent.y};sr.set(e.childId,{...i,position:r,hasBeenDragged:!0}),t=e.childId,n=r}}if(i.parentId&&i.offsetFromParent){const t=Qi();let n=e,o=i;for(;o.parentId&&o.offsetFromParent;){const i=sr.get(o.parentId);if(!i)break;const l=n===e?r:sr.get(n).position,s={x:l.x-o.offsetFromParent.x,y:l.y-o.offsetFromParent.y};"animated"===t.parentChild.movementMode?zr.set(o.parentId,s):sr.set(o.parentId,{...i,position:s,hasBeenDragged:!0}),n=o.parentId,o=i}}dr()}function Tr(e,t){const n=sr.get(e);n&&(sr.set(e,{...n,...t}),dr())}function Wr(e){var t;const n=sr.get(e);if(!n)return;const i=Math.max(...Array.from(sr.values()).map(e=>e.zIndex),0);if(n.parentId){const r=sr.get(n.parentId);r&&r.zIndex<i&&sr.set(n.parentId,{...r,zIndex:i+2});const o=(null==(t=sr.get(n.parentId))?void 0:t.zIndex)??i+2;return n.zIndex<=o&&sr.set(e,{...n,zIndex:o+2}),void dr()}if(n.zIndex<i&&(sr.set(e,{...n,zIndex:i+2}),dr()),n.childId){const t=sr.get(n.childId),i=sr.get(e);t&&i&&t.zIndex<=i.zIndex&&(sr.set(n.childId,{...t,zIndex:i.zIndex+2}),dr())}}function Rr(e){const t=sr.get(e);if(!t)return!1;const n=Math.max(...Array.from(sr.values()).map(e=>e.zIndex),0);return t.zIndex===n&&!t.isMinimized&&!t.isHiddenWithParent}function Br(e){Tt(Ir,e,!0)}function Ar(e,t,n){const i=t.getBoundingClientRect();br.set(e,{x:i.left+i.width/2,y:i.top+i.height/2});const r=Qi();(null==n?void 0:n.parentId)&&r.features.parentChild&&Tt(kr,{parentId:n.parentId,childId:e},!0),Fn(hr).includes(e)||Tt(hr,[...Fn(hr),e],!0),dr();const o=sr.get(e);if(o){if(o.isOpen&&!o.isMinimized&&!o.isHiddenWithParent)return Tt(hr,Fn(hr).filter(t=>t!==e),!0),Vr(e),void Wr(e);if(o.isMinimized)return Tt(hr,Fn(hr).filter(t=>t!==e),!0),void Er(e);sr.set(e,{...o,isOpen:!0}),Wr(e)}}function $r(e,t=!1){const n=sr.get(e);n&&(to(e),t?Tt(vr,[...Fn(vr),e],!0):Tt(pr,[...Fn(pr),e],!0),dr(),n.childId&&$r(n.childId,t))}function jr(){Array.from(sr.keys()).forEach(e=>$r(e,!0))}function Hr(e,t,n){const i=Qi();if(n&&!br.has(e.id)){const t=n.getBoundingClientRect();br.set(e.id,{x:t.left+t.width/2,y:t.top+t.height/2})}const r={id:e.id,title:e.title??"",icon:e.icon??"",isOpen:!0,isMinimized:!1,isHiddenWithParent:!1,isTransparent:e.isTransparent??!1,isRejected:!1,position:e.position??null,size:e.size??null,hasBeenDragged:e.hasBeenDragged??!1,dockPosition:e.dockPosition??-1,glow:e.glow??null};if(!i.features.parentChild){Sr(r);const t=sr.get(e.id);return t&&sr.set(e.id,{...t,isOpen:!0}),Tt(hr,[...Fn(hr),e.id],!0),dr(),void Wr(e.id)}const o=sr.get(t);if(!o)return;o.childId&&$r(o.childId,!0),Sr({...r,parentId:t});const l=sr.get(e.id);l&&sr.set(e.id,{...l,isOpen:!0,parentId:t}),Tt(hr,[...Fn(hr),e.id],!0),dr(),Wr(e.id),Tt(kr,{parentId:t,childId:e.id},!0)}function Lr(e){return Fn(fr).includes(e)}function Fr(e){return sr.get(e)}function Nr(){return Fn(ar)}function qr(e){return Fn(pr).includes(e)}function Xr(e){return Fn(vr).includes(e)}function Yr(e){return!!Fn(vr).includes(e)&&(Tt(vr,Fn(vr).filter(t=>t!==e),!0),!0)}function Gr(e){return Fn(gr).includes(e)}function Ur(e){return Fn(mr).includes(e)}function Vr(e){sr.get(e)&&(Fn(yr).includes(e)||Fn(wr).includes(e)||(Tt(yr,[...Fn(yr),e],!0),dr()))}function Kr(e){const t=sr.get(e);return void 0!==t&&t.isOpen&&!t.isMinimized&&!t.isHiddenWithParent}function Qr(e){return sr.has(e)}function Jr(){return{get modals(){return sr},get pendingMinimize(){return Fn(fr)},get pendingOpen(){return Fn(hr)},get pendingClose(){return Fn(pr)},get pendingRestore(){return Fn(gr)},get dockOrder(){return Fn(Ir)}}}function Zr(e){_r.has(e)?_r.delete(e):_r.add(e);const t=sr.get(e);t&&(sr.set(e,{...t,isTransparent:_r.has(e)}),dr())}function eo(e){_r.delete(e);const t=sr.get(e);t&&(sr.set(e,{...t,isTransparent:!1}),dr())}function to(e){zr.delete(e)}function no(){return Qi().features.animations}const io=["button:not([disabled])","[href]","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(", ");function ro(e){return Array.from(e.querySelectorAll(io)).filter(e=>null!==e.offsetParent||"A"===e.tagName)}function oo(e,t){if("Tab"!==e.key)return;const n=ro(t);if(0===n.length)return void e.preventDefault();const i=n[0],r=n[n.length-1],o=document.activeElement;e.shiftKey?o===i&&(r.focus(),e.preventDefault()):o===r&&(i.focus(),e.preventDefault())}function lo(e){const t=ro(e);return t.length>0&&(t[0].focus(),!0)}const so="modal-portal";var ao=ii('<div style="display: contents;"><!></div>');function uo(e,t){Ue(t,!0);let n=Ni(t,"target",0,"body"),i=null,r=null;const{mount:o}={mount:function(e,t=null){const n=function(e){if("undefined"==typeof window)return null;if(e instanceof HTMLElement)return e;if("string"==typeof e){const t=document.querySelector(e);if(t)return t;if(e.startsWith("#")){const t=e.slice(1),n=document.createElement("div");return n.id=t,document.body.appendChild(n),n}}let t=document.getElementById(so);return t||(t=document.createElement("div"),t.id=so,document.body.appendChild(t)),t}(t);return n?(n.appendChild(e),()=>{e.parentNode===n&&n.removeChild(e),n.id!==so&&0===n.children.length&&n.parentNode&&n.parentNode.removeChild(n)}):()=>{}}};qi(()=>(i&&(r=o(i,n())),()=>{null==r||r()}));var l=ao();bi(Yt(l),()=>t.children),Fi(l,e=>i=e,()=>i),oi(e,l),Ve()}var co=ii('<button type="button" aria-label="Minimize"></button>'),fo=ii('<button type="button" class="modal-header-light modal-header-light-style" aria-label="Toggle style"></button>'),ho=ii('<div class="modal-header-icon"><!></div>'),po=ii('<div class="modal-header-icon"><!></div>'),vo=ii('<h2 class="modal-header-title"> </h2>'),go=ii('<h2 class="modal-header-title"> </h2>'),mo=ii('<div class="modal-header-traffic-lights"><button type="button" class="modal-header-light modal-header-light-close" aria-label="Close"></button> <!> <!></div> <div class="modal-header-mac-center"><!> <div class="modal-header-title-group"><!></div></div> <div class="modal-header-mac-spacer"></div>',1),yo=ii('<div class="modal-header-icon"><!></div>'),wo=ii('<div class="modal-header-icon"><!></div>'),xo=ii('<h2 class="modal-header-title"> </h2>'),bo=ii('<h2 class="modal-header-title"> </h2>'),ko=ii('<button type="button" class="modal-header-btn-windows modal-header-btn-windows-style" aria-label="Toggle style">&#9671;</button>'),zo=ii('<button type="button" aria-label="Minimize">&#8211;</button>'),Mo=ii('<div class="modal-header-title-group"><!> <!></div> <div class="modal-header-actions"><!> <!> <button type="button" class="modal-header-btn-windows modal-header-btn-windows-close" aria-label="Close">&times;</button></div>',1),_o=ii("<header><!></header>");Zn(["pointerdown","click"]);var Io=ii("<div></div>"),So=ii('<div class="modal-resize-handles"></div>');function Po(e,t){return t&&e.appendChild(t),{update(t){e.innerHTML="",t&&e.appendChild(t)},destroy(){e.innerHTML=""}}}Zn(["pointerdown"]);var Co=ii('<div class="modal-footer"><!></div>'),Eo=ii("<div></div>"),Oo=ii('<div role="dialog" aria-modal="true" tabindex="-1"><!> <div class="modal-body"><!></div> <!> <!> <!></div>');function Do(e,t){Ue(t,!0);let n=Ni(t,"maxWidth",0,"600px"),i=Ni(t,"autoOpen",0,!1),r=Ni(t,"closeOnEscape",0,!0),o=Ni(t,"skipRegistration",0,!1);var l,s;l=Yi,s=t.id,Ke().set(l,s);const a=Qi().portalTarget,u=lr(t.id);function d(e){var n,i;return(null==(i=null==(n=t.config)?void 0:n.features)?void 0:i[e])??function(e){return Ui.features[e]}(e)}const c=kt(()=>(Ki(),d("drag"))),f=kt(()=>(Ki(),d("minimize"))),h=kt(()=>(Ki(),!d("dock"))),p=kt(()=>(Ki(),d("transparency"))),v=kt(()=>(Ki(),d("resize"))),g=kt(()=>{var e,n;return Ki(),(null==(n=null==(e=t.config)?void 0:e.appearance)?void 0:n.headerLayout)??Qi().appearance.headerLayout});let m=Ot(null),y=Ot(!1),w=Ot(!1),x=Ot(!1),b=Ot(!1),k=Ot(!1);const z=kt(()=>(Nr(),Fr(t.id))),M=kt(()=>Fn(z)&&(Fn(z).isOpen||qr(t.id))&&(!Fn(z).isMinimized||Lr(t.id))&&!Fn(z).isHiddenWithParent),_=kt(()=>{var e;return!!(null==(e=Fn(z))?void 0:e.childId)}),I=kt(()=>{var e;return!!(null==(e=Fn(z))?void 0:e.parentId)}),S=kt(()=>Fn(_)||Fn(w)),P=kt(()=>!!t.glow),C=kt(()=>`modal-title-${u}`),E=kt(()=>{var e;return(null==(e=Fn(z))?void 0:e.zIndex)??1e3}),O=function(e={x:0,y:0}){const t=$t({...e}),n=$t({isDragging:!1,startX:0,startY:0,initialX:0,initialY:0,hasBeenDragged:!1});return{get position(){return t},get hasBeenDragged(){return n.hasBeenDragged},get isDragging(){return n.isDragging},onPointerDown:function(e,i){if(0===e.button){if(!n.hasBeenDragged){const e=i.getBoundingClientRect();t.x=e.left,t.y=e.top}n.isDragging=!0,n.startX=e.clientX,n.startY=e.clientY,n.initialX=t.x,n.initialY=t.y,i.setPointerCapture(e.pointerId)}},onPointerMove:function(e,i,r){if(!n.isDragging)return;const o=e.clientX-n.startX,l=e.clientY-n.startY,s=tr(n.initialX+o,n.initialY+l,r.width,r.height);t.x=s.x,t.y=s.y,n.hasBeenDragged=!0},onPointerUp:function(e,t){n.isDragging&&(n.isDragging=!1,t.releasePointerCapture(e.pointerId))},setPosition:function(e){t.x=e.x,t.y=e.y},setHasBeenDragged:function(e){n.hasBeenDragged=e},reset:function(){t.x=e.x,t.y=e.y,n.hasBeenDragged=!1}}}({x:0,y:0});let D=Ot(!1);const T=function(e,n,i){let r=Ot(!1),o=Ot(""),l=Ot($t({width:0,height:0})),s=Ot(!1),a=Ot(!1),u={x:0,y:0,width:0,height:0,posX:0,posY:0},d=null;function c(t,a){t.preventDefault(),t.stopPropagation();const c=e();if(!c)return;const p=c.getBoundingClientRect();O.hasBeenDragged||(i({x:p.left,y:p.top}),O.setHasBeenDragged(!0)),Fn(s)||(Tt(l,{width:p.width,height:p.height},!0),Tt(s,!0));const v=n();Tt(r,!0),Tt(o,a,!0),d=t.pointerId,u={x:t.clientX,y:t.clientY,width:Fn(l).width,height:Fn(l).height,posX:v.x,posY:v.y,centerX:v.x+Fn(l).width/2,centerY:v.y+Fn(l).height/2},window.addEventListener("pointermove",f),window.addEventListener("pointerup",h),window.addEventListener("pointercancel",h)}function f(e){if(e.pointerId!==d)return;const t=e.clientX-u.x,n=e.clientY-u.y,r=window.innerWidth,s=window.innerHeight;let a=u.width,c=u.height,f=u.posX,h=u.posY;if(Fn(o).includes("e")){const e=r-f;a=Math.max(280,Math.min(u.width+t,e))}if(Fn(o).includes("w")){const e=u.width-280,n=Math.min(t,e);a=u.width-n,f=u.posX+n}if(Fn(o).includes("s")){const e=s-h;c=Math.max(200,Math.min(u.height+n,e))}if(Fn(o).includes("n")){const e=u.height-200,t=Math.min(n,e);c=u.height-t,h=u.posY+t}const p=nr(f,h,a,c);Tt(l,{width:p.width,height:p.height},!0),i({x:p.x,y:p.y})}function h(e){e.pointerId===d&&(Tt(r,!1),d=null,window.removeEventListener("pointermove",f),window.removeEventListener("pointerup",h),window.removeEventListener("pointercancel",h),Tt(a,!0),((e,n)=>{const i=Fr(t.id);if(null==i?void 0:i.parentId){const e=Fr(i.parentId),r=document.querySelector(`[data-modal-id="${lr(i.parentId)}"]`);if(e&&r){const i=e.position??{x:r.getBoundingClientRect().left,y:r.getBoundingClientRect().top},o=e.size??{width:r.offsetWidth,height:r.offsetHeight},l={x:i.x+(o.width-n.width)/2,y:i.y+(o.height-n.height)/2};Tt(D,!0),O.setPosition(l);const s={x:l.x-i.x,y:l.y-i.y};return Tr(t.id,{position:l,size:n,hasBeenDragged:!0,offsetFromParent:s}),void setTimeout(()=>{Tt(D,!1)},200)}}Tr(t.id,{position:e,size:n,hasBeenDragged:!0})})(n(),Fn(l)),setTimeout(()=>{Tt(a,!1)},0))}const p={startResize:c};return{get isResizing(){return Fn(r)},get resizeDirection(){return Fn(o)},get size(){return Fn(l)},get hasBeenResized(){return Fn(s)},get isActive(){return Fn(r)},get justFinishedResizing(){return Fn(a)},start:c,setHasBeenResized:()=>{},setSize:function(e){Tt(l,e,!0),Tt(s,!0)},reset:function(){Tt(s,!1),Tt(l,{width:0,height:0},!0)},constrainToViewport:function(){const t=n(),r=e();if(!r)return;const o=nr(t.x,t.y,Fn(l).width||r.offsetWidth,Fn(l).height||r.offsetHeight);Tt(l,{width:o.width,height:o.height},!0),i({x:o.x,y:o.y})},handlers:p}}(()=>Fn(m),()=>O.position,e=>O.setPosition(e)),W=function(e,n,i,r,o,l,s,a,u){let d=Ot(!1),c=Ot(!1),f=Ot(!1),h=Ot(!1),p=Ot(null),v=Ot(null),g=null,m=null;function y(){m&&(clearTimeout(m),m=null)}function w(){const e=t.id,n=document.querySelector(`.modal-dock-item[data-modal-id="${lr(e)}"]`),i=document.querySelector('[data-dock-container="true"]'),r=n||i;if(r){const e=r.getBoundingClientRect();return{x:e.left+e.width/2,y:e.top+e.height/2}}return{x:window.innerWidth/2,y:window.innerHeight-40}}return Zt(()=>()=>{y(),Tt(d,!1),Tt(c,!1),Tt(f,!1),Tt(h,!1),Tt(p,null),Tt(v,null),g=null}),{get isMinimizing(){return Fn(d)},get isRestoring(){return Fn(c)},get isOpening(){return Fn(f)},get isClosing(){return Fn(h)},get animationTransform(){return Fn(p)},get pendingOpenSource(){return Fn(v)},startMinimize:function(e,t){const h=n();if(Fn(d)||!h)return;if(Tt(c,!1),Tt(f,!1),y(),!no()){const e=h.getBoundingClientRect();let n=o()?i():{x:e.left,y:e.top},d=s()?a():{width:e.width,height:e.height};return o()||(r(n),l(!0)),void(t?t():u(n,!0,d))}const v=h.getBoundingClientRect(),g=v.left+v.width/2,x=v.top+v.height/2;let b=o()?i():{x:v.left,y:v.top},k=s()?a():{width:v.width,height:v.height};o()||(r(b),l(!0));const z=e??w(),M=z.x-v.left,_=z.y-v.top,I={x:z.x-g,y:z.y-x,originX:M,originY:_};Tt(p,I,!0),requestAnimationFrame(()=>{requestAnimationFrame(()=>{Tt(d,!0)})}),m=setTimeout(()=>{t?t():u(b,!0,k)},500)},startRestore:function(e,t){if(!no()){const t=e||{x:window.innerWidth/2,y:window.innerHeight/2};return r(t),void l(!0)}const n=w(),i=e||{x:window.innerWidth/2,y:window.innerHeight/2},o=t||{width:480,height:400};r(i),l(!0);const s=i.x+o.width/2,a=i.y+o.height/2,u=n.x-i.x,d=n.y-i.y;Tt(p,{x:n.x-s,y:n.y-a,originX:u,originY:d},!0),Tt(c,!0),setTimeout(()=>{Tt(c,!1),Tt(p,null)},400)},startClose:function(e){Fn(h)||Fn(d)||(no()?(g=e,Tt(h,!0),setTimeout(()=>{Tt(h,!1),g&&(g(),g=null)},250)):e())},setPendingOpenSource:function(e){Tt(v,e,!0)},tryStartOpenAnimation:function(){const e=n();if(!Fn(v)||!e||Fn(f))return!1;if(!no())return Tt(v,null),!1;const t=Fn(v);Tt(v,null);const s=e.getBoundingClientRect(),a=o()?i():{x:s.left,y:s.top},u=s.width,d=s.height,c=a.x+u/2,h=a.y+d/2;o()||(r(a),l(!0));const g=t.x-a.x,m=t.y-a.y;return Tt(p,{x:t.x-c,y:t.y-h,originX:g,originY:m},!0),Tt(f,!0),setTimeout(()=>{Tt(f,!1),Tt(p,null)},400),!0},forceClearMinimize:function(){y(),Tt(d,!1),Tt(p,null)}}}(0,()=>Fn(m),()=>O.position,e=>O.setPosition(e),()=>O.hasBeenDragged,e=>O.setHasBeenDragged(e),()=>T.hasBeenResized,()=>T.size,(e,n,i)=>{Tr(t.id,{position:e,size:i,hasBeenDragged:n}),Cr(t.id)}),{trapFocus:R,focusFirstElement:B}={trapFocus:oo,focusFirstElement:lo},A=kt(()=>W.isMinimizing||W.isRestoring||W.isOpening||W.isClosing),$=kt(()=>(Ur(t.id)||Gr(t.id))&&!W.isRestoring);let j=Ot(!1);const H=kt(()=>W.isRestoring||W.isOpening||Fn(j)),L=kt(()=>Fn(M)&&!O.hasBeenDragged&&!Fn(A)&&!W.pendingOpenSource&&!Fn($)),F=kt(()=>{const e=[];return e.push(`z-index: ${Fn(E)};`),W.animationTransform?(e.push(`left: ${O.position.x}px; top: ${O.position.y}px;`),e.push(`--genie-origin-x: ${W.animationTransform.originX}px;`),e.push(`--genie-origin-y: ${W.animationTransform.originY}px;`),e.push(`--genie-translate-x: ${W.animationTransform.x}px;`),e.push(`--genie-translate-y: ${W.animationTransform.y}px;`)):O.hasBeenDragged&&e.push(`left: ${O.position.x}px; top: ${O.position.y}px; transform: none;`),T.hasBeenResized?e.push(`width: ${T.size.width}px; height: ${T.size.height}px; max-width: none; max-height: none;`):(t.preferredHeight&&e.push(`min-height: ${t.preferredHeight};`),n()&&e.push(`max-width: ${n()};`)),Fn(P)&&t.glow&&(e.push(`--modal-glow-color: ${t.glow.color};`),e.push(`--modal-glow-intensity: ${t.glow.intensity};`)),e.join(" ")});function N(){Fn(f)&&Cr(t.id)}function q(){var e;Xr(t.id)&&Yr(t.id),$r(t.id),null==(e=t.onClose)||e.call(t)}function X(){Zr(t.id)}function Y(e){Fn(c)&&Fn(m)&&O.onPointerDown(e,Fn(m))}function G(e){r()&&"Escape"===e.key&&Rr(t.id)&&(e.stopPropagation(),q())}function U(e){if(!Fn(m))return;const n=O.isDragging,i=T.hasBeenResized?T.size:{width:Fn(m).offsetWidth,height:Fn(m).offsetHeight};O.onPointerMove(e,Fn(m),i),O.isDragging&&n&&Dr(t.id,O.position,{drag:!0})}function V(e){if(!Fn(m))return;const n=O.isDragging;O.onPointerUp(e,Fn(m)),n&&!T.justFinishedResizing&&(Dr(t.id,O.position,{drag:!0}),function(e){const t=Qi();if("animated"!==t.parentChild.movementMode)return;const n=t.parentChild.animationDuration,i=[];let r=e;for(;;){const e=sr.get(r);if(!(null==e?void 0:e.parentId))break;i.push({parentId:e.parentId,childId:r}),r=e.parentId}i.forEach(({parentId:e,childId:t},i)=>{setTimeout(()=>{const i=sr.get(t),r=sr.get(e);if(!(null==i?void 0:i.position)||!i.offsetFromParent||!r)return;const o={x:i.position.x-i.offsetFromParent.x,y:i.position.y-i.offsetFromParent.y};zr.set(e,o),function(e){const t=zr.get(e);if(!t)return;const n=sr.get(e);n&&(sr.set(e,{...n,isAnimatingPosition:!0,position:t}),zr.delete(e),dr())}(e),setTimeout(()=>function(e){const t=sr.get(e);t&&(sr.set(e,{...t,isAnimatingPosition:!1}),dr())}(e),n)},i*n)})}(t.id))}function K(){var e;const n=Qi();if("smart"!==(null==(e=n.positioning)?void 0:e.strategy))return!1;const i=Fr(t.id);if(null==i?void 0:i.parentId)return!1;if((null==i?void 0:i.hasBeenDragged)||(null==i?void 0:i.position))return!1;const r=Fn(m)||document.querySelector(`[data-modal-id="${u}"]`);if(!r)return!1;const o=r.offsetWidth,l=r.offsetHeight;if(o<=0||l<=0)return!1;const s=n.positioning.modalGap??16,a=function(e){const t=[];for(const[n,i]of sr.entries())if(n!==e&&i.isOpen&&!i.isMinimized&&!i.isHiddenWithParent)if(i.position&&i.size)t.push({x:i.position.x,y:i.position.y,width:i.size.width,height:i.size.height});else{const e=document.querySelector(`[data-modal-id="${lr(n)}"]`);if(e){const n=e.getBoundingClientRect();t.push({x:n.left,y:n.top,width:n.width,height:n.height})}}return t}(t.id),d=function(e){if("undefined"==typeof document)return[];const t=[];for(const n of e)try{const e=document.querySelectorAll(n);for(const n of e){const e=n.getBoundingClientRect();e.width>0&&e.height>0&&t.push({x:e.left,y:e.top,width:e.width,height:e.height})}}catch{}return t}(n.positioning.avoidElements??[]),c=function(e,t,n,i={}){const{modalGap:r=16,gridResolution:o=10,avoidBounds:l=[],avoidMargin:s=16}=i,a=i.margin??r,u="undefined"!=typeof window?window.innerWidth:1920,d="undefined"!=typeof window?window.innerHeight:1080,c=l.map(e=>({x:e.x-s,y:e.y-s,width:e.width+2*s,height:e.height+2*s})),f={x:(u-e)/2,y:(d-t)/2};if(0===n.length&&0===c.length)return f;const h=a,p=Math.max(a,u-e-a),v=a,g=Math.max(a,d-t-a);if(p<=h||g<=v)return f;const m=rr(f.x,f.y,e,t,n,r),y=rr(f.x,f.y,e,t,c,0);if(0===m&&0===y)return f;const w=[],x=(p-h)/o,b=(g-v)/o;for(let i=0;i<=o;i++)for(let l=0;l<=o;l++){const o=h+i*x,s=v+l*b,f=rr(o,s,e,t,n,r),p=rr(o,s,e,t,c,0),g=or(o,s,e,t,u,d,a);w.push({pos:{x:o,y:s},modalOverlap:f,avoidOverlap:p,centerDist:g})}const k=w.filter(e=>0===e.avoidOverlap),z=k.length>0?k:w,M=e*t,_=Math.min(...z.map(e=>e.modalOverlap))/M;return z.sort((e,t)=>{if(0===k.length&&e.avoidOverlap!==t.avoidOverlap)return e.avoidOverlap-t.avoidOverlap;const n=e.modalOverlap/M,i=t.modalOverlap/M;if(_<.3){const r=.3,o=n<=r,l=i<=r;if(o&&l)return e.centerDist+.3*n-(t.centerDist+.3*i);if(o)return-1;if(l)return 1}return.6*n+.4*e.centerDist-(.6*i+.4*t.centerDist)}),z[0].pos}(o,l,a,{modalGap:s,avoidBounds:d});if(rr(c.x,c.y,o,l,a,s)/(o*l)>.1&&a.length>0){const e=function(e){const t=[];for(const[n,i]of sr.entries())if(n!==e&&i.isOpen&&!i.isMinimized&&!i.isHiddenWithParent&&!i.parentId)if(i.position&&i.size)t.push({id:lr(n),x:i.position.x,y:i.position.y,width:i.size.width,height:i.size.height});else{const e=document.querySelector(`[data-modal-id="${lr(n)}"]`);if(e){const i=e.getBoundingClientRect();t.push({id:lr(n),x:i.left,y:i.top,width:i.width,height:i.height})}}return t}(t.id),n=function(e,t,n,i={}){const{modalGap:r=16}=i,o=i.margin??r,l="undefined"!=typeof window?window.innerWidth:1920,s="undefined"!=typeof window?window.innerHeight:1080,a=n.reduce((e,t)=>e+t.width,0)+e,u=n.length*r,d=l-2*o;if(a+u>d)return null;const c=d-a-u;n.length;const f=c/2,h=l/2,p=[...n.map(e=>({id:e.id,width:e.width,height:e.height,currentX:e.x+e.width/2,currentY:e.y,isNew:!1})),{id:"__new__",width:e,height:t,currentX:h,currentY:(s-t)/2,isNew:!0}];p.sort((e,t)=>e.currentX-t.currentX);let v=o+f;const g=new Map;let m=null;for(const e of p){const t=v;if(e.isNew)m={x:Math.round(t),y:Math.round(e.currentY)};else{const i=n.find(t=>t.id===e.id);Math.abs(t-i.x)>5&&g.set(e.id,{x:Math.round(t),y:Math.round(i.y)})}v+=e.width+r}return m?{newModalPosition:m,existingModalMoves:g}:null}(o,l,e,{modalGap:s});if(n&&n.existingModalMoves.size>0)return function(e){const t=Qi().parentChild.animationDuration;for(const[t,n]of e){const e=sr.get(t);e&&sr.set(t,{...e,position:n,isAnimatingPosition:!0,hasBeenDragged:!0})}dr(),setTimeout(()=>{for(const t of e.keys()){const e=sr.get(t);e&&sr.set(t,{...e,isAnimatingPosition:!1})}dr()},t)}(n.existingModalMoves),O.setPosition(n.newModalPosition),O.setHasBeenDragged(!0),Dr(t.id,n.newModalPosition,{size:{width:o,height:l}}),!0}return O.setPosition(c),O.setHasBeenDragged(!0),Dr(t.id,c,{size:{width:o,height:l}}),!0}function Q(){Ln().then(()=>Ln()).then(()=>{let e=0;const t=()=>{e+=1,K()||e>5||requestAnimationFrame(t)};Fn(m)?t():requestAnimationFrame(t)})}var J;qi(()=>{var e;function n(){const e=Fr(t.id);if(!(null==e?void 0:e.position)||!Fn(m))return;if(e.parentId)return;const n=T.hasBeenResized?T.size.width:Fn(m).offsetWidth,i=T.hasBeenResized?T.size.height:Fn(m).offsetHeight;if(n<=0||i<=0)return;const r=tr(e.position.x,e.position.y,n,i);(Math.abs(r.x-e.position.x)>1||Math.abs(r.y-e.position.y)>1)&&(O.setPosition(r),Dr(t.id,r))}return o()||(e=i(),Sr({id:t.id,title:t.title,icon:t.icon??"",isOpen:e,isMinimized:!1,isHiddenWithParent:!1,isTransparent:!1,isRejected:!1,position:null,size:null,hasBeenDragged:!1,dockPosition:0,glow:t.glow??null,parentId:void 0,childId:void 0,offsetFromParent:void 0}),e&&Wr(t.id)),i()&&(Ln().then(()=>{Fn(m)&&B(Fn(m))}),Q()),window.addEventListener("pointermove",U),window.addEventListener("pointerup",V),window.addEventListener("resize",n),()=>{window.removeEventListener("pointermove",U),window.removeEventListener("pointerup",V),window.removeEventListener("resize",n)}}),J=()=>{eo(t.id),o()||Pr(t.id)},null===Xe&&He(),qi(()=>()=>Xn(J)),Zt(()=>{Nr();const e=Fr(t.id);if(e){if(Tt(y,e.isTransparent,!0),!O.isDragging&&!T.isResizing&&e.position){const t=O.position,n=e.position;(Math.abs(t.x-n.x)>.5||Math.abs(t.y-n.y)>.5)&&(O.setPosition(n),e.hasBeenDragged&&O.setHasBeenDragged(!0))}Ln().then(()=>function(){var e,n;if(!Fr(t.id))return;if(Xr(t.id))return Yr(t.id),void(null==(e=t.onClose)||e.call(t));if(Lr(t.id)&&!Fn(b)){if(Tt(b,!0),Fn(xr),Tt(xr,null),Fn(m)){const e=Fn(m).getBoundingClientRect(),n=O.hasBeenDragged?O.position:{x:e.left,y:e.top},i=T.hasBeenResized?T.size:{width:e.width,height:e.height};Tr(t.id,{position:n,size:i,hasBeenDragged:!0})}W.startMinimize(void 0,()=>{var e;e=t.id,Fn(fr).includes(e)&&Tt(fr,Fn(fr).filter(t=>t!==e),!0),Tt(b,!1)})}if(Gr(t.id)){n=t.id,Fn(gr).includes(n)&&Tt(gr,Fn(gr).filter(e=>e!==n),!0);const e=Fr(t.id);W.startRestore((null==e?void 0:e.position)??void 0,(null==e?void 0:e.size)??void 0),Ln().then(()=>{Fn(m)&&B(Fn(m))})}if(Ur(t.id)){!function(e){Fn(mr).includes(e)&&Tt(mr,Fn(mr).filter(t=>t!==e),!0)}(t.id);const e=Fr(t.id);W.startRestore((null==e?void 0:e.position)??void 0,(null==e?void 0:e.size)??void 0)}if(qr(t.id)&&(function(e){Fn(pr).includes(e)&&Tt(pr,Fn(pr).filter(t=>t!==e),!0)}(t.id),W.startClose(()=>{var e;eo(t.id),function(e){const t=sr.get(e);if(t){if(t.parentId){const n=sr.get(t.parentId);n&&n.childId===e&&sr.set(t.parentId,{...n,childId:void 0,lastChildId:e})}sr.set(e,{...t,isOpen:!1,isMinimized:!1,isHiddenWithParent:!1,isTransparent:!1,position:null,size:null,hasBeenDragged:!1,parentId:void 0,childId:void 0,offsetFromParent:void 0}),dr()}}(t.id),null==(e=t.onClose)||e.call(t)})),function(e){return Fn(hr).includes(e)}(t.id)){!function(e){Fn(hr).includes(e)&&Tt(hr,Fn(hr).filter(t=>t!==e),!0)}(t.id);const e=function(e){const t=br.get(e);return t&&br.delete(e),t??null}(t.id)||t.openSourcePosition||null;e?(W.setPendingOpenSource(e),Ln().then(()=>Ln()).then(()=>{K(),W.tryStartOpenAnimation()})):Q(),Ln().then(()=>{Fn(m)&&B(Fn(m))})}(function(e){return Fn(yr).includes(e)})(t.id)&&(function(e){Fn(yr).includes(e)&&Tt(yr,Fn(yr).filter(t=>t!==e),!0)}(t.id),function(e){Fn(wr).includes(e)||Tt(wr,[...Fn(wr),e],!0)}(t.id),Tt(k,!0),setTimeout(()=>{Tt(k,!1),function(e){Tt(wr,Fn(wr).filter(t=>t!==e),!0)}(t.id)},600));const i=function(e){if(!Fn(kr)||Fn(kr).childId!==e)return null;const t=Fn(kr);return Tt(kr,null),t}(t.id);var r;i&&Fn(m)&&(r=i.parentId,Ln().then(()=>Ln()).then(()=>{let e=0;const n=()=>{e+=1;const i=function(e){var n,i;const r=Fr(e);if(!r)return!1;const o=Fn(m)||document.querySelector(`[data-modal-id="${u}"]`),l=document.querySelector(`[data-modal-id="${lr(e)}"]`),s=null==l?void 0:l.getBoundingClientRect(),a=r.position??(s?{x:s.left,y:s.top}:null);if(!a||!o)return!1;const d=(null==(n=r.size)?void 0:n.width)??(null==l?void 0:l.offsetWidth)??(null==s?void 0:s.width)??480,c=(null==(i=r.size)?void 0:i.height)??(null==l?void 0:l.offsetHeight)??(null==s?void 0:s.height)??400,f=o.offsetWidth,h=o.offsetHeight;if(d<=0||c<=0||f<=0||h<=0)return!1;const p={x:a.x+(d-f)/2,y:a.y+(c-h)/2};return O.setPosition(p),O.setHasBeenDragged(!0),Dr(t.id,p,{size:{width:f,height:h}}),r.position&&r.size||!s||Dr(e,{x:s.left,y:s.top},{size:{width:d,height:c}}),function(e,t){if(!Qi().features.parentChild)return;const n=sr.get(e),i=sr.get(t);if(!n||!i)return;let r={x:40,y:40};n.position&&i.position&&(r={x:i.position.x-n.position.x,y:i.position.y-n.position.y});const o=Math.max(i.zIndex,n.zIndex+1);sr.set(e,{...n,childId:t,lastChildId:t}),sr.set(t,{...i,parentId:e,offsetFromParent:r,zIndex:o}),dr()}(e,t.id),!0}(r);i||e>5||requestAnimationFrame(n)};Fn(m)?n():requestAnimationFrame(n)}))}())}}),Zt(()=>{const e=Fr(t.id);e&&e.isTransparent!==Fn(y)&&Tt(y,e.isTransparent,!0)}),Zt(()=>{if(Fn(M)&&Fn(m)){const e=e=>function(e){Fn(m)&&R(e,Fn(m))}(e);return Fn(m).addEventListener("keydown",e),()=>{var t;return null==(t=Fn(m))?void 0:t.removeEventListener("keydown",e)}}}),Zt(()=>{!Fn(M)&&W.isMinimizing&&W.forceClearMinimize()}),Zt(()=>{W.isRestoring||W.isOpening?Tt(j,!0):Fn(j)&&requestAnimationFrame(()=>{Tt(j,!1)})}),Zt(()=>{Fn(x)&&!Fn(_)&&(Tt(w,!0),setTimeout(()=>{Tt(w,!1)},200)),Tt(x,Fn(_),!0)});var Z=ri(),ee=Gt(Z),te=e=>{uo(e,{get target(){return a},children:(e,n)=>{var i=Oo();let r;i.__keydown=G;var o=Yt(i);{let e=kt(()=>Fn(c)?Y:void 0);!function(e,t){Ue(t,!0);let n=Ni(t,"isTransparent",0,!1),i=Ni(t,"headerLayout",0,"macos"),r=Ni(t,"minimizable",0,!0),o=Ni(t,"minimizeDisabled",0,!1),l=Ni(t,"transparencyEnabled",0,!0);const s=Ge(Xi),a=kt(()=>null==s?void 0:s()),u=kt(()=>"macos"===i());var d=_o();let c;d.__pointerdown=function(e){var n;e.target.closest("button")||null==(n=t.onStartDrag)||n.call(t,e)};var f=Yt(d),h=e=>{var n=mo(),i=Gt(n),s=Yt(i);s.__click=function(...e){var n;null==(n=t.onClose)||n.apply(this,e)};var u=Ut(s,2),d=e=>{var n=co();let i;n.__click=function(...e){var n;null==(n=o()?void 0:t.onMinimize)||n.apply(this,e)},rn(()=>{i=Wi(n,0,"modal-header-light modal-header-light-minimize",null,i,{"modal-header-light-disabled":o()}),n.disabled=o(),ji(n,"title",o()?"Enable dock to minimize":void 0)}),oi(e,n)};hi(u,e=>{r()&&e(d)});var c=Ut(u,2),f=e=>{var n=fo();n.__click=function(...e){var n;null==(n=t.onToggleStyle)||n.apply(this,e)},oi(e,n)};hi(c,e=>{l()&&e(f)});var h=Yt(Ut(i,2)),p=e=>{var n=ho();bi(Yt(n),()=>t.customIcon),oi(e,n)},v=e=>{var n=ri(),i=Gt(n),r=e=>{var n=po();bi(Yt(n),()=>Fn(a),()=>t.icon),oi(e,n)};hi(i,e=>{t.icon&&Fn(a)&&e(r)},!0),oi(e,n)};hi(h,e=>{t.customIcon?e(p):e(v,!1)});var g=Yt(Ut(h,2)),m=e=>{var n=vo(),i=Yt(n);rn(()=>{ji(n,"id",t.titleId),si(i,t.title)}),oi(e,n)},y=e=>{var n=go(),i=Yt(n);rn(()=>si(i,t.title)),oi(e,n)};hi(g,e=>{t.titleId?e(m):e(y,!1)}),oi(e,n)},p=e=>{var n=Mo(),i=Gt(n),s=Yt(i),u=e=>{var n=yo();bi(Yt(n),()=>t.customIcon),oi(e,n)},d=e=>{var n=ri(),i=Gt(n),r=e=>{var n=wo();bi(Yt(n),()=>Fn(a),()=>t.icon),oi(e,n)};hi(i,e=>{t.icon&&Fn(a)&&e(r)},!0),oi(e,n)};hi(s,e=>{t.customIcon?e(u):e(d,!1)});var c=Ut(s,2),f=e=>{var n=xo(),i=Yt(n);rn(()=>{ji(n,"id",t.titleId),si(i,t.title)}),oi(e,n)},h=e=>{var n=bo(),i=Yt(n);rn(()=>si(i,t.title)),oi(e,n)};hi(c,e=>{t.titleId?e(f):e(h,!1)});var p=Yt(Ut(i,2)),v=e=>{var n=ko();n.__click=function(...e){var n;null==(n=t.onToggleStyle)||n.apply(this,e)},oi(e,n)};hi(p,e=>{l()&&e(v)});var g=Ut(p,2),m=e=>{var n=zo();let i;n.__click=function(...e){var n;null==(n=o()?void 0:t.onMinimize)||n.apply(this,e)},rn(()=>{i=Wi(n,0,"modal-header-btn-windows",null,i,{"modal-header-btn-windows-disabled":o()}),n.disabled=o(),ji(n,"title",o()?"Enable dock to minimize":void 0)}),oi(e,n)};hi(g,e=>{r()&&e(m)}),Ut(g,2).__click=function(...e){var n;null==(n=t.onClose)||n.apply(this,e)},oi(e,n)};hi(f,e=>{Fn(u)?e(h):e(p,!1)}),rn(()=>c=Wi(d,0,"modal-header",null,c,{"modal-header-draggable":!!t.onStartDrag,transparent:n()})),oi(e,d),Ve()}(o,{get title(){return t.title},get customIcon(){return t.customIcon},get icon(){return t.icon},get isTransparent(){return Fn(y)},get titleId(){return Fn(C)},get headerLayout(){return Fn(g)},get onStartDrag(){return Fn(e)},onToggleStyle:X,onMinimize:N,onClose:q,get minimizable(){return Fn(f)},get minimizeDisabled(){return Fn(h)},get transparencyEnabled(){return Fn(p)}})}var l=Ut(o,2);bi(Yt(l),()=>t.children??xe),Ei(l,(e,t)=>null==Po?void 0:Po(e,t),()=>t.bodyElement);var s=Ut(l,2),a=e=>{var n=Co(),i=Yt(n),r=e=>{var n=ri();bi(Gt(n),()=>t.footer),oi(e,n)};hi(i,e=>{t.footer&&e(r)}),Ei(n,(e,t)=>null==Po?void 0:Po(e,t),()=>t.footerElement),oi(e,n)};hi(s,e=>{(t.footer||t.footerElement)&&e(a)});var d=Ut(s,2);{let e=kt(()=>Fn(v)&&!Fn(_)?T.handlers.startResize:void 0);!function(e,t){Ue(t,!0);const n=["n","s","e","w","ne","nw","se","sw"];var i=ri(),r=Gt(i),o=e=>{var i=So();mi(i,21,()=>n,pi,(e,n)=>{var i=Io();i.__pointerdown=e=>function(e,n){var i;null==(i=t.onStartResize)||i.call(t,e,n)}(e,Fn(n)),rn(()=>Wi(i,0,`modal-resize-handle modal-resize-${Fn(n)??""}`)),oi(e,i)}),oi(e,i)};hi(r,e=>{t.onStartResize&&e(o)}),oi(e,i),Ve()}(d,{get onStartResize(){return Fn(e)}})}var x,b,M,E=Ut(d,2),R=e=>{var t=Eo();let n;rn(()=>n=Wi(t,0,"modal-child-overlay",null,n,{"modal-overlay-closing":Fn(w)})),oi(e,t)};hi(E,e=>{Fn(S)&&e(R)}),Fi(i,e=>Tt(m,e),()=>Fn(m)),rn(()=>{var e;r=Wi(i,0,"modal-dialog",null,r,{"modal-dragging":O.isDragging,"modal-resizing":T.isResizing,"modal-positioned":O.hasBeenDragged,"modal-minimizing":W.isMinimizing,"modal-restoring":W.isRestoring,"modal-opening":W.isOpening,"modal-closing":W.isClosing,"modal-centered":Fn(L),"modal-solid":!Fn(y),"modal-transparent":Fn(y),"modal-glow":Fn(P),"modal-has-child":Fn(_),"modal-is-child":Fn(I),"modal-visible-by-animation":Fn(H),"modal-animating-to-center":Fn(D),"modal-animating-position":null==(e=Fn(z))?void 0:e.isAnimatingPosition,"modal-attention":Fn(k)}),ji(i,"data-modal-id",u),Bi(i,Fn(F)),ji(i,"aria-labelledby",Fn(C))}),M=function(e,t,n,i={}){function r(e){if(i.capture||ti.call(t,e),!e.cancelBubble)return Vt(()=>null==n?void 0:n.call(this,e))}return e.startsWith("pointer")||e.startsWith("touch")||"wheel"===e?Ze(()=>{t.addEventListener(e,r,i)}):t.addEventListener(e,r,i),r}("pointerdown",x=i,()=>Wr(t.id),b={capture:!0,passive:void 0}),(x===document.body||x===window||x===document||x instanceof HTMLMediaElement)&&Jt(()=>{x.removeEventListener("pointerdown",M,b)}),oi(e,i)},$$slots:{default:!0}})};hi(ee,e=>{Fn(M)&&e(te)}),oi(e,Z),Ve()}function To({id:e,title:t,icon:n,maxWidth:i="600px",preferredHeight:r,autoOpen:o=!1,glow:l,config:s,closeOnEscape:a=!0,onClose:u,children:d,footer:c}){const f=Q(null),h=Q(null),p=Q(null),v=Q(null),[g,m]=J(!1),[y,w]=J(!1);Z(()=>(Sr({id:e,title:t,icon:n??"",isOpen:o,isMinimized:!1,isHiddenWithParent:!1,isTransparent:!1,isRejected:!1,position:null,size:null,hasBeenDragged:!1,dockPosition:0,glow:l??null}),m(!0),()=>{Pr(e)}),[e]),Z(()=>{if(!g||!f.current)return;const o=d?(p.current||"undefined"==typeof document||(p.current=document.createElement("div"),p.current.className="react-modal-body-content"),p.current):null,l=c?(v.current||"undefined"==typeof document||(v.current=document.createElement("div"),v.current.className="react-modal-footer-content"),v.current):null;return h.current=ai(Do,{target:f.current,props:{id:e,title:t,icon:n??"",maxWidth:i,preferredHeight:r,closeOnEscape:a,onClose:u,bodyElement:o,footerElement:l}}),w(!0),()=>{h.current&&(ci(h.current),h.current=null,w(!1)),p.current=null,v.current=null}},[g,e]);const x=lr(e),b=y?p.current:null,k=y?v.current:null;return ue.jsxs(ue.Fragment,{children:[ue.jsx("div",{ref:f,"data-modal-bridge":x,style:{display:"contents"}}),b&&d&&ne(d,b),k&&c&&ne(c,k)]})}function Wo({config:e,children:t}){return Z(()=>{e&&Ji(e),Tt(Zi,Qi().zIndex.base,!0);const t=Qi().portalTarget;let n=null;return"string"==typeof t&&"undefined"!=typeof document&&(document.querySelector(t)||(n=document.createElement("div"),n.id=t.replace("#",""),document.body.appendChild(n))),()=>{Ui={...Gi},Rt(Vi),Tt(Zi,Qi().zIndex.base,!0),n&&n.remove()}},[e]),K.createElement(K.Fragment,null,t)}function Ro(e){const t=e-1;return t*t*t+1}function Bo(e){const t="string"==typeof e&&e.match(/^\s*(-?[\d.]+)([^\s]*)\s*$/);return t?[parseFloat(t[1]),t[2]||"px"]:[e,"px"]}function Ao(e,{delay:t=0,duration:n=400,easing:i=Ro,x:r=0,y:o=0,opacity:l=0}={}){const s=getComputedStyle(e),a=+s.opacity,u="none"===s.transform?"":s.transform,d=a*(1-l),[c,f]=Bo(r),[h,p]=Bo(o);return{delay:t,duration:n,easing:i,css:(e,t)=>`\n\t\t\ttransform: ${u} translate(${(1-e)*c}${f}, ${(1-e)*h}${p});\n\t\t\topacity: ${a-d*t}`}}function $o(e,{delay:t=0,duration:n=400,easing:i=Ro,start:r=0,opacity:o=0}={}){const l=getComputedStyle(e),s=+l.opacity,a="none"===l.transform?"":l.transform,u=1-r,d=s*(1-o);return{delay:t,duration:n,easing:i,css:(e,t)=>`\n\t\t\ttransform: ${a} scale(${1-u*t});\n\t\t\topacity: ${s-d*t}\n\t\t`}}function jo(e){const t=1.70158;return--e*e*((t+1)*e+t)+1}function Ho(e){const t=e-1;return t*t*t+1}Zn(["keydown"]);var Lo=ii('<button type="button" aria-label="Drag dock"></button>'),Fo=ii('<span class="modal-dock-item-icon-placeholder"> </span>'),No=ii('<span class="modal-dock-item-label"> </span>'),qo=ii("<span>+</span>"),Xo=ii('<span class="modal-dock-child-indicator"><!></span>'),Yo=ii('<button><span class="modal-dock-item-icon"><!></span> <!> <span class="modal-dock-item-glow"></span> <!></button>'),Go=ii('<div data-dock-container="true"><div><!> <!></div></div>');function Uo(e,t){Ue(t,!0);const n=Ge(Xi),i=kt(()=>t.renderIcon??(null==n?void 0:n())),r=Jr(),o=kt(()=>(Ki(),Qi())),l=kt(()=>Qi().zIndex.dock),s=kt(()=>Fn(o).dock.position),a=kt(()=>Fn(o).dock.labelMode);let u=Ot("horizontal"),d=Ot($t({x:100,y:100})),c=Ot(null),f=Ot(!1),h={x:0,y:0},p=null;const v=kt(()=>(Nr(),Array.from(r.modals.values()).filter(e=>e.isMinimized).sort((e,t)=>e.dockPosition-t.dockPosition))),g=kt(()=>{switch(Fn(s)){case"left":return{x:-20,duration:250,easing:Ho};case"right":return{x:20,duration:250,easing:Ho};default:return{y:20,duration:250,easing:Ho}}});function m(e){var t;"free"===Fn(s)&&(Tt(f,!0),p=e.pointerId,h={x:e.clientX-Fn(d).x,y:e.clientY-Fn(d).y},null==(t=e.currentTarget)||t.setPointerCapture(e.pointerId),window.addEventListener("pointermove",y),window.addEventListener("pointerup",w),window.addEventListener("pointercancel",w))}function y(e){if(e.pointerId!==p||!Fn(c))return;const t=Fn(c).getBoundingClientRect(),n=window.innerWidth-t.width-8,i=window.innerHeight-t.height-8,r=Math.min(Math.max(e.clientX-h.x,8),Math.max(8,n)),o=Math.min(Math.max(e.clientY-h.y,8),Math.max(8,i));Tt(d,{x:Math.round(r),y:Math.round(o)},!0)}function w(e){e.pointerId===p&&(Tt(f,!1),p=null,window.removeEventListener("pointermove",y),window.removeEventListener("pointerup",w),window.removeEventListener("pointercancel",w))}const{addListener:x}=function(){function e(e,t,n){return"undefined"==typeof window?()=>{}:(window.addEventListener(e,t,n),()=>{window.removeEventListener(e,t,n)})}return{addListener:e,addListenerEffect:function(t,n,i){Zt(()=>{if("undefined"!=typeof window)return e(t,n,i)})}}}();function b(){if("free"!==Fn(s)||!Fn(c))return;const e=Fn(c).getBoundingClientRect(),t=tr(Fn(d).x,Fn(d).y,e.width,e.height);t.x===Fn(d).x&&t.y===Fn(d).y||Tt(d,{x:Math.round(t.x),y:Math.round(t.y)},!0)}Zt(()=>{"undefined"!=typeof window&&x("resize",b)});var k={setDockOrientation:function(e){Tt(u,e,!0)},setDockFreePosition:function(e){Tt(d,e,!0)},getDockState:function(){return{dockPosition:Fn(s),dockOrientation:Fn(u),dockFreePosition:Fn(d),dockLabelMode:Fn(a)}}};return uo(e,{get target(){return Fn(o).portalTarget},children:(e,t)=>{var n=Go();let o,h;var p=Yt(n);let y;var w=Yt(p),x=e=>{var t=Lo();let n;t.__pointerdown=m,rn(()=>n=Wi(t,0,"modal-dock-handle",null,n,{"modal-dock-handle-dragging":Fn(f)})),oi(e,t)};hi(w,e=>{"free"===Fn(s)&&e(x)}),mi(Ut(w,2),19,()=>Fn(v),e=>e.id,(e,t,n)=>{const o=kt(()=>Fn(t).lastChildId?r.modals.get(Fn(t).lastChildId):null);var l=Yo();let s;l.__click=e=>{var n;n=Fn(t).id,Mr.has(n)?e.currentTarget.animate([{transform:"translateX(0)"},{transform:"translateX(-6px)"},{transform:"translateX(6px)"},{transform:"translateX(-6px)"},{transform:"translateX(6px)"},{transform:"translateX(0)"}],{duration:300,easing:"ease-in-out"}):Er(Fn(t).id)};var u=Yt(l),d=Yt(u),c=e=>{var n=ri();bi(Gt(n),()=>Fn(i),()=>Fn(t).icon),oi(e,n)},f=e=>{var n=Fo(),i=Yt(n);rn(e=>si(i,e),[()=>Fn(t).title.charAt(0)]),oi(e,n)};hi(d,e=>{Fn(t).icon&&Fn(i)?e(c):e(f,!1)});var h=Ut(u,2),p=e=>{var n=No(),i=Yt(n);rn(()=>si(i,Fn(t).title)),oi(e,n)};hi(h,e=>{"hidden"!==Fn(a)&&e(p)});var v=Ut(h,4),g=e=>{var t=Xo(),n=Yt(t),r=e=>{var t=ri();bi(Gt(t),()=>Fn(i),()=>Fn(o).icon),oi(e,t)},l=e=>{oi(e,qo())};hi(n,e=>{Fn(o).icon&&Fn(i)?e(r):e(l,!1)}),oi(e,t)};hi(v,e=>{Fn(t).lastChildId&&Fn(o)&&e(g)}),rn(e=>{s=Wi(l,0,"modal-dock-item",null,s,{"modal-dock-item-has-glow":!!Fn(t).glow,"modal-dock-item-has-child":!!Fn(t).lastChildId,"modal-dock-item-label-beside":"beside"===Fn(a),"modal-dock-item-label-below":"below"===Fn(a)}),ji(l,"data-modal-id",e),Bi(l,Fn(t).glow?`--modal-dock-glow-color: ${Fn(t).glow.color};`:"")},[()=>lr(Fn(t).id)]),Pi(3,l,()=>$o,()=>({duration:300,delay:50*Fn(n),easing:jo,start:.5})),oi(e,l)}),Fi(n,e=>Tt(c,e),()=>Fn(c)),rn(()=>{o=Wi(n,0,"modal-dock-container",null,o,{"modal-dock-left":"left"===Fn(s),"modal-dock-right":"right"===Fn(s),"modal-dock-bottom":"bottom"===Fn(s),"modal-dock-free":"free"===Fn(s),"modal-dock-empty":0===Fn(v).length}),h=Bi(n,"free"===Fn(s)?`left: ${Fn(d).x}px; top: ${Fn(d).y}px;`:"",h,{"z-index":Fn(l)}),y=Wi(p,0,"modal-dock",null,y,{"modal-dock-free-horizontal":"free"===Fn(s)&&"horizontal"===Fn(u),"modal-dock-free-vertical":"free"===Fn(s)&&"vertical"===Fn(u)})}),Pi(3,n,()=>Ao,()=>Fn(v).length>0?Fn(g):{duration:0}),oi(e,n)},$$slots:{default:!0}}),Ve(k)}function Vo({renderIcon:e}){const t=Q(null),n=Q(null);return Z(()=>{if(t.current)return n.current=ai(Uo,{target:t.current,props:{}}),()=>{n.current&&(ci(n.current),n.current=null)}},[]),ue.jsx("div",{ref:t,"data-dock-bridge":"true",style:{display:"contents"}})}function Ko(e,t){if(!Qr(e))throw new Error(`Cannot call ${t}() on unregistered modal "${String(e)}". Ensure the Modal component is rendered.`)}Zn(["pointerdown","click"]);const Qo=new Map;function Jo(e){const t=ee(()=>function(e){const t=Jr().modals.get(e),n=void 0!==t&&!t.isMinimized,i=(null==t?void 0:t.isMinimized)??!1,r=void 0!==t,o=Qo.get(e);if(o&&o.isOpen===n&&o.isMinimized===i&&o.isRegistered===r)return o;const l={isOpen:n,isMinimized:i,isRegistered:r};return Qo.set(e,l),l}(e),[e]);return{...te(cr,t,t),open:ee(t=>{Ko(e,"open"),Ar(e,t)},[e]),close:ee(()=>{Ko(e,"close"),$r(e)},[e]),minimize:ee(()=>{Ko(e,"minimize"),Cr(e)},[e]),restore:ee(()=>{Ko(e,"restore"),Er(e)},[e]),openChild:ee((t,n)=>{Ko(e,"openChild"),Hr({id:t},e,n)},[e]),shake:ee(()=>{Ko(e,"shake"),Vr(e)},[e]),bringToFront:ee(()=>{Ko(e,"bringToFront"),Wr(e)},[e])}}let Zo=null;function el(){const e=Jr(),t=Array.from(e.modals.values()),n=t.filter(e=>e.isMinimized).length,i=t.filter(e=>!e.isMinimized).length;return Zo&&Zo.modals===e.modals&&Zo.minimizedCount===n&&Zo.openCount===i||(Zo={modals:e.modals,minimizedCount:n,openCount:i}),Zo}function tl(){return te(cr,el,el)}export{Vo as Dock,To as Modal,Wo as ModalProvider,Wr as bringToFront,jr as closeAllModals,$r as closeModal,Qi as getConfig,Kr as isModalOpen,Qr as isModalRegistered,Rr as isTopModal,Cr as minimizeModal,Hr as openChildModal,Ar as openModal,Br as reorderDock,Er as restoreModal,Ji as setConfig,Zr as toggleModalTransparency,Jo as useModal,tl as useModals};
1
+ import{r as e,u as n,m as t,M as r,a as o,t as i,s as l,i as s,g as c,b as u,c as a,D as d,d as m,o as p,e as f,f as g,h,j as y,k as M,l as z,n as v,p as C}from"./runtime.js";import{q as E,v as b,w as O}from"./runtime.js";import{jsxs as j,Fragment as k,jsx as w}from"react/jsx-runtime";import x,{useRef as T,useState as F,useEffect as H,useCallback as R,useSyncExternalStore as W}from"react";import{createPortal as A}from"react-dom";function D({id:l,title:s,icon:c,maxWidth:u="600px",preferredHeight:a,autoOpen:d=!1,glow:m,config:p,closeOnEscape:f=!0,onClose:g,children:h,footer:y}){const M=T(null),z=T(null),v=T(null),C=T(null),[E,b]=F(!1),[O,x]=F(!1);H(()=>(e({id:l,title:s,icon:c??"",isOpen:d,isMinimized:!1,isHiddenWithParent:!1,isTransparent:!1,isRejected:!1,position:null,size:null,hasBeenDragged:!1,dockPosition:0,glow:m??null}),b(!0),()=>{n(l)}),[l]),H(()=>{if(!E||!M.current)return;const e=h?(v.current||"undefined"==typeof document||(v.current=document.createElement("div"),v.current.className="react-modal-body-content"),v.current):null,n=y?(C.current||"undefined"==typeof document||(C.current=document.createElement("div"),C.current.className="react-modal-footer-content"),C.current):null;return z.current=t(r,{target:M.current,props:{id:l,title:s,icon:c??"",maxWidth:u,preferredHeight:a,closeOnEscape:f,onClose:g,bodyElement:e,footerElement:n}}),x(!0),()=>{z.current&&(o(z.current),z.current=null,x(!1)),v.current=null,C.current=null}},[E,l]);const R=i(l),W=O?v.current:null,D=O?C.current:null;return j(k,{children:[w("div",{ref:M,"data-modal-bridge":R,style:{display:"contents"}}),W&&h&&A(h,W),D&&y&&A(y,D)]})}function N({config:e,children:n}){return H(()=>{e&&l(e),s();const n=c().portalTarget;let t=null;return"string"==typeof n&&"undefined"!=typeof document&&(document.querySelector(n)||(t=document.createElement("div"),t.id=n.replace("#",""),document.body.appendChild(t))),()=>{u(),a(),t&&t.remove()}},[e]),x.createElement(x.Fragment,null,n)}function P({renderIcon:e}){const n=T(null),r=T(null);return H(()=>{if(n.current)return r.current=t(d,{target:n.current,props:{}}),()=>{r.current&&(o(r.current),r.current=null)}},[]),w("div",{ref:n,"data-dock-bridge":"true",style:{display:"contents"}})}function S(e,n){if(!C(e))throw new Error(`Cannot call ${n}() on unregistered modal "${String(e)}". Ensure the Modal component is rendered.`)}const $=new Map;function q(e){const n=R(()=>function(e){const n=v().modals.get(e),t=void 0!==n&&!n.isMinimized,r=(null==n?void 0:n.isMinimized)??!1,o=void 0!==n,i=$.get(e);if(i&&i.isOpen===t&&i.isMinimized===r&&i.isRegistered===o)return i;const l={isOpen:t,isMinimized:r,isRegistered:o};return $.set(e,l),l}(e),[e]);return{...W(m,n,n),open:R(n=>{S(e,"open"),p(e,n)},[e]),close:R(()=>{S(e,"close"),f(e)},[e]),minimize:R(()=>{S(e,"minimize"),g(e)},[e]),restore:R(()=>{S(e,"restore"),h(e)},[e]),openChild:R((n,t)=>{S(e,"openChild"),y({id:n},e,t)},[e]),shake:R(()=>{S(e,"shake"),M(e)},[e]),bringToFront:R(()=>{S(e,"bringToFront"),z(e)},[e])}}let B=null;function I(){const e=v(),n=Array.from(e.modals.values()),t=n.filter(e=>e.isMinimized).length,r=n.filter(e=>!e.isMinimized).length;return B&&B.modals===e.modals&&B.minimizedCount===t&&B.openCount===r||(B={modals:e.modals,minimizedCount:t,openCount:r}),B}function G(){return W(m,I,I)}export{P as Dock,D as Modal,N as ModalProvider,z as bringToFront,E as closeAllModals,f as closeModal,c as getConfig,b as isModalOpen,C as isModalRegistered,g as minimizeModal,y as openChildModal,p as openModal,h as restoreModal,l as setConfig,O as toggleModalTransparency,q as useModal,G as useModals};
@@ -0,0 +1 @@
1
+ var t,e,n,i,r,o,s,a,l,d,u,c,f,h,p,v,g,m,w,y,x,b,M,z,k,I,_,P,D,C,S,O,E,W,T,B,R,A,L,H,$,F,q=Object.defineProperty,j=t=>{throw TypeError(t)},X=(t,e,n)=>((t,e,n)=>e in t?q(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n)(t,"symbol"!=typeof e?e+"":e,n),Y=(t,e,n)=>e.has(t)||j("Cannot "+n),N=(t,e,n)=>(Y(t,e,"read from private field"),n?n.call(t):e.get(t)),K=(t,e,n)=>e.has(t)?j("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),G=(t,e,n,i)=>(Y(t,e,"write to private field"),i?i.call(t,n):e.set(t,n),n),V=(t,e,n)=>(Y(t,e,"access private method"),n);const U=Symbol();var Q=Array.isArray,J=Array.prototype.indexOf,Z=Array.from,tt=Object.defineProperty,et=Object.getOwnPropertyDescriptor,nt=Object.getOwnPropertyDescriptors,it=Object.prototype,rt=Array.prototype,ot=Object.getPrototypeOf,st=Object.isExtensible;const at=()=>{};function lt(){var t,e;return{promise:new Promise((n,i)=>{t=n,e=i}),resolve:t,reject:e}}const dt=16,ut=512,ct=1024,ft=2048,ht=4096,pt=8192,vt=16384,gt=32768,mt=65536,wt=1<<18,yt=1<<19,xt=1<<25,bt=32768,Mt=1<<21,zt=1<<23,kt=Symbol("$state"),It=Symbol(""),_t=new class extends Error{constructor(){super(...arguments),X(this,"name","StaleReactionError"),X(this,"message","The reaction that called `getAbortSignal()` was re-run or destroyed")}};function Pt(t){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function Dt(t){return t===this.v}function Ct(t,e){return t!=t?e==e:t!==e||null!==t&&"object"==typeof t||"function"==typeof t}function St(t){return!Ct(t,this.v)}let Ot=null;function Et(t){Ot=t}function Wt(t){return Rt().get(t)}function Tt(t,e=!1,n){Ot={p:Ot,i:!1,c:null,e:null,s:t,x:null,l:null}}function Bt(t){var e=Ot,n=e.e;if(null!==n)for(var i of(e.e=null,n))$e(i);return void 0!==t&&(e.x=t),e.i=!0,Ot=e.p,t??{}}function Rt(t){return null===Ot&&Pt(),Ot.c??(Ot.c=new Map(function(){let t=Ot.p;for(;null!==t;){const e=t.c;if(null!==e)return e;t=t.p}return null}()||void 0))}let At=[];function Lt(){var t=At;At=[],function(t){for(var e=0;e<t.length;e++)t[e]()}(t)}function Ht(t){if(0===At.length&&!Vt){var e=At;queueMicrotask(()=>{e===At&&Lt()})}At.push(t)}function $t(){for(;At.length>0;)Lt()}function Ft(t){var e=dn;if(null===e)return sn.f|=zt,t;if(0===(e.f&gt)){if(!(128&e.f))throw t;e.b.error(t)}else qt(t,e)}function qt(t,e){for(;null!==e;){if(128&e.f)try{return void e.b.error(t)}catch(e){t=e}e=e.parent}throw t}const jt=new Set;let Xt=null,Yt=null,Nt=[],Kt=null,Gt=!1,Vt=!1;t=new WeakMap,e=new WeakMap,n=new WeakMap,i=new WeakMap,r=new WeakMap,o=new WeakMap,s=new WeakMap,a=new WeakSet,l=function(t,e){var n;t.f^=ct;for(var i=t.first;null!==i;){var r=i.f,s=!!(96&r),l=s&&0!==(r&ct)||0!==(r&pt)||this.skipped_effects.has(i);if(!!(128&i.f)&&(null==(n=i.b)?void 0:n.is_pending())&&(e={parent:e,effect:i,effects:[],render_effects:[]}),!l&&null!==i.fn){s?i.f^=ct:4&r?e.effects.push(i):bn(i)&&(0!==(i.f&dt)&&N(this,o).add(i),_n(i));var u=i.first;if(null!==u){i=u;continue}}var c=i.parent;for(i=i.next;null===i&&null!==c;)c===e.effect&&(V(this,a,d).call(this,e.effects),V(this,a,d).call(this,e.render_effects),e=e.parent),i=c.next,c=c.parent}},d=function(t){for(const e of t)0!==(e.f&ft)?N(this,o).add(e):0!==(e.f&ht)&&N(this,s).add(e),V(this,a,u).call(this,e.deps),Wn(e,ct)},u=function(t){if(null!==t)for(const e of t)2&e.f&&0!==(e.f&bt)&&(e.f^=bt,V(this,a,u).call(this,e.deps))},c=function(){if(0===N(this,i)){for(const e of N(this,t))e();N(this,t).clear()}0===N(this,n)&&V(this,a,f).call(this)},f=function(){var t;if(jt.size>1){this.previous.clear();var e=Yt,n=!0,i={parent:null,effect:null,effects:[],render_effects:[]};for(const e of jt){if(e===this){n=!1;continue}const o=[];for(const[t,i]of this.current){if(e.current.has(t)){if(!n||i===e.current.get(t))continue;e.current.set(t,i)}o.push(t)}if(0===o.length)continue;const s=[...e.current.keys()].filter(t=>!this.current.has(t));if(s.length>0){var r=Nt;Nt=[];const n=new Set,d=new Map;for(const t of o)ee(t,s,n,d);if(Nt.length>0){Xt=e,e.apply();for(const n of Nt)V(t=e,a,l).call(t,n,i);e.deactivate()}Nt=r}}Xt=null,Yt=e}this.committed=!0,jt.delete(this)};let Ut=class u{constructor(){K(this,a),X(this,"committed",!1),X(this,"current",new Map),X(this,"previous",new Map),K(this,t,new Set),K(this,e,new Set),K(this,n,0),K(this,i,0),K(this,r,null),K(this,o,new Set),K(this,s,new Set),X(this,"skipped_effects",new Set),X(this,"is_fork",!1)}is_deferred(){return this.is_fork||N(this,i)>0}process(t){var e;Nt=[],this.apply();var n={parent:null,effect:null,effects:[],render_effects:[]};for(const e of t)V(this,a,l).call(this,e,n);this.is_fork||V(this,a,c).call(this),this.is_deferred()?(V(this,a,d).call(this,n.effects),V(this,a,d).call(this,n.render_effects)):(Xt=null,te(n.render_effects),te(n.effects),null==(e=N(this,r))||e.resolve()),Yt=null}capture(t,e){this.previous.has(t)||this.previous.set(t,e),0===(t.f&zt)&&(this.current.set(t,t.v),null==Yt||Yt.set(t,t.v))}activate(){Xt=this,this.apply()}deactivate(){Xt===this&&(Xt=null,Yt=null)}flush(){if(this.activate(),Nt.length>0){if(Qt(),null!==Xt&&Xt!==this)return}else 0===N(this,n)&&this.process([]);this.deactivate()}discard(){for(const t of N(this,e))t(this);N(this,e).clear()}increment(t){G(this,n,N(this,n)+1),t&&G(this,i,N(this,i)+1)}decrement(t){G(this,n,N(this,n)-1),t&&G(this,i,N(this,i)-1),this.revive()}revive(){for(const t of N(this,o))N(this,s).delete(t),Wn(t,ft),ie(t);for(const t of N(this,s))Wn(t,ht),ie(t);this.flush()}oncommit(e){N(this,t).add(e)}ondiscard(t){N(this,e).add(t)}settled(){return(N(this,r)??G(this,r,lt())).promise}static ensure(){if(null===Xt){const t=Xt=new u;jt.add(Xt),Vt||u.enqueue(()=>{Xt===t&&t.flush()})}return Xt}static enqueue(t){Ht(t)}apply(){}};function Qt(){var t=en;Gt=!0;try{var e=0;for(nn(!0);Nt.length>0;){var n=Ut.ensure();e++>1e3&&Jt(),n.process(Nt),pe.clear()}}finally{Gt=!1,nn(t),Kt=null}}function Jt(){try{!function(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}()}catch(t){qt(t,Kt)}}let Zt=null;function te(t){var e=t.length;if(0!==e){for(var n=0;n<e;){var i=t[n++];if(!(24576&i.f)&&bn(i)&&(Zt=new Set,_n(i),null===i.deps&&null===i.first&&null===i.nodes&&(null===i.teardown&&null===i.ac?Ve(i):i.fn=null),(null==Zt?void 0:Zt.size)>0)){pe.clear();for(const t of Zt){if(24576&t.f)continue;const e=[t];let n=t.parent;for(;null!==n;)Zt.has(n)&&(Zt.delete(n),e.push(n)),n=n.parent;for(let t=e.length-1;t>=0;t--){const n=e[t];24576&n.f||_n(n)}}Zt.clear()}}Zt=null}}function ee(t,e,n,i){if(!n.has(t)&&(n.add(t),null!==t.reactions))for(const r of t.reactions){const t=r.f;2&t?ee(r,e,n,i):4194320&t&&0===(t&ft)&&ne(r,e,i)&&(Wn(r,ft),ie(r))}}function ne(t,e,n){const i=n.get(t);if(void 0!==i)return i;if(null!==t.deps)for(const i of t.deps){if(e.includes(i))return!0;if(2&i.f&&ne(i,e,n))return n.set(i,!0),!0}return n.set(t,!1),!1}function ie(t){for(var e=Kt=t;null!==e.parent;){var n=(e=e.parent).f;if(Gt&&e===dn&&0!==(n&dt)&&0===(n&wt))return;if(96&n){if(0===(n&ct))return;e.f^=ct}}Nt.push(e)}class re{constructor(t,e,n){K(this,C),X(this,"parent"),K(this,h,!1),K(this,p),K(this,v,null),K(this,g),K(this,m),K(this,w),K(this,y,null),K(this,x,null),K(this,b,null),K(this,M,null),K(this,z,null),K(this,k,0),K(this,I,0),K(this,_,!1),K(this,P,null),K(this,D,function(t){let e,n=0,i=ge(0);return()=>{Ae()&&(Dn(i),qe(()=>(0===n&&(e=On(()=>t())),n+=1,()=>{Ht(()=>{n-=1,0===n&&(null==e||e(),e=void 0,Me(i))})})))}}(()=>(G(this,P,ge(N(this,k))),()=>{G(this,P,null)}))),G(this,p,t),G(this,g,e),G(this,m,n),this.parent=dn.b,G(this,h,!!N(this,g).pending),G(this,w,Xe(()=>{dn.b=this;var t=V(this,C,S).call(this);try{G(this,y,Ye(()=>n(t)))}catch(t){this.error(t)}return N(this,I)>0?V(this,C,E).call(this):G(this,h,!1),()=>{var t;null==(t=N(this,z))||t.remove()}},589952))}is_pending(){return N(this,h)||!!this.parent&&this.parent.is_pending()}has_pending_snippet(){return!!N(this,g).pending}update_pending_count(t){V(this,C,W).call(this,t),G(this,k,N(this,k)+t),N(this,P)&&xe(N(this,P),N(this,k))}get_effect_pending(){return N(this,D).call(this),Dn(N(this,P))}error(t){var e=N(this,g).onerror;let n=N(this,g).failed;if(N(this,_)||!e&&!n)throw t;N(this,y)&&(Ge(N(this,y)),G(this,y,null)),N(this,x)&&(Ge(N(this,x)),G(this,x,null)),N(this,b)&&(Ge(N(this,b)),G(this,b,null));var i=!1,r=!1;const o=()=>{i||(i=!0,r&&function(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}(),Ut.ensure(),G(this,k,0),null!==N(this,b)&&Ue(N(this,b),()=>{G(this,b,null)}),G(this,h,this.has_pending_snippet()),G(this,y,V(this,C,O).call(this,()=>(G(this,_,!1),Ye(()=>N(this,m).call(this,N(this,p)))))),N(this,I)>0?V(this,C,E).call(this):G(this,h,!1))};var s=sn;try{ln(null),r=!0,null==e||e(t,o),r=!1}catch(t){qt(t,N(this,w)&&N(this,w).parent)}finally{ln(s)}n&&Ht(()=>{G(this,b,V(this,C,O).call(this,()=>{Ut.ensure(),G(this,_,!0);try{return Ye(()=>{n(N(this,p),()=>t,()=>o)})}catch(t){return qt(t,N(this,w).parent),null}finally{G(this,_,!1)}}))})}}function oe(){un(null),ln(null),Et(null)}function se(t){var e=null!==sn&&2&sn.f?sn:null;return null!==dn&&(dn.f|=yt),{ctx:Ot,deps:null,effects:null,equals:Dt,f:2050,fn:t,reactions:null,rv:0,v:U,wv:0,parent:e??dn,ac:null}}function ae(t,e){let n=dn;null===n&&function(){throw new Error("https://svelte.dev/e/async_derived_orphan")}();var i=n.b,r=void 0,o=ge(U),s=!sn,a=new Map;return function(t){Re(4718592,t,!0)}(()=>{var e,n=lt();r=n.promise;try{Promise.resolve(t()).then(n.resolve,n.reject).then(()=>{l===Xt&&l.committed&&l.deactivate(),oe()})}catch(t){n.reject(t),oe()}var l=Xt;if(s){var d=!i.is_pending();i.update_pending_count(1),l.increment(d),null==(e=a.get(l))||e.reject(_t),a.delete(l),a.set(l,n)}const u=(t,e=void 0)=>{if(l.activate(),e)e!==_t&&(o.f|=zt,xe(o,e));else{0!==(o.f&zt)&&(o.f^=zt),xe(o,t);for(const[t,e]of a){if(a.delete(t),t===l)break;e.reject(_t)}}s&&(i.update_pending_count(-1),l.decrement(d))};n.promise.then(u,t=>u(null,t||"unknown"))}),Le(()=>{for(const t of a.values())t.reject(_t)}),new Promise(t=>{!function e(n){function i(){n===r?t(o):e(r)}n.then(i,i)}(r)})}function le(t){const e=se(t);return fn(e),e}function de(t){const e=se(t);return e.equals=St,e}function ue(t){var e=t.effects;if(null!==e){t.effects=null;for(var n=0;n<e.length;n+=1)Ge(e[n])}}function ce(t){var e,n=dn;un(function(t){for(var e=t.parent;null!==e;){if(!(2&e.f))return 0===(e.f&vt)?e:null;e=e.parent}return null}(t));try{t.f&=-32769,ue(t),e=zn(t)}finally{un(n)}return e}function fe(t){var e=ce(t);t.equals(e)||((null==Xt?void 0:Xt.is_fork)||(t.v=e),t.wv=xn()),rn||(null!==Yt?(Ae()||(null==Xt?void 0:Xt.is_fork))&&Yt.set(t,e):Wn(t,0===(t.f&ut)?ht:ct))}h=new WeakMap,p=new WeakMap,v=new WeakMap,g=new WeakMap,m=new WeakMap,w=new WeakMap,y=new WeakMap,x=new WeakMap,b=new WeakMap,M=new WeakMap,z=new WeakMap,k=new WeakMap,I=new WeakMap,_=new WeakMap,P=new WeakMap,D=new WeakMap,C=new WeakSet,S=function(){var t=N(this,p);return N(this,h)&&(G(this,z,Ce()),N(this,p).before(N(this,z)),t=N(this,z)),t},O=function(t){var e=dn,n=sn,i=Ot;un(N(this,w)),ln(N(this,w)),Et(N(this,w).ctx);try{return t()}catch(t){return Ft(t),null}finally{un(e),ln(n),Et(i)}},E=function(){const t=N(this,g).pending;null!==N(this,y)&&(G(this,M,document.createDocumentFragment()),N(this,M).append(N(this,z)),tn(N(this,y),N(this,M))),null===N(this,x)&&G(this,x,Ye(()=>t(N(this,p))))},W=function(t){var e;this.has_pending_snippet()?(G(this,I,N(this,I)+t),0===N(this,I)&&(G(this,h,!1),N(this,x)&&Ue(N(this,x),()=>{G(this,x,null)}),N(this,M)&&(N(this,p).before(N(this,M)),G(this,M,null)))):this.parent&&V(e=this.parent,C,W).call(e,t)};let he=new Set;const pe=new Map;let ve=!1;function ge(t,e){return{f:0,v:t,reactions:null,equals:Dt,rv:0,wv:0}}function me(t,e){const n=ge(t);return fn(n),n}function we(t,e=!1,n=!0){const i=ge(t);return e||(i.equals=St),i}function ye(t,e,n=!1){return null===sn||an&&!(131072&sn.f)||!(4325394&sn.f)||(null==cn?void 0:cn.includes(t))||function(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}(),xe(t,n?ke(e):e)}function xe(t,e){if(!t.equals(e)){var n=t.v;rn?pe.set(t,e):pe.set(t,n),t.v=e;var i=Ut.ensure();i.capture(t,n),2&t.f&&(0!==(t.f&ft)&&ce(t),Wn(t,0!==(t.f&ut)?ct:ht)),t.wv=xn(),ze(t,ft),null===dn||0===(dn.f&ct)||96&dn.f||(null===vn?function(t){vn=t}([t]):vn.push(t)),!i.is_fork&&he.size>0&&!ve&&function(){ve=!1;var t=en;nn(!0);const e=Array.from(he);try{for(const t of e)0!==(t.f&ct)&&Wn(t,ht),bn(t)&&_n(t)}finally{nn(t)}he.clear()}()}return e}function be(t,e=1){var n=Dn(t),i=1===e?n++:n--;return ye(t,n),i}function Me(t){ye(t,t.v+1)}function ze(t,e){var n=t.reactions;if(null!==n)for(var i=n.length,r=0;r<i;r++){var o=n[r],s=o.f,a=0===(s&ft);if(a&&Wn(o,e),2&s){var l=o;null==Yt||Yt.delete(l),0===(s&bt)&&(s&ut&&(o.f|=bt),ze(l,ht))}else a&&(0!==(s&dt)&&null!==Zt&&Zt.add(o),ie(o))}}function ke(t){if("object"!=typeof t||null===t||kt in t)return t;const e=ot(t);if(e!==it&&e!==rt)return t;var n=new Map,i=Q(t),r=me(0),o=wn,s=t=>{if(wn===o)return t();var e=sn,n=wn;ln(null),yn(o);var i=t();return ln(e),yn(n),i};return i&&n.set("length",me(t.length)),new Proxy(t,{defineProperty(t,e,i){"value"in i&&!1!==i.configurable&&!1!==i.enumerable&&!1!==i.writable||function(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}();var r=n.get(e);return void 0===r?r=s(()=>{var t=me(i.value);return n.set(e,t),t}):ye(r,i.value,!0),!0},deleteProperty(t,e){var i=n.get(e);if(void 0===i){if(e in t){const t=s(()=>me(U));n.set(e,t),Me(r)}}else ye(i,U),Me(r);return!0},get(e,i,r){var o;if(i===kt)return t;var a=n.get(i),l=i in e;if(void 0!==a||l&&!(null==(o=et(e,i))?void 0:o.writable)||(a=s(()=>me(ke(l?e[i]:U))),n.set(i,a)),void 0!==a){var d=Dn(a);return d===U?void 0:d}return Reflect.get(e,i,r)},getOwnPropertyDescriptor(t,e){var i=Reflect.getOwnPropertyDescriptor(t,e);if(i&&"value"in i){var r=n.get(e);r&&(i.value=Dn(r))}else if(void 0===i){var o=n.get(e),s=null==o?void 0:o.v;if(void 0!==o&&s!==U)return{enumerable:!0,configurable:!0,value:s,writable:!0}}return i},has(t,e){var i;if(e===kt)return!0;var r=n.get(e),o=void 0!==r&&r.v!==U||Reflect.has(t,e);return!((void 0!==r||null!==dn&&(!o||(null==(i=et(t,e))?void 0:i.writable)))&&(void 0===r&&(r=s(()=>me(o?ke(t[e]):U)),n.set(e,r)),Dn(r)===U))&&o},set(t,e,o,a){var l,d=n.get(e),u=e in t;if(i&&"length"===e)for(var c=o;c<d.v;c+=1){var f=n.get(c+"");void 0!==f?ye(f,U):c in t&&(f=s(()=>me(U)),n.set(c+"",f))}void 0===d?u&&!(null==(l=et(t,e))?void 0:l.writable)||(ye(d=s(()=>me(void 0)),ke(o)),n.set(e,d)):(u=d.v!==U,ye(d,s(()=>ke(o))));var h=Reflect.getOwnPropertyDescriptor(t,e);if((null==h?void 0:h.set)&&h.set.call(a,o),!u){if(i&&"string"==typeof e){var p=n.get("length"),v=Number(e);Number.isInteger(v)&&v>=p.v&&ye(p,v+1)}Me(r)}return!0},ownKeys(t){Dn(r);var e=Reflect.ownKeys(t).filter(t=>{var e=n.get(t);return void 0===e||e.v!==U});for(var[i,o]of n)o.v===U||i in t||e.push(i);return e},setPrototypeOf(){!function(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}()}})}var Ie,_e,Pe,De;function Ce(t=""){return document.createTextNode(t)}function Se(t){return Pe.call(t)}function Oe(t){return De.call(t)}function Ee(t,e){return Se(t)}function We(t,e=!1){var n=Se(t);return n instanceof Comment&&""===n.data?Oe(n):n}function Te(t,e=1,n=!1){let i=t;for(;e--;)i=Oe(i);return i}function Be(t){var e=sn,n=dn;ln(null),un(null);try{return t()}finally{ln(e),un(n)}}function Re(t,e,n){var i=dn;null!==i&&0!==(i.f&pt)&&(t|=pt);var r={ctx:Ot,deps:null,nodes:null,f:t|ft|ut,first:null,fn:e,last:null,next:null,parent:i,b:i&&i.b,prev:null,teardown:null,wv:0,ac:null};if(n)try{_n(r),r.f|=gt}catch(t){throw Ge(r),t}else null!==e&&ie(r);var o=r;if(n&&null===o.deps&&null===o.teardown&&null===o.nodes&&o.first===o.last&&0===(o.f&yt)&&(o=o.first,0!==(t&dt)&&0!==(t&mt)&&null!==o&&(o.f|=mt)),null!==o&&(o.parent=i,null!==i&&function(t,e){var n=e.last;null===n?e.last=e.first=t:(n.next=t,t.prev=n,e.last=t)}(o,i),null!==sn&&2&sn.f&&!(64&t))){var s=sn;(s.effects??(s.effects=[])).push(o)}return r}function Ae(){return null!==sn&&!an}function Le(t){const e=Re(8,null,!1);return Wn(e,ct),e.teardown=t,e}function He(t){null===dn&&(null===sn&&function(){throw new Error("https://svelte.dev/e/effect_orphan")}(),function(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}()),rn&&function(){throw new Error("https://svelte.dev/e/effect_in_teardown")}();var e=dn.f;if(sn||!(32&e)||0!==(e&gt))return $e(t);var n=Ot;(n.e??(n.e=[])).push(t)}function $e(t){return Re(1048580,t,!1)}function Fe(t){return Re(4,t,!1)}function qe(t,e=0){return Re(8|e,t,!0)}function je(t,e=[],n=[],i=[]){!function(t,e,n,i){const r=se;if(0!==n.length||0!==t.length){var o,s,a,l,d=Xt,u=dn,c=(o=dn,s=sn,a=Ot,l=Xt,function(t=!0){un(o),ln(s),Et(a),t&&(null==l||l.activate())});t.length>0?Promise.all(t).then(()=>{c();try{return f()}finally{null==d||d.deactivate(),oe()}}):f()}else i(e.map(r));function f(){Promise.all(n.map(t=>ae(t))).then(t=>{c();try{i([...e.map(r),...t])}catch(t){0===(u.f&vt)&&qt(t,u)}null==d||d.deactivate(),oe()}).catch(t=>{qt(t,u)})}}(i,e,n,e=>{Re(8,()=>t(...e.map(Dn)),!0)})}function Xe(t,e=0){return Re(dt|e,t,!0)}function Ye(t){return Re(524320,t,!0)}function Ne(t){var e=t.teardown;if(null!==e){const t=rn,n=sn;on(!0),ln(null);try{e.call(null)}finally{on(t),ln(n)}}}function Ke(t,e=!1){var n=t.first;for(t.first=t.last=null;null!==n;){const t=n.ac;null!==t&&Be(()=>{t.abort(_t)});var i=n.next;64&n.f?n.parent=null:Ge(n,e),n=i}}function Ge(t,e=!0){var n=!1;!e&&0===(t.f&wt)||null===t.nodes||null===t.nodes.end||(function(t,e){for(;null!==t;){var n=t===e?null:Oe(t);t.remove(),t=n}}(t.nodes.start,t.nodes.end),n=!0),Ke(t,e&&!n),In(t,0),Wn(t,vt);var i=t.nodes&&t.nodes.t;if(null!==i)for(const t of i)t.stop();Ne(t);var r=t.parent;null!==r&&null!==r.first&&Ve(t),t.next=t.prev=t.teardown=t.ctx=t.deps=t.fn=t.nodes=t.ac=null}function Ve(t){var e=t.parent,n=t.prev,i=t.next;null!==n&&(n.next=i),null!==i&&(i.prev=n),null!==e&&(e.first===t&&(e.first=i),e.last===t&&(e.last=n))}function Ue(t,e,n=!0){var i=[];Qe(t,i,!0);var r=()=>{n&&Ge(t),e&&e()},o=i.length;if(o>0){var s=()=>--o||r();for(var a of i)a.out(s)}else r()}function Qe(t,e,n){if(0===(t.f&pt)){t.f^=pt;var i=t.nodes&&t.nodes.t;if(null!==i)for(const t of i)(t.is_global||n)&&e.push(t);for(var r=t.first;null!==r;){var o=r.next;Qe(r,e,!!(0!==(r.f&mt)||32&r.f&&0!==(t.f&dt))&&n),r=o}}}function Je(t){Ze(t,!0)}function Ze(t,e){if(0!==(t.f&pt)){t.f^=pt,0===(t.f&ct)&&(Wn(t,ft),ie(t));for(var n=t.first;null!==n;){var i=n.next;Ze(n,!!(0!==(n.f&mt)||32&n.f)&&e),n=i}var r=t.nodes&&t.nodes.t;if(null!==r)for(const t of r)(t.is_global||e)&&t.in()}}function tn(t,e){if(t.nodes)for(var n=t.nodes.start,i=t.nodes.end;null!==n;){var r=n===i?null:Oe(n);e.append(n),n=r}}let en=!1;function nn(t){en=t}let rn=!1;function on(t){rn=t}let sn=null,an=!1;function ln(t){sn=t}let dn=null;function un(t){dn=t}let cn=null;function fn(t){null!==sn&&(null===cn?cn=[t]:cn.push(t))}let hn=null,pn=0,vn=null,gn=1,mn=0,wn=mn;function yn(t){wn=t}function xn(){return++gn}function bn(t){var e=t.f;if(0!==(e&ft))return!0;if(2&e&&(t.f&=-32769),0!==(e&ht)){var n=t.deps;if(null!==n)for(var i=n.length,r=0;r<i;r++){var o=n[r];if(bn(o)&&fe(o),o.wv>t.wv)return!0}0!==(e&ut)&&null===Yt&&Wn(t,ct)}return!1}function Mn(t,e,n=!0){var i=t.reactions;if(null!==i&&!(null==cn?void 0:cn.includes(t)))for(var r=0;r<i.length;r++){var o=i[r];2&o.f?Mn(o,e,!1):e===o&&(n?Wn(o,ft):0!==(o.f&ct)&&Wn(o,ht),ie(o))}}function zn(t){var e,n=hn,i=pn,r=vn,o=sn,s=cn,a=Ot,l=an,d=wn,u=t.f;hn=null,pn=0,vn=null,sn=96&u?null:t,cn=null,Et(t.ctx),an=!1,wn=++mn,null!==t.ac&&(Be(()=>{t.ac.abort(_t)}),t.ac=null);try{t.f|=Mt;var c=(0,t.fn)(),f=t.deps;if(null!==hn){var h;if(In(t,pn),null!==f&&pn>0)for(f.length=pn+hn.length,h=0;h<hn.length;h++)f[pn+h]=hn[h];else t.deps=f=hn;if(Ae()&&0!==(t.f&ut))for(h=pn;h<f.length;h++)((e=f[h]).reactions??(e.reactions=[])).push(t)}else null!==f&&pn<f.length&&(In(t,pn),f.length=pn);if(!(null===vn||an||null===f||6146&t.f))for(h=0;h<vn.length;h++)Mn(vn[h],t);return null!==o&&o!==t&&(mn++,null!==vn&&(null===r?r=vn:r.push(...vn))),0!==(t.f&zt)&&(t.f^=zt),c}catch(t){return Ft(t)}finally{t.f^=Mt,hn=n,pn=i,vn=r,sn=o,cn=s,Et(a),an=l,wn=d}}function kn(t,e){let n=e.reactions;if(null!==n){var i=J.call(n,t);if(-1!==i){var r=n.length-1;0===r?n=e.reactions=null:(n[i]=n[r],n.pop())}}null===n&&2&e.f&&(null===hn||!hn.includes(e))&&(Wn(e,ht),0!==(e.f&ut)&&(e.f^=ut,e.f&=-32769),ue(e),In(e,0))}function In(t,e){var n=t.deps;if(null!==n)for(var i=e;i<n.length;i++)kn(t,n[i])}function _n(t){var e=t.f;if(0===(e&vt)){Wn(t,ct);var n=dn,i=en;dn=t,en=!0;try{16777232&e?function(t){for(var e=t.first;null!==e;){var n=e.next;!(32&e.f)&&Ge(e),e=n}}(t):Ke(t),Ne(t);var r=zn(t);t.teardown="function"==typeof r?r:null,t.wv=gn}finally{en=i,dn=n}}}async function Pn(){await Promise.resolve(),function(){var t=Vt;Vt=!0;try{for(;;){if($t(),0===Nt.length&&(null==Xt||Xt.flush(),0===Nt.length))return void(Kt=null);Qt()}}finally{Vt=t}}()}function Dn(t){var e=!!(2&t.f);if(!(null===sn||an||null!==dn&&0!==(dn.f&vt)||(null==cn?void 0:cn.includes(t)))){var n=sn.deps;if(0!==(sn.f&Mt))t.rv<mn&&(t.rv=mn,null===hn&&null!==n&&n[pn]===t?pn++:null===hn?hn=[t]:hn.includes(t)||hn.push(t));else{(sn.deps??(sn.deps=[])).push(t);var i=t.reactions;null===i?t.reactions=[sn]:i.includes(sn)||i.push(sn)}}if(rn){if(pe.has(t))return pe.get(t);if(e){var r=t,o=r.v;return(0===(r.f&ct)&&null!==r.reactions||Sn(r))&&(o=ce(r)),pe.set(r,o),o}}else e&&(!(null==Yt?void 0:Yt.has(t))||(null==Xt?void 0:Xt.is_fork)&&!Ae())&&(bn(r=t)&&fe(r),en&&Ae()&&0===(r.f&ut)&&Cn(r));if(null==Yt?void 0:Yt.has(t))return Yt.get(t);if(0!==(t.f&zt))throw t.v;return t.v}function Cn(t){if(null!==t.deps){t.f^=ut;for(const e of t.deps)(e.reactions??(e.reactions=[])).push(t),2&e.f&&0===(e.f&ut)&&Cn(e)}}function Sn(t){if(t.v===U)return!0;if(null===t.deps)return!1;for(const e of t.deps){if(pe.has(e))return!0;if(2&e.f&&Sn(e))return!0}return!1}function On(t){var e=an;try{return an=!0,t()}finally{an=e}}const En=-7169;function Wn(t,e){t.f=t.f&En|e}function Tn(t,e=new Set){if(!("object"!=typeof t||null===t||t instanceof EventTarget||e.has(t))){e.add(t),t instanceof Date&&t.getTime();for(let n in t)try{Tn(t[n],e)}catch(t){}const n=ot(t);if(n!==Object.prototype&&n!==Array.prototype&&n!==Map.prototype&&n!==Set.prototype&&n!==Date.prototype){const e=nt(n);for(let n in e){const i=e[n].get;if(i)try{i.call(t)}catch(t){}}}}}const Bn=new Set,Rn=new Set;function An(t){for(var e=0;e<t.length;e++)Bn.add(t[e]);for(var n of Rn)n(t)}let Ln=null;function Hn(t){var e,n=this,i=n.ownerDocument,r=t.type,o=(null==(e=t.composedPath)?void 0:e.call(t))||[],s=o[0]||t.target;Ln=t;var a=0,l=Ln===t&&t.__root;if(l){var d=o.indexOf(l);if(-1!==d&&(n===document||n===window))return void(t.__root=n);var u=o.indexOf(n);if(-1===u)return;d<=u&&(a=d)}if((s=o[a]||t.target)!==n){tt(t,"currentTarget",{configurable:!0,get:()=>s||i});var c=sn,f=dn;ln(null),un(null);try{for(var h,p=[];null!==s;){var v=s.assignedSlot||s.parentNode||s.host||null;try{var g=s["__"+r];null==g||s.disabled&&t.target!==s||g.call(s,t)}catch(t){h?p.push(t):h=t}if(t.cancelBubble||v===n||null===v)break;s=v}if(h){for(let t of p)queueMicrotask(()=>{throw t});throw h}}finally{t.__root=n,delete t.currentTarget,ln(c),un(f)}}}function $n(t,e){var n=dn;null===n.nodes&&(n.nodes={start:t,end:e,a:null,t:null})}function Fn(t,e){var n,i=!!(1&e),r=!!(2&e),o=!t.startsWith("<!>");return()=>{var e,s;void 0===n&&(e=o?t:"<!>"+t,(s=document.createElement("template")).innerHTML=e.replaceAll("<!>","\x3c!----\x3e"),n=s.content,i||(n=Se(n)));var a=r||_e?document.importNode(n,!0):n.cloneNode(!0);return i?$n(Se(a),a.lastChild):$n(a,a),a}}function qn(){var t=document.createDocumentFragment(),e=document.createComment(""),n=Ce();return t.append(e,n),$n(e,n),t}function jn(t,e){null!==t&&t.before(e)}const Xn=["touchstart","touchmove"];function Yn(t){return Xn.includes(t)}let Nn=!0;function Kn(t,e){var n=null==e?"":"object"==typeof e?e+"":e;n!==(t.__t??(t.__t=t.nodeValue))&&(t.__t=n,t.nodeValue=n+"")}function Gn(t,e){return function(t,{target:e,anchor:n,props:i={},events:r,context:o,intro:s=!0}){!function(){if(void 0===Ie){Ie=window,_e=/Firefox/.test(navigator.userAgent);var t=Element.prototype,e=Node.prototype,n=Text.prototype;Pe=et(e,"firstChild").get,De=et(e,"nextSibling").get,st(t)&&(t.__click=void 0,t.__className=void 0,t.__attributes=null,t.__style=void 0,t.__e=void 0),st(n)&&(n.__t=void 0)}}();var a=new Set,l=t=>{for(var n=0;n<t.length;n++){var i=t[n];if(!a.has(i)){a.add(i);var r=Yn(i);e.addEventListener(i,Hn,{passive:r});var o=Vn.get(i);void 0===o?(document.addEventListener(i,Hn,{passive:r}),Vn.set(i,1)):Vn.set(i,o+1)}}};l(Z(Bn)),Rn.add(l);var d=void 0,u=function(){Ut.ensure();const u=Re(524352,()=>{var u=n??e.appendChild(Ce());return new re(u,{pending:()=>{}},e=>{o&&(Tt({}),Ot.c=o),r&&(i.$$events=r),Nn=s,d=t(e,i)||{},Nn=!0,o&&Bt()}),()=>{var t;for(var i of a){e.removeEventListener(i,Hn);var r=Vn.get(i);0===--r?(document.removeEventListener(i,Hn),Vn.delete(i)):Vn.set(i,r)}Rn.delete(l),u!==n&&(null==(t=u.parentNode)||t.removeChild(u))}},!0);return(t={})=>new Promise(e=>{t.outro?Ue(u,()=>{Ge(u),e(void 0)}):(Ge(u),e(void 0))})}();return Un.set(d,u),d}(t,e)}const Vn=new Map;let Un=new WeakMap;function Qn(t,e){const n=Un.get(t);return n?(Un.delete(t),n(e)):Promise.resolve()}class Jn{constructor(t,e=!0){X(this,"anchor"),K(this,T,new Map),K(this,B,new Map),K(this,R,new Map),K(this,A,new Set),K(this,L,!0),K(this,H,()=>{var t=Xt;if(N(this,T).has(t)){var e=N(this,T).get(t),n=N(this,B).get(e);if(n)Je(n),N(this,A).delete(e);else{var i=N(this,R).get(e);i&&(N(this,B).set(e,i.effect),N(this,R).delete(e),i.fragment.lastChild.remove(),this.anchor.before(i.fragment),n=i.effect)}for(const[e,n]of N(this,T)){if(N(this,T).delete(e),e===t)break;const i=N(this,R).get(n);i&&(Ge(i.effect),N(this,R).delete(n))}for(const[t,i]of N(this,B)){if(t===e||N(this,A).has(t))continue;const r=()=>{if(Array.from(N(this,T).values()).includes(t)){var e=document.createDocumentFragment();tn(i,e),e.append(Ce()),N(this,R).set(t,{effect:i,fragment:e})}else Ge(i);N(this,A).delete(t),N(this,B).delete(t)};N(this,L)||!n?(N(this,A).add(t),Ue(i,r,!1)):r()}}}),K(this,$,t=>{N(this,T).delete(t);const e=Array.from(N(this,T).values());for(const[t,n]of N(this,R))e.includes(t)||(Ge(n.effect),N(this,R).delete(t))}),this.anchor=t,G(this,L,e)}ensure(t,e){var n=Xt;!e||N(this,B).has(t)||N(this,R).has(t)||N(this,B).set(t,Ye(()=>e(this.anchor))),N(this,T).set(n,t),N(this,H).call(this)}}function Zn(t,e,...n){var i=new Jn(t);Xe(()=>{const t=e()??null;i.ensure(t,t&&(e=>t(e,...n)))},mt)}function ti(t){null===Ot&&Pt(),He(()=>{const e=On(t);if("function"==typeof e)return e})}function ei(t){null===Ot&&Pt(),ti(()=>()=>On(t))}function ni(t,e,n=!1){var i=new Jn(t);function r(t,e){i.ensure(t,e)}Xe(()=>{var t=!1;e((e,n=!0)=>{t=!0,r(n,e)}),t||r(!1,null)},n?mt:0)}function ii(t,e){return e}function ri(t,e=!0){for(var n=0;n<t.length;n++)Ge(t[n],e)}var oi;function si(t,e,n,i,r,o=null){var s=t,a=new Map;!(4&e)||(s=t.appendChild(Ce()));var l,d=null,u=de(()=>{var t=n();return Q(t)?t:null==t?[]:Z(t)}),c=!0,f={effect:Xe(()=>{for(var t=(l=Dn(u)).length,h=new Set,p=0;p<t;p+=1){var v=l[p],g=i(v,p),m=c?null:a.get(g);m?(m.v&&xe(m.v,v),m.i&&xe(m.i,p)):(m=ai(a,c?s:oi??(oi=Ce()),v,g,p,r,e,n),c||(m.e.f|=xt),a.set(g,m)),h.add(g)}0===t&&o&&!d&&(c?d=Ye(()=>o(s)):(d=Ye(()=>o(oi??(oi=Ce())))).f|=xt),c||(f.fallback=d,function(t,e,n,i,r){var o,s,a,l,d,u,c,f,h,p,v,g,m,w,y=!!(8&i),x=e.length,b=t.items,M=t.effect.first,z=null,k=[],I=[];if(y)for(w=0;w<x;w+=1)g=r(e[w],w),0===((m=b.get(g).e).f&xt)&&(null==(s=null==(o=m.nodes)?void 0:o.a)||s.measure(),(v??(v=new Set)).add(m));for(w=0;w<x;w+=1){if(g=r(e[w],w),m=b.get(g).e,null!==t.outrogroups)for(const e of t.outrogroups)e.pending.delete(m),e.done.delete(m);if(0!==(m.f&xt)){if(m.f^=xt,m!==M){var _=z?z.next:M;m===t.effect.last&&(t.effect.last=m.prev),m.prev&&(m.prev.next=m.next),m.next&&(m.next.prev=m.prev),di(t,z,m),di(t,m,_),li(m,_,n),k=[],I=[],M=(z=m).next;continue}li(m,null,n)}if(0!==(m.f&pt)&&(Je(m),y&&(null==(l=null==(a=m.nodes)?void 0:a.a)||l.unfix(),(v??(v=new Set)).delete(m))),m!==M){if(void 0!==p&&p.has(m)){if(k.length<I.length){var P,D=I[0];z=D.prev;var C=k[0],S=k[k.length-1];for(P=0;P<k.length;P+=1)li(k[P],D,n);for(P=0;P<I.length;P+=1)p.delete(I[P]);di(t,C.prev,S.next),di(t,z,C),di(t,S,D),M=D,z=S,w-=1,k=[],I=[]}else p.delete(m),li(m,M,n),di(t,m.prev,m.next),di(t,m,null===z?t.effect.first:z.next),di(t,z,m),z=m;continue}for(k=[],I=[];null!==M&&M!==m;)(p??(p=new Set)).add(M),I.push(M),M=M.next;if(null===M)continue}0===(m.f&xt)&&k.push(m),z=m,M=m.next}if(null!==t.outrogroups){for(const e of t.outrogroups)0===e.pending.size&&(ri(Z(e.done)),null==(d=t.outrogroups)||d.delete(e));0===t.outrogroups.size&&(t.outrogroups=null)}if(null!==M||void 0!==p){var O=[];if(void 0!==p)for(m of p)0===(m.f&pt)&&O.push(m);for(;null!==M;)0===(M.f&pt)&&M!==t.fallback&&O.push(M),M=M.next;var E=O.length;if(E>0){var W=4&i&&0===x?n:null;if(y){for(w=0;w<E;w+=1)null==(c=null==(u=O[w].nodes)?void 0:u.a)||c.measure();for(w=0;w<E;w+=1)null==(h=null==(f=O[w].nodes)?void 0:f.a)||h.fix()}!function(t,e,n){for(var i,r=e.length,o=e.length,s=0;s<r;s++){let n=e[s];Ue(n,()=>{if(i){if(i.pending.delete(n),i.done.add(n),0===i.pending.size){var e=t.outrogroups;ri(Z(i.done)),e.delete(i),0===e.size&&(t.outrogroups=null)}}else o-=1},!1)}if(0===o){var a=null!==n;if(a){var l=n,d=l.parentNode;d.textContent="",d.append(l),t.items.clear()}ri(e,!a)}else i={pending:new Set(e),done:new Set},(t.outrogroups??(t.outrogroups=new Set)).add(i)}(t,O,W)}}y&&Ht(()=>{var t,e;if(void 0!==v)for(m of v)null==(e=null==(t=m.nodes)?void 0:t.a)||e.apply()})}(f,l,s,e,i),null!==d&&(0===l.length?0===(d.f&xt)?Je(d):(d.f^=xt,li(d,null,s)):Ue(d,()=>{d=null}))),Dn(u)}),items:a,outrogroups:null,fallback:d};c=!1}function ai(t,e,n,i,r,o,s,a){var l=1&s?16&s?ge(n):we(n,!1,!1):null,d=2&s?ge(r):null;return{v:l,i:d,e:Ye(()=>(o(e,l??n,d??r,a),()=>{t.delete(i)}))}}function li(t,e,n){if(t.nodes)for(var i=t.nodes.start,r=t.nodes.end,o=e&&0===(e.f&xt)?e.nodes.start:n;null!==i;){var s=Oe(i);if(o.before(i),i===r)return;i=s}}function di(t,e,n){null===e?t.effect.first=n:e.next=n,null===n?t.effect.last=e:n.prev=e}T=new WeakMap,B=new WeakMap,R=new WeakMap,A=new WeakMap,L=new WeakMap,H=new WeakMap,$=new WeakMap;const ui={tick:t=>requestAnimationFrame(t),now:()=>performance.now(),tasks:new Set};function ci(){const t=ui.now();ui.tasks.forEach(e=>{e.c(t)||(ui.tasks.delete(e),e.f())}),0!==ui.tasks.size&&ui.tick(ci)}function fi(t,e){Be(()=>{t.dispatchEvent(new CustomEvent(e))})}function hi(t){if("float"===t)return"cssFloat";if("offset"===t)return"cssOffset";if(t.startsWith("--"))return t;const e=t.split("-");return 1===e.length?e[0]:e[0]+e.slice(1).map(t=>t[0].toUpperCase()+t.slice(1)).join("")}function pi(t){const e={},n=t.split(";");for(const t of n){const[n,i]=t.split(":");if(!n||void 0===i)break;e[hi(n.trim())]=i.trim()}return e}const vi=t=>t;function gi(t,e,n,i){var r,o,s,a,l=!!(4&t),d=e.inert,u=e.style.overflow;function c(){return Be(()=>o??(o=n()(e,(null==i?void 0:i())??{},{direction:"both"})))}var f={is_global:l,in(){e.inert=d,fi(e,"introstart"),s=mi(e,c(),a,1,()=>{fi(e,"introend"),null==s||s.abort(),s=o=void 0,e.style.overflow=u})},out(t){e.inert=!0,fi(e,"outrostart"),a=mi(e,c(),s,0,()=>{fi(e,"outroend"),null==t||t()})},stop:()=>{null==s||s.abort(),null==a||a.abort()}},h=dn;if(((r=h.nodes).t??(r.t=[])).push(f),Nn){var p=l;if(!p){for(var v=h.parent;v&&0!==(v.f&mt);)for(;(v=v.parent)&&0===(v.f&dt););p=!v||0!==(v.f&gt)}p&&Fe(()=>{On(()=>f.in())})}}function mi(t,e,n,i,r){var o=1===i;if("function"==typeof e){var s,a=!1;return Ht(()=>{if(!a){var l=e({direction:o?"in":"out"});s=mi(t,l,n,i,r)}}),{abort:()=>{a=!0,null==s||s.abort()},deactivate:()=>s.deactivate(),reset:()=>s.reset(),t:()=>s.t()}}if(null==n||n.deactivate(),!(null==e?void 0:e.duration))return r(),{abort:at,deactivate:at,reset:at,t:()=>i};const{delay:l=0,css:d,tick:u,easing:c=vi}=e;var f=[];if(o&&void 0===n&&(u&&u(0,1),d)){var h=pi(d(0,1));f.push(h,h)}var p=()=>1-i,v=t.animate(f,{duration:l,fill:"forwards"});return v.onfinish=()=>{v.cancel();var o=(null==n?void 0:n.t())??1-i;null==n||n.abort();var s=i-o,a=e.duration*Math.abs(s),l=[];if(a>0){var f=!1;if(d)for(var h=Math.ceil(a/(1e3/60)),g=0;g<=h;g+=1){var m=o+s*c(g/h),w=pi(d(m,1-m));l.push(w),f||(f="hidden"===w.overflow)}f&&(t.style.overflow="hidden"),p=()=>{var t=v.currentTime;return o+s*c(t/a)},u&&function(t){let e;0===ui.tasks.size&&ui.tick(ci),new Promise(n=>{ui.tasks.add(e={c:t,f:n})})}(()=>{if("running"!==v.playState)return!1;var t=p();return u(t,1-t),!0})}(v=t.animate(l,{duration:a,fill:"forwards"})).onfinish=()=>{p=()=>i,null==u||u(i,1-i),r()}},{abort:()=>{v&&(v.cancel(),v.effect=null,v.onfinish=at)},deactivate:()=>{r=at},reset:()=>{0===i&&(null==u||u(1,0))},t:()=>p()}}function wi(t,e,n){Fe(()=>{var i=On(()=>e(t,null==n?void 0:n())||{});if(n&&(null==i?void 0:i.update)){var r=!1,o={};qe(()=>{var t=n();!function(t){if("object"==typeof t&&t&&!(t instanceof EventTarget))if(kt in t)Tn(t);else if(!Array.isArray(t))for(let e in t){const n=t[e];"object"==typeof n&&n&&kt in n&&Tn(n)}}(t),r&&Ct(o,t)&&(o=t,i.update(t))}),r=!0}if(null==i?void 0:i.destroy)return()=>i.destroy()})}const yi=[..." \t\n\r\f \v\ufeff"];function xi(t,e=!1){var n=e?" !important;":";",i="";for(var r in t){var o=t[r];null!=o&&""!==o&&(i+=" "+r+": "+o+n)}return i}function bi(t){return"-"!==t[0]||"-"!==t[1]?t.toLowerCase():t}function Mi(t,e,n,i,r,o){var s=t.__className;if(s!==n||void 0===s){var a=function(t,e,n){var i=null==t?"":""+t;if(e&&(i=i?i+" "+e:e),n)for(var r in n)if(n[r])i=i?i+" "+r:r;else if(i.length)for(var o=r.length,s=0;(s=i.indexOf(r,s))>=0;){var a=s+o;0!==s&&!yi.includes(i[s-1])||a!==i.length&&!yi.includes(i[a])?s=a:i=(0===s?"":i.substring(0,s))+i.substring(a+1)}return""===i?null:i}(n,i,o);null==a?t.removeAttribute("class"):t.className=a,t.__className=n}else if(o&&r!==o)for(var l in o){var d=!!o[l];null!=r&&d===!!r[l]||t.classList.toggle(l,d)}return o}function zi(t,e={},n,i){for(var r in n){var o=n[r];e[r]!==o&&(null==n[r]?t.style.removeProperty(r):t.style.setProperty(r,o,i))}}function ki(t,e,n,i){if(t.__style!==e){var r=function(t,e){if(e){var n,i,r="";if(Array.isArray(e)?(n=e[0],i=e[1]):n=e,t){t=String(t).replaceAll(/\s*\/\*.*?\*\/\s*/g,"").trim();var o=!1,s=0,a=!1,l=[];n&&l.push(...Object.keys(n).map(bi)),i&&l.push(...Object.keys(i).map(bi));var d=0,u=-1;const e=t.length;for(var c=0;c<e;c++){var f=t[c];if(a?"/"===f&&"*"===t[c-1]&&(a=!1):o?o===f&&(o=!1):"/"===f&&"*"===t[c+1]?a=!0:'"'===f||"'"===f?o=f:"("===f?s++:")"===f&&s--,!a&&!1===o&&0===s)if(":"===f&&-1===u)u=c;else if(";"===f||c===e-1){if(-1!==u){var h=bi(t.substring(d,u).trim());l.includes(h)||(";"!==f&&c++,r+=" "+t.substring(d,c).trim()+";")}d=c+1,u=-1}}}return n&&(r+=xi(n)),i&&(r+=xi(i,!0)),""===(r=r.trim())?null:r}return null==t?null:String(t)}(e,i);null==r?t.removeAttribute("style"):t.style.cssText=r,t.__style=e}else i&&(Array.isArray(i)?(zi(t,null==n?void 0:n[0],i[0]),zi(t,null==n?void 0:n[1],i[1],"important")):zi(t,n,i));return i}const Ii=Symbol("is custom element"),_i=Symbol("is html");function Pi(t,e,n,i){var r=function(t){return t.__attributes??(t.__attributes={[Ii]:t.nodeName.includes("-"),[_i]:"http://www.w3.org/1999/xhtml"===t.namespaceURI})}(t);r[e]!==(r[e]=n)&&("loading"===e&&(t[It]=n),null==n?t.removeAttribute(e):"string"!=typeof n&&function(t){var e,n=t.getAttribute("is")||t.nodeName,i=Di.get(n);if(i)return i;Di.set(n,i=[]);for(var r=t,o=Element.prototype;o!==r;){for(var s in e=nt(r))e[s].set&&i.push(s);r=ot(r)}return i}(t).includes(e)?t[e]=n:t.setAttribute(e,n))}var Di=new Map;function Ci(t,e){return t===e||(null==t?void 0:t[kt])===e}function Si(t={},e,n,i){return Fe(()=>{var i,r;return qe(()=>{i=r,r=[],On(()=>{t!==n(...r)&&(e(t,...r),i&&Ci(n(...i),t)&&e(null,...i))})}),()=>{Ht(()=>{r&&Ci(n(...r),t)&&e(null,...r)})}}),t}function Oi(t,e,n,i){var r=i,o=!0,s=()=>(o&&(o=!1,r=i),r);return void 0===t[e]&&void 0!==i&&s(),()=>{var n=t[e];return void 0===n?s():(o=!0,n)}}const Ei={features:{dock:!0,minimize:!0,transparency:!0,resize:!0,drag:!0,focusTrap:!0,animations:!0,backdrop:!0,parentChild:!0},dock:{position:"bottom",labelMode:"beside",enableReorder:!0,enableFreeDrag:!0},animations:{open:400,close:250,minimize:500,restore:400},appearance:{headerLayout:"macos",defaultWidth:"480px",defaultHeight:"auto",minWidth:280,minHeight:200},zIndex:{base:400,dock:8e3,toast:9e3},parentChild:{movementMode:"animated",animationDuration:300},positioning:{strategy:"smart",modalGap:16,avoidElements:[]},portalTarget:"#modal-portal"};let Wi={...Ei},Ti=me(0);function Bi(){return Dn(Ti)}function Ri(){return Wi}function Ai(t){const e=Wi;var n,i;Wi={features:{...(n=Ei).features,...(i=t).features},dock:{...n.dock,...i.dock},animations:{...n.animations,...i.animations},appearance:{...n.appearance,...i.appearance},zIndex:{...n.zIndex,...i.zIndex},parentChild:{...n.parentChild,...i.parentChild},positioning:{...n.positioning,...i.positioning},portalTarget:i.portalTarget??n.portalTarget},be(Ti),e.features.dock&&!Wi.features.dock&&(Array.from(Qi.values()).filter(t=>t.isMinimized).map(t=>t.id).forEach(t=>{const e=Qi.get(t);if(e){Qi.set(t,{...e,isMinimized:!1,isOpen:!0}),ye(sr,[...Dn(sr),t],!0),kr(t);const n=e.lastChildId||e.childId;n&&br(n)}}),ye(gr,[],!0),tr())}function Li(){Wi={...Ei},be(Ti)}const Hi={BASE:0,DROPDOWN:100,STICKY:200,OVERLAY:300,MODAL:400,DOCK:8e3,TOAST:9e3};let $i=me(ke(Hi.MODAL));function Fi(){ye($i,Ri().zIndex.base,!0)}function qi(t){const e=Ri();return"MODAL"===t?e.zIndex.base:"DOCK"===t?e.zIndex.dock:"TOAST"===t?e.zIndex.toast:Hi[t]}function ji(){ye($i,Ri().zIndex.base,!0)}const Xi=8;function Yi(t,e,n,i,r={}){const{margin:o=Xi,allowPartialVisibility:s=!1}=r,a="undefined"!=typeof window?window.innerWidth:1920,l="undefined"!=typeof window?window.innerHeight:1080;let d,u,c,f;return s&&n>a-2*o?(d=40-n,u=a-40):(d=o,u=Math.max(o,a-n-o)),s&&i>l-2*o?(c=40-i,f=l-40):(c=o,f=Math.max(o,l-i-o)),{x:Math.max(d,Math.min(u,t)),y:Math.max(c,Math.min(f,e))}}function Ni(t,e,n,i,r={}){const{margin:o=Xi}=r,s=("undefined"!=typeof window?window.innerWidth:1920)-2*o,a=("undefined"!=typeof window?window.innerHeight:1080)-2*o,l=Math.min(n,s),d=Math.min(i,a),u=Yi(t,e,l,d,r);return{x:u.x,y:u.y,width:l,height:d}}function Ki(t,e){return Math.max(0,Math.min(t.x+t.width,e.x+e.width)-Math.max(t.x,e.x))*Math.max(0,Math.min(t.y+t.height,e.y+e.height)-Math.max(t.y,e.y))}function Gi(t,e,n,i,r,o){const s={x:t-o,y:e-o,width:n+2*o,height:i+2*o};let a=0;for(const t of r)a+=Ki(s,t);return a}function Vi(t,e,n,i,r,o,s){const a=(r-n)/2,l=(o-i)/2,d=a-s,u=l-s,c=Math.abs(t-a)/(d||1),f=Math.abs(e-l)/(u||1),h=Math.sqrt(c*c+f*f)/Math.SQRT2,p=50,v=t-s,g=r-n-s-t,m=e-s,w=o-i-s-e;let y=0;return v<p&&(y+=.3*(1-v/p)),g<p&&(y+=.3*(1-g/p)),m<p&&(y+=.2*(1-m/p)),w<p&&(y+=.2*(1-w/p)),Math.min(1,h+y)}function Ui(t){return"symbol"==typeof t?t.description??"symbol":t}let Qi=ke(new Map),Ji=me(0);const Zi=new Set;function tr(){be(Ji),queueMicrotask(()=>{Zi.forEach(t=>t())})}function er(t){return Zi.add(t),()=>Zi.delete(t)}let nr=me(ke([])),ir=me(ke([])),rr=me(ke([])),or=me(ke([])),sr=me(ke([])),ar=me(ke([])),lr=me(ke([])),dr=me(ke([])),ur=me(null),cr=ke(new Map),fr=me(null),hr=ke(new Map),pr=ke(new Set),vr=ke(new Set),gr=me(ke([]));function mr(t){const e=Qi.get(t.id),n=(null==e?void 0:e.zIndex)??function(){const t=Dn($i);return ye($i,Dn($i)+2),t}();e?Qi.set(t.id,{...e,title:t.title,icon:t.icon,glow:t.glow,zIndex:n}):Qi.set(t.id,{...t,zIndex:n,isAnimating:!1}),tr(),t.isMinimized&&!Dn(gr).includes(t.id)&&Dn(gr).push(t.id)}function wr(t){const e=Qi.get(t);if(e){if(ye(gr,Dn(gr).filter(e=>e!==t),!0),e.childId){const t=Qi.get(e.childId);t&&Qi.set(e.childId,{...t,parentId:void 0})}if(e.parentId){const t=Qi.get(e.parentId);t&&Qi.set(e.parentId,{...t,childId:void 0,lastChildId:e.id})}Qi.delete(t),tr(),vr.delete(t),pr.delete(t)}}function yr(t){const e=Qi.get(t);if(!e||e.isMinimized)return;if(Xr(t),e.parentId){const t=Qi.get(e.parentId);if(t&&!t.isMinimized)return void yr(e.parentId)}ye(nr,[...Dn(nr),t],!0),e.position&&e.size;const n=e.childId;Qi.set(t,{...e,isMinimized:!0,lastChildId:n}),tr(),Dn(gr).includes(t)||Dn(gr).push(t),e.childId&&function(t){const e=Qi.get(t);if(!(null==e?void 0:e.childId))return;const n=Qi.get(e.childId);n&&(Qi.set(e.childId,{...n,isHiddenWithParent:!0}),tr())}(t)}function xr(t){const e=Qi.get(t);if(!e||!e.isMinimized)return;Qi.set(t,{...e,isMinimized:!1,isOpen:!0}),tr(),ye(sr,[...Dn(sr),t],!0),kr(t);const n=e.lastChildId||e.childId;n&&br(n)}function br(t){const e=Qi.get(t);e&&e.isHiddenWithParent&&(Qi.set(t,{...e,isHiddenWithParent:!1}),tr(),ye(ar,[...Dn(ar),t],!0))}function Mr(t,e,n){const i=Qi.get(t);if(!i)return;let r=e;if((null==n?void 0:n.constrain)&&i.size&&(r=Yi(e.x,e.y,i.size.width,i.size.height)),Qi.set(t,{...i,position:r,size:(null==n?void 0:n.size)??i.size,hasBeenDragged:i.hasBeenDragged||(null==n?void 0:n.drag)||!1}),i.childId){let e=t,n=r;for(;;){const t=Qi.get(e);if(!(null==t?void 0:t.childId))break;const i=Qi.get(t.childId);if(!(null==i?void 0:i.offsetFromParent))break;const r={x:n.x+i.offsetFromParent.x,y:n.y+i.offsetFromParent.y};Qi.set(t.childId,{...i,position:r,hasBeenDragged:!0}),e=t.childId,n=r}}if(i.parentId&&i.offsetFromParent){const e=Ri();let n=t,o=i;for(;o.parentId&&o.offsetFromParent;){const i=Qi.get(o.parentId);if(!i)break;const s=n===t?r:Qi.get(n).position,a={x:s.x-o.offsetFromParent.x,y:s.y-o.offsetFromParent.y};"animated"===e.parentChild.movementMode?hr.set(o.parentId,a):Qi.set(o.parentId,{...i,position:a,hasBeenDragged:!0}),n=o.parentId,o=i}}tr()}function zr(t,e){const n=Qi.get(t);n&&(Qi.set(t,{...n,...e}),tr())}function kr(t){var e;const n=Qi.get(t);if(!n)return;const i=Math.max(...Array.from(Qi.values()).map(t=>t.zIndex),0);if(n.parentId){const r=Qi.get(n.parentId);r&&r.zIndex<i&&Qi.set(n.parentId,{...r,zIndex:i+2});const o=(null==(e=Qi.get(n.parentId))?void 0:e.zIndex)??i+2;return n.zIndex<=o&&Qi.set(t,{...n,zIndex:o+2}),void tr()}if(n.zIndex<i&&(Qi.set(t,{...n,zIndex:i+2}),tr()),n.childId){const e=Qi.get(n.childId),i=Qi.get(t);e&&i&&e.zIndex<=i.zIndex&&(Qi.set(n.childId,{...e,zIndex:i.zIndex+2}),tr())}}function Ir(t,e,n){const i=e.getBoundingClientRect();cr.set(t,{x:i.left+i.width/2,y:i.top+i.height/2});const r=Ri();(null==n?void 0:n.parentId)&&r.features.parentChild&&ye(fr,{parentId:n.parentId,childId:t},!0),Dn(ir).includes(t)||ye(ir,[...Dn(ir),t],!0),tr();const o=Qi.get(t);if(o){if(o.isOpen&&!o.isMinimized&&!o.isHiddenWithParent)return ye(ir,Dn(ir).filter(e=>e!==t),!0),Lr(t),void kr(t);if(o.isMinimized)return ye(ir,Dn(ir).filter(e=>e!==t),!0),void xr(t);Qi.set(t,{...o,isOpen:!0}),kr(t)}}function _r(t,e=!1){const n=Qi.get(t);n&&(Xr(t),e?ye(or,[...Dn(or),t],!0):ye(rr,[...Dn(rr),t],!0),tr(),n.childId&&_r(n.childId,e))}function Pr(){Array.from(Qi.keys()).forEach(t=>_r(t,!0))}function Dr(t,e,n){const i=Ri();if(n&&!cr.has(t.id)){const e=n.getBoundingClientRect();cr.set(t.id,{x:e.left+e.width/2,y:e.top+e.height/2})}const r={id:t.id,title:t.title??"",icon:t.icon??"",isOpen:!0,isMinimized:!1,isHiddenWithParent:!1,isTransparent:t.isTransparent??!1,isRejected:!1,position:t.position??null,size:t.size??null,hasBeenDragged:t.hasBeenDragged??!1,dockPosition:t.dockPosition??-1,glow:t.glow??null};if(!i.features.parentChild){mr(r);const e=Qi.get(t.id);return e&&Qi.set(t.id,{...e,isOpen:!0}),ye(ir,[...Dn(ir),t.id],!0),tr(),void kr(t.id)}const o=Qi.get(e);if(!o)return;o.childId&&_r(o.childId,!0),mr({...r,parentId:e});const s=Qi.get(t.id);s&&Qi.set(t.id,{...s,isOpen:!0,parentId:e}),ye(ir,[...Dn(ir),t.id],!0),tr(),kr(t.id),ye(fr,{parentId:e,childId:t.id},!0)}function Cr(t){return Dn(nr).includes(t)}function Sr(t){return Qi.get(t)}function Or(){return Dn(Ji)}function Er(t){return Dn(ir).includes(t)}function Wr(t){return Dn(rr).includes(t)}function Tr(t){return Dn(or).includes(t)}function Br(t){return!!Dn(or).includes(t)&&(ye(or,Dn(or).filter(e=>e!==t),!0),!0)}function Rr(t){return Dn(sr).includes(t)}function Ar(t){return Dn(ar).includes(t)}function Lr(t){Qi.get(t)&&(Dn(lr).includes(t)||Dn(dr).includes(t)||(ye(lr,[...Dn(lr),t],!0),tr()))}function Hr(t){const e=Qi.get(t);return void 0!==e&&e.isOpen&&!e.isMinimized&&!e.isHiddenWithParent}function $r(t){return Qi.has(t)}function Fr(){return{get modals(){return Qi},get pendingMinimize(){return Dn(nr)},get pendingOpen(){return Dn(ir)},get pendingClose(){return Dn(rr)},get pendingRestore(){return Dn(sr)},get dockOrder(){return Dn(gr)}}}function qr(t){vr.has(t)?vr.delete(t):vr.add(t);const e=Qi.get(t);e&&(Qi.set(t,{...e,isTransparent:vr.has(t)}),tr())}function jr(t){vr.delete(t);const e=Qi.get(t);e&&(Qi.set(t,{...e,isTransparent:!1}),tr())}function Xr(t){hr.delete(t)}"undefined"!=typeof window&&((F=window.__svelte??(window.__svelte={})).v??(F.v=new Set)).add("5");const Yr=Symbol("modal-render-icon"),Nr=Symbol("modal-id");function Kr(){return Ri().features.animations}const Gr=["button:not([disabled])","[href]","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(", ");function Vr(t){return Array.from(t.querySelectorAll(Gr)).filter(t=>null!==t.offsetParent||"A"===t.tagName)}function Ur(t,e){if("Tab"!==t.key)return;const n=Vr(e);if(0===n.length)return void t.preventDefault();const i=n[0],r=n[n.length-1],o=document.activeElement;t.shiftKey?o===i&&(r.focus(),t.preventDefault()):o===r&&(i.focus(),t.preventDefault())}function Qr(t){const e=Vr(t);return e.length>0&&(e[0].focus(),!0)}const Jr="modal-portal";var Zr=Fn('<div style="display: contents;"><!></div>');function to(t,e){Tt(e,!0);let n=Oi(e,"target",0,"body"),i=null,r=null;const{mount:o}={mount:function(t,e=null){const n=function(t){if("undefined"==typeof window)return null;if(t instanceof HTMLElement)return t;if("string"==typeof t){const e=document.querySelector(t);if(e)return e;if(t.startsWith("#")){const e=t.slice(1),n=document.createElement("div");return n.id=e,document.body.appendChild(n),n}}let e=document.getElementById(Jr);return e||(e=document.createElement("div"),e.id=Jr,document.body.appendChild(e)),e}(e);return n?(n.appendChild(t),()=>{t.parentNode===n&&n.removeChild(t),n.id!==Jr&&0===n.children.length&&n.parentNode&&n.parentNode.removeChild(n)}):()=>{}}};ti(()=>(i&&(r=o(i,n())),()=>{null==r||r()}));var s=Zr();Zn(Ee(s),()=>e.children),Si(s,t=>i=t,()=>i),jn(t,s),Bt()}var eo=Fn('<button type="button" aria-label="Minimize"></button>'),no=Fn('<button type="button" class="modal-header-light modal-header-light-style" aria-label="Toggle style"></button>'),io=Fn('<div class="modal-header-icon"><!></div>'),ro=Fn('<div class="modal-header-icon"><!></div>'),oo=Fn('<h2 class="modal-header-title"> </h2>'),so=Fn('<h2 class="modal-header-title"> </h2>'),ao=Fn('<div class="modal-header-traffic-lights"><button type="button" class="modal-header-light modal-header-light-close" aria-label="Close"></button> <!> <!></div> <div class="modal-header-mac-center"><!> <div class="modal-header-title-group"><!></div></div> <div class="modal-header-mac-spacer"></div>',1),lo=Fn('<div class="modal-header-icon"><!></div>'),uo=Fn('<div class="modal-header-icon"><!></div>'),co=Fn('<h2 class="modal-header-title"> </h2>'),fo=Fn('<h2 class="modal-header-title"> </h2>'),ho=Fn('<button type="button" class="modal-header-btn-windows modal-header-btn-windows-style" aria-label="Toggle style">&#9671;</button>'),po=Fn('<button type="button" aria-label="Minimize">&#8211;</button>'),vo=Fn('<div class="modal-header-title-group"><!> <!></div> <div class="modal-header-actions"><!> <!> <button type="button" class="modal-header-btn-windows modal-header-btn-windows-close" aria-label="Close">&times;</button></div>',1),go=Fn("<header><!></header>");An(["pointerdown","click"]);var mo=Fn("<div></div>"),wo=Fn('<div class="modal-resize-handles"></div>');function yo(t,e){return e&&t.appendChild(e),{update(e){t.innerHTML="",e&&t.appendChild(e)},destroy(){t.innerHTML=""}}}An(["pointerdown"]);var xo=Fn('<div class="modal-footer"><!></div>'),bo=Fn("<div></div>"),Mo=Fn('<div role="dialog" aria-modal="true" tabindex="-1"><!> <div class="modal-body"><!></div> <!> <!> <!></div>');function zo(t,e){Tt(e,!0);let n=Oi(e,"maxWidth",0,"600px"),i=Oi(e,"autoOpen",0,!1),r=Oi(e,"closeOnEscape",0,!0),o=Oi(e,"skipRegistration",0,!1);var s,a;s=Nr,a=()=>e.id,Rt().set(s,a);const l=Ri().portalTarget,d=le(()=>Ui(e.id));function u(t){var n,i;return(null==(i=null==(n=e.config)?void 0:n.features)?void 0:i[t])??function(t){return Wi.features[t]}(t)}const c=le(()=>(Bi(),u("drag"))),f=le(()=>(Bi(),u("minimize"))),h=le(()=>(Bi(),!u("dock"))),p=le(()=>(Bi(),u("transparency"))),v=le(()=>(Bi(),u("resize"))),g=le(()=>{var t,n;return Bi(),(null==(n=null==(t=e.config)?void 0:t.appearance)?void 0:n.headerLayout)??Ri().appearance.headerLayout});let m=me(null),w=me(!1),y=me(!1),x=me(!1),b=me(!1),M=me(!1);const z=le(()=>(Or(),Sr(e.id))),k=le(()=>Dn(z)&&(Dn(z).isOpen||Wr(e.id))&&(!Dn(z).isMinimized||Cr(e.id))&&!Dn(z).isHiddenWithParent),I=le(()=>{var t;return!!(null==(t=Dn(z))?void 0:t.childId)}),_=le(()=>{var t;return!!(null==(t=Dn(z))?void 0:t.parentId)}),P=le(()=>Dn(I)||Dn(y)),D=le(()=>!!e.glow),C=le(()=>`modal-title-${Dn(d)}`),S=le(()=>{var t;return(null==(t=Dn(z))?void 0:t.zIndex)??1e3}),O=function(t={x:0,y:0}){const e=ke({...t}),n=ke({isDragging:!1,startX:0,startY:0,initialX:0,initialY:0,hasBeenDragged:!1});return{get position(){return e},get hasBeenDragged(){return n.hasBeenDragged},get isDragging(){return n.isDragging},onPointerDown:function(t,i){if(0===t.button){if(!n.hasBeenDragged){const t=i.getBoundingClientRect();e.x=t.left,e.y=t.top}n.isDragging=!0,n.startX=t.clientX,n.startY=t.clientY,n.initialX=e.x,n.initialY=e.y,i.setPointerCapture(t.pointerId)}},onPointerMove:function(t,i,r){if(!n.isDragging)return;const o=t.clientX-n.startX,s=t.clientY-n.startY,a=Yi(n.initialX+o,n.initialY+s,r.width,r.height);e.x=a.x,e.y=a.y,n.hasBeenDragged=!0},onPointerUp:function(t,e){n.isDragging&&(n.isDragging=!1,e.releasePointerCapture(t.pointerId))},setPosition:function(t){e.x=t.x,e.y=t.y},setHasBeenDragged:function(t){n.hasBeenDragged=t},reset:function(){e.x=t.x,e.y=t.y,n.hasBeenDragged=!1}}}({x:0,y:0});let E=me(!1);const W=function(t,n,i){let r=me(!1),o=me(""),s=me(ke({width:0,height:0})),a=me(!1),l=me(!1),d={x:0,y:0,width:0,height:0,posX:0,posY:0},u=null;function c(e,l){e.preventDefault(),e.stopPropagation();const c=t();if(!c)return;const p=c.getBoundingClientRect();O.hasBeenDragged||(i({x:p.left,y:p.top}),O.setHasBeenDragged(!0)),Dn(a)||(ye(s,{width:p.width,height:p.height},!0),ye(a,!0));const v=n();ye(r,!0),ye(o,l,!0),u=e.pointerId,d={x:e.clientX,y:e.clientY,width:Dn(s).width,height:Dn(s).height,posX:v.x,posY:v.y,centerX:v.x+Dn(s).width/2,centerY:v.y+Dn(s).height/2},window.addEventListener("pointermove",f),window.addEventListener("pointerup",h),window.addEventListener("pointercancel",h)}function f(t){if(t.pointerId!==u)return;const e=t.clientX-d.x,n=t.clientY-d.y,r=window.innerWidth,a=window.innerHeight;let l=d.width,c=d.height,f=d.posX,h=d.posY;if(Dn(o).includes("e")){const t=r-f;l=Math.max(280,Math.min(d.width+e,t))}if(Dn(o).includes("w")){const t=d.width-280,n=Math.min(e,t);l=d.width-n,f=d.posX+n}if(Dn(o).includes("s")){const t=a-h;c=Math.max(200,Math.min(d.height+n,t))}if(Dn(o).includes("n")){const t=d.height-200,e=Math.min(n,t);c=d.height-e,h=d.posY+e}const p=Ni(f,h,l,c);ye(s,{width:p.width,height:p.height},!0),i({x:p.x,y:p.y})}function h(t){t.pointerId===u&&(ye(r,!1),u=null,window.removeEventListener("pointermove",f),window.removeEventListener("pointerup",h),window.removeEventListener("pointercancel",h),ye(l,!0),((t,n)=>{const i=Sr(e.id);if(null==i?void 0:i.parentId){const t=Sr(i.parentId),r=document.querySelector(`[data-modal-id="${Ui(i.parentId)}"]`);if(t&&r){const i=t.position??{x:r.getBoundingClientRect().left,y:r.getBoundingClientRect().top},o=t.size??{width:r.offsetWidth,height:r.offsetHeight},s={x:i.x+(o.width-n.width)/2,y:i.y+(o.height-n.height)/2};ye(E,!0),O.setPosition(s);const a={x:s.x-i.x,y:s.y-i.y};return zr(e.id,{position:s,size:n,hasBeenDragged:!0,offsetFromParent:a}),void setTimeout(()=>{ye(E,!1)},200)}}zr(e.id,{position:t,size:n,hasBeenDragged:!0})})(n(),Dn(s)),setTimeout(()=>{ye(l,!1)},0))}const p={startResize:c};return{get isResizing(){return Dn(r)},get resizeDirection(){return Dn(o)},get size(){return Dn(s)},get hasBeenResized(){return Dn(a)},get isActive(){return Dn(r)},get justFinishedResizing(){return Dn(l)},start:c,setHasBeenResized:()=>{},setSize:function(t){ye(s,t,!0),ye(a,!0)},reset:function(){ye(a,!1),ye(s,{width:0,height:0},!0)},constrainToViewport:function(){const e=n(),r=t();if(!r)return;const o=Ni(e.x,e.y,Dn(s).width||r.offsetWidth,Dn(s).height||r.offsetHeight);ye(s,{width:o.width,height:o.height},!0),i({x:o.x,y:o.y})},handlers:p}}(()=>Dn(m),()=>O.position,t=>O.setPosition(t)),T=function(t,n,i,r,o,s,a,l,d){let u=me(!1),c=me(!1),f=me(!1),h=me(!1),p=me(null),v=me(null),g=null,m=null;function w(){m&&(clearTimeout(m),m=null)}function y(){const t=e.id,n=document.querySelector(`.modal-dock-item[data-modal-id="${Ui(t)}"]`),i=document.querySelector('[data-dock-container="true"]'),r=n||i;if(r){const t=r.getBoundingClientRect();return{x:t.left+t.width/2,y:t.top+t.height/2}}return{x:window.innerWidth/2,y:window.innerHeight-40}}return He(()=>()=>{w(),ye(u,!1),ye(c,!1),ye(f,!1),ye(h,!1),ye(p,null),ye(v,null),g=null}),{get isMinimizing(){return Dn(u)},get isRestoring(){return Dn(c)},get isOpening(){return Dn(f)},get isClosing(){return Dn(h)},get animationTransform(){return Dn(p)},get pendingOpenSource(){return Dn(v)},startMinimize:function(t,e){const h=n();if(Dn(u)||!h)return;if(ye(c,!1),ye(f,!1),w(),!Kr()){const t=h.getBoundingClientRect();let n=o()?i():{x:t.left,y:t.top},u=a()?l():{width:t.width,height:t.height};return o()||(r(n),s(!0)),void(e?e():d(n,!0,u))}const v=h.getBoundingClientRect(),g=v.left+v.width/2,x=v.top+v.height/2;let b=o()?i():{x:v.left,y:v.top},M=a()?l():{width:v.width,height:v.height};o()||(r(b),s(!0));const z=t??y(),k=z.x-v.left,I=z.y-v.top,_={x:z.x-g,y:z.y-x,originX:k,originY:I};ye(p,_,!0),requestAnimationFrame(()=>{requestAnimationFrame(()=>{ye(u,!0)})}),m=setTimeout(()=>{e?e():d(b,!0,M)},500)},startRestore:function(t,e){if(!Kr()){const e=t||{x:window.innerWidth/2,y:window.innerHeight/2};return r(e),void s(!0)}const n=y(),i=t||{x:window.innerWidth/2,y:window.innerHeight/2},o=e||{width:480,height:400};r(i),s(!0);const a=i.x+o.width/2,l=i.y+o.height/2,d=n.x-i.x,u=n.y-i.y;ye(p,{x:n.x-a,y:n.y-l,originX:d,originY:u},!0),ye(c,!0),setTimeout(()=>{ye(c,!1),ye(p,null)},400)},startClose:function(t){Dn(h)||Dn(u)||(Kr()?(g=t,ye(h,!0),setTimeout(()=>{ye(h,!1),g&&(g(),g=null)},250)):t())},setPendingOpenSource:function(t){ye(v,t,!0)},tryStartOpenAnimation:function(){const t=n();if(!Dn(v)||!t||Dn(f))return!1;if(!Kr())return ye(v,null),!1;const e=Dn(v);ye(v,null);const a=t.getBoundingClientRect(),l=o()?i():{x:a.left,y:a.top},d=a.width,u=a.height,c=l.x+d/2,h=l.y+u/2;o()||(r(l),s(!0));const g=e.x-l.x,m=e.y-l.y;return ye(p,{x:e.x-c,y:e.y-h,originX:g,originY:m},!0),ye(f,!0),setTimeout(()=>{ye(f,!1),ye(p,null)},400),!0},forceClearMinimize:function(){w(),ye(u,!1),ye(p,null)}}}(0,()=>Dn(m),()=>O.position,t=>O.setPosition(t),()=>O.hasBeenDragged,t=>O.setHasBeenDragged(t),()=>W.hasBeenResized,()=>W.size,(t,n,i)=>{zr(e.id,{position:t,size:i,hasBeenDragged:n}),yr(e.id)}),{trapFocus:B,focusFirstElement:R}={trapFocus:Ur,focusFirstElement:Qr},A=le(()=>T.isMinimizing||T.isRestoring||T.isOpening||T.isClosing),L=le(()=>(Ar(e.id)||Rr(e.id))&&!T.isRestoring);let H=me(!1);const $=le(()=>T.isRestoring||T.isOpening||Dn(H)),F=le(()=>Dn(k)&&!O.hasBeenDragged&&!Dn(A)&&!T.pendingOpenSource&&!Dn(L)),q=le(()=>{const t=[];return t.push(`z-index: ${Dn(S)};`),T.animationTransform?(t.push(`left: ${O.position.x}px; top: ${O.position.y}px;`),t.push(`--genie-origin-x: ${T.animationTransform.originX}px;`),t.push(`--genie-origin-y: ${T.animationTransform.originY}px;`),t.push(`--genie-translate-x: ${T.animationTransform.x}px;`),t.push(`--genie-translate-y: ${T.animationTransform.y}px;`)):O.hasBeenDragged&&t.push(`left: ${O.position.x}px; top: ${O.position.y}px; transform: none;`),W.hasBeenResized?t.push(`width: ${W.size.width}px; height: ${W.size.height}px; max-width: none; max-height: none;`):(e.preferredHeight&&t.push(`min-height: ${e.preferredHeight};`),n()&&t.push(`max-width: ${n()};`)),Dn(D)&&e.glow&&(t.push(`--modal-glow-color: ${e.glow.color};`),t.push(`--modal-glow-intensity: ${e.glow.intensity};`)),t.join(" ")});function j(){Dn(f)&&yr(e.id)}function X(){var t;Tr(e.id)&&Br(e.id),_r(e.id),null==(t=e.onClose)||t.call(e)}function Y(){qr(e.id)}function N(t){Dn(c)&&Dn(m)&&O.onPointerDown(t,Dn(m))}function K(t){r()&&"Escape"===t.key&&function(t){const e=Qi.get(t);if(!e)return!1;const n=Math.max(...Array.from(Qi.values()).map(t=>t.zIndex),0);return e.zIndex===n&&!e.isMinimized&&!e.isHiddenWithParent}(e.id)&&(t.stopPropagation(),X())}function G(t){if(!Dn(m))return;const n=O.isDragging,i=W.hasBeenResized?W.size:{width:Dn(m).offsetWidth,height:Dn(m).offsetHeight};O.onPointerMove(t,Dn(m),i),O.isDragging&&n&&Mr(e.id,O.position,{drag:!0})}function V(t){if(!Dn(m))return;const n=O.isDragging;O.onPointerUp(t,Dn(m)),n&&!W.justFinishedResizing&&(Mr(e.id,O.position,{drag:!0}),function(t){const e=Ri();if("animated"!==e.parentChild.movementMode)return;const n=e.parentChild.animationDuration,i=[];let r=t;for(;;){const t=Qi.get(r);if(!(null==t?void 0:t.parentId))break;i.push({parentId:t.parentId,childId:r}),r=t.parentId}i.forEach(({parentId:t,childId:e},i)=>{setTimeout(()=>{const i=Qi.get(e),r=Qi.get(t);if(!(null==i?void 0:i.position)||!i.offsetFromParent||!r)return;const o={x:i.position.x-i.offsetFromParent.x,y:i.position.y-i.offsetFromParent.y};hr.set(t,o),function(t){const e=hr.get(t);if(!e)return;const n=Qi.get(t);n&&(Qi.set(t,{...n,isAnimatingPosition:!0,position:e}),hr.delete(t),tr())}(t),setTimeout(()=>function(t){const e=Qi.get(t);e&&(Qi.set(t,{...e,isAnimatingPosition:!1}),tr())}(t),n)},i*n)})}(e.id))}function U(){var t;const n=Ri();if("smart"!==(null==(t=n.positioning)?void 0:t.strategy))return!1;const i=Sr(e.id),r=Dn(fr);if((null==i?void 0:i.parentId)||r&&r.childId===e.id)return!1;if((null==i?void 0:i.hasBeenDragged)||(null==i?void 0:i.position))return!1;const o=Dn(m)||document.querySelector(`[data-modal-id="${Dn(d)}"]`);if(!o)return!1;const s=o.offsetWidth,a=o.offsetHeight;if(s<=0||a<=0)return!1;const l=n.positioning.modalGap??16,u=function(t){const e=[];for(const[n,i]of Qi.entries())if(n!==t&&i.isOpen&&!i.isMinimized&&!i.isHiddenWithParent)if(i.position&&i.size)e.push({x:i.position.x,y:i.position.y,width:i.size.width,height:i.size.height});else{const t=document.querySelector(`[data-modal-id="${Ui(n)}"]`);if(t){const n=t.getBoundingClientRect();e.push({x:n.left,y:n.top,width:n.width,height:n.height})}}return e}(e.id),c=function(t){if("undefined"==typeof document)return[];const e=[];for(const n of t)try{const t=document.querySelectorAll(n);for(const n of t){const t=n.getBoundingClientRect();t.width>0&&t.height>0&&e.push({x:t.left,y:t.top,width:t.width,height:t.height})}}catch{}return e}(n.positioning.avoidElements??[]),f=function(t,e,n,i={}){const{modalGap:r=16,gridResolution:o=10,avoidBounds:s=[],avoidMargin:a=16}=i,l=i.margin??r,d="undefined"!=typeof window?window.innerWidth:1920,u="undefined"!=typeof window?window.innerHeight:1080,c=s.map(t=>({x:t.x-a,y:t.y-a,width:t.width+2*a,height:t.height+2*a})),f={x:(d-t)/2,y:(u-e)/2};if(0===n.length&&0===c.length)return f;const h=l,p=Math.max(l,d-t-l),v=l,g=Math.max(l,u-e-l);if(p<=h||g<=v)return f;const m=Gi(f.x,f.y,t,e,n,r),w=Gi(f.x,f.y,t,e,c,0);if(0===m&&0===w)return f;const y=[],x=(p-h)/o,b=(g-v)/o;for(let i=0;i<=o;i++)for(let s=0;s<=o;s++){const o=h+i*x,a=v+s*b,f=Gi(o,a,t,e,n,r),p=Gi(o,a,t,e,c,0),g=Vi(o,a,t,e,d,u,l);y.push({pos:{x:o,y:a},modalOverlap:f,avoidOverlap:p,centerDist:g})}const M=y.filter(t=>0===t.avoidOverlap),z=M.length>0?M:y,k=t*e,I=Math.min(...z.map(t=>t.modalOverlap))/k;return z.sort((t,e)=>{if(0===M.length&&t.avoidOverlap!==e.avoidOverlap)return t.avoidOverlap-e.avoidOverlap;const n=t.modalOverlap/k,i=e.modalOverlap/k;if(I<.3){const r=.3,o=n<=r,s=i<=r;if(o&&s)return t.centerDist+.3*n-(e.centerDist+.3*i);if(o)return-1;if(s)return 1}return.6*n+.4*t.centerDist-(.6*i+.4*e.centerDist)}),z[0].pos}(s,a,u,{modalGap:l,avoidBounds:c});if(Gi(f.x,f.y,s,a,u,l)/(s*a)>.1&&u.length>0){const t=function(t){const e=[];for(const[n,i]of Qi.entries())if(n!==t&&i.isOpen&&!i.isMinimized&&!i.isHiddenWithParent&&!i.parentId)if(i.position&&i.size)e.push({id:Ui(n),x:i.position.x,y:i.position.y,width:i.size.width,height:i.size.height});else{const t=document.querySelector(`[data-modal-id="${Ui(n)}"]`);if(t){const i=t.getBoundingClientRect();e.push({id:Ui(n),x:i.left,y:i.top,width:i.width,height:i.height})}}return e}(e.id),n=function(t,e,n,i={}){const{modalGap:r=16}=i,o=i.margin??r,s="undefined"!=typeof window?window.innerWidth:1920,a="undefined"!=typeof window?window.innerHeight:1080,l=n.reduce((t,e)=>t+e.width,0)+t,d=n.length*r,u=s-2*o;if(l+d>u)return null;const c=u-l-d;n.length;const f=c/2,h=s/2,p=[...n.map(t=>({id:t.id,width:t.width,height:t.height,currentX:t.x+t.width/2,currentY:t.y,isNew:!1})),{id:"__new__",width:t,height:e,currentX:h,currentY:(a-e)/2,isNew:!0}];p.sort((t,e)=>t.currentX-e.currentX);let v=o+f;const g=new Map;let m=null;for(const t of p){const e=v;if(t.isNew)m={x:Math.round(e),y:Math.round(t.currentY)};else{const i=n.find(e=>e.id===t.id);Math.abs(e-i.x)>5&&g.set(t.id,{x:Math.round(e),y:Math.round(i.y)})}v+=t.width+r}return m?{newModalPosition:m,existingModalMoves:g}:null}(s,a,t,{modalGap:l});if(n&&n.existingModalMoves.size>0)return function(t){const e=Ri().parentChild.animationDuration;for(const[e,n]of t){const t=Qi.get(e);t&&Qi.set(e,{...t,position:n,isAnimatingPosition:!0,hasBeenDragged:!0})}tr(),setTimeout(()=>{for(const e of t.keys()){const t=Qi.get(e);t&&Qi.set(e,{...t,isAnimatingPosition:!1})}tr()},e)}(n.existingModalMoves),O.setPosition(n.newModalPosition),O.setHasBeenDragged(!0),Mr(e.id,n.newModalPosition,{size:{width:s,height:a}}),!0}return O.setPosition(f),O.setHasBeenDragged(!0),Mr(e.id,f,{size:{width:s,height:a}}),!0}function Q(){Pn().then(()=>Pn()).then(()=>{let t=0;const e=()=>{t+=1,U()||t>5||requestAnimationFrame(e)};Dn(m)?e():requestAnimationFrame(e)})}ti(()=>{var t;function n(){const t=Sr(e.id);if(!(null==t?void 0:t.position)||!Dn(m))return;if(t.parentId)return;const n=W.hasBeenResized?W.size.width:Dn(m).offsetWidth,i=W.hasBeenResized?W.size.height:Dn(m).offsetHeight;if(n<=0||i<=0)return;const r=Yi(t.position.x,t.position.y,n,i);(Math.abs(r.x-t.position.x)>1||Math.abs(r.y-t.position.y)>1)&&(O.setPosition(r),Mr(e.id,r))}return o()||(t=i(),mr({id:e.id,title:e.title,icon:e.icon??"",isOpen:t,isMinimized:!1,isHiddenWithParent:!1,isTransparent:!1,isRejected:!1,position:null,size:null,hasBeenDragged:!1,dockPosition:0,glow:e.glow??null,parentId:void 0,childId:void 0,offsetFromParent:void 0}),t&&kr(e.id)),i()&&(Pn().then(()=>{Dn(m)&&R(Dn(m))}),Q()),window.addEventListener("pointermove",G),window.addEventListener("pointerup",V),window.addEventListener("resize",n),()=>{window.removeEventListener("pointermove",G),window.removeEventListener("pointerup",V),window.removeEventListener("resize",n)}}),ei(()=>{jr(e.id),o()||wr(e.id)}),He(()=>{Or();const t=Sr(e.id);if(t){if(ye(w,t.isTransparent,!0),!O.isDragging&&!W.isResizing&&t.position){const e=O.position,n=t.position;(Math.abs(e.x-n.x)>.5||Math.abs(e.y-n.y)>.5)&&(O.setPosition(n),t.hasBeenDragged&&O.setHasBeenDragged(!0))}Pn().then(()=>function(){var t,n;if(!Sr(e.id))return;if(Tr(e.id))return Br(e.id),void(null==(t=e.onClose)||t.call(e));if(Cr(e.id)&&!Dn(b)){if(ye(b,!0),Dn(ur),ye(ur,null),Dn(m)){const t=Dn(m).getBoundingClientRect(),n=O.hasBeenDragged?O.position:{x:t.left,y:t.top},i=W.hasBeenResized?W.size:{width:t.width,height:t.height};zr(e.id,{position:n,size:i,hasBeenDragged:!0})}T.startMinimize(void 0,()=>{var t;t=e.id,Dn(nr).includes(t)&&ye(nr,Dn(nr).filter(e=>e!==t),!0),ye(b,!1)})}if(Rr(e.id)){n=e.id,Dn(sr).includes(n)&&ye(sr,Dn(sr).filter(t=>t!==n),!0);const t=Sr(e.id);T.startRestore((null==t?void 0:t.position)??void 0,(null==t?void 0:t.size)??void 0),Pn().then(()=>{Dn(m)&&R(Dn(m))})}if(Ar(e.id)){!function(t){Dn(ar).includes(t)&&ye(ar,Dn(ar).filter(e=>e!==t),!0)}(e.id);const t=Sr(e.id);T.startRestore((null==t?void 0:t.position)??void 0,(null==t?void 0:t.size)??void 0)}if(Wr(e.id)&&(function(t){Dn(rr).includes(t)&&ye(rr,Dn(rr).filter(e=>e!==t),!0)}(e.id),T.startClose(()=>{var t;jr(e.id),function(t){const e=Qi.get(t);if(e){if(e.parentId){const n=Qi.get(e.parentId);n&&n.childId===t&&Qi.set(e.parentId,{...n,childId:void 0,lastChildId:t})}Qi.set(t,{...e,isOpen:!1,isMinimized:!1,isHiddenWithParent:!1,isTransparent:!1,position:null,size:null,hasBeenDragged:!1,parentId:void 0,childId:void 0,offsetFromParent:void 0}),tr()}}(e.id),null==(t=e.onClose)||t.call(e)})),Er(e.id)){!function(t){Dn(ir).includes(t)&&ye(ir,Dn(ir).filter(e=>e!==t),!0)}(e.id);const t=function(t){const e=cr.get(t);return e&&cr.delete(t),e??null}(e.id)||e.openSourcePosition||null;t?(T.setPendingOpenSource(t),Pn().then(()=>Pn()).then(()=>{U(),T.tryStartOpenAnimation()})):Q(),Pn().then(()=>{Dn(m)&&R(Dn(m))})}(function(t){return Dn(lr).includes(t)})(e.id)&&(function(t){Dn(lr).includes(t)&&ye(lr,Dn(lr).filter(e=>e!==t),!0)}(e.id),function(t){Dn(dr).includes(t)||ye(dr,[...Dn(dr),t],!0)}(e.id),ye(M,!0),setTimeout(()=>{ye(M,!1),function(t){ye(dr,Dn(dr).filter(e=>e!==t),!0)}(e.id)},600));const i=function(t){if(!Dn(fr)||Dn(fr).childId!==t)return null;const e=Dn(fr);return ye(fr,null),e}(e.id);var r;i&&Dn(m)&&(r=i.parentId,Pn().then(()=>Pn()).then(()=>{let t=0;const n=()=>{t+=1;const i=function(t){var n,i;const r=Sr(t);if(!r)return!1;const o=Dn(m)||document.querySelector(`[data-modal-id="${Dn(d)}"]`),s=document.querySelector(`[data-modal-id="${Ui(t)}"]`),a=null==s?void 0:s.getBoundingClientRect(),l=r.position??(a?{x:a.left,y:a.top}:null);if(!l||!o)return!1;const u=(null==(n=r.size)?void 0:n.width)??(null==s?void 0:s.offsetWidth)??(null==a?void 0:a.width)??480,c=(null==(i=r.size)?void 0:i.height)??(null==s?void 0:s.offsetHeight)??(null==a?void 0:a.height)??400,f=o.offsetWidth,h=o.offsetHeight;if(u<=0||c<=0||f<=0||h<=0)return!1;const p={x:l.x+(u-f)/2,y:l.y+(c-h)/2};return O.setPosition(p),O.setHasBeenDragged(!0),Mr(e.id,p,{size:{width:f,height:h}}),r.position&&r.size||!a||Mr(t,{x:a.left,y:a.top},{size:{width:u,height:c}}),function(t,e){if(!Ri().features.parentChild)return;const n=Qi.get(t),i=Qi.get(e);if(!n||!i)return;let r={x:40,y:40};n.position&&i.position&&(r={x:i.position.x-n.position.x,y:i.position.y-n.position.y});const o=Math.max(i.zIndex,n.zIndex+1);Qi.set(t,{...n,childId:e,lastChildId:e}),Qi.set(e,{...i,parentId:t,offsetFromParent:r,zIndex:o}),tr()}(t,e.id),!0}(r);i||t>5||requestAnimationFrame(n)};Dn(m)?n():requestAnimationFrame(n)}))}())}}),He(()=>{const t=Sr(e.id);t&&t.isTransparent!==Dn(w)&&ye(w,t.isTransparent,!0)}),He(()=>{if(Dn(k)&&Dn(m)){const t=t=>function(t){Dn(m)&&B(t,Dn(m))}(t);return Dn(m).addEventListener("keydown",t),()=>{var e;return null==(e=Dn(m))?void 0:e.removeEventListener("keydown",t)}}}),He(()=>{!Dn(k)&&T.isMinimizing&&T.forceClearMinimize()}),He(()=>{T.isRestoring||T.isOpening?ye(H,!0):Dn(H)&&requestAnimationFrame(()=>{ye(H,!1)})}),He(()=>{Dn(x)&&!Dn(I)&&(ye(y,!0),setTimeout(()=>{ye(y,!1)},200)),ye(x,Dn(I),!0)});var J=qn(),Z=We(J),tt=t=>{to(t,{get target(){return l},children:(t,n)=>{var i=Mo();let r;i.__keydown=K;var o=Ee(i);{let t=le(()=>Dn(c)?N:void 0);!function(t,e){Tt(e,!0);let n=Oi(e,"isTransparent",0,!1),i=Oi(e,"headerLayout",0,"macos"),r=Oi(e,"minimizable",0,!0),o=Oi(e,"minimizeDisabled",0,!1),s=Oi(e,"transparencyEnabled",0,!0);const a=Wt(Yr),l=le(()=>null==a?void 0:a()),d=le(()=>"macos"===i());var u=go();let c;u.__pointerdown=function(t){var n;t.target.closest("button")||null==(n=e.onStartDrag)||n.call(e,t)};var f=Ee(u),h=t=>{var n=ao(),i=We(n),a=Ee(i);a.__click=function(...t){var n;null==(n=e.onClose)||n.apply(this,t)};var d=Te(a,2),u=t=>{var n=eo();let i;n.__click=function(...t){var n;null==(n=o()?void 0:e.onMinimize)||n.apply(this,t)},je(()=>{i=Mi(n,0,"modal-header-light modal-header-light-minimize",null,i,{"modal-header-light-disabled":o()}),n.disabled=o(),Pi(n,"title",o()?"Enable dock to minimize":void 0)}),jn(t,n)};ni(d,t=>{r()&&t(u)});var c=Te(d,2),f=t=>{var n=no();n.__click=function(...t){var n;null==(n=e.onToggleStyle)||n.apply(this,t)},jn(t,n)};ni(c,t=>{s()&&t(f)});var h=Ee(Te(i,2)),p=t=>{var n=io();Zn(Ee(n),()=>e.customIcon),jn(t,n)},v=t=>{var n=qn(),i=We(n),r=t=>{var n=ro();Zn(Ee(n),()=>Dn(l),()=>e.icon),jn(t,n)};ni(i,t=>{e.icon&&Dn(l)&&t(r)},!0),jn(t,n)};ni(h,t=>{e.customIcon?t(p):t(v,!1)});var g=Ee(Te(h,2)),m=t=>{var n=oo(),i=Ee(n);je(()=>{Pi(n,"id",e.titleId),Kn(i,e.title)}),jn(t,n)},w=t=>{var n=so(),i=Ee(n);je(()=>Kn(i,e.title)),jn(t,n)};ni(g,t=>{e.titleId?t(m):t(w,!1)}),jn(t,n)},p=t=>{var n=vo(),i=We(n),a=Ee(i),d=t=>{var n=lo();Zn(Ee(n),()=>e.customIcon),jn(t,n)},u=t=>{var n=qn(),i=We(n),r=t=>{var n=uo();Zn(Ee(n),()=>Dn(l),()=>e.icon),jn(t,n)};ni(i,t=>{e.icon&&Dn(l)&&t(r)},!0),jn(t,n)};ni(a,t=>{e.customIcon?t(d):t(u,!1)});var c=Te(a,2),f=t=>{var n=co(),i=Ee(n);je(()=>{Pi(n,"id",e.titleId),Kn(i,e.title)}),jn(t,n)},h=t=>{var n=fo(),i=Ee(n);je(()=>Kn(i,e.title)),jn(t,n)};ni(c,t=>{e.titleId?t(f):t(h,!1)});var p=Ee(Te(i,2)),v=t=>{var n=ho();n.__click=function(...t){var n;null==(n=e.onToggleStyle)||n.apply(this,t)},jn(t,n)};ni(p,t=>{s()&&t(v)});var g=Te(p,2),m=t=>{var n=po();let i;n.__click=function(...t){var n;null==(n=o()?void 0:e.onMinimize)||n.apply(this,t)},je(()=>{i=Mi(n,0,"modal-header-btn-windows",null,i,{"modal-header-btn-windows-disabled":o()}),n.disabled=o(),Pi(n,"title",o()?"Enable dock to minimize":void 0)}),jn(t,n)};ni(g,t=>{r()&&t(m)}),Te(g,2).__click=function(...t){var n;null==(n=e.onClose)||n.apply(this,t)},jn(t,n)};ni(f,t=>{Dn(d)?t(h):t(p,!1)}),je(()=>c=Mi(u,0,"modal-header",null,c,{"modal-header-draggable":!!e.onStartDrag,transparent:n()})),jn(t,u),Bt()}(o,{get title(){return e.title},get customIcon(){return e.customIcon},get icon(){return e.icon},get isTransparent(){return Dn(w)},get titleId(){return Dn(C)},get headerLayout(){return Dn(g)},get onStartDrag(){return Dn(t)},onToggleStyle:Y,onMinimize:j,onClose:X,get minimizable(){return Dn(f)},get minimizeDisabled(){return Dn(h)},get transparencyEnabled(){return Dn(p)}})}var s=Te(o,2);Zn(Ee(s),()=>e.children??at),wi(s,(t,e)=>null==yo?void 0:yo(t,e),()=>e.bodyElement);var a=Te(s,2),l=t=>{var n=xo(),i=Ee(n),r=t=>{var n=qn();Zn(We(n),()=>e.footer),jn(t,n)};ni(i,t=>{e.footer&&t(r)}),wi(n,(t,e)=>null==yo?void 0:yo(t,e),()=>e.footerElement),jn(t,n)};ni(a,t=>{(e.footer||e.footerElement)&&t(l)});var u=Te(a,2);{let t=le(()=>Dn(v)&&!Dn(I)?W.handlers.startResize:void 0);!function(t,e){Tt(e,!0);const n=["n","s","e","w","ne","nw","se","sw"];var i=qn(),r=We(i),o=t=>{var i=wo();si(i,21,()=>n,ii,(t,n)=>{var i=mo();i.__pointerdown=t=>function(t,n){var i;null==(i=e.onStartResize)||i.call(e,t,n)}(t,Dn(n)),je(()=>Mi(i,0,`modal-resize-handle modal-resize-${Dn(n)??""}`)),jn(t,i)}),jn(t,i)};ni(r,t=>{e.onStartResize&&t(o)}),jn(t,i),Bt()}(u,{get onStartResize(){return Dn(t)}})}var x,b,k,S=Te(u,2),B=t=>{var e=bo();let n;je(()=>n=Mi(e,0,"modal-child-overlay",null,n,{"modal-overlay-closing":Dn(y)})),jn(t,e)};ni(S,t=>{Dn(P)&&t(B)}),Si(i,t=>ye(m,t),()=>Dn(m)),je(()=>{var t;r=Mi(i,0,"modal-dialog",null,r,{"modal-dragging":O.isDragging,"modal-resizing":W.isResizing,"modal-positioned":O.hasBeenDragged,"modal-minimizing":T.isMinimizing,"modal-restoring":T.isRestoring,"modal-opening":T.isOpening,"modal-closing":T.isClosing,"modal-centered":Dn(F),"modal-solid":!Dn(w),"modal-transparent":Dn(w),"modal-glow":Dn(D),"modal-has-child":Dn(I),"modal-is-child":Dn(_),"modal-visible-by-animation":Dn($),"modal-animating-to-center":Dn(E),"modal-animating-position":null==(t=Dn(z))?void 0:t.isAnimatingPosition,"modal-attention":Dn(M)}),Pi(i,"data-modal-id",Dn(d)),ki(i,Dn(q)),Pi(i,"aria-labelledby",Dn(C))}),k=function(t,e,n,i={}){function r(t){if(i.capture||Hn.call(e,t),!t.cancelBubble)return Be(()=>null==n?void 0:n.call(this,t))}return t.startsWith("pointer")||t.startsWith("touch")||"wheel"===t?Ht(()=>{e.addEventListener(t,r,i)}):e.addEventListener(t,r,i),r}("pointerdown",x=i,()=>kr(e.id),b={capture:!0,passive:void 0}),(x===document.body||x===window||x===document||x instanceof HTMLMediaElement)&&Le(()=>{x.removeEventListener("pointerdown",k,b)}),jn(t,i)},$$slots:{default:!0}})};ni(Z,t=>{Dn(k)&&t(tt)}),jn(t,J),Bt()}An(["keydown"]);const ko=t=>t;function Io(t){const e=t-1;return e*e*e+1}function _o(t){const e="string"==typeof t&&t.match(/^\s*(-?[\d.]+)([^\s]*)\s*$/);return e?[parseFloat(e[1]),e[2]||"px"]:[t,"px"]}function Po(t,{delay:e=0,duration:n=400,easing:i=ko}={}){const r=+getComputedStyle(t).opacity;return{delay:e,duration:n,easing:i,css:t=>"opacity: "+t*r}}function Do(t,{delay:e=0,duration:n=400,easing:i=Io,x:r=0,y:o=0,opacity:s=0}={}){const a=getComputedStyle(t),l=+a.opacity,d="none"===a.transform?"":a.transform,u=l*(1-s),[c,f]=_o(r),[h,p]=_o(o);return{delay:e,duration:n,easing:i,css:(t,e)=>`\n\t\t\ttransform: ${d} translate(${(1-t)*c}${f}, ${(1-t)*h}${p});\n\t\t\topacity: ${l-u*e}`}}function Co(t,{delay:e=0,duration:n=400,easing:i=Io,start:r=0,opacity:o=0}={}){const s=getComputedStyle(t),a=+s.opacity,l="none"===s.transform?"":s.transform,d=1-r,u=a*(1-o);return{delay:e,duration:n,easing:i,css:(t,e)=>`\n\t\t\ttransform: ${l} scale(${1-d*e});\n\t\t\topacity: ${a-u*e}\n\t\t`}}function So(t){const e=1.70158;return--t*t*((e+1)*t+e)+1}function Oo(t){const e=t-1;return e*e*e+1}var Eo=Fn('<button type="button" aria-label="Drag dock"></button>'),Wo=Fn('<span class="modal-dock-item-icon-placeholder"> </span>'),To=Fn('<span class="modal-dock-item-label"> </span>'),Bo=Fn("<span>+</span>"),Ro=Fn('<span class="modal-dock-child-indicator"><!></span>'),Ao=Fn('<button><span class="modal-dock-item-icon"><!></span> <!> <span class="modal-dock-item-glow"></span> <!></button>'),Lo=Fn('<div data-dock-container="true"><div><!> <!></div></div>');function Ho(t,e){Tt(e,!0);const n=Wt(Yr),i=le(()=>e.renderIcon??(null==n?void 0:n())),r=Fr(),o=le(()=>(Bi(),Ri())),s=le(()=>qi("DOCK")),a=le(()=>Dn(o).dock.position),l=le(()=>Dn(o).dock.labelMode);let d=me("horizontal"),u=me(ke({x:100,y:100})),c=me(null),f=me(!1),h={x:0,y:0},p=null;const v=le(()=>(Or(),Array.from(r.modals.values()).filter(t=>t.isMinimized).sort((t,e)=>t.dockPosition-e.dockPosition))),g=le(()=>{switch(Dn(a)){case"left":return{x:-20,duration:250,easing:Oo};case"right":return{x:20,duration:250,easing:Oo};default:return{y:20,duration:250,easing:Oo}}});function m(t){var e;"free"===Dn(a)&&(ye(f,!0),p=t.pointerId,h={x:t.clientX-Dn(u).x,y:t.clientY-Dn(u).y},null==(e=t.currentTarget)||e.setPointerCapture(t.pointerId),window.addEventListener("pointermove",w),window.addEventListener("pointerup",y),window.addEventListener("pointercancel",y))}function w(t){if(t.pointerId!==p||!Dn(c))return;const e=Dn(c).getBoundingClientRect(),n=window.innerWidth-e.width-8,i=window.innerHeight-e.height-8,r=Math.min(Math.max(t.clientX-h.x,8),Math.max(8,n)),o=Math.min(Math.max(t.clientY-h.y,8),Math.max(8,i));ye(u,{x:Math.round(r),y:Math.round(o)},!0)}function y(t){t.pointerId===p&&(ye(f,!1),p=null,window.removeEventListener("pointermove",w),window.removeEventListener("pointerup",y),window.removeEventListener("pointercancel",y))}const{addListener:x}=function(){function t(t,e,n){return"undefined"==typeof window?()=>{}:(window.addEventListener(t,e,n),()=>{window.removeEventListener(t,e,n)})}return{addListener:t,addListenerEffect:function(e,n,i){He(()=>{if("undefined"!=typeof window)return t(e,n,i)})}}}();function b(){if("free"!==Dn(a)||!Dn(c))return;const t=Dn(c).getBoundingClientRect(),e=Yi(Dn(u).x,Dn(u).y,t.width,t.height);e.x===Dn(u).x&&e.y===Dn(u).y||ye(u,{x:Math.round(e.x),y:Math.round(e.y)},!0)}He(()=>{"undefined"!=typeof window&&x("resize",b)});var M={setDockOrientation:function(t){ye(d,t,!0)},setDockFreePosition:function(t){ye(u,t,!0)},getDockState:function(){return{dockPosition:Dn(a),dockOrientation:Dn(d),dockFreePosition:Dn(u),dockLabelMode:Dn(l)}}};return to(t,{get target(){return Dn(o).portalTarget},children:(t,e)=>{var n=Lo();let o,h;var p=Ee(n);let w;var y=Ee(p),x=t=>{var e=Eo();let n;e.__pointerdown=m,je(()=>n=Mi(e,0,"modal-dock-handle",null,n,{"modal-dock-handle-dragging":Dn(f)})),jn(t,e)};ni(y,t=>{"free"===Dn(a)&&t(x)}),si(Te(y,2),19,()=>Dn(v),t=>t.id,(t,e,n)=>{const o=le(()=>Dn(e).lastChildId?r.modals.get(Dn(e).lastChildId):null);var s=Ao();let a;s.__click=t=>{var n;n=Dn(e).id,pr.has(n)?t.currentTarget.animate([{transform:"translateX(0)"},{transform:"translateX(-6px)"},{transform:"translateX(6px)"},{transform:"translateX(-6px)"},{transform:"translateX(6px)"},{transform:"translateX(0)"}],{duration:300,easing:"ease-in-out"}):xr(Dn(e).id)};var d=Ee(s),u=Ee(d),c=t=>{var n=qn();Zn(We(n),()=>Dn(i),()=>Dn(e).icon),jn(t,n)},f=t=>{var n=Wo(),i=Ee(n);je(t=>Kn(i,t),[()=>Dn(e).title.charAt(0)]),jn(t,n)};ni(u,t=>{Dn(e).icon&&Dn(i)?t(c):t(f,!1)});var h=Te(d,2),p=t=>{var n=To(),i=Ee(n);je(()=>Kn(i,Dn(e).title)),jn(t,n)};ni(h,t=>{"hidden"!==Dn(l)&&t(p)});var v=Te(h,4),g=t=>{var e=Ro(),n=Ee(e),r=t=>{var e=qn();Zn(We(e),()=>Dn(i),()=>Dn(o).icon),jn(t,e)},s=t=>{jn(t,Bo())};ni(n,t=>{Dn(o).icon&&Dn(i)?t(r):t(s,!1)}),jn(t,e)};ni(v,t=>{Dn(e).lastChildId&&Dn(o)&&t(g)}),je(t=>{a=Mi(s,0,"modal-dock-item",null,a,{"modal-dock-item-has-glow":!!Dn(e).glow,"modal-dock-item-has-child":!!Dn(e).lastChildId,"modal-dock-item-label-beside":"beside"===Dn(l),"modal-dock-item-label-below":"below"===Dn(l)}),Pi(s,"data-modal-id",t),ki(s,Dn(e).glow?`--modal-dock-glow-color: ${Dn(e).glow.color};`:"")},[()=>Ui(Dn(e).id)]),gi(3,s,()=>Co,()=>({duration:300,delay:50*Dn(n),easing:So,start:.5})),jn(t,s)}),Si(n,t=>ye(c,t),()=>Dn(c)),je(()=>{o=Mi(n,0,"modal-dock-container",null,o,{"modal-dock-left":"left"===Dn(a),"modal-dock-right":"right"===Dn(a),"modal-dock-bottom":"bottom"===Dn(a),"modal-dock-free":"free"===Dn(a),"modal-dock-empty":0===Dn(v).length}),h=ki(n,"free"===Dn(a)?`left: ${Dn(u).x}px; top: ${Dn(u).y}px;`:"",h,{"z-index":Dn(s)}),w=Mi(p,0,"modal-dock",null,w,{"modal-dock-free-horizontal":"free"===Dn(a)&&"horizontal"===Dn(d),"modal-dock-free-vertical":"free"===Dn(a)&&"vertical"===Dn(d)})}),gi(3,n,()=>Do,()=>Dn(v).length>0?Dn(g):{duration:0}),jn(t,n)},$$slots:{default:!0}}),Bt(M)}function $o(t,e){Tt(e,!0);let n=Oi(e,"maxWidth",0,"600px"),i=Oi(e,"autoOpen",0,!1),r=Oi(e,"closeOnEscape",0,!0),o=me(!1);ti(()=>{mr({id:e.id,title:e.title,icon:e.icon??"",isOpen:i(),isMinimized:!1,isHiddenWithParent:!1,isTransparent:!1,isRejected:!1,position:null,size:null,hasBeenDragged:!1,dockPosition:0,glow:e.glow??null,parentId:void 0,childId:void 0,offsetFromParent:void 0}),ye(o,!0)}),ei(()=>{wr(e.id)});const s=le(()=>{if(!Dn(o))return!1;Or();const t=Sr(e.id);return!!t&&(t.isOpen||t.isMinimized||Er(e.id)||Wr(e.id)||Cr(e.id))});var a=qn(),l=We(a),d=t=>{zo(t,{get id(){return e.id},get title(){return e.title},get icon(){return e.icon},get customIcon(){return e.customIcon},get maxWidth(){return n()},get preferredHeight(){return e.preferredHeight},get autoOpen(){return i()},get openSourcePosition(){return e.openSourcePosition},get glow(){return e.glow},get config(){return e.config},get closeOnEscape(){return r()},get onClose(){return e.onClose},get children(){return e.children},get footer(){return e.footer},skipRegistration:!0})};ni(l,t=>{Dn(s)&&t(d)}),jn(t,a),Bt()}An(["pointerdown","click"]);var Fo=Fn('<div class="modal-backdrop svelte-1d3nq4t" aria-hidden="true"></div>');function qo(t,e){Tt(e,!0);const n=Fr(),i=le(()=>(Bi(),Ri())),r=le(()=>Dn(i).features.backdrop),o=le(()=>(Or(),Array.from(n.modals.values()).some(t=>t.isOpen&&!t.isMinimized&&!t.isHiddenWithParent))),s=le(()=>Dn(r)&&Dn(o)),a=le(()=>qi("MODAL")-1);to(t,{get target(){return Dn(i).portalTarget},children:(t,e)=>{var n=qn(),i=We(n),r=t=>{var e=Fo();let n;je(()=>n=ki(e,"",n,{"z-index":Dn(a)})),gi(3,e,()=>Po,()=>({duration:200})),jn(t,e)};ni(i,t=>{Dn(s)&&t(r)}),jn(t,n)},$$slots:{default:!0}}),Bt()}export{qo as B,Ho as D,zo as M,Qn as a,Li as b,ji as c,er as d,_r as e,yr as f,Ri as g,xr as h,Fi as i,Dr as j,Lr as k,kr as l,Gn as m,Fr as n,Ir as o,$r as p,Pr as q,mr as r,Ai as s,Ui as t,wr as u,Hr as v,qr as w,$o as x};
@@ -1 +1 @@
1
- .modal-dialog{background:var(--modal-bg);border:1px solid var(--modal-border);border-radius:var(--modal-border-radius);width:calc(100% - 2rem);max-width:480px;max-height:80vh;box-shadow:var(--modal-shadow-lg);opacity:0;outline:none;flex-direction:column;transition:height .15s ease-out,background-color .2s,border-color .2s;display:flex;position:fixed;top:50%;left:50%;overflow:visible;transform:translate(-50%,-50%)}.modal-dialog.modal-positioned{opacity:1;transform:none}.modal-dialog.modal-centered{opacity:1}.modal-dialog.modal-awaiting-restore{pointer-events:none;opacity:0!important}.modal-dialog.modal-dragging{opacity:.9;user-select:none;transition:none}.modal-dialog.modal-resizing{user-select:none;transition:none}.modal-dialog.modal-animating-to-center{transition:left .2s ease-out,top .2s ease-out}.modal-dialog.modal-animating-position{transition:left var(--modal-parent-animation-duration)ease-out,top var(--modal-parent-animation-duration)ease-out}.modal-dialog.modal-solid{background:var(--modal-bg)}.modal-dialog.modal-transparent{background:var(--modal-bg-transparent);opacity:.4}.modal-dialog.modal-minimizing{pointer-events:none;animation:modal-genie-minimize var(--modal-animation-duration-minimize)ease-in forwards;transform-origin:var(--genie-origin-x,50%)var(--genie-origin-y,100%);will-change:transform,opacity;backface-visibility:hidden}.modal-dialog.modal-restoring{pointer-events:none;animation:modal-genie-restore var(--modal-animation-duration-restore)ease-out forwards;transform-origin:var(--genie-origin-x,50%)var(--genie-origin-y,100%);will-change:transform,opacity;backface-visibility:hidden}.modal-dialog.modal-opening{pointer-events:none;animation:modal-genie-restore var(--modal-animation-duration-open)ease-out forwards;transform-origin:var(--genie-origin-x,50%)var(--genie-origin-y,50%);will-change:transform,opacity;backface-visibility:hidden}.modal-dialog.modal-closing{pointer-events:none;animation:modal-close var(--modal-animation-duration-close)ease-in forwards;will-change:transform,opacity;backface-visibility:hidden}.modal-dialog.modal-closing:not(.modal-positioned){animation-name:modal-close-centered}.modal-dialog.modal-positioned.modal-minimizing,.modal-dialog.modal-positioned.modal-closing{transform:unset;opacity:unset}.modal-dialog.modal-positioned.modal-opening,.modal-dialog.modal-positioned.modal-restoring{transform:unset;opacity:1}.modal-dialog.modal-visible-by-animation{opacity:1}.modal-dialog.modal-attention{animation:.5s cubic-bezier(.36,.07,.19,.97) both modal-shake-positioned,.6s ease-out both modal-attention-glow}.modal-dialog.modal-attention:not(.modal-positioned){animation:.5s cubic-bezier(.36,.07,.19,.97) both modal-shake-centered,.6s ease-out both modal-attention-glow}.modal-dialog.modal-attention.modal-glow{--modal-attention-color:var(--modal-glow-color)}.modal-dialog.modal-glow{border-color:rgb(var(--modal-glow-color));animation:2s ease-in-out infinite modal-glow-medium}.modal-dialog.modal-glow.modal-glow-low{animation-name:modal-glow-low}.modal-dialog.modal-glow.modal-glow-high{animation-name:modal-glow-high}.modal-dialog.modal-glow.modal-minimizing{animation:modal-genie-minimize var(--modal-animation-duration-minimize)ease-in forwards}.modal-dialog.modal-glow.modal-restoring{animation:modal-genie-restore var(--modal-animation-duration-restore)ease-out forwards}.modal-dialog.modal-glow.modal-opening{animation:modal-genie-restore var(--modal-animation-duration-open)ease-out forwards}.modal-dialog.modal-glow.modal-closing{animation:modal-close var(--modal-animation-duration-close)ease-in forwards}.modal-header{padding:var(--modal-header-padding);border-bottom:1px solid var(--modal-header-border);z-index:101;outline:none;flex-shrink:0;align-items:center;gap:.75rem;display:flex;position:relative;overflow:visible}.modal-header.modal-header-draggable{cursor:grab;user-select:none;touch-action:none}.modal-header.modal-header-draggable:active{cursor:grabbing}.modal-header-traffic-lights{gap:var(--modal-btn-gap);z-index:100;flex-shrink:0;display:flex;position:relative}.modal-header-traffic-lights .modal-header-light{width:var(--modal-btn-size);height:var(--modal-btn-size);cursor:pointer;border:none;border-radius:50%;outline:none;flex-shrink:0;padding:0;transition:filter .15s,transform .1s;position:relative}.modal-header-traffic-lights .modal-header-light:before{content:"";opacity:0;justify-content:center;align-items:center;transition:opacity .15s;display:flex;position:absolute;inset:0}.modal-header-traffic-lights .modal-header-light:hover{transform:scale(1.1)}.modal-header-traffic-lights .modal-header-light:hover:before{opacity:1}.modal-header-traffic-lights .modal-header-light:focus-visible{box-shadow:0 0 0 2px #ffffff80,0 0 0 4px #0003}.modal-header-light-close{background:var(--modal-btn-close);box-shadow:inset 0 0 0 .5px #0000001f}.modal-header-light-close:hover{filter:brightness(.92)}.modal-header-traffic-lights .modal-header-light.modal-header-light-close:before{content:"×";color:#4a0002cc;font-size:11px;font-weight:600;line-height:13px}.modal-header-light-minimize{background:var(--modal-btn-minimize);box-shadow:inset 0 0 0 .5px #0000001f}.modal-header-light-minimize:hover{filter:brightness(.92)}.modal-header-traffic-lights .modal-header-light.modal-header-light-minimize:before{content:"−";color:#995700cc;font-size:13px;font-weight:600;line-height:12px}.modal-header-light-style{background:var(--modal-btn-style);box-shadow:inset 0 0 0 .5px #0000001f}.modal-header-light-style:hover{filter:brightness(.92)}.modal-header-traffic-lights .modal-header-light.modal-header-light-style:before{content:"◇";color:#006500cc;font-size:7px;line-height:13px}.modal-header-light.modal-header-light-disabled{opacity:.5;cursor:not-allowed;background:#ccc}.modal-header-light.modal-header-light-disabled:hover{filter:none}.modal-header-traffic-lights .modal-header-light.modal-header-light-disabled:before{opacity:.4}.modal-header-mac-center{pointer-events:none;justify-content:center;align-items:center;gap:.5rem;display:flex;position:absolute;left:0;right:0}.modal-header-mac-center .modal-header-title-group{flex:unset;pointer-events:auto}.modal-header-mac-center .modal-header-icon{pointer-events:auto}.modal-header-mac-spacer{display:none}.modal-header-title-group{flex:1;align-items:center;gap:.5rem;min-width:0;display:flex}.modal-header-title{font-size:var(--modal-title-size);color:var(--modal-title-color);white-space:nowrap;text-overflow:ellipsis;min-width:0;margin:0;overflow:hidden}.modal-header-icon{font-size:var(--modal-icon-size);width:var(--modal-icon-size);height:var(--modal-icon-size);flex-shrink:0;justify-content:center;align-items:center;display:inline-flex;position:relative}.modal-header-icon-badge{font-size:var(--modal-icon-badge-size);background:var(--modal-bg);border-radius:50%;padding:2px;line-height:1;position:absolute;bottom:-6px;right:-8px;box-shadow:0 1px 3px #0003}.modal-header-btn-windows{color:var(--modal-btn-windows-color);cursor:pointer;background:0 0;border:none;border-radius:4px;padding:.25rem;font-size:1.25rem;line-height:1;transition:background-color .15s,color .15s}.modal-header-btn-windows:hover{color:var(--modal-btn-windows-hover-color);background:var(--modal-btn-windows-hover-bg)}.modal-header-btn-windows-style{font-size:.9rem}.modal-header-btn-windows-close{padding:0;font-size:1.5rem}.modal-header-btn-windows.modal-header-btn-windows-disabled{opacity:.35;cursor:not-allowed}.modal-header-btn-windows.modal-header-btn-windows-disabled:hover{color:var(--modal-btn-windows-color);background:0 0}.modal-body{min-height:0;padding:var(--modal-content-padding);color:var(--modal-content-color);flex-direction:column;flex:auto;display:flex;position:relative;overflow-y:auto}.modal-body::-webkit-scrollbar{width:6px}.modal-body::-webkit-scrollbar-track{background:#0000000d}.modal-body::-webkit-scrollbar-thumb{background:#0003;border-radius:3px}.modal-footer{padding:var(--modal-footer-padding);border-top:1px solid var(--modal-footer-border);flex-shrink:0}.modal-footer-empty:empty{display:none}.modal-resize-handle{z-index:10;touch-action:none;position:absolute}.modal-resize-n,.modal-resize-s{height:var(--modal-resize-handle-size);cursor:ns-resize;left:8px;right:8px}.modal-resize-n{top:calc(var(--modal-resize-handle-size)/-2)}.modal-resize-s{bottom:calc(var(--modal-resize-handle-size)/-2)}.modal-resize-e,.modal-resize-w{width:var(--modal-resize-handle-size);cursor:ew-resize;top:8px;bottom:8px}.modal-resize-e{right:calc(var(--modal-resize-handle-size)/-2)}.modal-resize-w{left:calc(var(--modal-resize-handle-size)/-2)}.modal-resize-ne,.modal-resize-nw,.modal-resize-se,.modal-resize-sw{width:var(--modal-resize-corner-size);height:var(--modal-resize-corner-size)}.modal-resize-ne{top:calc(var(--modal-resize-handle-size)/-2);right:calc(var(--modal-resize-handle-size)/-2);cursor:nesw-resize}.modal-resize-nw{top:calc(var(--modal-resize-handle-size)/-2);left:calc(var(--modal-resize-handle-size)/-2);cursor:nwse-resize}.modal-resize-se{bottom:calc(var(--modal-resize-handle-size)/-2);right:calc(var(--modal-resize-handle-size)/-2);cursor:nwse-resize}.modal-resize-sw{bottom:calc(var(--modal-resize-handle-size)/-2);left:calc(var(--modal-resize-handle-size)/-2);cursor:nesw-resize}.modal-child-overlay{background:var(--modal-child-overlay-bg);backdrop-filter:blur(var(--modal-child-overlay-blur));border-radius:inherit;z-index:100;cursor:not-allowed;pointer-events:all;animation:.2s ease-out forwards modal-overlay-fade-in;position:absolute;inset:0}.modal-child-overlay.modal-overlay-closing{pointer-events:none;animation:.2s ease-in forwards modal-overlay-fade-out}.modal-dialog.modal-has-child .modal-header-actions{pointer-events:none;opacity:.5}.modal-dialog.modal-has-child .modal-header-draggable{cursor:not-allowed}.modal-dialog.modal-is-child.modal-positioned:not(.modal-closing):not(.modal-minimizing):not(.modal-restoring){animation:.25s ease-out forwards modal-child-appear}.modal-dialog.modal-is-child.modal-closing{animation:.2s ease-in forwards modal-child-disappear}
1
+ .modal-dialog{background:var(--modal-bg);border:1px solid var(--modal-border);border-radius:var(--modal-border-radius);width:calc(100% - 2rem);max-width:480px;max-height:80vh;box-shadow:var(--modal-shadow-lg);opacity:0;outline:none;flex-direction:column;transition:height .15s ease-out,background-color .2s,border-color .2s;display:flex;position:fixed;top:50%;left:50%;overflow:visible;transform:translate(-50%,-50%)}.modal-dialog.modal-positioned{opacity:1;transform:none}.modal-dialog.modal-centered{opacity:1}.modal-dialog.modal-awaiting-restore{pointer-events:none;opacity:0!important}.modal-dialog.modal-dragging{opacity:.9;user-select:none;transition:none}.modal-dialog.modal-resizing{user-select:none;transition:none}.modal-dialog.modal-animating-to-center{transition:left .2s ease-out,top .2s ease-out}.modal-dialog.modal-animating-position{transition:left var(--modal-parent-animation-duration)ease-out,top var(--modal-parent-animation-duration)ease-out}.modal-dialog.modal-solid{background:var(--modal-bg)}.modal-dialog.modal-transparent{background:var(--modal-bg-transparent);opacity:.4}.modal-dialog.modal-minimizing{pointer-events:none;animation:modal-genie-minimize var(--modal-animation-duration-minimize)ease-in forwards;transform-origin:var(--genie-origin-x,50%)var(--genie-origin-y,100%);will-change:transform,opacity;backface-visibility:hidden}.modal-dialog.modal-restoring{pointer-events:none;animation:modal-genie-restore var(--modal-animation-duration-restore)ease-out forwards;transform-origin:var(--genie-origin-x,50%)var(--genie-origin-y,100%);will-change:transform,opacity;backface-visibility:hidden}.modal-dialog.modal-opening{pointer-events:none;animation:modal-genie-restore var(--modal-animation-duration-open)ease-out forwards;transform-origin:var(--genie-origin-x,50%)var(--genie-origin-y,50%);will-change:transform,opacity;backface-visibility:hidden}.modal-dialog.modal-closing{pointer-events:none;animation:modal-close var(--modal-animation-duration-close)ease-in forwards;will-change:transform,opacity;backface-visibility:hidden}.modal-dialog.modal-closing:not(.modal-positioned){animation-name:modal-close-centered}.modal-dialog.modal-positioned.modal-minimizing,.modal-dialog.modal-positioned.modal-closing{transform:unset;opacity:unset}.modal-dialog.modal-positioned.modal-opening,.modal-dialog.modal-positioned.modal-restoring{transform:unset;opacity:1}.modal-dialog.modal-visible-by-animation{opacity:1}.modal-dialog.modal-attention{animation:.5s cubic-bezier(.36,.07,.19,.97) both modal-shake-positioned,.6s ease-out both modal-attention-glow}.modal-dialog.modal-attention:not(.modal-positioned){animation:.5s cubic-bezier(.36,.07,.19,.97) both modal-shake-centered,.6s ease-out both modal-attention-glow}.modal-dialog.modal-attention.modal-glow{--modal-attention-color:var(--modal-glow-color)}.modal-dialog.modal-glow{border-color:rgb(var(--modal-glow-color));animation:2s ease-in-out infinite modal-glow-medium}.modal-dialog.modal-glow.modal-glow-low{animation-name:modal-glow-low}.modal-dialog.modal-glow.modal-glow-high{animation-name:modal-glow-high}.modal-dialog.modal-glow.modal-minimizing{animation:modal-genie-minimize var(--modal-animation-duration-minimize)ease-in forwards}.modal-dialog.modal-glow.modal-restoring{animation:modal-genie-restore var(--modal-animation-duration-restore)ease-out forwards}.modal-dialog.modal-glow.modal-opening{animation:modal-genie-restore var(--modal-animation-duration-open)ease-out forwards}.modal-dialog.modal-glow.modal-closing{animation:modal-close var(--modal-animation-duration-close)ease-in forwards}.modal-header{padding:var(--modal-header-padding);border-bottom:1px solid var(--modal-header-border);outline:none;flex-shrink:0;align-items:center;gap:.75rem;display:flex;position:relative;overflow:visible}.modal-header.modal-header-draggable{cursor:grab;user-select:none;touch-action:none}.modal-header.modal-header-draggable:active{cursor:grabbing}.modal-header-traffic-lights{gap:var(--modal-btn-gap);z-index:100;flex-shrink:0;display:flex;position:relative}.modal-header-traffic-lights .modal-header-light{width:var(--modal-btn-size);height:var(--modal-btn-size);cursor:pointer;border:none;border-radius:50%;outline:none;flex-shrink:0;padding:0;transition:filter .15s,transform .1s;position:relative}.modal-header-traffic-lights .modal-header-light:before{content:"";opacity:0;justify-content:center;align-items:center;transition:opacity .15s;display:flex;position:absolute;inset:0}.modal-header-traffic-lights .modal-header-light:hover{transform:scale(1.1)}.modal-header-traffic-lights .modal-header-light:hover:before{opacity:1}.modal-header-traffic-lights .modal-header-light:focus-visible{box-shadow:0 0 0 2px #ffffff80,0 0 0 4px #0003}.modal-header-light-close{background:var(--modal-btn-close);box-shadow:inset 0 0 0 .5px #0000001f}.modal-header-light-close:hover{filter:brightness(.92)}.modal-header-traffic-lights .modal-header-light.modal-header-light-close:before{content:"×";color:#4a0002cc;font-size:11px;font-weight:600;line-height:13px}.modal-header-light-minimize{background:var(--modal-btn-minimize);box-shadow:inset 0 0 0 .5px #0000001f}.modal-header-light-minimize:hover{filter:brightness(.92)}.modal-header-traffic-lights .modal-header-light.modal-header-light-minimize:before{content:"−";color:#995700cc;font-size:13px;font-weight:600;line-height:12px}.modal-header-light-style{background:var(--modal-btn-style);box-shadow:inset 0 0 0 .5px #0000001f}.modal-header-light-style:hover{filter:brightness(.92)}.modal-header-traffic-lights .modal-header-light.modal-header-light-style:before{content:"◇";color:#006500cc;font-size:7px;line-height:13px}.modal-header-light.modal-header-light-disabled{opacity:.5;cursor:not-allowed;background:#ccc}.modal-header-light.modal-header-light-disabled:hover{filter:none}.modal-header-traffic-lights .modal-header-light.modal-header-light-disabled:before{opacity:.4}.modal-header-mac-center{pointer-events:none;justify-content:center;align-items:center;gap:.5rem;display:flex;position:absolute;left:0;right:0}.modal-header-mac-center .modal-header-title-group{flex:unset;pointer-events:auto}.modal-header-mac-center .modal-header-icon{pointer-events:auto}.modal-header-mac-spacer{display:none}.modal-header-title-group{flex:1;align-items:center;gap:.5rem;min-width:0;display:flex}.modal-header-title{font-size:var(--modal-title-size);color:var(--modal-title-color);white-space:nowrap;text-overflow:ellipsis;min-width:0;margin:0;overflow:hidden}.modal-header-icon{font-size:var(--modal-icon-size);width:var(--modal-icon-size);height:var(--modal-icon-size);flex-shrink:0;justify-content:center;align-items:center;display:inline-flex;position:relative}.modal-header-icon-badge{font-size:var(--modal-icon-badge-size);background:var(--modal-bg);border-radius:50%;padding:2px;line-height:1;position:absolute;bottom:-6px;right:-8px;box-shadow:0 1px 3px #0003}.modal-header-btn-windows{color:var(--modal-btn-windows-color);cursor:pointer;background:0 0;border:none;border-radius:4px;padding:.25rem;font-size:1.25rem;line-height:1;transition:background-color .15s,color .15s}.modal-header-btn-windows:hover{color:var(--modal-btn-windows-hover-color);background:var(--modal-btn-windows-hover-bg)}.modal-header-btn-windows-style{font-size:.9rem}.modal-header-btn-windows-close{padding:0;font-size:1.5rem}.modal-header-btn-windows.modal-header-btn-windows-disabled{opacity:.35;cursor:not-allowed}.modal-header-btn-windows.modal-header-btn-windows-disabled:hover{color:var(--modal-btn-windows-color);background:0 0}.modal-body{min-height:0;padding:var(--modal-content-padding);color:var(--modal-content-color);flex-direction:column;flex:auto;display:flex;position:relative;overflow-y:auto}.modal-body::-webkit-scrollbar{width:6px}.modal-body::-webkit-scrollbar-track{background:#0000000d}.modal-body::-webkit-scrollbar-thumb{background:#0003;border-radius:3px}.modal-footer{padding:var(--modal-footer-padding);border-top:1px solid var(--modal-footer-border);flex-shrink:0}.modal-footer-empty:empty{display:none}.modal-resize-handle{z-index:10;touch-action:none;position:absolute}.modal-resize-n,.modal-resize-s{height:var(--modal-resize-handle-size);cursor:ns-resize;left:8px;right:8px}.modal-resize-n{top:calc(var(--modal-resize-handle-size)/-2)}.modal-resize-s{bottom:calc(var(--modal-resize-handle-size)/-2)}.modal-resize-e,.modal-resize-w{width:var(--modal-resize-handle-size);cursor:ew-resize;top:8px;bottom:8px}.modal-resize-e{right:calc(var(--modal-resize-handle-size)/-2)}.modal-resize-w{left:calc(var(--modal-resize-handle-size)/-2)}.modal-resize-ne,.modal-resize-nw,.modal-resize-se,.modal-resize-sw{width:var(--modal-resize-corner-size);height:var(--modal-resize-corner-size)}.modal-resize-ne{top:calc(var(--modal-resize-handle-size)/-2);right:calc(var(--modal-resize-handle-size)/-2);cursor:nesw-resize}.modal-resize-nw{top:calc(var(--modal-resize-handle-size)/-2);left:calc(var(--modal-resize-handle-size)/-2);cursor:nwse-resize}.modal-resize-se{bottom:calc(var(--modal-resize-handle-size)/-2);right:calc(var(--modal-resize-handle-size)/-2);cursor:nwse-resize}.modal-resize-sw{bottom:calc(var(--modal-resize-handle-size)/-2);left:calc(var(--modal-resize-handle-size)/-2);cursor:nesw-resize}.modal-child-overlay{background:var(--modal-child-overlay-bg);backdrop-filter:blur(var(--modal-child-overlay-blur));border-radius:inherit;z-index:100;cursor:not-allowed;pointer-events:all;animation:.2s ease-out forwards modal-overlay-fade-in;position:absolute;inset:0}.modal-child-overlay.modal-overlay-closing{pointer-events:none;animation:.2s ease-in forwards modal-overlay-fade-out}.modal-dialog.modal-has-child .modal-header-actions{pointer-events:none;opacity:.5}.modal-dialog.modal-has-child .modal-header-draggable{cursor:not-allowed}.modal-dialog.modal-is-child.modal-positioned:not(.modal-closing):not(.modal-minimizing):not(.modal-restoring){animation:.25s ease-out forwards modal-child-appear}.modal-dialog.modal-is-child.modal-closing{animation:.2s ease-in forwards modal-child-disappear}
@@ -1 +1 @@
1
- :root{--modal-bg:#fff;--modal-bg-transparent:#ffffffd9;--modal-border:#0000001a;--modal-title-color:#1a1a1a;--modal-content-color:#333;--modal-header-border:#00000014;--modal-footer-border:#00000014;--modal-dock-bg:linear-gradient(to bottom,#f8f9fa,#f0f1f3);--modal-dock-border:#0000001a;--modal-dock-label-color:#333;--modal-btn-windows-color:#666;--modal-btn-windows-hover-bg:#0000000d;--modal-btn-windows-hover-color:#1a1a1a}
1
+ :root{--modal-bg:linear-gradient(165deg,#fff 0%,#fafbfc 50%,#f5f7f9 100%);--modal-bg-transparent:#ffffffeb;--modal-border:#0000001f;--modal-title-color:#0f172a;--modal-content-color:#334155;--modal-header-border:#0000000f;--modal-footer-border:#0000000f;--modal-shadow:0 0 0 1px #0000000a,0 4px 6px -1px #00000014,0 10px 20px -5px #0000001a,0 25px 50px -12px #00000026;--modal-shadow-lg:0 0 0 1px #00000008,0 8px 16px -4px #0000001a,0 20px 40px -8px #0000001f,0 40px 80px -16px #00000014;--modal-dock-bg:linear-gradient(180deg,#fffffff2 0%,#f8fafceb 100%);--modal-dock-border:#00000014;--modal-dock-shadow:0 -1px 0 0 #fffc,0 4px 12px -2px #0000001f,0 8px 24px -4px #00000014;--modal-dock-label-color:#475569;--modal-dock-item-bg:linear-gradient(145deg,#fffc,#f1f5f999);--modal-dock-item-border:#0000000f;--modal-dock-item-shadow:0 1px 3px #0000000f,inset 0 1px 0 #fffc;--modal-dock-item-hover-bg:linear-gradient(145deg,#fff,#f1f5f9);--modal-dock-item-hover-border:#0000001f;--modal-dock-item-hover-shadow:0 4px 12px #0000001a,0 2px 4px #0000000f,inset 0 1px 0 #fff;--modal-dock-handle-bg:linear-gradient(145deg,#fff9,#f1f5f966);--modal-dock-handle-border:#0000000f;--modal-dock-handle-dots:#00000040;--modal-btn-windows-color:#64748b;--modal-btn-windows-hover-bg:#0000000f;--modal-btn-windows-hover-color:#0f172a;--modal-attention-color:251,146,60;--modal-backdrop-bg:#0f172a33;--modal-backdrop-blur:4px;--modal-child-overlay-bg:#fff9;--modal-child-overlay-blur:2px}
@@ -1 +1 @@
1
- :root{--modal-bg:#fff;--modal-bg-transparent:#ffffffd9;--modal-border:#0000001a;--modal-border-radius:12px;--modal-shadow:0 25px 50px -12px #00000040;--modal-shadow-lg:0 10px 15px -3px #0000001a,0 4px 6px -2px #0000000d;--modal-header-bg:transparent;--modal-header-border:#00000014;--modal-header-height:48px;--modal-header-padding:.875rem 1.25rem;--modal-title-color:#1a1a1a;--modal-title-size:1rem;--modal-btn-close:#ff5f57;--modal-btn-minimize:#febc2e;--modal-btn-style:#28c840;--modal-btn-size:13px;--modal-btn-gap:7px;--modal-btn-windows-color:#666;--modal-btn-windows-hover-bg:#0000000d;--modal-btn-windows-hover-color:#1a1a1a;--modal-content-padding:0;--modal-content-color:#333;--modal-footer-bg:transparent;--modal-footer-border:#00000014;--modal-footer-padding:1rem 1.25rem;--modal-backdrop-bg:#0000004d;--modal-backdrop-blur:2px;--modal-dock-bg:linear-gradient(to bottom,#f8f9fa,#f0f1f3);--modal-dock-border:#0000001a;--modal-dock-shadow:0 4px 6px -1px #0000001a;--modal-dock-padding:.5rem .625rem;--modal-dock-gap:.5rem;--modal-dock-border-radius:14px;--modal-dock-item-size:44px;--modal-dock-item-bg:linear-gradient(145deg,#00000005,transparent);--modal-dock-item-border:#00000014;--modal-dock-item-shadow:none;--modal-dock-item-hover-bg:linear-gradient(145deg,#0000000d,#00000005);--modal-dock-item-hover-border:#00000026;--modal-dock-item-hover-shadow:0 6px 16px #00000026,0 2px 6px #0000001a;--modal-dock-item-border-radius:10px;--modal-dock-label-color:#333;--modal-dock-label-size:.65rem;--modal-dock-handle-bg:linear-gradient(145deg,#00000005,transparent);--modal-dock-handle-border:#00000014;--modal-dock-handle-dots:#0000004d;--modal-animation-duration-open:.4s;--modal-animation-duration-close:.25s;--modal-animation-duration-minimize:.5s;--modal-animation-duration-restore:.4s;--modal-animation-easing:cubic-bezier(.4,0,.2,1);--modal-parent-animation-duration:.3s;--modal-resize-handle-size:12px;--modal-resize-corner-size:20px;--modal-glow-color:126,200,191;--modal-attention-color:255,180,100;--modal-attention-duration:.6s;--modal-child-overlay-bg:#00000040;--modal-child-overlay-blur:1px;--modal-icon-size:1.5rem;--modal-icon-badge-size:.85rem}
1
+ :root{--modal-bg:linear-gradient(165deg,#fff 0%,#fafbfc 50%,#f5f7f9 100%);--modal-bg-transparent:#ffffffeb;--modal-border:#0000001f;--modal-border-radius:12px;--modal-shadow:0 0 0 1px #0000000a,0 4px 6px -1px #00000014,0 10px 20px -5px #0000001a,0 25px 50px -12px #00000026;--modal-shadow-lg:0 0 0 1px #00000008,0 8px 16px -4px #0000001a,0 20px 40px -8px #0000001f,0 40px 80px -16px #00000014;--modal-header-bg:transparent;--modal-header-border:#00000014;--modal-header-height:48px;--modal-header-padding:.875rem 1.25rem;--modal-title-color:#0f172a;--modal-title-size:1rem;--modal-btn-close:#ff5f57;--modal-btn-minimize:#febc2e;--modal-btn-style:#28c840;--modal-btn-size:13px;--modal-btn-gap:7px;--modal-btn-windows-color:#666;--modal-btn-windows-hover-bg:#0000000d;--modal-btn-windows-hover-color:#1a1a1a;--modal-content-padding:0;--modal-content-color:#334155;--modal-footer-bg:transparent;--modal-footer-border:#00000014;--modal-footer-padding:1rem 1.25rem;--modal-backdrop-bg:#0000004d;--modal-backdrop-blur:2px;--modal-dock-bg:linear-gradient(180deg,#fffffff2 0%,#f8fafceb 100%);--modal-dock-border:#00000014;--modal-dock-shadow:0 -1px 0 0 #fffc,0 4px 12px -2px #0000001f,0 8px 24px -4px #00000014;--modal-dock-padding:.5rem .625rem;--modal-dock-gap:.5rem;--modal-dock-border-radius:14px;--modal-dock-item-size:44px;--modal-dock-item-bg:linear-gradient(145deg,#fffc,#f1f5f999);--modal-dock-item-border:#0000000f;--modal-dock-item-shadow:0 1px 3px #0000000f,inset 0 1px 0 #fffc;--modal-dock-item-hover-bg:linear-gradient(145deg,#fff,#f1f5f9);--modal-dock-item-hover-border:#0000001f;--modal-dock-item-hover-shadow:0 4px 12px #0000001a,0 2px 4px #0000000f,inset 0 1px 0 #fff;--modal-dock-item-border-radius:10px;--modal-dock-label-color:#475569;--modal-dock-label-size:.65rem;--modal-dock-handle-bg:linear-gradient(145deg,#fff9,#f1f5f966);--modal-dock-handle-border:#0000000f;--modal-dock-handle-dots:#00000040;--modal-animation-duration-open:.4s;--modal-animation-duration-close:.25s;--modal-animation-duration-minimize:.5s;--modal-animation-duration-restore:.4s;--modal-animation-easing:cubic-bezier(.4,0,.2,1);--modal-parent-animation-duration:.3s;--modal-resize-handle-size:12px;--modal-resize-corner-size:20px;--modal-glow-color:126,200,191;--modal-attention-color:255,180,100;--modal-attention-duration:.6s;--modal-child-overlay-bg:#00000040;--modal-child-overlay-blur:1px;--modal-icon-size:1.5rem;--modal-icon-badge-size:.85rem}
@@ -0,0 +1 @@
1
+ export { SvelteComponent as default } from 'svelte';
@@ -0,0 +1 @@
1
+ export { SvelteComponent as default } from 'svelte';
@@ -0,0 +1 @@
1
+ export { SvelteComponent as default } from 'svelte';
@@ -0,0 +1 @@
1
+ export { SvelteComponent as default } from 'svelte';
@@ -0,0 +1 @@
1
+ export { SvelteComponent as default } from 'svelte';
@@ -0,0 +1 @@
1
+ export { SvelteComponent as default } from 'svelte';
@@ -0,0 +1 @@
1
+ export { SvelteComponent as default } from 'svelte';
@@ -0,0 +1 @@
1
+ export { SvelteComponent as default } from 'svelte';
package/dist/svelte.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- export * from './core';
2
1
  export { default as Modal } from './svelte/Modal.svelte';
3
2
  export { default as Dock } from './svelte/Dock.svelte';
4
3
  export { default as Backdrop } from './svelte/Backdrop.svelte';
package/dist/svelte.js CHANGED
@@ -1 +1 @@
1
- import*as e from"svelte/internal/client";import"svelte/internal/disclose-version";import{getContext as t,onMount as n,setContext as i,tick as o,onDestroy as r,untrack as s}from"svelte";import{scale as d,fly as a,fade as l}from"svelte/transition";import{cubicOut as c,backOut as g}from"svelte/easing";const u={BASE:0,DROPDOWN:100,STICKY:200,OVERLAY:300,MODAL:400,DOCK:8e3,TOAST:9e3};let h=e.state(e.proxy(u.MODAL));function p(){e.set(h,mt().zIndex.base,!0)}function f(){const t=e.get(h);return e.set(h,e.get(h)+2),t}function m(e){const t=mt();return"MODAL"===e?t.zIndex.base:"DOCK"===e?t.zIndex.dock:"TOAST"===e?t.zIndex.toast:u[e]}function v(){e.set(h,mt().zIndex.base,!0)}const y=8;function w(e,t,n,i,o={}){const{margin:r=y,allowPartialVisibility:s=!1}=o,d="undefined"!=typeof window?window.innerWidth:1920,a="undefined"!=typeof window?window.innerHeight:1080;let l,c,g,u;return s&&n>d-2*r?(l=40-n,c=d-40):(l=r,c=Math.max(r,d-n-r)),s&&i>a-2*r?(g=40-i,u=a-40):(g=r,u=Math.max(r,a-i-r)),{x:Math.max(l,Math.min(c,e)),y:Math.max(g,Math.min(u,t))}}function x(e,t,n,i,o={}){const{margin:r=y}=o,s=("undefined"!=typeof window?window.innerWidth:1920)-2*r,d=("undefined"!=typeof window?window.innerHeight:1080)-2*r,a=Math.min(n,s),l=Math.min(i,d),c=w(e,t,a,l,o);return{x:c.x,y:c.y,width:a,height:l}}function z(e,t){return Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x))*Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y))}function I(e,t,n,i,o,r){const s={x:e-r,y:t-r,width:n+2*r,height:i+2*r};let d=0;for(const e of o)d+=z(s,e);return d}function b(e){if("undefined"==typeof document)return[];const t=[];for(const n of e)try{const e=document.querySelectorAll(n);for(const n of e){const e=n.getBoundingClientRect();e.width>0&&e.height>0&&t.push({x:e.left,y:e.top,width:e.width,height:e.height})}}catch{}return t}function _(e,t,n,i,o,r,s){const d=(o-n)/2,a=(r-i)/2,l=d-s,c=a-s,g=Math.abs(e-d)/(l||1),u=Math.abs(t-a)/(c||1),h=Math.sqrt(g*g+u*u)/Math.SQRT2,p=50,f=e-s,m=o-n-s-e,v=t-s,y=r-i-s-t;let w=0;return f<p&&(w+=.3*(1-f/p)),m<p&&(w+=.3*(1-m/p)),v<p&&(w+=.2*(1-v/p)),y<p&&(w+=.2*(1-y/p)),Math.min(1,h+w)}function M(e,t,n,i={}){const{modalGap:o=16,gridResolution:r=10,avoidBounds:s=[],avoidMargin:d=16}=i,a=i.margin??o,l="undefined"!=typeof window?window.innerWidth:1920,c="undefined"!=typeof window?window.innerHeight:1080,g=s.map(e=>({x:e.x-d,y:e.y-d,width:e.width+2*d,height:e.height+2*d})),u={x:(l-e)/2,y:(c-t)/2};if(0===n.length&&0===g.length)return u;const h=a,p=Math.max(a,l-e-a),f=a,m=Math.max(a,c-t-a);if(p<=h||m<=f)return u;const v=I(u.x,u.y,e,t,n,o),y=I(u.x,u.y,e,t,g,0);if(0===v&&0===y)return u;const w=[],x=(p-h)/r,z=(m-f)/r;for(let i=0;i<=r;i++)for(let s=0;s<=r;s++){const r=h+i*x,d=f+s*z,u=I(r,d,e,t,n,o),p=I(r,d,e,t,g,0),m=_(r,d,e,t,l,c,a);w.push({pos:{x:r,y:d},modalOverlap:u,avoidOverlap:p,centerDist:m})}const b=w.filter(e=>0===e.avoidOverlap),M=b.length>0?b:w,k=e*t,D=Math.min(...M.map(e=>e.modalOverlap))/k;return M.sort((e,t)=>{if(0===b.length&&e.avoidOverlap!==t.avoidOverlap)return e.avoidOverlap-t.avoidOverlap;const n=e.modalOverlap/k,i=t.modalOverlap/k;if(D<.3){const o=.3,r=n<=o,s=i<=o;if(r&&s)return e.centerDist+.3*n-(t.centerDist+.3*i);if(r)return-1;if(s)return 1}return.6*n+.4*e.centerDist-(.6*i+.4*t.centerDist)}),M[0].pos}function k(e,t,n,i={}){const{modalGap:o=16}=i,r=i.margin??o,s="undefined"!=typeof window?window.innerWidth:1920,d="undefined"!=typeof window?window.innerHeight:1080,a=n.reduce((e,t)=>e+t.width,0)+e,l=n.length*o,c=s-2*r;if(a+l>c)return null;const g=c-a-l;n.length;const u=g/2,h=s/2,p=[...n.map(e=>({id:e.id,width:e.width,height:e.height,currentX:e.x+e.width/2,currentY:e.y,isNew:!1})),{id:"__new__",width:e,height:t,currentX:h,currentY:(d-t)/2,isNew:!0}];p.sort((e,t)=>e.currentX-t.currentX);let f=r+u;const m=new Map;let v=null;for(const e of p){const t=f;if(e.isNew)v={x:Math.round(t),y:Math.round(e.currentY)};else{const i=n.find(t=>t.id===e.id);Math.abs(t-i.x)>5&&m.set(e.id,{x:Math.round(t),y:Math.round(i.y)})}f+=e.width+o}return v?{newModalPosition:v,existingModalMoves:m}:null}function D(e){return"symbol"==typeof e?e.description??"symbol":e}let P=e.proxy(new Map),C=e.state(0);const B=new Set;function O(){e.update(C),queueMicrotask(()=>{B.forEach(e=>e())})}function T(e){return B.add(e),()=>B.delete(e)}let R=e.state(e.proxy([])),E=e.state(e.proxy([])),H=e.state(e.proxy([])),S=e.state(e.proxy([])),L=e.state(e.proxy([])),F=e.state(e.proxy([])),W=e.state(e.proxy([])),A=e.state(e.proxy([])),$=e.state(null),X=e.proxy(new Map),Y=e.state(null),q=e.proxy(new Map),N=e.proxy(new Set),j=e.proxy(new Set),G=e.state(e.proxy([])),K=null,V=null;function U(t){const n=P.get(t.id),i=(null==n?void 0:n.zIndex)??f();n?P.set(t.id,{...n,title:t.title,icon:t.icon,glow:t.glow,zIndex:i}):P.set(t.id,{...t,zIndex:i,isAnimating:!1}),O(),t.isMinimized&&!e.get(G).includes(t.id)&&e.get(G).push(t.id)}function Q(t){const n=P.get(t);if(n){if(e.set(G,e.get(G).filter(e=>e!==t),!0),n.childId){const e=P.get(n.childId);e&&P.set(n.childId,{...e,parentId:void 0})}if(n.parentId){const e=P.get(n.parentId);e&&P.set(n.parentId,{...e,childId:void 0,lastChildId:n.id})}P.delete(t),O(),j.delete(t),N.delete(t)}}function Z(t){const n=P.get(t);if(!n||n.isMinimized)return;if(ot(t),n.parentId){const e=P.get(n.parentId);if(e&&!e.isMinimized)return void Z(n.parentId)}if(e.set(R,[...e.get(R),t],!0),n.position&&n.size&&V){const i=V(),o=e.get(G).indexOf(t),r=i.x+o*(i.height+8),s=i.y;e.set($,{x:r,y:s,originX:n.position.x+n.size.width/2,originY:n.position.y+n.size.height/2},!0)}const i=n.childId;P.set(t,{...n,isMinimized:!0,lastChildId:i}),O(),e.get(G).includes(t)||e.get(G).push(t),n.childId&&me(t)}function J(t){const n=P.get(t);if(!n||!n.isMinimized)return;P.set(t,{...n,isMinimized:!1,isOpen:!0}),O(),e.set(L,[...e.get(L),t],!0),re(t);const i=n.lastChildId||n.childId;i&&te(i)}function ee(){Array.from(P.values()).filter(e=>e.isMinimized).map(e=>e.id).forEach(t=>{const n=P.get(t);if(n){P.set(t,{...n,isMinimized:!1,isOpen:!0}),e.set(L,[...e.get(L),t],!0),re(t);const i=n.lastChildId||n.childId;i&&te(i)}}),e.set(G,[],!0),O()}function te(t){const n=P.get(t);n&&n.isHiddenWithParent&&(P.set(t,{...n,isHiddenWithParent:!1}),O(),e.set(F,[...e.get(F),t],!0))}function ne(e,t,n){const i=P.get(e);if(!i)return;let o=t;if((null==n?void 0:n.constrain)&&i.size&&(o=w(t.x,t.y,i.size.width,i.size.height)),P.set(e,{...i,position:o,size:(null==n?void 0:n.size)??i.size,hasBeenDragged:i.hasBeenDragged||(null==n?void 0:n.drag)||!1}),i.childId){let t=e,n=o;for(;;){const e=P.get(t);if(!(null==e?void 0:e.childId))break;const i=P.get(e.childId);if(!(null==i?void 0:i.offsetFromParent))break;const o={x:n.x+i.offsetFromParent.x,y:n.y+i.offsetFromParent.y};P.set(e.childId,{...i,position:o,hasBeenDragged:!0}),t=e.childId,n=o}}if(i.parentId&&i.offsetFromParent){const t=mt();let n=e,r=i;for(;r.parentId&&r.offsetFromParent;){const i=P.get(r.parentId);if(!i)break;const s=n===e?o:P.get(n).position,d={x:s.x-r.offsetFromParent.x,y:s.y-r.offsetFromParent.y};"animated"===t.parentChild.movementMode?q.set(r.parentId,d):P.set(r.parentId,{...i,position:d,hasBeenDragged:!0}),n=r.parentId,r=i}}O()}function ie(e,t){const n=P.get(e);n&&(P.set(e,{...n,size:t}),O())}function oe(e,t){const n=P.get(e);n&&(P.set(e,{...n,...t}),O())}function re(e){var t;const n=P.get(e);if(!n)return;const i=Math.max(...Array.from(P.values()).map(e=>e.zIndex),0);if(n.parentId){const o=P.get(n.parentId);o&&o.zIndex<i&&P.set(n.parentId,{...o,zIndex:i+2});const r=(null==(t=P.get(n.parentId))?void 0:t.zIndex)??i+2;return n.zIndex<=r&&P.set(e,{...n,zIndex:r+2}),void O()}if(n.zIndex<i&&(P.set(e,{...n,zIndex:i+2}),O()),n.childId){const t=P.get(n.childId),i=P.get(e);t&&i&&t.zIndex<=i.zIndex&&(P.set(n.childId,{...t,zIndex:i.zIndex+2}),O())}}function se(e){const t=P.get(e);if(!t)return!1;const n=Math.max(...Array.from(P.values()).map(e=>e.zIndex),0);return t.zIndex===n&&!t.isMinimized&&!t.isHiddenWithParent}function de(t){e.set(G,t,!0)}function ae(t,n,i){const o=n.getBoundingClientRect();X.set(t,{x:o.left+o.width/2,y:o.top+o.height/2});const r=mt();(null==i?void 0:i.parentId)&&r.features.parentChild&&e.set(Y,{parentId:i.parentId,childId:t},!0),e.get(E).includes(t)||e.set(E,[...e.get(E),t],!0),O();const s=P.get(t);if(s){if(s.isOpen&&!s.isMinimized&&!s.isHiddenWithParent)return e.set(E,e.get(E).filter(e=>e!==t),!0),Ae(t),void re(t);if(s.isMinimized)return e.set(E,e.get(E).filter(e=>e!==t),!0),void J(t);P.set(t,{...s,isOpen:!0}),re(t),null==K||K.push(t)}}function le(t){U(t);const n=P.get(t.id);n&&(P.set(t.id,{...n,isOpen:!0}),O()),e.set(E,[...e.get(E),t.id],!0),O(),re(t.id),null==K||K.push(t.id)}function ce(t,n=!1){const i=P.get(t);i&&(ot(t),n?e.set(S,[...e.get(S),t],!0):e.set(H,[...e.get(H),t],!0),O(),i.childId&&ce(i.childId,n),null==K||K.pop())}function ge(){Array.from(P.keys()).forEach(e=>ce(e,!0))}function ue(e){const t=P.get(e);if(t){if(t.parentId){const n=P.get(t.parentId);n&&n.childId===e&&P.set(t.parentId,{...n,childId:void 0,lastChildId:e})}P.set(e,{...t,isOpen:!1,isMinimized:!1,isHiddenWithParent:!1,isTransparent:!1,position:null,size:null,hasBeenDragged:!1,parentId:void 0,childId:void 0,offsetFromParent:void 0}),O()}}function he(e){const t=P.get(e);if(!t)return[e];const n=[e];return t.childId&&n.push(...he(t.childId)),n}function pe(t,n,i){const o=mt();if(i&&!X.has(t.id)){const e=i.getBoundingClientRect();X.set(t.id,{x:e.left+e.width/2,y:e.top+e.height/2})}const r={id:t.id,title:t.title??"",icon:t.icon??"",isOpen:!0,isMinimized:!1,isHiddenWithParent:!1,isTransparent:t.isTransparent??!1,isRejected:!1,position:t.position??null,size:t.size??null,hasBeenDragged:t.hasBeenDragged??!1,dockPosition:t.dockPosition??-1,glow:t.glow??null};if(!o.features.parentChild){U(r);const n=P.get(t.id);return n&&P.set(t.id,{...n,isOpen:!0}),e.set(E,[...e.get(E),t.id],!0),O(),void re(t.id)}const s=P.get(n);if(!s)return;s.childId&&ce(s.childId,!0),U({...r,parentId:n});const d=P.get(t.id);d&&P.set(t.id,{...d,isOpen:!0,parentId:n}),e.set(E,[...e.get(E),t.id],!0),O(),re(t.id),e.set(Y,{parentId:n,childId:t.id},!0)}function fe(e,t){if(!mt().features.parentChild)return;const n=P.get(e),i=P.get(t);if(!n||!i)return;let o={x:40,y:40};n.position&&i.position&&(o={x:i.position.x-n.position.x,y:i.position.y-n.position.y});const r=Math.max(i.zIndex,n.zIndex+1);P.set(e,{...n,childId:t,lastChildId:t}),P.set(t,{...i,parentId:e,offsetFromParent:o,zIndex:r}),O()}function me(e){const t=P.get(e);if(!(null==t?void 0:t.childId))return;const n=P.get(t.childId);n&&(P.set(t.childId,{...n,isHiddenWithParent:!0}),O())}function ve(e,t){const n=P.get(e);if(!(null==n?void 0:n.childId))return;const i=P.get(n.childId);if(!i||!i.offsetFromParent)return;const o={x:t.x+i.offsetFromParent.x,y:t.y+i.offsetFromParent.y};P.set(n.childId,{...i,position:o}),O()}function ye(e,t){const n=P.get(e),i=P.get(t);if(!(null==n?void 0:n.position)||!(null==i?void 0:i.position))return;const o={x:n.position.x-i.position.x,y:n.position.y-i.position.y};P.set(e,{...n,offsetFromParent:o}),O()}function we(t){return e.get(R).includes(t)}function xe(t){return!!e.get(R).includes(t)&&(e.set(R,e.get(R).filter(e=>e!==t),!0),!0)}function ze(){return e.get(R).length>0}function Ie(){return Array.from(P.keys())}function be(e){return P.get(e)}function _e(e){const t=[];for(const[n,i]of P.entries())if(n!==e&&i.isOpen&&!i.isMinimized&&!i.isHiddenWithParent&&!i.parentId)if(i.position&&i.size)t.push({id:D(n),x:i.position.x,y:i.position.y,width:i.size.width,height:i.size.height});else{const e=document.querySelector(`[data-modal-id="${D(n)}"]`);if(e){const i=e.getBoundingClientRect();t.push({id:D(n),x:i.left,y:i.top,width:i.width,height:i.height})}}return t}function Me(e){const t=[];for(const[n,i]of P.entries())if(n!==e&&i.isOpen&&!i.isMinimized&&!i.isHiddenWithParent)if(i.position&&i.size)t.push({x:i.position.x,y:i.position.y,width:i.size.width,height:i.size.height});else{const e=document.querySelector(`[data-modal-id="${D(n)}"]`);if(e){const n=e.getBoundingClientRect();t.push({x:n.left,y:n.top,width:n.width,height:n.height})}}return t}function ke(){return e.get(C)}function De(){const t=e.get($);return e.set($,null),t}function Pe(t){return e.get(E).includes(t)}function Ce(t){return!!e.get(E).includes(t)&&(e.set(E,e.get(E).filter(e=>e!==t),!0),!0)}function Be(t){return e.get(H).includes(t)}function Oe(t){return!!e.get(H).includes(t)&&(e.set(H,e.get(H).filter(e=>e!==t),!0),!0)}function Te(t){return e.get(S).includes(t)}function Re(t){return!!e.get(S).includes(t)&&(e.set(S,e.get(S).filter(e=>e!==t),!0),!0)}function Ee(t){return e.get(L).includes(t)}function He(t){return!!e.get(L).includes(t)&&(e.set(L,e.get(L).filter(e=>e!==t),!0),!0)}function Se(t){return e.get(F).includes(t)}function Le(t){return!!e.get(F).includes(t)&&(e.set(F,e.get(F).filter(e=>e!==t),!0),!0)}function Fe(t){return e.get(W).includes(t)}function We(t){return!!e.get(W).includes(t)&&(e.set(W,e.get(W).filter(e=>e!==t),!0),!0)}function Ae(t){P.get(t)&&(e.get(W).includes(t)||e.get(A).includes(t)||(e.set(W,[...e.get(W),t],!0),O()))}function $e(t){e.get(A).includes(t)||e.set(A,[...e.get(A),t],!0)}function Xe(t){e.set(A,e.get(A).filter(e=>e!==t),!0)}function Ye(){return e.get(Y)}function qe(t){if(!e.get(Y)||e.get(Y).childId!==t)return null;const n=e.get(Y);return e.set(Y,null),n}function Ne(e,t){X.set(e,t)}function je(e){const t=X.get(e);return t&&X.delete(e),t??null}function Ge(e,t){t?N.add(e):N.delete(e)}function Ke(e){return N.has(e)}function Ve(e){const t=P.get(e);return void 0!==t&&t.isOpen&&!t.isMinimized&&!t.isHiddenWithParent}function Ue(e){return P.has(e)}function Qe(){return{get modals(){return P},get pendingMinimize(){return e.get(R)},get pendingOpen(){return e.get(E)},get pendingClose(){return e.get(H)},get pendingRestore(){return e.get(L)},get dockOrder(){return e.get(G)}}}function Ze(e){j.has(e)?j.delete(e):j.add(e);const t=P.get(e);t&&(P.set(e,{...t,isTransparent:j.has(e)}),O())}function Je(e){j.delete(e);const t=P.get(e);t&&(P.set(e,{...t,isTransparent:!1}),O())}function et(e){e.animate([{transform:"translateX(0)"},{transform:"translateX(-6px)"},{transform:"translateX(6px)"},{transform:"translateX(-6px)"},{transform:"translateX(6px)"},{transform:"translateX(0)"}],{duration:300,easing:"ease-in-out"})}function tt(e){const t=q.get(e);if(!t)return;const n=P.get(e);n&&(P.set(e,{...n,isAnimatingPosition:!0,position:t}),q.delete(e),O())}function nt(e){const t=P.get(e);t&&(P.set(e,{...t,isAnimatingPosition:!1}),O())}function it(e){return q.has(e)}function ot(e){q.delete(e)}function rt(e){const t=mt().parentChild.animationDuration;for(const[t,n]of e){const e=P.get(t);e&&P.set(t,{...e,position:n,isAnimatingPosition:!0,hasBeenDragged:!0})}O(),setTimeout(()=>{for(const t of e.keys()){const e=P.get(t);e&&P.set(t,{...e,isAnimatingPosition:!1})}O()},t)}function st(e){const t=mt();if("animated"!==t.parentChild.movementMode)return;const n=t.parentChild.animationDuration,i=[];let o=e;for(;;){const e=P.get(o);if(!(null==e?void 0:e.parentId))break;i.push({parentId:e.parentId,childId:o}),o=e.parentId}i.forEach(({parentId:e,childId:t},i)=>{setTimeout(()=>{const i=P.get(t),o=P.get(e);if(!(null==i?void 0:i.position)||!i.offsetFromParent||!o)return;const r={x:i.position.x-i.offsetFromParent.x,y:i.position.y-i.offsetFromParent.y};q.set(e,r),tt(e),setTimeout(()=>nt(e),n)},i*n)})}function dt(e){}function at(e){K=e}function lt(e){V=e}function ct(){return{modals:P,pendingMinimize:e.get(R),pendingOpen:e.get(E),pendingClose:e.get(H),pendingRestore:e.get(L),dockOrder:e.get(G),animatingModals:N,transparentModals:j}}function gt(){P.clear(),e.get(R).length=0,e.get(E).length=0,e.get(H).length=0,e.get(S).length=0,e.get(L).length=0,e.get(F).length=0,e.set($,null),X.clear(),e.set(Y,null),q.clear(),N.clear(),j.clear(),e.get(G).length=0,K=null,V=null}const ut={features:{dock:!0,minimize:!0,transparency:!0,resize:!0,drag:!0,focusTrap:!0,animations:!0,backdrop:!0,parentChild:!0},dock:{position:"bottom",labelMode:"beside",enableReorder:!0,enableFreeDrag:!0},animations:{open:400,close:250,minimize:500,restore:400},appearance:{headerLayout:"macos",defaultWidth:"480px",defaultHeight:"auto",minWidth:280,minHeight:200},zIndex:{base:400,dock:8e3,toast:9e3},parentChild:{movementMode:"animated",animationDuration:300},positioning:{strategy:"smart",modalGap:16,avoidElements:[]},portalTarget:"#modal-portal"};let ht={...ut},pt=e.state(0);function ft(){return e.get(pt)}function mt(){return ht}function vt(t){const n=ht;ht=wt(ut,t),e.update(pt),n.features.dock&&!ht.features.dock&&ee()}function yt(){ht={...ut},e.update(pt)}function wt(e,t){return{features:{...e.features,...t.features},dock:{...e.dock,...t.dock},animations:{...e.animations,...t.animations},appearance:{...e.appearance,...t.appearance},zIndex:{...e.zIndex,...t.zIndex},parentChild:{...e.parentChild,...t.parentChild},positioning:{...e.positioning,...t.positioning},portalTarget:t.portalTarget??e.portalTarget}}function xt(e){return ht.features[e]}const zt=Symbol("modal-render-icon"),It=Symbol("modal-id");function bt(e,t){if(!Ue(e))throw new Error(`Cannot call ${t}() on unregistered modal "${String(e)}". Ensure the Modal component is rendered.`)}function _t(e){return{shake:()=>{bt(e,"shake"),Ae(e)},bringToFront:()=>{bt(e,"bringToFront"),re(e)},isOpen:()=>Ve(e),isRegistered:()=>Ue(e),open:t=>{bt(e,"open"),ae(e,t)},close:()=>{bt(e,"close"),ce(e)},minimize:()=>{bt(e,"minimize"),Z(e)},restore:()=>{bt(e,"restore"),J(e)},openChild:(t,n)=>{bt(e,"openChild"),pe({id:t},e,n)}}}function Mt(t={x:0,y:0}){const n=e.proxy({...t}),i=e.proxy({isDragging:!1,startX:0,startY:0,initialX:0,initialY:0,hasBeenDragged:!1});return{get position(){return n},get hasBeenDragged(){return i.hasBeenDragged},get isDragging(){return i.isDragging},onPointerDown:function(e,t){if(0===e.button){if(!i.hasBeenDragged){const e=t.getBoundingClientRect();n.x=e.left,n.y=e.top}i.isDragging=!0,i.startX=e.clientX,i.startY=e.clientY,i.initialX=n.x,i.initialY=n.y,t.setPointerCapture(e.pointerId)}},onPointerMove:function(e,t,o){if(!i.isDragging)return;const r=e.clientX-i.startX,s=e.clientY-i.startY,d=w(i.initialX+r,i.initialY+s,o.width,o.height);n.x=d.x,n.y=d.y,i.hasBeenDragged=!0},onPointerUp:function(e,t){i.isDragging&&(i.isDragging=!1,t.releasePointerCapture(e.pointerId))},setPosition:function(e){n.x=e.x,n.y=e.y},setHasBeenDragged:function(e){i.hasBeenDragged=e},reset:function(){n.x=t.x,n.y=t.y,i.hasBeenDragged=!1}}}function kt(t,n,i,o,r,s,d){let a=e.state(!1),l=e.state(""),c=e.state(e.proxy({width:0,height:0})),g=e.state(!1),u=e.state(!1),h={x:0,y:0,width:0,height:0,posX:0,posY:0,centerX:0,centerY:0},p=null;function f(s,d){s.preventDefault(),s.stopPropagation();const u=t();if(!u)return;const f=u.getBoundingClientRect();o()||(i({x:f.left,y:f.top}),r(!0)),e.get(g)||(e.set(c,{width:f.width,height:f.height},!0),e.set(g,!0));const y=n();e.set(a,!0),e.set(l,d,!0),p=s.pointerId,h={x:s.clientX,y:s.clientY,width:e.get(c).width,height:e.get(c).height,posX:y.x,posY:y.y,centerX:y.x+e.get(c).width/2,centerY:y.y+e.get(c).height/2},window.addEventListener("pointermove",m),window.addEventListener("pointerup",v),window.addEventListener("pointercancel",v)}function m(t){if(t.pointerId!==p)return;const n=t.clientX-h.x,o=t.clientY-h.y,r=window.innerWidth,s=window.innerHeight,a=(null==d?void 0:d())??!1;let g=h.width,u=h.height,f=h.posX,m=h.posY;if(a){if(e.get(l).includes("e")||e.get(l).includes("w")){const t=e.get(l).includes("e")?n:-n;g=Math.max(280,h.width+2*t),f=h.centerX-g/2}if(e.get(l).includes("s")||e.get(l).includes("n")){const t=e.get(l).includes("s")?o:-o;u=Math.max(200,h.height+2*t),m=h.centerY-u/2}}else{if(e.get(l).includes("e")){const e=r-f;g=Math.max(280,Math.min(h.width+n,e))}if(e.get(l).includes("w")){const e=h.width-280,t=Math.min(n,e);g=h.width-t,f=h.posX+t}if(e.get(l).includes("s")){const e=s-m;u=Math.max(200,Math.min(h.height+o,e))}if(e.get(l).includes("n")){const e=h.height-200,t=Math.min(o,e);u=h.height-t,m=h.posY+t}}const v=x(f,m,g,u);e.set(c,{width:v.width,height:v.height},!0),i({x:v.x,y:v.y})}function v(t){t.pointerId===p&&(e.set(a,!1),p=null,window.removeEventListener("pointermove",m),window.removeEventListener("pointerup",v),window.removeEventListener("pointercancel",v),e.set(u,!0),s(n(),e.get(c)),setTimeout(()=>{e.set(u,!1)},0))}const y={startResize:f};return{get isResizing(){return e.get(a)},get resizeDirection(){return e.get(l)},get size(){return e.get(c)},get hasBeenResized(){return e.get(g)},get isActive(){return e.get(a)},get justFinishedResizing(){return e.get(u)},start:f,setHasBeenResized:()=>{},setSize:function(t){e.set(c,t,!0),e.set(g,!0)},reset:function(){e.set(g,!1),e.set(c,{width:0,height:0},!0)},constrainToViewport:function(){const o=n(),r=t();if(!r)return;const s=x(o.x,o.y,e.get(c).width||r.offsetWidth,e.get(c).height||r.offsetHeight);e.set(c,{width:s.width,height:s.height},!0),i({x:s.x,y:s.y})},handlers:y}}function Dt(){return mt().features.animations}function Pt(t,n,i,o,r,s,d,a,l){let c=e.state(!1),g=e.state(!1),u=e.state(!1),h=e.state(!1),p=e.state(null),f=e.state(null),m=null,v=null;function y(){v&&(clearTimeout(v),v=null)}function w(){const e=t(),n=document.querySelector(`.modal-dock-item[data-modal-id="${D(e)}"]`),i=document.querySelector('[data-dock-container="true"]'),o=n||i;if(o){const e=o.getBoundingClientRect();return{x:e.left+e.width/2,y:e.top+e.height/2}}return{x:window.innerWidth/2,y:window.innerHeight-40}}return e.user_effect(()=>()=>{y(),e.set(c,!1),e.set(g,!1),e.set(u,!1),e.set(h,!1),e.set(p,null),e.set(f,null),m=null}),{get isMinimizing(){return e.get(c)},get isRestoring(){return e.get(g)},get isOpening(){return e.get(u)},get isClosing(){return e.get(h)},get animationTransform(){return e.get(p)},get pendingOpenSource(){return e.get(f)},startMinimize:function(t,h){const f=n();if(e.get(c)||!f)return;if(e.set(g,!1),e.set(u,!1),y(),!Dt()){const e=f.getBoundingClientRect();let t=r()?i():{x:e.left,y:e.top},n=d()?a():{width:e.width,height:e.height};return r()||(o(t),s(!0)),void(h?h():l(t,!0,n))}const m=f.getBoundingClientRect(),x=m.left+m.width/2,z=m.top+m.height/2;let I=r()?i():{x:m.left,y:m.top},b=d()?a():{width:m.width,height:m.height};r()||(o(I),s(!0));const _=t??w(),M=_.x-m.left,k=_.y-m.top,D={x:_.x-x,y:_.y-z,originX:M,originY:k};e.set(p,D,!0),requestAnimationFrame(()=>{requestAnimationFrame(()=>{e.set(c,!0)})}),v=setTimeout(()=>{h?h():l(I,!0,b)},500)},startRestore:function(t,n){if(!Dt()){const e=t||{x:window.innerWidth/2,y:window.innerHeight/2};return o(e),void s(!0)}const i=w(),r=t||{x:window.innerWidth/2,y:window.innerHeight/2},d=n||{width:480,height:400};o(r),s(!0);const a=r.x+d.width/2,l=r.y+d.height/2,c=i.x-r.x,u=i.y-r.y;e.set(p,{x:i.x-a,y:i.y-l,originX:c,originY:u},!0),e.set(g,!0),setTimeout(()=>{e.set(g,!1),e.set(p,null)},400)},startClose:function(t){e.get(h)||e.get(c)||(Dt()?(m=t,e.set(h,!0),setTimeout(()=>{e.set(h,!1),m&&(m(),m=null)},250)):t())},setPendingOpenSource:function(t){e.set(f,t,!0)},tryStartOpenAnimation:function(){const t=n();if(!e.get(f)||!t||e.get(u))return!1;if(!Dt())return e.set(f,null),!1;const d=e.get(f);e.set(f,null);const a=t.getBoundingClientRect(),l=r()?i():{x:a.left,y:a.top},c=a.width,g=a.height,h=l.x+c/2,m=l.y+g/2;r()||(o(l),s(!0));const v=d.x-l.x,y=d.y-l.y;return e.set(p,{x:d.x-h,y:d.y-m,originX:v,originY:y},!0),e.set(u,!0),setTimeout(()=>{e.set(u,!1),e.set(p,null)},400),!0},forceClearMinimize:function(){y(),e.set(c,!1),e.set(p,null)}}}const Ct=["button:not([disabled])","[href]","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(", ");function Bt(e){return Array.from(e.querySelectorAll(Ct)).filter(e=>null!==e.offsetParent||"A"===e.tagName)}function Ot(e,t){if("Tab"!==e.key)return;const n=Bt(t);if(0===n.length)return void e.preventDefault();const i=n[0],o=n[n.length-1],r=document.activeElement;e.shiftKey?r===i&&(o.focus(),e.preventDefault()):r===o&&(i.focus(),e.preventDefault())}function Tt(e){const t=Bt(e);return t.length>0&&(t[0].focus(),!0)}function Rt(){return{trapFocus:Ot,focusFirstElement:Tt}}const Et="modal-portal";function Ht(){return{mount:function(e,t=null){const n=function(e){if("undefined"==typeof window)return null;if(e instanceof HTMLElement)return e;if("string"==typeof e){const t=document.querySelector(e);if(t)return t;if(e.startsWith("#")){const t=e.slice(1),n=document.createElement("div");return n.id=t,document.body.appendChild(n),n}}let t=document.getElementById(Et);return t||(t=document.createElement("div"),t.id=Et,document.body.appendChild(t)),t}(t);return n?(n.appendChild(e),()=>{e.parentNode===n&&n.removeChild(e),n.id!==Et&&0===n.children.length&&n.parentNode&&n.parentNode.removeChild(n)}):()=>{}}}}function St(e){const n=t(It),i=e??n;if(!i)throw new Error("useModalZIndex: No modal ID provided and no modal context found. Either pass a modal ID or use this hook inside a Modal component.");return{get zIndex(){const e=be(i);return((null==e?void 0:e.zIndex)??mt().zIndex.base)+1},get portalTarget(){return mt().portalTarget}}}function Lt(){function t(e,t,n){return"undefined"==typeof window?()=>{}:(window.addEventListener(e,t,n),()=>{window.removeEventListener(e,t,n)})}return{addListener:t,addListenerEffect:function(n,i,o){e.user_effect(()=>{if("undefined"!=typeof window)return t(n,i,o)})}}}var Ft=e.from_html('<div style="display: contents;"><!></div>');function Wt(t,i){e.push(i,!0);let o=e.prop(i,"target",3,"body"),r=null,s=null;const{mount:d}=Ht();n(()=>(r&&(s=d(r,o())),()=>{null==s||s()}));var a=Ft(),l=e.child(a);e.snippet(l,()=>i.children),e.reset(a),e.bind_this(a,e=>r=e,()=>r),e.append(t,a),e.pop()}var At=e.from_html('<button type="button" aria-label="Minimize"></button>'),$t=e.from_html('<button type="button" class="modal-header-light modal-header-light-style" aria-label="Toggle style"></button>'),Xt=e.from_html('<div class="modal-header-icon"><!></div>'),Yt=e.from_html('<div class="modal-header-icon"><!></div>'),qt=e.from_html('<h2 class="modal-header-title"> </h2>'),Nt=e.from_html('<h2 class="modal-header-title"> </h2>'),jt=e.from_html('<div class="modal-header-traffic-lights"><button type="button" class="modal-header-light modal-header-light-close" aria-label="Close"></button> <!> <!></div> <div class="modal-header-mac-center"><!> <div class="modal-header-title-group"><!></div></div> <div class="modal-header-mac-spacer"></div>',1),Gt=e.from_html('<div class="modal-header-icon"><!></div>'),Kt=e.from_html('<div class="modal-header-icon"><!></div>'),Vt=e.from_html('<h2 class="modal-header-title"> </h2>'),Ut=e.from_html('<h2 class="modal-header-title"> </h2>'),Qt=e.from_html('<button type="button" class="modal-header-btn-windows modal-header-btn-windows-style" aria-label="Toggle style">&#9671;</button>'),Zt=e.from_html('<button type="button" aria-label="Minimize">&#8211;</button>'),Jt=e.from_html('<div class="modal-header-title-group"><!> <!></div> <div class="modal-header-actions"><!> <!> <button type="button" class="modal-header-btn-windows modal-header-btn-windows-close" aria-label="Close">&times;</button></div>',1),en=e.from_html("<header><!></header>");function tn(n,i){e.push(i,!0);let o=e.prop(i,"isTransparent",3,!1),r=e.prop(i,"headerLayout",3,"macos"),s=e.prop(i,"minimizable",3,!0),d=e.prop(i,"minimizeDisabled",3,!1),a=e.prop(i,"transparencyEnabled",3,!0);const l=t(zt),c=e.derived(()=>null==l?void 0:l()),g=e.derived(()=>"macos"===r());var u=en();let h;u.__pointerdown=function(e){var t;e.target.closest("button")||null==(t=i.onStartDrag)||t.call(i,e)};var p=e.child(u),f=t=>{var n=jt(),o=e.first_child(n),r=e.child(o);r.__click=function(...e){var t;null==(t=i.onClose)||t.apply(this,e)};var l=e.sibling(r,2),g=t=>{var n=At();let o;n.__click=function(...e){var t;null==(t=d()?void 0:i.onMinimize)||t.apply(this,e)},e.template_effect(()=>{o=e.set_class(n,1,"modal-header-light modal-header-light-minimize",null,o,{"modal-header-light-disabled":d()}),n.disabled=d(),e.set_attribute(n,"title",d()?"Enable dock to minimize":void 0)}),e.append(t,n)};e.if(l,e=>{s()&&e(g)});var u=e.sibling(l,2),h=t=>{var n=$t();n.__click=function(...e){var t;null==(t=i.onToggleStyle)||t.apply(this,e)},e.append(t,n)};e.if(u,e=>{a()&&e(h)}),e.reset(o);var p=e.sibling(o,2),f=e.child(p),m=t=>{var n=Xt(),o=e.child(n);e.snippet(o,()=>i.customIcon),e.reset(n),e.append(t,n)},v=t=>{var n=e.comment(),o=e.first_child(n),r=t=>{var n=Yt(),o=e.child(n);e.snippet(o,()=>e.get(c),()=>i.icon),e.reset(n),e.append(t,n)};e.if(o,t=>{i.icon&&e.get(c)&&t(r)},!0),e.append(t,n)};e.if(f,e=>{i.customIcon?e(m):e(v,!1)});var y=e.sibling(f,2),w=e.child(y),x=t=>{var n=qt(),o=e.child(n,!0);e.reset(n),e.template_effect(()=>{e.set_attribute(n,"id",i.titleId),e.set_text(o,i.title)}),e.append(t,n)},z=t=>{var n=Nt(),o=e.child(n,!0);e.reset(n),e.template_effect(()=>e.set_text(o,i.title)),e.append(t,n)};e.if(w,e=>{i.titleId?e(x):e(z,!1)}),e.reset(y),e.reset(p),e.next(2),e.append(t,n)},m=t=>{var n=Jt(),o=e.first_child(n),r=e.child(o),l=t=>{var n=Gt(),o=e.child(n);e.snippet(o,()=>i.customIcon),e.reset(n),e.append(t,n)},g=t=>{var n=e.comment(),o=e.first_child(n),r=t=>{var n=Kt(),o=e.child(n);e.snippet(o,()=>e.get(c),()=>i.icon),e.reset(n),e.append(t,n)};e.if(o,t=>{i.icon&&e.get(c)&&t(r)},!0),e.append(t,n)};e.if(r,e=>{i.customIcon?e(l):e(g,!1)});var u=e.sibling(r,2),h=t=>{var n=Vt(),o=e.child(n,!0);e.reset(n),e.template_effect(()=>{e.set_attribute(n,"id",i.titleId),e.set_text(o,i.title)}),e.append(t,n)},p=t=>{var n=Ut(),o=e.child(n,!0);e.reset(n),e.template_effect(()=>e.set_text(o,i.title)),e.append(t,n)};e.if(u,e=>{i.titleId?e(h):e(p,!1)}),e.reset(o);var f=e.sibling(o,2),m=e.child(f),v=t=>{var n=Qt();n.__click=function(...e){var t;null==(t=i.onToggleStyle)||t.apply(this,e)},e.append(t,n)};e.if(m,e=>{a()&&e(v)});var y=e.sibling(m,2),w=t=>{var n=Zt();let o;n.__click=function(...e){var t;null==(t=d()?void 0:i.onMinimize)||t.apply(this,e)},e.template_effect(()=>{o=e.set_class(n,1,"modal-header-btn-windows",null,o,{"modal-header-btn-windows-disabled":d()}),n.disabled=d(),e.set_attribute(n,"title",d()?"Enable dock to minimize":void 0)}),e.append(t,n)};e.if(y,e=>{s()&&e(w)}),e.sibling(y,2).__click=function(...e){var t;null==(t=i.onClose)||t.apply(this,e)},e.reset(f),e.append(t,n)};e.if(p,t=>{e.get(g)?t(f):t(m,!1)}),e.reset(u),e.template_effect(()=>h=e.set_class(u,1,"modal-header",null,h,{"modal-header-draggable":!!i.onStartDrag,transparent:o()})),e.append(n,u),e.pop()}e.delegate(["pointerdown","click"]);var nn=e.from_html("<div></div>"),on=e.from_html('<div class="modal-resize-handles"></div>');function rn(t,n){e.push(n,!0);const i=["n","s","e","w","ne","nw","se","sw"];var o=e.comment(),r=e.first_child(o),s=t=>{var o=on();e.each(o,21,()=>i,e.index,(t,i)=>{var o=nn();o.__pointerdown=t=>function(e,t){var i;null==(i=n.onStartResize)||i.call(n,e,t)}(t,e.get(i)),e.template_effect(()=>e.set_class(o,1,`modal-resize-handle modal-resize-${e.get(i)??""}`)),e.append(t,o)}),e.reset(o),e.append(t,o)};e.if(r,e=>{n.onStartResize&&e(s)}),e.append(t,o),e.pop()}function sn(e,t){return t&&e.appendChild(t),{update(t){e.innerHTML="",t&&e.appendChild(t)},destroy(){e.innerHTML=""}}}e.delegate(["pointerdown"]);var dn=e.from_html('<div class="modal-footer"><!></div>'),an=e.from_html("<div></div>"),ln=e.from_html('<div role="dialog" aria-modal="true" tabindex="-1"><!> <div class="modal-body"><!></div> <!> <!> <!></div>');function cn(t,s){e.push(s,!0);let d=e.prop(s,"maxWidth",3,"600px"),a=e.prop(s,"autoOpen",3,!1),l=e.prop(s,"closeOnEscape",3,!0),c=e.state(!1);n(()=>{U({id:s.id,title:s.title,icon:s.icon??"",isOpen:a(),isMinimized:!1,isHiddenWithParent:!1,isTransparent:!1,isRejected:!1,position:null,size:null,hasBeenDragged:!1,dockPosition:0,glow:s.glow??null,parentId:void 0,childId:void 0,offsetFromParent:void 0}),e.set(c,!0)}),r(()=>{Q(s.id)});const g=e.derived(()=>{if(!e.get(c))return!1;ke();const t=be(s.id);return!!t&&(t.isOpen||t.isMinimized||Pe(s.id)||Be(s.id)||we(s.id))});var u=e.comment(),h=e.first_child(u),p=t=>{!function(t,s){e.push(s,!0);let d=e.prop(s,"maxWidth",3,"600px"),a=e.prop(s,"autoOpen",3,!1),l=e.prop(s,"closeOnEscape",3,!0),c=e.prop(s,"skipRegistration",3,!1);i(It,s.id);const g=mt().portalTarget,u=D(s.id);function h(e){var t,n;return(null==(n=null==(t=s.config)?void 0:t.features)?void 0:n[e])??xt(e)}const p=e.derived(()=>(ft(),h("drag"))),f=e.derived(()=>(ft(),h("minimize"))),m=e.derived(()=>(ft(),!h("dock"))),v=e.derived(()=>(ft(),h("transparency"))),y=e.derived(()=>(ft(),h("resize"))),x=e.derived(()=>{var e,t;return ft(),(null==(t=null==(e=s.config)?void 0:e.appearance)?void 0:t.headerLayout)??mt().appearance.headerLayout});let z=e.state(null),_=e.state(!1),P=e.state(!1),C=e.state(!1),B=e.state(!1),O=e.state(!1);const T=e.derived(()=>(ke(),be(s.id))),R=e.derived(()=>e.get(T)&&(e.get(T).isOpen||Be(s.id))&&(!e.get(T).isMinimized||we(s.id))&&!e.get(T).isHiddenWithParent),E=e.derived(()=>{var t;return!!(null==(t=e.get(T))?void 0:t.childId)}),H=e.derived(()=>{var t;return!!(null==(t=e.get(T))?void 0:t.parentId)}),S=e.derived(()=>e.get(E)||e.get(P)),L=e.derived(()=>!!s.glow),F=e.derived(()=>`modal-title-${u}`),W=e.derived(()=>{var t;return(null==(t=e.get(T))?void 0:t.zIndex)??1e3}),A=Mt({x:0,y:0});let $=e.state(!1);const X=kt(()=>e.get(z),()=>A.position,e=>A.setPosition(e),()=>A.hasBeenDragged,e=>A.setHasBeenDragged(e),(t,n)=>{const i=be(s.id);if(null==i?void 0:i.parentId){const t=be(i.parentId),o=document.querySelector(`[data-modal-id="${D(i.parentId)}"]`);if(t&&o){const i=t.position??{x:o.getBoundingClientRect().left,y:o.getBoundingClientRect().top},r=t.size??{width:o.offsetWidth,height:o.offsetHeight},d={x:i.x+(r.width-n.width)/2,y:i.y+(r.height-n.height)/2};e.set($,!0),A.setPosition(d);const a={x:d.x-i.x,y:d.y-i.y};return oe(s.id,{position:d,size:n,hasBeenDragged:!0,offsetFromParent:a}),void setTimeout(()=>{e.set($,!1)},200)}}oe(s.id,{position:t,size:n,hasBeenDragged:!0})}),Y=Pt(()=>s.id,()=>e.get(z),()=>A.position,e=>A.setPosition(e),()=>A.hasBeenDragged,e=>A.setHasBeenDragged(e),()=>X.hasBeenResized,()=>X.size,(e,t,n)=>{oe(s.id,{position:e,size:n,hasBeenDragged:t}),Z(s.id)}),{trapFocus:q,focusFirstElement:N}=Rt(),j=e.derived(()=>Y.isMinimizing||Y.isRestoring||Y.isOpening||Y.isClosing),G=e.derived(()=>(Se(s.id)||Ee(s.id))&&!Y.isRestoring);let K=e.state(!1);const V=e.derived(()=>Y.isRestoring||Y.isOpening||e.get(K)),J=e.derived(()=>e.get(R)&&!A.hasBeenDragged&&!e.get(j)&&!Y.pendingOpenSource&&!e.get(G)),ee=e.derived(()=>{const t=[];return t.push(`z-index: ${e.get(W)};`),Y.animationTransform?(t.push(`left: ${A.position.x}px; top: ${A.position.y}px;`),t.push(`--genie-origin-x: ${Y.animationTransform.originX}px;`),t.push(`--genie-origin-y: ${Y.animationTransform.originY}px;`),t.push(`--genie-translate-x: ${Y.animationTransform.x}px;`),t.push(`--genie-translate-y: ${Y.animationTransform.y}px;`)):A.hasBeenDragged&&t.push(`left: ${A.position.x}px; top: ${A.position.y}px; transform: none;`),X.hasBeenResized?t.push(`width: ${X.size.width}px; height: ${X.size.height}px; max-width: none; max-height: none;`):(s.preferredHeight&&t.push(`min-height: ${s.preferredHeight};`),d()&&t.push(`max-width: ${d()};`)),e.get(L)&&s.glow&&(t.push(`--modal-glow-color: ${s.glow.color};`),t.push(`--modal-glow-intensity: ${s.glow.intensity};`)),t.join(" ")});function te(){e.get(f)&&Z(s.id)}function ie(){var e;Te(s.id)&&Re(s.id),ce(s.id),null==(e=s.onClose)||e.call(s)}function de(){Ze(s.id)}function ae(t){e.get(p)&&e.get(z)&&A.onPointerDown(t,e.get(z))}function le(e){l()&&"Escape"===e.key&&se(s.id)&&(e.stopPropagation(),ie())}function ge(t){if(!e.get(z))return;const n=A.isDragging,i=X.hasBeenResized?X.size:{width:e.get(z).offsetWidth,height:e.get(z).offsetHeight};A.onPointerMove(t,e.get(z),i),A.isDragging&&n&&ne(s.id,A.position,{drag:!0})}function he(t){if(!e.get(z))return;const n=A.isDragging;A.onPointerUp(t,e.get(z)),n&&!X.justFinishedResizing&&(ne(s.id,A.position,{drag:!0}),st(s.id))}function pe(){var t;const n=mt();if("smart"!==(null==(t=n.positioning)?void 0:t.strategy))return!1;const i=be(s.id);if(null==i?void 0:i.parentId)return!1;if((null==i?void 0:i.hasBeenDragged)||(null==i?void 0:i.position))return!1;const o=e.get(z)||document.querySelector(`[data-modal-id="${u}"]`);if(!o)return!1;const r=o.offsetWidth,d=o.offsetHeight;if(r<=0||d<=0)return!1;const a=n.positioning.modalGap??16,l=Me(s.id),c=M(r,d,l,{modalGap:a,avoidBounds:b(n.positioning.avoidElements??[])});if(I(c.x,c.y,r,d,l,a)/(r*d)>.1&&l.length>0){const e=k(r,d,_e(s.id),{modalGap:a});if(e&&e.existingModalMoves.size>0)return rt(e.existingModalMoves),A.setPosition(e.newModalPosition),A.setHasBeenDragged(!0),ne(s.id,e.newModalPosition,{size:{width:r,height:d}}),!0}return A.setPosition(c),A.setHasBeenDragged(!0),ne(s.id,c,{size:{width:r,height:d}}),!0}function me(){o().then(()=>o()).then(()=>{let t=0;const n=()=>{t+=1,pe()||t>5||requestAnimationFrame(n)};e.get(z)?n():requestAnimationFrame(n)})}n(()=>{var t;function n(){const t=be(s.id);if(!(null==t?void 0:t.position)||!e.get(z))return;if(t.parentId)return;const n=X.hasBeenResized?X.size.width:e.get(z).offsetWidth,i=X.hasBeenResized?X.size.height:e.get(z).offsetHeight;if(n<=0||i<=0)return;const o=w(t.position.x,t.position.y,n,i);(Math.abs(o.x-t.position.x)>1||Math.abs(o.y-t.position.y)>1)&&(A.setPosition(o),ne(s.id,o))}return c()||(t=a(),U({id:s.id,title:s.title,icon:s.icon??"",isOpen:t,isMinimized:!1,isHiddenWithParent:!1,isTransparent:!1,isRejected:!1,position:null,size:null,hasBeenDragged:!1,dockPosition:0,glow:s.glow??null,parentId:void 0,childId:void 0,offsetFromParent:void 0}),t&&re(s.id)),a()&&(o().then(()=>{e.get(z)&&N(e.get(z))}),me()),window.addEventListener("pointermove",ge),window.addEventListener("pointerup",he),window.addEventListener("resize",n),()=>{window.removeEventListener("pointermove",ge),window.removeEventListener("pointerup",he),window.removeEventListener("resize",n)}}),r(()=>{Je(s.id),c()||Q(s.id)}),e.user_effect(()=>{ke();const t=be(s.id);if(t){if(e.set(_,t.isTransparent,!0),!A.isDragging&&!X.isResizing&&t.position){const e=A.position,n=t.position;(Math.abs(e.x-n.x)>.5||Math.abs(e.y-n.y)>.5)&&(A.setPosition(n),t.hasBeenDragged&&A.setHasBeenDragged(!0))}o().then(()=>function(){var t;if(!be(s.id))return;if(Te(s.id))return Re(s.id),void(null==(t=s.onClose)||t.call(s));if(we(s.id)&&!e.get(B)){if(e.set(B,!0),De(),e.get(z)){const t=e.get(z).getBoundingClientRect(),n=A.hasBeenDragged?A.position:{x:t.left,y:t.top},i=X.hasBeenResized?X.size:{width:t.width,height:t.height};oe(s.id,{position:n,size:i,hasBeenDragged:!0})}Y.startMinimize(void 0,()=>{xe(s.id),e.set(B,!1)})}if(Ee(s.id)){He(s.id);const t=be(s.id);Y.startRestore((null==t?void 0:t.position)??void 0,(null==t?void 0:t.size)??void 0),o().then(()=>{e.get(z)&&N(e.get(z))})}if(Se(s.id)){Le(s.id);const e=be(s.id);Y.startRestore((null==e?void 0:e.position)??void 0,(null==e?void 0:e.size)??void 0)}if(Be(s.id)&&(Oe(s.id),Y.startClose(()=>{var e;Je(s.id),ue(s.id),null==(e=s.onClose)||e.call(s)})),Pe(s.id)){Ce(s.id);const t=je(s.id)||s.openSourcePosition||null;t?(Y.setPendingOpenSource(t),o().then(()=>o()).then(()=>{pe(),Y.tryStartOpenAnimation()})):me(),o().then(()=>{e.get(z)&&N(e.get(z))})}Fe(s.id)&&(We(s.id),$e(s.id),e.set(O,!0),setTimeout(()=>{e.set(O,!1),Xe(s.id)},600));const n=qe(s.id);var i;n&&e.get(z)&&(i=n.parentId,o().then(()=>o()).then(()=>{let t=0;const n=()=>{t+=1;const o=function(t){var n,i;const o=be(t);if(!o)return!1;const r=e.get(z)||document.querySelector(`[data-modal-id="${u}"]`),d=document.querySelector(`[data-modal-id="${D(t)}"]`),a=null==d?void 0:d.getBoundingClientRect(),l=o.position??(a?{x:a.left,y:a.top}:null);if(!l||!r)return!1;const c=(null==(n=o.size)?void 0:n.width)??(null==d?void 0:d.offsetWidth)??(null==a?void 0:a.width)??480,g=(null==(i=o.size)?void 0:i.height)??(null==d?void 0:d.offsetHeight)??(null==a?void 0:a.height)??400,h=r.offsetWidth,p=r.offsetHeight;if(c<=0||g<=0||h<=0||p<=0)return!1;const f={x:l.x+(c-h)/2,y:l.y+(g-p)/2};return A.setPosition(f),A.setHasBeenDragged(!0),ne(s.id,f,{size:{width:h,height:p}}),o.position&&o.size||!a||ne(t,{x:a.left,y:a.top},{size:{width:c,height:g}}),fe(t,s.id),!0}(i);o||t>5||requestAnimationFrame(n)};e.get(z)?n():requestAnimationFrame(n)}))}())}}),e.user_effect(()=>{const t=be(s.id);t&&t.isTransparent!==e.get(_)&&e.set(_,t.isTransparent,!0)}),e.user_effect(()=>{if(e.get(R)&&e.get(z)){const t=t=>function(t){e.get(z)&&q(t,e.get(z))}(t);return e.get(z).addEventListener("keydown",t),()=>{var n;return null==(n=e.get(z))?void 0:n.removeEventListener("keydown",t)}}}),e.user_effect(()=>{!e.get(R)&&Y.isMinimizing&&Y.forceClearMinimize()}),e.user_effect(()=>{Y.isRestoring||Y.isOpening?e.set(K,!0):e.get(K)&&requestAnimationFrame(()=>{e.set(K,!1)})}),e.user_effect(()=>{e.get(C)&&!e.get(E)&&(e.set(P,!0),setTimeout(()=>{e.set(P,!1)},200)),e.set(C,e.get(E),!0)});var ve=e.comment(),ye=e.first_child(ve),ze=t=>{Wt(t,{get target(){return g},children:(t,n)=>{var i=ln();let o;i.__keydown=le;var r=e.child(i);{let t=e.derived(()=>e.get(p)?ae:void 0);tn(r,{get title(){return s.title},get customIcon(){return s.customIcon},get icon(){return s.icon},get isTransparent(){return e.get(_)},get titleId(){return e.get(F)},get headerLayout(){return e.get(x)},get onStartDrag(){return e.get(t)},onToggleStyle:de,onMinimize:te,onClose:ie,get minimizable(){return e.get(f)},get minimizeDisabled(){return e.get(m)},get transparencyEnabled(){return e.get(v)}})}var d=e.sibling(r,2),a=e.child(d);e.snippet(a,()=>s.children??e.noop),e.reset(d),e.action(d,(e,t)=>null==sn?void 0:sn(e,t),()=>s.bodyElement);var l=e.sibling(d,2),c=t=>{var n=dn(),i=e.child(n),o=t=>{var n=e.comment(),i=e.first_child(n);e.snippet(i,()=>s.footer),e.append(t,n)};e.if(i,e=>{s.footer&&e(o)}),e.reset(n),e.action(n,(e,t)=>null==sn?void 0:sn(e,t),()=>s.footerElement),e.append(t,n)};e.if(l,e=>{(s.footer||s.footerElement)&&e(c)});var g=e.sibling(l,2);{let t=e.derived(()=>e.get(y)&&!e.get(E)?X.handlers.startResize:void 0);rn(g,{get onStartResize(){return e.get(t)}})}var h=e.sibling(g,2),w=t=>{var n=an();let i;e.template_effect(()=>i=e.set_class(n,1,"modal-child-overlay",null,i,{"modal-overlay-closing":e.get(P)})),e.append(t,n)};e.if(h,t=>{e.get(S)&&t(w)}),e.reset(i),e.bind_this(i,t=>e.set(z,t),()=>e.get(z)),e.template_effect(()=>{var t;o=e.set_class(i,1,"modal-dialog",null,o,{"modal-dragging":A.isDragging,"modal-resizing":X.isResizing,"modal-positioned":A.hasBeenDragged,"modal-minimizing":Y.isMinimizing,"modal-restoring":Y.isRestoring,"modal-opening":Y.isOpening,"modal-closing":Y.isClosing,"modal-centered":e.get(J),"modal-solid":!e.get(_),"modal-transparent":e.get(_),"modal-glow":e.get(L),"modal-has-child":e.get(E),"modal-is-child":e.get(H),"modal-visible-by-animation":e.get(V),"modal-animating-to-center":e.get($),"modal-animating-position":null==(t=e.get(T))?void 0:t.isAnimatingPosition,"modal-attention":e.get(O)}),e.set_attribute(i,"data-modal-id",u),e.set_style(i,e.get(ee)),e.set_attribute(i,"aria-labelledby",e.get(F))}),e.event("pointerdown",i,()=>re(s.id),!0),e.append(t,i)},$$slots:{default:!0}})};e.if(ye,t=>{e.get(R)&&t(ze)}),e.append(t,ve),e.pop()}(t,{get id(){return s.id},get title(){return s.title},get icon(){return s.icon},get customIcon(){return s.customIcon},get maxWidth(){return d()},get preferredHeight(){return s.preferredHeight},get autoOpen(){return a()},get openSourcePosition(){return s.openSourcePosition},get glow(){return s.glow},get config(){return s.config},get closeOnEscape(){return l()},get onClose(){return s.onClose},get children(){return s.children},get footer(){return s.footer},skipRegistration:!0})};e.if(h,t=>{e.get(g)&&t(p)}),e.append(t,u),e.pop()}e.delegate(["keydown"]);var gn=e.from_html('<button type="button" aria-label="Drag dock"></button>'),un=e.from_html('<span class="modal-dock-item-icon-placeholder"> </span>'),hn=e.from_html('<span class="modal-dock-item-label"> </span>'),pn=e.from_html("<span>+</span>"),fn=e.from_html('<span class="modal-dock-child-indicator"><!></span>'),mn=e.from_html('<button><span class="modal-dock-item-icon"><!></span> <!> <span class="modal-dock-item-glow"></span> <!></button>'),vn=e.from_html('<div data-dock-container="true"><div><!> <!></div></div>');function yn(n,i){e.push(i,!0);const o=t(zt),r=e.derived(()=>i.renderIcon??(null==o?void 0:o())),s=Qe(),l=e.derived(()=>(ft(),mt())),u=e.derived(()=>m("DOCK")),h=e.derived(()=>e.get(l).dock.position),p=e.derived(()=>e.get(l).dock.labelMode);let f=e.state("horizontal"),v=e.state(e.proxy({x:100,y:100})),y=e.state(null),x=e.state(!1),z={x:0,y:0},I=null;const b=e.derived(()=>(ke(),Array.from(s.modals.values()).filter(e=>e.isMinimized).sort((e,t)=>e.dockPosition-t.dockPosition))),_=e.derived(()=>{switch(e.get(h)){case"left":return{x:-20,duration:250,easing:c};case"right":return{x:20,duration:250,easing:c};default:return{y:20,duration:250,easing:c}}});function M(t){var n;"free"===e.get(h)&&(e.set(x,!0),I=t.pointerId,z={x:t.clientX-e.get(v).x,y:t.clientY-e.get(v).y},null==(n=t.currentTarget)||n.setPointerCapture(t.pointerId),window.addEventListener("pointermove",k),window.addEventListener("pointerup",P),window.addEventListener("pointercancel",P))}function k(t){if(t.pointerId!==I||!e.get(y))return;const n=e.get(y).getBoundingClientRect(),i=window.innerWidth-n.width-8,o=window.innerHeight-n.height-8,r=Math.min(Math.max(t.clientX-z.x,8),Math.max(8,i)),s=Math.min(Math.max(t.clientY-z.y,8),Math.max(8,o));e.set(v,{x:Math.round(r),y:Math.round(s)},!0)}function P(t){t.pointerId===I&&(e.set(x,!1),I=null,window.removeEventListener("pointermove",k),window.removeEventListener("pointerup",P),window.removeEventListener("pointercancel",P))}const{addListener:C}=Lt();function B(){if("free"!==e.get(h)||!e.get(y))return;const t=e.get(y).getBoundingClientRect(),n=w(e.get(v).x,e.get(v).y,t.width,t.height);n.x===e.get(v).x&&n.y===e.get(v).y||e.set(v,{x:Math.round(n.x),y:Math.round(n.y)},!0)}e.user_effect(()=>{"undefined"!=typeof window&&C("resize",B)});var O={setDockOrientation:function(t){e.set(f,t,!0)},setDockFreePosition:function(t){e.set(v,t,!0)},getDockState:function(){return{dockPosition:e.get(h),dockOrientation:e.get(f),dockFreePosition:e.get(v),dockLabelMode:e.get(p)}}};return Wt(n,{get target(){return e.get(l).portalTarget},children:(t,n)=>{var i=vn();let o,l;var c=e.child(i);let m;var w=e.child(c),z=t=>{var n=gn();let i;n.__pointerdown=M,e.template_effect(()=>i=e.set_class(n,1,"modal-dock-handle",null,i,{"modal-dock-handle-dragging":e.get(x)})),e.append(t,n)};e.if(w,t=>{"free"===e.get(h)&&t(z)});var I=e.sibling(w,2);e.each(I,19,()=>e.get(b),e=>e.id,(t,n,i)=>{const o=e.derived(()=>e.get(n).lastChildId?s.modals.get(e.get(n).lastChildId):null);var a=mn();let l;a.__click=t=>{Ke(e.get(n).id)?et(t.currentTarget):J(e.get(n).id)};var c=e.child(a),u=e.child(c),h=t=>{var i=e.comment(),o=e.first_child(i);e.snippet(o,()=>e.get(r),()=>e.get(n).icon),e.append(t,i)},f=t=>{var i=un(),o=e.child(i,!0);e.reset(i),e.template_effect(t=>e.set_text(o,t),[()=>e.get(n).title.charAt(0)]),e.append(t,i)};e.if(u,t=>{e.get(n).icon&&e.get(r)?t(h):t(f,!1)}),e.reset(c);var m=e.sibling(c,2),v=t=>{var i=hn(),o=e.child(i,!0);e.reset(i),e.template_effect(()=>e.set_text(o,e.get(n).title)),e.append(t,i)};e.if(m,t=>{"hidden"!==e.get(p)&&t(v)});var y=e.sibling(m,4),w=t=>{var n=fn(),i=e.child(n),s=t=>{var n=e.comment(),i=e.first_child(n);e.snippet(i,()=>e.get(r),()=>e.get(o).icon),e.append(t,n)},d=t=>{var n=pn();e.append(t,n)};e.if(i,t=>{e.get(o).icon&&e.get(r)?t(s):t(d,!1)}),e.reset(n),e.append(t,n)};e.if(y,t=>{e.get(n).lastChildId&&e.get(o)&&t(w)}),e.reset(a),e.template_effect(t=>{l=e.set_class(a,1,"modal-dock-item",null,l,{"modal-dock-item-has-glow":!!e.get(n).glow,"modal-dock-item-has-child":!!e.get(n).lastChildId,"modal-dock-item-label-beside":"beside"===e.get(p),"modal-dock-item-label-below":"below"===e.get(p)}),e.set_attribute(a,"data-modal-id",t),e.set_style(a,e.get(n).glow?`--modal-dock-glow-color: ${e.get(n).glow.color};`:"")},[()=>D(e.get(n).id)]),e.transition(3,a,()=>d,()=>({duration:300,delay:50*e.get(i),easing:g,start:.5})),e.append(t,a)}),e.reset(c),e.reset(i),e.bind_this(i,t=>e.set(y,t),()=>e.get(y)),e.template_effect(()=>{o=e.set_class(i,1,"modal-dock-container",null,o,{"modal-dock-left":"left"===e.get(h),"modal-dock-right":"right"===e.get(h),"modal-dock-bottom":"bottom"===e.get(h),"modal-dock-free":"free"===e.get(h),"modal-dock-empty":0===e.get(b).length}),l=e.set_style(i,"free"===e.get(h)?`left: ${e.get(v).x}px; top: ${e.get(v).y}px;`:"",l,{"z-index":e.get(u)}),m=e.set_class(c,1,"modal-dock",null,m,{"modal-dock-free-horizontal":"free"===e.get(h)&&"horizontal"===e.get(f),"modal-dock-free-vertical":"free"===e.get(h)&&"vertical"===e.get(f)})}),e.transition(3,i,()=>a,()=>e.get(b).length>0?e.get(_):{duration:0}),e.append(t,i)},$$slots:{default:!0}}),e.pop(O)}e.delegate(["pointerdown","click"]);var wn=e.from_html('<div class="modal-backdrop svelte-1d3nq4t" aria-hidden="true"></div>');function xn(t,n){e.push(n,!0);const i=Qe(),o=e.derived(()=>(ft(),mt())),r=e.derived(()=>e.get(o).features.backdrop),s=e.derived(()=>(ke(),Array.from(i.modals.values()).some(e=>e.isOpen&&!e.isMinimized&&!e.isHiddenWithParent))),d=e.derived(()=>e.get(r)&&e.get(s)),a=e.derived(()=>m("MODAL")-1);Wt(t,{get target(){return e.get(o).portalTarget},children:(t,n)=>{var i=e.comment(),o=e.first_child(i),r=t=>{var n=wn();let i;e.template_effect(()=>i=e.set_style(n,"",i,{"z-index":e.get(a)})),e.transition(3,n,()=>l,()=>({duration:200})),e.append(t,n)};e.if(o,t=>{e.get(d)&&t(r)}),e.append(t,i)},$$slots:{default:!0}}),e.pop()}var zn=e.from_html("<!> <!>",1);function In(t,n){e.push(n,!0),i(zt,()=>n.renderIcon),e.user_effect(()=>(s(()=>{n.config&&vt(n.config),p()}),()=>{yt(),v()})),e.user_effect(()=>{if("undefined"==typeof document)return;const e=s(()=>mt().portalTarget);if("string"==typeof e&&!document.querySelector(e)){const t=document.createElement("div");return t.id=e.replace("#",""),document.body.appendChild(t),()=>{t.remove()}}});var o=zn(),r=e.first_child(o);xn(r,{});var d=e.sibling(r,2);e.snippet(d,()=>n.children??e.noop),e.append(t,o),e.pop()}export{xn as Backdrop,yn as Dock,cn as Modal,tn as ModalHeader,In as ModalProvider,Wt as Portal,rn as ResizeHandles,ct as _getInternalState,gt as _resetInternalState,f as acquireModalZIndex,rt as animateModalsToPositions,tt as animateParentToPosition,re as bringToFront,z as calculateOverlap,_ as calculatePositionScore,k as calculateRearrangement,I as calculateTotalOverlap,nt as clearParentAnimationFlag,ot as clearPendingParentAnimation,ge as closeAllModals,ce as closeModal,x as constrainSizeToViewport,w as constrainToViewport,je as consumeOpenSourcePosition,We as consumePendingAttention,Le as consumePendingChildRestore,Oe as consumePendingClose,Re as consumePendingForceClose,xe as consumePendingMinimize,De as consumePendingMinimizeTarget,Ce as consumePendingOpen,qe as consumePendingParentLink,He as consumePendingRestore,le as createModal,ut as defaultConfig,Xe as endAttentionAnimation,ue as finalizeModalClose,M as findSmartPosition,Tt as focusFirstElement,mt as getConfig,ft as getConfigVersion,b as getElementBounds,m as getLayerZIndex,be as getModalState,Qe as getModalsStore,he as getModalsToClose,Me as getOpenModalBounds,_e as getOpenModalBoundsWithIds,Ye as getPendingParentLink,Ie as getRegisteredModalIds,ke as getStateVersion,ze as hasAnyPendingMinimize,Fe as hasPendingAttention,Se as hasPendingChildRestore,Be as hasPendingClose,Te as hasPendingForceClose,we as hasPendingMinimize,Pe as hasPendingOpen,it as hasPendingParentAnimation,Ee as hasPendingRestore,me as hideChildWithParent,p as initializeStacking,xt as isFeatureEnabled,Ke as isModalAnimating,Ve as isModalOpen,Ue as isModalRegistered,se as isTopModal,fe as linkModals,wt as mergeConfig,Z as minimizeModal,pe as openChildModal,ae as openModal,U as registerModal,de as reorderDock,yt as resetConfig,Je as resetModalTransparency,v as resetStacking,ee as restoreAllMinimizedModals,te as restoreChildModal,J as restoreModal,ye as setChildOffsetFromParent,vt as setConfig,lt as setDockPositionGetter,Ge as setModalAnimating,dt as setRegistryFunctions,at as setURLStateCallbacks,et as shakeElement,$e as startAttentionAnimation,Ne as storeOpenSourcePosition,T as subscribe,Ze as toggleModalTransparency,Ot as trapFocus,Ae as triggerAttention,st as triggerCascadingParentAnimations,Q as unregisterModal,ve as updateChildPosition,oe as updateModal,ne as updateModalPosition,ie as updateModalSize,Rt as useFocusTrap,_t as useModal,Pt as useModalAnimation,Mt as useModalDrag,kt as useModalResize,St as useModalZIndex,Ht as usePortal,Lt as useWindowEvent};
1
+ import{B as a,D as s,M as e,b as o,a as d,P as r,R as l,f as u,t as i,g as t,u as M,e as n,c,d as p,i as m,h as F,j as P}from"./ui.js";export{a as Backdrop,s as Dock,e as Modal,o as ModalHeader,d as ModalProvider,r as Portal,l as ResizeHandles,u as focusFirstElement,i as trapFocus,t as useFocusTrap,M as useModal,n as useModalAnimation,c as useModalDrag,p as useModalResize,m as useModalZIndex,F as usePortal,P as useWindowEvent};
package/dist/ui.js ADDED
@@ -0,0 +1 @@
1
+ import*as e from"svelte/internal/client";import{i as t,a as i,o as n,r as o,m as r,c as s,b as a,d,t as l,e as g,f as c,g as u,h as p,j as h,k as m,l as f,n as v,p as w,q as y,s as x,u as _,v as b,w as z,x as k,y as D,z as M,A as B,B as I,C,D as E,E as R,F as P,G as T,H as L,I as $,J as S,K as H,L as O,M as X,N as Y,O as F,P as W,Q as A,R as q,S as j,T as N,U as G,V as K,W as U,X as V,Y as Z,Z as J,_ as Q,$ as ee,a0 as te,a1 as ie,a2 as ne,a3 as oe,a4 as re,a5 as se,a6 as ae,a7 as de}from"./core.js";import{getContext as le,onMount as ge,setContext as ce,tick as ue,onDestroy as pe,untrack as he}from"svelte";import"svelte/internal/disclose-version";import{scale as me,fly as fe,fade as ve}from"svelte/transition";import{cubicOut as we,backOut as ye}from"svelte/easing";const xe=Symbol("modal-render-icon"),_e=Symbol("modal-id");function be(e,i){if(!t(e))throw new Error(`Cannot call ${i}() on unregistered modal "${String(e)}". Ensure the Modal component is rendered.`)}function ze(e){return{shake:()=>{be(e,"shake"),l(e)},bringToFront:()=>{be(e,"bringToFront"),d(e)},isOpen:()=>i(e),isRegistered:()=>t(e),open:t=>{be(e,"open"),a(e,t)},close:()=>{be(e,"close"),s(e)},minimize:()=>{be(e,"minimize"),r(e)},restore:()=>{be(e,"restore"),o(e)},openChild:(t,i)=>{be(e,"openChild"),n({id:t},e,i)}}}function ke(t={x:0,y:0}){const i=e.proxy({...t}),n=e.proxy({isDragging:!1,startX:0,startY:0,initialX:0,initialY:0,hasBeenDragged:!1});return{get position(){return i},get hasBeenDragged(){return n.hasBeenDragged},get isDragging(){return n.isDragging},onPointerDown:function(e,t){if(0===e.button){if(!n.hasBeenDragged){const e=t.getBoundingClientRect();i.x=e.left,i.y=e.top}n.isDragging=!0,n.startX=e.clientX,n.startY=e.clientY,n.initialX=i.x,n.initialY=i.y,t.setPointerCapture(e.pointerId)}},onPointerMove:function(e,t,o){if(!n.isDragging)return;const r=e.clientX-n.startX,s=e.clientY-n.startY,a=n.initialX+r,d=n.initialY+s,l=g(a,d,o.width,o.height);i.x=l.x,i.y=l.y,n.hasBeenDragged=!0},onPointerUp:function(e,t){n.isDragging&&(n.isDragging=!1,t.releasePointerCapture(e.pointerId))},setPosition:function(e){i.x=e.x,i.y=e.y},setHasBeenDragged:function(e){n.hasBeenDragged=e},reset:function(){i.x=t.x,i.y=t.y,n.hasBeenDragged=!1}}}function De(t,i,n,o,r,s,a){let d=e.state(!1),l=e.state(""),g=e.state(e.proxy({width:0,height:0})),u=e.state(!1),p=e.state(!1),h={x:0,y:0,width:0,height:0,posX:0,posY:0,centerX:0,centerY:0},m=null;function f(s,a){s.preventDefault(),s.stopPropagation();const c=t();if(!c)return;const p=c.getBoundingClientRect();o()||(n({x:p.left,y:p.top}),r(!0)),e.get(u)||(e.set(g,{width:p.width,height:p.height},!0),e.set(u,!0));const f=i();e.set(d,!0),e.set(l,a,!0),m=s.pointerId,h={x:s.clientX,y:s.clientY,width:e.get(g).width,height:e.get(g).height,posX:f.x,posY:f.y,centerX:f.x+e.get(g).width/2,centerY:f.y+e.get(g).height/2},window.addEventListener("pointermove",v),window.addEventListener("pointerup",w),window.addEventListener("pointercancel",w)}function v(t){if(t.pointerId!==m)return;const i=t.clientX-h.x,o=t.clientY-h.y,r=window.innerWidth,s=window.innerHeight,d=(null==a?void 0:a())??!1;let u=h.width,p=h.height,f=h.posX,v=h.posY;if(d){if(e.get(l).includes("e")||e.get(l).includes("w")){const t=e.get(l).includes("e")?i:-i;u=Math.max(280,h.width+2*t),f=h.centerX-u/2}if(e.get(l).includes("s")||e.get(l).includes("n")){const t=e.get(l).includes("s")?o:-o;p=Math.max(200,h.height+2*t),v=h.centerY-p/2}}else{if(e.get(l).includes("e")){const e=r-f;u=Math.max(280,Math.min(h.width+i,e))}if(e.get(l).includes("w")){const e=h.width-280,t=Math.min(i,e);u=h.width-t,f=h.posX+t}if(e.get(l).includes("s")){const e=s-v;p=Math.max(200,Math.min(h.height+o,e))}if(e.get(l).includes("n")){const e=h.height-200,t=Math.min(o,e);p=h.height-t,v=h.posY+t}}const w=c(f,v,u,p);e.set(g,{width:w.width,height:w.height},!0),n({x:w.x,y:w.y})}function w(t){t.pointerId===m&&(e.set(d,!1),m=null,window.removeEventListener("pointermove",v),window.removeEventListener("pointerup",w),window.removeEventListener("pointercancel",w),e.set(p,!0),s(i(),e.get(g)),setTimeout(()=>{e.set(p,!1)},0))}const y={startResize:f};return{get isResizing(){return e.get(d)},get resizeDirection(){return e.get(l)},get size(){return e.get(g)},get hasBeenResized(){return e.get(u)},get isActive(){return e.get(d)},get justFinishedResizing(){return e.get(p)},start:f,setHasBeenResized:()=>{},setSize:function(t){e.set(g,t,!0),e.set(u,!0)},reset:function(){e.set(u,!1),e.set(g,{width:0,height:0},!0)},constrainToViewport:function(){const o=i(),r=t();if(!r)return;const s=c(o.x,o.y,e.get(g).width||r.offsetWidth,e.get(g).height||r.offsetHeight);e.set(g,{width:s.width,height:s.height},!0),n({x:s.x,y:s.y})},handlers:y}}function Me(){return u().features.animations}function Be(t,i,n,o,r,s,a,d,l){let g=e.state(!1),c=e.state(!1),u=e.state(!1),h=e.state(!1),m=e.state(null),f=e.state(null),v=null,w=null;function y(){w&&(clearTimeout(w),w=null)}function x(){const e=t(),i=document.querySelector(`.modal-dock-item[data-modal-id="${p(e)}"]`),n=document.querySelector('[data-dock-container="true"]'),o=i||n;if(o){const e=o.getBoundingClientRect();return{x:e.left+e.width/2,y:e.top+e.height/2}}return{x:window.innerWidth/2,y:window.innerHeight-40}}return e.user_effect(()=>()=>{y(),e.set(g,!1),e.set(c,!1),e.set(u,!1),e.set(h,!1),e.set(m,null),e.set(f,null),v=null}),{get isMinimizing(){return e.get(g)},get isRestoring(){return e.get(c)},get isOpening(){return e.get(u)},get isClosing(){return e.get(h)},get animationTransform(){return e.get(m)},get pendingOpenSource(){return e.get(f)},startMinimize:function(t,p){const h=i();if(e.get(g)||!h)return;if(e.set(c,!1),e.set(u,!1),y(),!Me()){const e=h.getBoundingClientRect();let t=r()?n():{x:e.left,y:e.top},i=a()?d():{width:e.width,height:e.height};return r()||(o(t),s(!0)),void(p?p():l(t,!0,i))}const f=h.getBoundingClientRect(),v=f.left+f.width/2,_=f.top+f.height/2;let b=r()?n():{x:f.left,y:f.top},z=a()?d():{width:f.width,height:f.height};r()||(o(b),s(!0));const k=t??x(),D=k.x-f.left,M=k.y-f.top,B={x:k.x-v,y:k.y-_,originX:D,originY:M};e.set(m,B,!0),requestAnimationFrame(()=>{requestAnimationFrame(()=>{e.set(g,!0)})}),w=setTimeout(()=>{p?p():l(b,!0,z)},500)},startRestore:function(t,i){if(!Me()){const e=t||{x:window.innerWidth/2,y:window.innerHeight/2};return o(e),void s(!0)}const n=x(),r=t||{x:window.innerWidth/2,y:window.innerHeight/2},a=i||{width:480,height:400};o(r),s(!0);const d=r.x+a.width/2,l=r.y+a.height/2,g=n.x-r.x,u=n.y-r.y;e.set(m,{x:n.x-d,y:n.y-l,originX:g,originY:u},!0),e.set(c,!0),setTimeout(()=>{e.set(c,!1),e.set(m,null)},400)},startClose:function(t){e.get(h)||e.get(g)||(Me()?(v=t,e.set(h,!0),setTimeout(()=>{e.set(h,!1),v&&(v(),v=null)},250)):t())},setPendingOpenSource:function(t){e.set(f,t,!0)},tryStartOpenAnimation:function(){const t=i();if(!e.get(f)||!t||e.get(u))return!1;if(!Me())return e.set(f,null),!1;const a=e.get(f);e.set(f,null);const d=t.getBoundingClientRect(),l=r()?n():{x:d.left,y:d.top},g=d.width,c=d.height,p=l.x+g/2,h=l.y+c/2;r()||(o(l),s(!0));const v=a.x-l.x,w=a.y-l.y;return e.set(m,{x:a.x-p,y:a.y-h,originX:v,originY:w},!0),e.set(u,!0),setTimeout(()=>{e.set(u,!1),e.set(m,null)},400),!0},forceClearMinimize:function(){y(),e.set(g,!1),e.set(m,null)}}}const Ie=["button:not([disabled])","[href]","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(", ");function Ce(e){return Array.from(e.querySelectorAll(Ie)).filter(e=>null!==e.offsetParent||"A"===e.tagName)}function Ee(e,t){if("Tab"!==e.key)return;const i=Ce(t);if(0===i.length)return void e.preventDefault();const n=i[0],o=i[i.length-1],r=document.activeElement;e.shiftKey?r===n&&(o.focus(),e.preventDefault()):r===o&&(n.focus(),e.preventDefault())}function Re(e){const t=Ce(e);return t.length>0&&(t[0].focus(),!0)}function Pe(){return{trapFocus:Ee,focusFirstElement:Re}}const Te="modal-portal";function Le(){return{mount:function(e,t=null){const i=function(e){if("undefined"==typeof window)return null;if(e instanceof HTMLElement)return e;if("string"==typeof e){const t=document.querySelector(e);if(t)return t;if(e.startsWith("#")){const t=e.slice(1),i=document.createElement("div");return i.id=t,document.body.appendChild(i),i}}let t=document.getElementById(Te);return t||(t=document.createElement("div"),t.id=Te,document.body.appendChild(t)),t}(t);return i?(i.appendChild(e),()=>{e.parentNode===i&&i.removeChild(e),i.id!==Te&&0===i.children.length&&i.parentNode&&i.parentNode.removeChild(i)}):()=>{}}}}function $e(e){const t=le(_e),i=e??t;if(!i)throw new Error("useModalZIndex: No modal ID provided and no modal context found. Either pass a modal ID or use this hook inside a Modal component.");return{get zIndex(){const e=h(i);return((null==e?void 0:e.zIndex)??u().zIndex.base)+1},get portalTarget(){return u().portalTarget}}}function Se(){function t(e,t,i){return"undefined"==typeof window?()=>{}:(window.addEventListener(e,t,i),()=>{window.removeEventListener(e,t,i)})}return{addListener:t,addListenerEffect:function(i,n,o){e.user_effect(()=>{if("undefined"!=typeof window)return t(i,n,o)})}}}var He=e.from_html('<div style="display: contents;"><!></div>');function Oe(t,i){e.push(i,!0);let n=e.prop(i,"target",3,"body"),o=null,r=null;const{mount:s}=Le();ge(()=>(o&&(r=s(o,n())),()=>{null==r||r()}));var a=He(),d=e.child(a);e.snippet(d,()=>i.children),e.reset(a),e.bind_this(a,e=>o=e,()=>o),e.append(t,a),e.pop()}var Xe=e.from_html('<button type="button" aria-label="Minimize"></button>'),Ye=e.from_html('<button type="button" class="modal-header-light modal-header-light-style" aria-label="Toggle style"></button>'),Fe=e.from_html('<div class="modal-header-icon"><!></div>'),We=e.from_html('<div class="modal-header-icon"><!></div>'),Ae=e.from_html('<h2 class="modal-header-title"> </h2>'),qe=e.from_html('<h2 class="modal-header-title"> </h2>'),je=e.from_html('<div class="modal-header-traffic-lights"><button type="button" class="modal-header-light modal-header-light-close" aria-label="Close"></button> <!> <!></div> <div class="modal-header-mac-center"><!> <div class="modal-header-title-group"><!></div></div> <div class="modal-header-mac-spacer"></div>',1),Ne=e.from_html('<div class="modal-header-icon"><!></div>'),Ge=e.from_html('<div class="modal-header-icon"><!></div>'),Ke=e.from_html('<h2 class="modal-header-title"> </h2>'),Ue=e.from_html('<h2 class="modal-header-title"> </h2>'),Ve=e.from_html('<button type="button" class="modal-header-btn-windows modal-header-btn-windows-style" aria-label="Toggle style">&#9671;</button>'),Ze=e.from_html('<button type="button" aria-label="Minimize">&#8211;</button>'),Je=e.from_html('<div class="modal-header-title-group"><!> <!></div> <div class="modal-header-actions"><!> <!> <button type="button" class="modal-header-btn-windows modal-header-btn-windows-close" aria-label="Close">&times;</button></div>',1),Qe=e.from_html("<header><!></header>");function et(t,i){e.push(i,!0);let n=e.prop(i,"isTransparent",3,!1),o=e.prop(i,"headerLayout",3,"macos"),r=e.prop(i,"minimizable",3,!0),s=e.prop(i,"minimizeDisabled",3,!1),a=e.prop(i,"transparencyEnabled",3,!0);const d=le(xe),l=e.derived(()=>null==d?void 0:d()),g=e.derived(()=>"macos"===o());var c=Qe();let u;c.__pointerdown=function(e){var t;e.target.closest("button")||null==(t=i.onStartDrag)||t.call(i,e)};var p=e.child(c),h=t=>{var n=je(),o=e.first_child(n),d=e.child(o);d.__click=function(...e){var t;null==(t=i.onClose)||t.apply(this,e)};var g=e.sibling(d,2),c=t=>{var n=Xe();let o;n.__click=function(...e){var t;null==(t=s()?void 0:i.onMinimize)||t.apply(this,e)},e.template_effect(()=>{o=e.set_class(n,1,"modal-header-light modal-header-light-minimize",null,o,{"modal-header-light-disabled":s()}),n.disabled=s(),e.set_attribute(n,"title",s()?"Enable dock to minimize":void 0)}),e.append(t,n)};e.if(g,e=>{r()&&e(c)});var u=e.sibling(g,2),p=t=>{var n=Ye();n.__click=function(...e){var t;null==(t=i.onToggleStyle)||t.apply(this,e)},e.append(t,n)};e.if(u,e=>{a()&&e(p)}),e.reset(o);var h=e.sibling(o,2),m=e.child(h),f=t=>{var n=Fe(),o=e.child(n);e.snippet(o,()=>i.customIcon),e.reset(n),e.append(t,n)},v=t=>{var n=e.comment(),o=e.first_child(n),r=t=>{var n=We(),o=e.child(n);e.snippet(o,()=>e.get(l),()=>i.icon),e.reset(n),e.append(t,n)};e.if(o,t=>{i.icon&&e.get(l)&&t(r)},!0),e.append(t,n)};e.if(m,e=>{i.customIcon?e(f):e(v,!1)});var w=e.sibling(m,2),y=e.child(w),x=t=>{var n=Ae(),o=e.child(n,!0);e.reset(n),e.template_effect(()=>{e.set_attribute(n,"id",i.titleId),e.set_text(o,i.title)}),e.append(t,n)},_=t=>{var n=qe(),o=e.child(n,!0);e.reset(n),e.template_effect(()=>e.set_text(o,i.title)),e.append(t,n)};e.if(y,e=>{i.titleId?e(x):e(_,!1)}),e.reset(w),e.reset(h),e.next(2),e.append(t,n)},m=t=>{var n=Je(),o=e.first_child(n),d=e.child(o),g=t=>{var n=Ne(),o=e.child(n);e.snippet(o,()=>i.customIcon),e.reset(n),e.append(t,n)},c=t=>{var n=e.comment(),o=e.first_child(n),r=t=>{var n=Ge(),o=e.child(n);e.snippet(o,()=>e.get(l),()=>i.icon),e.reset(n),e.append(t,n)};e.if(o,t=>{i.icon&&e.get(l)&&t(r)},!0),e.append(t,n)};e.if(d,e=>{i.customIcon?e(g):e(c,!1)});var u=e.sibling(d,2),p=t=>{var n=Ke(),o=e.child(n,!0);e.reset(n),e.template_effect(()=>{e.set_attribute(n,"id",i.titleId),e.set_text(o,i.title)}),e.append(t,n)},h=t=>{var n=Ue(),o=e.child(n,!0);e.reset(n),e.template_effect(()=>e.set_text(o,i.title)),e.append(t,n)};e.if(u,e=>{i.titleId?e(p):e(h,!1)}),e.reset(o);var m=e.sibling(o,2),f=e.child(m),v=t=>{var n=Ve();n.__click=function(...e){var t;null==(t=i.onToggleStyle)||t.apply(this,e)},e.append(t,n)};e.if(f,e=>{a()&&e(v)});var w=e.sibling(f,2),y=t=>{var n=Ze();let o;n.__click=function(...e){var t;null==(t=s()?void 0:i.onMinimize)||t.apply(this,e)},e.template_effect(()=>{o=e.set_class(n,1,"modal-header-btn-windows",null,o,{"modal-header-btn-windows-disabled":s()}),n.disabled=s(),e.set_attribute(n,"title",s()?"Enable dock to minimize":void 0)}),e.append(t,n)};e.if(w,e=>{r()&&e(y)}),e.sibling(w,2).__click=function(...e){var t;null==(t=i.onClose)||t.apply(this,e)},e.reset(m),e.append(t,n)};e.if(p,t=>{e.get(g)?t(h):t(m,!1)}),e.reset(c),e.template_effect(()=>u=e.set_class(c,1,"modal-header",null,u,{"modal-header-draggable":!!i.onStartDrag,transparent:n()})),e.append(t,c),e.pop()}e.delegate(["pointerdown","click"]);var tt=e.from_html("<div></div>"),it=e.from_html('<div class="modal-resize-handles"></div>');function nt(t,i){e.push(i,!0);const n=["n","s","e","w","ne","nw","se","sw"];var o=e.comment(),r=e.first_child(o),s=t=>{var o=it();e.each(o,21,()=>n,e.index,(t,n)=>{var o=tt();o.__pointerdown=t=>function(e,t){var n;null==(n=i.onStartResize)||n.call(i,e,t)}(t,e.get(n)),e.template_effect(()=>e.set_class(o,1,`modal-resize-handle modal-resize-${e.get(n)??""}`)),e.append(t,o)}),e.reset(o),e.append(t,o)};e.if(r,e=>{i.onStartResize&&e(s)}),e.append(t,o),e.pop()}function ot(e,t){return t&&e.appendChild(t),{update(t){e.innerHTML="",t&&e.appendChild(t)},destroy(){e.innerHTML=""}}}e.delegate(["pointerdown"]);var rt=e.from_html('<div class="modal-footer"><!></div>'),st=e.from_html("<div></div>"),at=e.from_html('<div role="dialog" aria-modal="true" tabindex="-1"><!> <div class="modal-body"><!></div> <!> <!> <!></div>');function dt(t,i){e.push(i,!0);let n=e.prop(i,"maxWidth",3,"600px"),o=e.prop(i,"autoOpen",3,!1),a=e.prop(i,"closeOnEscape",3,!0),l=e.state(!1);ge(()=>{Z({id:i.id,title:i.title,icon:i.icon??"",isOpen:o(),isMinimized:!1,isHiddenWithParent:!1,isTransparent:!1,isRejected:!1,position:null,size:null,hasBeenDragged:!1,dockPosition:0,glow:i.glow??null,parentId:void 0,childId:void 0,offsetFromParent:void 0}),e.set(l,!0)}),pe(()=>{b(i.id)});const c=e.derived(()=>{if(!e.get(l))return!1;f();const t=h(i.id);return!!t&&(t.isOpen||t.isMinimized||$(i.id)||v(i.id)||w(i.id))});var te=e.comment(),ie=e.first_child(te),ne=t=>{!function(t,i){e.push(i,!0);let n=e.prop(i,"maxWidth",3,"600px"),o=e.prop(i,"autoOpen",3,!1),a=e.prop(i,"closeOnEscape",3,!0),l=e.prop(i,"skipRegistration",3,!1);ce(_e,()=>i.id);const c=u().portalTarget,te=e.derived(()=>p(i.id));function ie(e){var t,n;return(null==(n=null==(t=i.config)?void 0:t.features)?void 0:n[e])??z(e)}const ne=e.derived(()=>(m(),ie("drag"))),oe=e.derived(()=>(m(),ie("minimize"))),re=e.derived(()=>(m(),!ie("dock"))),se=e.derived(()=>(m(),ie("transparency"))),ae=e.derived(()=>(m(),ie("resize"))),de=e.derived(()=>{var e,t;return m(),(null==(t=null==(e=i.config)?void 0:e.appearance)?void 0:t.headerLayout)??u().appearance.headerLayout});let le=e.state(null),he=e.state(!1),me=e.state(!1),fe=e.state(!1),ve=e.state(!1),we=e.state(!1);const ye=e.derived(()=>(f(),h(i.id))),xe=e.derived(()=>e.get(ye)&&(e.get(ye).isOpen||v(i.id))&&(!e.get(ye).isMinimized||w(i.id))&&!e.get(ye).isHiddenWithParent),be=e.derived(()=>{var t;return!!(null==(t=e.get(ye))?void 0:t.childId)}),ze=e.derived(()=>{var t;return!!(null==(t=e.get(ye))?void 0:t.parentId)}),Me=e.derived(()=>e.get(be)||e.get(me)),Ie=e.derived(()=>!!i.glow),Ce=e.derived(()=>`modal-title-${e.get(te)}`),Ee=e.derived(()=>{var t;return(null==(t=e.get(ye))?void 0:t.zIndex)??1e3}),Re=ke({x:0,y:0});let Te=e.state(!1);const Le=De(()=>e.get(le),()=>Re.position,e=>Re.setPosition(e),()=>Re.hasBeenDragged,e=>Re.setHasBeenDragged(e),(t,n)=>{const o=h(i.id);if(null==o?void 0:o.parentId){const t=h(o.parentId),r=document.querySelector(`[data-modal-id="${p(o.parentId)}"]`);if(t&&r){const o=t.position??{x:r.getBoundingClientRect().left,y:r.getBoundingClientRect().top},s=t.size??{width:r.offsetWidth,height:r.offsetHeight},a={x:o.x+(s.width-n.width)/2,y:o.y+(s.height-n.height)/2};e.set(Te,!0),Re.setPosition(a);const d={x:a.x-o.x,y:a.y-o.y};return C(i.id,{position:a,size:n,hasBeenDragged:!0,offsetFromParent:d}),void setTimeout(()=>{e.set(Te,!1)},200)}}C(i.id,{position:t,size:n,hasBeenDragged:!0})}),$e=Be(()=>i.id,()=>e.get(le),()=>Re.position,e=>Re.setPosition(e),()=>Re.hasBeenDragged,e=>Re.setHasBeenDragged(e),()=>Le.hasBeenResized,()=>Le.size,(e,t,n)=>{C(i.id,{position:e,size:n,hasBeenDragged:t}),r(i.id)}),{trapFocus:Se,focusFirstElement:He}=Pe(),Xe=e.derived(()=>$e.isMinimizing||$e.isRestoring||$e.isOpening||$e.isClosing),Ye=e.derived(()=>(y(i.id)||x(i.id))&&!$e.isRestoring);let Fe=e.state(!1);const We=e.derived(()=>$e.isRestoring||$e.isOpening||e.get(Fe)),Ae=e.derived(()=>e.get(xe)&&!Re.hasBeenDragged&&!e.get(Xe)&&!$e.pendingOpenSource&&!e.get(Ye)),qe=e.derived(()=>{const t=[];return t.push(`z-index: ${e.get(Ee)};`),$e.animationTransform?(t.push(`left: ${Re.position.x}px; top: ${Re.position.y}px;`),t.push(`--genie-origin-x: ${$e.animationTransform.originX}px;`),t.push(`--genie-origin-y: ${$e.animationTransform.originY}px;`),t.push(`--genie-translate-x: ${$e.animationTransform.x}px;`),t.push(`--genie-translate-y: ${$e.animationTransform.y}px;`)):Re.hasBeenDragged&&t.push(`left: ${Re.position.x}px; top: ${Re.position.y}px; transform: none;`),Le.hasBeenResized?t.push(`width: ${Le.size.width}px; height: ${Le.size.height}px; max-width: none; max-height: none;`):(i.preferredHeight&&t.push(`min-height: ${i.preferredHeight};`),n()&&t.push(`max-width: ${n()};`)),e.get(Ie)&&i.glow&&(t.push(`--modal-glow-color: ${i.glow.color};`),t.push(`--modal-glow-intensity: ${i.glow.intensity};`)),t.join(" ")});function je(){e.get(oe)&&r(i.id)}function Ne(){var e;M(i.id)&&B(i.id),s(i.id),null==(e=i.onClose)||e.call(i)}function Ge(){Q(i.id)}function Ke(t){e.get(ne)&&e.get(le)&&Re.onPointerDown(t,e.get(le))}function Ue(e){a()&&"Escape"===e.key&&J(i.id)&&(e.stopPropagation(),Ne())}function Ve(t){if(!e.get(le))return;const n=Re.isDragging,o=Le.hasBeenResized?Le.size:{width:e.get(le).offsetWidth,height:e.get(le).offsetHeight};Re.onPointerMove(t,e.get(le),o),Re.isDragging&&n&&k(i.id,Re.position,{drag:!0})}function Ze(t){if(!e.get(le))return;const n=Re.isDragging;Re.onPointerUp(t,e.get(le)),n&&!Le.justFinishedResizing&&(k(i.id,Re.position,{drag:!0}),D(i.id))}function Je(){var t;const n=u();if("smart"!==(null==(t=n.positioning)?void 0:t.strategy))return!1;const o=h(i.id),r=A();if((null==o?void 0:o.parentId)||r&&r.childId===i.id)return!1;if((null==o?void 0:o.hasBeenDragged)||(null==o?void 0:o.position))return!1;const s=e.get(le)||document.querySelector(`[data-modal-id="${e.get(te)}"]`);if(!s)return!1;const a=s.offsetWidth,d=s.offsetHeight;if(a<=0||d<=0)return!1;const l=n.positioning.modalGap??16,g=q(i.id),c=j(n.positioning.avoidElements??[]),p=N(a,d,g,{modalGap:l,avoidBounds:c});if(G(p.x,p.y,a,d,g,l)/(a*d)>.1&&g.length>0){const e=K(i.id),t=U(a,d,e,{modalGap:l});if(t&&t.existingModalMoves.size>0)return V(t.existingModalMoves),Re.setPosition(t.newModalPosition),Re.setHasBeenDragged(!0),k(i.id,t.newModalPosition,{size:{width:a,height:d}}),!0}return Re.setPosition(p),Re.setHasBeenDragged(!0),k(i.id,p,{size:{width:a,height:d}}),!0}function Qe(){ue().then(()=>ue()).then(()=>{let t=0;const i=()=>{t+=1,Je()||t>5||requestAnimationFrame(i)};e.get(le)?i():requestAnimationFrame(i)})}ge(()=>{var t;function n(){const t=h(i.id);if(!(null==t?void 0:t.position)||!e.get(le))return;if(t.parentId)return;const n=Le.hasBeenResized?Le.size.width:e.get(le).offsetWidth,o=Le.hasBeenResized?Le.size.height:e.get(le).offsetHeight;if(n<=0||o<=0)return;const r=g(t.position.x,t.position.y,n,o);(Math.abs(r.x-t.position.x)>1||Math.abs(r.y-t.position.y)>1)&&(Re.setPosition(r),k(i.id,r))}return l()||(t=o(),Z({id:i.id,title:i.title,icon:i.icon??"",isOpen:t,isMinimized:!1,isHiddenWithParent:!1,isTransparent:!1,isRejected:!1,position:null,size:null,hasBeenDragged:!1,dockPosition:0,glow:i.glow??null,parentId:void 0,childId:void 0,offsetFromParent:void 0}),t&&d(i.id)),o()&&(ue().then(()=>{e.get(le)&&He(e.get(le))}),Qe()),window.addEventListener("pointermove",Ve),window.addEventListener("pointerup",Ze),window.addEventListener("resize",n),()=>{window.removeEventListener("pointermove",Ve),window.removeEventListener("pointerup",Ze),window.removeEventListener("resize",n)}}),pe(()=>{_(i.id),l()||b(i.id)}),e.user_effect(()=>{f();const t=h(i.id);if(t){if(e.set(he,t.isTransparent,!0),!Re.isDragging&&!Le.isResizing&&t.position){const e=Re.position,i=t.position;(Math.abs(e.x-i.x)>.5||Math.abs(e.y-i.y)>.5)&&(Re.setPosition(i),t.hasBeenDragged&&Re.setHasBeenDragged(!0))}ue().then(()=>function(){var t;if(!h(i.id))return;if(M(i.id))return B(i.id),void(null==(t=i.onClose)||t.call(i));if(w(i.id)&&!e.get(ve)){if(e.set(ve,!0),I(),e.get(le)){const t=e.get(le).getBoundingClientRect(),n=Re.hasBeenDragged?Re.position:{x:t.left,y:t.top},o=Le.hasBeenResized?Le.size:{width:t.width,height:t.height};C(i.id,{position:n,size:o,hasBeenDragged:!0})}$e.startMinimize(void 0,()=>{E(i.id),e.set(ve,!1)})}if(x(i.id)){R(i.id);const t=h(i.id);$e.startRestore((null==t?void 0:t.position)??void 0,(null==t?void 0:t.size)??void 0),ue().then(()=>{e.get(le)&&He(e.get(le))})}if(y(i.id)){P(i.id);const e=h(i.id);$e.startRestore((null==e?void 0:e.position)??void 0,(null==e?void 0:e.size)??void 0)}if(v(i.id)&&(T(i.id),$e.startClose(()=>{var e;_(i.id),L(i.id),null==(e=i.onClose)||e.call(i)})),$(i.id)){S(i.id);const t=H(i.id)||i.openSourcePosition||null;t?($e.setPendingOpenSource(t),ue().then(()=>ue()).then(()=>{Je(),$e.tryStartOpenAnimation()})):Qe(),ue().then(()=>{e.get(le)&&He(e.get(le))})}O(i.id)&&(X(i.id),Y(i.id),e.set(we,!0),setTimeout(()=>{e.set(we,!1),F(i.id)},600));const n=W(i.id);var o;n&&e.get(le)&&(o=n.parentId,ue().then(()=>ue()).then(()=>{let t=0;const n=()=>{t+=1;const r=function(t){var n,o;const r=h(t);if(!r)return!1;const s=e.get(le)||document.querySelector(`[data-modal-id="${e.get(te)}"]`),a=document.querySelector(`[data-modal-id="${p(t)}"]`),d=null==a?void 0:a.getBoundingClientRect(),l=r.position??(d?{x:d.left,y:d.top}:null);if(!l||!s)return!1;const g=(null==(n=r.size)?void 0:n.width)??(null==a?void 0:a.offsetWidth)??(null==d?void 0:d.width)??480,c=(null==(o=r.size)?void 0:o.height)??(null==a?void 0:a.offsetHeight)??(null==d?void 0:d.height)??400,u=s.offsetWidth,m=s.offsetHeight;if(g<=0||c<=0||u<=0||m<=0)return!1;const f={x:l.x+(g-u)/2,y:l.y+(c-m)/2};return Re.setPosition(f),Re.setHasBeenDragged(!0),k(i.id,f,{size:{width:u,height:m}}),r.position&&r.size||!d||k(t,{x:d.left,y:d.top},{size:{width:g,height:c}}),ee(t,i.id),!0}(o);r||t>5||requestAnimationFrame(n)};e.get(le)?n():requestAnimationFrame(n)}))}())}}),e.user_effect(()=>{const t=h(i.id);t&&t.isTransparent!==e.get(he)&&e.set(he,t.isTransparent,!0)}),e.user_effect(()=>{if(e.get(xe)&&e.get(le)){const t=t=>function(t){e.get(le)&&Se(t,e.get(le))}(t);return e.get(le).addEventListener("keydown",t),()=>{var i;return null==(i=e.get(le))?void 0:i.removeEventListener("keydown",t)}}}),e.user_effect(()=>{!e.get(xe)&&$e.isMinimizing&&$e.forceClearMinimize()}),e.user_effect(()=>{$e.isRestoring||$e.isOpening?e.set(Fe,!0):e.get(Fe)&&requestAnimationFrame(()=>{e.set(Fe,!1)})}),e.user_effect(()=>{e.get(fe)&&!e.get(be)&&(e.set(me,!0),setTimeout(()=>{e.set(me,!1)},200)),e.set(fe,e.get(be),!0)});var tt=e.comment(),it=e.first_child(tt),dt=t=>{Oe(t,{get target(){return c},children:(t,n)=>{var o=at();let r;o.__keydown=Ue;var s=e.child(o);{let t=e.derived(()=>e.get(ne)?Ke:void 0);et(s,{get title(){return i.title},get customIcon(){return i.customIcon},get icon(){return i.icon},get isTransparent(){return e.get(he)},get titleId(){return e.get(Ce)},get headerLayout(){return e.get(de)},get onStartDrag(){return e.get(t)},onToggleStyle:Ge,onMinimize:je,onClose:Ne,get minimizable(){return e.get(oe)},get minimizeDisabled(){return e.get(re)},get transparencyEnabled(){return e.get(se)}})}var a=e.sibling(s,2),l=e.child(a);e.snippet(l,()=>i.children??e.noop),e.reset(a),e.action(a,(e,t)=>null==ot?void 0:ot(e,t),()=>i.bodyElement);var g=e.sibling(a,2),c=t=>{var n=rt(),o=e.child(n),r=t=>{var n=e.comment(),o=e.first_child(n);e.snippet(o,()=>i.footer),e.append(t,n)};e.if(o,e=>{i.footer&&e(r)}),e.reset(n),e.action(n,(e,t)=>null==ot?void 0:ot(e,t),()=>i.footerElement),e.append(t,n)};e.if(g,e=>{(i.footer||i.footerElement)&&e(c)});var u=e.sibling(g,2);{let t=e.derived(()=>e.get(ae)&&!e.get(be)?Le.handlers.startResize:void 0);nt(u,{get onStartResize(){return e.get(t)}})}var p=e.sibling(u,2),h=t=>{var i=st();let n;e.template_effect(()=>n=e.set_class(i,1,"modal-child-overlay",null,n,{"modal-overlay-closing":e.get(me)})),e.append(t,i)};e.if(p,t=>{e.get(Me)&&t(h)}),e.reset(o),e.bind_this(o,t=>e.set(le,t),()=>e.get(le)),e.template_effect(()=>{var t;r=e.set_class(o,1,"modal-dialog",null,r,{"modal-dragging":Re.isDragging,"modal-resizing":Le.isResizing,"modal-positioned":Re.hasBeenDragged,"modal-minimizing":$e.isMinimizing,"modal-restoring":$e.isRestoring,"modal-opening":$e.isOpening,"modal-closing":$e.isClosing,"modal-centered":e.get(Ae),"modal-solid":!e.get(he),"modal-transparent":e.get(he),"modal-glow":e.get(Ie),"modal-has-child":e.get(be),"modal-is-child":e.get(ze),"modal-visible-by-animation":e.get(We),"modal-animating-to-center":e.get(Te),"modal-animating-position":null==(t=e.get(ye))?void 0:t.isAnimatingPosition,"modal-attention":e.get(we)}),e.set_attribute(o,"data-modal-id",e.get(te)),e.set_style(o,e.get(qe)),e.set_attribute(o,"aria-labelledby",e.get(Ce))}),e.event("pointerdown",o,()=>d(i.id),!0),e.append(t,o)},$$slots:{default:!0}})};e.if(it,t=>{e.get(xe)&&t(dt)}),e.append(t,tt),e.pop()}(t,{get id(){return i.id},get title(){return i.title},get icon(){return i.icon},get customIcon(){return i.customIcon},get maxWidth(){return n()},get preferredHeight(){return i.preferredHeight},get autoOpen(){return o()},get openSourcePosition(){return i.openSourcePosition},get glow(){return i.glow},get config(){return i.config},get closeOnEscape(){return a()},get onClose(){return i.onClose},get children(){return i.children},get footer(){return i.footer},skipRegistration:!0})};e.if(ie,t=>{e.get(c)&&t(ne)}),e.append(t,te),e.pop()}e.delegate(["keydown"]);var lt=e.from_html('<button type="button" aria-label="Drag dock"></button>'),gt=e.from_html('<span class="modal-dock-item-icon-placeholder"> </span>'),ct=e.from_html('<span class="modal-dock-item-label"> </span>'),ut=e.from_html("<span>+</span>"),pt=e.from_html('<span class="modal-dock-child-indicator"><!></span>'),ht=e.from_html('<button><span class="modal-dock-item-icon"><!></span> <!> <span class="modal-dock-item-glow"></span> <!></button>'),mt=e.from_html('<div data-dock-container="true"><div><!> <!></div></div>');function ft(t,i){e.push(i,!0);const n=le(xe),r=e.derived(()=>i.renderIcon??(null==n?void 0:n())),s=ie(),a=e.derived(()=>(m(),u())),d=e.derived(()=>te("DOCK")),l=e.derived(()=>e.get(a).dock.position),c=e.derived(()=>e.get(a).dock.labelMode);let h=e.state("horizontal"),v=e.state(e.proxy({x:100,y:100})),w=e.state(null),y=e.state(!1),x={x:0,y:0},_=null;const b=e.derived(()=>(f(),Array.from(s.modals.values()).filter(e=>e.isMinimized).sort((e,t)=>e.dockPosition-t.dockPosition))),z=e.derived(()=>{switch(e.get(l)){case"left":return{x:-20,duration:250,easing:we};case"right":return{x:20,duration:250,easing:we};default:return{y:20,duration:250,easing:we}}});function k(t){var i;"free"===e.get(l)&&(e.set(y,!0),_=t.pointerId,x={x:t.clientX-e.get(v).x,y:t.clientY-e.get(v).y},null==(i=t.currentTarget)||i.setPointerCapture(t.pointerId),window.addEventListener("pointermove",D),window.addEventListener("pointerup",M),window.addEventListener("pointercancel",M))}function D(t){if(t.pointerId!==_||!e.get(w))return;const i=e.get(w).getBoundingClientRect(),n=window.innerWidth-i.width-8,o=window.innerHeight-i.height-8,r=Math.min(Math.max(t.clientX-x.x,8),Math.max(8,n)),s=Math.min(Math.max(t.clientY-x.y,8),Math.max(8,o));e.set(v,{x:Math.round(r),y:Math.round(s)},!0)}function M(t){t.pointerId===_&&(e.set(y,!1),_=null,window.removeEventListener("pointermove",D),window.removeEventListener("pointerup",M),window.removeEventListener("pointercancel",M))}const{addListener:B}=Se();function I(){if("free"!==e.get(l)||!e.get(w))return;const t=e.get(w).getBoundingClientRect(),i=g(e.get(v).x,e.get(v).y,t.width,t.height);i.x===e.get(v).x&&i.y===e.get(v).y||e.set(v,{x:Math.round(i.x),y:Math.round(i.y)},!0)}e.user_effect(()=>{"undefined"!=typeof window&&B("resize",I)});var C={setDockOrientation:function(t){e.set(h,t,!0)},setDockFreePosition:function(t){e.set(v,t,!0)},getDockState:function(){return{dockPosition:e.get(l),dockOrientation:e.get(h),dockFreePosition:e.get(v),dockLabelMode:e.get(c)}}};return Oe(t,{get target(){return e.get(a).portalTarget},children:(t,i)=>{var n=mt();let a,g;var u=e.child(n);let m;var f=e.child(u),x=t=>{var i=lt();let n;i.__pointerdown=k,e.template_effect(()=>n=e.set_class(i,1,"modal-dock-handle",null,n,{"modal-dock-handle-dragging":e.get(y)})),e.append(t,i)};e.if(f,t=>{"free"===e.get(l)&&t(x)});var _=e.sibling(f,2);e.each(_,19,()=>e.get(b),e=>e.id,(t,i,n)=>{const a=e.derived(()=>e.get(i).lastChildId?s.modals.get(e.get(i).lastChildId):null);var d=ht();let l;d.__click=t=>{ne(e.get(i).id)?oe(t.currentTarget):o(e.get(i).id)};var g=e.child(d),u=e.child(g),h=t=>{var n=e.comment(),o=e.first_child(n);e.snippet(o,()=>e.get(r),()=>e.get(i).icon),e.append(t,n)},m=t=>{var n=gt(),o=e.child(n,!0);e.reset(n),e.template_effect(t=>e.set_text(o,t),[()=>e.get(i).title.charAt(0)]),e.append(t,n)};e.if(u,t=>{e.get(i).icon&&e.get(r)?t(h):t(m,!1)}),e.reset(g);var f=e.sibling(g,2),v=t=>{var n=ct(),o=e.child(n,!0);e.reset(n),e.template_effect(()=>e.set_text(o,e.get(i).title)),e.append(t,n)};e.if(f,t=>{"hidden"!==e.get(c)&&t(v)});var w=e.sibling(f,4),y=t=>{var i=pt(),n=e.child(i),o=t=>{var i=e.comment(),n=e.first_child(i);e.snippet(n,()=>e.get(r),()=>e.get(a).icon),e.append(t,i)},s=t=>{var i=ut();e.append(t,i)};e.if(n,t=>{e.get(a).icon&&e.get(r)?t(o):t(s,!1)}),e.reset(i),e.append(t,i)};e.if(w,t=>{e.get(i).lastChildId&&e.get(a)&&t(y)}),e.reset(d),e.template_effect(t=>{l=e.set_class(d,1,"modal-dock-item",null,l,{"modal-dock-item-has-glow":!!e.get(i).glow,"modal-dock-item-has-child":!!e.get(i).lastChildId,"modal-dock-item-label-beside":"beside"===e.get(c),"modal-dock-item-label-below":"below"===e.get(c)}),e.set_attribute(d,"data-modal-id",t),e.set_style(d,e.get(i).glow?`--modal-dock-glow-color: ${e.get(i).glow.color};`:"")},[()=>p(e.get(i).id)]),e.transition(3,d,()=>me,()=>({duration:300,delay:50*e.get(n),easing:ye,start:.5})),e.append(t,d)}),e.reset(u),e.reset(n),e.bind_this(n,t=>e.set(w,t),()=>e.get(w)),e.template_effect(()=>{a=e.set_class(n,1,"modal-dock-container",null,a,{"modal-dock-left":"left"===e.get(l),"modal-dock-right":"right"===e.get(l),"modal-dock-bottom":"bottom"===e.get(l),"modal-dock-free":"free"===e.get(l),"modal-dock-empty":0===e.get(b).length}),g=e.set_style(n,"free"===e.get(l)?`left: ${e.get(v).x}px; top: ${e.get(v).y}px;`:"",g,{"z-index":e.get(d)}),m=e.set_class(u,1,"modal-dock",null,m,{"modal-dock-free-horizontal":"free"===e.get(l)&&"horizontal"===e.get(h),"modal-dock-free-vertical":"free"===e.get(l)&&"vertical"===e.get(h)})}),e.transition(3,n,()=>fe,()=>e.get(b).length>0?e.get(z):{duration:0}),e.append(t,n)},$$slots:{default:!0}}),e.pop(C)}e.delegate(["pointerdown","click"]);var vt=e.from_html('<div class="modal-backdrop svelte-1d3nq4t" aria-hidden="true"></div>');function wt(t,i){e.push(i,!0);const n=ie(),o=e.derived(()=>(m(),u())),r=e.derived(()=>e.get(o).features.backdrop),s=e.derived(()=>(f(),Array.from(n.modals.values()).some(e=>e.isOpen&&!e.isMinimized&&!e.isHiddenWithParent))),a=e.derived(()=>e.get(r)&&e.get(s)),d=e.derived(()=>te("MODAL")-1);Oe(t,{get target(){return e.get(o).portalTarget},children:(t,i)=>{var n=e.comment(),o=e.first_child(n),r=t=>{var i=vt();let n;e.template_effect(()=>n=e.set_style(i,"",n,{"z-index":e.get(d)})),e.transition(3,i,()=>ve,()=>({duration:200})),e.append(t,i)};e.if(o,t=>{e.get(a)&&t(r)}),e.append(t,n)},$$slots:{default:!0}}),e.pop()}var yt=e.from_html("<!> <!>",1);function xt(t,i){e.push(i,!0),ce(xe,()=>i.renderIcon),e.user_effect(()=>(he(()=>{i.config&&re(i.config),se()}),()=>{ae(),de()})),e.user_effect(()=>{if("undefined"==typeof document)return;const e=he(()=>u().portalTarget);if("string"==typeof e&&!document.querySelector(e)){const t=document.createElement("div");return t.id=e.replace("#",""),document.body.appendChild(t),()=>{t.remove()}}});var n=yt(),o=e.first_child(n);wt(o,{});var r=e.sibling(o,2);e.snippet(r,()=>i.children??e.noop),e.append(t,n),e.pop()}export{wt as B,ft as D,dt as M,Oe as P,nt as R,xt as a,et as b,ke as c,De as d,Be as e,Re as f,Pe as g,Le as h,$e as i,Se as j,Ee as t,ze as u};
package/dist/vanilla.js CHANGED
@@ -1 +1 @@
1
- import{onMount as e,getContext as t,setContext as i,tick as n,onDestroy as o,mount as r,unmount as d}from"svelte";import"svelte/internal/disclose-version";import*as s from"svelte/internal/client";import{scale as a,fly as l,fade as c}from"svelte/transition";import{cubicOut as g,backOut as u}from"svelte/easing";const h={features:{dock:!0,minimize:!0,transparency:!0,resize:!0,drag:!0,focusTrap:!0,animations:!0,backdrop:!0,parentChild:!0},dock:{position:"bottom",labelMode:"beside",enableReorder:!0,enableFreeDrag:!0},animations:{open:400,close:250,minimize:500,restore:400},appearance:{headerLayout:"macos",defaultWidth:"480px",defaultHeight:"auto",minWidth:280,minHeight:200},zIndex:{base:400,dock:8e3,toast:9e3},parentChild:{movementMode:"animated",animationDuration:300},positioning:{strategy:"smart",modalGap:16,avoidElements:[]},portalTarget:"#modal-portal"};let p={...h},f=s.state(0);function m(){return s.get(f)}function v(){return p}function y(e){const t=p;var i,n;p={features:{...(i=h).features,...(n=e).features},dock:{...i.dock,...n.dock},animations:{...i.animations,...n.animations},appearance:{...i.appearance,...n.appearance},zIndex:{...i.zIndex,...n.zIndex},parentChild:{...i.parentChild,...n.parentChild},positioning:{...i.positioning,...n.positioning},portalTarget:n.portalTarget??i.portalTarget},s.update(f),t.features.dock&&!p.features.dock&&(Array.from(C.values()).filter(e=>e.isMinimized).map(e=>e.id).forEach(e=>{const t=C.get(e);if(t){C.set(e,{...t,isMinimized:!1,isOpen:!0}),s.set(L,[...s.get(L),e],!0),te(e);const i=t.lastChildId||t.childId;i&&J(i)}}),s.set(G,[],!0),T())}const w={BASE:0,DROPDOWN:100,STICKY:200,OVERLAY:300,MODAL:400,DOCK:8e3,TOAST:9e3};let x=s.state(s.proxy(w.MODAL));function z(e){const t=v();return"MODAL"===e?t.zIndex.base:"DOCK"===e?t.zIndex.dock:"TOAST"===e?t.zIndex.toast:w[e]}const I=8;function b(e,t,i,n,o={}){const{margin:r=I,allowPartialVisibility:d=!1}=o,s="undefined"!=typeof window?window.innerWidth:1920,a="undefined"!=typeof window?window.innerHeight:1080;let l,c,g,u;return d&&i>s-2*r?(l=40-i,c=s-40):(l=r,c=Math.max(r,s-i-r)),d&&n>a-2*r?(g=40-n,u=a-40):(g=r,u=Math.max(r,a-n-r)),{x:Math.max(l,Math.min(c,e)),y:Math.max(g,Math.min(u,t))}}function _(e,t,i,n,o={}){const{margin:r=I}=o,d=("undefined"!=typeof window?window.innerWidth:1920)-2*r,s=("undefined"!=typeof window?window.innerHeight:1080)-2*r,a=Math.min(i,d),l=Math.min(n,s),c=b(e,t,a,l,o);return{x:c.x,y:c.y,width:a,height:l}}function M(e,t){return Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x))*Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y))}function k(e,t,i,n,o,r){const d={x:e-r,y:t-r,width:i+2*r,height:n+2*r};let s=0;for(const e of o)s+=M(d,e);return s}function D(e,t,i,n,o,r,d){const s=(o-i)/2,a=(r-n)/2,l=s-d,c=a-d,g=Math.abs(e-s)/(l||1),u=Math.abs(t-a)/(c||1),h=Math.sqrt(g*g+u*u)/Math.SQRT2,p=50,f=e-d,m=o-i-d-e,v=t-d,y=r-n-d-t;let w=0;return f<p&&(w+=.3*(1-f/p)),m<p&&(w+=.3*(1-m/p)),v<p&&(w+=.2*(1-v/p)),y<p&&(w+=.2*(1-y/p)),Math.min(1,h+w)}function P(e){return"symbol"==typeof e?e.description??"symbol":e}let C=s.proxy(new Map),B=s.state(0);const O=new Set;function T(){s.update(B),queueMicrotask(()=>{O.forEach(e=>e())})}let R=s.state(s.proxy([])),E=s.state(s.proxy([])),H=s.state(s.proxy([])),S=s.state(s.proxy([])),L=s.state(s.proxy([])),W=s.state(s.proxy([])),A=s.state(s.proxy([])),$=s.state(s.proxy([])),F=s.state(null),X=s.proxy(new Map),Y=s.state(null),q=s.proxy(new Map),N=s.proxy(new Set),j=s.proxy(new Set),G=s.state(s.proxy([]));function K(e){const t=C.get(e.id),i=(null==t?void 0:t.zIndex)??function(){const e=s.get(x);return s.set(x,s.get(x)+2),e}();t?C.set(e.id,{...t,title:e.title,icon:e.icon,glow:e.glow,zIndex:i}):C.set(e.id,{...e,zIndex:i,isAnimating:!1}),T(),e.isMinimized&&!s.get(G).includes(e.id)&&s.get(G).push(e.id)}function V(e){const t=C.get(e);if(t){if(s.set(G,s.get(G).filter(t=>t!==e),!0),t.childId){const e=C.get(t.childId);e&&C.set(t.childId,{...e,parentId:void 0})}if(t.parentId){const e=C.get(t.parentId);e&&C.set(t.parentId,{...e,childId:void 0,lastChildId:t.id})}C.delete(e),T(),j.delete(e),N.delete(e)}}function U(e){const t=C.get(e);if(!t||t.isMinimized)return;if(xe(e),t.parentId){const e=C.get(t.parentId);if(e&&!e.isMinimized)return void U(t.parentId)}s.set(R,[...s.get(R),e],!0),t.position&&t.size;const i=t.childId;C.set(e,{...t,isMinimized:!0,lastChildId:i}),T(),s.get(G).includes(e)||s.get(G).push(e),t.childId&&function(e){const t=C.get(e);if(!(null==t?void 0:t.childId))return;const i=C.get(t.childId);i&&(C.set(t.childId,{...i,isHiddenWithParent:!0}),T())}(e)}function Q(e){const t=C.get(e);if(!t||!t.isMinimized)return;C.set(e,{...t,isMinimized:!1,isOpen:!0}),T(),s.set(L,[...s.get(L),e],!0),te(e);const i=t.lastChildId||t.childId;i&&J(i)}function J(e){const t=C.get(e);t&&t.isHiddenWithParent&&(C.set(e,{...t,isHiddenWithParent:!1}),T(),s.set(W,[...s.get(W),e],!0))}function Z(e,t,i){const n=C.get(e);if(!n)return;let o=t;if((null==i?void 0:i.constrain)&&n.size&&(o=b(t.x,t.y,n.size.width,n.size.height)),C.set(e,{...n,position:o,size:(null==i?void 0:i.size)??n.size,hasBeenDragged:n.hasBeenDragged||(null==i?void 0:i.drag)||!1}),n.childId){let t=e,i=o;for(;;){const e=C.get(t);if(!(null==e?void 0:e.childId))break;const n=C.get(e.childId);if(!(null==n?void 0:n.offsetFromParent))break;const o={x:i.x+n.offsetFromParent.x,y:i.y+n.offsetFromParent.y};C.set(e.childId,{...n,position:o,hasBeenDragged:!0}),t=e.childId,i=o}}if(n.parentId&&n.offsetFromParent){const t=v();let i=e,r=n;for(;r.parentId&&r.offsetFromParent;){const n=C.get(r.parentId);if(!n)break;const d=i===e?o:C.get(i).position,s={x:d.x-r.offsetFromParent.x,y:d.y-r.offsetFromParent.y};"animated"===t.parentChild.movementMode?q.set(r.parentId,s):C.set(r.parentId,{...n,position:s,hasBeenDragged:!0}),i=r.parentId,r=n}}T()}function ee(e,t){const i=C.get(e);i&&(C.set(e,{...i,...t}),T())}function te(e){var t;const i=C.get(e);if(!i)return;const n=Math.max(...Array.from(C.values()).map(e=>e.zIndex),0);if(i.parentId){const o=C.get(i.parentId);o&&o.zIndex<n&&C.set(i.parentId,{...o,zIndex:n+2});const r=(null==(t=C.get(i.parentId))?void 0:t.zIndex)??n+2;return i.zIndex<=r&&C.set(e,{...i,zIndex:r+2}),void T()}if(i.zIndex<n&&(C.set(e,{...i,zIndex:n+2}),T()),i.childId){const t=C.get(i.childId),n=C.get(e);t&&n&&t.zIndex<=n.zIndex&&(C.set(i.childId,{...t,zIndex:n.zIndex+2}),T())}}function ie(e,t,i){const n=t.getBoundingClientRect();X.set(e,{x:n.left+n.width/2,y:n.top+n.height/2});const o=v();(null==i?void 0:i.parentId)&&o.features.parentChild&&s.set(Y,{parentId:i.parentId,childId:e},!0),s.get(E).includes(e)||s.set(E,[...s.get(E),e],!0),T();const r=C.get(e);if(r){if(r.isOpen&&!r.isMinimized&&!r.isHiddenWithParent)return s.set(E,s.get(E).filter(t=>t!==e),!0),function(e){C.get(e)&&(s.get(A).includes(e)||s.get($).includes(e)||(s.set(A,[...s.get(A),e],!0),T()))}(e),void te(e);if(r.isMinimized)return s.set(E,s.get(E).filter(t=>t!==e),!0),void Q(e);C.set(e,{...r,isOpen:!0}),te(e)}}function ne(e,t=!1){const i=C.get(e);i&&(xe(e),t?s.set(S,[...s.get(S),e],!0):s.set(H,[...s.get(H),e],!0),T(),i.childId&&ne(i.childId,t))}function oe(){Array.from(C.keys()).forEach(e=>ne(e,!0))}function re(e,t,i){const n=v();if(i&&!X.has(e.id)){const t=i.getBoundingClientRect();X.set(e.id,{x:t.left+t.width/2,y:t.top+t.height/2})}const o={id:e.id,title:e.title??"",icon:e.icon??"",isOpen:!0,isMinimized:!1,isHiddenWithParent:!1,isTransparent:e.isTransparent??!1,isRejected:!1,position:e.position??null,size:e.size??null,hasBeenDragged:e.hasBeenDragged??!1,dockPosition:e.dockPosition??-1,glow:e.glow??null};if(!n.features.parentChild){K(o);const t=C.get(e.id);return t&&C.set(e.id,{...t,isOpen:!0}),s.set(E,[...s.get(E),e.id],!0),T(),void te(e.id)}const r=C.get(t);if(!r)return;r.childId&&ne(r.childId,!0),K({...o,parentId:t});const d=C.get(e.id);d&&C.set(e.id,{...d,isOpen:!0,parentId:t}),s.set(E,[...s.get(E),e.id],!0),T(),te(e.id),s.set(Y,{parentId:t,childId:e.id},!0)}function de(e){return s.get(R).includes(e)}function se(e){return C.get(e)}function ae(){return s.get(B)}function le(e){return s.get(E).includes(e)}function ce(e){return s.get(H).includes(e)}function ge(e){return s.get(S).includes(e)}function ue(e){return!!s.get(S).includes(e)&&(s.set(S,s.get(S).filter(t=>t!==e),!0),!0)}function he(e){return s.get(L).includes(e)}function pe(e){return s.get(W).includes(e)}function fe(e){const t=C.get(e);return void 0!==t&&t.isOpen&&!t.isMinimized&&!t.isHiddenWithParent}function me(e){return C.has(e)}function ve(){return{get modals(){return C},get pendingMinimize(){return s.get(R)},get pendingOpen(){return s.get(E)},get pendingClose(){return s.get(H)},get pendingRestore(){return s.get(L)},get dockOrder(){return s.get(G)}}}function ye(e){j.has(e)?j.delete(e):j.add(e);const t=C.get(e);t&&(C.set(e,{...t,isTransparent:j.has(e)}),T())}function we(e){j.delete(e);const t=C.get(e);t&&(C.set(e,{...t,isTransparent:!1}),T())}function xe(e){q.delete(e)}const ze=Symbol("modal-render-icon"),Ie=Symbol("modal-id");function be(){return v().features.animations}const _e=["button:not([disabled])","[href]","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(", ");function Me(e){return Array.from(e.querySelectorAll(_e)).filter(e=>null!==e.offsetParent||"A"===e.tagName)}function ke(e,t){if("Tab"!==e.key)return;const i=Me(t);if(0===i.length)return void e.preventDefault();const n=i[0],o=i[i.length-1],r=document.activeElement;e.shiftKey?r===n&&(o.focus(),e.preventDefault()):r===o&&(n.focus(),e.preventDefault())}function De(e){const t=Me(e);return t.length>0&&(t[0].focus(),!0)}const Pe="modal-portal";var Ce=s.from_html('<div style="display: contents;"><!></div>');function Be(t,i){s.push(i,!0);let n=s.prop(i,"target",3,"body"),o=null,r=null;const{mount:d}={mount:function(e,t=null){const i=function(e){if("undefined"==typeof window)return null;if(e instanceof HTMLElement)return e;if("string"==typeof e){const t=document.querySelector(e);if(t)return t;if(e.startsWith("#")){const t=e.slice(1),i=document.createElement("div");return i.id=t,document.body.appendChild(i),i}}let t=document.getElementById(Pe);return t||(t=document.createElement("div"),t.id=Pe,document.body.appendChild(t)),t}(t);return i?(i.appendChild(e),()=>{e.parentNode===i&&i.removeChild(e),i.id!==Pe&&0===i.children.length&&i.parentNode&&i.parentNode.removeChild(i)}):()=>{}}};e(()=>(o&&(r=d(o,n())),()=>{null==r||r()}));var a=Ce(),l=s.child(a);s.snippet(l,()=>i.children),s.reset(a),s.bind_this(a,e=>o=e,()=>o),s.append(t,a),s.pop()}var Oe=s.from_html('<button type="button" aria-label="Minimize"></button>'),Te=s.from_html('<button type="button" class="modal-header-light modal-header-light-style" aria-label="Toggle style"></button>'),Re=s.from_html('<div class="modal-header-icon"><!></div>'),Ee=s.from_html('<div class="modal-header-icon"><!></div>'),He=s.from_html('<h2 class="modal-header-title"> </h2>'),Se=s.from_html('<h2 class="modal-header-title"> </h2>'),Le=s.from_html('<div class="modal-header-traffic-lights"><button type="button" class="modal-header-light modal-header-light-close" aria-label="Close"></button> <!> <!></div> <div class="modal-header-mac-center"><!> <div class="modal-header-title-group"><!></div></div> <div class="modal-header-mac-spacer"></div>',1),We=s.from_html('<div class="modal-header-icon"><!></div>'),Ae=s.from_html('<div class="modal-header-icon"><!></div>'),$e=s.from_html('<h2 class="modal-header-title"> </h2>'),Fe=s.from_html('<h2 class="modal-header-title"> </h2>'),Xe=s.from_html('<button type="button" class="modal-header-btn-windows modal-header-btn-windows-style" aria-label="Toggle style">&#9671;</button>'),Ye=s.from_html('<button type="button" aria-label="Minimize">&#8211;</button>'),qe=s.from_html('<div class="modal-header-title-group"><!> <!></div> <div class="modal-header-actions"><!> <!> <button type="button" class="modal-header-btn-windows modal-header-btn-windows-close" aria-label="Close">&times;</button></div>',1),Ne=s.from_html("<header><!></header>");s.delegate(["pointerdown","click"]);var je=s.from_html("<div></div>"),Ge=s.from_html('<div class="modal-resize-handles"></div>');function Ke(e,t){return t&&e.appendChild(t),{update(t){e.innerHTML="",t&&e.appendChild(t)},destroy(){e.innerHTML=""}}}s.delegate(["pointerdown"]);var Ve=s.from_html('<div class="modal-footer"><!></div>'),Ue=s.from_html("<div></div>"),Qe=s.from_html('<div role="dialog" aria-modal="true" tabindex="-1"><!> <div class="modal-body"><!></div> <!> <!> <!></div>');function Je(r,d){s.push(d,!0);let a=s.prop(d,"maxWidth",3,"600px"),l=s.prop(d,"autoOpen",3,!1),c=s.prop(d,"closeOnEscape",3,!0),g=s.state(!1);e(()=>{K({id:d.id,title:d.title,icon:d.icon??"",isOpen:l(),isMinimized:!1,isHiddenWithParent:!1,isTransparent:!1,isRejected:!1,position:null,size:null,hasBeenDragged:!1,dockPosition:0,glow:d.glow??null,parentId:void 0,childId:void 0,offsetFromParent:void 0}),s.set(g,!0)}),o(()=>{V(d.id)});const u=s.derived(()=>{if(!s.get(g))return!1;ae();const e=se(d.id);return!!e&&(e.isOpen||e.isMinimized||le(d.id)||ce(d.id)||de(d.id))});var h=s.comment(),f=s.first_child(h),y=r=>{!function(r,d){s.push(d,!0);let a=s.prop(d,"maxWidth",3,"600px"),l=s.prop(d,"autoOpen",3,!1),c=s.prop(d,"closeOnEscape",3,!0),g=s.prop(d,"skipRegistration",3,!1);i(Ie,d.id);const u=v().portalTarget,h=P(d.id);function f(e){var t,i;return(null==(i=null==(t=d.config)?void 0:t.features)?void 0:i[e])??function(e){return p.features[e]}(e)}const y=s.derived(()=>(m(),f("drag"))),w=s.derived(()=>(m(),f("minimize"))),x=s.derived(()=>(m(),!f("dock"))),z=s.derived(()=>(m(),f("transparency"))),I=s.derived(()=>(m(),f("resize"))),M=s.derived(()=>{var e,t;return m(),(null==(t=null==(e=d.config)?void 0:e.appearance)?void 0:t.headerLayout)??v().appearance.headerLayout});let B=s.state(null),O=s.state(!1),S=s.state(!1),N=s.state(!1),j=s.state(!1),G=s.state(!1);const Q=s.derived(()=>(ae(),se(d.id))),J=s.derived(()=>s.get(Q)&&(s.get(Q).isOpen||ce(d.id))&&(!s.get(Q).isMinimized||de(d.id))&&!s.get(Q).isHiddenWithParent),ie=s.derived(()=>{var e;return!!(null==(e=s.get(Q))?void 0:e.childId)}),oe=s.derived(()=>{var e;return!!(null==(e=s.get(Q))?void 0:e.parentId)}),re=s.derived(()=>s.get(ie)||s.get(S)),fe=s.derived(()=>!!d.glow),me=s.derived(()=>`modal-title-${h}`),ve=s.derived(()=>{var e;return(null==(e=s.get(Q))?void 0:e.zIndex)??1e3}),xe=function(e={x:0,y:0}){const t=s.proxy({...e}),i=s.proxy({isDragging:!1,startX:0,startY:0,initialX:0,initialY:0,hasBeenDragged:!1});return{get position(){return t},get hasBeenDragged(){return i.hasBeenDragged},get isDragging(){return i.isDragging},onPointerDown:function(e,n){if(0===e.button){if(!i.hasBeenDragged){const e=n.getBoundingClientRect();t.x=e.left,t.y=e.top}i.isDragging=!0,i.startX=e.clientX,i.startY=e.clientY,i.initialX=t.x,i.initialY=t.y,n.setPointerCapture(e.pointerId)}},onPointerMove:function(e,n,o){if(!i.isDragging)return;const r=e.clientX-i.startX,d=e.clientY-i.startY,s=b(i.initialX+r,i.initialY+d,o.width,o.height);t.x=s.x,t.y=s.y,i.hasBeenDragged=!0},onPointerUp:function(e,t){i.isDragging&&(i.isDragging=!1,t.releasePointerCapture(e.pointerId))},setPosition:function(e){t.x=e.x,t.y=e.y},setHasBeenDragged:function(e){i.hasBeenDragged=e},reset:function(){t.x=e.x,t.y=e.y,i.hasBeenDragged=!1}}}({x:0,y:0});let _e=s.state(!1);const Me=function(e,t,i){let n=s.state(!1),o=s.state(""),r=s.state(s.proxy({width:0,height:0})),a=s.state(!1),l=s.state(!1),c={x:0,y:0,width:0,height:0,posX:0,posY:0},g=null;function u(d,l){d.preventDefault(),d.stopPropagation();const u=e();if(!u)return;const f=u.getBoundingClientRect();xe.hasBeenDragged||(i({x:f.left,y:f.top}),xe.setHasBeenDragged(!0)),s.get(a)||(s.set(r,{width:f.width,height:f.height},!0),s.set(a,!0));const m=t();s.set(n,!0),s.set(o,l,!0),g=d.pointerId,c={x:d.clientX,y:d.clientY,width:s.get(r).width,height:s.get(r).height,posX:m.x,posY:m.y,centerX:m.x+s.get(r).width/2,centerY:m.y+s.get(r).height/2},window.addEventListener("pointermove",h),window.addEventListener("pointerup",p),window.addEventListener("pointercancel",p)}function h(e){if(e.pointerId!==g)return;const t=e.clientX-c.x,n=e.clientY-c.y,d=window.innerWidth,a=window.innerHeight;let l=c.width,u=c.height,h=c.posX,p=c.posY;if(s.get(o).includes("e")){const e=d-h;l=Math.max(280,Math.min(c.width+t,e))}if(s.get(o).includes("w")){const e=c.width-280,i=Math.min(t,e);l=c.width-i,h=c.posX+i}if(s.get(o).includes("s")){const e=a-p;u=Math.max(200,Math.min(c.height+n,e))}if(s.get(o).includes("n")){const e=c.height-200,t=Math.min(n,e);u=c.height-t,p=c.posY+t}const f=_(h,p,l,u);s.set(r,{width:f.width,height:f.height},!0),i({x:f.x,y:f.y})}function p(e){e.pointerId===g&&(s.set(n,!1),g=null,window.removeEventListener("pointermove",h),window.removeEventListener("pointerup",p),window.removeEventListener("pointercancel",p),s.set(l,!0),((e,t)=>{const i=se(d.id);if(null==i?void 0:i.parentId){const e=se(i.parentId),n=document.querySelector(`[data-modal-id="${P(i.parentId)}"]`);if(e&&n){const i=e.position??{x:n.getBoundingClientRect().left,y:n.getBoundingClientRect().top},o=e.size??{width:n.offsetWidth,height:n.offsetHeight},r={x:i.x+(o.width-t.width)/2,y:i.y+(o.height-t.height)/2};s.set(_e,!0),xe.setPosition(r);const a={x:r.x-i.x,y:r.y-i.y};return ee(d.id,{position:r,size:t,hasBeenDragged:!0,offsetFromParent:a}),void setTimeout(()=>{s.set(_e,!1)},200)}}ee(d.id,{position:e,size:t,hasBeenDragged:!0})})(t(),s.get(r)),setTimeout(()=>{s.set(l,!1)},0))}const f={startResize:u};return{get isResizing(){return s.get(n)},get resizeDirection(){return s.get(o)},get size(){return s.get(r)},get hasBeenResized(){return s.get(a)},get isActive(){return s.get(n)},get justFinishedResizing(){return s.get(l)},start:u,setHasBeenResized:()=>{},setSize:function(e){s.set(r,e,!0),s.set(a,!0)},reset:function(){s.set(a,!1),s.set(r,{width:0,height:0},!0)},constrainToViewport:function(){const n=t(),o=e();if(!o)return;const d=_(n.x,n.y,s.get(r).width||o.offsetWidth,s.get(r).height||o.offsetHeight);s.set(r,{width:d.width,height:d.height},!0),i({x:d.x,y:d.y})},handlers:f}}(()=>s.get(B),()=>xe.position,e=>xe.setPosition(e)),Pe=function(e,t,i,n,o,r,a,l,c){let g=s.state(!1),u=s.state(!1),h=s.state(!1),p=s.state(!1),f=s.state(null),m=s.state(null),v=null,y=null;function w(){y&&(clearTimeout(y),y=null)}function x(){const e=d.id,t=document.querySelector(`.modal-dock-item[data-modal-id="${P(e)}"]`),i=document.querySelector('[data-dock-container="true"]'),n=t||i;if(n){const e=n.getBoundingClientRect();return{x:e.left+e.width/2,y:e.top+e.height/2}}return{x:window.innerWidth/2,y:window.innerHeight-40}}return s.user_effect(()=>()=>{w(),s.set(g,!1),s.set(u,!1),s.set(h,!1),s.set(p,!1),s.set(f,null),s.set(m,null),v=null}),{get isMinimizing(){return s.get(g)},get isRestoring(){return s.get(u)},get isOpening(){return s.get(h)},get isClosing(){return s.get(p)},get animationTransform(){return s.get(f)},get pendingOpenSource(){return s.get(m)},startMinimize:function(e,d){const p=t();if(s.get(g)||!p)return;if(s.set(u,!1),s.set(h,!1),w(),!be()){const e=p.getBoundingClientRect();let t=o()?i():{x:e.left,y:e.top},s=a()?l():{width:e.width,height:e.height};return o()||(n(t),r(!0)),void(d?d():c(t,!0,s))}const m=p.getBoundingClientRect(),v=m.left+m.width/2,z=m.top+m.height/2;let I=o()?i():{x:m.left,y:m.top},b=a()?l():{width:m.width,height:m.height};o()||(n(I),r(!0));const _=e??x(),M=_.x-m.left,k=_.y-m.top,D={x:_.x-v,y:_.y-z,originX:M,originY:k};s.set(f,D,!0),requestAnimationFrame(()=>{requestAnimationFrame(()=>{s.set(g,!0)})}),y=setTimeout(()=>{d?d():c(I,!0,b)},500)},startRestore:function(e,t){if(!be()){const t=e||{x:window.innerWidth/2,y:window.innerHeight/2};return n(t),void r(!0)}const i=x(),o=e||{x:window.innerWidth/2,y:window.innerHeight/2},d=t||{width:480,height:400};n(o),r(!0);const a=o.x+d.width/2,l=o.y+d.height/2,c=i.x-o.x,g=i.y-o.y;s.set(f,{x:i.x-a,y:i.y-l,originX:c,originY:g},!0),s.set(u,!0),setTimeout(()=>{s.set(u,!1),s.set(f,null)},400)},startClose:function(e){s.get(p)||s.get(g)||(be()?(v=e,s.set(p,!0),setTimeout(()=>{s.set(p,!1),v&&(v(),v=null)},250)):e())},setPendingOpenSource:function(e){s.set(m,e,!0)},tryStartOpenAnimation:function(){const e=t();if(!s.get(m)||!e||s.get(h))return!1;if(!be())return s.set(m,null),!1;const d=s.get(m);s.set(m,null);const a=e.getBoundingClientRect(),l=o()?i():{x:a.left,y:a.top},c=a.width,g=a.height,u=l.x+c/2,p=l.y+g/2;o()||(n(l),r(!0));const v=d.x-l.x,y=d.y-l.y;return s.set(f,{x:d.x-u,y:d.y-p,originX:v,originY:y},!0),s.set(h,!0),setTimeout(()=>{s.set(h,!1),s.set(f,null)},400),!0},forceClearMinimize:function(){w(),s.set(g,!1),s.set(f,null)}}}(0,()=>s.get(B),()=>xe.position,e=>xe.setPosition(e),()=>xe.hasBeenDragged,e=>xe.setHasBeenDragged(e),()=>Me.hasBeenResized,()=>Me.size,(e,t,i)=>{ee(d.id,{position:e,size:i,hasBeenDragged:t}),U(d.id)}),{trapFocus:Ce,focusFirstElement:Je}={trapFocus:ke,focusFirstElement:De},Ze=s.derived(()=>Pe.isMinimizing||Pe.isRestoring||Pe.isOpening||Pe.isClosing),et=s.derived(()=>(pe(d.id)||he(d.id))&&!Pe.isRestoring);let tt=s.state(!1);const it=s.derived(()=>Pe.isRestoring||Pe.isOpening||s.get(tt)),nt=s.derived(()=>s.get(J)&&!xe.hasBeenDragged&&!s.get(Ze)&&!Pe.pendingOpenSource&&!s.get(et)),ot=s.derived(()=>{const e=[];return e.push(`z-index: ${s.get(ve)};`),Pe.animationTransform?(e.push(`left: ${xe.position.x}px; top: ${xe.position.y}px;`),e.push(`--genie-origin-x: ${Pe.animationTransform.originX}px;`),e.push(`--genie-origin-y: ${Pe.animationTransform.originY}px;`),e.push(`--genie-translate-x: ${Pe.animationTransform.x}px;`),e.push(`--genie-translate-y: ${Pe.animationTransform.y}px;`)):xe.hasBeenDragged&&e.push(`left: ${xe.position.x}px; top: ${xe.position.y}px; transform: none;`),Me.hasBeenResized?e.push(`width: ${Me.size.width}px; height: ${Me.size.height}px; max-width: none; max-height: none;`):(d.preferredHeight&&e.push(`min-height: ${d.preferredHeight};`),a()&&e.push(`max-width: ${a()};`)),s.get(fe)&&d.glow&&(e.push(`--modal-glow-color: ${d.glow.color};`),e.push(`--modal-glow-intensity: ${d.glow.intensity};`)),e.join(" ")});function rt(){s.get(w)&&U(d.id)}function dt(){var e;ge(d.id)&&ue(d.id),ne(d.id),null==(e=d.onClose)||e.call(d)}function st(){ye(d.id)}function at(e){s.get(y)&&s.get(B)&&xe.onPointerDown(e,s.get(B))}function lt(e){c()&&"Escape"===e.key&&function(e){const t=C.get(e);if(!t)return!1;const i=Math.max(...Array.from(C.values()).map(e=>e.zIndex),0);return t.zIndex===i&&!t.isMinimized&&!t.isHiddenWithParent}(d.id)&&(e.stopPropagation(),dt())}function ct(e){if(!s.get(B))return;const t=xe.isDragging,i=Me.hasBeenResized?Me.size:{width:s.get(B).offsetWidth,height:s.get(B).offsetHeight};xe.onPointerMove(e,s.get(B),i),xe.isDragging&&t&&Z(d.id,xe.position,{drag:!0})}function gt(e){if(!s.get(B))return;const t=xe.isDragging;xe.onPointerUp(e,s.get(B)),t&&!Me.justFinishedResizing&&(Z(d.id,xe.position,{drag:!0}),function(e){const t=v();if("animated"!==t.parentChild.movementMode)return;const i=t.parentChild.animationDuration,n=[];let o=e;for(;;){const e=C.get(o);if(!(null==e?void 0:e.parentId))break;n.push({parentId:e.parentId,childId:o}),o=e.parentId}n.forEach(({parentId:e,childId:t},n)=>{setTimeout(()=>{const n=C.get(t),o=C.get(e);if(!(null==n?void 0:n.position)||!n.offsetFromParent||!o)return;const r={x:n.position.x-n.offsetFromParent.x,y:n.position.y-n.offsetFromParent.y};q.set(e,r),function(e){const t=q.get(e);if(!t)return;const i=C.get(e);i&&(C.set(e,{...i,isAnimatingPosition:!0,position:t}),q.delete(e),T())}(e),setTimeout(()=>function(e){const t=C.get(e);t&&(C.set(e,{...t,isAnimatingPosition:!1}),T())}(e),i)},n*i)})}(d.id))}function ut(){var e;const t=v();if("smart"!==(null==(e=t.positioning)?void 0:e.strategy))return!1;const i=se(d.id);if(null==i?void 0:i.parentId)return!1;if((null==i?void 0:i.hasBeenDragged)||(null==i?void 0:i.position))return!1;const n=s.get(B)||document.querySelector(`[data-modal-id="${h}"]`);if(!n)return!1;const o=n.offsetWidth,r=n.offsetHeight;if(o<=0||r<=0)return!1;const a=t.positioning.modalGap??16,l=function(e){const t=[];for(const[i,n]of C.entries())if(i!==e&&n.isOpen&&!n.isMinimized&&!n.isHiddenWithParent)if(n.position&&n.size)t.push({x:n.position.x,y:n.position.y,width:n.size.width,height:n.size.height});else{const e=document.querySelector(`[data-modal-id="${P(i)}"]`);if(e){const i=e.getBoundingClientRect();t.push({x:i.left,y:i.top,width:i.width,height:i.height})}}return t}(d.id),c=function(e){if("undefined"==typeof document)return[];const t=[];for(const i of e)try{const e=document.querySelectorAll(i);for(const i of e){const e=i.getBoundingClientRect();e.width>0&&e.height>0&&t.push({x:e.left,y:e.top,width:e.width,height:e.height})}}catch{}return t}(t.positioning.avoidElements??[]),g=function(e,t,i,n={}){const{modalGap:o=16,gridResolution:r=10,avoidBounds:d=[],avoidMargin:s=16}=n,a=n.margin??o,l="undefined"!=typeof window?window.innerWidth:1920,c="undefined"!=typeof window?window.innerHeight:1080,g=d.map(e=>({x:e.x-s,y:e.y-s,width:e.width+2*s,height:e.height+2*s})),u={x:(l-e)/2,y:(c-t)/2};if(0===i.length&&0===g.length)return u;const h=a,p=Math.max(a,l-e-a),f=a,m=Math.max(a,c-t-a);if(p<=h||m<=f)return u;const v=k(u.x,u.y,e,t,i,o),y=k(u.x,u.y,e,t,g,0);if(0===v&&0===y)return u;const w=[],x=(p-h)/r,z=(m-f)/r;for(let n=0;n<=r;n++)for(let d=0;d<=r;d++){const r=h+n*x,s=f+d*z,u=k(r,s,e,t,i,o),p=k(r,s,e,t,g,0),m=D(r,s,e,t,l,c,a);w.push({pos:{x:r,y:s},modalOverlap:u,avoidOverlap:p,centerDist:m})}const I=w.filter(e=>0===e.avoidOverlap),b=I.length>0?I:w,_=e*t,M=Math.min(...b.map(e=>e.modalOverlap))/_;return b.sort((e,t)=>{if(0===I.length&&e.avoidOverlap!==t.avoidOverlap)return e.avoidOverlap-t.avoidOverlap;const i=e.modalOverlap/_,n=t.modalOverlap/_;if(M<.3){const o=.3,r=i<=o,d=n<=o;if(r&&d)return e.centerDist+.3*i-(t.centerDist+.3*n);if(r)return-1;if(d)return 1}return.6*i+.4*e.centerDist-(.6*n+.4*t.centerDist)}),b[0].pos}(o,r,l,{modalGap:a,avoidBounds:c});if(k(g.x,g.y,o,r,l,a)/(o*r)>.1&&l.length>0){const e=function(e){const t=[];for(const[i,n]of C.entries())if(i!==e&&n.isOpen&&!n.isMinimized&&!n.isHiddenWithParent&&!n.parentId)if(n.position&&n.size)t.push({id:P(i),x:n.position.x,y:n.position.y,width:n.size.width,height:n.size.height});else{const e=document.querySelector(`[data-modal-id="${P(i)}"]`);if(e){const n=e.getBoundingClientRect();t.push({id:P(i),x:n.left,y:n.top,width:n.width,height:n.height})}}return t}(d.id),t=function(e,t,i,n={}){const{modalGap:o=16}=n,r=n.margin??o,d="undefined"!=typeof window?window.innerWidth:1920,s="undefined"!=typeof window?window.innerHeight:1080,a=i.reduce((e,t)=>e+t.width,0)+e,l=i.length*o,c=d-2*r;if(a+l>c)return null;const g=c-a-l;i.length;const u=g/2,h=d/2,p=[...i.map(e=>({id:e.id,width:e.width,height:e.height,currentX:e.x+e.width/2,currentY:e.y,isNew:!1})),{id:"__new__",width:e,height:t,currentX:h,currentY:(s-t)/2,isNew:!0}];p.sort((e,t)=>e.currentX-t.currentX);let f=r+u;const m=new Map;let v=null;for(const e of p){const t=f;if(e.isNew)v={x:Math.round(t),y:Math.round(e.currentY)};else{const n=i.find(t=>t.id===e.id);Math.abs(t-n.x)>5&&m.set(e.id,{x:Math.round(t),y:Math.round(n.y)})}f+=e.width+o}return v?{newModalPosition:v,existingModalMoves:m}:null}(o,r,e,{modalGap:a});if(t&&t.existingModalMoves.size>0)return function(e){const t=v().parentChild.animationDuration;for(const[t,i]of e){const e=C.get(t);e&&C.set(t,{...e,position:i,isAnimatingPosition:!0,hasBeenDragged:!0})}T(),setTimeout(()=>{for(const t of e.keys()){const e=C.get(t);e&&C.set(t,{...e,isAnimatingPosition:!1})}T()},t)}(t.existingModalMoves),xe.setPosition(t.newModalPosition),xe.setHasBeenDragged(!0),Z(d.id,t.newModalPosition,{size:{width:o,height:r}}),!0}return xe.setPosition(g),xe.setHasBeenDragged(!0),Z(d.id,g,{size:{width:o,height:r}}),!0}function ht(){n().then(()=>n()).then(()=>{let e=0;const t=()=>{e+=1,ut()||e>5||requestAnimationFrame(t)};s.get(B)?t():requestAnimationFrame(t)})}e(()=>{var e;function t(){const e=se(d.id);if(!(null==e?void 0:e.position)||!s.get(B))return;if(e.parentId)return;const t=Me.hasBeenResized?Me.size.width:s.get(B).offsetWidth,i=Me.hasBeenResized?Me.size.height:s.get(B).offsetHeight;if(t<=0||i<=0)return;const n=b(e.position.x,e.position.y,t,i);(Math.abs(n.x-e.position.x)>1||Math.abs(n.y-e.position.y)>1)&&(xe.setPosition(n),Z(d.id,n))}return g()||(e=l(),K({id:d.id,title:d.title,icon:d.icon??"",isOpen:e,isMinimized:!1,isHiddenWithParent:!1,isTransparent:!1,isRejected:!1,position:null,size:null,hasBeenDragged:!1,dockPosition:0,glow:d.glow??null,parentId:void 0,childId:void 0,offsetFromParent:void 0}),e&&te(d.id)),l()&&(n().then(()=>{s.get(B)&&Je(s.get(B))}),ht()),window.addEventListener("pointermove",ct),window.addEventListener("pointerup",gt),window.addEventListener("resize",t),()=>{window.removeEventListener("pointermove",ct),window.removeEventListener("pointerup",gt),window.removeEventListener("resize",t)}}),o(()=>{we(d.id),g()||V(d.id)}),s.user_effect(()=>{ae();const e=se(d.id);if(e){if(s.set(O,e.isTransparent,!0),!xe.isDragging&&!Me.isResizing&&e.position){const t=xe.position,i=e.position;(Math.abs(t.x-i.x)>.5||Math.abs(t.y-i.y)>.5)&&(xe.setPosition(i),e.hasBeenDragged&&xe.setHasBeenDragged(!0))}n().then(()=>function(){var e,t;if(!se(d.id))return;if(ge(d.id))return ue(d.id),void(null==(e=d.onClose)||e.call(d));if(de(d.id)&&!s.get(j)){if(s.set(j,!0),s.get(F),s.set(F,null),s.get(B)){const e=s.get(B).getBoundingClientRect(),t=xe.hasBeenDragged?xe.position:{x:e.left,y:e.top},i=Me.hasBeenResized?Me.size:{width:e.width,height:e.height};ee(d.id,{position:t,size:i,hasBeenDragged:!0})}Pe.startMinimize(void 0,()=>{var e;e=d.id,s.get(R).includes(e)&&s.set(R,s.get(R).filter(t=>t!==e),!0),s.set(j,!1)})}if(he(d.id)){t=d.id,s.get(L).includes(t)&&s.set(L,s.get(L).filter(e=>e!==t),!0);const e=se(d.id);Pe.startRestore((null==e?void 0:e.position)??void 0,(null==e?void 0:e.size)??void 0),n().then(()=>{s.get(B)&&Je(s.get(B))})}if(pe(d.id)){!function(e){s.get(W).includes(e)&&s.set(W,s.get(W).filter(t=>t!==e),!0)}(d.id);const e=se(d.id);Pe.startRestore((null==e?void 0:e.position)??void 0,(null==e?void 0:e.size)??void 0)}if(ce(d.id)&&(function(e){s.get(H).includes(e)&&s.set(H,s.get(H).filter(t=>t!==e),!0)}(d.id),Pe.startClose(()=>{var e;we(d.id),function(e){const t=C.get(e);if(t){if(t.parentId){const i=C.get(t.parentId);i&&i.childId===e&&C.set(t.parentId,{...i,childId:void 0,lastChildId:e})}C.set(e,{...t,isOpen:!1,isMinimized:!1,isHiddenWithParent:!1,isTransparent:!1,position:null,size:null,hasBeenDragged:!1,parentId:void 0,childId:void 0,offsetFromParent:void 0}),T()}}(d.id),null==(e=d.onClose)||e.call(d)})),le(d.id)){!function(e){s.get(E).includes(e)&&s.set(E,s.get(E).filter(t=>t!==e),!0)}(d.id);const e=function(e){const t=X.get(e);return t&&X.delete(e),t??null}(d.id)||d.openSourcePosition||null;e?(Pe.setPendingOpenSource(e),n().then(()=>n()).then(()=>{ut(),Pe.tryStartOpenAnimation()})):ht(),n().then(()=>{s.get(B)&&Je(s.get(B))})}(function(e){return s.get(A).includes(e)})(d.id)&&(function(e){s.get(A).includes(e)&&s.set(A,s.get(A).filter(t=>t!==e),!0)}(d.id),function(e){s.get($).includes(e)||s.set($,[...s.get($),e],!0)}(d.id),s.set(G,!0),setTimeout(()=>{s.set(G,!1),function(e){s.set($,s.get($).filter(t=>t!==e),!0)}(d.id)},600));const i=function(e){if(!s.get(Y)||s.get(Y).childId!==e)return null;const t=s.get(Y);return s.set(Y,null),t}(d.id);var o;i&&s.get(B)&&(o=i.parentId,n().then(()=>n()).then(()=>{let e=0;const t=()=>{e+=1;const i=function(e){var t,i;const n=se(e);if(!n)return!1;const o=s.get(B)||document.querySelector(`[data-modal-id="${h}"]`),r=document.querySelector(`[data-modal-id="${P(e)}"]`),a=null==r?void 0:r.getBoundingClientRect(),l=n.position??(a?{x:a.left,y:a.top}:null);if(!l||!o)return!1;const c=(null==(t=n.size)?void 0:t.width)??(null==r?void 0:r.offsetWidth)??(null==a?void 0:a.width)??480,g=(null==(i=n.size)?void 0:i.height)??(null==r?void 0:r.offsetHeight)??(null==a?void 0:a.height)??400,u=o.offsetWidth,p=o.offsetHeight;if(c<=0||g<=0||u<=0||p<=0)return!1;const f={x:l.x+(c-u)/2,y:l.y+(g-p)/2};return xe.setPosition(f),xe.setHasBeenDragged(!0),Z(d.id,f,{size:{width:u,height:p}}),n.position&&n.size||!a||Z(e,{x:a.left,y:a.top},{size:{width:c,height:g}}),function(e,t){if(!v().features.parentChild)return;const i=C.get(e),n=C.get(t);if(!i||!n)return;let o={x:40,y:40};i.position&&n.position&&(o={x:n.position.x-i.position.x,y:n.position.y-i.position.y});const r=Math.max(n.zIndex,i.zIndex+1);C.set(e,{...i,childId:t,lastChildId:t}),C.set(t,{...n,parentId:e,offsetFromParent:o,zIndex:r}),T()}(e,d.id),!0}(o);i||e>5||requestAnimationFrame(t)};s.get(B)?t():requestAnimationFrame(t)}))}())}}),s.user_effect(()=>{const e=se(d.id);e&&e.isTransparent!==s.get(O)&&s.set(O,e.isTransparent,!0)}),s.user_effect(()=>{if(s.get(J)&&s.get(B)){const e=e=>function(e){s.get(B)&&Ce(e,s.get(B))}(e);return s.get(B).addEventListener("keydown",e),()=>{var t;return null==(t=s.get(B))?void 0:t.removeEventListener("keydown",e)}}}),s.user_effect(()=>{!s.get(J)&&Pe.isMinimizing&&Pe.forceClearMinimize()}),s.user_effect(()=>{Pe.isRestoring||Pe.isOpening?s.set(tt,!0):s.get(tt)&&requestAnimationFrame(()=>{s.set(tt,!1)})}),s.user_effect(()=>{s.get(N)&&!s.get(ie)&&(s.set(S,!0),setTimeout(()=>{s.set(S,!1)},200)),s.set(N,s.get(ie),!0)});var pt=s.comment(),ft=s.first_child(pt),mt=e=>{Be(e,{get target(){return u},children:(e,i)=>{var n=Qe();let o;n.__keydown=lt;var r=s.child(n);{let e=s.derived(()=>s.get(y)?at:void 0);!function(e,i){s.push(i,!0);let n=s.prop(i,"isTransparent",3,!1),o=s.prop(i,"headerLayout",3,"macos"),r=s.prop(i,"minimizable",3,!0),d=s.prop(i,"minimizeDisabled",3,!1),a=s.prop(i,"transparencyEnabled",3,!0);const l=t(ze),c=s.derived(()=>null==l?void 0:l()),g=s.derived(()=>"macos"===o());var u=Ne();let h;u.__pointerdown=function(e){var t;e.target.closest("button")||null==(t=i.onStartDrag)||t.call(i,e)};var p=s.child(u),f=e=>{var t=Le(),n=s.first_child(t),o=s.child(n);o.__click=function(...e){var t;null==(t=i.onClose)||t.apply(this,e)};var l=s.sibling(o,2),g=e=>{var t=Oe();let n;t.__click=function(...e){var t;null==(t=d()?void 0:i.onMinimize)||t.apply(this,e)},s.template_effect(()=>{n=s.set_class(t,1,"modal-header-light modal-header-light-minimize",null,n,{"modal-header-light-disabled":d()}),t.disabled=d(),s.set_attribute(t,"title",d()?"Enable dock to minimize":void 0)}),s.append(e,t)};s.if(l,e=>{r()&&e(g)});var u=s.sibling(l,2),h=e=>{var t=Te();t.__click=function(...e){var t;null==(t=i.onToggleStyle)||t.apply(this,e)},s.append(e,t)};s.if(u,e=>{a()&&e(h)}),s.reset(n);var p=s.sibling(n,2),f=s.child(p),m=e=>{var t=Re(),n=s.child(t);s.snippet(n,()=>i.customIcon),s.reset(t),s.append(e,t)},v=e=>{var t=s.comment(),n=s.first_child(t),o=e=>{var t=Ee(),n=s.child(t);s.snippet(n,()=>s.get(c),()=>i.icon),s.reset(t),s.append(e,t)};s.if(n,e=>{i.icon&&s.get(c)&&e(o)},!0),s.append(e,t)};s.if(f,e=>{i.customIcon?e(m):e(v,!1)});var y=s.sibling(f,2),w=s.child(y),x=e=>{var t=He(),n=s.child(t,!0);s.reset(t),s.template_effect(()=>{s.set_attribute(t,"id",i.titleId),s.set_text(n,i.title)}),s.append(e,t)},z=e=>{var t=Se(),n=s.child(t,!0);s.reset(t),s.template_effect(()=>s.set_text(n,i.title)),s.append(e,t)};s.if(w,e=>{i.titleId?e(x):e(z,!1)}),s.reset(y),s.reset(p),s.next(2),s.append(e,t)},m=e=>{var t=qe(),n=s.first_child(t),o=s.child(n),l=e=>{var t=We(),n=s.child(t);s.snippet(n,()=>i.customIcon),s.reset(t),s.append(e,t)},g=e=>{var t=s.comment(),n=s.first_child(t),o=e=>{var t=Ae(),n=s.child(t);s.snippet(n,()=>s.get(c),()=>i.icon),s.reset(t),s.append(e,t)};s.if(n,e=>{i.icon&&s.get(c)&&e(o)},!0),s.append(e,t)};s.if(o,e=>{i.customIcon?e(l):e(g,!1)});var u=s.sibling(o,2),h=e=>{var t=$e(),n=s.child(t,!0);s.reset(t),s.template_effect(()=>{s.set_attribute(t,"id",i.titleId),s.set_text(n,i.title)}),s.append(e,t)},p=e=>{var t=Fe(),n=s.child(t,!0);s.reset(t),s.template_effect(()=>s.set_text(n,i.title)),s.append(e,t)};s.if(u,e=>{i.titleId?e(h):e(p,!1)}),s.reset(n);var f=s.sibling(n,2),m=s.child(f),v=e=>{var t=Xe();t.__click=function(...e){var t;null==(t=i.onToggleStyle)||t.apply(this,e)},s.append(e,t)};s.if(m,e=>{a()&&e(v)});var y=s.sibling(m,2),w=e=>{var t=Ye();let n;t.__click=function(...e){var t;null==(t=d()?void 0:i.onMinimize)||t.apply(this,e)},s.template_effect(()=>{n=s.set_class(t,1,"modal-header-btn-windows",null,n,{"modal-header-btn-windows-disabled":d()}),t.disabled=d(),s.set_attribute(t,"title",d()?"Enable dock to minimize":void 0)}),s.append(e,t)};s.if(y,e=>{r()&&e(w)}),s.sibling(y,2).__click=function(...e){var t;null==(t=i.onClose)||t.apply(this,e)},s.reset(f),s.append(e,t)};s.if(p,e=>{s.get(g)?e(f):e(m,!1)}),s.reset(u),s.template_effect(()=>h=s.set_class(u,1,"modal-header",null,h,{"modal-header-draggable":!!i.onStartDrag,transparent:n()})),s.append(e,u),s.pop()}(r,{get title(){return d.title},get customIcon(){return d.customIcon},get icon(){return d.icon},get isTransparent(){return s.get(O)},get titleId(){return s.get(me)},get headerLayout(){return s.get(M)},get onStartDrag(){return s.get(e)},onToggleStyle:st,onMinimize:rt,onClose:dt,get minimizable(){return s.get(w)},get minimizeDisabled(){return s.get(x)},get transparencyEnabled(){return s.get(z)}})}var a=s.sibling(r,2),l=s.child(a);s.snippet(l,()=>d.children??s.noop),s.reset(a),s.action(a,(e,t)=>null==Ke?void 0:Ke(e,t),()=>d.bodyElement);var c=s.sibling(a,2),g=e=>{var t=Ve(),i=s.child(t),n=e=>{var t=s.comment(),i=s.first_child(t);s.snippet(i,()=>d.footer),s.append(e,t)};s.if(i,e=>{d.footer&&e(n)}),s.reset(t),s.action(t,(e,t)=>null==Ke?void 0:Ke(e,t),()=>d.footerElement),s.append(e,t)};s.if(c,e=>{(d.footer||d.footerElement)&&e(g)});var u=s.sibling(c,2);{let e=s.derived(()=>s.get(I)&&!s.get(ie)?Me.handlers.startResize:void 0);!function(e,t){s.push(t,!0);const i=["n","s","e","w","ne","nw","se","sw"];var n=s.comment(),o=s.first_child(n),r=e=>{var n=Ge();s.each(n,21,()=>i,s.index,(e,i)=>{var n=je();n.__pointerdown=e=>function(e,i){var n;null==(n=t.onStartResize)||n.call(t,e,i)}(e,s.get(i)),s.template_effect(()=>s.set_class(n,1,`modal-resize-handle modal-resize-${s.get(i)??""}`)),s.append(e,n)}),s.reset(n),s.append(e,n)};s.if(o,e=>{t.onStartResize&&e(r)}),s.append(e,n),s.pop()}(u,{get onStartResize(){return s.get(e)}})}var p=s.sibling(u,2),f=e=>{var t=Ue();let i;s.template_effect(()=>i=s.set_class(t,1,"modal-child-overlay",null,i,{"modal-overlay-closing":s.get(S)})),s.append(e,t)};s.if(p,e=>{s.get(re)&&e(f)}),s.reset(n),s.bind_this(n,e=>s.set(B,e),()=>s.get(B)),s.template_effect(()=>{var e;o=s.set_class(n,1,"modal-dialog",null,o,{"modal-dragging":xe.isDragging,"modal-resizing":Me.isResizing,"modal-positioned":xe.hasBeenDragged,"modal-minimizing":Pe.isMinimizing,"modal-restoring":Pe.isRestoring,"modal-opening":Pe.isOpening,"modal-closing":Pe.isClosing,"modal-centered":s.get(nt),"modal-solid":!s.get(O),"modal-transparent":s.get(O),"modal-glow":s.get(fe),"modal-has-child":s.get(ie),"modal-is-child":s.get(oe),"modal-visible-by-animation":s.get(it),"modal-animating-to-center":s.get(_e),"modal-animating-position":null==(e=s.get(Q))?void 0:e.isAnimatingPosition,"modal-attention":s.get(G)}),s.set_attribute(n,"data-modal-id",h),s.set_style(n,s.get(ot)),s.set_attribute(n,"aria-labelledby",s.get(me))}),s.event("pointerdown",n,()=>te(d.id),!0),s.append(e,n)},$$slots:{default:!0}})};s.if(ft,e=>{s.get(J)&&e(mt)}),s.append(r,pt),s.pop()}(r,{get id(){return d.id},get title(){return d.title},get icon(){return d.icon},get customIcon(){return d.customIcon},get maxWidth(){return a()},get preferredHeight(){return d.preferredHeight},get autoOpen(){return l()},get openSourcePosition(){return d.openSourcePosition},get glow(){return d.glow},get config(){return d.config},get closeOnEscape(){return c()},get onClose(){return d.onClose},get children(){return d.children},get footer(){return d.footer},skipRegistration:!0})};s.if(f,e=>{s.get(u)&&e(y)}),s.append(r,h),s.pop()}s.delegate(["keydown"]);var Ze=s.from_html('<button type="button" aria-label="Drag dock"></button>'),et=s.from_html('<span class="modal-dock-item-icon-placeholder"> </span>'),tt=s.from_html('<span class="modal-dock-item-label"> </span>'),it=s.from_html("<span>+</span>"),nt=s.from_html('<span class="modal-dock-child-indicator"><!></span>'),ot=s.from_html('<button><span class="modal-dock-item-icon"><!></span> <!> <span class="modal-dock-item-glow"></span> <!></button>'),rt=s.from_html('<div data-dock-container="true"><div><!> <!></div></div>');function dt(e,i){s.push(i,!0);const n=t(ze),o=s.derived(()=>i.renderIcon??(null==n?void 0:n())),r=ve(),d=s.derived(()=>(m(),v())),c=s.derived(()=>z("DOCK")),h=s.derived(()=>s.get(d).dock.position),p=s.derived(()=>s.get(d).dock.labelMode);let f=s.state("horizontal"),y=s.state(s.proxy({x:100,y:100})),w=s.state(null),x=s.state(!1),I={x:0,y:0},_=null;const M=s.derived(()=>(ae(),Array.from(r.modals.values()).filter(e=>e.isMinimized).sort((e,t)=>e.dockPosition-t.dockPosition))),k=s.derived(()=>{switch(s.get(h)){case"left":return{x:-20,duration:250,easing:g};case"right":return{x:20,duration:250,easing:g};default:return{y:20,duration:250,easing:g}}});function D(e){var t;"free"===s.get(h)&&(s.set(x,!0),_=e.pointerId,I={x:e.clientX-s.get(y).x,y:e.clientY-s.get(y).y},null==(t=e.currentTarget)||t.setPointerCapture(e.pointerId),window.addEventListener("pointermove",C),window.addEventListener("pointerup",B),window.addEventListener("pointercancel",B))}function C(e){if(e.pointerId!==_||!s.get(w))return;const t=s.get(w).getBoundingClientRect(),i=window.innerWidth-t.width-8,n=window.innerHeight-t.height-8,o=Math.min(Math.max(e.clientX-I.x,8),Math.max(8,i)),r=Math.min(Math.max(e.clientY-I.y,8),Math.max(8,n));s.set(y,{x:Math.round(o),y:Math.round(r)},!0)}function B(e){e.pointerId===_&&(s.set(x,!1),_=null,window.removeEventListener("pointermove",C),window.removeEventListener("pointerup",B),window.removeEventListener("pointercancel",B))}const{addListener:O}=function(){function e(e,t,i){return"undefined"==typeof window?()=>{}:(window.addEventListener(e,t,i),()=>{window.removeEventListener(e,t,i)})}return{addListener:e,addListenerEffect:function(t,i,n){s.user_effect(()=>{if("undefined"!=typeof window)return e(t,i,n)})}}}();function T(){if("free"!==s.get(h)||!s.get(w))return;const e=s.get(w).getBoundingClientRect(),t=b(s.get(y).x,s.get(y).y,e.width,e.height);t.x===s.get(y).x&&t.y===s.get(y).y||s.set(y,{x:Math.round(t.x),y:Math.round(t.y)},!0)}s.user_effect(()=>{"undefined"!=typeof window&&O("resize",T)});var R={setDockOrientation:function(e){s.set(f,e,!0)},setDockFreePosition:function(e){s.set(y,e,!0)},getDockState:function(){return{dockPosition:s.get(h),dockOrientation:s.get(f),dockFreePosition:s.get(y),dockLabelMode:s.get(p)}}};return Be(e,{get target(){return s.get(d).portalTarget},children:(e,t)=>{var i=rt();let n,d;var g=s.child(i);let m;var v=s.child(g),z=e=>{var t=Ze();let i;t.__pointerdown=D,s.template_effect(()=>i=s.set_class(t,1,"modal-dock-handle",null,i,{"modal-dock-handle-dragging":s.get(x)})),s.append(e,t)};s.if(v,e=>{"free"===s.get(h)&&e(z)});var I=s.sibling(v,2);s.each(I,19,()=>s.get(M),e=>e.id,(e,t,i)=>{const n=s.derived(()=>s.get(t).lastChildId?r.modals.get(s.get(t).lastChildId):null);var d=ot();let l;d.__click=e=>{var i;i=s.get(t).id,N.has(i)?e.currentTarget.animate([{transform:"translateX(0)"},{transform:"translateX(-6px)"},{transform:"translateX(6px)"},{transform:"translateX(-6px)"},{transform:"translateX(6px)"},{transform:"translateX(0)"}],{duration:300,easing:"ease-in-out"}):Q(s.get(t).id)};var c=s.child(d),g=s.child(c),h=e=>{var i=s.comment(),n=s.first_child(i);s.snippet(n,()=>s.get(o),()=>s.get(t).icon),s.append(e,i)},f=e=>{var i=et(),n=s.child(i,!0);s.reset(i),s.template_effect(e=>s.set_text(n,e),[()=>s.get(t).title.charAt(0)]),s.append(e,i)};s.if(g,e=>{s.get(t).icon&&s.get(o)?e(h):e(f,!1)}),s.reset(c);var m=s.sibling(c,2),v=e=>{var i=tt(),n=s.child(i,!0);s.reset(i),s.template_effect(()=>s.set_text(n,s.get(t).title)),s.append(e,i)};s.if(m,e=>{"hidden"!==s.get(p)&&e(v)});var y=s.sibling(m,4),w=e=>{var t=nt(),i=s.child(t),r=e=>{var t=s.comment(),i=s.first_child(t);s.snippet(i,()=>s.get(o),()=>s.get(n).icon),s.append(e,t)},d=e=>{var t=it();s.append(e,t)};s.if(i,e=>{s.get(n).icon&&s.get(o)?e(r):e(d,!1)}),s.reset(t),s.append(e,t)};s.if(y,e=>{s.get(t).lastChildId&&s.get(n)&&e(w)}),s.reset(d),s.template_effect(e=>{l=s.set_class(d,1,"modal-dock-item",null,l,{"modal-dock-item-has-glow":!!s.get(t).glow,"modal-dock-item-has-child":!!s.get(t).lastChildId,"modal-dock-item-label-beside":"beside"===s.get(p),"modal-dock-item-label-below":"below"===s.get(p)}),s.set_attribute(d,"data-modal-id",e),s.set_style(d,s.get(t).glow?`--modal-dock-glow-color: ${s.get(t).glow.color};`:"")},[()=>P(s.get(t).id)]),s.transition(3,d,()=>a,()=>({duration:300,delay:50*s.get(i),easing:u,start:.5})),s.append(e,d)}),s.reset(g),s.reset(i),s.bind_this(i,e=>s.set(w,e),()=>s.get(w)),s.template_effect(()=>{n=s.set_class(i,1,"modal-dock-container",null,n,{"modal-dock-left":"left"===s.get(h),"modal-dock-right":"right"===s.get(h),"modal-dock-bottom":"bottom"===s.get(h),"modal-dock-free":"free"===s.get(h),"modal-dock-empty":0===s.get(M).length}),d=s.set_style(i,"free"===s.get(h)?`left: ${s.get(y).x}px; top: ${s.get(y).y}px;`:"",d,{"z-index":s.get(c)}),m=s.set_class(g,1,"modal-dock",null,m,{"modal-dock-free-horizontal":"free"===s.get(h)&&"horizontal"===s.get(f),"modal-dock-free-vertical":"free"===s.get(h)&&"vertical"===s.get(f)})}),s.transition(3,i,()=>l,()=>s.get(M).length>0?s.get(k):{duration:0}),s.append(e,i)},$$slots:{default:!0}}),s.pop(R)}s.delegate(["pointerdown","click"]);var st=s.from_html('<div class="modal-backdrop svelte-1d3nq4t" aria-hidden="true"></div>');function at(e,t){s.push(t,!0);const i=ve(),n=s.derived(()=>(m(),v())),o=s.derived(()=>s.get(n).features.backdrop),r=s.derived(()=>(ae(),Array.from(i.modals.values()).some(e=>e.isOpen&&!e.isMinimized&&!e.isHiddenWithParent))),d=s.derived(()=>s.get(o)&&s.get(r)),a=s.derived(()=>z("MODAL")-1);Be(e,{get target(){return s.get(n).portalTarget},children:(e,t)=>{var i=s.comment(),n=s.first_child(i),o=e=>{var t=st();let i;s.template_effect(()=>i=s.set_style(t,"",i,{"z-index":s.get(a)})),s.transition(3,t,()=>c,()=>({duration:200})),s.append(e,t)};s.if(n,e=>{s.get(d)&&e(o)}),s.append(e,i)},$$slots:{default:!0}}),s.pop()}function lt(e){const{content:t,footer:i,icon:n,...o}=e,s=r(Je,{target:document.body,props:{...o,children:t?()=>gt(t):void 0,footer:i?()=>gt(i):void 0,icon:n?()=>gt(n):void 0}});return{destroy:()=>d(s)}}function ct(){const e=r(dt,{target:document.body,props:{}});return{destroy:()=>d(e)}}function gt(e){if("string"==typeof e){const t=document.createElement("div");return t.innerHTML=e,t}return e}function ut(){const e=r(at,{target:document.body,props:{}});return{destroy:()=>d(e)}}function ht(e={}){const{config:t}=e;t&&y(t),s.set(x,v().zIndex.base,!0);const i=v(),n=e.backdrop??i.features.backdrop?ut():null,o=e.dock??i.features.dock?ct():null;return{backdrop:n,dock:o,destroy:()=>{null==n||n.destroy(),null==o||o.destroy()}}}export{te as bringToFront,oe as closeAllModals,ne as closeModal,ut as createBackdrop,ct as createDock,lt as createModal,v as getConfig,ht as init,fe as isModalOpen,me as isModalRegistered,U as minimizeModal,re as openChildModal,ie as openModal,Q as restoreModal,y as setConfig,ye as toggleModalTransparency};
1
+ import{m as o,x as t,a as n,s as e,i as r,g as s,D as a,B as d}from"./runtime.js";import{l as c,q as i,e as l,v as u,p,f,j as m,o as y,h as g,w as M}from"./runtime.js";function b(e){const{content:r,footer:s,icon:a,...d}=e,c=o(t,{target:document.body,props:{...d,children:r?()=>v(r):void 0,footer:s?()=>v(s):void 0,icon:a?()=>v(a):void 0}});return{destroy:()=>n(c)}}function k(){const t=o(a,{target:document.body,props:{}});return{destroy:()=>n(t)}}function v(o){if("string"==typeof o){const t=document.createElement("div");return t.innerHTML=o,t}return o}function T(){const t=o(d,{target:document.body,props:{}});return{destroy:()=>n(t)}}function h(o={}){const{config:t}=o;t&&e(t),r();const n=s(),a=o.backdrop??n.features.backdrop?T():null,d=o.dock??n.features.dock?k():null;return{backdrop:a,dock:d,destroy:()=>{null==a||a.destroy(),null==d||d.destroy()}}}export{c as bringToFront,i as closeAllModals,l as closeModal,T as createBackdrop,k as createDock,b as createModal,s as getConfig,h as init,u as isModalOpen,p as isModalRegistered,f as minimizeModal,m as openChildModal,y as openModal,g as restoreModal,e as setConfig,M as toggleModalTransparency};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "epic-modals",
3
- "version": "0.0.5",
3
+ "version": "0.0.6",
4
4
  "description": "A stunning modal library with macOS-style animations, drag, resize, and dock. Supports Svelte 5, React, and vanilla JS.",
5
5
  "keywords": [
6
6
  "modal",
@@ -50,8 +50,8 @@
50
50
  ],
51
51
  "scripts": {
52
52
  "dev": "vite dev",
53
- "build": "ENTRY=index vite build --mode development && ENTRY=svelte vite build --mode development && ENTRY=react vite build --mode development && ENTRY=vanilla vite build --mode development && node scripts/build-css.js",
54
- "build:prod": "ENTRY=index vite build && ENTRY=svelte vite build && ENTRY=react vite build && ENTRY=vanilla vite build && node scripts/build-css.js",
53
+ "build": "vite build && BUILD_TYPE=standalone vite build && node scripts/build-css.js",
54
+ "build:dev": "vite build --mode development && BUILD_TYPE=standalone vite build --mode development && node scripts/build-css.js",
55
55
  "check": "svelte-check --tsconfig ./tsconfig.json",
56
56
  "test": "vitest run",
57
57
  "test:watch": "vitest",
@@ -70,6 +70,9 @@
70
70
  },
71
71
  "react-dom": {
72
72
  "optional": true
73
+ },
74
+ "svelte": {
75
+ "optional": true
73
76
  }
74
77
  },
75
78
  "devDependencies": {