epic-modals 1.0.0 → 1.0.1
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/dist/core.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var t=Object.defineProperty,i=(i,e,n)=>((i,e,n)=>e in i?t(i,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):i[e]=n)(i,"symbol"!=typeof e?e+"":e,n);const e=Symbol.for("epic-modals-core");if("undefined"!=typeof globalThis){const t=globalThis;t[e],t[e]=!0}const n=new Map;let o=0,s=null;function a(t){s=t}let r=null;function d(t){r=t}const l=new Set;let h=!1,c=!1,g=!1,u=[],m=[],f=[],p=[],w=[],y=[],z=[],v=[],x=[],b=null;function I(t){b=t}const C=new Map;let P=null;function M(t){P=t}const A=new Map,k=new Set,R=new Set,B=new Set;let S=[];function D(t){S=t}let H=null;function E(t){H=t}let T=null;function O(t){T=t}let F=null;function W(t){F=t}function L(t){u=t}function _(t){m=t}function G(t){f=t}function $(t){p=t}function V(t){w=t}function Y(t){y=t}function X(t){z=t}function q(t){v=t}function N(t){x=t}function j(){if(!g){g=!0;try{l.forEach(t=>t())}finally{g=!1}}}function K(){o++,h?c=!0:j()}function U(){return o}function Z(t){return l.add(t),()=>l.delete(t)}function J(t){const i=h;h=!0;try{t()}finally{h=i,!i&&c&&(c=!1,queueMicrotask(()=>{j()}))}}function Q(t,i){if(t.width<=0||t.height<=0)throw new Error(`[epic-modals] Invalid dimensions in ${i}: width=${t.width}, height=${t.height}`)}function tt(t,i){return!!n.get(t)||(function(){var t,i;try{const e=import.meta;return!0===(null==(t=e.env)?void 0:t.DEV)||"development"===(null==(i=e.env)?void 0:i.MODE)}catch{return!1}}(),!1)}function it(){n.clear(),u=[],m=[],f=[],p=[],w=[],y=[],z=[],v=[],x=[],b=null,C.clear(),P=null,A.clear(),k.clear(),R.clear(),B.clear(),S=[],H=null,T=null,F=null,s&&(clearTimeout(s),s=null),r&&(clearTimeout(r),r=null)}function et(){return{modals:n,pendingMinimize:u,pendingOpen:m,pendingClose:f,pendingRestore:w,dockOrder:S,animatingModals:k,transparentModals:B}}function nt(t){return{id:t.id,title:t.title,icon:t.icon??"",isOpen:t.autoOpen??!1,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}}function ot(t){const i=n.get(t.id);let e;e=(null==i?void 0:i.zIndex)?i.zIndex:Math.max(...Array.from(n.values()).map(t=>t.zIndex),ue().zIndex.base-2)+2;const o=m.includes(t.id),s=t.isOpen||o;i?n.set(t.id,{...i,title:t.title,icon:t.icon,glow:t.glow,zIndex:e}):n.set(t.id,{...t,isOpen:s,zIndex:e,isAnimating:!1}),K(),t.isMinimized&&!S.includes(t.id)&&D([...S,t.id])}function st(t){const i=n.get(t);if(i){if(D(S.filter(i=>i!==t)),_(m.filter(i=>i!==t)),G(f.filter(i=>i!==t)),$(p.filter(i=>i!==t)),L(u.filter(i=>i!==t)),V(w.filter(i=>i!==t)),Y(y.filter(i=>i!==t)),X(z.filter(i=>i!==t)),q(v.filter(i=>i!==t)),i.childId){const t=n.get(i.childId);t&&n.set(i.childId,{...t,parentId:void 0})}if(i.parentId){const t=n.get(i.parentId);t&&n.set(i.parentId,{...t,childId:void 0,lastChildId:i.id})}n.delete(t),K(),B.delete(t),k.delete(t)}}function at(t,i){const e=n.get(t);if(!(null==e?void 0:e.childId))return;const o=n.get(e.childId);if(!o)return;const s=i+2;n.set(e.childId,{...o,zIndex:s}),at(e.childId,s)}function rt(t){if(!n.get(t))return;const i=Math.max(...Array.from(n.values()).map(t=>t.zIndex),0),e=function(t){let i=t,e=n.get(i);for(;null==e?void 0:e.parentId;)i=e.parentId,e=n.get(i);return i}(t),o=n.get(e);if(!o)return;const s=i+2;n.set(e,{...o,zIndex:s}),at(e,s),K()}function dt(t){const i=n.get(t);if(!i)return!1;const e=Math.max(...Array.from(n.values()).map(t=>t.zIndex),0);return i.zIndex===e&&!i.isMinimized&&!i.isHiddenWithParent}function lt(t,i){if(Array.isArray(t))D(t);else if("number"==typeof i){const e=t,n=[...S],[o]=n.splice(e,1);n.splice(i,0,o),D(n)}}const ht=8;function ct(t,i,e,n,o={}){const{margin:s=ht,allowPartialVisibility:a=!1}=o,r="undefined"!=typeof window?window.innerWidth:1920,d="undefined"!=typeof window?window.innerHeight:1080;let l,h,c,g;return a&&e>r-2*s?(l=40-e,h=r-40):(l=s,h=Math.max(s,r-e-s)),a&&n>d-2*s?(c=40-n,g=d-40):(c=s,g=Math.max(s,d-n-s)),{x:Math.max(l,Math.min(h,t)),y:Math.max(c,Math.min(g,i))}}function gt(t,i,e,n,o={}){const{margin:s=ht}=o,a=("undefined"!=typeof window?window.innerWidth:1920)-2*s,r=("undefined"!=typeof window?window.innerHeight:1080)-2*s,d=Math.min(e,a),l=Math.min(n,r),h=ct(t,i,d,l,o);return{x:h.x,y:h.y,width:d,height:l}}function ut(t,i){return Math.max(0,Math.min(t.x+t.width,i.x+i.width)-Math.max(t.x,i.x))*Math.max(0,Math.min(t.y+t.height,i.y+i.height)-Math.max(t.y,i.y))}function mt(t,i,e,n,o,s){const a={x:t-s,y:i-s,width:e+2*s,height:n+2*s};let r=0;for(const t of o)r+=ut(a,t);return r}function ft(t,i){const e=i.x-(t.x+t.width),n=t.x-(i.x+i.width),o=i.y-(t.y+t.height),s=t.y-(i.y+i.height),a=Math.max(e,n,0),r=Math.max(o,s,0);return 0===a&&0===r?0:Math.sqrt(a*a+r*r)}function pt(t){if("undefined"==typeof document)return[];const i=[];for(const e of t)try{const t=document.querySelectorAll(e);for(const e of t){const t=e.getBoundingClientRect();t.width>0&&t.height>0&&i.push({x:t.left,y:t.top,width:t.width,height:t.height})}}catch{}return i}function wt(t,i,e,n,o){let s=e,a=e,r=t-e,d=i-e;for(const e of n){const n=e.y,l=i-(e.y+e.height),h=e.x,c=t-(e.x+e.width);let g;if(e.width>e.height)g=n<=l?"top":"bottom";else if(e.height>e.width)g=h<=c?"left":"right";else{const t=Math.min(n,l,h,c);g=t===n?"top":t===l?"bottom":t===h?"left":"right"}"bottom"===g?d=Math.min(d,e.y-o):"top"===g?a=Math.max(a,e.y+e.height+o):"left"===g?s=Math.max(s,e.x+e.width+o):r=Math.min(r,e.x-o)}return{x:s,y:a,width:Math.max(0,r-s),height:Math.max(0,d-a)}}function yt(t,i,e,n){const o=t-i,s=e-1;if(o<=0)return{interGap:0,edgeGap:0};if(e<=1)return{interGap:0,edgeGap:o/2};const a=o/(e+1);if(a>=n)return{interGap:a,edgeGap:a};const r=s*n;return o>=r?{interGap:n,edgeGap:(o-r)/2}:{interGap:o/s,edgeGap:0}}function zt(t,i,e,n,o=0){if(0===e.length)return{cols:t,rows:i,score:1/0,positions:new Map};const s=new Array(t).fill(0),a=new Array(i).fill(0);for(let i=0;i<e.length;i++){const n=i%t,o=Math.floor(i/t);s[n]=Math.max(s[n],e[i].width),a[o]=Math.max(a[o],e[i].height)}const r=s.reduce((t,i)=>t+i,0),d=a.reduce((t,i)=>t+i,0);if(r>n.width||d>n.height)return null;const{interGap:l,edgeGap:h}=yt(n.width,r,t,o),{interGap:c,edgeGap:g}=yt(n.height,d,i,o),u=new Map,m=[0];for(let i=0;i<t;i++)m.push(m[i]+s[i]);const f=[0];for(let t=0;t<i;t++)f.push(f[t]+a[t]);for(let i=0;i<e.length;i++){const o=i%t,r=Math.floor(i/t),d=e[i],p=n.x+h+o*l+m[o],w=n.y+g+r*c+f[r],y=p+(s[o]-d.width)/2,z=w+(a[r]-d.height)/2;u.set(d.id,{x:Math.round(y),y:Math.round(z)})}const p=t>1?l:h,w=i>1?c:g;return{cols:t,rows:i,score:(.6*Math.min(p,w)+.4*Math.sqrt(p*w))*(n.width>n.height==t>=i?1.02:1),positions:u}}function vt(t,i,e={}){const{modalGap:n=16,viewportMargin:o=16,avoidBounds:s=[],avoidMargin:a=24}=e,r="undefined"!=typeof window?window.innerWidth:1920,d="undefined"!=typeof window?window.innerHeight:1080,l=new Map,h=t.filter(t=>!t.parentId),c=h.map(t=>({id:t.id,width:t.width,height:t.height}));if(i&&c.push({id:i.id,width:i.width,height:i.height}),0===c.length)return{positions:l};const g=new Map(h.map(t=>[t.id,t.currentPosition]));c.sort((t,i)=>{const e=g.get(t.id),n=g.get(i.id);return(e?e.x+t.width/2:1/0)-(n?n.x+i.width/2:1/0)});const u=wt(r,d,o,s,a);if(1===c.length){const t=c[0],i=u.x+(u.width-t.width)/2,e=u.y+(u.height-t.height)/2;return l.set(t.id,{x:Math.round(i),y:Math.round(e)}),{positions:l}}const m=c.length;let f=null;for(let t=1;t<=m;t++){const i=zt(t,Math.ceil(m/t),c,u,n);i&&(null===f||i.score>f.score)&&(f=i)}if(f){for(const[t,i]of f.positions)l.set(t,i);return{positions:l}}if(i){const t=h.map(t=>({x:t.currentPosition.x,y:t.currentPosition.y,width:t.width,height:t.height})),e=function(t,i,e,n,o=20){const s=n.x+(n.width-t)/2,a=n.y+(n.height-i)/2;if(0===e.length)return{x:Math.round(s),y:Math.round(a)};const r=n.x,d=Math.max(n.x,n.x+n.width-t),l=n.y,h=Math.max(n.y,n.y+n.height-i);if(d<=r||h<=l)return{x:Math.round(s),y:Math.round(a)};const c=(d-r)/o,g=(h-l)/o;let u={x:s,y:a},m=1/0;const f=t*i,p=Math.hypot(n.width/2,n.height/2),w=n.x+n.width/2,y=n.y+n.height/2;for(let n=0;n<=o;n++)for(let s=0;s<=o;s++){const o=r+n*c,a=l+s*g,d=mt(o,a,t,i,e,0),h=f>0?d/f:0,z=Math.hypot(o+t/2-w,a+i/2-y),v=.5*h+.5*(p>0?z/p:0);v<m&&(m=v,u={x:o,y:a})}return{x:Math.round(u.x),y:Math.round(u.y)}}(i.width,i.height,t,u);return l.set(i.id,e),{positions:l}}const p=function(t,i){const e=new Map,n=Math.max(...t.map(t=>t.width)),o=Math.max(...t.map(t=>t.height)),s=n+40*(t.length-1),a=o+40*(t.length-1);let r=i.x+(i.width-s)/2,d=i.y+(i.height-a)/2;r=Math.max(i.x,r),d=Math.max(i.y,d);for(let i=0;i<t.length;i++)e.set(t[i].id,{x:Math.round(r+40*i),y:Math.round(d+40*i)});return e}(c,u);return{positions:p}}function xt(t){return t}function bt(t){return"undefined"==typeof document?null:document.querySelector(`.modal-dialog[data-modal-id="${t}"]`)}function It(){return{x:window.innerWidth/2,y:window.innerHeight/2}}const Ct={minimize:500,restore:400,open:400,close:250,attention:300,parentMove:300,parentRetargetInterval:100,centerAfterResize:200,glowStabilize:1e3,overlayFade:200},Pt=100,Mt={easeOut:"ease-out",easeOutCubic:"cubic-bezier(0.25, 0.1, 0.25, 1)",linear:"linear",easeInOut:"ease-in-out"};function At(t){switch(t){case"open":return Ct.open;case"close":return Ct.close;case"minimize":return Ct.minimize;case"restore":return Ct.restore;case"attention":return Ct.attention;default:return 0}}function kt(t){switch(t){case"open":case"restore":return Mt.easeOut;case"close":case"minimize":return Mt.easeOutCubic;case"attention":return Mt.easeInOut;default:return Mt.linear}}function Rt(t,i,e,n){var o;const s=i.x-e.x,a=i.y-e.y;if(0===s&&0===a)return null==(o=null==n?void 0:n.onComplete)||o.call(n),()=>{};const r=(null==n?void 0:n.duration)??Ct.parentMove,d=(null==n?void 0:n.easing)??"ease-out";let l=!1;function h(){var t;l||(l=!0,clearTimeout(g),null==(t=null==n?void 0:n.onComplete)||t.call(n))}t.style.left=`${e.x}px`,t.style.top=`${e.y}px`;const c=t.animate([{transform:`translate(${s}px, ${a}px)`},{transform:"translate(0, 0)"}],{duration:r,easing:d,fill:"none"});c.onfinish=h;const g=setTimeout(h,r+Pt);return function(){l||(l=!0,clearTimeout(g),c.cancel())}}function Bt(t){return n.get(t)}function St(t){const i=n.get(t);return(null==i?void 0:i.isOpen)??!1}function Dt(t){return n.has(t)}function Ht(t){return k.has(t)}function Et(t,i){i?k.add(t):k.delete(t)}function Tt(){return n}function Ot(){return S}function Ft(t){return"undefined"==typeof document?null:document.querySelector(`[data-dock-item="${t}"]`)}function Wt(){const t=[];for(const i of n.values()){if(!i.isOpen||i.isMinimized||i.isHiddenWithParent)continue;if(R.has(i.id))continue;const e=bt(i.id);if(!e)continue;const n=i.position??{x:e.getBoundingClientRect().left,y:e.getBoundingClientRect().top},o=i.size??{width:e.offsetWidth,height:e.offsetHeight};t.push({id:i.id,width:o.width,height:o.height,currentPosition:n,parentId:i.parentId})}return t}function Lt(t){const i=[];for(const e of n.values())if(e.isOpen&&!e.isMinimized&&!e.isHiddenWithParent&&(!t||e.id!==t))if(e.position&&e.size)i.push({x:e.position.x,y:e.position.y,width:e.size.width,height:e.size.height});else{const t=bt(e.id);if(t){const e=t.getBoundingClientRect();i.push({x:e.left,y:e.top,width:e.width,height:e.height})}}return i}function _t(t){const i=[];for(const e of n.values())if(e.isOpen&&!e.isMinimized&&!e.isHiddenWithParent&&(!t||e.id!==t))if(e.position&&e.size)i.push({id:e.id,x:e.position.x,y:e.position.y,width:e.size.width,height:e.size.height});else{const t=bt(e.id);if(t){const n=t.getBoundingClientRect();i.push({id:e.id,x:n.left,y:n.top,width:n.width,height:n.height})}}return i}function Gt(t,i,e){if(!tt(t))return;!function(t){if(!Number.isFinite(t.x)||!Number.isFinite(t.y))throw new Error(`[epic-modals] Invalid position in updateModalPosition: x=${t.x}, y=${t.y}`)}(i),(null==e?void 0:e.size)&&Q(e.size,"updateModalPosition");const o=n.get(t);if(!o)return;let s=i;if((null==e?void 0:e.constrain)&&o.size&&(s=ct(i.x,i.y,o.size.width,o.size.height)),n.set(t,{...o,position:s,size:(null==e?void 0:e.size)??o.size,hasBeenDragged:o.hasBeenDragged||(null==e?void 0:e.drag)||!1}),o.childId){let i=t,e=s;for(;;){const t=n.get(i);if(!(null==t?void 0:t.childId))break;const o=n.get(t.childId);if(!(null==o?void 0:o.offsetFromParent))break;const s={x:e.x+o.offsetFromParent.x,y:e.y+o.offsetFromParent.y};n.set(t.childId,{...o,position:s,hasBeenDragged:!0}),i=t.childId,e=s}}if(o.parentId&&o.offsetFromParent){const i=ue();let a=t,r=o;for(;r.parentId&&r.offsetFromParent;){const o=n.get(r.parentId);if(!o)break;const d=a===t?s:n.get(a).position,l={x:d.x-r.offsetFromParent.x,y:d.y-r.offsetFromParent.y};if("animated"===i.parentChild.movementMode&&!(null==e?void 0:e.realtime)){A.set(r.parentId,l);break}n.set(r.parentId,{...o,position:l,hasBeenDragged:!0}),a=r.parentId,r=o}}K()}function $t(t){const i=n.get(t);if(!i)return;if(!i.isAnimatingPosition)return;i.isAnimatingPosition=!1;let e=i.childId;for(;e;){const t=n.get(e);t&&(t.isAnimatingPosition=!1),e=null==t?void 0:t.childId}K()}function Vt(t,i){if(!tt(t))return;Q(i,"updateModalSize");const e=n.get(t);e&&(n.set(t,{...e,size:i}),K())}function Yt(t,i){const e=n.get(t);e&&(n.set(t,{...e,...i}),K())}function Xt(t){const i=ue();"smart"===i.positioning.strategy&&(s&&clearTimeout(s),a(setTimeout(()=>{const e=Wt(),n=pt(i.positioning.avoidElements);qt(vt(e,t,{modalGap:i.positioning.modalGap,viewportMargin:i.positioning.modalGap,avoidBounds:n,avoidMargin:i.positioning.modalGap}).positions),a(null)},50)))}function qt(t){if(0===t.size)return;const i=[];for(const[e,o]of t){const t=n.get(e);if(!t)continue;const s=bt(e),a=t.position??(s?{x:s.getBoundingClientRect().left,y:s.getBoundingClientRect().top}:{x:0,y:0}),r=t.size??(s?{width:s.offsetWidth,height:s.offsetHeight}:{width:0,height:0});i.push({id:e,element:s,oldPosition:a,newPosition:o,size:r}),Nt(e,a,o,i)}for(const{id:t,newPosition:e,size:o}of i){const i=n.get(t);i&&n.set(t,{...i,position:e,size:o,hasBeenDragged:!0,isAnimatingPosition:!0})}K();for(const{id:t,element:e,oldPosition:n,newPosition:o}of i)e?Rt(e,n,o,{duration:Ct.parentMove,onComplete:()=>$t(t)}):setTimeout(()=>$t(t),Ct.parentMove+Pt)}function Nt(t,i,e,o){const s=n.get(t);if(!(null==s?void 0:s.childId))return;const a=n.get(s.childId);if(!(null==a?void 0:a.offsetFromParent))return;const r=bt(s.childId),d={x:i.x+a.offsetFromParent.x,y:i.y+a.offsetFromParent.y},l={x:e.x+a.offsetFromParent.x,y:e.y+a.offsetFromParent.y};o.push({id:s.childId,element:r,oldPosition:d,newPosition:l}),n.set(s.childId,{...a,position:l,hasBeenDragged:!0,isAnimatingPosition:!0}),a.childId&&Nt(s.childId,d,l,o)}function jt(){r&&clearTimeout(r),d(setTimeout(()=>{Xt(null),d(null)},100))}let Kt=!1;function Ut(){Kt||"undefined"==typeof window||(window.addEventListener("resize",jt),Kt=!0)}function Zt(){"undefined"!=typeof window&&(window.removeEventListener("resize",jt),Kt=!1)}function Jt(t){if(0===t.size)return;const i=[];for(const[e,o]of t){const t=n.get(e);if(!t)continue;const s=bt(e),a=t.position??(s?{x:s.getBoundingClientRect().left,y:s.getBoundingClientRect().top}:{x:0,y:0});i.push({id:e,element:s,oldPosition:a,newPosition:o})}for(const{id:t,newPosition:e}of i){const i=n.get(t);i&&n.set(t,{...i,position:e,hasBeenDragged:!0,isAnimatingPosition:!0})}K();for(const{id:t,element:e,oldPosition:n,newPosition:o}of i)e?Rt(e,n,o,{duration:Ct.parentMove,onComplete:()=>$t(t)}):setTimeout(()=>$t(t),Ct.parentMove+Pt)}function Qt(t){A.delete(t)}function ti(t){const i=n.get(t);if(!(null==i?void 0:i.childId))return;const e=n.get(i.childId);e&&(z.includes(i.childId)||X([...z,i.childId]),e.childId&&ti(i.childId))}function ii(t){const i=n.get(t);if(!i||i.isMinimized)return;if(Qt(t),i.parentId){const t=n.get(i.parentId);if(t&&!t.isMinimized)return void ii(i.parentId)}if(L([...u,t]),i.position&&i.size&&T){const e=T(),n=S.indexOf(t);I({x:e.x+n*(e.height+8),y:e.y,originX:i.position.x+i.size.width/2,originY:i.position.y+i.size.height/2})}const e=i.childId;n.set(t,{...i,isMinimized:!0,lastChildId:e}),S.includes(t)||D([...S,t]),K(),i.childId&&ti(t),Xt(null)}function ei(t){const i=n.get(t);if(!i||!i.isMinimized)return;n.set(t,{...i,isMinimized:!1,isOpen:!0}),V([...w,t]),rt(t);const e=i.lastChildId||i.childId;e&&oi(e),K()}function ni(){Array.from(n.values()).filter(t=>t.isMinimized).map(t=>t.id).forEach(t=>{const i=n.get(t);if(i){n.set(t,{...i,isMinimized:!1,isOpen:!0}),V([...w,t]),rt(t);const e=i.lastChildId||i.childId;e&&oi(e)}}),D([]),K()}function oi(t){const i=n.get(t);if(i&&i.isHiddenWithParent){Y([...y,t]);const e=i.lastChildId||i.childId;e&&oi(e)}}function si(t){const i=n.get(t);i&&i.isHiddenWithParent&&(n.set(t,{...i,isHiddenWithParent:!1}),K())}function ai(t){const i=n.get(t);i&&(n.set(t,{...i,isHiddenWithParent:!0}),K())}function ri(t){const i=n.get(t);if(!(null==i?void 0:i.childId))return;const e=n.get(i.childId);e&&(e.childId&&ri(i.childId),n.set(i.childId,{...e,isHiddenWithParent:!0}),K())}function di(t){if(!tt(t))return;const i=n.get(t);B.has(t)?(B.delete(t),n.set(t,{...i,isTransparent:!1})):(B.add(t),n.set(t,{...i,isTransparent:!0})),K()}function li(t){tt(t)&&(v.includes(t)||(q([...v,t]),K()))}function hi(t){t.classList.add("modal-shake"),t.addEventListener("animationend",()=>{t.classList.remove("modal-shake")},{once:!0})}function ci(t){if(!tt(t))return;const i=n.get(t);n.set(t,{...i,isRejected:!0}),K(),setTimeout(()=>{const i=n.get(t);i&&(n.set(t,{...i,isRejected:!1}),K())},300);const e=bt(t);e&&hi(e)}function gi(t){if(!tt(t))return;const i=n.get(t);B.delete(t),n.set(t,{...i,isTransparent:!1}),K()}function ui(t){}function mi(t){}function fi(t,i,e){pi(t,e,{parentId:i})}function pi(t,i,e){const o=ue(),s=n.get(t);if(s&&s.isOpen&&!s.isMinimized&&!s.isHiddenWithParent)return li(t),void rt(t);if(s&&s.isMinimized)return void ei(t);if("x"in i&&"y"in i)C.set(t,i);else{const e=i.getBoundingClientRect();C.set(t,{x:e.left+e.width/2,y:e.top+e.height/2})}if((null==e?void 0:e.parentId)&&o.features.parentChild){const i=n.get(e.parentId);(null==i?void 0:i.childId)&&i.childId!==t&&yi(i.childId,!0),M({parentId:e.parentId,childId:t})}if(m.includes(t)||_([...m,t]),K(),!s)return void((null==F?void 0:F.isRegisteredInRegistry(t))&&F.mountModal(t));const a={isOpen:!0};(null==e?void 0:e.parentId)&&o.features.parentChild&&(a.parentId=e.parentId),n.set(t,{...s,...a}),rt(t),null==H||H.push(t)}function wi(t){ot(t);const i=n.get(t.id);i&&(n.set(t.id,{...i,isOpen:!0}),K()),_([...m,t.id]),K(),rt(t.id),null==H||H.push(t.id)}function yi(t,i=!1){const e=n.get(t);if(e&&(e.isOpen||e.isMinimized)){if(Qt(t),e.childId&&yi(e.childId,i),e.isMinimized)return D(S.filter(i=>i!==t)),vi(t),void(null==H||H.pop());R.add(t),i?$([...p,t]):G([...f,t]),e.parentId||Xt(null),K(),null==H||H.pop()}}function zi(t){const i=new Set(t??[]);Array.from(n.keys()).filter(t=>!i.has(t)).forEach(t=>yi(t,!0))}function vi(t){const i=n.get(t);if(i){if(R.delete(t),i.parentId){const e=n.get(i.parentId);e&&e.childId===t&&n.set(i.parentId,{...e,childId:void 0,lastChildId:t})}n.set(t,{...i,isOpen:!1,isMinimized:!1,isHiddenWithParent:!1,isTransparent:!1,position:null,size:null,hasBeenDragged:!1,parentId:void 0,childId:void 0,offsetFromParent:void 0}),K()}}function xi(t){if(Array.isArray(t)){const i=new Set(t);return Array.from(n.entries()).filter(([t,e])=>e.isOpen&&!i.has(t)).map(([t])=>t)}const i=n.get(t);if(!i)return[t];const e=[t];return i.childId&&e.push(...xi(i.childId)),e}function bi(t){return u.includes(t)}function Ii(t){L(u.filter(i=>i!==t));const i=b;return I(null),i}function Ci(t){return z.includes(t)}function Pi(t){X(z.filter(i=>i!==t))}function Mi(t){return m.includes(t)}function Ai(t){_(m.filter(i=>i!==t))}function ki(t){return f.includes(t)}function Ri(t){G(f.filter(i=>i!==t))}function Bi(t){return p.includes(t)}function Si(t){$(p.filter(i=>i!==t))}function Di(t){return w.includes(t)}function Hi(t){V(w.filter(i=>i!==t))}function Ei(t){return y.includes(t)}function Ti(t){Y(y.filter(i=>i!==t))}function Oi(t){return v.includes(t)}function Fi(t){q(v.filter(i=>i!==t)),x.includes(t)||N([...x,t])}function Wi(t){N(x.filter(i=>i!==t))}function Li(t){return(null==P?void 0:P.childId)===t}function _i(t){return A.has(t)}function Gi(t){const i=A.get(t)??null;return A.delete(t),i}function $i(t,i){C.set(t,i)}function Vi(t){return C.get(t)??null}function Yi(t){const i=C.get(t)??null;return C.delete(t),i}function Xi(){const t=b;return I(null),t}function qi(t){const i=P;return t&&(null==i?void 0:i.childId)!==t?null:(M(null),i)}function Ni(t,i,e){const o=n.get(t),s=n.get(i);o&&s&&(n.set(t,{...o,childId:i}),n.set(i,{...s,parentId:t,offsetFromParent:e}),rt(i),K())}function ji(){return P}function Ki(t){if("animated"!==ue().parentChild.movementMode)return;const i=n.get(t);if(!(null==i?void 0:i.parentId)||!i.offsetFromParent||!i.position)return;const e={x:i.position.x-i.offsetFromParent.x,y:i.position.y-i.offsetFromParent.y};A.set(i.parentId,e),K()}function Ui(t){return A.get(t)??null}function Zi(t,i,e){const o=n.get(t);if(!o)return null;const s=bt(t);if(!s)return null;const a=o.position??{x:s.getBoundingClientRect().left,y:s.getBoundingClientRect().top},r=o.size??{width:s.offsetWidth,height:s.offsetHeight};return{x:a.x+(r.width-i)/2,y:a.y+(r.height-e)/2}}const Ji={BASE:0,DROPDOWN:100,STICKY:200,OVERLAY:300,MODAL:400,DOCK:8e3,TOAST:9e3};let Qi=Ji.MODAL;function te(){Qi=ue().zIndex.base}function ie(){const t=Qi;return Qi+=2,t}function ee(t){const i=ue();return"MODAL"===t?i.zIndex.base:"DOCK"===t?i.zIndex.dock:"TOAST"===t?i.zIndex.toast:Ji[t]}function ne(){Qi=ue().zIndex.base}function oe(){const t=new Map;return{on(i,e){let n=t.get(i);return n||(n=new Set,t.set(i,n)),n.add(e),()=>{null==n||n.delete(e),0===(null==n?void 0:n.size)&&t.delete(i)}},emit(i,e){const n=t.get(i);n&&n.forEach(t=>t(e))},off(i){i?t.delete(i):t.clear()},listenerCount(i){var e;return(null==(e=t.get(i))?void 0:e.size)??0}}}function se(t){return"boolean"==typeof t?{visible:t,blockClicks:t}:t}const ae={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,easing:"cubic-bezier(0.34, 1.56, 0.64, 1)"},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 re={...ae},de=0;const le=new Set;function he(t){return le.add(t),()=>le.delete(t)}function ce(){le.forEach(t=>t())}function ge(){return de}function ue(){return re}function me(t){const i=re;re=pe(re,t),de++,ce(),i.features.dock&&!re.features.dock&&ni()}function fe(){re={...ae},de++,ce()}function pe(t,i){var e;return{features:{...t.features,...i.features},dock:{...t.dock,...i.dock},animations:{...t.animations,...i.animations},appearance:{...t.appearance,...i.appearance},zIndex:{...t.zIndex,...i.zIndex},parentChild:{...t.parentChild,...i.parentChild},positioning:{...t.positioning,...i.positioning,avoidElements:(null==(e=i.positioning)?void 0:e.avoidElements)??t.positioning.avoidElements},portalTarget:i.portalTarget??t.portalTarget}}function we(t){const i=re.features[t];if("backdrop"===t){const t=se(i);return t.visible||t.blockClicks}return i}function ye(t,i){const e=ue(),n=i?pe(e,i):e;return{isFeatureEnabled:i=>{var e;if(void 0!==(null==(e=null==t?void 0:t.features)?void 0:e[i])){const e=t.features[i];if("backdrop"===i){const t=se(e);return t.visible||t.blockClicks}return e}const o=n.features[i];if("backdrop"===i){const t=se(o);return t.visible||t.blockClicks}return o},getAppearance:i=>{var e;return void 0!==(null==(e=null==t?void 0:t.appearance)?void 0:e[i])?t.appearance[i]:n.appearance[i]},getPositioning:i=>{var e;return void 0!==(null==(e=null==t?void 0:t.positioning)?void 0:e[i])?t.positioning[i]:n.positioning[i]},getEffectiveConfig:()=>n}}function ze(t){const{getModalConfig:i,getProviderConfig:e}=t;return{getEffectiveConfig:function(){const t=ue(),n=e(),o=i();let s=t;return n&&(s=pe(s,n)),o&&(s={...s,features:{...s.features,...o.features},appearance:{...s.appearance,...o.appearance},animations:{...s.animations,...o.animations},positioning:{...s.positioning,...o.positioning},parentChild:{...s.parentChild,...o.parentChild}}),s},isFeatureEnabled:function(t){var n,o;const s=i(),a=e(),r=i=>{if(void 0!==i){if("backdrop"===t&&"object"==typeof i){const t=se(i);return t.visible||t.blockClicks}return i}},d=r(null==(n=null==s?void 0:s.features)?void 0:n[t]);if(void 0!==d)return d;const l=r(null==(o=null==a?void 0:a.features)?void 0:o[t]);return void 0!==l?l:r(ue().features[t])??!1},getAppearance:function(t){var n,o;const s=i(),a=e();return void 0!==(null==(n=null==s?void 0:s.appearance)?void 0:n[t])?s.appearance[t]:void 0!==(null==(o=null==a?void 0:a.appearance)?void 0:o[t])?a.appearance[t]:ue().appearance[t]},getAnimation:function(t){var n,o;const s=i(),a=e();return void 0!==(null==(n=null==s?void 0:s.animations)?void 0:n[t])?s.animations[t]:void 0!==(null==(o=null==a?void 0:a.animations)?void 0:o[t])?a.animations[t]:ue().animations[t]},getPositioning:function(t){var n,o;const s=i(),a=e();return void 0!==(null==(n=null==s?void 0:s.positioning)?void 0:n[t])?s.positioning[t]:void 0!==(null==(o=null==a?void 0:a.positioning)?void 0:o[t])?a.positioning[t]:ue().positioning[t]},getParentChild:function(t){var n,o;const s=i(),a=e();return void 0!==(null==(n=null==s?void 0:s.parentChild)?void 0:n[t])?s.parentChild[t]:void 0!==(null==(o=null==a?void 0:a.parentChild)?void 0:o[t])?a.parentChild[t]:ue().parentChild[t]}}}const ve={modal:"modal-dialog",modalDragging:"modal-dragging",modalResizing:"modal-resizing",modalPositioned:"modal-positioned",modalMinimizing:"modal-minimizing",modalRestoring:"modal-restoring",modalOpening:"modal-opening",modalClosing:"modal-closing",modalCentered:"modal-centered",modalSolid:"modal-solid",modalTransparent:"modal-transparent",modalGlow:"modal-glow",modalHasGlow:"modal-has-glow",modalHasChild:"modal-has-child",modalIsChild:"modal-is-child",modalWasRestored:"modal-was-restored",modalVisibleByAnimation:"modal-visible-by-animation",modalAwaitingRestore:"modal-awaiting-restore",modalAwaitingChildOpen:"modal-awaiting-child-open",modalAnimatingToCenter:"modal-animating-to-center",modalAnimatingPosition:"modal-animating-position",modalAttention:"modal-attention",modalGlowStabilizing:"modal-glow-stabilizing",header:"modal-header",headerDraggable:"modal-header-draggable",body:"modal-body",footer:"modal-footer",childOverlay:"modal-child-overlay",overlayClosing:"modal-overlay-closing",headerTitle:"modal-header-title",headerIcon:"modal-header-icon",headerTitleGroup:"modal-header-title-group",headerActions:"modal-header-actions",headerTrafficLights:"modal-header-traffic-lights",headerLight:"modal-header-light",headerLightClose:"modal-header-light-close",headerLightMinimize:"modal-header-light-minimize",headerLightStyle:"modal-header-light-style",headerLightDisabled:"modal-header-light-disabled",headerMacCenter:"modal-header-mac-center",headerMacSpacer:"modal-header-mac-spacer",headerBtnWindows:"modal-header-btn-windows",headerBtnWindowsClose:"modal-header-btn-windows-close",headerBtnWindowsStyle:"modal-header-btn-windows-style",headerBtnWindowsDisabled:"modal-header-btn-windows-disabled",resizeHandles:"modal-resize-handles",resizeHandle:"modal-resize-handle",resizeN:"modal-resize-n",resizeS:"modal-resize-s",resizeE:"modal-resize-e",resizeW:"modal-resize-w",resizeNE:"modal-resize-ne",resizeNW:"modal-resize-nw",resizeSE:"modal-resize-se",resizeSW:"modal-resize-sw",resizePrefix:"modal-resize-",dock:"modal-dock",dockContainer:"modal-dock-container",dockItem:"modal-dock-item",dockItemActive:"modal-dock-item-active",dockItemHasGlow:"modal-dock-item-has-glow",dockItemHasChild:"modal-dock-item-has-child",dockItemLabelBeside:"modal-dock-item-label-beside",dockItemLabelBelow:"modal-dock-item-label-below",dockItemIcon:"modal-dock-item-icon",dockItemIconPlaceholder:"modal-dock-item-icon-placeholder",dockItemLabel:"modal-dock-item-label",dockItemGlow:"modal-dock-item-glow",dockChildIndicator:"modal-dock-child-indicator",dockHandle:"modal-dock-handle",dockHandleDragging:"modal-dock-handle-dragging",dockLeft:"modal-dock-left",dockRight:"modal-dock-right",dockBottom:"modal-dock-bottom",dockFree:"modal-dock-free",dockEmpty:"modal-dock-empty",dockFreeHorizontal:"modal-dock-free-horizontal",dockFreeVertical:"modal-dock-free-vertical",backdrop:"modal-backdrop",backdropVisible:"modal-backdrop-visible",srOnly:"sr-only",reactBodyContent:"react-modal-body-content",reactFooterContent:"react-modal-footer-content"},xe={dialog:ve.modal,dialogCentered:ve.modalCentered,dialogDragging:ve.modalDragging,dialogResizing:ve.modalResizing,dialogMinimizing:ve.modalMinimizing,dialogRestoring:ve.modalRestoring,dialogOpening:ve.modalOpening,dialogClosing:ve.modalClosing,dialogSolid:ve.modalSolid,dialogTransparent:ve.modalTransparent,dialogHasGlow:ve.modalHasGlow,dialogHasChild:ve.modalHasChild,dialogIsChild:ve.modalIsChild,dialogAnimatingPosition:ve.modalAnimatingPosition,dialogAttention:ve.modalAttention,header:ve.header,headerDraggable:ve.headerDraggable,headerLayout:t=>`modal-header--${t}`,body:ve.body,footer:ve.footer,childOverlay:ve.childOverlay,overlayClosing:ve.overlayClosing,headerTitle:ve.headerTitle,headerIcon:ve.headerIcon,headerTitleGroup:ve.headerTitleGroup,headerActions:ve.headerActions,headerTrafficLights:ve.headerTrafficLights,headerLight:ve.headerLight,headerLightClose:ve.headerLightClose,headerLightMinimize:ve.headerLightMinimize,headerLightStyle:ve.headerLightStyle,headerLightDisabled:ve.headerLightDisabled,headerMacCenter:ve.headerMacCenter,headerMacSpacer:ve.headerMacSpacer,headerBtnWindows:ve.headerBtnWindows,headerBtnWindowsClose:ve.headerBtnWindowsClose,headerBtnWindowsStyle:ve.headerBtnWindowsStyle,headerBtnWindowsDisabled:ve.headerBtnWindowsDisabled,resizeHandles:ve.resizeHandles,resizeHandle:ve.resizeHandle,resizePrefix:ve.resizePrefix,dock:ve.dock,dockContainer:ve.dockContainer,dockItem:ve.dockItem,dockItemActive:ve.dockItemActive,dockItemHasGlow:ve.dockItemHasGlow,dockItemHasChild:ve.dockItemHasChild,dockItemLabelBeside:ve.dockItemLabelBeside,dockItemLabelBelow:ve.dockItemLabelBelow,dockItemIcon:ve.dockItemIcon,dockItemIconPlaceholder:ve.dockItemIconPlaceholder,dockItemLabel:ve.dockItemLabel,dockItemGlow:ve.dockItemGlow,dockChildIndicator:ve.dockChildIndicator,dockHandle:ve.dockHandle,dockHandleDragging:ve.dockHandleDragging,dockLeft:ve.dockLeft,dockRight:ve.dockRight,dockBottom:ve.dockBottom,dockFree:ve.dockFree,dockEmpty:ve.dockEmpty,dockFreeHorizontal:ve.dockFreeHorizontal,dockFreeVertical:ve.dockFreeVertical,backdrop:ve.backdrop,backdropVisible:ve.backdropVisible},be={modalId:"data-modal-id",dockContainer:"data-dock-container",resizeDir:"data-resize-dir",modalBridge:"data-modal-bridge"},Ie={modalId:be.modalId,resizeDirection:"data-direction",dockItemId:"data-dock-item-id"},Ce=["n","s","e","w","ne","nw","se","sw"],Pe={n:"Resize north",s:"Resize south",e:"Resize east",w:"Resize west",ne:"Resize northeast",nw:"Resize northwest",se:"Resize southeast",sw:"Resize southwest"},Me={minimize:500,restore:400,open:400,close:250,overlay:200,centerAfterResize:200,glowStabilize:1e3},Ae={minWidth:280,minHeight:200,maxWidth:"600px",zIndexBase:1e3},ke=["button:not([disabled])","[href]","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(", ");function Re(t,i){return function(t,i,e={}){const{timeout:n=5e3}=e;return new Promise((e,o)=>{const s=performance.now(),a=()=>{const r=t(),d=performance.now()-s;r&&i(r)?e(r):d>=n?o(new Error(`DOM not ready after ${n}ms`)):requestAnimationFrame(a)};a()})}(t,t=>t.offsetWidth>0&&t.offsetHeight>0,i)}function Be(t,i,e=2e3){return new Promise((n,o)=>{let s=!1;const a=e=>{i&&e.animationName!==i||s||(s=!0,t.removeEventListener("animationend",a),n(e))};t.addEventListener("animationend",a),setTimeout(()=>{s||(s=!0,t.removeEventListener("animationend",a),o(new Error(`Animation '${i||"any"}' did not complete within ${e}ms`)))},e)})}const Se={MINIMIZE:"modal-genie-minimize",RESTORE:"modal-genie-restore",OPEN:"modal-genie-restore",CLOSE:"modal-close",CLOSE_CENTERED:"modal-close-centered",CHILD_APPEAR:"modal-child-appear",CHILD_DISAPPEAR:"modal-child-disappear"};function De(t,i){const e=e=>{e.target===t&&i(e.animationName)};return t.addEventListener("animationend",e),()=>t.removeEventListener("animationend",e)}function He(){const t=Tt();return Array.from(t.values()).filter(t=>t.isMinimized).sort((t,i)=>t.dockPosition-i.dockPosition)}function Ee(t,i,e){const n=ct(t.x,t.y,i,e);return{x:Math.round(n.x),y:Math.round(n.y)}}function Te(t,i,e,n,o,s=8){const a=window.innerWidth-n-s,r=window.innerHeight-o-s,d=Math.min(Math.max(t-e.x,s),Math.max(s,a)),l=Math.min(Math.max(i-e.y,s),Math.max(s,r));return{x:Math.round(d),y:Math.round(l)}}function Oe(t,i){const e=["modal-dock-container"];return"left"===t?e.push("modal-dock-left"):"right"===t?e.push("modal-dock-right"):"bottom"===t?e.push("modal-dock-bottom"):"free"===t&&e.push("modal-dock-free"),i&&e.push("modal-dock-empty"),e.join(" ")}function Fe(t,i){const e=["modal-dock"];return"free"===t&&e.push("horizontal"===i?"modal-dock-free-horizontal":"modal-dock-free-vertical"),e.join(" ")}function We(){const t=Tt();return Array.from(t.values()).some(t=>t.isOpen&&!t.isMinimized&&!t.isHiddenWithParent)}function Le(){return se(ue().features.backdrop)}function _e(){const t=Le();return t.visible||t.blockClicks}function Ge(t={}){const{initialPosition:i={x:0,y:0},constrain:e=!0}=t,n={...i};let o=!1,s=!1,a=0,r=0,d=0,l=0;const h=oe();function c(){return{isDragging:o,position:{...n},hasBeenDragged:s}}function g(){h.emit("change",c())}return{getState:c,getPosition:()=>({...n}),isDragging:()=>o,hasBeenDragged:()=>s,setPosition:function(t){n.x=t.x,n.y=t.y,g()},setHasBeenDragged:function(t){s=t,g()},reset:function(){n.x=i.x,n.y=i.y,s=!1,o=!1,g()},constrainToViewport:function(t){if(!s)return;const i=ct(n.x,n.y,t.width,t.height);n.x=i.x,n.y=i.y,g()},onPointerDown:function(t,i){if(0===t.button){if(!s){const t=i.getBoundingClientRect();n.x=t.left,n.y=t.top}o=!0,a=t.clientX,r=t.clientY,d=n.x,l=n.y,i.setPointerCapture(t.pointerId),h.emit("dragStart",{...n}),g()}},onPointerMove:function(t,i){if(!o)return;const c=t.clientX-a,u=t.clientY-r;let m=d+c,f=l+u;if(e){const t=ct(m,f,i.width,i.height);m=t.x,f=t.y}n.x=m,n.y=f,s=!0,h.emit("dragMove",{...n}),g()},onPointerUp:function(t,i){o&&(o=!1,i.releasePointerCapture(t.pointerId),h.emit("dragEnd",{...n}),g())},subscribe:function(t){return h.on("change",t)},destroy:function(){h.off()}}}function $e(t){const{minWidth:i=Ae.minWidth,minHeight:e=Ae.minHeight,getPosition:n,setPosition:o,getHasBeenDragged:s,setHasBeenDragged:a,getElement:r,getSymmetricResize:d,onResizeEnd:l}=t;let h=!1,c="",g={width:0,height:0},u=!1,m=!1,f={x:0,y:0,width:0,height:0,posX:0,posY:0,centerX:0,centerY:0},p=null;const w=oe();let y=null,z=null;function v(){return{isResizing:h,direction:c,size:{...g},hasBeenResized:u}}function x(){w.emit("change",v())}function b(t){if(t.pointerId!==p)return;const n=t.clientX-f.x,s=t.clientY-f.y,a=window.innerWidth,r=window.innerHeight,l=(null==d?void 0:d())??!1;let h=f.width,u=f.height,m=f.posX,y=f.posY;if(l){if(c.includes("e")||c.includes("w")){const t=c.includes("e")?n:-n;h=Math.max(i,f.width+2*t),m=f.centerX-h/2}if(c.includes("s")||c.includes("n")){const t=c.includes("s")?s:-s;u=Math.max(e,f.height+2*t),y=f.centerY-u/2}}else{if(c.includes("e")){const t=a-m;h=Math.max(i,Math.min(f.width+n,t))}if(c.includes("w")){const t=f.width-i,e=Math.min(n,t);h=f.width-e,m=f.posX+e}if(c.includes("s")){const t=r-y;u=Math.max(e,Math.min(f.height+s,t))}if(c.includes("n")){const t=f.height-e,i=Math.min(s,t);u=f.height-i,y=f.posY+i}}const z=gt(m,y,h,u);g={width:z.width,height:z.height},o({x:z.x,y:z.y}),w.emit("resizeMove",{size:{...g},position:{x:z.x,y:z.y}}),x()}function I(t){if(t.pointerId!==p)return;h=!1,c="",p=null,y&&window.removeEventListener("pointermove",y),z&&(window.removeEventListener("pointerup",z),window.removeEventListener("pointercancel",z)),y=null,z=null,m=!0;const i=n();w.emit("resizeEnd",{size:{...g},position:i}),l&&l(i,{...g}),x(),setTimeout(()=>{m=!1},0)}return{getState:v,getSize:()=>({...g}),isResizing:()=>h,hasBeenResized:()=>u,justFinishedResizing:()=>m,setSize:function(t){g={...t},u=!0,x()},reset:function(){u=!1,g={width:0,height:0},h=!1,c="",x()},constrainToViewport:function(){const t=n(),i=r();if(!i)return;const e=gt(t.x,t.y,g.width||i.offsetWidth,g.height||i.offsetHeight);g={width:e.width,height:e.height},o({x:e.x,y:e.y}),x()},startResize:function(t,i){t.preventDefault(),t.stopPropagation();const e=r();if(!e)return;const d=e.getBoundingClientRect();s()||(o({x:d.left,y:d.top}),a(!0)),u||(g={width:d.width,height:d.height},u=!0);const l=n();h=!0,c=i,p=t.pointerId,f={x:t.clientX,y:t.clientY,width:g.width,height:g.height,posX:l.x,posY:l.y,centerX:l.x+g.width/2,centerY:l.y+g.height/2},y=b,z=I,window.addEventListener("pointermove",y),window.addEventListener("pointerup",z),window.addEventListener("pointercancel",z),w.emit("resizeStart",{direction:i}),x()},subscribe:function(t){return w.on("change",t)},destroy:function(){y&&window.removeEventListener("pointermove",y),z&&(window.removeEventListener("pointerup",z),window.removeEventListener("pointercancel",z)),w.off()}}}function Ve(t){return Array.from(t.querySelectorAll(ke)).filter(t=>null!==t.offsetParent||"A"===t.tagName)}function Ye(t,i){if("Tab"!==t.key)return;const e=Ve(i);if(0===e.length)return void t.preventDefault();const n=e[0],o=e[e.length-1],s=document.activeElement;t.shiftKey?s===n&&(o.focus(),t.preventDefault()):s===o&&(n.focus(),t.preventDefault())}function Xe(t){const i=Ve(t);return i.length>0&&(i[0].focus(),!0)}function qe(t){const i=Ve(t);return i.length>0&&(i[i.length-1].focus(),!0)}function Ne(t){return t.contains(document.activeElement)}function je(t){let i=null;return{activate(){i=document.activeElement,Xe(t)},deactivate(){i&&"function"==typeof i.focus&&i.focus(),i=null},handleKeyDown(i){Ye(i,t)},containsFocus:()=>Ne(t)}}function Ke(t,i){return{x:t.x-i.x,y:t.y-i.y}}function Ue(t,i){return{x:t.x+i.x,y:t.y+i.y}}function Ze(t,i){return{x:t.x-i.x,y:t.y-i.y}}function Je(t,i,e){return{x:t.x+(i.width-e.width)/2,y:t.y+(i.height-e.height)/2}}function Qe(t){const i=t.getBoundingClientRect();return{position:{x:i.left,y:i.top},size:{width:i.width,height:i.height}}}function tn(t){return bt(t)}function en(t){return bt(t)}function nn(t,i,e){return t&&!i&&!e}function on(t,i){const e=[];let n=i(t);for(;n;)e.push(n),n=i(n);return e}function sn(t,i){const e=[];let n=i(t);for(;n;)e.push(n),n=i(n);return e}function an(t,i){let e=t,n=i(e);for(;n;)e=n,n=i(e);return e}function rn(t,i,e){const n=t.x+i.width/2,o=t.y+i.height/2;return{x:e.x-n,y:e.y-o,originX:e.x-t.x,originY:e.y-t.y}}function dn(t,i,e){const n=t.x+i.width/2,o=t.y+i.height/2;return{x:e.x-n,y:e.y-o,originX:e.x-t.x,originY:e.y-t.y}}function ln(t,i,e){const n=t.x+i.width/2,o=t.y+i.height/2;return{x:e.x-n,y:e.y-o,originX:e.x-t.x,originY:e.y-t.y}}function hn(t){return{"--modal-transform-x":`${t.x}px`,"--modal-transform-y":`${t.y}px`,"--modal-origin-x":`${t.originX}px`,"--modal-origin-y":`${t.originY}px`}}function cn(){return{x:"undefined"!=typeof window?window.innerWidth/2:0,y:"undefined"!=typeof window?window.innerHeight-40:0}}function gn(t,i){const e=document.querySelector(`.modal-dock-item[data-modal-id="${t}"]`);if(e){const t=e.getBoundingClientRect();return{x:t.left+t.width/2,y:t.top+t.height/2}}const n=document.querySelector('[data-dock-container="true"]');if(n){const t=n.getBoundingClientRect();return{x:t.left+t.width/2,y:t.top+t.height/2}}return i??cn()}function un(t){const{getId:i,getElement:e,getPosition:n,setPosition:o,getHasBeenDragged:s,setHasBeenDragged:a,getHasBeenResized:r,getSize:d,areAnimationsEnabled:l=()=>!0,onMinimizeComplete:h,onOpenStart:c}=t;let g="none",u=!1,m=null,f=null,p=null,w=null,y=null,z=null,v=null;const x=oe();function b(){return{type:g,isAnimating:u,transform:m?{...m}:null}}function I(){x.emit("change",b())}function C(){z&&(clearTimeout(z),z=null)}function P(){const t=e();t&&!v&&(v=De(t,M))}function M(t){switch(C(),t){case Se.MINIMIZE:"minimize"===g&&A();break;case Se.RESTORE:"restore"===g?k():"open"===g&&R();break;case Se.CLOSE:case Se.CLOSE_CENTERED:case Se.CHILD_DISAPPEAR:"close"===g&&B();break;case Se.CHILD_APPEAR:"open"===g&&R()}}function A(){"minimize"===g&&(C(),w?(w(),w=null):y&&(null==h||h(y.position,!0,y.size)),x.emit("animationEnd",{type:"minimize"}),y=null)}function k(){if("restore"!==g)return;C(),g="none",u=!1,m=null;const t=e();t&&(t.setAttribute("data-state","open"),t.setAttribute("data-animation-phase","idle")),x.emit("animationEnd",{type:"restore"}),I()}function R(){if("open"!==g)return;C(),g="none",u=!1,m=null;const t=e();t&&(t.setAttribute("data-state","open"),t.setAttribute("data-animation-phase","idle")),x.emit("animationEnd",{type:"open"}),I()}function B(){if("close"!==g)return;C(),g="none",u=!1;const t=e();t&&(t.setAttribute("data-state","closed"),t.setAttribute("data-animation-phase","idle")),x.emit("animationEnd",{type:"close"}),p&&(p(),p=null),I()}return{getState:b,isAnimating:()=>u,getAnimationType:()=>g,getTransform:()=>m?{...m}:null,getPendingOpenSource:()=>f?{...f}:null,setPendingOpenSource:t=>{f=t?{...t}:null},startMinimize:function(t,c){const f=e();if(u||!f)return!1;if(P(),C(),!l()){const t=f.getBoundingClientRect(),i=s()?n():{x:t.left,y:t.top},e=r()?d():{width:t.width,height:t.height};return s()||(o(i),a(!0)),c?c():null==h||h(i,!0,e),!0}const p=f.getBoundingClientRect(),v=s()?n():{x:p.left,y:p.top},b=r()?d():{width:p.width,height:p.height};s()||(o(v),a(!0));const M=t??gn(i());return m=rn(v,b,M),w=c||null,y={position:v,size:b},f.setAttribute("data-state","minimizing"),f.setAttribute("data-animation-phase","prepare"),requestAnimationFrame(()=>{requestAnimationFrame(()=>{g="minimize",u=!0,f.setAttribute("data-animation-phase","animate"),x.emit("animationStart",{type:"minimize"}),I()})}),z=setTimeout(()=>{"minimize"===g&&A()},Ct.minimize+Pt),!0},startRestore:function(t,n){const s=e();if(P(),C(),!l()){const i=t||{x:window.innerWidth/2,y:window.innerHeight/2};return o(i),void a(!0)}const r=gn(i()),d=t||{x:window.innerWidth/2,y:window.innerHeight/2},h=n||{width:480,height:400};o(d),a(!0),m=dn(d,h,r),g="restore",u=!0,s&&(s.setAttribute("data-state","restoring"),s.setAttribute("data-animation-phase","animate")),x.emit("animationStart",{type:"restore"}),I(),z=setTimeout(()=>{"restore"===g&&k()},Ct.restore+Pt)},startOpen:function(){const t=e();if(!f||!t||u)return!1;if(P(),C(),!l())return f=null,!1;const i=f,r=t.getBoundingClientRect(),d=s()?n():{x:r.left,y:r.top},h=r.width,p=r.height;return s()||(o(d),a(!0)),m=ln(d,{width:h,height:p},i),g="open",u=!0,f=null,t.setAttribute("data-state","opening"),t.setAttribute("data-animation-phase","animate"),x.emit("animationStart",{type:"open"}),null==c||c(),I(),z=setTimeout(()=>{"open"===g&&R()},Ct.open+Pt),!0},startClose:function(t){const i=e();return!u&&(P(),C(),l()?(p=t,g="close",u=!0,i&&(i.setAttribute("data-state","closing"),i.setAttribute("data-animation-phase","animate")),x.emit("animationStart",{type:"close"}),I(),z=setTimeout(()=>{"close"===g&&B()},Ct.close+Pt),!0):(t(),!0))},forceClearMinimize:function(){C(),"minimize"===g&&(g="none",u=!1,m=null,w=null,y=null,I())},destroy:function(){C(),null==v||v(),v=null,x.off()},subscribe:t=>x.on("change",t)}}function mn(t){const i={"z-index":t.zIndex};return t.animationTransform?(i.left=`${t.position.x}px`,i.top=`${t.position.y}px`,i["--genie-origin-x"]=`${t.animationTransform.originX}px`,i["--genie-origin-y"]=`${t.animationTransform.originY}px`,i["--genie-translate-x"]=`${t.animationTransform.x}px`,i["--genie-translate-y"]=`${t.animationTransform.y}px`):t.hasBeenDragged&&(i.left=`${t.position.x}px`,i.top=`${t.position.y}px`,t.isAnimatingPosition||(i.transform="none")),t.hasBeenResized?(i.width=`${t.size.width}px`,i.height=`${t.size.height}px`,i["max-width"]="none",i["max-height"]="none"):(t.preferredHeight&&(i["min-height"]=t.preferredHeight),t.maxWidth&&(i["max-width"]=t.maxWidth)),t.glowEnabled&&t.glow&&(i["--modal-glow-color"]=t.glow.color,i["--modal-glow-intensity"]=String(t.glow.intensity??"medium")),i}function fn(t){const i=["modal-dialog"];return t.isDragging&&i.push("modal-dragging"),t.isResizing&&i.push("modal-resizing"),t.hasBeenDragged&&i.push("modal-positioned"),t.isMinimizing&&i.push("modal-minimizing"),t.isRestoring&&i.push("modal-restoring"),t.isOpening&&i.push("modal-opening"),t.isClosing&&i.push("modal-closing"),t.showCentered&&i.push("modal-centered"),t.isTransparent||i.push("modal-solid"),t.isTransparent&&i.push("modal-transparent"),t.glowEnabled&&i.push("modal-glow"),t.hasChild&&i.push("modal-has-child"),t.isChildModal&&i.push("modal-is-child"),t.wasRestored&&i.push("modal-was-restored"),t.isVisibleByAnimation&&i.push("modal-visible-by-animation"),t.isAwaitingRestore&&i.push("modal-awaiting-restore"),t.isAwaitingChildOpen&&i.push("modal-awaiting-child-open"),t.isAnimatingToCenter&&i.push("modal-animating-to-center"),t.isAnimatingPosition&&i.push("modal-animating-position"),t.isAttentionAnimating&&i.push("modal-attention"),t.glowStabilizing&&t.glowEnabled&&i.push("modal-glow-stabilizing"),i}class pn{constructor(t={}){i(this,"element",null),i(this,"resizeHandler",null),i(this,"options"),this.options=t}mount(t){var i,e;this.element=t,this.options.onWindowResize&&(this.resizeHandler=this.options.onWindowResize,window.addEventListener("resize",this.resizeHandler)),null==(e=(i=this.options).onMount)||e.call(i)}destroy(){var t,i;this.resizeHandler&&(window.removeEventListener("resize",this.resizeHandler),this.resizeHandler=null),this.element=null,null==(i=(t=this.options).onDestroy)||i.call(t)}getElement(){return this.element}isMounted(){return null!==this.element}}class wn{constructor(t){i(this,"id"),i(this,"dataId"),i(this,"configHelper"),i(this,"getDragBehavior"),i(this,"getElement"),this.id=t.id,this.dataId=t.dataId,this.configHelper=t.configHelper,this.getDragBehavior=t.getDragBehavior,this.getElement=t.getElement}constrainToViewport(t){const i=this.getDragBehavior();i.hasBeenDragged()&&i.constrainToViewport(t)}shouldApplySmartPositioning(){return"smart"===this.configHelper.getPositioning("strategy")&&!this.getDragBehavior().hasBeenDragged()}applySmartPositioning(){if("smart"!==this.configHelper.getPositioning("strategy"))return!1;const t=Bt(this.id),i=ji();if((null==t?void 0:t.parentId)||i&&i.childId===this.id)return!1;if((null==t?void 0:t.hasBeenDragged)||(null==t?void 0:t.position))return!1;const e=this.getElement()||bt(this.id);if(!e)return!1;const n=e.offsetWidth,o=e.offsetHeight;if(n<=0||o<=0)return!1;const s=this.configHelper.getPositioning("modalGap"),a=Wt().filter(t=>t.id!==this.id),r=pt(this.configHelper.getPositioning("avoidElements")),d=vt(a,{id:this.id,width:n,height:o},{modalGap:s,viewportMargin:s,avoidBounds:r,avoidMargin:s}),l=d.positions.get(this.id);if(!l)return!1;const h=new Map;for(const[t,i]of d.positions)t!==this.id&&h.set(t,i);h.size>0&&qt(h);const c=this.getDragBehavior();return c.setPosition(l),c.setHasBeenDragged(!0),Gt(this.id,l,{size:{width:n,height:o}}),!0}scheduleSmartPositioning(){Re(()=>this.getElement()||bt(this.id)).then(()=>{this.applySmartPositioning()}).catch(()=>{this.applySmartPositioning()})}centerChildOnParent(t){var i,e;const n=Bt(t);if(!n)return!1;const o=this.getElement()||bt(this.id),s=bt(t),a=null==s?void 0:s.getBoundingClientRect(),r=n.position??(a?{x:a.left,y:a.top}:null);if(!r||!o)return!1;const d=(null==(i=n.size)?void 0:i.width)??(null==s?void 0:s.offsetWidth)??(null==a?void 0:a.width)??480,l=(null==(e=n.size)?void 0:e.height)??(null==s?void 0:s.offsetHeight)??(null==a?void 0:a.height)??400,h=o.offsetWidth,c=o.offsetHeight;if(d<=0||l<=0||h<=0||c<=0)return!1;const g={x:r.x+(d-h)/2,y:r.y+(l-c)/2},u=this.getDragBehavior();u.setPosition(g),u.setHasBeenDragged(!0),Gt(this.id,g,{size:{width:h,height:c}}),n.position&&n.size||!a||Gt(t,{x:a.left,y:a.top},{size:{width:d,height:l}});const m={x:g.x-r.x,y:g.y-r.y};return Ni(t,this.id,m),!0}scheduleCenterChildOnParent(t){Re(()=>this.getElement()).then(()=>{this.centerChildOnParent(t)}).catch(()=>{this.centerChildOnParent(t)})}}class yn{constructor(t){i(this,"options"),this.options=t}startDrag(t){const i=this.options.getElement();this.options.configHelper.isFeatureEnabled("drag")&&i&&this.options.getDragBehavior().onPointerDown(t,i)}startResize(t,i){const e=this.options.getState();this.options.configHelper.isFeatureEnabled("resize")&&!e.hasChild&&this.options.getResizeBehavior().startResize(t,i)}handlePointerMove(t){const i=this.options.getElement();if(!i)return;const e=this.options.getDragBehavior(),n=e.isDragging(),o=this.options.getResizeBehavior(),s=o.hasBeenResized()?o.getSize():{width:i.offsetWidth,height:i.offsetHeight};e.onPointerMove(t,s),n&&e.isDragging()&&this.options.onDragMove()}handlePointerUp(t){const i=this.options.getElement();if(!i)return;const e=this.options.getDragBehavior(),n=e.isDragging();e.onPointerUp(t,i),n&&!this.options.getResizeBehavior().justFinishedResizing()&&this.options.onDragEnd()}handleKeyDown(t){var i,e;this.options.closeOnEscape&&"Escape"===t.key&&this.options.isTopModal()&&(t.stopPropagation(),null==(e=(i=this.options).onClose)||e.call(i))}handleTabKey(t){const i=this.options.getElement();i&&Ye(t,i)}focusFirst(){const t=this.options.getElement();t&&Xe(t)}}class zn{constructor(t){i(this,"id"),i(this,"options"),i(this,"_isHandlingMinimize",!1),i(this,"_isAttentionAnimating",!1),i(this,"_wasRestored"),i(this,"_glowStabilizing",!1),i(this,"_restoreHold",!1),i(this,"_isAnimatingToCenter",!1),i(this,"_cancelParentAnimationCleanup",null),i(this,"_parentFlipInFlight",!1),i(this,"_deferredParentTarget",null),i(this,"_parentFlipStartTime",0),this.id=t.id,this.options=t,this._wasRestored=!1}handlePendingStates(){if(!Bt(this.id))return;if(this.handlePendingForceClose())return;if(this.handlePendingMinimize(),this.handlePendingMinimizeWithParent(),this.handlePendingRestore(),this.handlePendingChildRestore(),this.handlePendingClose())return;const t=this.handlePendingParentLink(),i=this.handlePendingOpen(t);this.handlePendingAttention(),this.handlePendingParentAnimation(),this.handleChildCentering(t,i)}handlePendingForceClose(){var t,i;return!!Bi(this.id)&&(Si(this.id),vi(this.id),null==(i=(t=this.options.options).onClose)||i.call(t),!0)}handlePendingMinimize(){if(!bi(this.id)||this._isHandlingMinimize)return;this._isHandlingMinimize=!0,Xi();const t=this.options.getElement();if(t){const i=this.options.getDragBehavior(),e=this.options.getResizeBehavior(),n=t.getBoundingClientRect(),o=i.hasBeenDragged()?i.getPosition():{x:n.left,y:n.top},s=e.hasBeenResized()?e.getSize():{width:n.width,height:n.height};Yt(this.id,{position:o,size:s,hasBeenDragged:!0})}this.options.getAnimationController().startMinimize(void 0,()=>{Ii(this.id),this._isHandlingMinimize=!1})||(this._isHandlingMinimize=!1)}handlePendingMinimizeWithParent(){if(!Ci(this.id)||this._isHandlingMinimize)return;this._isHandlingMinimize=!0;const t=this.options.getElement();if(t){const i=this.options.getDragBehavior(),e=this.options.getResizeBehavior(),n=t.getBoundingClientRect(),o=i.hasBeenDragged()?i.getPosition():{x:n.left,y:n.top},s=e.hasBeenResized()?e.getSize():{width:n.width,height:n.height};Yt(this.id,{position:o,size:s,hasBeenDragged:!0})}this.options.getAnimationController().startMinimize(void 0,()=>{Pi(this.id),ai(this.id),this._isHandlingMinimize=!1})}handlePendingRestore(){if(!Di(this.id))return;const t=Bt(this.id),i=this.options.getAnimationController();Hi(this.id),i.startRestore((null==t?void 0:t.position)??void 0,(null==t?void 0:t.size)??void 0),requestAnimationFrame(()=>{this.options.focusFirst()})}handlePendingChildRestore(){if(!Ei(this.id))return;const t=Bt(this.id),i=this.options.getAnimationController();Ti(this.id),i.startRestore((null==t?void 0:t.position)??void 0,(null==t?void 0:t.size)??void 0),si(this.id),this._wasRestored=!0}handlePendingClose(){var t,i;return!!ki(this.id)&&(Ri(this.id),this.options.getAnimationController().startClose(()=>{var t,i;gi(this.id),vi(this.id),null==(i=(t=this.options.options).onClose)||i.call(t)})||(gi(this.id),vi(this.id),null==(i=(t=this.options.options).onClose)||i.call(t)),!0)}handlePendingParentLink(){const t=ji();return t&&t.childId===this.id&&(Yt(this.id,{parentId:t.parentId}),this._wasRestored=!0),qi(this.id)}handlePendingOpen(t){var i;if(!Mi(this.id))return!1;Ai(this.id);const e=this.options.getDragBehavior(),n=this.options.getResizeBehavior();Yt(this.id,{position:null,hasBeenDragged:!1,size:null}),e.setPosition({x:0,y:0}),e.setHasBeenDragged(!1),n.reset();const o=Yi(this.id)||this.options.options.openSourcePosition||null,s=!!t||!!(null==(i=Bt(this.id))?void 0:i.parentId);let a=!1;return o?(a=!0,this.options.getAnimationController().setPendingOpenSource(o),s&&t?this.openChildModalWithAnimation(t.parentId):this.openStandaloneModalWithAnimation()):s||this.options.getPositioning().scheduleSmartPositioning(),requestAnimationFrame(()=>{this.options.focusFirst()}),a}openChildModalWithAnimation(t){const i=this.options.getPositioning(),e=this.options.getAnimationController();Re(()=>this.options.getElement()).then(()=>{i.centerChildOnParent(t)&&(e.startOpen(),this._wasRestored=!0)}).catch(()=>{i.centerChildOnParent(t)&&(e.startOpen(),this._wasRestored=!0)})}openStandaloneModalWithAnimation(){const t=this.options.getPositioning(),i=this.options.getAnimationController();Re(()=>this.options.getElement()).then(()=>{t.applySmartPositioning(),i.startOpen()}).catch(()=>{t.applySmartPositioning(),i.startOpen()})}handlePendingAttention(){Oi(this.id)&&(Fi(this.id),this.id,this._isAttentionAnimating=!0,setTimeout(()=>{this._isAttentionAnimating=!1,this.id,this.options.onStateChange()},600))}handlePendingParentAnimation(){if(!_i(this.id))return;const t=Gi(this.id);if(t){if(this._parentFlipInFlight&&Date.now()-this._parentFlipStartTime<Ct.parentRetargetInterval)return void(this._deferredParentTarget=t);this._deferredParentTarget=null,this.startParentFlip(t)}}startParentFlip(t){var i,e;const n=this.options.getDragBehavior(),o=this.options.getElement(),s=o?{x:o.getBoundingClientRect().left,y:o.getBoundingClientRect().top}:(null==(i=Bt(this.id))?void 0:i.position)??null;Yt(this.id,{position:t,hasBeenDragged:!0,isAnimatingPosition:!0}),n.setPosition(t),n.setHasBeenDragged(!0),null==(e=this._cancelParentAnimationCleanup)||e.call(this),this._parentFlipInFlight=!0,this._parentFlipStartTime=Date.now();const a=this.id,r=()=>{this._parentFlipInFlight=!1,this._cancelParentAnimationCleanup=null,$t(a);const t=this._deferredParentTarget;t?(this._deferredParentTarget=null,this.startParentFlip(t)):Ki(a)};o&&s?this._cancelParentAnimationCleanup=Rt(o,s,t,{duration:Ct.parentMove,onComplete:r}):setTimeout(r,Ct.parentMove+Pt)}handleChildCentering(t,i){t&&this.options.getElement()&&!i&&this.options.getPositioning().scheduleCenterChildOnParent(t.parentId)}get wasRestored(){return this._wasRestored}set wasRestored(t){this._wasRestored=t}get isAttentionAnimating(){return this._isAttentionAnimating}get glowStabilizing(){return this._glowStabilizing}set glowStabilizing(t){this._glowStabilizing=t}get restoreHold(){return this._restoreHold}set restoreHold(t){this._restoreHold=t}get isAnimatingToCenter(){return this._isAnimatingToCenter}set isAnimatingToCenter(t){this._isAnimatingToCenter=t}get isHandlingMinimize(){return this._isHandlingMinimize}}class vn{constructor(t){var e,n,o,s;i(this,"id"),i(this,"dataId"),i(this,"options"),i(this,"drag"),i(this,"resize"),i(this,"animation"),i(this,"positioning"),i(this,"lifecycle"),i(this,"interactions"),i(this,"stateManager"),i(this,"overlayClosing",!1),i(this,"emitter",oe()),i(this,"unsubscribeState",null),i(this,"cachedState",null),this.id=t.id,this.dataId=t.id,this.options=t,this.drag=Ge({initialPosition:{x:0,y:0},constrain:!0}),this.resize=$e({minWidth:(null==(n=null==(e=t.config)?void 0:e.appearance)?void 0:n.minWidth)??ue().appearance.minWidth,minHeight:(null==(s=null==(o=t.config)?void 0:o.appearance)?void 0:s.minHeight)??ue().appearance.minHeight,getPosition:()=>this.drag.getPosition(),setPosition:t=>this.drag.setPosition(t),getHasBeenDragged:()=>this.drag.hasBeenDragged(),setHasBeenDragged:t=>this.drag.setHasBeenDragged(t),getElement:()=>this.element,onResizeEnd:(t,i)=>this.handleResizeEnd(t,i)}),this.animation=un({getId:()=>this.id,getElement:()=>this.element,getPosition:()=>this.drag.getPosition(),setPosition:t=>this.drag.setPosition(t),getHasBeenDragged:()=>this.drag.hasBeenDragged(),setHasBeenDragged:t=>this.drag.setHasBeenDragged(t),getHasBeenResized:()=>this.resize.hasBeenResized(),getSize:()=>this.resize.getSize(),areAnimationsEnabled:()=>this.options.configHelper.isFeatureEnabled("animations"),onMinimizeComplete:(t,i,e)=>{Yt(this.id,{position:t,size:e,hasBeenDragged:i}),ii(this.id)},onOpenStart:()=>{const t=Bt(this.id);(null==t?void 0:t.parentId)&&(this.stateManager.wasRestored=!0)}}),this.positioning=new wn({id:this.id,dataId:this.dataId,configHelper:t.configHelper,getDragBehavior:()=>this.drag,getElement:()=>this.element}),this.interactions=new yn({id:this.id,configHelper:t.configHelper,getDragBehavior:()=>this.drag,getResizeBehavior:()=>this.resize,getElement:()=>this.element,getState:()=>{var t;return{hasChild:!!(null==(t=Bt(this.id))?void 0:t.childId)}},onDragMove:()=>{if("realtime"===ue().parentChild.movementMode){const t=this.drag.getPosition();Gt(this.id,t,{drag:!0,realtime:!0})}},onDragEnd:()=>{const t=this.drag.getPosition();Gt(this.id,t,{drag:!0}),"animated"===ue().parentChild.movementMode&&Ki(this.id)},onClose:()=>this.close(),closeOnEscape:t.closeOnEscape,isTopModal:()=>dt(this.id)}),this.stateManager=new zn({id:this.id,options:{glow:t.glow,openSourcePosition:t.openSourcePosition,onClose:t.onClose},getDragBehavior:()=>this.drag,getResizeBehavior:()=>this.resize,getAnimationController:()=>this.animation,getElement:()=>this.element,getPositioning:()=>this.positioning,onStateChange:()=>this.notifyStateChange(),focusFirst:()=>this.interactions.focusFirst()}),Li(t.id)&&(this.stateManager.wasRestored=!0),this.lifecycle=new pn({onMount:()=>{this.handleStateChange(),this.handlePendingStates(),this.notifyStateChange()},onDestroy:()=>{var t;null==(t=this.unsubscribeState)||t.call(this),this.drag.destroy(),this.resize.destroy(),this.animation.destroy(),this.emitter.off()},onWindowResize:()=>this.handleWindowResize()}),this.drag.subscribe(()=>this.notifyStateChange()),this.resize.subscribe(()=>this.notifyStateChange()),this.animation.subscribe(()=>{this.handlePendingStates(),this.notifyStateChange()}),this.unsubscribeState=Z(()=>{this.handleStateChange(),this.handlePendingStates(),this.notifyStateChange()}),t.skipRegistration||this.register(t.autoOpen??!1),this.handleStateChange(),this.handlePendingStates()}mount(t){this.lifecycle.mount(t)}destroy(){this.lifecycle.destroy()}get element(){return this.lifecycle.getElement()}handleWindowResize(){if(!this.element||!this.drag.hasBeenDragged())return;const t=this.resize.hasBeenResized()?this.resize.getSize():{width:this.element.offsetWidth,height:this.element.offsetHeight};this.positioning.constrainToViewport(t),this.resize.hasBeenResized()&&this.resize.constrainToViewport(),this.notifyStateChange()}register(t){ot({id:this.id,title:this.options.title,icon:this.options.icon??"",isOpen:t,isMinimized:!1,isHiddenWithParent:!1,isTransparent:!1,isRejected:!1,position:null,size:null,hasBeenDragged:!1,dockPosition:0,glow:this.options.glow??null,parentId:void 0,childId:void 0,offsetFromParent:void 0}),t&&rt(this.id)}getState(){if(this.cachedState)return this.cachedState;const t=Bt(this.id),i=this.drag.getState(),e=this.resize.getState(),n=this.animation.getState(),o=!!t&&(t.isOpen||ki(this.id))&&(!t.isMinimized||bi(this.id))&&(!t.isHiddenWithParent||Ci(this.id)||Ei(this.id)),s=!!(null==t?void 0:t.childId),a=!!(null==t?void 0:t.parentId),r="minimize"===n.type&&n.isAnimating,d="restore"===n.type&&n.isAnimating,l="open"===n.type&&n.isAnimating,h="close"===n.type&&n.isAnimating,c=n.isAnimating,g=(null==t?void 0:t.isAnimatingPosition)??!1,u=g&&(null==t?void 0:t.position)?t.position:i.position,m=!!g||i.hasBeenDragged,f=(Ei(this.id)||Di(this.id))&&!d,p=(a||Li(this.id))&&!l&&(!m||!!this.animation.getPendingOpenSource()),w=d||l||this.stateManager.restoreHold,y=o&&!m&&!c&&!this.animation.getPendingOpenSource()&&!f&&!p;let z="closed";r?z="minimizing":d?z="restoring":l?z="opening":h?z="closing":(null==t?void 0:t.isMinimized)?z="minimized":o&&(z="open");const v=this.options.configHelper.isFeatureEnabled("drag"),x=this.options.configHelper.isFeatureEnabled("resize"),b=this.options.configHelper.isFeatureEnabled("minimize"),I=!!this.options.glow,C=mn({position:u,hasBeenDragged:m,hasBeenResized:e.hasBeenResized,size:e.size,animationTransform:n.transform,zIndex:(null==t?void 0:t.zIndex)??1e3,glowEnabled:I,glow:this.options.glow??null,maxWidth:this.options.maxWidth,preferredHeight:this.options.preferredHeight,isAnimatingPosition:g}),P=fn({isDragging:i.isDragging,isResizing:e.isResizing,hasBeenDragged:m,isMinimizing:r,isRestoring:d,isOpening:l,isClosing:h,showCentered:y,isTransparent:(null==t?void 0:t.isTransparent)??!1,glowEnabled:I,hasChild:s,isChildModal:a,wasRestored:this.stateManager.wasRestored,isVisibleByAnimation:w,isAwaitingRestore:f,isAwaitingChildOpen:p,isAnimatingToCenter:this.stateManager.isAnimatingToCenter,isAnimatingPosition:(null==t?void 0:t.isAnimatingPosition)??!1,isAttentionAnimating:this.stateManager.isAttentionAnimating,glowStabilizing:this.stateManager.glowStabilizing});return this.cachedState={position:i.position,size:e.size,zIndex:(null==t?void 0:t.zIndex)??1e3,isDragging:i.isDragging,isResizing:e.isResizing,hasBeenDragged:i.hasBeenDragged,hasBeenResized:e.hasBeenResized,isMinimizing:r,isRestoring:d,isOpening:l,isClosing:h,isAnyAnimating:c,animationTransform:n.transform,isVisible:o,showCentered:y,isAwaitingRestore:f,isAwaitingChildOpen:p,isVisibleByAnimation:w,hasChild:s,isChildModal:a,showOverlay:s||this.overlayClosing,isTransparent:(null==t?void 0:t.isTransparent)??!1,isAttentionAnimating:this.stateManager.isAttentionAnimating,glowStabilizing:this.stateManager.glowStabilizing,isAnimatingPosition:(null==t?void 0:t.isAnimatingPosition)??!1,isAnimatingToCenter:this.stateManager.isAnimatingToCenter,wasRestored:this.stateManager.wasRestored,overlayClosing:this.overlayClosing,glowEnabled:I,draggable:v,resizable:x,minimizable:b,dataState:z,dataAnimationPhase:n.isAnimating?"animate":"idle",style:C,cssClasses:P},this.cachedState}subscribe(t){return this.emitter.on("stateChange",t)}notifyStateChange(){this.cachedState=null,this.emitter.emit("stateChange",this.getState())}startDrag(t){this.interactions.startDrag(t)}startResize(t,i){this.interactions.startResize(t,i)}handlePointerMove(t){this.interactions.handlePointerMove(t)}handlePointerUp(t){this.interactions.handlePointerUp(t)}handleKeyDown(t){this.interactions.handleKeyDown(t)}handleTabKey(t){this.interactions.handleTabKey(t)}minimize(){this.options.configHelper.isFeatureEnabled("minimize")&&ii(this.id)}close(){var t,i;Bi(this.id)&&Si(this.id),yi(this.id),null==(i=(t=this.options).onClose)||i.call(t)}toggleTransparency(){di(this.id)}bringToFront(){rt(this.id)}setOpenSourcePosition(t){this.animation.setPendingOpenSource(t)}updateGlow(t){this.options.glow!==t&&(this.options.glow=t,Yt(this.id,{glow:t??null}),this.notifyStateChange())}focusFirst(){this.interactions.focusFirst()}handleResizeEnd(t,i){const e=Bt(this.id);if(null==e?void 0:e.parentId){const n=Bt(e.parentId),o=bt(e.parentId);if(n&&o){const e=n.position??{x:o.getBoundingClientRect().left,y:o.getBoundingClientRect().top},s=n.size??{width:o.offsetWidth,height:o.offsetHeight},a={x:e.x+(s.width-i.width)/2,y:e.y+(s.height-i.height)/2},r=t;this.stateManager.isAnimatingToCenter=!0,this.drag.setPosition(a);const d={x:a.x-e.x,y:a.y-e.y};Yt(this.id,{position:a,size:i,hasBeenDragged:!0,offsetFromParent:d});const l=this.lifecycle.getElement();return void(l?Rt(l,r,a,{duration:Ct.centerAfterResize,onComplete:()=>{this.stateManager.isAnimatingToCenter=!1}}):this.stateManager.isAnimatingToCenter=!1)}}Yt(this.id,{position:t,size:i,hasBeenDragged:!0})}handleStateChange(){const t=Bt(this.id);if(t){if((t.parentId||Li(this.id))&&(this.stateManager.wasRestored=!0),!this.drag.isDragging()&&!this.resize.isResizing()&&t.position){const i=this.drag.getPosition(),e=t.position;(Math.abs(i.x-e.x)>.5||Math.abs(i.y-e.y)>.5)&&(this.drag.setPosition(e),t.hasBeenDragged&&this.drag.setHasBeenDragged(!0))}this.stateManager.handlePendingStates()}}handlePendingStates(){this.stateManager.handlePendingStates()}getId(){return this.id}getDataId(){return this.dataId}getElement(){return this.element}}function xn(t){return new vn(t)}export{pn as $,ee as A,He as B,xe as C,Ie as D,Ee as E,ke as F,Ht as G,hi as H,Te as I,Le as J,_e as K,We as L,vn as M,me as N,te as O,Ut as P,ne as Q,Ce as R,Zt as S,Me as T,Se as U,ve as V,be as W,Ae as X,Ct as Y,Mt as Z,yn as _,he as a,Fe as a$,wn as a0,zn as a1,et as a2,it as a3,ie as a4,Jt as a5,qt as a6,J as a7,Je as a8,Zi as a9,Pi as aA,Ai as aB,Gi as aC,qi as aD,Hi as aE,Ne as aF,un as aG,ye as aH,Ge as aI,oe as aJ,je as aK,wi as aL,xn as aM,$e as aN,ae as aO,mi as aP,ai as aQ,vi as aR,en as aS,tn as aT,an as aU,Rt as aV,Xe as aW,qe as aX,sn as aY,cn as aZ,on as a_,Ue as aa,vt as ab,ft as ac,rn as ad,Ke as ae,ln as af,ut as ag,Ze as ah,dn as ai,mt as aj,Wi as ak,Qt as al,$t as am,zi as an,wt as ao,fn as ap,mn as aq,gt as ar,ct as as,Yi as at,Fi as au,Ti as av,Ri as aw,Si as ax,Ii as ay,Xi as az,ge as b,Oe as b0,Ft as b1,gn as b2,Ot as b3,At as b4,kt as b5,pt as b6,Ve as b7,Qe as b8,Wt as b9,O as bA,Et as bB,W as bC,E as bD,De as bE,nn as bF,ui as bG,$i as bH,di as bI,hn as bJ,Ye as bK,Ki as bL,Xt as bM,ci as bN,si as bO,Yt as bP,Gt as bQ,Vt as bR,Re as bS,It as bT,xi as ba,Lt as bb,_t as bc,Vi as bd,Ui as be,ji as bf,jt as bg,Oi as bh,Ei as bi,Bi as bj,Ci as bk,_i as bl,Li as bm,Di as bn,ri as bo,we as bp,dt as bq,Ni as br,pe as bs,se as bt,Be as bu,lt as bv,fe as bw,gi as bx,ni as by,oi as bz,yi as c,pi as d,Bt as e,St as f,U as g,rt as h,Dt as i,Tt as j,ue as k,ze as l,ii as m,Pe as n,fi as o,xt as p,ot as q,ei as r,Z as s,li as t,nt as u,st as v,Mi as w,ki as x,bi as y,bt as z};
|
|
1
|
+
var t=Object.defineProperty,i=(i,e,n)=>((i,e,n)=>e in i?t(i,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):i[e]=n)(i,"symbol"!=typeof e?e+"":e,n);const e=Symbol.for("epic-modals-core");if("undefined"!=typeof globalThis){const t=globalThis;t[e],t[e]=!0}const n=new Map;let o=0,s=null;function a(t){s=t}let r=null;function d(t){r=t}const l=new Set;let h=!1,c=!1,g=!1,u=[],m=[],f=[],p=[],w=[],y=[],z=[],v=[],x=[],b=null;function I(t){b=t}const C=new Map;let P=null;function M(t){P=t}const A=new Map,k=new Set,R=new Set,B=new Set;let S=[];function D(t){S=t}let H=null;function E(t){H=t}let T=null;function O(t){T=t}let F=null;function W(t){F=t}function L(t){u=t}function _(t){m=t}function G(t){f=t}function $(t){p=t}function V(t){w=t}function Y(t){y=t}function X(t){z=t}function q(t){v=t}function N(t){x=t}function j(){if(!g){g=!0;try{l.forEach(t=>t())}finally{g=!1}}}function K(){o++,h?c=!0:j()}function U(){return o}function Z(t){return l.add(t),()=>l.delete(t)}function J(t){const i=h;h=!0;try{t()}finally{h=i,!i&&c&&(c=!1,queueMicrotask(()=>{j()}))}}function Q(t,i){if(t.width<=0||t.height<=0)throw new Error(`[epic-modals] Invalid dimensions in ${i}: width=${t.width}, height=${t.height}`)}function tt(t,i){return!!n.get(t)||(function(){var t,i;try{const e=import.meta;return!0===(null==(t=e.env)?void 0:t.DEV)||"development"===(null==(i=e.env)?void 0:i.MODE)}catch{return!1}}(),!1)}function it(){n.clear(),u=[],m=[],f=[],p=[],w=[],y=[],z=[],v=[],x=[],b=null,C.clear(),P=null,A.clear(),k.clear(),R.clear(),B.clear(),S=[],H=null,T=null,F=null,s&&(clearTimeout(s),s=null),r&&(clearTimeout(r),r=null)}function et(){return{modals:n,pendingMinimize:u,pendingOpen:m,pendingClose:f,pendingRestore:w,dockOrder:S,animatingModals:k,transparentModals:B}}function nt(t){return{id:t.id,title:t.title,icon:t.icon??"",isOpen:t.autoOpen??!1,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}}function ot(t){const i=n.get(t.id);let e;e=(null==i?void 0:i.zIndex)?i.zIndex:Math.max(...Array.from(n.values()).map(t=>t.zIndex),ue().zIndex.base-2)+2;const o=m.includes(t.id),s=t.isOpen||o;i?n.set(t.id,{...i,title:t.title,icon:t.icon,glow:t.glow,zIndex:e}):n.set(t.id,{...t,isOpen:s,zIndex:e,isAnimating:!1}),K(),t.isMinimized&&!S.includes(t.id)&&D([...S,t.id])}function st(t){const i=n.get(t);if(i){if(D(S.filter(i=>i!==t)),_(m.filter(i=>i!==t)),G(f.filter(i=>i!==t)),$(p.filter(i=>i!==t)),L(u.filter(i=>i!==t)),V(w.filter(i=>i!==t)),Y(y.filter(i=>i!==t)),X(z.filter(i=>i!==t)),q(v.filter(i=>i!==t)),i.childId){const t=n.get(i.childId);t&&n.set(i.childId,{...t,parentId:void 0})}if(i.parentId){const t=n.get(i.parentId);t&&n.set(i.parentId,{...t,childId:void 0,lastChildId:i.id})}n.delete(t),K(),B.delete(t),k.delete(t)}}function at(t,i){const e=n.get(t);if(!(null==e?void 0:e.childId))return;const o=n.get(e.childId);if(!o)return;const s=i+2;n.set(e.childId,{...o,zIndex:s}),at(e.childId,s)}function rt(t){if(!n.get(t))return;const i=Math.max(...Array.from(n.values()).map(t=>t.zIndex),0),e=function(t){let i=t,e=n.get(i);for(;null==e?void 0:e.parentId;)i=e.parentId,e=n.get(i);return i}(t),o=n.get(e);if(!o)return;const s=i+2;n.set(e,{...o,zIndex:s}),at(e,s),K()}function dt(t){const i=n.get(t);if(!i)return!1;const e=Math.max(...Array.from(n.values()).map(t=>t.zIndex),0);return i.zIndex===e&&!i.isMinimized&&!i.isHiddenWithParent}function lt(t,i){if(Array.isArray(t))D(t);else if("number"==typeof i){const e=t,n=[...S],[o]=n.splice(e,1);n.splice(i,0,o),D(n)}}const ht=8;function ct(t,i,e,n,o={}){const{margin:s=ht,allowPartialVisibility:a=!1}=o,r="undefined"!=typeof window?window.innerWidth:1920,d="undefined"!=typeof window?window.innerHeight:1080;let l,h,c,g;return a&&e>r-2*s?(l=40-e,h=r-40):(l=s,h=Math.max(s,r-e-s)),a&&n>d-2*s?(c=40-n,g=d-40):(c=s,g=Math.max(s,d-n-s)),{x:Math.max(l,Math.min(h,t)),y:Math.max(c,Math.min(g,i))}}function gt(t,i,e,n,o={}){const{margin:s=ht}=o,a=("undefined"!=typeof window?window.innerWidth:1920)-2*s,r=("undefined"!=typeof window?window.innerHeight:1080)-2*s,d=Math.min(e,a),l=Math.min(n,r),h=ct(t,i,d,l,o);return{x:h.x,y:h.y,width:d,height:l}}function ut(t,i){return Math.max(0,Math.min(t.x+t.width,i.x+i.width)-Math.max(t.x,i.x))*Math.max(0,Math.min(t.y+t.height,i.y+i.height)-Math.max(t.y,i.y))}function mt(t,i,e,n,o,s){const a={x:t-s,y:i-s,width:e+2*s,height:n+2*s};let r=0;for(const t of o)r+=ut(a,t);return r}function ft(t,i){const e=i.x-(t.x+t.width),n=t.x-(i.x+i.width),o=i.y-(t.y+t.height),s=t.y-(i.y+i.height),a=Math.max(e,n,0),r=Math.max(o,s,0);return 0===a&&0===r?0:Math.sqrt(a*a+r*r)}function pt(t){if("undefined"==typeof document)return[];const i=[];for(const e of t)try{const t=document.querySelectorAll(e);for(const e of t){const t=e.getBoundingClientRect();t.width>0&&t.height>0&&i.push({x:t.left,y:t.top,width:t.width,height:t.height})}}catch{}return i}function wt(t,i,e,n,o){let s=e,a=e,r=t-e,d=i-e;for(const e of n){const n=e.y,l=i-(e.y+e.height),h=e.x,c=t-(e.x+e.width);let g;if(e.width>e.height)g=n<=l?"top":"bottom";else if(e.height>e.width)g=h<=c?"left":"right";else{const t=Math.min(n,l,h,c);g=t===n?"top":t===l?"bottom":t===h?"left":"right"}"bottom"===g?d=Math.min(d,e.y-o):"top"===g?a=Math.max(a,e.y+e.height+o):"left"===g?s=Math.max(s,e.x+e.width+o):r=Math.min(r,e.x-o)}return{x:s,y:a,width:Math.max(0,r-s),height:Math.max(0,d-a)}}function yt(t,i,e,n){const o=t-i,s=e-1;if(o<=0)return{interGap:0,edgeGap:0};if(e<=1)return{interGap:0,edgeGap:o/2};const a=o/(e+1);if(a>=n)return{interGap:a,edgeGap:a};const r=s*n;return o>=r?{interGap:n,edgeGap:(o-r)/2}:{interGap:o/s,edgeGap:0}}function zt(t,i,e,n,o=0){if(0===e.length)return{cols:t,rows:i,score:1/0,positions:new Map};const s=new Array(t).fill(0),a=new Array(i).fill(0);for(let i=0;i<e.length;i++){const n=i%t,o=Math.floor(i/t);s[n]=Math.max(s[n],e[i].width),a[o]=Math.max(a[o],e[i].height)}const r=s.reduce((t,i)=>t+i,0),d=a.reduce((t,i)=>t+i,0);if(r>n.width||d>n.height)return null;const{interGap:l,edgeGap:h}=yt(n.width,r,t,o),{interGap:c,edgeGap:g}=yt(n.height,d,i,o),u=new Map,m=[0];for(let i=0;i<t;i++)m.push(m[i]+s[i]);const f=[0];for(let t=0;t<i;t++)f.push(f[t]+a[t]);for(let i=0;i<e.length;i++){const o=i%t,r=Math.floor(i/t),d=e[i],p=n.x+h+o*l+m[o],w=n.y+g+r*c+f[r],y=p+(s[o]-d.width)/2,z=w+(a[r]-d.height)/2;u.set(d.id,{x:Math.round(y),y:Math.round(z)})}const p=t>1?l:h,w=i>1?c:g;return{cols:t,rows:i,score:(.6*Math.min(p,w)+.4*Math.sqrt(p*w))*(n.width>n.height==t>=i?1.02:1),positions:u}}function vt(t,i,e={}){const{modalGap:n=16,viewportMargin:o=16,avoidBounds:s=[],avoidMargin:a=24}=e,r="undefined"!=typeof window?window.innerWidth:1920,d="undefined"!=typeof window?window.innerHeight:1080,l=new Map,h=t.filter(t=>!t.parentId),c=h.map(t=>({id:t.id,width:t.width,height:t.height}));if(i&&c.push({id:i.id,width:i.width,height:i.height}),0===c.length)return{positions:l};const g=new Map(h.map(t=>[t.id,t.currentPosition]));c.sort((t,i)=>{const e=g.get(t.id),n=g.get(i.id);return(e?e.x+t.width/2:1/0)-(n?n.x+i.width/2:1/0)});const u=wt(r,d,o,s,a);if(1===c.length){const t=c[0],i=u.x+(u.width-t.width)/2,e=u.y+(u.height-t.height)/2;return l.set(t.id,{x:Math.round(i),y:Math.round(e)}),{positions:l}}const m=c.length;let f=null;for(let t=1;t<=m;t++){const i=zt(t,Math.ceil(m/t),c,u,n);i&&(null===f||i.score>f.score)&&(f=i)}if(f){for(const[t,i]of f.positions)l.set(t,i);return{positions:l}}if(i){const t=h.map(t=>({x:t.currentPosition.x,y:t.currentPosition.y,width:t.width,height:t.height})),e=function(t,i,e,n,o=20){const s=n.x+(n.width-t)/2,a=n.y+(n.height-i)/2;if(0===e.length)return{x:Math.round(s),y:Math.round(a)};const r=n.x,d=Math.max(n.x,n.x+n.width-t),l=n.y,h=Math.max(n.y,n.y+n.height-i);if(d<=r||h<=l)return{x:Math.round(s),y:Math.round(a)};const c=(d-r)/o,g=(h-l)/o;let u={x:s,y:a},m=1/0;const f=t*i,p=Math.hypot(n.width/2,n.height/2),w=n.x+n.width/2,y=n.y+n.height/2;for(let n=0;n<=o;n++)for(let s=0;s<=o;s++){const o=r+n*c,a=l+s*g,d=mt(o,a,t,i,e,0),h=f>0?d/f:0,z=Math.hypot(o+t/2-w,a+i/2-y),v=.5*h+.5*(p>0?z/p:0);v<m&&(m=v,u={x:o,y:a})}return{x:Math.round(u.x),y:Math.round(u.y)}}(i.width,i.height,t,u);return l.set(i.id,e),{positions:l}}const p=function(t,i){const e=new Map,n=Math.max(...t.map(t=>t.width)),o=Math.max(...t.map(t=>t.height)),s=n+40*(t.length-1),a=o+40*(t.length-1);let r=i.x+(i.width-s)/2,d=i.y+(i.height-a)/2;r=Math.max(i.x,r),d=Math.max(i.y,d);for(let i=0;i<t.length;i++)e.set(t[i].id,{x:Math.round(r+40*i),y:Math.round(d+40*i)});return e}(c,u);return{positions:p}}function xt(t){return t}function bt(t){return"undefined"==typeof document?null:document.querySelector(`.modal-dialog[data-modal-id="${t}"]`)}function It(){return{x:window.innerWidth/2,y:window.innerHeight/2}}const Ct={minimize:500,restore:400,open:400,close:250,attention:300,parentMove:300,parentRetargetInterval:100,centerAfterResize:200,glowStabilize:1e3,overlayFade:200},Pt=100,Mt={easeOut:"ease-out",easeOutCubic:"cubic-bezier(0.25, 0.1, 0.25, 1)",linear:"linear",easeInOut:"ease-in-out"};function At(t){switch(t){case"open":return Ct.open;case"close":return Ct.close;case"minimize":return Ct.minimize;case"restore":return Ct.restore;case"attention":return Ct.attention;default:return 0}}function kt(t){switch(t){case"open":case"restore":return Mt.easeOut;case"close":case"minimize":return Mt.easeOutCubic;case"attention":return Mt.easeInOut;default:return Mt.linear}}function Rt(t,i,e,n){var o;const s=i.x-e.x,a=i.y-e.y;if(0===s&&0===a)return null==(o=null==n?void 0:n.onComplete)||o.call(n),()=>{};const r=(null==n?void 0:n.duration)??Ct.parentMove,d=(null==n?void 0:n.easing)??"ease-out";let l=!1;function h(){var t;l||(l=!0,clearTimeout(g),null==(t=null==n?void 0:n.onComplete)||t.call(n))}t.style.left=`${e.x}px`,t.style.top=`${e.y}px`;const c=t.animate([{transform:`translate(${s}px, ${a}px)`},{transform:"translate(0, 0)"}],{duration:r,easing:d,fill:"none"});c.onfinish=h;const g=setTimeout(h,r+Pt);return function(){l||(l=!0,clearTimeout(g),c.cancel())}}function Bt(t){return n.get(t)}function St(t){const i=n.get(t);return(null==i?void 0:i.isOpen)??!1}function Dt(t){return n.has(t)}function Ht(t){return k.has(t)}function Et(t,i){i?k.add(t):k.delete(t)}function Tt(){return n}function Ot(){return S}function Ft(t){return"undefined"==typeof document?null:document.querySelector(`[data-dock-item="${t}"]`)}function Wt(){const t=[];for(const i of n.values()){if(!i.isOpen||i.isMinimized||i.isHiddenWithParent)continue;if(R.has(i.id))continue;const e=bt(i.id);if(!e)continue;const n=i.position??{x:e.getBoundingClientRect().left,y:e.getBoundingClientRect().top},o=i.size??{width:e.offsetWidth,height:e.offsetHeight};t.push({id:i.id,width:o.width,height:o.height,currentPosition:n,parentId:i.parentId})}return t}function Lt(t){const i=[];for(const e of n.values())if(e.isOpen&&!e.isMinimized&&!e.isHiddenWithParent&&(!t||e.id!==t))if(e.position&&e.size)i.push({x:e.position.x,y:e.position.y,width:e.size.width,height:e.size.height});else{const t=bt(e.id);if(t){const e=t.getBoundingClientRect();i.push({x:e.left,y:e.top,width:e.width,height:e.height})}}return i}function _t(t){const i=[];for(const e of n.values())if(e.isOpen&&!e.isMinimized&&!e.isHiddenWithParent&&(!t||e.id!==t))if(e.position&&e.size)i.push({id:e.id,x:e.position.x,y:e.position.y,width:e.size.width,height:e.size.height});else{const t=bt(e.id);if(t){const n=t.getBoundingClientRect();i.push({id:e.id,x:n.left,y:n.top,width:n.width,height:n.height})}}return i}function Gt(t,i,e){if(!tt(t))return;!function(t){if(!Number.isFinite(t.x)||!Number.isFinite(t.y))throw new Error(`[epic-modals] Invalid position in updateModalPosition: x=${t.x}, y=${t.y}`)}(i),(null==e?void 0:e.size)&&Q(e.size,"updateModalPosition");const o=n.get(t);if(!o)return;let s=i;if((null==e?void 0:e.constrain)&&o.size&&(s=ct(i.x,i.y,o.size.width,o.size.height)),n.set(t,{...o,position:s,size:(null==e?void 0:e.size)??o.size,hasBeenDragged:o.hasBeenDragged||(null==e?void 0:e.drag)||!1}),o.childId){let i=t,e=s;for(;;){const t=n.get(i);if(!(null==t?void 0:t.childId))break;const o=n.get(t.childId);if(!(null==o?void 0:o.offsetFromParent))break;const s={x:e.x+o.offsetFromParent.x,y:e.y+o.offsetFromParent.y};n.set(t.childId,{...o,position:s,hasBeenDragged:!0}),i=t.childId,e=s}}if(o.parentId&&o.offsetFromParent){const i=ue();let a=t,r=o;for(;r.parentId&&r.offsetFromParent;){const o=n.get(r.parentId);if(!o)break;const d=a===t?s:n.get(a).position,l={x:d.x-r.offsetFromParent.x,y:d.y-r.offsetFromParent.y};if("animated"===i.parentChild.movementMode&&!(null==e?void 0:e.realtime)){A.set(r.parentId,l);break}n.set(r.parentId,{...o,position:l,hasBeenDragged:!0}),a=r.parentId,r=o}}K()}function $t(t){const i=n.get(t);if(!i)return;if(!i.isAnimatingPosition)return;i.isAnimatingPosition=!1;let e=i.childId;for(;e;){const t=n.get(e);t&&(t.isAnimatingPosition=!1),e=null==t?void 0:t.childId}K()}function Vt(t,i){if(!tt(t))return;Q(i,"updateModalSize");const e=n.get(t);e&&(n.set(t,{...e,size:i}),K())}function Yt(t,i){const e=n.get(t);e&&(n.set(t,{...e,...i}),K())}function Xt(t){const i=ue();"smart"===i.positioning.strategy&&(s&&clearTimeout(s),a(setTimeout(()=>{const e=Wt(),n=pt(i.positioning.avoidElements);qt(vt(e,t,{modalGap:i.positioning.modalGap,viewportMargin:i.positioning.modalGap,avoidBounds:n,avoidMargin:i.positioning.modalGap}).positions),a(null)},50)))}function qt(t){if(0===t.size)return;const i=[];for(const[e,o]of t){const t=n.get(e);if(!t)continue;const s=bt(e),a=t.position??(s?{x:s.getBoundingClientRect().left,y:s.getBoundingClientRect().top}:{x:0,y:0}),r=t.size??(s?{width:s.offsetWidth,height:s.offsetHeight}:{width:0,height:0});i.push({id:e,element:s,oldPosition:a,newPosition:o,size:r}),Nt(e,a,o,i)}for(const{id:t,newPosition:e,size:o}of i){const i=n.get(t);i&&n.set(t,{...i,position:e,size:o,hasBeenDragged:!0,isAnimatingPosition:!0})}K();for(const{id:t,element:e,oldPosition:n,newPosition:o}of i)e?Rt(e,n,o,{duration:Ct.parentMove,onComplete:()=>$t(t)}):setTimeout(()=>$t(t),Ct.parentMove+Pt)}function Nt(t,i,e,o){const s=n.get(t);if(!(null==s?void 0:s.childId))return;const a=n.get(s.childId);if(!(null==a?void 0:a.offsetFromParent))return;const r=bt(s.childId),d={x:i.x+a.offsetFromParent.x,y:i.y+a.offsetFromParent.y},l={x:e.x+a.offsetFromParent.x,y:e.y+a.offsetFromParent.y};o.push({id:s.childId,element:r,oldPosition:d,newPosition:l}),n.set(s.childId,{...a,position:l,hasBeenDragged:!0,isAnimatingPosition:!0}),a.childId&&Nt(s.childId,d,l,o)}function jt(){r&&clearTimeout(r),d(setTimeout(()=>{Xt(null),d(null)},100))}let Kt=!1;function Ut(){Kt||"undefined"==typeof window||(window.addEventListener("resize",jt),Kt=!0)}function Zt(){"undefined"!=typeof window&&(window.removeEventListener("resize",jt),Kt=!1)}function Jt(t){if(0===t.size)return;const i=[];for(const[e,o]of t){const t=n.get(e);if(!t)continue;const s=bt(e),a=t.position??(s?{x:s.getBoundingClientRect().left,y:s.getBoundingClientRect().top}:{x:0,y:0});i.push({id:e,element:s,oldPosition:a,newPosition:o})}for(const{id:t,newPosition:e}of i){const i=n.get(t);i&&n.set(t,{...i,position:e,hasBeenDragged:!0,isAnimatingPosition:!0})}K();for(const{id:t,element:e,oldPosition:n,newPosition:o}of i)e?Rt(e,n,o,{duration:Ct.parentMove,onComplete:()=>$t(t)}):setTimeout(()=>$t(t),Ct.parentMove+Pt)}function Qt(t){A.delete(t)}function ti(t){const i=n.get(t);if(!(null==i?void 0:i.childId))return;const e=n.get(i.childId);e&&(z.includes(i.childId)||X([...z,i.childId]),e.childId&&ti(i.childId))}function ii(t){const i=n.get(t);if(!i||i.isMinimized)return;if(Qt(t),i.parentId){const t=n.get(i.parentId);if(t&&!t.isMinimized)return void ii(i.parentId)}if(L([...u,t]),i.position&&i.size&&T){const e=T(),n=S.indexOf(t);I({x:e.x+n*(e.height+8),y:e.y,originX:i.position.x+i.size.width/2,originY:i.position.y+i.size.height/2})}const e=i.childId;n.set(t,{...i,isMinimized:!0,lastChildId:e}),S.includes(t)||D([...S,t]),K(),i.childId&&ti(t),Xt(null)}function ei(t){const i=n.get(t);if(!i||!i.isMinimized)return;n.set(t,{...i,isMinimized:!1,isOpen:!0}),V([...w,t]),rt(t);const e=i.lastChildId||i.childId;e&&oi(e),K()}function ni(){Array.from(n.values()).filter(t=>t.isMinimized).map(t=>t.id).forEach(t=>{const i=n.get(t);if(i){n.set(t,{...i,isMinimized:!1,isOpen:!0}),V([...w,t]),rt(t);const e=i.lastChildId||i.childId;e&&oi(e)}}),D([]),K()}function oi(t){const i=n.get(t);if(i&&i.isHiddenWithParent){Y([...y,t]);const e=i.lastChildId||i.childId;e&&oi(e)}}function si(t){const i=n.get(t);i&&i.isHiddenWithParent&&(n.set(t,{...i,isHiddenWithParent:!1}),K())}function ai(t){const i=n.get(t);i&&(n.set(t,{...i,isHiddenWithParent:!0}),K())}function ri(t){const i=n.get(t);if(!(null==i?void 0:i.childId))return;const e=n.get(i.childId);e&&(e.childId&&ri(i.childId),n.set(i.childId,{...e,isHiddenWithParent:!0}),K())}function di(t){if(!tt(t))return;const i=n.get(t);B.has(t)?(B.delete(t),n.set(t,{...i,isTransparent:!1})):(B.add(t),n.set(t,{...i,isTransparent:!0})),K()}function li(t){tt(t)&&(v.includes(t)||(q([...v,t]),K()))}function hi(t){t.classList.add("modal-shake"),t.addEventListener("animationend",()=>{t.classList.remove("modal-shake")},{once:!0})}function ci(t){if(!tt(t))return;const i=n.get(t);n.set(t,{...i,isRejected:!0}),K(),setTimeout(()=>{const i=n.get(t);i&&(n.set(t,{...i,isRejected:!1}),K())},300);const e=bt(t);e&&hi(e)}function gi(t){if(!tt(t))return;const i=n.get(t);B.delete(t),n.set(t,{...i,isTransparent:!1}),K()}function ui(t){}function mi(t){}function fi(t,i,e){pi(t,e,{parentId:i})}function pi(t,i,e){const o=ue(),s=n.get(t);if(s&&s.isOpen&&!s.isMinimized&&!s.isHiddenWithParent)return li(t),void rt(t);if(s&&s.isMinimized)return void ei(t);if("x"in i&&"y"in i)C.set(t,i);else{const e=i.getBoundingClientRect();C.set(t,{x:e.left+e.width/2,y:e.top+e.height/2})}if((null==e?void 0:e.parentId)&&o.features.parentChild){const i=n.get(e.parentId);(null==i?void 0:i.childId)&&i.childId!==t&&yi(i.childId,!0),M({parentId:e.parentId,childId:t})}if(m.includes(t)||_([...m,t]),K(),!s)return void((null==F?void 0:F.isRegisteredInRegistry(t))&&F.mountModal(t));const a={isOpen:!0};(null==e?void 0:e.parentId)&&o.features.parentChild&&(a.parentId=e.parentId),n.set(t,{...s,...a}),rt(t),null==H||H.push(t)}function wi(t){ot(t);const i=n.get(t.id);i&&(n.set(t.id,{...i,isOpen:!0}),K()),_([...m,t.id]),K(),rt(t.id),null==H||H.push(t.id)}function yi(t,i=!1){const e=n.get(t);if(e&&(e.isOpen||e.isMinimized)){if(Qt(t),e.childId&&yi(e.childId,i),e.isMinimized)return D(S.filter(i=>i!==t)),vi(t),void(null==H||H.pop());R.add(t),i?$([...p,t]):G([...f,t]),K(),null==H||H.pop()}}function zi(t){const i=new Set(t??[]);Array.from(n.keys()).filter(t=>!i.has(t)).forEach(t=>yi(t,!0))}function vi(t){const i=n.get(t);if(i){if(R.delete(t),i.parentId){const e=n.get(i.parentId);e&&e.childId===t&&n.set(i.parentId,{...e,childId:void 0,lastChildId:t})}n.set(t,{...i,isOpen:!1,isMinimized:!1,isHiddenWithParent:!1,isTransparent:!1,position:null,size:null,hasBeenDragged:!1,parentId:void 0,childId:void 0,offsetFromParent:void 0}),K()}}function xi(t){if(Array.isArray(t)){const i=new Set(t);return Array.from(n.entries()).filter(([t,e])=>e.isOpen&&!i.has(t)).map(([t])=>t)}const i=n.get(t);if(!i)return[t];const e=[t];return i.childId&&e.push(...xi(i.childId)),e}function bi(t){return u.includes(t)}function Ii(t){L(u.filter(i=>i!==t));const i=b;return I(null),i}function Ci(t){return z.includes(t)}function Pi(t){X(z.filter(i=>i!==t))}function Mi(t){return m.includes(t)}function Ai(t){_(m.filter(i=>i!==t))}function ki(t){return f.includes(t)}function Ri(t){G(f.filter(i=>i!==t))}function Bi(t){return p.includes(t)}function Si(t){$(p.filter(i=>i!==t))}function Di(t){return w.includes(t)}function Hi(t){V(w.filter(i=>i!==t))}function Ei(t){return y.includes(t)}function Ti(t){Y(y.filter(i=>i!==t))}function Oi(t){return v.includes(t)}function Fi(t){q(v.filter(i=>i!==t)),x.includes(t)||N([...x,t])}function Wi(t){N(x.filter(i=>i!==t))}function Li(t){return(null==P?void 0:P.childId)===t}function _i(t){return A.has(t)}function Gi(t){const i=A.get(t)??null;return A.delete(t),i}function $i(t,i){C.set(t,i)}function Vi(t){return C.get(t)??null}function Yi(t){const i=C.get(t)??null;return C.delete(t),i}function Xi(){const t=b;return I(null),t}function qi(t){const i=P;return t&&(null==i?void 0:i.childId)!==t?null:(M(null),i)}function Ni(t,i,e){const o=n.get(t),s=n.get(i);o&&s&&(n.set(t,{...o,childId:i}),n.set(i,{...s,parentId:t,offsetFromParent:e}),rt(i),K())}function ji(){return P}function Ki(t){if("animated"!==ue().parentChild.movementMode)return;const i=n.get(t);if(!(null==i?void 0:i.parentId)||!i.offsetFromParent||!i.position)return;const e={x:i.position.x-i.offsetFromParent.x,y:i.position.y-i.offsetFromParent.y};A.set(i.parentId,e),K()}function Ui(t){return A.get(t)??null}function Zi(t,i,e){const o=n.get(t);if(!o)return null;const s=bt(t);if(!s)return null;const a=o.position??{x:s.getBoundingClientRect().left,y:s.getBoundingClientRect().top},r=o.size??{width:s.offsetWidth,height:s.offsetHeight};return{x:a.x+(r.width-i)/2,y:a.y+(r.height-e)/2}}const Ji={BASE:0,DROPDOWN:100,STICKY:200,OVERLAY:300,MODAL:400,DOCK:8e3,TOAST:9e3};let Qi=Ji.MODAL;function te(){Qi=ue().zIndex.base}function ie(){const t=Qi;return Qi+=2,t}function ee(t){const i=ue();return"MODAL"===t?i.zIndex.base:"DOCK"===t?i.zIndex.dock:"TOAST"===t?i.zIndex.toast:Ji[t]}function ne(){Qi=ue().zIndex.base}function oe(){const t=new Map;return{on(i,e){let n=t.get(i);return n||(n=new Set,t.set(i,n)),n.add(e),()=>{null==n||n.delete(e),0===(null==n?void 0:n.size)&&t.delete(i)}},emit(i,e){const n=t.get(i);n&&n.forEach(t=>t(e))},off(i){i?t.delete(i):t.clear()},listenerCount(i){var e;return(null==(e=t.get(i))?void 0:e.size)??0}}}function se(t){return"boolean"==typeof t?{visible:t,blockClicks:t}:t}const ae={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,easing:"cubic-bezier(0.34, 1.56, 0.64, 1)"},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 re={...ae},de=0;const le=new Set;function he(t){return le.add(t),()=>le.delete(t)}function ce(){le.forEach(t=>t())}function ge(){return de}function ue(){return re}function me(t){const i=re;re=pe(re,t),de++,ce(),i.features.dock&&!re.features.dock&&ni()}function fe(){re={...ae},de++,ce()}function pe(t,i){var e;return{features:{...t.features,...i.features},dock:{...t.dock,...i.dock},animations:{...t.animations,...i.animations},appearance:{...t.appearance,...i.appearance},zIndex:{...t.zIndex,...i.zIndex},parentChild:{...t.parentChild,...i.parentChild},positioning:{...t.positioning,...i.positioning,avoidElements:(null==(e=i.positioning)?void 0:e.avoidElements)??t.positioning.avoidElements},portalTarget:i.portalTarget??t.portalTarget}}function we(t){const i=re.features[t];if("backdrop"===t){const t=se(i);return t.visible||t.blockClicks}return i}function ye(t,i){const e=ue(),n=i?pe(e,i):e;return{isFeatureEnabled:i=>{var e;if(void 0!==(null==(e=null==t?void 0:t.features)?void 0:e[i])){const e=t.features[i];if("backdrop"===i){const t=se(e);return t.visible||t.blockClicks}return e}const o=n.features[i];if("backdrop"===i){const t=se(o);return t.visible||t.blockClicks}return o},getAppearance:i=>{var e;return void 0!==(null==(e=null==t?void 0:t.appearance)?void 0:e[i])?t.appearance[i]:n.appearance[i]},getPositioning:i=>{var e;return void 0!==(null==(e=null==t?void 0:t.positioning)?void 0:e[i])?t.positioning[i]:n.positioning[i]},getEffectiveConfig:()=>n}}function ze(t){const{getModalConfig:i,getProviderConfig:e}=t;return{getEffectiveConfig:function(){const t=ue(),n=e(),o=i();let s=t;return n&&(s=pe(s,n)),o&&(s={...s,features:{...s.features,...o.features},appearance:{...s.appearance,...o.appearance},animations:{...s.animations,...o.animations},positioning:{...s.positioning,...o.positioning},parentChild:{...s.parentChild,...o.parentChild}}),s},isFeatureEnabled:function(t){var n,o;const s=i(),a=e(),r=i=>{if(void 0!==i){if("backdrop"===t&&"object"==typeof i){const t=se(i);return t.visible||t.blockClicks}return i}},d=r(null==(n=null==s?void 0:s.features)?void 0:n[t]);if(void 0!==d)return d;const l=r(null==(o=null==a?void 0:a.features)?void 0:o[t]);return void 0!==l?l:r(ue().features[t])??!1},getAppearance:function(t){var n,o;const s=i(),a=e();return void 0!==(null==(n=null==s?void 0:s.appearance)?void 0:n[t])?s.appearance[t]:void 0!==(null==(o=null==a?void 0:a.appearance)?void 0:o[t])?a.appearance[t]:ue().appearance[t]},getAnimation:function(t){var n,o;const s=i(),a=e();return void 0!==(null==(n=null==s?void 0:s.animations)?void 0:n[t])?s.animations[t]:void 0!==(null==(o=null==a?void 0:a.animations)?void 0:o[t])?a.animations[t]:ue().animations[t]},getPositioning:function(t){var n,o;const s=i(),a=e();return void 0!==(null==(n=null==s?void 0:s.positioning)?void 0:n[t])?s.positioning[t]:void 0!==(null==(o=null==a?void 0:a.positioning)?void 0:o[t])?a.positioning[t]:ue().positioning[t]},getParentChild:function(t){var n,o;const s=i(),a=e();return void 0!==(null==(n=null==s?void 0:s.parentChild)?void 0:n[t])?s.parentChild[t]:void 0!==(null==(o=null==a?void 0:a.parentChild)?void 0:o[t])?a.parentChild[t]:ue().parentChild[t]}}}const ve={modal:"modal-dialog",modalDragging:"modal-dragging",modalResizing:"modal-resizing",modalPositioned:"modal-positioned",modalMinimizing:"modal-minimizing",modalRestoring:"modal-restoring",modalOpening:"modal-opening",modalClosing:"modal-closing",modalCentered:"modal-centered",modalSolid:"modal-solid",modalTransparent:"modal-transparent",modalGlow:"modal-glow",modalHasGlow:"modal-has-glow",modalHasChild:"modal-has-child",modalIsChild:"modal-is-child",modalWasRestored:"modal-was-restored",modalVisibleByAnimation:"modal-visible-by-animation",modalAwaitingRestore:"modal-awaiting-restore",modalAwaitingChildOpen:"modal-awaiting-child-open",modalAnimatingToCenter:"modal-animating-to-center",modalAnimatingPosition:"modal-animating-position",modalAttention:"modal-attention",modalGlowStabilizing:"modal-glow-stabilizing",header:"modal-header",headerDraggable:"modal-header-draggable",body:"modal-body",footer:"modal-footer",childOverlay:"modal-child-overlay",overlayClosing:"modal-overlay-closing",headerTitle:"modal-header-title",headerIcon:"modal-header-icon",headerTitleGroup:"modal-header-title-group",headerActions:"modal-header-actions",headerTrafficLights:"modal-header-traffic-lights",headerLight:"modal-header-light",headerLightClose:"modal-header-light-close",headerLightMinimize:"modal-header-light-minimize",headerLightStyle:"modal-header-light-style",headerLightDisabled:"modal-header-light-disabled",headerMacCenter:"modal-header-mac-center",headerMacSpacer:"modal-header-mac-spacer",headerBtnWindows:"modal-header-btn-windows",headerBtnWindowsClose:"modal-header-btn-windows-close",headerBtnWindowsStyle:"modal-header-btn-windows-style",headerBtnWindowsDisabled:"modal-header-btn-windows-disabled",resizeHandles:"modal-resize-handles",resizeHandle:"modal-resize-handle",resizeN:"modal-resize-n",resizeS:"modal-resize-s",resizeE:"modal-resize-e",resizeW:"modal-resize-w",resizeNE:"modal-resize-ne",resizeNW:"modal-resize-nw",resizeSE:"modal-resize-se",resizeSW:"modal-resize-sw",resizePrefix:"modal-resize-",dock:"modal-dock",dockContainer:"modal-dock-container",dockItem:"modal-dock-item",dockItemActive:"modal-dock-item-active",dockItemHasGlow:"modal-dock-item-has-glow",dockItemHasChild:"modal-dock-item-has-child",dockItemLabelBeside:"modal-dock-item-label-beside",dockItemLabelBelow:"modal-dock-item-label-below",dockItemIcon:"modal-dock-item-icon",dockItemIconPlaceholder:"modal-dock-item-icon-placeholder",dockItemLabel:"modal-dock-item-label",dockItemGlow:"modal-dock-item-glow",dockChildIndicator:"modal-dock-child-indicator",dockHandle:"modal-dock-handle",dockHandleDragging:"modal-dock-handle-dragging",dockLeft:"modal-dock-left",dockRight:"modal-dock-right",dockBottom:"modal-dock-bottom",dockFree:"modal-dock-free",dockEmpty:"modal-dock-empty",dockFreeHorizontal:"modal-dock-free-horizontal",dockFreeVertical:"modal-dock-free-vertical",backdrop:"modal-backdrop",backdropVisible:"modal-backdrop-visible",srOnly:"sr-only",reactBodyContent:"react-modal-body-content",reactFooterContent:"react-modal-footer-content"},xe={dialog:ve.modal,dialogCentered:ve.modalCentered,dialogDragging:ve.modalDragging,dialogResizing:ve.modalResizing,dialogMinimizing:ve.modalMinimizing,dialogRestoring:ve.modalRestoring,dialogOpening:ve.modalOpening,dialogClosing:ve.modalClosing,dialogSolid:ve.modalSolid,dialogTransparent:ve.modalTransparent,dialogHasGlow:ve.modalHasGlow,dialogHasChild:ve.modalHasChild,dialogIsChild:ve.modalIsChild,dialogAnimatingPosition:ve.modalAnimatingPosition,dialogAttention:ve.modalAttention,header:ve.header,headerDraggable:ve.headerDraggable,headerLayout:t=>`modal-header--${t}`,body:ve.body,footer:ve.footer,childOverlay:ve.childOverlay,overlayClosing:ve.overlayClosing,headerTitle:ve.headerTitle,headerIcon:ve.headerIcon,headerTitleGroup:ve.headerTitleGroup,headerActions:ve.headerActions,headerTrafficLights:ve.headerTrafficLights,headerLight:ve.headerLight,headerLightClose:ve.headerLightClose,headerLightMinimize:ve.headerLightMinimize,headerLightStyle:ve.headerLightStyle,headerLightDisabled:ve.headerLightDisabled,headerMacCenter:ve.headerMacCenter,headerMacSpacer:ve.headerMacSpacer,headerBtnWindows:ve.headerBtnWindows,headerBtnWindowsClose:ve.headerBtnWindowsClose,headerBtnWindowsStyle:ve.headerBtnWindowsStyle,headerBtnWindowsDisabled:ve.headerBtnWindowsDisabled,resizeHandles:ve.resizeHandles,resizeHandle:ve.resizeHandle,resizePrefix:ve.resizePrefix,dock:ve.dock,dockContainer:ve.dockContainer,dockItem:ve.dockItem,dockItemActive:ve.dockItemActive,dockItemHasGlow:ve.dockItemHasGlow,dockItemHasChild:ve.dockItemHasChild,dockItemLabelBeside:ve.dockItemLabelBeside,dockItemLabelBelow:ve.dockItemLabelBelow,dockItemIcon:ve.dockItemIcon,dockItemIconPlaceholder:ve.dockItemIconPlaceholder,dockItemLabel:ve.dockItemLabel,dockItemGlow:ve.dockItemGlow,dockChildIndicator:ve.dockChildIndicator,dockHandle:ve.dockHandle,dockHandleDragging:ve.dockHandleDragging,dockLeft:ve.dockLeft,dockRight:ve.dockRight,dockBottom:ve.dockBottom,dockFree:ve.dockFree,dockEmpty:ve.dockEmpty,dockFreeHorizontal:ve.dockFreeHorizontal,dockFreeVertical:ve.dockFreeVertical,backdrop:ve.backdrop,backdropVisible:ve.backdropVisible},be={modalId:"data-modal-id",dockContainer:"data-dock-container",resizeDir:"data-resize-dir",modalBridge:"data-modal-bridge"},Ie={modalId:be.modalId,resizeDirection:"data-direction",dockItemId:"data-dock-item-id"},Ce=["n","s","e","w","ne","nw","se","sw"],Pe={n:"Resize north",s:"Resize south",e:"Resize east",w:"Resize west",ne:"Resize northeast",nw:"Resize northwest",se:"Resize southeast",sw:"Resize southwest"},Me={minimize:500,restore:400,open:400,close:250,overlay:200,centerAfterResize:200,glowStabilize:1e3},Ae={minWidth:280,minHeight:200,maxWidth:"600px",zIndexBase:1e3},ke=["button:not([disabled])","[href]","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(", ");function Re(t,i){return function(t,i,e={}){const{timeout:n=5e3}=e;return new Promise((e,o)=>{const s=performance.now(),a=()=>{const r=t(),d=performance.now()-s;r&&i(r)?e(r):d>=n?o(new Error(`DOM not ready after ${n}ms`)):requestAnimationFrame(a)};a()})}(t,t=>t.offsetWidth>0&&t.offsetHeight>0,i)}function Be(t,i,e=2e3){return new Promise((n,o)=>{let s=!1;const a=e=>{i&&e.animationName!==i||s||(s=!0,t.removeEventListener("animationend",a),n(e))};t.addEventListener("animationend",a),setTimeout(()=>{s||(s=!0,t.removeEventListener("animationend",a),o(new Error(`Animation '${i||"any"}' did not complete within ${e}ms`)))},e)})}const Se={MINIMIZE:"modal-genie-minimize",RESTORE:"modal-genie-restore",OPEN:"modal-genie-restore",CLOSE:"modal-close",CLOSE_CENTERED:"modal-close-centered",CHILD_APPEAR:"modal-child-appear",CHILD_DISAPPEAR:"modal-child-disappear"};function De(t,i){const e=e=>{e.target===t&&i(e.animationName)};return t.addEventListener("animationend",e),()=>t.removeEventListener("animationend",e)}function He(){const t=Tt();return Array.from(t.values()).filter(t=>t.isMinimized).sort((t,i)=>t.dockPosition-i.dockPosition)}function Ee(t,i,e){const n=ct(t.x,t.y,i,e);return{x:Math.round(n.x),y:Math.round(n.y)}}function Te(t,i,e,n,o,s=8){const a=window.innerWidth-n-s,r=window.innerHeight-o-s,d=Math.min(Math.max(t-e.x,s),Math.max(s,a)),l=Math.min(Math.max(i-e.y,s),Math.max(s,r));return{x:Math.round(d),y:Math.round(l)}}function Oe(t,i){const e=["modal-dock-container"];return"left"===t?e.push("modal-dock-left"):"right"===t?e.push("modal-dock-right"):"bottom"===t?e.push("modal-dock-bottom"):"free"===t&&e.push("modal-dock-free"),i&&e.push("modal-dock-empty"),e.join(" ")}function Fe(t,i){const e=["modal-dock"];return"free"===t&&e.push("horizontal"===i?"modal-dock-free-horizontal":"modal-dock-free-vertical"),e.join(" ")}function We(){const t=Tt();return Array.from(t.values()).some(t=>t.isOpen&&!t.isMinimized&&!t.isHiddenWithParent)}function Le(){return se(ue().features.backdrop)}function _e(){const t=Le();return t.visible||t.blockClicks}function Ge(t={}){const{initialPosition:i={x:0,y:0},constrain:e=!0}=t,n={...i};let o=!1,s=!1,a=0,r=0,d=0,l=0;const h=oe();function c(){return{isDragging:o,position:{...n},hasBeenDragged:s}}function g(){h.emit("change",c())}return{getState:c,getPosition:()=>({...n}),isDragging:()=>o,hasBeenDragged:()=>s,setPosition:function(t){n.x=t.x,n.y=t.y,g()},setHasBeenDragged:function(t){s=t,g()},reset:function(){n.x=i.x,n.y=i.y,s=!1,o=!1,g()},constrainToViewport:function(t){if(!s)return;const i=ct(n.x,n.y,t.width,t.height);n.x=i.x,n.y=i.y,g()},onPointerDown:function(t,i){if(0===t.button){if(!s){const t=i.getBoundingClientRect();n.x=t.left,n.y=t.top}o=!0,a=t.clientX,r=t.clientY,d=n.x,l=n.y,i.setPointerCapture(t.pointerId),h.emit("dragStart",{...n}),g()}},onPointerMove:function(t,i){if(!o)return;const c=t.clientX-a,u=t.clientY-r;let m=d+c,f=l+u;if(e){const t=ct(m,f,i.width,i.height);m=t.x,f=t.y}n.x=m,n.y=f,s=!0,h.emit("dragMove",{...n}),g()},onPointerUp:function(t,i){o&&(o=!1,i.releasePointerCapture(t.pointerId),h.emit("dragEnd",{...n}),g())},subscribe:function(t){return h.on("change",t)},destroy:function(){h.off()}}}function $e(t){const{minWidth:i=Ae.minWidth,minHeight:e=Ae.minHeight,getPosition:n,setPosition:o,getHasBeenDragged:s,setHasBeenDragged:a,getElement:r,getSymmetricResize:d,onResizeEnd:l}=t;let h=!1,c="",g={width:0,height:0},u=!1,m=!1,f={x:0,y:0,width:0,height:0,posX:0,posY:0,centerX:0,centerY:0},p=null;const w=oe();let y=null,z=null;function v(){return{isResizing:h,direction:c,size:{...g},hasBeenResized:u}}function x(){w.emit("change",v())}function b(t){if(t.pointerId!==p)return;const n=t.clientX-f.x,s=t.clientY-f.y,a=window.innerWidth,r=window.innerHeight,l=(null==d?void 0:d())??!1;let h=f.width,u=f.height,m=f.posX,y=f.posY;if(l){if(c.includes("e")||c.includes("w")){const t=c.includes("e")?n:-n;h=Math.max(i,f.width+2*t),m=f.centerX-h/2}if(c.includes("s")||c.includes("n")){const t=c.includes("s")?s:-s;u=Math.max(e,f.height+2*t),y=f.centerY-u/2}}else{if(c.includes("e")){const t=a-m;h=Math.max(i,Math.min(f.width+n,t))}if(c.includes("w")){const t=f.width-i,e=Math.min(n,t);h=f.width-e,m=f.posX+e}if(c.includes("s")){const t=r-y;u=Math.max(e,Math.min(f.height+s,t))}if(c.includes("n")){const t=f.height-e,i=Math.min(s,t);u=f.height-i,y=f.posY+i}}const z=gt(m,y,h,u);g={width:z.width,height:z.height},o({x:z.x,y:z.y}),w.emit("resizeMove",{size:{...g},position:{x:z.x,y:z.y}}),x()}function I(t){if(t.pointerId!==p)return;h=!1,c="",p=null,y&&window.removeEventListener("pointermove",y),z&&(window.removeEventListener("pointerup",z),window.removeEventListener("pointercancel",z)),y=null,z=null,m=!0;const i=n();w.emit("resizeEnd",{size:{...g},position:i}),l&&l(i,{...g}),x(),setTimeout(()=>{m=!1},0)}return{getState:v,getSize:()=>({...g}),isResizing:()=>h,hasBeenResized:()=>u,justFinishedResizing:()=>m,setSize:function(t){g={...t},u=!0,x()},reset:function(){u=!1,g={width:0,height:0},h=!1,c="",x()},constrainToViewport:function(){const t=n(),i=r();if(!i)return;const e=gt(t.x,t.y,g.width||i.offsetWidth,g.height||i.offsetHeight);g={width:e.width,height:e.height},o({x:e.x,y:e.y}),x()},startResize:function(t,i){t.preventDefault(),t.stopPropagation();const e=r();if(!e)return;const d=e.getBoundingClientRect();s()||(o({x:d.left,y:d.top}),a(!0)),u||(g={width:d.width,height:d.height},u=!0);const l=n();h=!0,c=i,p=t.pointerId,f={x:t.clientX,y:t.clientY,width:g.width,height:g.height,posX:l.x,posY:l.y,centerX:l.x+g.width/2,centerY:l.y+g.height/2},y=b,z=I,window.addEventListener("pointermove",y),window.addEventListener("pointerup",z),window.addEventListener("pointercancel",z),w.emit("resizeStart",{direction:i}),x()},subscribe:function(t){return w.on("change",t)},destroy:function(){y&&window.removeEventListener("pointermove",y),z&&(window.removeEventListener("pointerup",z),window.removeEventListener("pointercancel",z)),w.off()}}}function Ve(t){return Array.from(t.querySelectorAll(ke)).filter(t=>null!==t.offsetParent||"A"===t.tagName)}function Ye(t,i){if("Tab"!==t.key)return;const e=Ve(i);if(0===e.length)return void t.preventDefault();const n=e[0],o=e[e.length-1],s=document.activeElement;t.shiftKey?s===n&&(o.focus(),t.preventDefault()):s===o&&(n.focus(),t.preventDefault())}function Xe(t){const i=Ve(t);return i.length>0&&(i[0].focus(),!0)}function qe(t){const i=Ve(t);return i.length>0&&(i[i.length-1].focus(),!0)}function Ne(t){return t.contains(document.activeElement)}function je(t){let i=null;return{activate(){i=document.activeElement,Xe(t)},deactivate(){i&&"function"==typeof i.focus&&i.focus(),i=null},handleKeyDown(i){Ye(i,t)},containsFocus:()=>Ne(t)}}function Ke(t,i){return{x:t.x-i.x,y:t.y-i.y}}function Ue(t,i){return{x:t.x+i.x,y:t.y+i.y}}function Ze(t,i){return{x:t.x-i.x,y:t.y-i.y}}function Je(t,i,e){return{x:t.x+(i.width-e.width)/2,y:t.y+(i.height-e.height)/2}}function Qe(t){const i=t.getBoundingClientRect();return{position:{x:i.left,y:i.top},size:{width:i.width,height:i.height}}}function tn(t){return bt(t)}function en(t){return bt(t)}function nn(t,i,e){return t&&!i&&!e}function on(t,i){const e=[];let n=i(t);for(;n;)e.push(n),n=i(n);return e}function sn(t,i){const e=[];let n=i(t);for(;n;)e.push(n),n=i(n);return e}function an(t,i){let e=t,n=i(e);for(;n;)e=n,n=i(e);return e}function rn(t,i,e){const n=t.x+i.width/2,o=t.y+i.height/2;return{x:e.x-n,y:e.y-o,originX:e.x-t.x,originY:e.y-t.y}}function dn(t,i,e){const n=t.x+i.width/2,o=t.y+i.height/2;return{x:e.x-n,y:e.y-o,originX:e.x-t.x,originY:e.y-t.y}}function ln(t,i,e){const n=t.x+i.width/2,o=t.y+i.height/2;return{x:e.x-n,y:e.y-o,originX:e.x-t.x,originY:e.y-t.y}}function hn(t){return{"--modal-transform-x":`${t.x}px`,"--modal-transform-y":`${t.y}px`,"--modal-origin-x":`${t.originX}px`,"--modal-origin-y":`${t.originY}px`}}function cn(){return{x:"undefined"!=typeof window?window.innerWidth/2:0,y:"undefined"!=typeof window?window.innerHeight-40:0}}function gn(t,i){const e=document.querySelector(`.modal-dock-item[data-modal-id="${t}"]`);if(e){const t=e.getBoundingClientRect();return{x:t.left+t.width/2,y:t.top+t.height/2}}const n=document.querySelector('[data-dock-container="true"]');if(n){const t=n.getBoundingClientRect();return{x:t.left+t.width/2,y:t.top+t.height/2}}return i??cn()}function un(t){const{getId:i,getElement:e,getPosition:n,setPosition:o,getHasBeenDragged:s,setHasBeenDragged:a,getHasBeenResized:r,getSize:d,areAnimationsEnabled:l=()=>!0,onMinimizeComplete:h,onOpenStart:c}=t;let g="none",u=!1,m=null,f=null,p=null,w=null,y=null,z=null,v=null;const x=oe();function b(){return{type:g,isAnimating:u,transform:m?{...m}:null}}function I(){x.emit("change",b())}function C(){z&&(clearTimeout(z),z=null)}function P(){const t=e();t&&!v&&(v=De(t,M))}function M(t){switch(C(),t){case Se.MINIMIZE:"minimize"===g&&A();break;case Se.RESTORE:"restore"===g?k():"open"===g&&R();break;case Se.CLOSE:case Se.CLOSE_CENTERED:case Se.CHILD_DISAPPEAR:"close"===g&&B();break;case Se.CHILD_APPEAR:"open"===g&&R()}}function A(){"minimize"===g&&(C(),w?(w(),w=null):y&&(null==h||h(y.position,!0,y.size)),x.emit("animationEnd",{type:"minimize"}),y=null)}function k(){if("restore"!==g)return;C(),g="none",u=!1,m=null;const t=e();t&&(t.setAttribute("data-state","open"),t.setAttribute("data-animation-phase","idle")),x.emit("animationEnd",{type:"restore"}),I()}function R(){if("open"!==g)return;C(),g="none",u=!1,m=null;const t=e();t&&(t.setAttribute("data-state","open"),t.setAttribute("data-animation-phase","idle")),x.emit("animationEnd",{type:"open"}),I()}function B(){if("close"!==g)return;C(),g="none",u=!1;const t=e();t&&(t.setAttribute("data-state","closed"),t.setAttribute("data-animation-phase","idle")),x.emit("animationEnd",{type:"close"}),p&&(p(),p=null),I()}return{getState:b,isAnimating:()=>u,getAnimationType:()=>g,getTransform:()=>m?{...m}:null,getPendingOpenSource:()=>f?{...f}:null,setPendingOpenSource:t=>{f=t?{...t}:null},startMinimize:function(t,c){const f=e();if(u||!f)return!1;if(P(),C(),!l()){const t=f.getBoundingClientRect(),i=s()?n():{x:t.left,y:t.top},e=r()?d():{width:t.width,height:t.height};return s()||(o(i),a(!0)),c?c():null==h||h(i,!0,e),!0}const p=f.getBoundingClientRect(),v=s()?n():{x:p.left,y:p.top},b=r()?d():{width:p.width,height:p.height};s()||(o(v),a(!0));const M=t??gn(i());return m=rn(v,b,M),w=c||null,y={position:v,size:b},f.setAttribute("data-state","minimizing"),f.setAttribute("data-animation-phase","prepare"),requestAnimationFrame(()=>{requestAnimationFrame(()=>{g="minimize",u=!0,f.setAttribute("data-animation-phase","animate"),x.emit("animationStart",{type:"minimize"}),I()})}),z=setTimeout(()=>{"minimize"===g&&A()},Ct.minimize+Pt),!0},startRestore:function(t,n){const s=e();if(P(),C(),!l()){const i=t||{x:window.innerWidth/2,y:window.innerHeight/2};return o(i),void a(!0)}const r=gn(i()),d=t||{x:window.innerWidth/2,y:window.innerHeight/2},h=n||{width:480,height:400};o(d),a(!0),m=dn(d,h,r),g="restore",u=!0,s&&(s.setAttribute("data-state","restoring"),s.setAttribute("data-animation-phase","animate")),x.emit("animationStart",{type:"restore"}),I(),z=setTimeout(()=>{"restore"===g&&k()},Ct.restore+Pt)},startOpen:function(){const t=e();if(!f||!t||u)return!1;if(P(),C(),!l())return f=null,!1;const i=f,r=t.getBoundingClientRect(),d=s()?n():{x:r.left,y:r.top},h=r.width,p=r.height;return s()||(o(d),a(!0)),m=ln(d,{width:h,height:p},i),g="open",u=!0,f=null,t.setAttribute("data-state","opening"),t.setAttribute("data-animation-phase","animate"),x.emit("animationStart",{type:"open"}),null==c||c(),I(),z=setTimeout(()=>{"open"===g&&R()},Ct.open+Pt),!0},startClose:function(t){const i=e();return!u&&(P(),C(),l()?(p=t,g="close",u=!0,i&&(i.setAttribute("data-state","closing"),i.setAttribute("data-animation-phase","animate")),x.emit("animationStart",{type:"close"}),I(),z=setTimeout(()=>{"close"===g&&B()},Ct.close+Pt),!0):(t(),!0))},forceClearMinimize:function(){C(),"minimize"===g&&(g="none",u=!1,m=null,w=null,y=null,I())},destroy:function(){C(),null==v||v(),v=null,x.off()},subscribe:t=>x.on("change",t)}}function mn(t){const i={"z-index":t.zIndex};return t.animationTransform?(i.left=`${t.position.x}px`,i.top=`${t.position.y}px`,i["--genie-origin-x"]=`${t.animationTransform.originX}px`,i["--genie-origin-y"]=`${t.animationTransform.originY}px`,i["--genie-translate-x"]=`${t.animationTransform.x}px`,i["--genie-translate-y"]=`${t.animationTransform.y}px`):t.hasBeenDragged&&(i.left=`${t.position.x}px`,i.top=`${t.position.y}px`,t.isAnimatingPosition||(i.transform="none")),t.hasBeenResized?(i.width=`${t.size.width}px`,i.height=`${t.size.height}px`,i["max-width"]="none",i["max-height"]="none"):(t.preferredHeight&&(i["min-height"]=t.preferredHeight),t.maxWidth&&(i["max-width"]=t.maxWidth)),t.glowEnabled&&t.glow&&(i["--modal-glow-color"]=t.glow.color,i["--modal-glow-intensity"]=String(t.glow.intensity??"medium")),i}function fn(t){const i=["modal-dialog"];return t.isDragging&&i.push("modal-dragging"),t.isResizing&&i.push("modal-resizing"),t.hasBeenDragged&&i.push("modal-positioned"),t.isMinimizing&&i.push("modal-minimizing"),t.isRestoring&&i.push("modal-restoring"),t.isOpening&&i.push("modal-opening"),t.isClosing&&i.push("modal-closing"),t.showCentered&&i.push("modal-centered"),t.isTransparent||i.push("modal-solid"),t.isTransparent&&i.push("modal-transparent"),t.glowEnabled&&i.push("modal-glow"),t.hasChild&&i.push("modal-has-child"),t.isChildModal&&i.push("modal-is-child"),t.wasRestored&&i.push("modal-was-restored"),t.isVisibleByAnimation&&i.push("modal-visible-by-animation"),t.isAwaitingRestore&&i.push("modal-awaiting-restore"),t.isAwaitingChildOpen&&i.push("modal-awaiting-child-open"),t.isAnimatingToCenter&&i.push("modal-animating-to-center"),t.isAnimatingPosition&&i.push("modal-animating-position"),t.isAttentionAnimating&&i.push("modal-attention"),t.glowStabilizing&&t.glowEnabled&&i.push("modal-glow-stabilizing"),i}class pn{constructor(t={}){i(this,"element",null),i(this,"resizeHandler",null),i(this,"options"),this.options=t}mount(t){var i,e;this.element=t,this.options.onWindowResize&&(this.resizeHandler=this.options.onWindowResize,window.addEventListener("resize",this.resizeHandler)),null==(e=(i=this.options).onMount)||e.call(i)}destroy(){var t,i;this.resizeHandler&&(window.removeEventListener("resize",this.resizeHandler),this.resizeHandler=null),this.element=null,null==(i=(t=this.options).onDestroy)||i.call(t)}getElement(){return this.element}isMounted(){return null!==this.element}}class wn{constructor(t){i(this,"id"),i(this,"dataId"),i(this,"configHelper"),i(this,"getDragBehavior"),i(this,"getElement"),this.id=t.id,this.dataId=t.dataId,this.configHelper=t.configHelper,this.getDragBehavior=t.getDragBehavior,this.getElement=t.getElement}constrainToViewport(t){const i=this.getDragBehavior();i.hasBeenDragged()&&i.constrainToViewport(t)}shouldApplySmartPositioning(){return"smart"===this.configHelper.getPositioning("strategy")&&!this.getDragBehavior().hasBeenDragged()}applySmartPositioning(){if("smart"!==this.configHelper.getPositioning("strategy"))return!1;const t=Bt(this.id),i=ji();if((null==t?void 0:t.parentId)||i&&i.childId===this.id)return!1;if((null==t?void 0:t.hasBeenDragged)||(null==t?void 0:t.position))return!1;const e=this.getElement()||bt(this.id);if(!e)return!1;const n=e.offsetWidth,o=e.offsetHeight;if(n<=0||o<=0)return!1;const s=this.configHelper.getPositioning("modalGap"),a=Wt().filter(t=>t.id!==this.id),r=pt(this.configHelper.getPositioning("avoidElements")),d=vt(a,{id:this.id,width:n,height:o},{modalGap:s,viewportMargin:s,avoidBounds:r,avoidMargin:s}),l=d.positions.get(this.id);if(!l)return!1;const h=new Map;for(const[t,i]of d.positions)t!==this.id&&h.set(t,i);h.size>0&&qt(h);const c=this.getDragBehavior();return c.setPosition(l),c.setHasBeenDragged(!0),Gt(this.id,l,{size:{width:n,height:o}}),!0}scheduleSmartPositioning(){Re(()=>this.getElement()||bt(this.id)).then(()=>{this.applySmartPositioning()}).catch(()=>{this.applySmartPositioning()})}centerChildOnParent(t){var i,e;const n=Bt(t);if(!n)return!1;const o=this.getElement()||bt(this.id),s=bt(t),a=null==s?void 0:s.getBoundingClientRect(),r=n.position??(a?{x:a.left,y:a.top}:null);if(!r||!o)return!1;const d=(null==(i=n.size)?void 0:i.width)??(null==s?void 0:s.offsetWidth)??(null==a?void 0:a.width)??480,l=(null==(e=n.size)?void 0:e.height)??(null==s?void 0:s.offsetHeight)??(null==a?void 0:a.height)??400,h=o.offsetWidth,c=o.offsetHeight;if(d<=0||l<=0||h<=0||c<=0)return!1;const g={x:r.x+(d-h)/2,y:r.y+(l-c)/2},u=this.getDragBehavior();u.setPosition(g),u.setHasBeenDragged(!0),Gt(this.id,g,{size:{width:h,height:c}}),n.position&&n.size||!a||Gt(t,{x:a.left,y:a.top},{size:{width:d,height:l}});const m={x:g.x-r.x,y:g.y-r.y};return Ni(t,this.id,m),!0}scheduleCenterChildOnParent(t){Re(()=>this.getElement()).then(()=>{this.centerChildOnParent(t)}).catch(()=>{this.centerChildOnParent(t)})}}class yn{constructor(t){i(this,"options"),this.options=t}startDrag(t){const i=this.options.getElement();this.options.configHelper.isFeatureEnabled("drag")&&i&&this.options.getDragBehavior().onPointerDown(t,i)}startResize(t,i){const e=this.options.getState();this.options.configHelper.isFeatureEnabled("resize")&&!e.hasChild&&this.options.getResizeBehavior().startResize(t,i)}handlePointerMove(t){const i=this.options.getElement();if(!i)return;const e=this.options.getDragBehavior(),n=e.isDragging(),o=this.options.getResizeBehavior(),s=o.hasBeenResized()?o.getSize():{width:i.offsetWidth,height:i.offsetHeight};e.onPointerMove(t,s),n&&e.isDragging()&&this.options.onDragMove()}handlePointerUp(t){const i=this.options.getElement();if(!i)return;const e=this.options.getDragBehavior(),n=e.isDragging();e.onPointerUp(t,i),n&&!this.options.getResizeBehavior().justFinishedResizing()&&this.options.onDragEnd()}handleKeyDown(t){var i,e;this.options.closeOnEscape&&"Escape"===t.key&&this.options.isTopModal()&&(t.stopPropagation(),null==(e=(i=this.options).onClose)||e.call(i))}handleTabKey(t){const i=this.options.getElement();i&&Ye(t,i)}focusFirst(){const t=this.options.getElement();t&&Xe(t)}}class zn{constructor(t){i(this,"id"),i(this,"options"),i(this,"_isHandlingMinimize",!1),i(this,"_isAttentionAnimating",!1),i(this,"_wasRestored"),i(this,"_glowStabilizing",!1),i(this,"_restoreHold",!1),i(this,"_isAnimatingToCenter",!1),i(this,"_cancelParentAnimationCleanup",null),i(this,"_parentFlipInFlight",!1),i(this,"_deferredParentTarget",null),i(this,"_parentFlipStartTime",0),this.id=t.id,this.options=t,this._wasRestored=!1}handlePendingStates(){if(!Bt(this.id))return;if(this.handlePendingForceClose())return;if(this.handlePendingMinimize(),this.handlePendingMinimizeWithParent(),this.handlePendingRestore(),this.handlePendingChildRestore(),this.handlePendingClose())return;const t=this.handlePendingParentLink(),i=this.handlePendingOpen(t);this.handlePendingAttention(),this.handlePendingParentAnimation(),this.handleChildCentering(t,i)}handlePendingForceClose(){var t,i;return!!Bi(this.id)&&(Si(this.id),vi(this.id),null==(i=(t=this.options.options).onClose)||i.call(t),!0)}handlePendingMinimize(){if(!bi(this.id)||this._isHandlingMinimize)return;this._isHandlingMinimize=!0,Xi();const t=this.options.getElement();if(t){const i=this.options.getDragBehavior(),e=this.options.getResizeBehavior(),n=t.getBoundingClientRect(),o=i.hasBeenDragged()?i.getPosition():{x:n.left,y:n.top},s=e.hasBeenResized()?e.getSize():{width:n.width,height:n.height};Yt(this.id,{position:o,size:s,hasBeenDragged:!0})}this.options.getAnimationController().startMinimize(void 0,()=>{Ii(this.id),this._isHandlingMinimize=!1})||(this._isHandlingMinimize=!1)}handlePendingMinimizeWithParent(){if(!Ci(this.id)||this._isHandlingMinimize)return;this._isHandlingMinimize=!0;const t=this.options.getElement();if(t){const i=this.options.getDragBehavior(),e=this.options.getResizeBehavior(),n=t.getBoundingClientRect(),o=i.hasBeenDragged()?i.getPosition():{x:n.left,y:n.top},s=e.hasBeenResized()?e.getSize():{width:n.width,height:n.height};Yt(this.id,{position:o,size:s,hasBeenDragged:!0})}this.options.getAnimationController().startMinimize(void 0,()=>{Pi(this.id),ai(this.id),this._isHandlingMinimize=!1})}handlePendingRestore(){if(!Di(this.id))return;const t=Bt(this.id),i=this.options.getAnimationController();Hi(this.id),i.startRestore((null==t?void 0:t.position)??void 0,(null==t?void 0:t.size)??void 0),requestAnimationFrame(()=>{this.options.focusFirst()})}handlePendingChildRestore(){if(!Ei(this.id))return;const t=Bt(this.id),i=this.options.getAnimationController();Ti(this.id),i.startRestore((null==t?void 0:t.position)??void 0,(null==t?void 0:t.size)??void 0),si(this.id),this._wasRestored=!0}handlePendingClose(){var t,i;return!!ki(this.id)&&(Ri(this.id),this.options.getAnimationController().startClose(()=>{var t,i;gi(this.id),vi(this.id),null==(i=(t=this.options.options).onClose)||i.call(t)})||(gi(this.id),vi(this.id),null==(i=(t=this.options.options).onClose)||i.call(t)),!0)}handlePendingParentLink(){const t=ji();return t&&t.childId===this.id&&(Yt(this.id,{parentId:t.parentId}),this._wasRestored=!0),qi(this.id)}handlePendingOpen(t){var i;if(!Mi(this.id))return!1;Ai(this.id);const e=this.options.getDragBehavior(),n=this.options.getResizeBehavior();Yt(this.id,{position:null,hasBeenDragged:!1,size:null}),e.setPosition({x:0,y:0}),e.setHasBeenDragged(!1),n.reset();const o=Yi(this.id)||this.options.options.openSourcePosition||null,s=!!t||!!(null==(i=Bt(this.id))?void 0:i.parentId);let a=!1;return o?(a=!0,this.options.getAnimationController().setPendingOpenSource(o),s&&t?this.openChildModalWithAnimation(t.parentId):this.openStandaloneModalWithAnimation()):s||this.options.getPositioning().scheduleSmartPositioning(),requestAnimationFrame(()=>{this.options.focusFirst()}),a}openChildModalWithAnimation(t){const i=this.options.getPositioning(),e=this.options.getAnimationController();Re(()=>this.options.getElement()).then(()=>{i.centerChildOnParent(t)&&(e.startOpen(),this._wasRestored=!0)}).catch(()=>{i.centerChildOnParent(t)&&(e.startOpen(),this._wasRestored=!0)})}openStandaloneModalWithAnimation(){const t=this.options.getPositioning(),i=this.options.getAnimationController();Re(()=>this.options.getElement()).then(()=>{t.applySmartPositioning(),i.startOpen()}).catch(()=>{t.applySmartPositioning(),i.startOpen()})}handlePendingAttention(){Oi(this.id)&&(Fi(this.id),this.id,this._isAttentionAnimating=!0,setTimeout(()=>{this._isAttentionAnimating=!1,this.id,this.options.onStateChange()},600))}handlePendingParentAnimation(){if(!_i(this.id))return;const t=Gi(this.id);if(t){if(this._parentFlipInFlight&&Date.now()-this._parentFlipStartTime<Ct.parentRetargetInterval)return void(this._deferredParentTarget=t);this._deferredParentTarget=null,this.startParentFlip(t)}}startParentFlip(t){var i,e;const n=this.options.getDragBehavior(),o=this.options.getElement(),s=o?{x:o.getBoundingClientRect().left,y:o.getBoundingClientRect().top}:(null==(i=Bt(this.id))?void 0:i.position)??null;Yt(this.id,{position:t,hasBeenDragged:!0,isAnimatingPosition:!0}),n.setPosition(t),n.setHasBeenDragged(!0),null==(e=this._cancelParentAnimationCleanup)||e.call(this),this._parentFlipInFlight=!0,this._parentFlipStartTime=Date.now();const a=this.id,r=()=>{this._parentFlipInFlight=!1,this._cancelParentAnimationCleanup=null,$t(a);const t=this._deferredParentTarget;t?(this._deferredParentTarget=null,this.startParentFlip(t)):Ki(a)};o&&s?this._cancelParentAnimationCleanup=Rt(o,s,t,{duration:Ct.parentMove,onComplete:r}):setTimeout(r,Ct.parentMove+Pt)}handleChildCentering(t,i){t&&this.options.getElement()&&!i&&this.options.getPositioning().scheduleCenterChildOnParent(t.parentId)}get wasRestored(){return this._wasRestored}set wasRestored(t){this._wasRestored=t}get isAttentionAnimating(){return this._isAttentionAnimating}get glowStabilizing(){return this._glowStabilizing}set glowStabilizing(t){this._glowStabilizing=t}get restoreHold(){return this._restoreHold}set restoreHold(t){this._restoreHold=t}get isAnimatingToCenter(){return this._isAnimatingToCenter}set isAnimatingToCenter(t){this._isAnimatingToCenter=t}get isHandlingMinimize(){return this._isHandlingMinimize}}class vn{constructor(t){var e,n,o,s;i(this,"id"),i(this,"dataId"),i(this,"options"),i(this,"drag"),i(this,"resize"),i(this,"animation"),i(this,"positioning"),i(this,"lifecycle"),i(this,"interactions"),i(this,"stateManager"),i(this,"overlayClosing",!1),i(this,"emitter",oe()),i(this,"unsubscribeState",null),i(this,"cachedState",null),this.id=t.id,this.dataId=t.id,this.options=t,this.drag=Ge({initialPosition:{x:0,y:0},constrain:!0}),this.resize=$e({minWidth:(null==(n=null==(e=t.config)?void 0:e.appearance)?void 0:n.minWidth)??ue().appearance.minWidth,minHeight:(null==(s=null==(o=t.config)?void 0:o.appearance)?void 0:s.minHeight)??ue().appearance.minHeight,getPosition:()=>this.drag.getPosition(),setPosition:t=>this.drag.setPosition(t),getHasBeenDragged:()=>this.drag.hasBeenDragged(),setHasBeenDragged:t=>this.drag.setHasBeenDragged(t),getElement:()=>this.element,onResizeEnd:(t,i)=>this.handleResizeEnd(t,i)}),this.animation=un({getId:()=>this.id,getElement:()=>this.element,getPosition:()=>this.drag.getPosition(),setPosition:t=>this.drag.setPosition(t),getHasBeenDragged:()=>this.drag.hasBeenDragged(),setHasBeenDragged:t=>this.drag.setHasBeenDragged(t),getHasBeenResized:()=>this.resize.hasBeenResized(),getSize:()=>this.resize.getSize(),areAnimationsEnabled:()=>this.options.configHelper.isFeatureEnabled("animations"),onMinimizeComplete:(t,i,e)=>{Yt(this.id,{position:t,size:e,hasBeenDragged:i}),ii(this.id)},onOpenStart:()=>{const t=Bt(this.id);(null==t?void 0:t.parentId)&&(this.stateManager.wasRestored=!0)}}),this.positioning=new wn({id:this.id,dataId:this.dataId,configHelper:t.configHelper,getDragBehavior:()=>this.drag,getElement:()=>this.element}),this.interactions=new yn({id:this.id,configHelper:t.configHelper,getDragBehavior:()=>this.drag,getResizeBehavior:()=>this.resize,getElement:()=>this.element,getState:()=>{var t;return{hasChild:!!(null==(t=Bt(this.id))?void 0:t.childId)}},onDragMove:()=>{if("realtime"===ue().parentChild.movementMode){const t=this.drag.getPosition();Gt(this.id,t,{drag:!0,realtime:!0})}},onDragEnd:()=>{const t=this.drag.getPosition();Gt(this.id,t,{drag:!0}),"animated"===ue().parentChild.movementMode&&Ki(this.id)},onClose:()=>this.close(),closeOnEscape:t.closeOnEscape,isTopModal:()=>dt(this.id)}),this.stateManager=new zn({id:this.id,options:{glow:t.glow,openSourcePosition:t.openSourcePosition,onClose:t.onClose},getDragBehavior:()=>this.drag,getResizeBehavior:()=>this.resize,getAnimationController:()=>this.animation,getElement:()=>this.element,getPositioning:()=>this.positioning,onStateChange:()=>this.notifyStateChange(),focusFirst:()=>this.interactions.focusFirst()}),Li(t.id)&&(this.stateManager.wasRestored=!0),this.lifecycle=new pn({onMount:()=>{this.handleStateChange(),this.handlePendingStates(),this.notifyStateChange()},onDestroy:()=>{var t;null==(t=this.unsubscribeState)||t.call(this),this.drag.destroy(),this.resize.destroy(),this.animation.destroy(),this.emitter.off()},onWindowResize:()=>this.handleWindowResize()}),this.drag.subscribe(()=>this.notifyStateChange()),this.resize.subscribe(()=>this.notifyStateChange()),this.animation.subscribe(()=>{this.handlePendingStates(),this.notifyStateChange()}),this.unsubscribeState=Z(()=>{this.handleStateChange(),this.handlePendingStates(),this.notifyStateChange()}),t.skipRegistration||this.register(t.autoOpen??!1),this.handleStateChange(),this.handlePendingStates()}mount(t){this.lifecycle.mount(t)}destroy(){this.lifecycle.destroy()}get element(){return this.lifecycle.getElement()}handleWindowResize(){if(!this.element||!this.drag.hasBeenDragged())return;const t=this.resize.hasBeenResized()?this.resize.getSize():{width:this.element.offsetWidth,height:this.element.offsetHeight};this.positioning.constrainToViewport(t),this.resize.hasBeenResized()&&this.resize.constrainToViewport(),this.notifyStateChange()}register(t){ot({id:this.id,title:this.options.title,icon:this.options.icon??"",isOpen:t,isMinimized:!1,isHiddenWithParent:!1,isTransparent:!1,isRejected:!1,position:null,size:null,hasBeenDragged:!1,dockPosition:0,glow:this.options.glow??null,parentId:void 0,childId:void 0,offsetFromParent:void 0}),t&&rt(this.id)}getState(){if(this.cachedState)return this.cachedState;const t=Bt(this.id),i=this.drag.getState(),e=this.resize.getState(),n=this.animation.getState(),o=!!t&&(t.isOpen||ki(this.id))&&(!t.isMinimized||bi(this.id))&&(!t.isHiddenWithParent||Ci(this.id)||Ei(this.id)),s=!!(null==t?void 0:t.childId),a=!!(null==t?void 0:t.parentId),r="minimize"===n.type&&n.isAnimating,d="restore"===n.type&&n.isAnimating,l="open"===n.type&&n.isAnimating,h="close"===n.type&&n.isAnimating,c=n.isAnimating,g=(null==t?void 0:t.isAnimatingPosition)??!1,u=g&&(null==t?void 0:t.position)?t.position:i.position,m=!!g||i.hasBeenDragged,f=(Ei(this.id)||Di(this.id))&&!d,p=(a||Li(this.id))&&!l&&(!m||!!this.animation.getPendingOpenSource()),w=d||l||this.stateManager.restoreHold,y=o&&!m&&!c&&!this.animation.getPendingOpenSource()&&!f&&!p;let z="closed";r?z="minimizing":d?z="restoring":l?z="opening":h?z="closing":(null==t?void 0:t.isMinimized)?z="minimized":o&&(z="open");const v=this.options.configHelper.isFeatureEnabled("drag"),x=this.options.configHelper.isFeatureEnabled("resize"),b=this.options.configHelper.isFeatureEnabled("minimize"),I=!!this.options.glow,C=mn({position:u,hasBeenDragged:m,hasBeenResized:e.hasBeenResized,size:e.size,animationTransform:n.transform,zIndex:(null==t?void 0:t.zIndex)??1e3,glowEnabled:I,glow:this.options.glow??null,maxWidth:this.options.maxWidth,preferredHeight:this.options.preferredHeight,isAnimatingPosition:g}),P=fn({isDragging:i.isDragging,isResizing:e.isResizing,hasBeenDragged:m,isMinimizing:r,isRestoring:d,isOpening:l,isClosing:h,showCentered:y,isTransparent:(null==t?void 0:t.isTransparent)??!1,glowEnabled:I,hasChild:s,isChildModal:a,wasRestored:this.stateManager.wasRestored,isVisibleByAnimation:w,isAwaitingRestore:f,isAwaitingChildOpen:p,isAnimatingToCenter:this.stateManager.isAnimatingToCenter,isAnimatingPosition:(null==t?void 0:t.isAnimatingPosition)??!1,isAttentionAnimating:this.stateManager.isAttentionAnimating,glowStabilizing:this.stateManager.glowStabilizing});return this.cachedState={position:i.position,size:e.size,zIndex:(null==t?void 0:t.zIndex)??1e3,isDragging:i.isDragging,isResizing:e.isResizing,hasBeenDragged:i.hasBeenDragged,hasBeenResized:e.hasBeenResized,isMinimizing:r,isRestoring:d,isOpening:l,isClosing:h,isAnyAnimating:c,animationTransform:n.transform,isVisible:o,showCentered:y,isAwaitingRestore:f,isAwaitingChildOpen:p,isVisibleByAnimation:w,hasChild:s,isChildModal:a,showOverlay:s||this.overlayClosing,isTransparent:(null==t?void 0:t.isTransparent)??!1,isAttentionAnimating:this.stateManager.isAttentionAnimating,glowStabilizing:this.stateManager.glowStabilizing,isAnimatingPosition:(null==t?void 0:t.isAnimatingPosition)??!1,isAnimatingToCenter:this.stateManager.isAnimatingToCenter,wasRestored:this.stateManager.wasRestored,overlayClosing:this.overlayClosing,glowEnabled:I,draggable:v,resizable:x,minimizable:b,dataState:z,dataAnimationPhase:n.isAnimating?"animate":"idle",style:C,cssClasses:P},this.cachedState}subscribe(t){return this.emitter.on("stateChange",t)}notifyStateChange(){this.cachedState=null,this.emitter.emit("stateChange",this.getState())}startDrag(t){this.interactions.startDrag(t)}startResize(t,i){this.interactions.startResize(t,i)}handlePointerMove(t){this.interactions.handlePointerMove(t)}handlePointerUp(t){this.interactions.handlePointerUp(t)}handleKeyDown(t){this.interactions.handleKeyDown(t)}handleTabKey(t){this.interactions.handleTabKey(t)}minimize(){this.options.configHelper.isFeatureEnabled("minimize")&&ii(this.id)}close(){var t,i;Bi(this.id)&&Si(this.id),yi(this.id),null==(i=(t=this.options).onClose)||i.call(t)}toggleTransparency(){di(this.id)}bringToFront(){rt(this.id)}setOpenSourcePosition(t){this.animation.setPendingOpenSource(t)}updateGlow(t){this.options.glow!==t&&(this.options.glow=t,Yt(this.id,{glow:t??null}),this.notifyStateChange())}focusFirst(){this.interactions.focusFirst()}handleResizeEnd(t,i){const e=Bt(this.id);if(null==e?void 0:e.parentId){const n=Bt(e.parentId),o=bt(e.parentId);if(n&&o){const e=n.position??{x:o.getBoundingClientRect().left,y:o.getBoundingClientRect().top},s=n.size??{width:o.offsetWidth,height:o.offsetHeight},a={x:e.x+(s.width-i.width)/2,y:e.y+(s.height-i.height)/2},r=t;this.stateManager.isAnimatingToCenter=!0,this.drag.setPosition(a);const d={x:a.x-e.x,y:a.y-e.y};Yt(this.id,{position:a,size:i,hasBeenDragged:!0,offsetFromParent:d});const l=this.lifecycle.getElement();return void(l?Rt(l,r,a,{duration:Ct.centerAfterResize,onComplete:()=>{this.stateManager.isAnimatingToCenter=!1}}):this.stateManager.isAnimatingToCenter=!1)}}Yt(this.id,{position:t,size:i,hasBeenDragged:!0})}handleStateChange(){const t=Bt(this.id);if(t){if((t.parentId||Li(this.id))&&(this.stateManager.wasRestored=!0),!this.drag.isDragging()&&!this.resize.isResizing()&&t.position){const i=this.drag.getPosition(),e=t.position;(Math.abs(i.x-e.x)>.5||Math.abs(i.y-e.y)>.5)&&(this.drag.setPosition(e),t.hasBeenDragged&&this.drag.setHasBeenDragged(!0))}this.stateManager.handlePendingStates()}}handlePendingStates(){this.stateManager.handlePendingStates()}getId(){return this.id}getDataId(){return this.dataId}getElement(){return this.element}}function xn(t){return new vn(t)}export{pn as $,ee as A,He as B,xe as C,Ie as D,Ee as E,ke as F,Ht as G,hi as H,Te as I,Le as J,_e as K,We as L,vn as M,me as N,te as O,Ut as P,ne as Q,Ce as R,Zt as S,Me as T,Se as U,ve as V,be as W,Ae as X,Ct as Y,Mt as Z,yn as _,he as a,Fe as a$,wn as a0,zn as a1,et as a2,it as a3,ie as a4,Jt as a5,qt as a6,J as a7,Je as a8,Zi as a9,Pi as aA,Ai as aB,Gi as aC,qi as aD,Hi as aE,Ne as aF,un as aG,ye as aH,Ge as aI,oe as aJ,je as aK,wi as aL,xn as aM,$e as aN,ae as aO,mi as aP,ai as aQ,vi as aR,en as aS,tn as aT,an as aU,Rt as aV,Xe as aW,qe as aX,sn as aY,cn as aZ,on as a_,Ue as aa,vt as ab,ft as ac,rn as ad,Ke as ae,ln as af,ut as ag,Ze as ah,dn as ai,mt as aj,Wi as ak,Qt as al,$t as am,zi as an,wt as ao,fn as ap,mn as aq,gt as ar,ct as as,Yi as at,Fi as au,Ti as av,Ri as aw,Si as ax,Ii as ay,Xi as az,ge as b,Oe as b0,Ft as b1,gn as b2,Ot as b3,At as b4,kt as b5,pt as b6,Ve as b7,Qe as b8,Wt as b9,O as bA,Et as bB,W as bC,E as bD,De as bE,nn as bF,ui as bG,$i as bH,di as bI,hn as bJ,Ye as bK,Ki as bL,Xt as bM,ci as bN,si as bO,Yt as bP,Gt as bQ,Vt as bR,Re as bS,It as bT,xi as ba,Lt as bb,_t as bc,Vi as bd,Ui as be,ji as bf,jt as bg,Oi as bh,Ei as bi,Bi as bj,Ci as bk,_i as bl,Li as bm,Di as bn,ri as bo,we as bp,dt as bq,Ni as br,pe as bs,se as bt,Be as bu,lt as bv,fe as bw,gi as bx,ni as by,oi as bz,yi as c,pi as d,Bt as e,St as f,U as g,rt as h,Dt as i,Tt as j,ue as k,ze as l,ii as m,Pe as n,fi as o,xt as p,ot as q,ei as r,Z as s,li as t,nt as u,st as v,Mi as w,ki as x,bi as y,bt as z};
|
package/dist/react.d.ts
CHANGED
|
@@ -8,5 +8,5 @@ export { ModalProvider } from './react/components/ModalProvider';
|
|
|
8
8
|
export type { ModalProviderProps } from './react/components/ModalProvider';
|
|
9
9
|
export { Dock } from './react/components/dock/Dock';
|
|
10
10
|
export type { DockProps } from './react/components/dock/Dock';
|
|
11
|
-
export { useModal, useModals } from './react/useModal';
|
|
11
|
+
export { useModal, useModals } from './react/hooks/useModal';
|
|
12
12
|
//# sourceMappingURL=react.d.ts.map
|
package/dist/runtime.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var t=Object.defineProperty,i=(i,e,n)=>((i,e,n)=>e in i?t(i,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):i[e]=n)(i,"symbol"!=typeof e?e+"":e,n);const e=Symbol.for("epic-modals-core");if("undefined"!=typeof globalThis){const t=globalThis;t[e],t[e]=!0}const n=new Map;let o=null;function s(t){o=t}let a=null;function r(t){a=t}const d=new Set;let l=!1,h=[],c=[],g=[],u=[],m=[],p=[],f=[],w=[],v=[],y=null;function z(t){y=t}const x=new Map;let P=null;function I(t){P=t}const M=new Map,b=new Set,C=new Set,A=new Set;let B=[];function D(t){B=t}function S(t){h=t}function H(t){c=t}function R(t){g=t}function k(t){u=t}function E(t){m=t}function T(t){p=t}function W(t){f=t}function F(t){w=t}function O(){!function(){if(!l){l=!0;try{d.forEach(t=>t())}finally{l=!1}}}()}function L(t){return d.add(t),()=>d.delete(t)}function _(t,i){return!!n.get(t)||(function(){var t,i;try{const e=import.meta;return!0===(null==(t=e.env)?void 0:t.DEV)||"development"===(null==(i=e.env)?void 0:i.MODE)}catch{return!1}}(),!1)}function G(t){return"boolean"==typeof t?{visible:t,blockClicks:t}:t}let $={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,easing:"cubic-bezier(0.34, 1.56, 0.64, 1)"},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"},V=0;const Y=new Set;function X(){return V}function q(){return $}function K(t){const i=$;$=j($,t),V++,Y.forEach(t=>t()),i.features.dock&&!$.features.dock&&Ft()}function j(t,i){var e;return{features:{...t.features,...i.features},dock:{...t.dock,...i.dock},animations:{...t.animations,...i.animations},appearance:{...t.appearance,...i.appearance},zIndex:{...t.zIndex,...i.zIndex},parentChild:{...t.parentChild,...i.parentChild},positioning:{...t.positioning,...i.positioning,avoidElements:(null==(e=i.positioning)?void 0:e.avoidElements)??t.positioning.avoidElements},portalTarget:i.portalTarget??t.portalTarget}}function N(t,i){const e=q(),n=i?j(e,i):e;return{isFeatureEnabled:i=>{var e;if(void 0!==(null==(e=null==t?void 0:t.features)?void 0:e[i])){const e=t.features[i];if("backdrop"===i){const t=G(e);return t.visible||t.blockClicks}return e}const o=n.features[i];if("backdrop"===i){const t=G(o);return t.visible||t.blockClicks}return o},getAppearance:i=>{var e;return void 0!==(null==(e=null==t?void 0:t.appearance)?void 0:e[i])?t.appearance[i]:n.appearance[i]},getPositioning:i=>{var e;return void 0!==(null==(e=null==t?void 0:t.positioning)?void 0:e[i])?t.positioning[i]:n.positioning[i]},getEffectiveConfig:()=>n}}function U(t){const{getModalConfig:i,getProviderConfig:e}=t;return{getEffectiveConfig:function(){const t=q(),n=e(),o=i();let s=t;return n&&(s=j(s,n)),o&&(s={...s,features:{...s.features,...o.features},appearance:{...s.appearance,...o.appearance},animations:{...s.animations,...o.animations},positioning:{...s.positioning,...o.positioning},parentChild:{...s.parentChild,...o.parentChild}}),s},isFeatureEnabled:function(t){var n,o;const s=i(),a=e(),r=i=>{if(void 0!==i){if("backdrop"===t&&"object"==typeof i){const t=G(i);return t.visible||t.blockClicks}return i}},d=r(null==(n=null==s?void 0:s.features)?void 0:n[t]);if(void 0!==d)return d;const l=r(null==(o=null==a?void 0:a.features)?void 0:o[t]);return void 0!==l?l:r(q().features[t])??!1},getAppearance:function(t){var n,o;const s=i(),a=e();return void 0!==(null==(n=null==s?void 0:s.appearance)?void 0:n[t])?s.appearance[t]:void 0!==(null==(o=null==a?void 0:a.appearance)?void 0:o[t])?a.appearance[t]:q().appearance[t]},getAnimation:function(t){var n,o;const s=i(),a=e();return void 0!==(null==(n=null==s?void 0:s.animations)?void 0:n[t])?s.animations[t]:void 0!==(null==(o=null==a?void 0:a.animations)?void 0:o[t])?a.animations[t]:q().animations[t]},getPositioning:function(t){var n,o;const s=i(),a=e();return void 0!==(null==(n=null==s?void 0:s.positioning)?void 0:n[t])?s.positioning[t]:void 0!==(null==(o=null==a?void 0:a.positioning)?void 0:o[t])?a.positioning[t]:q().positioning[t]},getParentChild:function(t){var n,o;const s=i(),a=e();return void 0!==(null==(n=null==s?void 0:s.parentChild)?void 0:n[t])?s.parentChild[t]:void 0!==(null==(o=null==a?void 0:a.parentChild)?void 0:o[t])?a.parentChild[t]:q().parentChild[t]}}}function J(t){return{id:t.id,title:t.title,icon:t.icon??"",isOpen:t.autoOpen??!1,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}}function Q(t){const i=n.get(t.id);let e;e=(null==i?void 0:i.zIndex)?i.zIndex:Math.max(...Array.from(n.values()).map(t=>t.zIndex),q().zIndex.base-2)+2;const o=c.includes(t.id),s=t.isOpen||o;i?n.set(t.id,{...i,title:t.title,icon:t.icon,glow:t.glow,zIndex:e}):n.set(t.id,{...t,isOpen:s,zIndex:e,isAnimating:!1}),O(),t.isMinimized&&!B.includes(t.id)&&D([...B,t.id])}function Z(t){const i=n.get(t);if(i){if(D(B.filter(i=>i!==t)),H(c.filter(i=>i!==t)),R(g.filter(i=>i!==t)),k(u.filter(i=>i!==t)),S(h.filter(i=>i!==t)),E(m.filter(i=>i!==t)),T(p.filter(i=>i!==t)),W(f.filter(i=>i!==t)),F(w.filter(i=>i!==t)),i.childId){const t=n.get(i.childId);t&&n.set(i.childId,{...t,parentId:void 0})}if(i.parentId){const t=n.get(i.parentId);t&&n.set(i.parentId,{...t,childId:void 0,lastChildId:i.id})}n.delete(t),O(),A.delete(t),b.delete(t)}}function tt(t,i){const e=n.get(t);if(!(null==e?void 0:e.childId))return;const o=n.get(e.childId);if(!o)return;const s=i+2;n.set(e.childId,{...o,zIndex:s}),tt(e.childId,s)}function it(t){if(!n.get(t))return;const i=Math.max(...Array.from(n.values()).map(t=>t.zIndex),0),e=function(t){let i=t,e=n.get(i);for(;null==e?void 0:e.parentId;)i=e.parentId,e=n.get(i);return i}(t),o=n.get(e);if(!o)return;const s=i+2;n.set(e,{...o,zIndex:s}),tt(e,s),O()}function et(t){const i=n.get(t);if(!i)return!1;const e=Math.max(...Array.from(n.values()).map(t=>t.zIndex),0);return i.zIndex===e&&!i.isMinimized&&!i.isHiddenWithParent}function nt(t,i){if(Array.isArray(t))D(t);else if("number"==typeof i){const e=t,n=[...B],[o]=n.splice(e,1);n.splice(i,0,o),D(n)}}const ot=8;function st(t,i,e,n,o={}){const{margin:s=ot,allowPartialVisibility:a=!1}=o,r="undefined"!=typeof window?window.innerWidth:1920,d="undefined"!=typeof window?window.innerHeight:1080;let l,h,c,g;return a&&e>r-2*s?(l=40-e,h=r-40):(l=s,h=Math.max(s,r-e-s)),a&&n>d-2*s?(c=40-n,g=d-40):(c=s,g=Math.max(s,d-n-s)),{x:Math.max(l,Math.min(h,t)),y:Math.max(c,Math.min(g,i))}}function at(t,i,e,n,o={}){const{margin:s=ot}=o,a=("undefined"!=typeof window?window.innerWidth:1920)-2*s,r=("undefined"!=typeof window?window.innerHeight:1080)-2*s,d=Math.min(e,a),l=Math.min(n,r),h=st(t,i,d,l,o);return{x:h.x,y:h.y,width:d,height:l}}function rt(t,i){return Math.max(0,Math.min(t.x+t.width,i.x+i.width)-Math.max(t.x,i.x))*Math.max(0,Math.min(t.y+t.height,i.y+i.height)-Math.max(t.y,i.y))}function dt(t,i,e,n,o,s){const a={x:t-s,y:i-s,width:e+2*s,height:n+2*s};let r=0;for(const t of o)r+=rt(a,t);return r}function lt(t){if("undefined"==typeof document)return[];const i=[];for(const e of t)try{const t=document.querySelectorAll(e);for(const e of t){const t=e.getBoundingClientRect();t.width>0&&t.height>0&&i.push({x:t.left,y:t.top,width:t.width,height:t.height})}}catch{}return i}function ht(t,i,e,n){const o=t-i,s=e-1;if(o<=0)return{interGap:0,edgeGap:0};if(e<=1)return{interGap:0,edgeGap:o/2};const a=o/(e+1);if(a>=n)return{interGap:a,edgeGap:a};const r=s*n;return o>=r?{interGap:n,edgeGap:(o-r)/2}:{interGap:o/s,edgeGap:0}}function ct(t,i,e,n,o=0){if(0===e.length)return{cols:t,rows:i,score:1/0,positions:new Map};const s=new Array(t).fill(0),a=new Array(i).fill(0);for(let i=0;i<e.length;i++){const n=i%t,o=Math.floor(i/t);s[n]=Math.max(s[n],e[i].width),a[o]=Math.max(a[o],e[i].height)}const r=s.reduce((t,i)=>t+i,0),d=a.reduce((t,i)=>t+i,0);if(r>n.width||d>n.height)return null;const{interGap:l,edgeGap:h}=ht(n.width,r,t,o),{interGap:c,edgeGap:g}=ht(n.height,d,i,o),u=new Map,m=[0];for(let i=0;i<t;i++)m.push(m[i]+s[i]);const p=[0];for(let t=0;t<i;t++)p.push(p[t]+a[t]);for(let i=0;i<e.length;i++){const o=i%t,r=Math.floor(i/t),d=e[i],f=n.x+h+o*l+m[o],w=n.y+g+r*c+p[r],v=f+(s[o]-d.width)/2,y=w+(a[r]-d.height)/2;u.set(d.id,{x:Math.round(v),y:Math.round(y)})}const f=t>1?l:h,w=i>1?c:g;return{cols:t,rows:i,score:(.6*Math.min(f,w)+.4*Math.sqrt(f*w))*(n.width>n.height==t>=i?1.02:1),positions:u}}function gt(t,i,e={}){const{modalGap:n=16,viewportMargin:o=16,avoidBounds:s=[],avoidMargin:a=24}=e,r="undefined"!=typeof window?window.innerWidth:1920,d="undefined"!=typeof window?window.innerHeight:1080,l=new Map,h=t.filter(t=>!t.parentId),c=h.map(t=>({id:t.id,width:t.width,height:t.height}));if(i&&c.push({id:i.id,width:i.width,height:i.height}),0===c.length)return{positions:l};const g=new Map(h.map(t=>[t.id,t.currentPosition]));c.sort((t,i)=>{const e=g.get(t.id),n=g.get(i.id);return(e?e.x+t.width/2:1/0)-(n?n.x+i.width/2:1/0)});const u=function(t,i,e,n,o){let s=e,a=e,r=t-e,d=i-e;for(const e of n){const n=e.y,l=i-(e.y+e.height),h=e.x,c=t-(e.x+e.width);let g;if(e.width>e.height)g=n<=l?"top":"bottom";else if(e.height>e.width)g=h<=c?"left":"right";else{const t=Math.min(n,l,h,c);g=t===n?"top":t===l?"bottom":t===h?"left":"right"}"bottom"===g?d=Math.min(d,e.y-o):"top"===g?a=Math.max(a,e.y+e.height+o):"left"===g?s=Math.max(s,e.x+e.width+o):r=Math.min(r,e.x-o)}return{x:s,y:a,width:Math.max(0,r-s),height:Math.max(0,d-a)}}(r,d,o,s,a);if(1===c.length){const t=c[0],i=u.x+(u.width-t.width)/2,e=u.y+(u.height-t.height)/2;return l.set(t.id,{x:Math.round(i),y:Math.round(e)}),{positions:l}}const m=c.length;let p=null;for(let t=1;t<=m;t++){const i=ct(t,Math.ceil(m/t),c,u,n);i&&(null===p||i.score>p.score)&&(p=i)}if(p){for(const[t,i]of p.positions)l.set(t,i);return{positions:l}}if(i){const t=h.map(t=>({x:t.currentPosition.x,y:t.currentPosition.y,width:t.width,height:t.height})),e=function(t,i,e,n,o=20){const s=n.x+(n.width-t)/2,a=n.y+(n.height-i)/2;if(0===e.length)return{x:Math.round(s),y:Math.round(a)};const r=n.x,d=Math.max(n.x,n.x+n.width-t),l=n.y,h=Math.max(n.y,n.y+n.height-i);if(d<=r||h<=l)return{x:Math.round(s),y:Math.round(a)};const c=(d-r)/o,g=(h-l)/o;let u={x:s,y:a},m=1/0;const p=t*i,f=Math.hypot(n.width/2,n.height/2),w=n.x+n.width/2,v=n.y+n.height/2;for(let n=0;n<=o;n++)for(let s=0;s<=o;s++){const o=r+n*c,a=l+s*g,d=dt(o,a,t,i,e,0),h=p>0?d/p:0,y=Math.hypot(o+t/2-w,a+i/2-v),z=.5*h+.5*(f>0?y/f:0);z<m&&(m=z,u={x:o,y:a})}return{x:Math.round(u.x),y:Math.round(u.y)}}(i.width,i.height,t,u);return l.set(i.id,e),{positions:l}}const f=function(t,i){const e=new Map,n=Math.max(...t.map(t=>t.width)),o=Math.max(...t.map(t=>t.height)),s=n+40*(t.length-1),a=o+40*(t.length-1);let r=i.x+(i.width-s)/2,d=i.y+(i.height-a)/2;r=Math.max(i.x,r),d=Math.max(i.y,d);for(let i=0;i<t.length;i++)e.set(t[i].id,{x:Math.round(r+40*i),y:Math.round(d+40*i)});return e}(c,u);return{positions:f}}function ut(t){return t}function mt(t){return"undefined"==typeof document?null:document.querySelector(`.modal-dialog[data-modal-id="${t}"]`)}function pt(t,i,e,n){var o;const s=i.x-e.x,a=i.y-e.y;if(0===s&&0===a)return null==(o=null==n?void 0:n.onComplete)||o.call(n),()=>{};const r=(null==n?void 0:n.duration)??300,d=(null==n?void 0:n.easing)??"ease-out";let l=!1;function h(){var t;l||(l=!0,clearTimeout(g),null==(t=null==n?void 0:n.onComplete)||t.call(n))}t.style.left=`${e.x}px`,t.style.top=`${e.y}px`;const c=t.animate([{transform:`translate(${s}px, ${a}px)`},{transform:"translate(0, 0)"}],{duration:r,easing:d,fill:"none"});c.onfinish=h;const g=setTimeout(h,r+100);return function(){l||(l=!0,clearTimeout(g),c.cancel())}}function ft(t){return n.get(t)}function wt(t){const i=n.get(t);return(null==i?void 0:i.isOpen)??!1}function vt(t){return n.has(t)}function yt(t){return b.has(t)}function zt(){return n}function xt(){return B}function Pt(){const t=[];for(const i of n.values()){if(!i.isOpen||i.isMinimized||i.isHiddenWithParent)continue;if(C.has(i.id))continue;const e=mt(i.id);if(!e)continue;const n=i.position??{x:e.getBoundingClientRect().left,y:e.getBoundingClientRect().top},o=i.size??{width:e.offsetWidth,height:e.offsetHeight};t.push({id:i.id,width:o.width,height:o.height,currentPosition:n,parentId:i.parentId})}return t}function It(t,i,e){if(!_(t))return;!function(t){if(!Number.isFinite(t.x)||!Number.isFinite(t.y))throw new Error(`[epic-modals] Invalid position in updateModalPosition: x=${t.x}, y=${t.y}`)}(i),(null==e?void 0:e.size)&&function(t){if(t.width<=0||t.height<=0)throw new Error(`[epic-modals] Invalid dimensions in updateModalPosition: width=${t.width}, height=${t.height}`)}(e.size);const o=n.get(t);if(!o)return;let s=i;if((null==e?void 0:e.constrain)&&o.size&&(s=st(i.x,i.y,o.size.width,o.size.height)),n.set(t,{...o,position:s,size:(null==e?void 0:e.size)??o.size,hasBeenDragged:o.hasBeenDragged||(null==e?void 0:e.drag)||!1}),o.childId){let i=t,e=s;for(;;){const t=n.get(i);if(!(null==t?void 0:t.childId))break;const o=n.get(t.childId);if(!(null==o?void 0:o.offsetFromParent))break;const s={x:e.x+o.offsetFromParent.x,y:e.y+o.offsetFromParent.y};n.set(t.childId,{...o,position:s,hasBeenDragged:!0}),i=t.childId,e=s}}if(o.parentId&&o.offsetFromParent){const i=q();let a=t,r=o;for(;r.parentId&&r.offsetFromParent;){const o=n.get(r.parentId);if(!o)break;const d=a===t?s:n.get(a).position,l={x:d.x-r.offsetFromParent.x,y:d.y-r.offsetFromParent.y};if("animated"===i.parentChild.movementMode&&!(null==e?void 0:e.realtime)){M.set(r.parentId,l);break}n.set(r.parentId,{...o,position:l,hasBeenDragged:!0}),a=r.parentId,r=o}}O()}function Mt(t){const i=n.get(t);if(!i)return;if(!i.isAnimatingPosition)return;i.isAnimatingPosition=!1;let e=i.childId;for(;e;){const t=n.get(e);t&&(t.isAnimatingPosition=!1),e=null==t?void 0:t.childId}O()}function bt(t,i){const e=n.get(t);e&&(n.set(t,{...e,...i}),O())}function Ct(t){const i=q();"smart"===i.positioning.strategy&&(o&&clearTimeout(o),s(setTimeout(()=>{const e=Pt(),n=lt(i.positioning.avoidElements);At(gt(e,t,{modalGap:i.positioning.modalGap,viewportMargin:i.positioning.modalGap,avoidBounds:n,avoidMargin:i.positioning.modalGap}).positions),s(null)},50)))}function At(t){if(0===t.size)return;const i=[];for(const[e,o]of t){const t=n.get(e);if(!t)continue;const s=mt(e),a=t.position??(s?{x:s.getBoundingClientRect().left,y:s.getBoundingClientRect().top}:{x:0,y:0}),r=t.size??(s?{width:s.offsetWidth,height:s.offsetHeight}:{width:0,height:0});i.push({id:e,element:s,oldPosition:a,newPosition:o,size:r}),Bt(e,a,o,i)}for(const{id:t,newPosition:e,size:o}of i){const i=n.get(t);i&&n.set(t,{...i,position:e,size:o,hasBeenDragged:!0,isAnimatingPosition:!0})}O();for(const{id:t,element:e,oldPosition:n,newPosition:o}of i)e?pt(e,n,o,{duration:300,onComplete:()=>Mt(t)}):setTimeout(()=>Mt(t),400)}function Bt(t,i,e,o){const s=n.get(t);if(!(null==s?void 0:s.childId))return;const a=n.get(s.childId);if(!(null==a?void 0:a.offsetFromParent))return;const r=mt(s.childId),d={x:i.x+a.offsetFromParent.x,y:i.y+a.offsetFromParent.y},l={x:e.x+a.offsetFromParent.x,y:e.y+a.offsetFromParent.y};o.push({id:s.childId,element:r,oldPosition:d,newPosition:l}),n.set(s.childId,{...a,position:l,hasBeenDragged:!0,isAnimatingPosition:!0}),a.childId&&Bt(s.childId,d,l,o)}function Dt(){a&&clearTimeout(a),r(setTimeout(()=>{Ct(null),r(null)},100))}let St=!1;function Ht(){St||"undefined"==typeof window||(window.addEventListener("resize",Dt),St=!0)}function Rt(){"undefined"!=typeof window&&(window.removeEventListener("resize",Dt),St=!1)}function kt(t){M.delete(t)}function Et(t){const i=n.get(t);if(!(null==i?void 0:i.childId))return;const e=n.get(i.childId);e&&(f.includes(i.childId)||W([...f,i.childId]),e.childId&&Et(i.childId))}function Tt(t){const i=n.get(t);if(!i||i.isMinimized)return;if(kt(t),i.parentId){const t=n.get(i.parentId);if(t&&!t.isMinimized)return void Tt(i.parentId)}S([...h,t]),i.position&&i.size;const e=i.childId;n.set(t,{...i,isMinimized:!0,lastChildId:e}),B.includes(t)||D([...B,t]),O(),i.childId&&Et(t),Ct(null)}function Wt(t){const i=n.get(t);if(!i||!i.isMinimized)return;n.set(t,{...i,isMinimized:!1,isOpen:!0}),E([...m,t]),it(t);const e=i.lastChildId||i.childId;e&&Ot(e),O()}function Ft(){Array.from(n.values()).filter(t=>t.isMinimized).map(t=>t.id).forEach(t=>{const i=n.get(t);if(i){n.set(t,{...i,isMinimized:!1,isOpen:!0}),E([...m,t]),it(t);const e=i.lastChildId||i.childId;e&&Ot(e)}}),D([]),O()}function Ot(t){const i=n.get(t);if(i&&i.isHiddenWithParent){T([...p,t]);const e=i.lastChildId||i.childId;e&&Ot(e)}}function Lt(t){if(!_(t))return;const i=n.get(t);A.has(t)?(A.delete(t),n.set(t,{...i,isTransparent:!1})):(A.add(t),n.set(t,{...i,isTransparent:!0})),O()}function _t(t){_(t)&&(w.includes(t)||(F([...w,t]),O()))}function Gt(t){t.classList.add("modal-shake"),t.addEventListener("animationend",()=>{t.classList.remove("modal-shake")},{once:!0})}function $t(t){if(!_(t))return;const i=n.get(t);A.delete(t),n.set(t,{...i,isTransparent:!1}),O()}function Vt(t,i,e){Yt(t,e,{parentId:i})}function Yt(t,i,e){const o=q(),s=n.get(t);if(s&&s.isOpen&&!s.isMinimized&&!s.isHiddenWithParent)return _t(t),void it(t);if(s&&s.isMinimized)return void Wt(t);if("x"in i&&"y"in i)x.set(t,i);else{const e=i.getBoundingClientRect();x.set(t,{x:e.left+e.width/2,y:e.top+e.height/2})}if((null==e?void 0:e.parentId)&&o.features.parentChild){const i=n.get(e.parentId);(null==i?void 0:i.childId)&&i.childId!==t&&Xt(i.childId,!0),I({parentId:e.parentId,childId:t})}if(c.includes(t)||H([...c,t]),O(),!s)return;const a={isOpen:!0};(null==e?void 0:e.parentId)&&o.features.parentChild&&(a.parentId=e.parentId),n.set(t,{...s,...a}),it(t)}function Xt(t,i=!1){const e=n.get(t);if(e&&(e.isOpen||e.isMinimized)){if(kt(t),e.childId&&Xt(e.childId,i),e.isMinimized)return D(B.filter(i=>i!==t)),void Kt(t);C.add(t),i?k([...u,t]):R([...g,t]),e.parentId||Ct(null),O()}}function qt(t){const i=new Set(t??[]);Array.from(n.keys()).filter(t=>!i.has(t)).forEach(t=>Xt(t,!0))}function Kt(t){const i=n.get(t);if(i){if(C.delete(t),i.parentId){const e=n.get(i.parentId);e&&e.childId===t&&n.set(i.parentId,{...e,childId:void 0,lastChildId:t})}n.set(t,{...i,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 jt(t){return h.includes(t)}function Nt(t){return f.includes(t)}function Ut(t){return g.includes(t)}function Jt(t){return u.includes(t)}function Qt(t){k(u.filter(i=>i!==t))}function Zt(t){return m.includes(t)}function ti(t){return p.includes(t)}function ii(t){return(null==P?void 0:P.childId)===t}function ei(){return P}function ni(t){if("animated"!==q().parentChild.movementMode)return;const i=n.get(t);if(!(null==i?void 0:i.parentId)||!i.offsetFromParent||!i.position)return;const e={x:i.position.x-i.offsetFromParent.x,y:i.position.y-i.offsetFromParent.y};M.set(i.parentId,e),O()}const oi={BASE:0,DROPDOWN:100,STICKY:200,OVERLAY:300,MODAL:400,DOCK:8e3,TOAST:9e3};function si(){q().zIndex.base}function ai(t){const i=q();return"MODAL"===t?i.zIndex.base:"DOCK"===t?i.zIndex.dock:"TOAST"===t?i.zIndex.toast:oi[t]}function ri(){q().zIndex.base}function di(){const t=new Map;return{on(i,e){let n=t.get(i);return n||(n=new Set,t.set(i,n)),n.add(e),()=>{null==n||n.delete(e),0===(null==n?void 0:n.size)&&t.delete(i)}},emit(i,e){const n=t.get(i);n&&n.forEach(t=>t(e))},off(i){i?t.delete(i):t.clear()},listenerCount(i){var e;return(null==(e=t.get(i))?void 0:e.size)??0}}}const li={modal:"modal-dialog",header:"modal-header",headerDraggable:"modal-header-draggable",body:"modal-body",footer:"modal-footer",childOverlay:"modal-child-overlay",overlayClosing:"modal-overlay-closing",headerTitle:"modal-header-title",headerIcon:"modal-header-icon",headerTitleGroup:"modal-header-title-group",headerActions:"modal-header-actions",headerTrafficLights:"modal-header-traffic-lights",headerLight:"modal-header-light",headerLightClose:"modal-header-light-close",headerLightMinimize:"modal-header-light-minimize",headerLightStyle:"modal-header-light-style",headerLightDisabled:"modal-header-light-disabled",headerMacCenter:"modal-header-mac-center",headerMacSpacer:"modal-header-mac-spacer",headerBtnWindows:"modal-header-btn-windows",headerBtnWindowsClose:"modal-header-btn-windows-close",headerBtnWindowsStyle:"modal-header-btn-windows-style",headerBtnWindowsDisabled:"modal-header-btn-windows-disabled",resizeHandles:"modal-resize-handles",resizeHandle:"modal-resize-handle",resizePrefix:"modal-resize-",dock:"modal-dock",dockItem:"modal-dock-item",dockItemHasGlow:"modal-dock-item-has-glow",dockItemHasChild:"modal-dock-item-has-child",dockItemLabelBeside:"modal-dock-item-label-beside",dockItemLabelBelow:"modal-dock-item-label-below",dockItemIcon:"modal-dock-item-icon",dockItemIconPlaceholder:"modal-dock-item-icon-placeholder",dockItemLabel:"modal-dock-item-label",dockItemGlow:"modal-dock-item-glow",dockChildIndicator:"modal-dock-child-indicator",dockHandle:"modal-dock-handle",dockHandleDragging:"modal-dock-handle-dragging",backdrop:"modal-backdrop",backdropVisible:"modal-backdrop-visible"},hi={dialog:li.modal,header:li.header,headerDraggable:li.headerDraggable,body:li.body,footer:li.footer,headerTitle:li.headerTitle,headerIcon:li.headerIcon,headerTitleGroup:li.headerTitleGroup,headerActions:li.headerActions,headerTrafficLights:li.headerTrafficLights,headerLight:li.headerLight,headerLightClose:li.headerLightClose,headerLightMinimize:li.headerLightMinimize,headerLightStyle:li.headerLightStyle,headerLightDisabled:li.headerLightDisabled,headerMacCenter:li.headerMacCenter,headerMacSpacer:li.headerMacSpacer,headerBtnWindows:li.headerBtnWindows,headerBtnWindowsClose:li.headerBtnWindowsClose,headerBtnWindowsStyle:li.headerBtnWindowsStyle,headerBtnWindowsDisabled:li.headerBtnWindowsDisabled,resizeHandles:li.resizeHandles,resizeHandle:li.resizeHandle,resizePrefix:li.resizePrefix,dock:li.dock,dockItem:li.dockItem,dockItemHasGlow:li.dockItemHasGlow,dockItemHasChild:li.dockItemHasChild,dockItemLabelBeside:li.dockItemLabelBeside,dockItemLabelBelow:li.dockItemLabelBelow,dockItemIcon:li.dockItemIcon,dockItemIconPlaceholder:li.dockItemIconPlaceholder,dockItemLabel:li.dockItemLabel,dockItemGlow:li.dockItemGlow,dockChildIndicator:li.dockChildIndicator,dockHandle:li.dockHandle,backdrop:li.backdrop,backdropVisible:li.backdropVisible},ci={modalId:"data-modal-id",resizeDirection:"data-direction"},gi=["n","s","e","w","ne","nw","se","sw"],ui={n:"Resize north",s:"Resize south",e:"Resize east",w:"Resize west",ne:"Resize northeast",nw:"Resize northwest",se:"Resize southeast",sw:"Resize southwest"},mi={minWidth:280,minHeight:200},pi=["button:not([disabled])","[href]","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(", ");class fi{constructor(t={}){i(this,"element",null),i(this,"resizeHandler",null),i(this,"options"),this.options=t}mount(t){var i,e;this.element=t,this.options.onWindowResize&&(this.resizeHandler=this.options.onWindowResize,window.addEventListener("resize",this.resizeHandler)),null==(e=(i=this.options).onMount)||e.call(i)}destroy(){var t,i;this.resizeHandler&&(window.removeEventListener("resize",this.resizeHandler),this.resizeHandler=null),this.element=null,null==(i=(t=this.options).onDestroy)||i.call(t)}getElement(){return this.element}isMounted(){return null!==this.element}}function wi(t,i){const e=document.querySelector(`.modal-dock-item[data-modal-id="${t}"]`);if(e){const t=e.getBoundingClientRect();return{x:t.left+t.width/2,y:t.top+t.height/2}}const n=document.querySelector('[data-dock-container="true"]');if(n){const t=n.getBoundingClientRect();return{x:t.left+t.width/2,y:t.top+t.height/2}}return{x:"undefined"!=typeof window?window.innerWidth/2:0,y:"undefined"!=typeof window?window.innerHeight-40:0}}function vi(t,i){return function(t,i,e={}){const{timeout:n=5e3}=e;return new Promise((e,o)=>{const s=performance.now(),a=()=>{const r=t(),d=performance.now()-s;r&&i(r)?e(r):d>=n?o(new Error(`DOM not ready after ${n}ms`)):requestAnimationFrame(a)};a()})}(t,t=>t.offsetWidth>0&&t.offsetHeight>0,i)}class yi{constructor(t){i(this,"id"),i(this,"dataId"),i(this,"configHelper"),i(this,"getDragBehavior"),i(this,"getElement"),this.id=t.id,this.dataId=t.dataId,this.configHelper=t.configHelper,this.getDragBehavior=t.getDragBehavior,this.getElement=t.getElement}constrainToViewport(t){const i=this.getDragBehavior();i.hasBeenDragged()&&i.constrainToViewport(t)}shouldApplySmartPositioning(){return"smart"===this.configHelper.getPositioning("strategy")&&!this.getDragBehavior().hasBeenDragged()}applySmartPositioning(){if("smart"!==this.configHelper.getPositioning("strategy"))return!1;const t=ft(this.id),i=ei();if((null==t?void 0:t.parentId)||i&&i.childId===this.id)return!1;if((null==t?void 0:t.hasBeenDragged)||(null==t?void 0:t.position))return!1;const e=this.getElement()||mt(this.id);if(!e)return!1;const n=e.offsetWidth,o=e.offsetHeight;if(n<=0||o<=0)return!1;const s=this.configHelper.getPositioning("modalGap"),a=Pt().filter(t=>t.id!==this.id),r=lt(this.configHelper.getPositioning("avoidElements")),d=gt(a,{id:this.id,width:n,height:o},{modalGap:s,viewportMargin:s,avoidBounds:r,avoidMargin:s}),l=d.positions.get(this.id);if(!l)return!1;const h=new Map;for(const[t,i]of d.positions)t!==this.id&&h.set(t,i);h.size>0&&At(h);const c=this.getDragBehavior();return c.setPosition(l),c.setHasBeenDragged(!0),It(this.id,l,{size:{width:n,height:o}}),!0}scheduleSmartPositioning(){vi(()=>this.getElement()||mt(this.id)).then(()=>{this.applySmartPositioning()}).catch(()=>{this.applySmartPositioning()})}centerChildOnParent(t){var i,e;const o=ft(t);if(!o)return!1;const s=this.getElement()||mt(this.id),a=mt(t),r=null==a?void 0:a.getBoundingClientRect(),d=o.position??(r?{x:r.left,y:r.top}:null);if(!d||!s)return!1;const l=(null==(i=o.size)?void 0:i.width)??(null==a?void 0:a.offsetWidth)??(null==r?void 0:r.width)??480,h=(null==(e=o.size)?void 0:e.height)??(null==a?void 0:a.offsetHeight)??(null==r?void 0:r.height)??400,c=s.offsetWidth,g=s.offsetHeight;if(l<=0||h<=0||c<=0||g<=0)return!1;const u={x:d.x+(l-c)/2,y:d.y+(h-g)/2},m=this.getDragBehavior();m.setPosition(u),m.setHasBeenDragged(!0),It(this.id,u,{size:{width:c,height:g}}),o.position&&o.size||!r||It(t,{x:r.left,y:r.top},{size:{width:l,height:h}});const p={x:u.x-d.x,y:u.y-d.y};return function(t,i,e){const o=n.get(t),s=n.get(i);o&&s&&(n.set(t,{...o,childId:i}),n.set(i,{...s,parentId:t,offsetFromParent:e}),it(i),O())}(t,this.id,p),!0}scheduleCenterChildOnParent(t){vi(()=>this.getElement()).then(()=>{this.centerChildOnParent(t)}).catch(()=>{this.centerChildOnParent(t)})}}function zi(t){return Array.from(t.querySelectorAll(pi)).filter(t=>null!==t.offsetParent||"A"===t.tagName)}class xi{constructor(t){i(this,"options"),this.options=t}startDrag(t){const i=this.options.getElement();this.options.configHelper.isFeatureEnabled("drag")&&i&&this.options.getDragBehavior().onPointerDown(t,i)}startResize(t,i){const e=this.options.getState();this.options.configHelper.isFeatureEnabled("resize")&&!e.hasChild&&this.options.getResizeBehavior().startResize(t,i)}handlePointerMove(t){const i=this.options.getElement();if(!i)return;const e=this.options.getDragBehavior(),n=e.isDragging(),o=this.options.getResizeBehavior(),s=o.hasBeenResized()?o.getSize():{width:i.offsetWidth,height:i.offsetHeight};e.onPointerMove(t,s),n&&e.isDragging()&&this.options.onDragMove()}handlePointerUp(t){const i=this.options.getElement();if(!i)return;const e=this.options.getDragBehavior(),n=e.isDragging();e.onPointerUp(t,i),n&&!this.options.getResizeBehavior().justFinishedResizing()&&this.options.onDragEnd()}handleKeyDown(t){var i,e;this.options.closeOnEscape&&"Escape"===t.key&&this.options.isTopModal()&&(t.stopPropagation(),null==(e=(i=this.options).onClose)||e.call(i))}handleTabKey(t){const i=this.options.getElement();i&&function(t,i){if("Tab"!==t.key)return;const e=zi(i);if(0===e.length)return void t.preventDefault();const n=e[0],o=e[e.length-1],s=document.activeElement;t.shiftKey?s===n&&(o.focus(),t.preventDefault()):s===o&&(n.focus(),t.preventDefault())}(t,i)}focusFirst(){const t=this.options.getElement();t&&function(t){const i=zi(t);i.length>0&&i[0].focus()}(t)}}class Pi{constructor(t){i(this,"id"),i(this,"options"),i(this,"_isHandlingMinimize",!1),i(this,"_isAttentionAnimating",!1),i(this,"_wasRestored"),i(this,"_glowStabilizing",!1),i(this,"_restoreHold",!1),i(this,"_isAnimatingToCenter",!1),i(this,"_cancelParentAnimationCleanup",null),i(this,"_parentFlipInFlight",!1),i(this,"_deferredParentTarget",null),i(this,"_parentFlipStartTime",0),this.id=t.id,this.options=t,this._wasRestored=!1}handlePendingStates(){if(!ft(this.id))return;if(this.handlePendingForceClose())return;if(this.handlePendingMinimize(),this.handlePendingMinimizeWithParent(),this.handlePendingRestore(),this.handlePendingChildRestore(),this.handlePendingClose())return;const t=this.handlePendingParentLink(),i=this.handlePendingOpen(t);this.handlePendingAttention(),this.handlePendingParentAnimation(),this.handleChildCentering(t,i)}handlePendingForceClose(){var t,i;return!!Jt(this.id)&&(Qt(this.id),Kt(this.id),null==(i=(t=this.options.options).onClose)||i.call(t),!0)}handlePendingMinimize(){if(!jt(this.id)||this._isHandlingMinimize)return;this._isHandlingMinimize=!0,z(null);const t=this.options.getElement();if(t){const i=this.options.getDragBehavior(),e=this.options.getResizeBehavior(),n=t.getBoundingClientRect(),o=i.hasBeenDragged()?i.getPosition():{x:n.left,y:n.top},s=e.hasBeenResized()?e.getSize():{width:n.width,height:n.height};bt(this.id,{position:o,size:s,hasBeenDragged:!0})}this.options.getAnimationController().startMinimize(void 0,()=>{var t;t=this.id,S(h.filter(i=>i!==t)),z(null),this._isHandlingMinimize=!1})||(this._isHandlingMinimize=!1)}handlePendingMinimizeWithParent(){if(!Nt(this.id)||this._isHandlingMinimize)return;this._isHandlingMinimize=!0;const t=this.options.getElement();if(t){const i=this.options.getDragBehavior(),e=this.options.getResizeBehavior(),n=t.getBoundingClientRect(),o=i.hasBeenDragged()?i.getPosition():{x:n.left,y:n.top},s=e.hasBeenResized()?e.getSize():{width:n.width,height:n.height};bt(this.id,{position:o,size:s,hasBeenDragged:!0})}this.options.getAnimationController().startMinimize(void 0,()=>{var t;t=this.id,W(f.filter(i=>i!==t)),function(t){const i=n.get(t);i&&(n.set(t,{...i,isHiddenWithParent:!0}),O())}(this.id),this._isHandlingMinimize=!1})}handlePendingRestore(){if(!Zt(this.id))return;const t=ft(this.id),i=this.options.getAnimationController();var e;e=this.id,E(m.filter(t=>t!==e)),i.startRestore((null==t?void 0:t.position)??void 0,(null==t?void 0:t.size)??void 0),requestAnimationFrame(()=>{this.options.focusFirst()})}handlePendingChildRestore(){if(!ti(this.id))return;const t=ft(this.id),i=this.options.getAnimationController();var e;e=this.id,T(p.filter(t=>t!==e)),i.startRestore((null==t?void 0:t.position)??void 0,(null==t?void 0:t.size)??void 0),function(t){const i=n.get(t);i&&i.isHiddenWithParent&&(n.set(t,{...i,isHiddenWithParent:!1}),O())}(this.id),this._wasRestored=!0}handlePendingClose(){var t,i,e;return!!Ut(this.id)&&(e=this.id,R(g.filter(t=>t!==e)),this.options.getAnimationController().startClose(()=>{var t,i;$t(this.id),Kt(this.id),null==(i=(t=this.options.options).onClose)||i.call(t)})||($t(this.id),Kt(this.id),null==(i=(t=this.options.options).onClose)||i.call(t)),!0)}handlePendingParentLink(){const t=ei();return t&&t.childId===this.id&&(bt(this.id,{parentId:t.parentId}),this._wasRestored=!0),function(t){const i=P;return t&&(null==i?void 0:i.childId)!==t?null:(I(null),i)}(this.id)}handlePendingOpen(t){var i,e;if(e=this.id,!c.includes(e))return!1;!function(t){H(c.filter(i=>i!==t))}(this.id);const n=this.options.getDragBehavior(),o=this.options.getResizeBehavior();bt(this.id,{position:null,hasBeenDragged:!1,size:null}),n.setPosition({x:0,y:0}),n.setHasBeenDragged(!1),o.reset();const s=function(t){const i=x.get(t)??null;return x.delete(t),i}(this.id)||this.options.options.openSourcePosition||null,a=!!t||!!(null==(i=ft(this.id))?void 0:i.parentId);let r=!1;return s?(r=!0,this.options.getAnimationController().setPendingOpenSource(s),a&&t?this.openChildModalWithAnimation(t.parentId):this.openStandaloneModalWithAnimation()):a||this.options.getPositioning().scheduleSmartPositioning(),requestAnimationFrame(()=>{this.options.focusFirst()}),r}openChildModalWithAnimation(t){const i=this.options.getPositioning(),e=this.options.getAnimationController();vi(()=>this.options.getElement()).then(()=>{i.centerChildOnParent(t)&&(e.startOpen(),this._wasRestored=!0)}).catch(()=>{i.centerChildOnParent(t)&&(e.startOpen(),this._wasRestored=!0)})}openStandaloneModalWithAnimation(){const t=this.options.getPositioning(),i=this.options.getAnimationController();vi(()=>this.options.getElement()).then(()=>{t.applySmartPositioning(),i.startOpen()}).catch(()=>{t.applySmartPositioning(),i.startOpen()})}handlePendingAttention(){var t;t=this.id,w.includes(t)&&(function(t){var i;F(w.filter(i=>i!==t)),v.includes(t)||(i=[...v,t],v=i)}(this.id),this.id,this._isAttentionAnimating=!0,setTimeout(()=>{this._isAttentionAnimating=!1,this.id,this.options.onStateChange()},600))}handlePendingParentAnimation(){if(t=this.id,!M.has(t))return;var t;const i=function(t){const i=M.get(t)??null;return M.delete(t),i}(this.id);if(i){if(this._parentFlipInFlight&&Date.now()-this._parentFlipStartTime<100)return void(this._deferredParentTarget=i);this._deferredParentTarget=null,this.startParentFlip(i)}}startParentFlip(t){var i,e;const n=this.options.getDragBehavior(),o=this.options.getElement(),s=o?{x:o.getBoundingClientRect().left,y:o.getBoundingClientRect().top}:(null==(i=ft(this.id))?void 0:i.position)??null;bt(this.id,{position:t,hasBeenDragged:!0,isAnimatingPosition:!0}),n.setPosition(t),n.setHasBeenDragged(!0),null==(e=this._cancelParentAnimationCleanup)||e.call(this),this._parentFlipInFlight=!0,this._parentFlipStartTime=Date.now();const a=this.id,r=()=>{this._parentFlipInFlight=!1,this._cancelParentAnimationCleanup=null,Mt(a);const t=this._deferredParentTarget;t?(this._deferredParentTarget=null,this.startParentFlip(t)):ni(a)};o&&s?this._cancelParentAnimationCleanup=pt(o,s,t,{duration:300,onComplete:r}):setTimeout(r,400)}handleChildCentering(t,i){t&&this.options.getElement()&&!i&&this.options.getPositioning().scheduleCenterChildOnParent(t.parentId)}get wasRestored(){return this._wasRestored}set wasRestored(t){this._wasRestored=t}get isAttentionAnimating(){return this._isAttentionAnimating}get glowStabilizing(){return this._glowStabilizing}set glowStabilizing(t){this._glowStabilizing=t}get restoreHold(){return this._restoreHold}set restoreHold(t){this._restoreHold=t}get isAnimatingToCenter(){return this._isAnimatingToCenter}set isAnimatingToCenter(t){this._isAnimatingToCenter=t}get isHandlingMinimize(){return this._isHandlingMinimize}}class Ii{constructor(t){var e,n,o,s;i(this,"id"),i(this,"dataId"),i(this,"options"),i(this,"drag"),i(this,"resize"),i(this,"animation"),i(this,"positioning"),i(this,"lifecycle"),i(this,"interactions"),i(this,"stateManager"),i(this,"overlayClosing",!1),i(this,"emitter",di()),i(this,"unsubscribeState",null),i(this,"cachedState",null),this.id=t.id,this.dataId=t.id,this.options=t,this.drag=function(t={}){const{initialPosition:i={x:0,y:0},constrain:e=!0}=t,n={...i};let o=!1,s=!1,a=0,r=0,d=0,l=0;const h=di();function c(){return{isDragging:o,position:{...n},hasBeenDragged:s}}function g(){h.emit("change",c())}return{getState:c,getPosition:()=>({...n}),isDragging:()=>o,hasBeenDragged:()=>s,setPosition:function(t){n.x=t.x,n.y=t.y,g()},setHasBeenDragged:function(t){s=t,g()},reset:function(){n.x=i.x,n.y=i.y,s=!1,o=!1,g()},constrainToViewport:function(t){if(!s)return;const i=st(n.x,n.y,t.width,t.height);n.x=i.x,n.y=i.y,g()},onPointerDown:function(t,i){if(0===t.button){if(!s){const t=i.getBoundingClientRect();n.x=t.left,n.y=t.top}o=!0,a=t.clientX,r=t.clientY,d=n.x,l=n.y,i.setPointerCapture(t.pointerId),h.emit("dragStart",{...n}),g()}},onPointerMove:function(t,i){if(!o)return;const c=t.clientX-a,u=t.clientY-r;let m=d+c,p=l+u;if(e){const t=st(m,p,i.width,i.height);m=t.x,p=t.y}n.x=m,n.y=p,s=!0,h.emit("dragMove",{...n}),g()},onPointerUp:function(t,i){o&&(o=!1,i.releasePointerCapture(t.pointerId),h.emit("dragEnd",{...n}),g())},subscribe:function(t){return h.on("change",t)},destroy:function(){h.off()}}}({initialPosition:{x:0,y:0},constrain:!0}),this.resize=function(t){const{minWidth:i=mi.minWidth,minHeight:e=mi.minHeight,getPosition:n,setPosition:o,getHasBeenDragged:s,setHasBeenDragged:a,getElement:r,getSymmetricResize:d,onResizeEnd:l}=t;let h=!1,c="",g={width:0,height:0},u=!1,m=!1,p={x:0,y:0,width:0,height:0,posX:0,posY:0,centerX:0,centerY:0},f=null;const w=di();let v=null,y=null;function z(){return{isResizing:h,direction:c,size:{...g},hasBeenResized:u}}function x(){w.emit("change",z())}function P(t){if(t.pointerId!==f)return;const n=t.clientX-p.x,s=t.clientY-p.y,a=window.innerWidth,r=window.innerHeight,l=(null==d?void 0:d())??!1;let h=p.width,u=p.height,m=p.posX,v=p.posY;if(l){if(c.includes("e")||c.includes("w")){const t=c.includes("e")?n:-n;h=Math.max(i,p.width+2*t),m=p.centerX-h/2}if(c.includes("s")||c.includes("n")){const t=c.includes("s")?s:-s;u=Math.max(e,p.height+2*t),v=p.centerY-u/2}}else{if(c.includes("e")){const t=a-m;h=Math.max(i,Math.min(p.width+n,t))}if(c.includes("w")){const t=p.width-i,e=Math.min(n,t);h=p.width-e,m=p.posX+e}if(c.includes("s")){const t=r-v;u=Math.max(e,Math.min(p.height+s,t))}if(c.includes("n")){const t=p.height-e,i=Math.min(s,t);u=p.height-i,v=p.posY+i}}const y=at(m,v,h,u);g={width:y.width,height:y.height},o({x:y.x,y:y.y}),w.emit("resizeMove",{size:{...g},position:{x:y.x,y:y.y}}),x()}function I(t){if(t.pointerId!==f)return;h=!1,c="",f=null,v&&window.removeEventListener("pointermove",v),y&&(window.removeEventListener("pointerup",y),window.removeEventListener("pointercancel",y)),v=null,y=null,m=!0;const i=n();w.emit("resizeEnd",{size:{...g},position:i}),l&&l(i,{...g}),x(),setTimeout(()=>{m=!1},0)}return{getState:z,getSize:()=>({...g}),isResizing:()=>h,hasBeenResized:()=>u,justFinishedResizing:()=>m,setSize:function(t){g={...t},u=!0,x()},reset:function(){u=!1,g={width:0,height:0},h=!1,c="",x()},constrainToViewport:function(){const t=n(),i=r();if(!i)return;const e=at(t.x,t.y,g.width||i.offsetWidth,g.height||i.offsetHeight);g={width:e.width,height:e.height},o({x:e.x,y:e.y}),x()},startResize:function(t,i){t.preventDefault(),t.stopPropagation();const e=r();if(!e)return;const d=e.getBoundingClientRect();s()||(o({x:d.left,y:d.top}),a(!0)),u||(g={width:d.width,height:d.height},u=!0);const l=n();h=!0,c=i,f=t.pointerId,p={x:t.clientX,y:t.clientY,width:g.width,height:g.height,posX:l.x,posY:l.y,centerX:l.x+g.width/2,centerY:l.y+g.height/2},v=P,y=I,window.addEventListener("pointermove",v),window.addEventListener("pointerup",y),window.addEventListener("pointercancel",y),w.emit("resizeStart",{direction:i}),x()},subscribe:function(t){return w.on("change",t)},destroy:function(){v&&window.removeEventListener("pointermove",v),y&&(window.removeEventListener("pointerup",y),window.removeEventListener("pointercancel",y)),w.off()}}}({minWidth:(null==(n=null==(e=t.config)?void 0:e.appearance)?void 0:n.minWidth)??q().appearance.minWidth,minHeight:(null==(s=null==(o=t.config)?void 0:o.appearance)?void 0:s.minHeight)??q().appearance.minHeight,getPosition:()=>this.drag.getPosition(),setPosition:t=>this.drag.setPosition(t),getHasBeenDragged:()=>this.drag.hasBeenDragged(),setHasBeenDragged:t=>this.drag.setHasBeenDragged(t),getElement:()=>this.element,onResizeEnd:(t,i)=>this.handleResizeEnd(t,i)}),this.animation=function(t){const{getId:i,getElement:e,getPosition:n,setPosition:o,getHasBeenDragged:s,setHasBeenDragged:a,getHasBeenResized:r,getSize:d,areAnimationsEnabled:l=()=>!0,onMinimizeComplete:h,onOpenStart:c}=t;let g="none",u=!1,m=null,p=null,f=null,w=null,v=null,y=null,z=null;const x=di();function P(){return{type:g,isAnimating:u,transform:m?{...m}:null}}function I(){x.emit("change",P())}function M(){y&&(clearTimeout(y),y=null)}function b(){const t=e();t&&!z&&(z=function(t,i){const e=e=>{e.target===t&&i(e.animationName)};return t.addEventListener("animationend",e),()=>t.removeEventListener("animationend",e)}(t,C))}function C(t){switch(M(),t){case"modal-genie-minimize":"minimize"===g&&A();break;case"modal-genie-restore":"restore"===g?B():"open"===g&&D();break;case"modal-close":case"modal-close-centered":case"modal-child-disappear":"close"===g&&S();break;case"modal-child-appear":"open"===g&&D()}}function A(){"minimize"===g&&(M(),w?(w(),w=null):v&&(null==h||h(v.position,!0,v.size)),x.emit("animationEnd",{type:"minimize"}),v=null)}function B(){if("restore"!==g)return;M(),g="none",u=!1,m=null;const t=e();t&&(t.setAttribute("data-state","open"),t.setAttribute("data-animation-phase","idle")),x.emit("animationEnd",{type:"restore"}),I()}function D(){if("open"!==g)return;M(),g="none",u=!1,m=null;const t=e();t&&(t.setAttribute("data-state","open"),t.setAttribute("data-animation-phase","idle")),x.emit("animationEnd",{type:"open"}),I()}function S(){if("close"!==g)return;M(),g="none",u=!1;const t=e();t&&(t.setAttribute("data-state","closed"),t.setAttribute("data-animation-phase","idle")),x.emit("animationEnd",{type:"close"}),f&&(f(),f=null),I()}return{getState:P,isAnimating:()=>u,getAnimationType:()=>g,getTransform:()=>m?{...m}:null,getPendingOpenSource:()=>p?{...p}:null,setPendingOpenSource:t=>{p=t?{...t}:null},startMinimize:function(t,c){const p=e();if(u||!p)return!1;if(b(),M(),!l()){const t=p.getBoundingClientRect(),i=s()?n():{x:t.left,y:t.top},e=r()?d():{width:t.width,height:t.height};return s()||(o(i),a(!0)),c?c():null==h||h(i,!0,e),!0}const f=p.getBoundingClientRect(),z=s()?n():{x:f.left,y:f.top},P=r()?d():{width:f.width,height:f.height};s()||(o(z),a(!0));const C=t??wi(i());return m=function(t,i,e){const n=t.x+i.width/2,o=t.y+i.height/2;return{x:e.x-n,y:e.y-o,originX:e.x-t.x,originY:e.y-t.y}}(z,P,C),w=c||null,v={position:z,size:P},p.setAttribute("data-state","minimizing"),p.setAttribute("data-animation-phase","prepare"),requestAnimationFrame(()=>{requestAnimationFrame(()=>{g="minimize",u=!0,p.setAttribute("data-animation-phase","animate"),x.emit("animationStart",{type:"minimize"}),I()})}),y=setTimeout(()=>{"minimize"===g&&A()},600),!0},startRestore:function(t,n){const s=e();if(b(),M(),!l()){const i=t||{x:window.innerWidth/2,y:window.innerHeight/2};return o(i),void a(!0)}const r=wi(i()),d=t||{x:window.innerWidth/2,y:window.innerHeight/2},h=n||{width:480,height:400};o(d),a(!0),m=function(t,i,e){const n=t.x+i.width/2,o=t.y+i.height/2;return{x:e.x-n,y:e.y-o,originX:e.x-t.x,originY:e.y-t.y}}(d,h,r),g="restore",u=!0,s&&(s.setAttribute("data-state","restoring"),s.setAttribute("data-animation-phase","animate")),x.emit("animationStart",{type:"restore"}),I(),y=setTimeout(()=>{"restore"===g&&B()},500)},startOpen:function(){const t=e();if(!p||!t||u)return!1;if(b(),M(),!l())return p=null,!1;const i=p,r=t.getBoundingClientRect(),d=s()?n():{x:r.left,y:r.top},h=r.width,f=r.height;return s()||(o(d),a(!0)),m=function(t,i,e){const n=t.x+i.width/2,o=t.y+i.height/2;return{x:e.x-n,y:e.y-o,originX:e.x-t.x,originY:e.y-t.y}}(d,{width:h,height:f},i),g="open",u=!0,p=null,t.setAttribute("data-state","opening"),t.setAttribute("data-animation-phase","animate"),x.emit("animationStart",{type:"open"}),null==c||c(),I(),y=setTimeout(()=>{"open"===g&&D()},500),!0},startClose:function(t){const i=e();return!u&&(b(),M(),l()?(f=t,g="close",u=!0,i&&(i.setAttribute("data-state","closing"),i.setAttribute("data-animation-phase","animate")),x.emit("animationStart",{type:"close"}),I(),y=setTimeout(()=>{"close"===g&&S()},350),!0):(t(),!0))},forceClearMinimize:function(){M(),"minimize"===g&&(g="none",u=!1,m=null,w=null,v=null,I())},destroy:function(){M(),null==z||z(),z=null,x.off()},subscribe:t=>x.on("change",t)}}({getId:()=>this.id,getElement:()=>this.element,getPosition:()=>this.drag.getPosition(),setPosition:t=>this.drag.setPosition(t),getHasBeenDragged:()=>this.drag.hasBeenDragged(),setHasBeenDragged:t=>this.drag.setHasBeenDragged(t),getHasBeenResized:()=>this.resize.hasBeenResized(),getSize:()=>this.resize.getSize(),areAnimationsEnabled:()=>this.options.configHelper.isFeatureEnabled("animations"),onMinimizeComplete:(t,i,e)=>{bt(this.id,{position:t,size:e,hasBeenDragged:i}),Tt(this.id)},onOpenStart:()=>{const t=ft(this.id);(null==t?void 0:t.parentId)&&(this.stateManager.wasRestored=!0)}}),this.positioning=new yi({id:this.id,dataId:this.dataId,configHelper:t.configHelper,getDragBehavior:()=>this.drag,getElement:()=>this.element}),this.interactions=new xi({id:this.id,configHelper:t.configHelper,getDragBehavior:()=>this.drag,getResizeBehavior:()=>this.resize,getElement:()=>this.element,getState:()=>{var t;return{hasChild:!!(null==(t=ft(this.id))?void 0:t.childId)}},onDragMove:()=>{if("realtime"===q().parentChild.movementMode){const t=this.drag.getPosition();It(this.id,t,{drag:!0,realtime:!0})}},onDragEnd:()=>{const t=this.drag.getPosition();It(this.id,t,{drag:!0}),"animated"===q().parentChild.movementMode&&ni(this.id)},onClose:()=>this.close(),closeOnEscape:t.closeOnEscape,isTopModal:()=>et(this.id)}),this.stateManager=new Pi({id:this.id,options:{glow:t.glow,openSourcePosition:t.openSourcePosition,onClose:t.onClose},getDragBehavior:()=>this.drag,getResizeBehavior:()=>this.resize,getAnimationController:()=>this.animation,getElement:()=>this.element,getPositioning:()=>this.positioning,onStateChange:()=>this.notifyStateChange(),focusFirst:()=>this.interactions.focusFirst()}),ii(t.id)&&(this.stateManager.wasRestored=!0),this.lifecycle=new fi({onMount:()=>{this.handleStateChange(),this.handlePendingStates(),this.notifyStateChange()},onDestroy:()=>{var t;null==(t=this.unsubscribeState)||t.call(this),this.drag.destroy(),this.resize.destroy(),this.animation.destroy(),this.emitter.off()},onWindowResize:()=>this.handleWindowResize()}),this.drag.subscribe(()=>this.notifyStateChange()),this.resize.subscribe(()=>this.notifyStateChange()),this.animation.subscribe(()=>{this.handlePendingStates(),this.notifyStateChange()}),this.unsubscribeState=L(()=>{this.handleStateChange(),this.handlePendingStates(),this.notifyStateChange()}),t.skipRegistration||this.register(t.autoOpen??!1),this.handleStateChange(),this.handlePendingStates()}mount(t){this.lifecycle.mount(t)}destroy(){this.lifecycle.destroy()}get element(){return this.lifecycle.getElement()}handleWindowResize(){if(!this.element||!this.drag.hasBeenDragged())return;const t=this.resize.hasBeenResized()?this.resize.getSize():{width:this.element.offsetWidth,height:this.element.offsetHeight};this.positioning.constrainToViewport(t),this.resize.hasBeenResized()&&this.resize.constrainToViewport(),this.notifyStateChange()}register(t){Q({id:this.id,title:this.options.title,icon:this.options.icon??"",isOpen:t,isMinimized:!1,isHiddenWithParent:!1,isTransparent:!1,isRejected:!1,position:null,size:null,hasBeenDragged:!1,dockPosition:0,glow:this.options.glow??null,parentId:void 0,childId:void 0,offsetFromParent:void 0}),t&&it(this.id)}getState(){if(this.cachedState)return this.cachedState;const t=ft(this.id),i=this.drag.getState(),e=this.resize.getState(),n=this.animation.getState(),o=!!t&&(t.isOpen||Ut(this.id))&&(!t.isMinimized||jt(this.id))&&(!t.isHiddenWithParent||Nt(this.id)||ti(this.id)),s=!!(null==t?void 0:t.childId),a=!!(null==t?void 0:t.parentId),r="minimize"===n.type&&n.isAnimating,d="restore"===n.type&&n.isAnimating,l="open"===n.type&&n.isAnimating,h="close"===n.type&&n.isAnimating,c=n.isAnimating,g=(null==t?void 0:t.isAnimatingPosition)??!1,u=g&&(null==t?void 0:t.position)?t.position:i.position,m=!!g||i.hasBeenDragged,p=(ti(this.id)||Zt(this.id))&&!d,f=(a||ii(this.id))&&!l&&(!m||!!this.animation.getPendingOpenSource()),w=d||l||this.stateManager.restoreHold,v=o&&!m&&!c&&!this.animation.getPendingOpenSource()&&!p&&!f;let y="closed";r?y="minimizing":d?y="restoring":l?y="opening":h?y="closing":(null==t?void 0:t.isMinimized)?y="minimized":o&&(y="open");const z=this.options.configHelper.isFeatureEnabled("drag"),x=this.options.configHelper.isFeatureEnabled("resize"),P=this.options.configHelper.isFeatureEnabled("minimize"),I=!!this.options.glow,M=function(t){const i={"z-index":t.zIndex};return t.animationTransform?(i.left=`${t.position.x}px`,i.top=`${t.position.y}px`,i["--genie-origin-x"]=`${t.animationTransform.originX}px`,i["--genie-origin-y"]=`${t.animationTransform.originY}px`,i["--genie-translate-x"]=`${t.animationTransform.x}px`,i["--genie-translate-y"]=`${t.animationTransform.y}px`):t.hasBeenDragged&&(i.left=`${t.position.x}px`,i.top=`${t.position.y}px`,t.isAnimatingPosition||(i.transform="none")),t.hasBeenResized?(i.width=`${t.size.width}px`,i.height=`${t.size.height}px`,i["max-width"]="none",i["max-height"]="none"):(t.preferredHeight&&(i["min-height"]=t.preferredHeight),t.maxWidth&&(i["max-width"]=t.maxWidth)),t.glowEnabled&&t.glow&&(i["--modal-glow-color"]=t.glow.color,i["--modal-glow-intensity"]=String(t.glow.intensity??"medium")),i}({position:u,hasBeenDragged:m,hasBeenResized:e.hasBeenResized,size:e.size,animationTransform:n.transform,zIndex:(null==t?void 0:t.zIndex)??1e3,glowEnabled:I,glow:this.options.glow??null,maxWidth:this.options.maxWidth,preferredHeight:this.options.preferredHeight,isAnimatingPosition:g}),b=function(t){const i=["modal-dialog"];return t.isDragging&&i.push("modal-dragging"),t.isResizing&&i.push("modal-resizing"),t.hasBeenDragged&&i.push("modal-positioned"),t.isMinimizing&&i.push("modal-minimizing"),t.isRestoring&&i.push("modal-restoring"),t.isOpening&&i.push("modal-opening"),t.isClosing&&i.push("modal-closing"),t.showCentered&&i.push("modal-centered"),t.isTransparent||i.push("modal-solid"),t.isTransparent&&i.push("modal-transparent"),t.glowEnabled&&i.push("modal-glow"),t.hasChild&&i.push("modal-has-child"),t.isChildModal&&i.push("modal-is-child"),t.wasRestored&&i.push("modal-was-restored"),t.isVisibleByAnimation&&i.push("modal-visible-by-animation"),t.isAwaitingRestore&&i.push("modal-awaiting-restore"),t.isAwaitingChildOpen&&i.push("modal-awaiting-child-open"),t.isAnimatingToCenter&&i.push("modal-animating-to-center"),t.isAnimatingPosition&&i.push("modal-animating-position"),t.isAttentionAnimating&&i.push("modal-attention"),t.glowStabilizing&&t.glowEnabled&&i.push("modal-glow-stabilizing"),i}({isDragging:i.isDragging,isResizing:e.isResizing,hasBeenDragged:m,isMinimizing:r,isRestoring:d,isOpening:l,isClosing:h,showCentered:v,isTransparent:(null==t?void 0:t.isTransparent)??!1,glowEnabled:I,hasChild:s,isChildModal:a,wasRestored:this.stateManager.wasRestored,isVisibleByAnimation:w,isAwaitingRestore:p,isAwaitingChildOpen:f,isAnimatingToCenter:this.stateManager.isAnimatingToCenter,isAnimatingPosition:(null==t?void 0:t.isAnimatingPosition)??!1,isAttentionAnimating:this.stateManager.isAttentionAnimating,glowStabilizing:this.stateManager.glowStabilizing});return this.cachedState={position:i.position,size:e.size,zIndex:(null==t?void 0:t.zIndex)??1e3,isDragging:i.isDragging,isResizing:e.isResizing,hasBeenDragged:i.hasBeenDragged,hasBeenResized:e.hasBeenResized,isMinimizing:r,isRestoring:d,isOpening:l,isClosing:h,isAnyAnimating:c,animationTransform:n.transform,isVisible:o,showCentered:v,isAwaitingRestore:p,isAwaitingChildOpen:f,isVisibleByAnimation:w,hasChild:s,isChildModal:a,showOverlay:s||this.overlayClosing,isTransparent:(null==t?void 0:t.isTransparent)??!1,isAttentionAnimating:this.stateManager.isAttentionAnimating,glowStabilizing:this.stateManager.glowStabilizing,isAnimatingPosition:(null==t?void 0:t.isAnimatingPosition)??!1,isAnimatingToCenter:this.stateManager.isAnimatingToCenter,wasRestored:this.stateManager.wasRestored,overlayClosing:this.overlayClosing,glowEnabled:I,draggable:z,resizable:x,minimizable:P,dataState:y,dataAnimationPhase:n.isAnimating?"animate":"idle",style:M,cssClasses:b},this.cachedState}subscribe(t){return this.emitter.on("stateChange",t)}notifyStateChange(){this.cachedState=null,this.emitter.emit("stateChange",this.getState())}startDrag(t){this.interactions.startDrag(t)}startResize(t,i){this.interactions.startResize(t,i)}handlePointerMove(t){this.interactions.handlePointerMove(t)}handlePointerUp(t){this.interactions.handlePointerUp(t)}handleKeyDown(t){this.interactions.handleKeyDown(t)}handleTabKey(t){this.interactions.handleTabKey(t)}minimize(){this.options.configHelper.isFeatureEnabled("minimize")&&Tt(this.id)}close(){var t,i;Jt(this.id)&&Qt(this.id),Xt(this.id),null==(i=(t=this.options).onClose)||i.call(t)}toggleTransparency(){Lt(this.id)}bringToFront(){it(this.id)}setOpenSourcePosition(t){this.animation.setPendingOpenSource(t)}updateGlow(t){this.options.glow!==t&&(this.options.glow=t,bt(this.id,{glow:t??null}),this.notifyStateChange())}focusFirst(){this.interactions.focusFirst()}handleResizeEnd(t,i){const e=ft(this.id);if(null==e?void 0:e.parentId){const n=ft(e.parentId),o=mt(e.parentId);if(n&&o){const e=n.position??{x:o.getBoundingClientRect().left,y:o.getBoundingClientRect().top},s=n.size??{width:o.offsetWidth,height:o.offsetHeight},a={x:e.x+(s.width-i.width)/2,y:e.y+(s.height-i.height)/2},r=t;this.stateManager.isAnimatingToCenter=!0,this.drag.setPosition(a);const d={x:a.x-e.x,y:a.y-e.y};bt(this.id,{position:a,size:i,hasBeenDragged:!0,offsetFromParent:d});const l=this.lifecycle.getElement();return void(l?pt(l,r,a,{duration:200,onComplete:()=>{this.stateManager.isAnimatingToCenter=!1}}):this.stateManager.isAnimatingToCenter=!1)}}bt(this.id,{position:t,size:i,hasBeenDragged:!0})}handleStateChange(){const t=ft(this.id);if(t){if((t.parentId||ii(this.id))&&(this.stateManager.wasRestored=!0),!this.drag.isDragging()&&!this.resize.isResizing()&&t.position){const i=this.drag.getPosition(),e=t.position;(Math.abs(i.x-e.x)>.5||Math.abs(i.y-e.y)>.5)&&(this.drag.setPosition(e),t.hasBeenDragged&&this.drag.setHasBeenDragged(!0))}this.stateManager.handlePendingStates()}}handlePendingStates(){this.stateManager.handlePendingStates()}getId(){return this.id}getDataId(){return this.dataId}getElement(){return this.element}}function Mi(){const t=zt();return Array.from(t.values()).filter(t=>t.isMinimized).sort((t,i)=>t.dockPosition-i.dockPosition)}function bi(t,i,e){const n=st(t.x,t.y,i,e);return{x:Math.round(n.x),y:Math.round(n.y)}}function Ci(t,i,e,n,o,s=8){const a=window.innerWidth-n-s,r=window.innerHeight-o-s,d=Math.min(Math.max(t-e.x,s),Math.max(s,a)),l=Math.min(Math.max(i-e.y,s),Math.max(s,r));return{x:Math.round(d),y:Math.round(l)}}function Ai(t,i){const e=["modal-dock-container"];return"left"===t?e.push("modal-dock-left"):"right"===t?e.push("modal-dock-right"):"bottom"===t?e.push("modal-dock-bottom"):"free"===t&&e.push("modal-dock-free"),i&&e.push("modal-dock-empty"),e.join(" ")}function Bi(t,i){const e=["modal-dock"];return"free"===t&&e.push("horizontal"===i?"modal-dock-free-horizontal":"modal-dock-free-vertical"),e.join(" ")}function Di(){const t=zt();return Array.from(t.values()).some(t=>t.isOpen&&!t.isMinimized&&!t.isHiddenWithParent)}function Si(){return G(q().features.backdrop)}function Hi(){const t=Si();return t.visible||t.blockClicks}export{Bi as A,zt as B,li as C,Yt as D,Xt as E,Tt as F,Vt as G,_t as H,vt as I,N as J,hi as K,ci as L,Ii as M,qt as N,K as O,xt as P,ft as Q,gi as R,wt as S,nt as T,Ft as U,Lt as V,ui as a,it as b,U as c,J as d,Hi as e,Si as f,X as g,Di as h,et as i,ai as j,q as k,si as l,Ht as m,ri as n,Rt as o,yt as p,Wt as q,Q as r,Gt as s,ut as t,Z as u,L as v,Mi as w,Ai as x,Ci as y,bi as z};
|
|
1
|
+
var t=Object.defineProperty,i=(i,e,n)=>((i,e,n)=>e in i?t(i,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):i[e]=n)(i,"symbol"!=typeof e?e+"":e,n);const e=Symbol.for("epic-modals-core");if("undefined"!=typeof globalThis){const t=globalThis;t[e],t[e]=!0}const n=new Map;let o=null;function s(t){o=t}let a=null;function r(t){a=t}const d=new Set;let l=!1,h=[],c=[],g=[],u=[],m=[],p=[],f=[],w=[],v=[],y=null;function z(t){y=t}const x=new Map;let P=null;function I(t){P=t}const M=new Map,b=new Set,C=new Set,A=new Set;let B=[];function D(t){B=t}function S(t){h=t}function H(t){c=t}function R(t){g=t}function k(t){u=t}function E(t){m=t}function T(t){p=t}function W(t){f=t}function F(t){w=t}function O(){!function(){if(!l){l=!0;try{d.forEach(t=>t())}finally{l=!1}}}()}function L(t){return d.add(t),()=>d.delete(t)}function _(t,i){return!!n.get(t)||(function(){var t,i;try{const e=import.meta;return!0===(null==(t=e.env)?void 0:t.DEV)||"development"===(null==(i=e.env)?void 0:i.MODE)}catch{return!1}}(),!1)}function G(t){return"boolean"==typeof t?{visible:t,blockClicks:t}:t}let $={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,easing:"cubic-bezier(0.34, 1.56, 0.64, 1)"},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"},V=0;const Y=new Set;function X(){return V}function q(){return $}function K(t){const i=$;$=j($,t),V++,Y.forEach(t=>t()),i.features.dock&&!$.features.dock&&Ft()}function j(t,i){var e;return{features:{...t.features,...i.features},dock:{...t.dock,...i.dock},animations:{...t.animations,...i.animations},appearance:{...t.appearance,...i.appearance},zIndex:{...t.zIndex,...i.zIndex},parentChild:{...t.parentChild,...i.parentChild},positioning:{...t.positioning,...i.positioning,avoidElements:(null==(e=i.positioning)?void 0:e.avoidElements)??t.positioning.avoidElements},portalTarget:i.portalTarget??t.portalTarget}}function N(t,i){const e=q(),n=i?j(e,i):e;return{isFeatureEnabled:i=>{var e;if(void 0!==(null==(e=null==t?void 0:t.features)?void 0:e[i])){const e=t.features[i];if("backdrop"===i){const t=G(e);return t.visible||t.blockClicks}return e}const o=n.features[i];if("backdrop"===i){const t=G(o);return t.visible||t.blockClicks}return o},getAppearance:i=>{var e;return void 0!==(null==(e=null==t?void 0:t.appearance)?void 0:e[i])?t.appearance[i]:n.appearance[i]},getPositioning:i=>{var e;return void 0!==(null==(e=null==t?void 0:t.positioning)?void 0:e[i])?t.positioning[i]:n.positioning[i]},getEffectiveConfig:()=>n}}function U(t){const{getModalConfig:i,getProviderConfig:e}=t;return{getEffectiveConfig:function(){const t=q(),n=e(),o=i();let s=t;return n&&(s=j(s,n)),o&&(s={...s,features:{...s.features,...o.features},appearance:{...s.appearance,...o.appearance},animations:{...s.animations,...o.animations},positioning:{...s.positioning,...o.positioning},parentChild:{...s.parentChild,...o.parentChild}}),s},isFeatureEnabled:function(t){var n,o;const s=i(),a=e(),r=i=>{if(void 0!==i){if("backdrop"===t&&"object"==typeof i){const t=G(i);return t.visible||t.blockClicks}return i}},d=r(null==(n=null==s?void 0:s.features)?void 0:n[t]);if(void 0!==d)return d;const l=r(null==(o=null==a?void 0:a.features)?void 0:o[t]);return void 0!==l?l:r(q().features[t])??!1},getAppearance:function(t){var n,o;const s=i(),a=e();return void 0!==(null==(n=null==s?void 0:s.appearance)?void 0:n[t])?s.appearance[t]:void 0!==(null==(o=null==a?void 0:a.appearance)?void 0:o[t])?a.appearance[t]:q().appearance[t]},getAnimation:function(t){var n,o;const s=i(),a=e();return void 0!==(null==(n=null==s?void 0:s.animations)?void 0:n[t])?s.animations[t]:void 0!==(null==(o=null==a?void 0:a.animations)?void 0:o[t])?a.animations[t]:q().animations[t]},getPositioning:function(t){var n,o;const s=i(),a=e();return void 0!==(null==(n=null==s?void 0:s.positioning)?void 0:n[t])?s.positioning[t]:void 0!==(null==(o=null==a?void 0:a.positioning)?void 0:o[t])?a.positioning[t]:q().positioning[t]},getParentChild:function(t){var n,o;const s=i(),a=e();return void 0!==(null==(n=null==s?void 0:s.parentChild)?void 0:n[t])?s.parentChild[t]:void 0!==(null==(o=null==a?void 0:a.parentChild)?void 0:o[t])?a.parentChild[t]:q().parentChild[t]}}}function J(t){return{id:t.id,title:t.title,icon:t.icon??"",isOpen:t.autoOpen??!1,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}}function Q(t){const i=n.get(t.id);let e;e=(null==i?void 0:i.zIndex)?i.zIndex:Math.max(...Array.from(n.values()).map(t=>t.zIndex),q().zIndex.base-2)+2;const o=c.includes(t.id),s=t.isOpen||o;i?n.set(t.id,{...i,title:t.title,icon:t.icon,glow:t.glow,zIndex:e}):n.set(t.id,{...t,isOpen:s,zIndex:e,isAnimating:!1}),O(),t.isMinimized&&!B.includes(t.id)&&D([...B,t.id])}function Z(t){const i=n.get(t);if(i){if(D(B.filter(i=>i!==t)),H(c.filter(i=>i!==t)),R(g.filter(i=>i!==t)),k(u.filter(i=>i!==t)),S(h.filter(i=>i!==t)),E(m.filter(i=>i!==t)),T(p.filter(i=>i!==t)),W(f.filter(i=>i!==t)),F(w.filter(i=>i!==t)),i.childId){const t=n.get(i.childId);t&&n.set(i.childId,{...t,parentId:void 0})}if(i.parentId){const t=n.get(i.parentId);t&&n.set(i.parentId,{...t,childId:void 0,lastChildId:i.id})}n.delete(t),O(),A.delete(t),b.delete(t)}}function tt(t,i){const e=n.get(t);if(!(null==e?void 0:e.childId))return;const o=n.get(e.childId);if(!o)return;const s=i+2;n.set(e.childId,{...o,zIndex:s}),tt(e.childId,s)}function it(t){if(!n.get(t))return;const i=Math.max(...Array.from(n.values()).map(t=>t.zIndex),0),e=function(t){let i=t,e=n.get(i);for(;null==e?void 0:e.parentId;)i=e.parentId,e=n.get(i);return i}(t),o=n.get(e);if(!o)return;const s=i+2;n.set(e,{...o,zIndex:s}),tt(e,s),O()}function et(t){const i=n.get(t);if(!i)return!1;const e=Math.max(...Array.from(n.values()).map(t=>t.zIndex),0);return i.zIndex===e&&!i.isMinimized&&!i.isHiddenWithParent}function nt(t,i){if(Array.isArray(t))D(t);else if("number"==typeof i){const e=t,n=[...B],[o]=n.splice(e,1);n.splice(i,0,o),D(n)}}const ot=8;function st(t,i,e,n,o={}){const{margin:s=ot,allowPartialVisibility:a=!1}=o,r="undefined"!=typeof window?window.innerWidth:1920,d="undefined"!=typeof window?window.innerHeight:1080;let l,h,c,g;return a&&e>r-2*s?(l=40-e,h=r-40):(l=s,h=Math.max(s,r-e-s)),a&&n>d-2*s?(c=40-n,g=d-40):(c=s,g=Math.max(s,d-n-s)),{x:Math.max(l,Math.min(h,t)),y:Math.max(c,Math.min(g,i))}}function at(t,i,e,n,o={}){const{margin:s=ot}=o,a=("undefined"!=typeof window?window.innerWidth:1920)-2*s,r=("undefined"!=typeof window?window.innerHeight:1080)-2*s,d=Math.min(e,a),l=Math.min(n,r),h=st(t,i,d,l,o);return{x:h.x,y:h.y,width:d,height:l}}function rt(t,i){return Math.max(0,Math.min(t.x+t.width,i.x+i.width)-Math.max(t.x,i.x))*Math.max(0,Math.min(t.y+t.height,i.y+i.height)-Math.max(t.y,i.y))}function dt(t,i,e,n,o,s){const a={x:t-s,y:i-s,width:e+2*s,height:n+2*s};let r=0;for(const t of o)r+=rt(a,t);return r}function lt(t){if("undefined"==typeof document)return[];const i=[];for(const e of t)try{const t=document.querySelectorAll(e);for(const e of t){const t=e.getBoundingClientRect();t.width>0&&t.height>0&&i.push({x:t.left,y:t.top,width:t.width,height:t.height})}}catch{}return i}function ht(t,i,e,n){const o=t-i,s=e-1;if(o<=0)return{interGap:0,edgeGap:0};if(e<=1)return{interGap:0,edgeGap:o/2};const a=o/(e+1);if(a>=n)return{interGap:a,edgeGap:a};const r=s*n;return o>=r?{interGap:n,edgeGap:(o-r)/2}:{interGap:o/s,edgeGap:0}}function ct(t,i,e,n,o=0){if(0===e.length)return{cols:t,rows:i,score:1/0,positions:new Map};const s=new Array(t).fill(0),a=new Array(i).fill(0);for(let i=0;i<e.length;i++){const n=i%t,o=Math.floor(i/t);s[n]=Math.max(s[n],e[i].width),a[o]=Math.max(a[o],e[i].height)}const r=s.reduce((t,i)=>t+i,0),d=a.reduce((t,i)=>t+i,0);if(r>n.width||d>n.height)return null;const{interGap:l,edgeGap:h}=ht(n.width,r,t,o),{interGap:c,edgeGap:g}=ht(n.height,d,i,o),u=new Map,m=[0];for(let i=0;i<t;i++)m.push(m[i]+s[i]);const p=[0];for(let t=0;t<i;t++)p.push(p[t]+a[t]);for(let i=0;i<e.length;i++){const o=i%t,r=Math.floor(i/t),d=e[i],f=n.x+h+o*l+m[o],w=n.y+g+r*c+p[r],v=f+(s[o]-d.width)/2,y=w+(a[r]-d.height)/2;u.set(d.id,{x:Math.round(v),y:Math.round(y)})}const f=t>1?l:h,w=i>1?c:g;return{cols:t,rows:i,score:(.6*Math.min(f,w)+.4*Math.sqrt(f*w))*(n.width>n.height==t>=i?1.02:1),positions:u}}function gt(t,i,e={}){const{modalGap:n=16,viewportMargin:o=16,avoidBounds:s=[],avoidMargin:a=24}=e,r="undefined"!=typeof window?window.innerWidth:1920,d="undefined"!=typeof window?window.innerHeight:1080,l=new Map,h=t.filter(t=>!t.parentId),c=h.map(t=>({id:t.id,width:t.width,height:t.height}));if(i&&c.push({id:i.id,width:i.width,height:i.height}),0===c.length)return{positions:l};const g=new Map(h.map(t=>[t.id,t.currentPosition]));c.sort((t,i)=>{const e=g.get(t.id),n=g.get(i.id);return(e?e.x+t.width/2:1/0)-(n?n.x+i.width/2:1/0)});const u=function(t,i,e,n,o){let s=e,a=e,r=t-e,d=i-e;for(const e of n){const n=e.y,l=i-(e.y+e.height),h=e.x,c=t-(e.x+e.width);let g;if(e.width>e.height)g=n<=l?"top":"bottom";else if(e.height>e.width)g=h<=c?"left":"right";else{const t=Math.min(n,l,h,c);g=t===n?"top":t===l?"bottom":t===h?"left":"right"}"bottom"===g?d=Math.min(d,e.y-o):"top"===g?a=Math.max(a,e.y+e.height+o):"left"===g?s=Math.max(s,e.x+e.width+o):r=Math.min(r,e.x-o)}return{x:s,y:a,width:Math.max(0,r-s),height:Math.max(0,d-a)}}(r,d,o,s,a);if(1===c.length){const t=c[0],i=u.x+(u.width-t.width)/2,e=u.y+(u.height-t.height)/2;return l.set(t.id,{x:Math.round(i),y:Math.round(e)}),{positions:l}}const m=c.length;let p=null;for(let t=1;t<=m;t++){const i=ct(t,Math.ceil(m/t),c,u,n);i&&(null===p||i.score>p.score)&&(p=i)}if(p){for(const[t,i]of p.positions)l.set(t,i);return{positions:l}}if(i){const t=h.map(t=>({x:t.currentPosition.x,y:t.currentPosition.y,width:t.width,height:t.height})),e=function(t,i,e,n,o=20){const s=n.x+(n.width-t)/2,a=n.y+(n.height-i)/2;if(0===e.length)return{x:Math.round(s),y:Math.round(a)};const r=n.x,d=Math.max(n.x,n.x+n.width-t),l=n.y,h=Math.max(n.y,n.y+n.height-i);if(d<=r||h<=l)return{x:Math.round(s),y:Math.round(a)};const c=(d-r)/o,g=(h-l)/o;let u={x:s,y:a},m=1/0;const p=t*i,f=Math.hypot(n.width/2,n.height/2),w=n.x+n.width/2,v=n.y+n.height/2;for(let n=0;n<=o;n++)for(let s=0;s<=o;s++){const o=r+n*c,a=l+s*g,d=dt(o,a,t,i,e,0),h=p>0?d/p:0,y=Math.hypot(o+t/2-w,a+i/2-v),z=.5*h+.5*(f>0?y/f:0);z<m&&(m=z,u={x:o,y:a})}return{x:Math.round(u.x),y:Math.round(u.y)}}(i.width,i.height,t,u);return l.set(i.id,e),{positions:l}}const f=function(t,i){const e=new Map,n=Math.max(...t.map(t=>t.width)),o=Math.max(...t.map(t=>t.height)),s=n+40*(t.length-1),a=o+40*(t.length-1);let r=i.x+(i.width-s)/2,d=i.y+(i.height-a)/2;r=Math.max(i.x,r),d=Math.max(i.y,d);for(let i=0;i<t.length;i++)e.set(t[i].id,{x:Math.round(r+40*i),y:Math.round(d+40*i)});return e}(c,u);return{positions:f}}function ut(t){return t}function mt(t){return"undefined"==typeof document?null:document.querySelector(`.modal-dialog[data-modal-id="${t}"]`)}function pt(t,i,e,n){var o;const s=i.x-e.x,a=i.y-e.y;if(0===s&&0===a)return null==(o=null==n?void 0:n.onComplete)||o.call(n),()=>{};const r=(null==n?void 0:n.duration)??300,d=(null==n?void 0:n.easing)??"ease-out";let l=!1;function h(){var t;l||(l=!0,clearTimeout(g),null==(t=null==n?void 0:n.onComplete)||t.call(n))}t.style.left=`${e.x}px`,t.style.top=`${e.y}px`;const c=t.animate([{transform:`translate(${s}px, ${a}px)`},{transform:"translate(0, 0)"}],{duration:r,easing:d,fill:"none"});c.onfinish=h;const g=setTimeout(h,r+100);return function(){l||(l=!0,clearTimeout(g),c.cancel())}}function ft(t){return n.get(t)}function wt(t){const i=n.get(t);return(null==i?void 0:i.isOpen)??!1}function vt(t){return n.has(t)}function yt(t){return b.has(t)}function zt(){return n}function xt(){return B}function Pt(){const t=[];for(const i of n.values()){if(!i.isOpen||i.isMinimized||i.isHiddenWithParent)continue;if(C.has(i.id))continue;const e=mt(i.id);if(!e)continue;const n=i.position??{x:e.getBoundingClientRect().left,y:e.getBoundingClientRect().top},o=i.size??{width:e.offsetWidth,height:e.offsetHeight};t.push({id:i.id,width:o.width,height:o.height,currentPosition:n,parentId:i.parentId})}return t}function It(t,i,e){if(!_(t))return;!function(t){if(!Number.isFinite(t.x)||!Number.isFinite(t.y))throw new Error(`[epic-modals] Invalid position in updateModalPosition: x=${t.x}, y=${t.y}`)}(i),(null==e?void 0:e.size)&&function(t){if(t.width<=0||t.height<=0)throw new Error(`[epic-modals] Invalid dimensions in updateModalPosition: width=${t.width}, height=${t.height}`)}(e.size);const o=n.get(t);if(!o)return;let s=i;if((null==e?void 0:e.constrain)&&o.size&&(s=st(i.x,i.y,o.size.width,o.size.height)),n.set(t,{...o,position:s,size:(null==e?void 0:e.size)??o.size,hasBeenDragged:o.hasBeenDragged||(null==e?void 0:e.drag)||!1}),o.childId){let i=t,e=s;for(;;){const t=n.get(i);if(!(null==t?void 0:t.childId))break;const o=n.get(t.childId);if(!(null==o?void 0:o.offsetFromParent))break;const s={x:e.x+o.offsetFromParent.x,y:e.y+o.offsetFromParent.y};n.set(t.childId,{...o,position:s,hasBeenDragged:!0}),i=t.childId,e=s}}if(o.parentId&&o.offsetFromParent){const i=q();let a=t,r=o;for(;r.parentId&&r.offsetFromParent;){const o=n.get(r.parentId);if(!o)break;const d=a===t?s:n.get(a).position,l={x:d.x-r.offsetFromParent.x,y:d.y-r.offsetFromParent.y};if("animated"===i.parentChild.movementMode&&!(null==e?void 0:e.realtime)){M.set(r.parentId,l);break}n.set(r.parentId,{...o,position:l,hasBeenDragged:!0}),a=r.parentId,r=o}}O()}function Mt(t){const i=n.get(t);if(!i)return;if(!i.isAnimatingPosition)return;i.isAnimatingPosition=!1;let e=i.childId;for(;e;){const t=n.get(e);t&&(t.isAnimatingPosition=!1),e=null==t?void 0:t.childId}O()}function bt(t,i){const e=n.get(t);e&&(n.set(t,{...e,...i}),O())}function Ct(t){const i=q();"smart"===i.positioning.strategy&&(o&&clearTimeout(o),s(setTimeout(()=>{const e=Pt(),n=lt(i.positioning.avoidElements);At(gt(e,t,{modalGap:i.positioning.modalGap,viewportMargin:i.positioning.modalGap,avoidBounds:n,avoidMargin:i.positioning.modalGap}).positions),s(null)},50)))}function At(t){if(0===t.size)return;const i=[];for(const[e,o]of t){const t=n.get(e);if(!t)continue;const s=mt(e),a=t.position??(s?{x:s.getBoundingClientRect().left,y:s.getBoundingClientRect().top}:{x:0,y:0}),r=t.size??(s?{width:s.offsetWidth,height:s.offsetHeight}:{width:0,height:0});i.push({id:e,element:s,oldPosition:a,newPosition:o,size:r}),Bt(e,a,o,i)}for(const{id:t,newPosition:e,size:o}of i){const i=n.get(t);i&&n.set(t,{...i,position:e,size:o,hasBeenDragged:!0,isAnimatingPosition:!0})}O();for(const{id:t,element:e,oldPosition:n,newPosition:o}of i)e?pt(e,n,o,{duration:300,onComplete:()=>Mt(t)}):setTimeout(()=>Mt(t),400)}function Bt(t,i,e,o){const s=n.get(t);if(!(null==s?void 0:s.childId))return;const a=n.get(s.childId);if(!(null==a?void 0:a.offsetFromParent))return;const r=mt(s.childId),d={x:i.x+a.offsetFromParent.x,y:i.y+a.offsetFromParent.y},l={x:e.x+a.offsetFromParent.x,y:e.y+a.offsetFromParent.y};o.push({id:s.childId,element:r,oldPosition:d,newPosition:l}),n.set(s.childId,{...a,position:l,hasBeenDragged:!0,isAnimatingPosition:!0}),a.childId&&Bt(s.childId,d,l,o)}function Dt(){a&&clearTimeout(a),r(setTimeout(()=>{Ct(null),r(null)},100))}let St=!1;function Ht(){St||"undefined"==typeof window||(window.addEventListener("resize",Dt),St=!0)}function Rt(){"undefined"!=typeof window&&(window.removeEventListener("resize",Dt),St=!1)}function kt(t){M.delete(t)}function Et(t){const i=n.get(t);if(!(null==i?void 0:i.childId))return;const e=n.get(i.childId);e&&(f.includes(i.childId)||W([...f,i.childId]),e.childId&&Et(i.childId))}function Tt(t){const i=n.get(t);if(!i||i.isMinimized)return;if(kt(t),i.parentId){const t=n.get(i.parentId);if(t&&!t.isMinimized)return void Tt(i.parentId)}S([...h,t]),i.position&&i.size;const e=i.childId;n.set(t,{...i,isMinimized:!0,lastChildId:e}),B.includes(t)||D([...B,t]),O(),i.childId&&Et(t),Ct(null)}function Wt(t){const i=n.get(t);if(!i||!i.isMinimized)return;n.set(t,{...i,isMinimized:!1,isOpen:!0}),E([...m,t]),it(t);const e=i.lastChildId||i.childId;e&&Ot(e),O()}function Ft(){Array.from(n.values()).filter(t=>t.isMinimized).map(t=>t.id).forEach(t=>{const i=n.get(t);if(i){n.set(t,{...i,isMinimized:!1,isOpen:!0}),E([...m,t]),it(t);const e=i.lastChildId||i.childId;e&&Ot(e)}}),D([]),O()}function Ot(t){const i=n.get(t);if(i&&i.isHiddenWithParent){T([...p,t]);const e=i.lastChildId||i.childId;e&&Ot(e)}}function Lt(t){if(!_(t))return;const i=n.get(t);A.has(t)?(A.delete(t),n.set(t,{...i,isTransparent:!1})):(A.add(t),n.set(t,{...i,isTransparent:!0})),O()}function _t(t){_(t)&&(w.includes(t)||(F([...w,t]),O()))}function Gt(t){t.classList.add("modal-shake"),t.addEventListener("animationend",()=>{t.classList.remove("modal-shake")},{once:!0})}function $t(t){if(!_(t))return;const i=n.get(t);A.delete(t),n.set(t,{...i,isTransparent:!1}),O()}function Vt(t,i,e){Yt(t,e,{parentId:i})}function Yt(t,i,e){const o=q(),s=n.get(t);if(s&&s.isOpen&&!s.isMinimized&&!s.isHiddenWithParent)return _t(t),void it(t);if(s&&s.isMinimized)return void Wt(t);if("x"in i&&"y"in i)x.set(t,i);else{const e=i.getBoundingClientRect();x.set(t,{x:e.left+e.width/2,y:e.top+e.height/2})}if((null==e?void 0:e.parentId)&&o.features.parentChild){const i=n.get(e.parentId);(null==i?void 0:i.childId)&&i.childId!==t&&Xt(i.childId,!0),I({parentId:e.parentId,childId:t})}if(c.includes(t)||H([...c,t]),O(),!s)return;const a={isOpen:!0};(null==e?void 0:e.parentId)&&o.features.parentChild&&(a.parentId=e.parentId),n.set(t,{...s,...a}),it(t)}function Xt(t,i=!1){const e=n.get(t);if(e&&(e.isOpen||e.isMinimized)){if(kt(t),e.childId&&Xt(e.childId,i),e.isMinimized)return D(B.filter(i=>i!==t)),void Kt(t);C.add(t),i?k([...u,t]):R([...g,t]),O()}}function qt(t){const i=new Set(t??[]);Array.from(n.keys()).filter(t=>!i.has(t)).forEach(t=>Xt(t,!0))}function Kt(t){const i=n.get(t);if(i){if(C.delete(t),i.parentId){const e=n.get(i.parentId);e&&e.childId===t&&n.set(i.parentId,{...e,childId:void 0,lastChildId:t})}n.set(t,{...i,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 jt(t){return h.includes(t)}function Nt(t){return f.includes(t)}function Ut(t){return g.includes(t)}function Jt(t){return u.includes(t)}function Qt(t){k(u.filter(i=>i!==t))}function Zt(t){return m.includes(t)}function ti(t){return p.includes(t)}function ii(t){return(null==P?void 0:P.childId)===t}function ei(){return P}function ni(t){if("animated"!==q().parentChild.movementMode)return;const i=n.get(t);if(!(null==i?void 0:i.parentId)||!i.offsetFromParent||!i.position)return;const e={x:i.position.x-i.offsetFromParent.x,y:i.position.y-i.offsetFromParent.y};M.set(i.parentId,e),O()}const oi={BASE:0,DROPDOWN:100,STICKY:200,OVERLAY:300,MODAL:400,DOCK:8e3,TOAST:9e3};function si(){q().zIndex.base}function ai(t){const i=q();return"MODAL"===t?i.zIndex.base:"DOCK"===t?i.zIndex.dock:"TOAST"===t?i.zIndex.toast:oi[t]}function ri(){q().zIndex.base}function di(){const t=new Map;return{on(i,e){let n=t.get(i);return n||(n=new Set,t.set(i,n)),n.add(e),()=>{null==n||n.delete(e),0===(null==n?void 0:n.size)&&t.delete(i)}},emit(i,e){const n=t.get(i);n&&n.forEach(t=>t(e))},off(i){i?t.delete(i):t.clear()},listenerCount(i){var e;return(null==(e=t.get(i))?void 0:e.size)??0}}}const li={modal:"modal-dialog",header:"modal-header",headerDraggable:"modal-header-draggable",body:"modal-body",footer:"modal-footer",childOverlay:"modal-child-overlay",overlayClosing:"modal-overlay-closing",headerTitle:"modal-header-title",headerIcon:"modal-header-icon",headerTitleGroup:"modal-header-title-group",headerActions:"modal-header-actions",headerTrafficLights:"modal-header-traffic-lights",headerLight:"modal-header-light",headerLightClose:"modal-header-light-close",headerLightMinimize:"modal-header-light-minimize",headerLightStyle:"modal-header-light-style",headerLightDisabled:"modal-header-light-disabled",headerMacCenter:"modal-header-mac-center",headerMacSpacer:"modal-header-mac-spacer",headerBtnWindows:"modal-header-btn-windows",headerBtnWindowsClose:"modal-header-btn-windows-close",headerBtnWindowsStyle:"modal-header-btn-windows-style",headerBtnWindowsDisabled:"modal-header-btn-windows-disabled",resizeHandles:"modal-resize-handles",resizeHandle:"modal-resize-handle",resizePrefix:"modal-resize-",dock:"modal-dock",dockItem:"modal-dock-item",dockItemHasGlow:"modal-dock-item-has-glow",dockItemHasChild:"modal-dock-item-has-child",dockItemLabelBeside:"modal-dock-item-label-beside",dockItemLabelBelow:"modal-dock-item-label-below",dockItemIcon:"modal-dock-item-icon",dockItemIconPlaceholder:"modal-dock-item-icon-placeholder",dockItemLabel:"modal-dock-item-label",dockItemGlow:"modal-dock-item-glow",dockChildIndicator:"modal-dock-child-indicator",dockHandle:"modal-dock-handle",dockHandleDragging:"modal-dock-handle-dragging",backdrop:"modal-backdrop",backdropVisible:"modal-backdrop-visible"},hi={dialog:li.modal,header:li.header,headerDraggable:li.headerDraggable,body:li.body,footer:li.footer,headerTitle:li.headerTitle,headerIcon:li.headerIcon,headerTitleGroup:li.headerTitleGroup,headerActions:li.headerActions,headerTrafficLights:li.headerTrafficLights,headerLight:li.headerLight,headerLightClose:li.headerLightClose,headerLightMinimize:li.headerLightMinimize,headerLightStyle:li.headerLightStyle,headerLightDisabled:li.headerLightDisabled,headerMacCenter:li.headerMacCenter,headerMacSpacer:li.headerMacSpacer,headerBtnWindows:li.headerBtnWindows,headerBtnWindowsClose:li.headerBtnWindowsClose,headerBtnWindowsStyle:li.headerBtnWindowsStyle,headerBtnWindowsDisabled:li.headerBtnWindowsDisabled,resizeHandles:li.resizeHandles,resizeHandle:li.resizeHandle,resizePrefix:li.resizePrefix,dock:li.dock,dockItem:li.dockItem,dockItemHasGlow:li.dockItemHasGlow,dockItemHasChild:li.dockItemHasChild,dockItemLabelBeside:li.dockItemLabelBeside,dockItemLabelBelow:li.dockItemLabelBelow,dockItemIcon:li.dockItemIcon,dockItemIconPlaceholder:li.dockItemIconPlaceholder,dockItemLabel:li.dockItemLabel,dockItemGlow:li.dockItemGlow,dockChildIndicator:li.dockChildIndicator,dockHandle:li.dockHandle,backdrop:li.backdrop,backdropVisible:li.backdropVisible},ci={modalId:"data-modal-id",resizeDirection:"data-direction"},gi=["n","s","e","w","ne","nw","se","sw"],ui={n:"Resize north",s:"Resize south",e:"Resize east",w:"Resize west",ne:"Resize northeast",nw:"Resize northwest",se:"Resize southeast",sw:"Resize southwest"},mi={minWidth:280,minHeight:200},pi=["button:not([disabled])","[href]","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(", ");class fi{constructor(t={}){i(this,"element",null),i(this,"resizeHandler",null),i(this,"options"),this.options=t}mount(t){var i,e;this.element=t,this.options.onWindowResize&&(this.resizeHandler=this.options.onWindowResize,window.addEventListener("resize",this.resizeHandler)),null==(e=(i=this.options).onMount)||e.call(i)}destroy(){var t,i;this.resizeHandler&&(window.removeEventListener("resize",this.resizeHandler),this.resizeHandler=null),this.element=null,null==(i=(t=this.options).onDestroy)||i.call(t)}getElement(){return this.element}isMounted(){return null!==this.element}}function wi(t,i){const e=document.querySelector(`.modal-dock-item[data-modal-id="${t}"]`);if(e){const t=e.getBoundingClientRect();return{x:t.left+t.width/2,y:t.top+t.height/2}}const n=document.querySelector('[data-dock-container="true"]');if(n){const t=n.getBoundingClientRect();return{x:t.left+t.width/2,y:t.top+t.height/2}}return{x:"undefined"!=typeof window?window.innerWidth/2:0,y:"undefined"!=typeof window?window.innerHeight-40:0}}function vi(t,i){return function(t,i,e={}){const{timeout:n=5e3}=e;return new Promise((e,o)=>{const s=performance.now(),a=()=>{const r=t(),d=performance.now()-s;r&&i(r)?e(r):d>=n?o(new Error(`DOM not ready after ${n}ms`)):requestAnimationFrame(a)};a()})}(t,t=>t.offsetWidth>0&&t.offsetHeight>0,i)}class yi{constructor(t){i(this,"id"),i(this,"dataId"),i(this,"configHelper"),i(this,"getDragBehavior"),i(this,"getElement"),this.id=t.id,this.dataId=t.dataId,this.configHelper=t.configHelper,this.getDragBehavior=t.getDragBehavior,this.getElement=t.getElement}constrainToViewport(t){const i=this.getDragBehavior();i.hasBeenDragged()&&i.constrainToViewport(t)}shouldApplySmartPositioning(){return"smart"===this.configHelper.getPositioning("strategy")&&!this.getDragBehavior().hasBeenDragged()}applySmartPositioning(){if("smart"!==this.configHelper.getPositioning("strategy"))return!1;const t=ft(this.id),i=ei();if((null==t?void 0:t.parentId)||i&&i.childId===this.id)return!1;if((null==t?void 0:t.hasBeenDragged)||(null==t?void 0:t.position))return!1;const e=this.getElement()||mt(this.id);if(!e)return!1;const n=e.offsetWidth,o=e.offsetHeight;if(n<=0||o<=0)return!1;const s=this.configHelper.getPositioning("modalGap"),a=Pt().filter(t=>t.id!==this.id),r=lt(this.configHelper.getPositioning("avoidElements")),d=gt(a,{id:this.id,width:n,height:o},{modalGap:s,viewportMargin:s,avoidBounds:r,avoidMargin:s}),l=d.positions.get(this.id);if(!l)return!1;const h=new Map;for(const[t,i]of d.positions)t!==this.id&&h.set(t,i);h.size>0&&At(h);const c=this.getDragBehavior();return c.setPosition(l),c.setHasBeenDragged(!0),It(this.id,l,{size:{width:n,height:o}}),!0}scheduleSmartPositioning(){vi(()=>this.getElement()||mt(this.id)).then(()=>{this.applySmartPositioning()}).catch(()=>{this.applySmartPositioning()})}centerChildOnParent(t){var i,e;const o=ft(t);if(!o)return!1;const s=this.getElement()||mt(this.id),a=mt(t),r=null==a?void 0:a.getBoundingClientRect(),d=o.position??(r?{x:r.left,y:r.top}:null);if(!d||!s)return!1;const l=(null==(i=o.size)?void 0:i.width)??(null==a?void 0:a.offsetWidth)??(null==r?void 0:r.width)??480,h=(null==(e=o.size)?void 0:e.height)??(null==a?void 0:a.offsetHeight)??(null==r?void 0:r.height)??400,c=s.offsetWidth,g=s.offsetHeight;if(l<=0||h<=0||c<=0||g<=0)return!1;const u={x:d.x+(l-c)/2,y:d.y+(h-g)/2},m=this.getDragBehavior();m.setPosition(u),m.setHasBeenDragged(!0),It(this.id,u,{size:{width:c,height:g}}),o.position&&o.size||!r||It(t,{x:r.left,y:r.top},{size:{width:l,height:h}});const p={x:u.x-d.x,y:u.y-d.y};return function(t,i,e){const o=n.get(t),s=n.get(i);o&&s&&(n.set(t,{...o,childId:i}),n.set(i,{...s,parentId:t,offsetFromParent:e}),it(i),O())}(t,this.id,p),!0}scheduleCenterChildOnParent(t){vi(()=>this.getElement()).then(()=>{this.centerChildOnParent(t)}).catch(()=>{this.centerChildOnParent(t)})}}function zi(t){return Array.from(t.querySelectorAll(pi)).filter(t=>null!==t.offsetParent||"A"===t.tagName)}class xi{constructor(t){i(this,"options"),this.options=t}startDrag(t){const i=this.options.getElement();this.options.configHelper.isFeatureEnabled("drag")&&i&&this.options.getDragBehavior().onPointerDown(t,i)}startResize(t,i){const e=this.options.getState();this.options.configHelper.isFeatureEnabled("resize")&&!e.hasChild&&this.options.getResizeBehavior().startResize(t,i)}handlePointerMove(t){const i=this.options.getElement();if(!i)return;const e=this.options.getDragBehavior(),n=e.isDragging(),o=this.options.getResizeBehavior(),s=o.hasBeenResized()?o.getSize():{width:i.offsetWidth,height:i.offsetHeight};e.onPointerMove(t,s),n&&e.isDragging()&&this.options.onDragMove()}handlePointerUp(t){const i=this.options.getElement();if(!i)return;const e=this.options.getDragBehavior(),n=e.isDragging();e.onPointerUp(t,i),n&&!this.options.getResizeBehavior().justFinishedResizing()&&this.options.onDragEnd()}handleKeyDown(t){var i,e;this.options.closeOnEscape&&"Escape"===t.key&&this.options.isTopModal()&&(t.stopPropagation(),null==(e=(i=this.options).onClose)||e.call(i))}handleTabKey(t){const i=this.options.getElement();i&&function(t,i){if("Tab"!==t.key)return;const e=zi(i);if(0===e.length)return void t.preventDefault();const n=e[0],o=e[e.length-1],s=document.activeElement;t.shiftKey?s===n&&(o.focus(),t.preventDefault()):s===o&&(n.focus(),t.preventDefault())}(t,i)}focusFirst(){const t=this.options.getElement();t&&function(t){const i=zi(t);i.length>0&&i[0].focus()}(t)}}class Pi{constructor(t){i(this,"id"),i(this,"options"),i(this,"_isHandlingMinimize",!1),i(this,"_isAttentionAnimating",!1),i(this,"_wasRestored"),i(this,"_glowStabilizing",!1),i(this,"_restoreHold",!1),i(this,"_isAnimatingToCenter",!1),i(this,"_cancelParentAnimationCleanup",null),i(this,"_parentFlipInFlight",!1),i(this,"_deferredParentTarget",null),i(this,"_parentFlipStartTime",0),this.id=t.id,this.options=t,this._wasRestored=!1}handlePendingStates(){if(!ft(this.id))return;if(this.handlePendingForceClose())return;if(this.handlePendingMinimize(),this.handlePendingMinimizeWithParent(),this.handlePendingRestore(),this.handlePendingChildRestore(),this.handlePendingClose())return;const t=this.handlePendingParentLink(),i=this.handlePendingOpen(t);this.handlePendingAttention(),this.handlePendingParentAnimation(),this.handleChildCentering(t,i)}handlePendingForceClose(){var t,i;return!!Jt(this.id)&&(Qt(this.id),Kt(this.id),null==(i=(t=this.options.options).onClose)||i.call(t),!0)}handlePendingMinimize(){if(!jt(this.id)||this._isHandlingMinimize)return;this._isHandlingMinimize=!0,z(null);const t=this.options.getElement();if(t){const i=this.options.getDragBehavior(),e=this.options.getResizeBehavior(),n=t.getBoundingClientRect(),o=i.hasBeenDragged()?i.getPosition():{x:n.left,y:n.top},s=e.hasBeenResized()?e.getSize():{width:n.width,height:n.height};bt(this.id,{position:o,size:s,hasBeenDragged:!0})}this.options.getAnimationController().startMinimize(void 0,()=>{var t;t=this.id,S(h.filter(i=>i!==t)),z(null),this._isHandlingMinimize=!1})||(this._isHandlingMinimize=!1)}handlePendingMinimizeWithParent(){if(!Nt(this.id)||this._isHandlingMinimize)return;this._isHandlingMinimize=!0;const t=this.options.getElement();if(t){const i=this.options.getDragBehavior(),e=this.options.getResizeBehavior(),n=t.getBoundingClientRect(),o=i.hasBeenDragged()?i.getPosition():{x:n.left,y:n.top},s=e.hasBeenResized()?e.getSize():{width:n.width,height:n.height};bt(this.id,{position:o,size:s,hasBeenDragged:!0})}this.options.getAnimationController().startMinimize(void 0,()=>{var t;t=this.id,W(f.filter(i=>i!==t)),function(t){const i=n.get(t);i&&(n.set(t,{...i,isHiddenWithParent:!0}),O())}(this.id),this._isHandlingMinimize=!1})}handlePendingRestore(){if(!Zt(this.id))return;const t=ft(this.id),i=this.options.getAnimationController();var e;e=this.id,E(m.filter(t=>t!==e)),i.startRestore((null==t?void 0:t.position)??void 0,(null==t?void 0:t.size)??void 0),requestAnimationFrame(()=>{this.options.focusFirst()})}handlePendingChildRestore(){if(!ti(this.id))return;const t=ft(this.id),i=this.options.getAnimationController();var e;e=this.id,T(p.filter(t=>t!==e)),i.startRestore((null==t?void 0:t.position)??void 0,(null==t?void 0:t.size)??void 0),function(t){const i=n.get(t);i&&i.isHiddenWithParent&&(n.set(t,{...i,isHiddenWithParent:!1}),O())}(this.id),this._wasRestored=!0}handlePendingClose(){var t,i,e;return!!Ut(this.id)&&(e=this.id,R(g.filter(t=>t!==e)),this.options.getAnimationController().startClose(()=>{var t,i;$t(this.id),Kt(this.id),null==(i=(t=this.options.options).onClose)||i.call(t)})||($t(this.id),Kt(this.id),null==(i=(t=this.options.options).onClose)||i.call(t)),!0)}handlePendingParentLink(){const t=ei();return t&&t.childId===this.id&&(bt(this.id,{parentId:t.parentId}),this._wasRestored=!0),function(t){const i=P;return t&&(null==i?void 0:i.childId)!==t?null:(I(null),i)}(this.id)}handlePendingOpen(t){var i,e;if(e=this.id,!c.includes(e))return!1;!function(t){H(c.filter(i=>i!==t))}(this.id);const n=this.options.getDragBehavior(),o=this.options.getResizeBehavior();bt(this.id,{position:null,hasBeenDragged:!1,size:null}),n.setPosition({x:0,y:0}),n.setHasBeenDragged(!1),o.reset();const s=function(t){const i=x.get(t)??null;return x.delete(t),i}(this.id)||this.options.options.openSourcePosition||null,a=!!t||!!(null==(i=ft(this.id))?void 0:i.parentId);let r=!1;return s?(r=!0,this.options.getAnimationController().setPendingOpenSource(s),a&&t?this.openChildModalWithAnimation(t.parentId):this.openStandaloneModalWithAnimation()):a||this.options.getPositioning().scheduleSmartPositioning(),requestAnimationFrame(()=>{this.options.focusFirst()}),r}openChildModalWithAnimation(t){const i=this.options.getPositioning(),e=this.options.getAnimationController();vi(()=>this.options.getElement()).then(()=>{i.centerChildOnParent(t)&&(e.startOpen(),this._wasRestored=!0)}).catch(()=>{i.centerChildOnParent(t)&&(e.startOpen(),this._wasRestored=!0)})}openStandaloneModalWithAnimation(){const t=this.options.getPositioning(),i=this.options.getAnimationController();vi(()=>this.options.getElement()).then(()=>{t.applySmartPositioning(),i.startOpen()}).catch(()=>{t.applySmartPositioning(),i.startOpen()})}handlePendingAttention(){var t;t=this.id,w.includes(t)&&(function(t){var i;F(w.filter(i=>i!==t)),v.includes(t)||(i=[...v,t],v=i)}(this.id),this.id,this._isAttentionAnimating=!0,setTimeout(()=>{this._isAttentionAnimating=!1,this.id,this.options.onStateChange()},600))}handlePendingParentAnimation(){if(t=this.id,!M.has(t))return;var t;const i=function(t){const i=M.get(t)??null;return M.delete(t),i}(this.id);if(i){if(this._parentFlipInFlight&&Date.now()-this._parentFlipStartTime<100)return void(this._deferredParentTarget=i);this._deferredParentTarget=null,this.startParentFlip(i)}}startParentFlip(t){var i,e;const n=this.options.getDragBehavior(),o=this.options.getElement(),s=o?{x:o.getBoundingClientRect().left,y:o.getBoundingClientRect().top}:(null==(i=ft(this.id))?void 0:i.position)??null;bt(this.id,{position:t,hasBeenDragged:!0,isAnimatingPosition:!0}),n.setPosition(t),n.setHasBeenDragged(!0),null==(e=this._cancelParentAnimationCleanup)||e.call(this),this._parentFlipInFlight=!0,this._parentFlipStartTime=Date.now();const a=this.id,r=()=>{this._parentFlipInFlight=!1,this._cancelParentAnimationCleanup=null,Mt(a);const t=this._deferredParentTarget;t?(this._deferredParentTarget=null,this.startParentFlip(t)):ni(a)};o&&s?this._cancelParentAnimationCleanup=pt(o,s,t,{duration:300,onComplete:r}):setTimeout(r,400)}handleChildCentering(t,i){t&&this.options.getElement()&&!i&&this.options.getPositioning().scheduleCenterChildOnParent(t.parentId)}get wasRestored(){return this._wasRestored}set wasRestored(t){this._wasRestored=t}get isAttentionAnimating(){return this._isAttentionAnimating}get glowStabilizing(){return this._glowStabilizing}set glowStabilizing(t){this._glowStabilizing=t}get restoreHold(){return this._restoreHold}set restoreHold(t){this._restoreHold=t}get isAnimatingToCenter(){return this._isAnimatingToCenter}set isAnimatingToCenter(t){this._isAnimatingToCenter=t}get isHandlingMinimize(){return this._isHandlingMinimize}}class Ii{constructor(t){var e,n,o,s;i(this,"id"),i(this,"dataId"),i(this,"options"),i(this,"drag"),i(this,"resize"),i(this,"animation"),i(this,"positioning"),i(this,"lifecycle"),i(this,"interactions"),i(this,"stateManager"),i(this,"overlayClosing",!1),i(this,"emitter",di()),i(this,"unsubscribeState",null),i(this,"cachedState",null),this.id=t.id,this.dataId=t.id,this.options=t,this.drag=function(t={}){const{initialPosition:i={x:0,y:0},constrain:e=!0}=t,n={...i};let o=!1,s=!1,a=0,r=0,d=0,l=0;const h=di();function c(){return{isDragging:o,position:{...n},hasBeenDragged:s}}function g(){h.emit("change",c())}return{getState:c,getPosition:()=>({...n}),isDragging:()=>o,hasBeenDragged:()=>s,setPosition:function(t){n.x=t.x,n.y=t.y,g()},setHasBeenDragged:function(t){s=t,g()},reset:function(){n.x=i.x,n.y=i.y,s=!1,o=!1,g()},constrainToViewport:function(t){if(!s)return;const i=st(n.x,n.y,t.width,t.height);n.x=i.x,n.y=i.y,g()},onPointerDown:function(t,i){if(0===t.button){if(!s){const t=i.getBoundingClientRect();n.x=t.left,n.y=t.top}o=!0,a=t.clientX,r=t.clientY,d=n.x,l=n.y,i.setPointerCapture(t.pointerId),h.emit("dragStart",{...n}),g()}},onPointerMove:function(t,i){if(!o)return;const c=t.clientX-a,u=t.clientY-r;let m=d+c,p=l+u;if(e){const t=st(m,p,i.width,i.height);m=t.x,p=t.y}n.x=m,n.y=p,s=!0,h.emit("dragMove",{...n}),g()},onPointerUp:function(t,i){o&&(o=!1,i.releasePointerCapture(t.pointerId),h.emit("dragEnd",{...n}),g())},subscribe:function(t){return h.on("change",t)},destroy:function(){h.off()}}}({initialPosition:{x:0,y:0},constrain:!0}),this.resize=function(t){const{minWidth:i=mi.minWidth,minHeight:e=mi.minHeight,getPosition:n,setPosition:o,getHasBeenDragged:s,setHasBeenDragged:a,getElement:r,getSymmetricResize:d,onResizeEnd:l}=t;let h=!1,c="",g={width:0,height:0},u=!1,m=!1,p={x:0,y:0,width:0,height:0,posX:0,posY:0,centerX:0,centerY:0},f=null;const w=di();let v=null,y=null;function z(){return{isResizing:h,direction:c,size:{...g},hasBeenResized:u}}function x(){w.emit("change",z())}function P(t){if(t.pointerId!==f)return;const n=t.clientX-p.x,s=t.clientY-p.y,a=window.innerWidth,r=window.innerHeight,l=(null==d?void 0:d())??!1;let h=p.width,u=p.height,m=p.posX,v=p.posY;if(l){if(c.includes("e")||c.includes("w")){const t=c.includes("e")?n:-n;h=Math.max(i,p.width+2*t),m=p.centerX-h/2}if(c.includes("s")||c.includes("n")){const t=c.includes("s")?s:-s;u=Math.max(e,p.height+2*t),v=p.centerY-u/2}}else{if(c.includes("e")){const t=a-m;h=Math.max(i,Math.min(p.width+n,t))}if(c.includes("w")){const t=p.width-i,e=Math.min(n,t);h=p.width-e,m=p.posX+e}if(c.includes("s")){const t=r-v;u=Math.max(e,Math.min(p.height+s,t))}if(c.includes("n")){const t=p.height-e,i=Math.min(s,t);u=p.height-i,v=p.posY+i}}const y=at(m,v,h,u);g={width:y.width,height:y.height},o({x:y.x,y:y.y}),w.emit("resizeMove",{size:{...g},position:{x:y.x,y:y.y}}),x()}function I(t){if(t.pointerId!==f)return;h=!1,c="",f=null,v&&window.removeEventListener("pointermove",v),y&&(window.removeEventListener("pointerup",y),window.removeEventListener("pointercancel",y)),v=null,y=null,m=!0;const i=n();w.emit("resizeEnd",{size:{...g},position:i}),l&&l(i,{...g}),x(),setTimeout(()=>{m=!1},0)}return{getState:z,getSize:()=>({...g}),isResizing:()=>h,hasBeenResized:()=>u,justFinishedResizing:()=>m,setSize:function(t){g={...t},u=!0,x()},reset:function(){u=!1,g={width:0,height:0},h=!1,c="",x()},constrainToViewport:function(){const t=n(),i=r();if(!i)return;const e=at(t.x,t.y,g.width||i.offsetWidth,g.height||i.offsetHeight);g={width:e.width,height:e.height},o({x:e.x,y:e.y}),x()},startResize:function(t,i){t.preventDefault(),t.stopPropagation();const e=r();if(!e)return;const d=e.getBoundingClientRect();s()||(o({x:d.left,y:d.top}),a(!0)),u||(g={width:d.width,height:d.height},u=!0);const l=n();h=!0,c=i,f=t.pointerId,p={x:t.clientX,y:t.clientY,width:g.width,height:g.height,posX:l.x,posY:l.y,centerX:l.x+g.width/2,centerY:l.y+g.height/2},v=P,y=I,window.addEventListener("pointermove",v),window.addEventListener("pointerup",y),window.addEventListener("pointercancel",y),w.emit("resizeStart",{direction:i}),x()},subscribe:function(t){return w.on("change",t)},destroy:function(){v&&window.removeEventListener("pointermove",v),y&&(window.removeEventListener("pointerup",y),window.removeEventListener("pointercancel",y)),w.off()}}}({minWidth:(null==(n=null==(e=t.config)?void 0:e.appearance)?void 0:n.minWidth)??q().appearance.minWidth,minHeight:(null==(s=null==(o=t.config)?void 0:o.appearance)?void 0:s.minHeight)??q().appearance.minHeight,getPosition:()=>this.drag.getPosition(),setPosition:t=>this.drag.setPosition(t),getHasBeenDragged:()=>this.drag.hasBeenDragged(),setHasBeenDragged:t=>this.drag.setHasBeenDragged(t),getElement:()=>this.element,onResizeEnd:(t,i)=>this.handleResizeEnd(t,i)}),this.animation=function(t){const{getId:i,getElement:e,getPosition:n,setPosition:o,getHasBeenDragged:s,setHasBeenDragged:a,getHasBeenResized:r,getSize:d,areAnimationsEnabled:l=()=>!0,onMinimizeComplete:h,onOpenStart:c}=t;let g="none",u=!1,m=null,p=null,f=null,w=null,v=null,y=null,z=null;const x=di();function P(){return{type:g,isAnimating:u,transform:m?{...m}:null}}function I(){x.emit("change",P())}function M(){y&&(clearTimeout(y),y=null)}function b(){const t=e();t&&!z&&(z=function(t,i){const e=e=>{e.target===t&&i(e.animationName)};return t.addEventListener("animationend",e),()=>t.removeEventListener("animationend",e)}(t,C))}function C(t){switch(M(),t){case"modal-genie-minimize":"minimize"===g&&A();break;case"modal-genie-restore":"restore"===g?B():"open"===g&&D();break;case"modal-close":case"modal-close-centered":case"modal-child-disappear":"close"===g&&S();break;case"modal-child-appear":"open"===g&&D()}}function A(){"minimize"===g&&(M(),w?(w(),w=null):v&&(null==h||h(v.position,!0,v.size)),x.emit("animationEnd",{type:"minimize"}),v=null)}function B(){if("restore"!==g)return;M(),g="none",u=!1,m=null;const t=e();t&&(t.setAttribute("data-state","open"),t.setAttribute("data-animation-phase","idle")),x.emit("animationEnd",{type:"restore"}),I()}function D(){if("open"!==g)return;M(),g="none",u=!1,m=null;const t=e();t&&(t.setAttribute("data-state","open"),t.setAttribute("data-animation-phase","idle")),x.emit("animationEnd",{type:"open"}),I()}function S(){if("close"!==g)return;M(),g="none",u=!1;const t=e();t&&(t.setAttribute("data-state","closed"),t.setAttribute("data-animation-phase","idle")),x.emit("animationEnd",{type:"close"}),f&&(f(),f=null),I()}return{getState:P,isAnimating:()=>u,getAnimationType:()=>g,getTransform:()=>m?{...m}:null,getPendingOpenSource:()=>p?{...p}:null,setPendingOpenSource:t=>{p=t?{...t}:null},startMinimize:function(t,c){const p=e();if(u||!p)return!1;if(b(),M(),!l()){const t=p.getBoundingClientRect(),i=s()?n():{x:t.left,y:t.top},e=r()?d():{width:t.width,height:t.height};return s()||(o(i),a(!0)),c?c():null==h||h(i,!0,e),!0}const f=p.getBoundingClientRect(),z=s()?n():{x:f.left,y:f.top},P=r()?d():{width:f.width,height:f.height};s()||(o(z),a(!0));const C=t??wi(i());return m=function(t,i,e){const n=t.x+i.width/2,o=t.y+i.height/2;return{x:e.x-n,y:e.y-o,originX:e.x-t.x,originY:e.y-t.y}}(z,P,C),w=c||null,v={position:z,size:P},p.setAttribute("data-state","minimizing"),p.setAttribute("data-animation-phase","prepare"),requestAnimationFrame(()=>{requestAnimationFrame(()=>{g="minimize",u=!0,p.setAttribute("data-animation-phase","animate"),x.emit("animationStart",{type:"minimize"}),I()})}),y=setTimeout(()=>{"minimize"===g&&A()},600),!0},startRestore:function(t,n){const s=e();if(b(),M(),!l()){const i=t||{x:window.innerWidth/2,y:window.innerHeight/2};return o(i),void a(!0)}const r=wi(i()),d=t||{x:window.innerWidth/2,y:window.innerHeight/2},h=n||{width:480,height:400};o(d),a(!0),m=function(t,i,e){const n=t.x+i.width/2,o=t.y+i.height/2;return{x:e.x-n,y:e.y-o,originX:e.x-t.x,originY:e.y-t.y}}(d,h,r),g="restore",u=!0,s&&(s.setAttribute("data-state","restoring"),s.setAttribute("data-animation-phase","animate")),x.emit("animationStart",{type:"restore"}),I(),y=setTimeout(()=>{"restore"===g&&B()},500)},startOpen:function(){const t=e();if(!p||!t||u)return!1;if(b(),M(),!l())return p=null,!1;const i=p,r=t.getBoundingClientRect(),d=s()?n():{x:r.left,y:r.top},h=r.width,f=r.height;return s()||(o(d),a(!0)),m=function(t,i,e){const n=t.x+i.width/2,o=t.y+i.height/2;return{x:e.x-n,y:e.y-o,originX:e.x-t.x,originY:e.y-t.y}}(d,{width:h,height:f},i),g="open",u=!0,p=null,t.setAttribute("data-state","opening"),t.setAttribute("data-animation-phase","animate"),x.emit("animationStart",{type:"open"}),null==c||c(),I(),y=setTimeout(()=>{"open"===g&&D()},500),!0},startClose:function(t){const i=e();return!u&&(b(),M(),l()?(f=t,g="close",u=!0,i&&(i.setAttribute("data-state","closing"),i.setAttribute("data-animation-phase","animate")),x.emit("animationStart",{type:"close"}),I(),y=setTimeout(()=>{"close"===g&&S()},350),!0):(t(),!0))},forceClearMinimize:function(){M(),"minimize"===g&&(g="none",u=!1,m=null,w=null,v=null,I())},destroy:function(){M(),null==z||z(),z=null,x.off()},subscribe:t=>x.on("change",t)}}({getId:()=>this.id,getElement:()=>this.element,getPosition:()=>this.drag.getPosition(),setPosition:t=>this.drag.setPosition(t),getHasBeenDragged:()=>this.drag.hasBeenDragged(),setHasBeenDragged:t=>this.drag.setHasBeenDragged(t),getHasBeenResized:()=>this.resize.hasBeenResized(),getSize:()=>this.resize.getSize(),areAnimationsEnabled:()=>this.options.configHelper.isFeatureEnabled("animations"),onMinimizeComplete:(t,i,e)=>{bt(this.id,{position:t,size:e,hasBeenDragged:i}),Tt(this.id)},onOpenStart:()=>{const t=ft(this.id);(null==t?void 0:t.parentId)&&(this.stateManager.wasRestored=!0)}}),this.positioning=new yi({id:this.id,dataId:this.dataId,configHelper:t.configHelper,getDragBehavior:()=>this.drag,getElement:()=>this.element}),this.interactions=new xi({id:this.id,configHelper:t.configHelper,getDragBehavior:()=>this.drag,getResizeBehavior:()=>this.resize,getElement:()=>this.element,getState:()=>{var t;return{hasChild:!!(null==(t=ft(this.id))?void 0:t.childId)}},onDragMove:()=>{if("realtime"===q().parentChild.movementMode){const t=this.drag.getPosition();It(this.id,t,{drag:!0,realtime:!0})}},onDragEnd:()=>{const t=this.drag.getPosition();It(this.id,t,{drag:!0}),"animated"===q().parentChild.movementMode&&ni(this.id)},onClose:()=>this.close(),closeOnEscape:t.closeOnEscape,isTopModal:()=>et(this.id)}),this.stateManager=new Pi({id:this.id,options:{glow:t.glow,openSourcePosition:t.openSourcePosition,onClose:t.onClose},getDragBehavior:()=>this.drag,getResizeBehavior:()=>this.resize,getAnimationController:()=>this.animation,getElement:()=>this.element,getPositioning:()=>this.positioning,onStateChange:()=>this.notifyStateChange(),focusFirst:()=>this.interactions.focusFirst()}),ii(t.id)&&(this.stateManager.wasRestored=!0),this.lifecycle=new fi({onMount:()=>{this.handleStateChange(),this.handlePendingStates(),this.notifyStateChange()},onDestroy:()=>{var t;null==(t=this.unsubscribeState)||t.call(this),this.drag.destroy(),this.resize.destroy(),this.animation.destroy(),this.emitter.off()},onWindowResize:()=>this.handleWindowResize()}),this.drag.subscribe(()=>this.notifyStateChange()),this.resize.subscribe(()=>this.notifyStateChange()),this.animation.subscribe(()=>{this.handlePendingStates(),this.notifyStateChange()}),this.unsubscribeState=L(()=>{this.handleStateChange(),this.handlePendingStates(),this.notifyStateChange()}),t.skipRegistration||this.register(t.autoOpen??!1),this.handleStateChange(),this.handlePendingStates()}mount(t){this.lifecycle.mount(t)}destroy(){this.lifecycle.destroy()}get element(){return this.lifecycle.getElement()}handleWindowResize(){if(!this.element||!this.drag.hasBeenDragged())return;const t=this.resize.hasBeenResized()?this.resize.getSize():{width:this.element.offsetWidth,height:this.element.offsetHeight};this.positioning.constrainToViewport(t),this.resize.hasBeenResized()&&this.resize.constrainToViewport(),this.notifyStateChange()}register(t){Q({id:this.id,title:this.options.title,icon:this.options.icon??"",isOpen:t,isMinimized:!1,isHiddenWithParent:!1,isTransparent:!1,isRejected:!1,position:null,size:null,hasBeenDragged:!1,dockPosition:0,glow:this.options.glow??null,parentId:void 0,childId:void 0,offsetFromParent:void 0}),t&&it(this.id)}getState(){if(this.cachedState)return this.cachedState;const t=ft(this.id),i=this.drag.getState(),e=this.resize.getState(),n=this.animation.getState(),o=!!t&&(t.isOpen||Ut(this.id))&&(!t.isMinimized||jt(this.id))&&(!t.isHiddenWithParent||Nt(this.id)||ti(this.id)),s=!!(null==t?void 0:t.childId),a=!!(null==t?void 0:t.parentId),r="minimize"===n.type&&n.isAnimating,d="restore"===n.type&&n.isAnimating,l="open"===n.type&&n.isAnimating,h="close"===n.type&&n.isAnimating,c=n.isAnimating,g=(null==t?void 0:t.isAnimatingPosition)??!1,u=g&&(null==t?void 0:t.position)?t.position:i.position,m=!!g||i.hasBeenDragged,p=(ti(this.id)||Zt(this.id))&&!d,f=(a||ii(this.id))&&!l&&(!m||!!this.animation.getPendingOpenSource()),w=d||l||this.stateManager.restoreHold,v=o&&!m&&!c&&!this.animation.getPendingOpenSource()&&!p&&!f;let y="closed";r?y="minimizing":d?y="restoring":l?y="opening":h?y="closing":(null==t?void 0:t.isMinimized)?y="minimized":o&&(y="open");const z=this.options.configHelper.isFeatureEnabled("drag"),x=this.options.configHelper.isFeatureEnabled("resize"),P=this.options.configHelper.isFeatureEnabled("minimize"),I=!!this.options.glow,M=function(t){const i={"z-index":t.zIndex};return t.animationTransform?(i.left=`${t.position.x}px`,i.top=`${t.position.y}px`,i["--genie-origin-x"]=`${t.animationTransform.originX}px`,i["--genie-origin-y"]=`${t.animationTransform.originY}px`,i["--genie-translate-x"]=`${t.animationTransform.x}px`,i["--genie-translate-y"]=`${t.animationTransform.y}px`):t.hasBeenDragged&&(i.left=`${t.position.x}px`,i.top=`${t.position.y}px`,t.isAnimatingPosition||(i.transform="none")),t.hasBeenResized?(i.width=`${t.size.width}px`,i.height=`${t.size.height}px`,i["max-width"]="none",i["max-height"]="none"):(t.preferredHeight&&(i["min-height"]=t.preferredHeight),t.maxWidth&&(i["max-width"]=t.maxWidth)),t.glowEnabled&&t.glow&&(i["--modal-glow-color"]=t.glow.color,i["--modal-glow-intensity"]=String(t.glow.intensity??"medium")),i}({position:u,hasBeenDragged:m,hasBeenResized:e.hasBeenResized,size:e.size,animationTransform:n.transform,zIndex:(null==t?void 0:t.zIndex)??1e3,glowEnabled:I,glow:this.options.glow??null,maxWidth:this.options.maxWidth,preferredHeight:this.options.preferredHeight,isAnimatingPosition:g}),b=function(t){const i=["modal-dialog"];return t.isDragging&&i.push("modal-dragging"),t.isResizing&&i.push("modal-resizing"),t.hasBeenDragged&&i.push("modal-positioned"),t.isMinimizing&&i.push("modal-minimizing"),t.isRestoring&&i.push("modal-restoring"),t.isOpening&&i.push("modal-opening"),t.isClosing&&i.push("modal-closing"),t.showCentered&&i.push("modal-centered"),t.isTransparent||i.push("modal-solid"),t.isTransparent&&i.push("modal-transparent"),t.glowEnabled&&i.push("modal-glow"),t.hasChild&&i.push("modal-has-child"),t.isChildModal&&i.push("modal-is-child"),t.wasRestored&&i.push("modal-was-restored"),t.isVisibleByAnimation&&i.push("modal-visible-by-animation"),t.isAwaitingRestore&&i.push("modal-awaiting-restore"),t.isAwaitingChildOpen&&i.push("modal-awaiting-child-open"),t.isAnimatingToCenter&&i.push("modal-animating-to-center"),t.isAnimatingPosition&&i.push("modal-animating-position"),t.isAttentionAnimating&&i.push("modal-attention"),t.glowStabilizing&&t.glowEnabled&&i.push("modal-glow-stabilizing"),i}({isDragging:i.isDragging,isResizing:e.isResizing,hasBeenDragged:m,isMinimizing:r,isRestoring:d,isOpening:l,isClosing:h,showCentered:v,isTransparent:(null==t?void 0:t.isTransparent)??!1,glowEnabled:I,hasChild:s,isChildModal:a,wasRestored:this.stateManager.wasRestored,isVisibleByAnimation:w,isAwaitingRestore:p,isAwaitingChildOpen:f,isAnimatingToCenter:this.stateManager.isAnimatingToCenter,isAnimatingPosition:(null==t?void 0:t.isAnimatingPosition)??!1,isAttentionAnimating:this.stateManager.isAttentionAnimating,glowStabilizing:this.stateManager.glowStabilizing});return this.cachedState={position:i.position,size:e.size,zIndex:(null==t?void 0:t.zIndex)??1e3,isDragging:i.isDragging,isResizing:e.isResizing,hasBeenDragged:i.hasBeenDragged,hasBeenResized:e.hasBeenResized,isMinimizing:r,isRestoring:d,isOpening:l,isClosing:h,isAnyAnimating:c,animationTransform:n.transform,isVisible:o,showCentered:v,isAwaitingRestore:p,isAwaitingChildOpen:f,isVisibleByAnimation:w,hasChild:s,isChildModal:a,showOverlay:s||this.overlayClosing,isTransparent:(null==t?void 0:t.isTransparent)??!1,isAttentionAnimating:this.stateManager.isAttentionAnimating,glowStabilizing:this.stateManager.glowStabilizing,isAnimatingPosition:(null==t?void 0:t.isAnimatingPosition)??!1,isAnimatingToCenter:this.stateManager.isAnimatingToCenter,wasRestored:this.stateManager.wasRestored,overlayClosing:this.overlayClosing,glowEnabled:I,draggable:z,resizable:x,minimizable:P,dataState:y,dataAnimationPhase:n.isAnimating?"animate":"idle",style:M,cssClasses:b},this.cachedState}subscribe(t){return this.emitter.on("stateChange",t)}notifyStateChange(){this.cachedState=null,this.emitter.emit("stateChange",this.getState())}startDrag(t){this.interactions.startDrag(t)}startResize(t,i){this.interactions.startResize(t,i)}handlePointerMove(t){this.interactions.handlePointerMove(t)}handlePointerUp(t){this.interactions.handlePointerUp(t)}handleKeyDown(t){this.interactions.handleKeyDown(t)}handleTabKey(t){this.interactions.handleTabKey(t)}minimize(){this.options.configHelper.isFeatureEnabled("minimize")&&Tt(this.id)}close(){var t,i;Jt(this.id)&&Qt(this.id),Xt(this.id),null==(i=(t=this.options).onClose)||i.call(t)}toggleTransparency(){Lt(this.id)}bringToFront(){it(this.id)}setOpenSourcePosition(t){this.animation.setPendingOpenSource(t)}updateGlow(t){this.options.glow!==t&&(this.options.glow=t,bt(this.id,{glow:t??null}),this.notifyStateChange())}focusFirst(){this.interactions.focusFirst()}handleResizeEnd(t,i){const e=ft(this.id);if(null==e?void 0:e.parentId){const n=ft(e.parentId),o=mt(e.parentId);if(n&&o){const e=n.position??{x:o.getBoundingClientRect().left,y:o.getBoundingClientRect().top},s=n.size??{width:o.offsetWidth,height:o.offsetHeight},a={x:e.x+(s.width-i.width)/2,y:e.y+(s.height-i.height)/2},r=t;this.stateManager.isAnimatingToCenter=!0,this.drag.setPosition(a);const d={x:a.x-e.x,y:a.y-e.y};bt(this.id,{position:a,size:i,hasBeenDragged:!0,offsetFromParent:d});const l=this.lifecycle.getElement();return void(l?pt(l,r,a,{duration:200,onComplete:()=>{this.stateManager.isAnimatingToCenter=!1}}):this.stateManager.isAnimatingToCenter=!1)}}bt(this.id,{position:t,size:i,hasBeenDragged:!0})}handleStateChange(){const t=ft(this.id);if(t){if((t.parentId||ii(this.id))&&(this.stateManager.wasRestored=!0),!this.drag.isDragging()&&!this.resize.isResizing()&&t.position){const i=this.drag.getPosition(),e=t.position;(Math.abs(i.x-e.x)>.5||Math.abs(i.y-e.y)>.5)&&(this.drag.setPosition(e),t.hasBeenDragged&&this.drag.setHasBeenDragged(!0))}this.stateManager.handlePendingStates()}}handlePendingStates(){this.stateManager.handlePendingStates()}getId(){return this.id}getDataId(){return this.dataId}getElement(){return this.element}}function Mi(){const t=zt();return Array.from(t.values()).filter(t=>t.isMinimized).sort((t,i)=>t.dockPosition-i.dockPosition)}function bi(t,i,e){const n=st(t.x,t.y,i,e);return{x:Math.round(n.x),y:Math.round(n.y)}}function Ci(t,i,e,n,o,s=8){const a=window.innerWidth-n-s,r=window.innerHeight-o-s,d=Math.min(Math.max(t-e.x,s),Math.max(s,a)),l=Math.min(Math.max(i-e.y,s),Math.max(s,r));return{x:Math.round(d),y:Math.round(l)}}function Ai(t,i){const e=["modal-dock-container"];return"left"===t?e.push("modal-dock-left"):"right"===t?e.push("modal-dock-right"):"bottom"===t?e.push("modal-dock-bottom"):"free"===t&&e.push("modal-dock-free"),i&&e.push("modal-dock-empty"),e.join(" ")}function Bi(t,i){const e=["modal-dock"];return"free"===t&&e.push("horizontal"===i?"modal-dock-free-horizontal":"modal-dock-free-vertical"),e.join(" ")}function Di(){const t=zt();return Array.from(t.values()).some(t=>t.isOpen&&!t.isMinimized&&!t.isHiddenWithParent)}function Si(){return G(q().features.backdrop)}function Hi(){const t=Si();return t.visible||t.blockClicks}export{Bi as A,zt as B,li as C,Yt as D,Xt as E,Tt as F,Vt as G,_t as H,vt as I,N as J,hi as K,ci as L,Ii as M,qt as N,K as O,xt as P,ft as Q,gi as R,wt as S,nt as T,Ft as U,Lt as V,ui as a,it as b,U as c,J as d,Hi as e,Si as f,X as g,Di as h,et as i,ai as j,q as k,si as l,Ht as m,ri as n,Rt as o,yt as p,Wt as q,Q as r,Gt as s,ut as t,Z as u,L as v,Mi as w,Ai as x,Ci as y,bi as z};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "epic-modals",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
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",
|
|
@@ -17,6 +17,13 @@
|
|
|
17
17
|
"author": "Damian Lesiuk",
|
|
18
18
|
"license": "MIT",
|
|
19
19
|
"homepage": "https://epicmodals.eu",
|
|
20
|
+
"repository": {
|
|
21
|
+
"type": "git",
|
|
22
|
+
"url": "https://github.com/Lesiuk/epic-modals.git"
|
|
23
|
+
},
|
|
24
|
+
"bugs": {
|
|
25
|
+
"url": "https://github.com/Lesiuk/epic-modals/issues"
|
|
26
|
+
},
|
|
20
27
|
"type": "module",
|
|
21
28
|
"main": "./dist/index.js",
|
|
22
29
|
"module": "./dist/index.js",
|