epic-modals 1.0.1 → 1.0.3
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.d.ts +1562 -0
- package/dist/core.js +1 -1
- package/dist/react.d.ts +101 -12
- package/dist/react.js +1 -1
- package/dist/styles/all.css +1 -0
- package/dist/styles/basic.css +1 -0
- package/dist/styles/showcase.css +1 -0
- package/dist/svelte.d.ts +227 -19
- package/dist/svelte.js +1 -1
- package/dist/vanilla.d.ts +148 -3
- package/dist/vanilla.js +1 -1
- package/package.json +11 -20
- package/dist/core/animation/controller.d.ts +0 -58
- package/dist/core/animation/flip.d.ts +0 -8
- package/dist/core/animation/genie.d.ts +0 -14
- package/dist/core/animation/index.d.ts +0 -6
- package/dist/core/animation/timing.d.ts +0 -34
- package/dist/core/behaviors/drag.d.ts +0 -34
- package/dist/core/behaviors/focusTrap.d.ts +0 -23
- package/dist/core/behaviors/index.d.ts +0 -6
- package/dist/core/behaviors/parentChild.d.ts +0 -27
- package/dist/core/behaviors/resize.d.ts +0 -49
- package/dist/core/config/defaults.d.ts +0 -90
- package/dist/core/config/index.d.ts +0 -4
- package/dist/core/config/resolution.d.ts +0 -25
- package/dist/core/index.d.ts +0 -9
- package/dist/core/modal/Controller.d.ts +0 -70
- package/dist/core/modal/Controller.types.d.ts +0 -77
- package/dist/core/modal/Interactions.d.ts +0 -67
- package/dist/core/modal/Lifecycle.d.ts +0 -20
- package/dist/core/modal/Positioning.d.ts +0 -40
- package/dist/core/modal/StateManager.d.ts +0 -91
- package/dist/core/modal/Styling.d.ts +0 -42
- package/dist/core/modal/index.d.ts +0 -8
- package/dist/core/state/effects.d.ts +0 -16
- package/dist/core/state/events.d.ts +0 -15
- package/dist/core/state/getters.d.ts +0 -37
- package/dist/core/state/index.d.ts +0 -17
- package/dist/core/state/internal.d.ts +0 -105
- package/dist/core/state/layout.d.ts +0 -17
- package/dist/core/state/minimize.d.ts +0 -18
- package/dist/core/state/open-close.d.ts +0 -21
- package/dist/core/state/parent-child.d.ts +0 -17
- package/dist/core/state/pending.d.ts +0 -55
- package/dist/core/state/position.d.ts +0 -15
- package/dist/core/state/registration.d.ts +0 -15
- package/dist/core/state/stacking.d.ts +0 -10
- package/dist/core/state/zindex.d.ts +0 -8
- package/dist/core/types.d.ts +0 -191
- package/dist/core/utils/backdrop.d.ts +0 -8
- package/dist/core/utils/constants.d.ts +0 -193
- package/dist/core/utils/dock.d.ts +0 -12
- package/dist/core/utils/dom.d.ts +0 -31
- package/dist/core/utils/helpers.d.ts +0 -8
- package/dist/core/utils/index.d.ts +0 -8
- package/dist/core/utils/viewport/constraints.d.ts +0 -7
- package/dist/core/utils/viewport/index.d.ts +0 -7
- package/dist/core/utils/viewport/overlap.d.ts +0 -30
- package/dist/core/utils/viewport/smart-layout.d.ts +0 -3
- package/dist/core/utils/viewport/smart-position.d.ts +0 -36
- package/dist/core/utils/viewport/types.d.ts +0 -56
- package/dist/core/utils/viewport.d.ts +0 -3
- package/dist/epic-modals.css +0 -47
- package/dist/index.d.ts +0 -2
- package/dist/index.js +0 -1
- package/dist/react/components/Backdrop.d.ts +0 -7
- package/dist/react/components/ModalProvider.d.ts +0 -10
- package/dist/react/components/Portal.d.ts +0 -10
- package/dist/react/components/dock/Dock.d.ts +0 -7
- package/dist/react/components/dock/DockItem.d.ts +0 -16
- package/dist/react/components/modal/Modal.d.ts +0 -10
- package/dist/react/components/modal/ModalHeader.d.ts +0 -13
- package/dist/react/components/modal/ModalInner.d.ts +0 -17
- package/dist/react/components/modal/ResizeHandles.d.ts +0 -9
- package/dist/react/components/wizard/WizardModal.d.ts +0 -33
- package/dist/react/components/wizard/WizardStep.d.ts +0 -15
- package/dist/react/context.d.ts +0 -11
- package/dist/react/hooks/useConfig.d.ts +0 -25
- package/dist/react/hooks/useModal.d.ts +0 -23
- package/dist/runtime.js +0 -1
- package/dist/styles/animations.css +0 -1
- package/dist/styles/backdrop.css +0 -1
- package/dist/styles/index.css +0 -1
- package/dist/styles/modal.css +0 -1
- package/dist/styles/themes/dark.css +0 -1
- package/dist/styles/themes/light.css +0 -1
- package/dist/styles/variables.css +0 -1
- package/dist/svelte/actions/appendElement.d.ts +0 -6
- package/dist/svelte/components/Backdrop.svelte.d.ts +0 -1
- package/dist/svelte/components/ModalProvider.svelte.d.ts +0 -1
- package/dist/svelte/components/Portal.svelte.d.ts +0 -1
- package/dist/svelte/components/dock/Dock.svelte.d.ts +0 -1
- package/dist/svelte/components/modal/Modal.svelte.d.ts +0 -1
- package/dist/svelte/components/modal/ModalHeader.svelte.d.ts +0 -1
- package/dist/svelte/components/modal/ModalInner.svelte.d.ts +0 -1
- package/dist/svelte/components/modal/ResizeHandles.svelte.d.ts +0 -1
- package/dist/svelte/components/wizard/WizardModal.svelte.d.ts +0 -1
- package/dist/svelte/components/wizard/WizardStep.svelte.d.ts +0 -1
- package/dist/svelte/context.d.ts +0 -8
- package/dist/svelte/hooks/index.d.ts +0 -10
- package/dist/svelte/hooks/useFocusTrap.svelte.d.ts +0 -11
- package/dist/svelte/hooks/useModal.svelte.d.ts +0 -37
- package/dist/svelte/hooks/useModalConfig.svelte.d.ts +0 -27
- package/dist/svelte/hooks/useModalZIndex.svelte.d.ts +0 -10
- package/dist/svelte/hooks/usePortal.svelte.d.ts +0 -8
- package/dist/svelte/hooks/useWindowEvent.svelte.d.ts +0 -7
- package/dist/svelte/stores.svelte.d.ts +0 -6
- package/dist/svelte/wizardContext.svelte.d.ts +0 -36
- package/dist/ui.js +0 -1
- package/dist/vanilla/VanillaBackdrop.d.ts +0 -14
- package/dist/vanilla/VanillaDock.d.ts +0 -24
- package/dist/vanilla/VanillaModal.d.ts +0 -76
- package/dist/vanilla/index.d.ts +0 -47
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]),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 e=Object.defineProperty,t=(t,i,n)=>((t,i,n)=>i in t?e(t,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[i]=n)(t,"symbol"!=typeof i?i+"":i,n);const i=Symbol.for("epic-modals-core");if(typeof globalThis<"u"){const e=globalThis;e[i],e[i]=!0}const n=new Map;let o=0,s=null;function a(e){s=e}let r=null;function d(e){r=e}const l=new Set;let h=!1,c=!1,g=!1,u=[],m=[],p=[],f=[],w=[],y=[],z=[],v=[],M=[],P=null;function C(e){P=e}const x=new Map;let I=null;function b(e){I=e}const A=new Map,k=new Set,S=new Set,R=new Set;let D=[];function E(e){D=e}let B=null;function H(e){B=e}let T=null;function O(e){T=e}let F=null;function L(e){F=e}function W(e){u=e}function _(e){m=e}function G(e){p=e}function $(e){f=e}function V(e){w=e}function N(e){y=e}function Y(e){z=e}function X(e){v=e}function q(e){M=e}function U(){if(!g){g=!0;try{l.forEach(e=>e())}finally{g=!1}}}function j(){o++,h?c=!0:U()}function K(){return o}function Z(e){return l.add(e),()=>l.delete(e)}function J(e){const t=h;h=!0;try{e()}finally{h=t,!t&&c&&(c=!1,queueMicrotask(()=>{U()}))}}function Q(e,t){if(e.width<=0||e.height<=0)throw new Error(`[epic-modals] Invalid dimensions in ${t}: width=${e.width}, height=${e.height}`)}function ee(e,t){return!!n.get(e)||(function(){var e,t;try{const i=import.meta;return!0===(null==(e=i.env)?void 0:e.DEV)||"development"===(null==(t=i.env)?void 0:t.MODE)}catch{return!1}}(),!1)}function te(){n.clear(),u=[],m=[],p=[],f=[],w=[],y=[],z=[],v=[],M=[],P=null,x.clear(),I=null,A.clear(),k.clear(),S.clear(),R.clear(),D=[],B=null,T=null,F=null,s&&(clearTimeout(s),s=null),r&&(clearTimeout(r),r=null)}function ie(){return{modals:n,pendingMinimize:u,pendingOpen:m,pendingClose:p,pendingRestore:w,dockOrder:D,animatingModals:k,transparentModals:R}}function ne(e){return{id:e.id,title:e.title,icon:e.icon??"",isOpen:e.autoOpen??!1,isMinimized:!1,isHiddenWithParent:!1,isTransparent:!1,isRejected:!1,position:null,size:null,hasBeenDragged:!1,dockPosition:0,glow:e.glow??null,parentId:void 0,childId:void 0,offsetFromParent:void 0}}function oe(e){const t=n.get(e.id);let i;i=null!=t&&t.zIndex?t.zIndex:Math.max(...Array.from(n.values()).map(e=>e.zIndex),mi().zIndex.base-2)+2;const o=m.includes(e.id),s=e.isOpen||o;t?n.set(e.id,{...t,title:e.title,icon:e.icon,glow:e.glow,zIndex:i}):n.set(e.id,{...e,isOpen:s,zIndex:i,isAnimating:!1}),j(),e.isMinimized&&!D.includes(e.id)&&E([...D,e.id])}function se(e){const t=n.get(e);if(t){if(E(D.filter(t=>t!==e)),_(m.filter(t=>t!==e)),G(p.filter(t=>t!==e)),$(f.filter(t=>t!==e)),W(u.filter(t=>t!==e)),V(w.filter(t=>t!==e)),N(y.filter(t=>t!==e)),Y(z.filter(t=>t!==e)),X(v.filter(t=>t!==e)),t.childId){const e=n.get(t.childId);e&&n.set(t.childId,{...e,parentId:void 0})}if(t.parentId){const e=n.get(t.parentId);e&&n.set(t.parentId,{...e,childId:void 0,lastChildId:t.id})}n.delete(e),j(),R.delete(e),k.delete(e)}}function ae(e,t){const i=n.get(e);if(null==i||!i.childId)return;const o=n.get(i.childId);if(!o)return;const s=t+2;n.set(i.childId,{...o,zIndex:s}),ae(i.childId,s)}function re(e){if(!n.get(e))return;const t=Math.max(...Array.from(n.values()).map(e=>e.zIndex),0),i=function(e){let t=e,i=n.get(t);for(;null!=i&&i.parentId;)t=i.parentId,i=n.get(t);return t}(e),o=n.get(i);if(!o)return;const s=t+2;n.set(i,{...o,zIndex:s}),ae(i,s),j()}function de(e){const t=n.get(e);if(!t)return!1;const i=Math.max(...Array.from(n.values()).map(e=>e.zIndex),0);return t.zIndex===i&&!t.isMinimized&&!t.isHiddenWithParent}function le(e,t){if(Array.isArray(e))E(e);else if("number"==typeof t){const i=e,n=[...D],[o]=n.splice(i,1);n.splice(t,0,o),E(n)}}const he=8;function ce(e,t,i,n,o={}){const{margin:s=he,allowPartialVisibility:a=!1}=o,r=typeof window<"u"?window.innerWidth:1920,d=typeof window<"u"?window.innerHeight:1080;let l,h,c,g;return a&&i>r-2*s?(l=40-i,h=r-40):(l=s,h=Math.max(s,r-i-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,e)),y:Math.max(c,Math.min(g,t))}}function ge(e,t,i,n,o={}){const{margin:s=he}=o,a=(typeof window<"u"?window.innerWidth:1920)-2*s,r=(typeof window<"u"?window.innerHeight:1080)-2*s,d=Math.min(i,a),l=Math.min(n,r),h=ce(e,t,d,l,o);return{x:h.x,y:h.y,width:d,height:l}}function ue(e,t){return Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x))*Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y))}function me(e,t,i,n,o,s){const a={x:e-s,y:t-s,width:i+2*s,height:n+2*s};let r=0;for(const e of o)r+=ue(a,e);return r}function pe(e,t){const i=t.x-(e.x+e.width),n=e.x-(t.x+t.width),o=t.y-(e.y+e.height),s=e.y-(t.y+t.height),a=Math.max(i,n,0),r=Math.max(o,s,0);return 0===a&&0===r?0:Math.sqrt(a*a+r*r)}function fe(e){if(typeof document>"u")return[];const t=[];for(const i of e)try{const e=document.querySelectorAll(i);for(const i of e){const e=i.getBoundingClientRect();e.width>0&&e.height>0&&t.push({x:e.left,y:e.top,width:e.width,height:e.height})}}catch{}return t}function we(e,t,i,n,o){let s=i,a=i,r=e-i,d=t-i;for(const i of n){const n=i.y,l=t-(i.y+i.height),h=i.x,c=e-(i.x+i.width);let g;if(i.width>i.height)g=n<=l?"top":"bottom";else if(i.height>i.width)g=h<=c?"left":"right";else{const e=Math.min(n,l,h,c);g=e===n?"top":e===l?"bottom":e===h?"left":"right"}"bottom"===g?d=Math.min(d,i.y-o):"top"===g?a=Math.max(a,i.y+i.height+o):"left"===g?s=Math.max(s,i.x+i.width+o):r=Math.min(r,i.x-o)}return{x:s,y:a,width:Math.max(0,r-s),height:Math.max(0,d-a)}}function ye(e,t,i,n){const o=e-t,s=i-1;if(o<=0)return{interGap:0,edgeGap:0};if(i<=1)return{interGap:0,edgeGap:o/2};const a=o/(i+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 ze(e,t,i,n,o=0){if(0===i.length)return{cols:e,rows:t,score:1/0,positions:new Map};const s=new Array(e).fill(0),a=new Array(t).fill(0);for(let t=0;t<i.length;t++){const n=t%e,o=Math.floor(t/e);s[n]=Math.max(s[n],i[t].width),a[o]=Math.max(a[o],i[t].height)}const r=s.reduce((e,t)=>e+t,0),d=a.reduce((e,t)=>e+t,0);if(r>n.width||d>n.height)return null;const{interGap:l,edgeGap:h}=ye(n.width,r,e,o),{interGap:c,edgeGap:g}=ye(n.height,d,t,o),u=new Map,m=[0];for(let t=0;t<e;t++)m.push(m[t]+s[t]);const p=[0];for(let e=0;e<t;e++)p.push(p[e]+a[e]);for(let t=0;t<i.length;t++){const o=t%e,r=Math.floor(t/e),d=i[t],f=n.x+h+o*l+m[o],w=n.y+g+r*c+p[r],y=f+(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 f=e>1?l:h,w=t>1?c:g;return{cols:e,rows:t,score:(.6*Math.min(f,w)+.4*Math.sqrt(f*w))*(n.width>n.height==e>=t?1.02:1),positions:u}}function ve(e,t){const i=new Map,n=Math.max(...e.map(e=>e.width)),o=Math.max(...e.map(e=>e.height)),s=n+40*(e.length-1),a=o+40*(e.length-1);let r=t.x+(t.width-s)/2,d=t.y+(t.height-a)/2;r=Math.max(t.x,r),d=Math.max(t.y,d);for(let t=0;t<e.length;t++)i.set(e[t].id,{x:Math.round(r+40*t),y:Math.round(d+40*t)});return i}function Me(e,t,i={}){const{modalGap:n=16,viewportMargin:o=16,avoidBounds:s=[],avoidMargin:a=24}=i,r=typeof window<"u"?window.innerWidth:1920,d=typeof window<"u"?window.innerHeight:1080,l=new Map,h=e.filter(e=>!e.parentId),c=h.map(e=>({id:e.id,width:e.width,height:e.height}));if(t&&c.push({id:t.id,width:t.width,height:t.height}),0===c.length)return{positions:l};const g=new Map(h.map(e=>[e.id,e.currentPosition]));c.sort((e,t)=>{const i=g.get(e.id),n=g.get(t.id);return(i?i.x+e.width/2:1/0)-(n?n.x+t.width/2:1/0)});const u=we(r,d,o,s,a);if(1===c.length){const e=c[0],t=u.x+(u.width-e.width)/2,i=u.y+(u.height-e.height)/2;return l.set(e.id,{x:Math.round(t),y:Math.round(i)}),{positions:l}}const m=c.length;let p=null;for(let e=1;e<=m;e++){const t=ze(e,Math.ceil(m/e),c,u,n);t&&(null===p||t.score>p.score)&&(p=t)}if(p){for(const[e,t]of p.positions)l.set(e,t);return{positions:l}}if(t){const e=h.map(e=>({x:e.currentPosition.x,y:e.currentPosition.y,width:e.width,height:e.height})),i=function(e,t,i,n,o=20){const s=n.x+(n.width-e)/2,a=n.y+(n.height-t)/2;if(0===i.length)return{x:Math.round(s),y:Math.round(a)};const r=n.x,d=Math.max(n.x,n.x+n.width-e),l=n.y,h=Math.max(n.y,n.y+n.height-t);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=e*t,f=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=me(o,a,e,t,i,0),h=p>0?d/p:0,z=Math.hypot(o+e/2-w,a+t/2-y),v=.5*h+.5*(f>0?z/f:0);v<m&&(m=v,u={x:o,y:a})}return{x:Math.round(u.x),y:Math.round(u.y)}}(t.width,t.height,e,u);return l.set(t.id,i),{positions:l}}return{positions:ve(c,u)}}function Pe(e){return e}function Ce(e){return typeof document>"u"?null:document.querySelector(`.modal-dialog[data-modal-id="${e}"]`)}function xe(){return{x:window.innerWidth/2,y:window.innerHeight/2}}const Ie={minimize:500,restore:400,open:400,close:250,attention:300,parentMove:300,parentRetargetInterval:100,centerAfterResize:200,glowStabilize:1e3,overlayFade:200},be=100,Ae={easeOut:"ease-out",easeOutCubic:"cubic-bezier(0.25, 0.1, 0.25, 1)",linear:"linear",easeInOut:"ease-in-out"};function ke(e){switch(e){case"open":return Ie.open;case"close":return Ie.close;case"minimize":return Ie.minimize;case"restore":return Ie.restore;case"attention":return Ie.attention;default:return 0}}function Se(e){switch(e){case"open":case"restore":return Ae.easeOut;case"close":case"minimize":return Ae.easeOutCubic;case"attention":return Ae.easeInOut;default:return Ae.linear}}function Re(e,t,i,n){var o;const s=t.x-i.x,a=t.y-i.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)??Ie.parentMove,d=(null==n?void 0:n.easing)??"ease-out";let l=!1;function h(){var e;l||(l=!0,clearTimeout(g),null==(e=null==n?void 0:n.onComplete)||e.call(n))}e.style.left=`${i.x}px`,e.style.top=`${i.y}px`;const c=e.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+be);return function(){l||(l=!0,clearTimeout(g),c.cancel())}}function De(e){return n.get(e)}function Ee(e){const t=n.get(e);return(null==t?void 0:t.isOpen)??!1}function Be(e){return n.has(e)}function He(e){return k.has(e)}function Te(e,t){t?k.add(e):k.delete(e)}function Oe(){return n}function Fe(){return D}function Le(e){return typeof document>"u"?null:document.querySelector(`[data-dock-item="${e}"]`)}function We(){const e=[];for(const t of n.values()){if(!t.isOpen||t.isMinimized||t.isHiddenWithParent||S.has(t.id))continue;const i=Ce(t.id);if(!i)continue;const n=t.position??{x:i.getBoundingClientRect().left,y:i.getBoundingClientRect().top},o=t.size??{width:i.offsetWidth,height:i.offsetHeight};e.push({id:t.id,width:o.width,height:o.height,currentPosition:n,parentId:t.parentId})}return e}function _e(e){const t=[];for(const i of n.values())if(i.isOpen&&!i.isMinimized&&!i.isHiddenWithParent&&(!e||i.id!==e))if(i.position&&i.size)t.push({x:i.position.x,y:i.position.y,width:i.size.width,height:i.size.height});else{const e=Ce(i.id);if(e){const i=e.getBoundingClientRect();t.push({x:i.left,y:i.top,width:i.width,height:i.height})}}return t}function Ge(e){const t=[];for(const i of n.values())if(i.isOpen&&!i.isMinimized&&!i.isHiddenWithParent&&(!e||i.id!==e))if(i.position&&i.size)t.push({id:i.id,x:i.position.x,y:i.position.y,width:i.size.width,height:i.size.height});else{const e=Ce(i.id);if(e){const n=e.getBoundingClientRect();t.push({id:i.id,x:n.left,y:n.top,width:n.width,height:n.height})}}return t}function $e(e,t,i){if(!ee(e))return;(function(e){if(!Number.isFinite(e.x)||!Number.isFinite(e.y))throw new Error(`[epic-modals] Invalid position in updateModalPosition: x=${e.x}, y=${e.y}`)})(t),null!=i&&i.size&&Q(i.size,"updateModalPosition");const o=n.get(e);if(!o)return;let s=t;if(null!=i&&i.constrain&&o.size&&(s=ce(t.x,t.y,o.size.width,o.size.height)),n.set(e,{...o,position:s,size:(null==i?void 0:i.size)??o.size,hasBeenDragged:o.hasBeenDragged||(null==i?void 0:i.drag)||!1}),o.childId){let t=e,i=s;for(;;){const e=n.get(t);if(null==e||!e.childId)break;const o=n.get(e.childId);if(null==o||!o.offsetFromParent)break;const s={x:i.x+o.offsetFromParent.x,y:i.y+o.offsetFromParent.y};n.set(e.childId,{...o,position:s,hasBeenDragged:!0}),t=e.childId,i=s}}if(o.parentId&&o.offsetFromParent){const t=mi();let a=e,r=o;for(;r.parentId&&r.offsetFromParent;){const o=n.get(r.parentId);if(!o)break;const d=a===e?s:n.get(a).position,l={x:d.x-r.offsetFromParent.x,y:d.y-r.offsetFromParent.y};if(!("animated"!==t.parentChild.movementMode||null!=i&&i.realtime)){A.set(r.parentId,l);break}n.set(r.parentId,{...o,position:l,hasBeenDragged:!0}),a=r.parentId,r=o}}j()}function Ve(e){const t=n.get(e);if(!t||!t.isAnimatingPosition)return;t.isAnimatingPosition=!1;let i=t.childId;for(;i;){const e=n.get(i);e&&(e.isAnimatingPosition=!1),i=null==e?void 0:e.childId}j()}function Ne(e,t){if(!ee(e))return;Q(t,"updateModalSize");const i=n.get(e);i&&(n.set(e,{...i,size:t}),j())}function Ye(e,t){const i=n.get(e);i&&(n.set(e,{...i,...t}),j())}function Xe(e){const t=mi();"smart"===t.positioning.strategy&&(s&&clearTimeout(s),a(setTimeout(()=>{const i=We(),n=fe(t.positioning.avoidElements);qe(Me(i,e,{modalGap:t.positioning.modalGap,viewportMargin:t.positioning.modalGap,avoidBounds:n,avoidMargin:t.positioning.modalGap}).positions),a(null)},50)))}function qe(e){if(0===e.size)return;const t=[];for(const[i,o]of e){const e=n.get(i);if(!e)continue;const s=Ce(i),a=e.position??(s?{x:s.getBoundingClientRect().left,y:s.getBoundingClientRect().top}:{x:0,y:0}),r=e.size??(s?{width:s.offsetWidth,height:s.offsetHeight}:{width:0,height:0});t.push({id:i,element:s,oldPosition:a,newPosition:o,size:r}),Ue(i,a,o,t)}for(const{id:e,newPosition:i,size:o}of t){const t=n.get(e);t&&n.set(e,{...t,position:i,size:o,hasBeenDragged:!0,isAnimatingPosition:!0})}j();for(const{id:e,element:i,oldPosition:n,newPosition:o}of t)i?Re(i,n,o,{duration:Ie.parentMove,onComplete:()=>Ve(e)}):setTimeout(()=>Ve(e),Ie.parentMove+be)}function Ue(e,t,i,o){const s=n.get(e);if(null==s||!s.childId)return;const a=n.get(s.childId);if(null==a||!a.offsetFromParent)return;const r=Ce(s.childId),d={x:t.x+a.offsetFromParent.x,y:t.y+a.offsetFromParent.y},l={x:i.x+a.offsetFromParent.x,y:i.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&&Ue(s.childId,d,l,o)}function je(){r&&clearTimeout(r),d(setTimeout(()=>{Xe(null),d(null)},100))}let Ke=!1;function Ze(){Ke||typeof window>"u"||(window.addEventListener("resize",je),Ke=!0)}function Je(){typeof window>"u"||(window.removeEventListener("resize",je),Ke=!1)}function Qe(e){if(0===e.size)return;const t=[];for(const[i,o]of e){const e=n.get(i);if(!e)continue;const s=Ce(i),a=e.position??(s?{x:s.getBoundingClientRect().left,y:s.getBoundingClientRect().top}:{x:0,y:0});t.push({id:i,element:s,oldPosition:a,newPosition:o})}for(const{id:e,newPosition:i}of t){const t=n.get(e);t&&n.set(e,{...t,position:i,hasBeenDragged:!0,isAnimatingPosition:!0})}j();for(const{id:e,element:i,oldPosition:n,newPosition:o}of t)i?Re(i,n,o,{duration:Ie.parentMove,onComplete:()=>Ve(e)}):setTimeout(()=>Ve(e),Ie.parentMove+be)}function et(e){A.delete(e)}function tt(e){const t=n.get(e);if(null==t||!t.childId)return;const i=n.get(t.childId);i&&(z.includes(t.childId)||Y([...z,t.childId]),i.childId&&tt(t.childId))}function it(e){const t=n.get(e);if(!t||t.isMinimized)return;if(et(e),t.parentId){const e=n.get(t.parentId);if(e&&!e.isMinimized)return void it(t.parentId)}if(W([...u,e]),t.position&&t.size&&T){const i=T(),n=D.indexOf(e);C({x:i.x+n*(i.height+8),y:i.y,originX:t.position.x+t.size.width/2,originY:t.position.y+t.size.height/2})}const i=t.childId;n.set(e,{...t,isMinimized:!0,lastChildId:i}),D.includes(e)||E([...D,e]),j(),t.childId&&tt(e),Xe(null)}function nt(e){const t=n.get(e);if(!t||!t.isMinimized)return;n.set(e,{...t,isMinimized:!1,isOpen:!0}),V([...w,e]),re(e);const i=t.lastChildId||t.childId;i&&st(i),j()}function ot(){Array.from(n.values()).filter(e=>e.isMinimized).map(e=>e.id).forEach(e=>{const t=n.get(e);if(t){n.set(e,{...t,isMinimized:!1,isOpen:!0}),V([...w,e]),re(e);const i=t.lastChildId||t.childId;i&&st(i)}}),E([]),j()}function st(e){const t=n.get(e);if(t&&t.isHiddenWithParent){N([...y,e]);const i=t.lastChildId||t.childId;i&&st(i)}}function at(e){const t=n.get(e);!t||!t.isHiddenWithParent||(n.set(e,{...t,isHiddenWithParent:!1}),j())}function rt(e){const t=n.get(e);t&&(n.set(e,{...t,isHiddenWithParent:!0}),j())}function dt(e){const t=n.get(e);if(null==t||!t.childId)return;const i=n.get(t.childId);i&&(i.childId&&dt(t.childId),n.set(t.childId,{...i,isHiddenWithParent:!0}),j())}function lt(e){if(!ee(e))return;const t=n.get(e);R.has(e)?(R.delete(e),n.set(e,{...t,isTransparent:!1})):(R.add(e),n.set(e,{...t,isTransparent:!0})),j()}function ht(e){ee(e)&&(v.includes(e)||(X([...v,e]),j()))}function ct(e){e.classList.add("modal-shake"),e.addEventListener("animationend",()=>{e.classList.remove("modal-shake")},{once:!0})}function gt(e){if(!ee(e))return;const t=n.get(e);n.set(e,{...t,isRejected:!0}),j(),setTimeout(()=>{const t=n.get(e);t&&(n.set(e,{...t,isRejected:!1}),j())},300);const i=Ce(e);i&&ct(i)}function ut(e){if(!ee(e))return;const t=n.get(e);R.delete(e),n.set(e,{...t,isTransparent:!1}),j()}function mt(e){}function pt(e){}function ft(e,t,i){wt(e,i,{parentId:t})}function wt(e,t,i){const o=mi(),s=n.get(e);if(s&&s.isOpen&&!s.isMinimized&&!s.isHiddenWithParent)return ht(e),void re(e);if(s&&s.isMinimized)return void nt(e);if("x"in t&&"y"in t)x.set(e,t);else{const i=t.getBoundingClientRect();x.set(e,{x:i.left+i.width/2,y:i.top+i.height/2})}if(null!=i&&i.parentId&&o.features.parentChild){const t=n.get(i.parentId);null!=t&&t.childId&&t.childId!==e&&zt(t.childId,!0),b({parentId:i.parentId,childId:e})}if(m.includes(e)||_([...m,e]),j(),!s)return void(null!=F&&F.isRegisteredInRegistry(e)&&F.mountModal(e));const a={isOpen:!0};null!=i&&i.parentId&&o.features.parentChild&&(a.parentId=i.parentId),n.set(e,{...s,...a}),re(e),null==B||B.push(e)}function yt(e){oe(e);const t=n.get(e.id);t&&(n.set(e.id,{...t,isOpen:!0}),j()),_([...m,e.id]),j(),re(e.id),null==B||B.push(e.id)}function zt(e,t=!1){const i=n.get(e);if(i&&(i.isOpen||i.isMinimized)){if(et(e),i.childId&&zt(i.childId,t),i.isMinimized)return E(D.filter(t=>t!==e)),Mt(e),void(null==B||B.pop());S.add(e),t?$([...f,e]):G([...p,e]),i.parentId||Xe(null),j(),null==B||B.pop()}}function vt(e){const t=new Set(e??[]);Array.from(n.keys()).filter(e=>!t.has(e)).forEach(e=>zt(e,!0))}function Mt(e){const t=n.get(e);if(t){if(S.delete(e),t.parentId){const i=n.get(t.parentId);i&&i.childId===e&&n.set(t.parentId,{...i,childId:void 0,lastChildId:e})}n.set(e,{...t,isOpen:!1,isMinimized:!1,isHiddenWithParent:!1,isTransparent:!1,position:null,size:null,hasBeenDragged:!1,parentId:void 0,childId:void 0,offsetFromParent:void 0}),j()}}function Pt(e){if(Array.isArray(e)){const t=new Set(e);return Array.from(n.entries()).filter(([e,i])=>i.isOpen&&!t.has(e)).map(([e])=>e)}const t=n.get(e);if(!t)return[e];const i=[e];return t.childId&&i.push(...Pt(t.childId)),i}function Ct(e){return u.includes(e)}function xt(e){W(u.filter(t=>t!==e));const t=P;return C(null),t}function It(e){return z.includes(e)}function bt(e){Y(z.filter(t=>t!==e))}function At(e){return m.includes(e)}function kt(e){_(m.filter(t=>t!==e))}function St(e){return p.includes(e)}function Rt(e){G(p.filter(t=>t!==e))}function Dt(e){return f.includes(e)}function Et(e){$(f.filter(t=>t!==e))}function Bt(e){return w.includes(e)}function Ht(e){V(w.filter(t=>t!==e))}function Tt(e){return y.includes(e)}function Ot(e){N(y.filter(t=>t!==e))}function Ft(e){return v.includes(e)}function Lt(e){X(v.filter(t=>t!==e)),M.includes(e)||q([...M,e])}function Wt(e){q(M.filter(t=>t!==e))}function _t(e){return(null==I?void 0:I.childId)===e}function Gt(e){return A.has(e)}function $t(e){const t=A.get(e)??null;return A.delete(e),t}function Vt(e,t){x.set(e,t)}function Nt(e){return x.get(e)??null}function Yt(e){const t=x.get(e)??null;return x.delete(e),t}function Xt(){const e=P;return C(null),e}function qt(e){const t=I;return e&&(null==t?void 0:t.childId)!==e?null:(b(null),t)}function Ut(e,t,i){const o=n.get(e),s=n.get(t);!o||!s||(n.set(e,{...o,childId:t}),n.set(t,{...s,parentId:e,offsetFromParent:i}),re(t),j())}function jt(){return I}function Kt(e){if("animated"!==mi().parentChild.movementMode)return;const t=n.get(e);if(null==t||!t.parentId||!t.offsetFromParent||!t.position)return;const i={x:t.position.x-t.offsetFromParent.x,y:t.position.y-t.offsetFromParent.y};A.set(t.parentId,i),j()}function Zt(e){return A.get(e)??null}function Jt(e,t,i){const o=n.get(e);if(!o)return null;const s=Ce(e);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-t)/2,y:a.y+(r.height-i)/2}}const Qt={BASE:0,DROPDOWN:100,STICKY:200,OVERLAY:300,MODAL:400,DOCK:8e3,TOAST:9e3};let ei=Qt.MODAL;function ti(){ei=mi().zIndex.base}function ii(){const e=ei;return ei+=2,e}function ni(e){const t=mi();return"MODAL"===e?t.zIndex.base:"DOCK"===e?t.zIndex.dock:"TOAST"===e?t.zIndex.toast:Qt[e]}function oi(){ei=mi().zIndex.base}function si(){const e=new Map;return{on(t,i){let n=e.get(t);return n||(n=new Set,e.set(t,n)),n.add(i),()=>{null==n||n.delete(i),0===(null==n?void 0:n.size)&&e.delete(t)}},emit(t,i){const n=e.get(t);n&&n.forEach(e=>e(i))},off(t){t?e.delete(t):e.clear()},listenerCount(t){var i;return(null==(i=e.get(t))?void 0:i.size)??0}}}function ai(e){return"boolean"==typeof e?{visible:e,blockClicks:e}:e}const ri={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 di={...ri},li=0;const hi=new Set;function ci(e){return hi.add(e),()=>hi.delete(e)}function gi(){hi.forEach(e=>e())}function ui(){return li}function mi(){return di}function pi(e){const t=di;di=wi(di,e),li++,gi(),t.features.dock&&!di.features.dock&&ot()}function fi(){di={...ri},li++,gi()}function wi(e,t){var i;return{features:{...e.features,...t.features},dock:{...e.dock,...t.dock},animations:{...e.animations,...t.animations},appearance:{...e.appearance,...t.appearance},zIndex:{...e.zIndex,...t.zIndex},parentChild:{...e.parentChild,...t.parentChild},positioning:{...e.positioning,...t.positioning,avoidElements:(null==(i=t.positioning)?void 0:i.avoidElements)??e.positioning.avoidElements},portalTarget:t.portalTarget??e.portalTarget}}function yi(e){const t=di.features[e];if("backdrop"===e){const e=ai(t);return e.visible||e.blockClicks}return t}function zi(e,t){const i=mi(),n=t?wi(i,t):i;return{isFeatureEnabled:t=>{var i;if(void 0!==(null==(i=null==e?void 0:e.features)?void 0:i[t])){const i=e.features[t];if("backdrop"===t){const e=ai(i);return e.visible||e.blockClicks}return i}const o=n.features[t];if("backdrop"===t){const e=ai(o);return e.visible||e.blockClicks}return o},getAppearance:t=>{var i;return void 0!==(null==(i=null==e?void 0:e.appearance)?void 0:i[t])?e.appearance[t]:n.appearance[t]},getPositioning:t=>{var i;return void 0!==(null==(i=null==e?void 0:e.positioning)?void 0:i[t])?e.positioning[t]:n.positioning[t]},getEffectiveConfig:()=>n}}function vi(e){const{getModalConfig:t,getProviderConfig:i}=e;return{getEffectiveConfig:function(){const e=mi(),n=i(),o=t();let s=e;return n&&(s=wi(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(e){var n,o;const s=t(),a=i(),r=t=>{if(void 0!==t){if("backdrop"===e&&"object"==typeof t){const e=ai(t);return e.visible||e.blockClicks}return t}},d=r(null==(n=null==s?void 0:s.features)?void 0:n[e]);if(void 0!==d)return d;const l=r(null==(o=null==a?void 0:a.features)?void 0:o[e]);return void 0!==l?l:r(mi().features[e])??!1},getAppearance:function(e){var n,o;const s=t(),a=i();return void 0!==(null==(n=null==s?void 0:s.appearance)?void 0:n[e])?s.appearance[e]:void 0!==(null==(o=null==a?void 0:a.appearance)?void 0:o[e])?a.appearance[e]:mi().appearance[e]},getAnimation:function(e){var n,o;const s=t(),a=i();return void 0!==(null==(n=null==s?void 0:s.animations)?void 0:n[e])?s.animations[e]:void 0!==(null==(o=null==a?void 0:a.animations)?void 0:o[e])?a.animations[e]:mi().animations[e]},getPositioning:function(e){var n,o;const s=t(),a=i();return void 0!==(null==(n=null==s?void 0:s.positioning)?void 0:n[e])?s.positioning[e]:void 0!==(null==(o=null==a?void 0:a.positioning)?void 0:o[e])?a.positioning[e]:mi().positioning[e]},getParentChild:function(e){var n,o;const s=t(),a=i();return void 0!==(null==(n=null==s?void 0:s.parentChild)?void 0:n[e])?s.parentChild[e]:void 0!==(null==(o=null==a?void 0:a.parentChild)?void 0:o[e])?a.parentChild[e]:mi().parentChild[e]}}}const Mi={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"},Pi={dialog:Mi.modal,dialogCentered:Mi.modalCentered,dialogDragging:Mi.modalDragging,dialogResizing:Mi.modalResizing,dialogMinimizing:Mi.modalMinimizing,dialogRestoring:Mi.modalRestoring,dialogOpening:Mi.modalOpening,dialogClosing:Mi.modalClosing,dialogSolid:Mi.modalSolid,dialogTransparent:Mi.modalTransparent,dialogHasGlow:Mi.modalHasGlow,dialogHasChild:Mi.modalHasChild,dialogIsChild:Mi.modalIsChild,dialogAnimatingPosition:Mi.modalAnimatingPosition,dialogAttention:Mi.modalAttention,header:Mi.header,headerDraggable:Mi.headerDraggable,headerLayout:e=>`modal-header--${e}`,body:Mi.body,footer:Mi.footer,childOverlay:Mi.childOverlay,overlayClosing:Mi.overlayClosing,headerTitle:Mi.headerTitle,headerIcon:Mi.headerIcon,headerTitleGroup:Mi.headerTitleGroup,headerActions:Mi.headerActions,headerTrafficLights:Mi.headerTrafficLights,headerLight:Mi.headerLight,headerLightClose:Mi.headerLightClose,headerLightMinimize:Mi.headerLightMinimize,headerLightStyle:Mi.headerLightStyle,headerLightDisabled:Mi.headerLightDisabled,headerMacCenter:Mi.headerMacCenter,headerMacSpacer:Mi.headerMacSpacer,headerBtnWindows:Mi.headerBtnWindows,headerBtnWindowsClose:Mi.headerBtnWindowsClose,headerBtnWindowsStyle:Mi.headerBtnWindowsStyle,headerBtnWindowsDisabled:Mi.headerBtnWindowsDisabled,resizeHandles:Mi.resizeHandles,resizeHandle:Mi.resizeHandle,resizePrefix:Mi.resizePrefix,dock:Mi.dock,dockContainer:Mi.dockContainer,dockItem:Mi.dockItem,dockItemActive:Mi.dockItemActive,dockItemHasGlow:Mi.dockItemHasGlow,dockItemHasChild:Mi.dockItemHasChild,dockItemLabelBeside:Mi.dockItemLabelBeside,dockItemLabelBelow:Mi.dockItemLabelBelow,dockItemIcon:Mi.dockItemIcon,dockItemIconPlaceholder:Mi.dockItemIconPlaceholder,dockItemLabel:Mi.dockItemLabel,dockItemGlow:Mi.dockItemGlow,dockChildIndicator:Mi.dockChildIndicator,dockHandle:Mi.dockHandle,dockHandleDragging:Mi.dockHandleDragging,dockLeft:Mi.dockLeft,dockRight:Mi.dockRight,dockBottom:Mi.dockBottom,dockFree:Mi.dockFree,dockEmpty:Mi.dockEmpty,dockFreeHorizontal:Mi.dockFreeHorizontal,dockFreeVertical:Mi.dockFreeVertical,backdrop:Mi.backdrop,backdropVisible:Mi.backdropVisible},Ci={modalId:"data-modal-id",dockContainer:"data-dock-container",resizeDir:"data-resize-dir",modalBridge:"data-modal-bridge"},xi={modalId:Ci.modalId,resizeDirection:"data-direction",dockItemId:"data-dock-item-id"},Ii=["n","s","e","w","ne","nw","se","sw"],bi={n:"Resize north",s:"Resize south",e:"Resize east",w:"Resize west",ne:"Resize northeast",nw:"Resize northwest",se:"Resize southeast",sw:"Resize southwest"},Ai={minimize:500,restore:400,open:400,close:250,overlay:200,centerAfterResize:200,glowStabilize:1e3},ki={minWidth:280,minHeight:200,maxWidth:"600px",zIndexBase:1e3},Si=["button:not([disabled])","[href]","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(", ");function Ri(e,t){return function(e,t,i={}){const{timeout:n=5e3}=i;return new Promise((i,o)=>{const s=performance.now(),a=()=>{const r=e(),d=performance.now()-s;r&&t(r)?i(r):d>=n?o(new Error(`DOM not ready after ${n}ms`)):requestAnimationFrame(a)};a()})}(e,e=>e.offsetWidth>0&&e.offsetHeight>0,t)}function Di(e,t,i=2e3){return new Promise((n,o)=>{let s=!1;const a=i=>{t&&i.animationName!==t||s||(s=!0,e.removeEventListener("animationend",a),n(i))};e.addEventListener("animationend",a),setTimeout(()=>{s||(s=!0,e.removeEventListener("animationend",a),o(new Error(`Animation '${t||"any"}' did not complete within ${i}ms`)))},i)})}const Ei={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 Bi(e,t){const i=i=>{i.target===e&&t(i.animationName)};return e.addEventListener("animationend",i),()=>e.removeEventListener("animationend",i)}function Hi(){const e=Oe();return Array.from(e.values()).filter(e=>e.isMinimized).sort((e,t)=>e.dockPosition-t.dockPosition)}function Ti(e,t,i){const n=ce(e.x,e.y,t,i);return{x:Math.round(n.x),y:Math.round(n.y)}}function Oi(e,t,i,n,o,s=8){const a=window.innerWidth-n-s,r=window.innerHeight-o-s,d=Math.min(Math.max(e-i.x,s),Math.max(s,a)),l=Math.min(Math.max(t-i.y,s),Math.max(s,r));return{x:Math.round(d),y:Math.round(l)}}function Fi(e,t){const i=["modal-dock-container"];return"left"===e?i.push("modal-dock-left"):"right"===e?i.push("modal-dock-right"):"bottom"===e?i.push("modal-dock-bottom"):"free"===e&&i.push("modal-dock-free"),t&&i.push("modal-dock-empty"),i.join(" ")}function Li(e,t){const i=["modal-dock"];return"free"===e&&i.push("horizontal"===t?"modal-dock-free-horizontal":"modal-dock-free-vertical"),i.join(" ")}function Wi(){const e=Oe();return Array.from(e.values()).some(e=>e.isOpen&&!e.isMinimized&&!e.isHiddenWithParent)}function _i(){return ai(mi().features.backdrop)}function Gi(){const e=_i();return e.visible||e.blockClicks}function $i(e={}){const{initialPosition:t={x:0,y:0},constrain:i=!0}=e,n={...t};let o=!1,s=!1,a=0,r=0,d=0,l=0;const h=si();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(e){n.x=e.x,n.y=e.y,g()},setHasBeenDragged:function(e){s=e,g()},reset:function(){n.x=t.x,n.y=t.y,s=!1,o=!1,g()},constrainToViewport:function(e){if(!s)return;const t=ce(n.x,n.y,e.width,e.height);n.x=t.x,n.y=t.y,g()},onPointerDown:function(e,t){if(0===e.button){if(!s){const e=t.getBoundingClientRect();n.x=e.left,n.y=e.top}o=!0,a=e.clientX,r=e.clientY,d=n.x,l=n.y,t.setPointerCapture(e.pointerId),h.emit("dragStart",{...n}),g()}},onPointerMove:function(e,t){if(!o)return;const c=e.clientX-a,u=e.clientY-r;let m=d+c,p=l+u;if(i){const e=ce(m,p,t.width,t.height);m=e.x,p=e.y}n.x=m,n.y=p,s=!0,h.emit("dragMove",{...n}),g()},onPointerUp:function(e,t){o&&(o=!1,t.releasePointerCapture(e.pointerId),h.emit("dragEnd",{...n}),g())},subscribe:function(e){return h.on("change",e)},destroy:function(){h.off()}}}function Vi(e){const{minWidth:t=ki.minWidth,minHeight:i=ki.minHeight,getPosition:n,setPosition:o,getHasBeenDragged:s,setHasBeenDragged:a,getElement:r,getSymmetricResize:d,onResizeEnd:l}=e;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=si();let y=null,z=null;function v(){return{isResizing:h,direction:c,size:{...g},hasBeenResized:u}}function M(){w.emit("change",v())}function P(e){if(e.pointerId!==f)return;const n=e.clientX-p.x,s=e.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,y=p.posY;if(l){if(c.includes("e")||c.includes("w")){const e=c.includes("e")?n:-n;h=Math.max(t,p.width+2*e),m=p.centerX-h/2}if(c.includes("s")||c.includes("n")){const e=c.includes("s")?s:-s;u=Math.max(i,p.height+2*e),y=p.centerY-u/2}}else{if(c.includes("e")){const e=a-m;h=Math.max(t,Math.min(p.width+n,e))}if(c.includes("w")){const e=p.width-t,i=Math.min(n,e);h=p.width-i,m=p.posX+i}if(c.includes("s")){const e=r-y;u=Math.max(i,Math.min(p.height+s,e))}if(c.includes("n")){const e=p.height-i,t=Math.min(s,e);u=p.height-t,y=p.posY+t}}const z=ge(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}}),M()}function C(e){if(e.pointerId!==f)return;h=!1,c="",f=null,y&&window.removeEventListener("pointermove",y),z&&(window.removeEventListener("pointerup",z),window.removeEventListener("pointercancel",z)),y=null,z=null,m=!0;const t=n();w.emit("resizeEnd",{size:{...g},position:t}),l&&l(t,{...g}),M(),setTimeout(()=>{m=!1},0)}return{getState:v,getSize:()=>({...g}),isResizing:()=>h,hasBeenResized:()=>u,justFinishedResizing:()=>m,setSize:function(e){g={...e},u=!0,M()},reset:function(){u=!1,g={width:0,height:0},h=!1,c="",M()},constrainToViewport:function(){const e=n(),t=r();if(!t)return;const i=ge(e.x,e.y,g.width||t.offsetWidth,g.height||t.offsetHeight);g={width:i.width,height:i.height},o({x:i.x,y:i.y}),M()},startResize:function(e,t){e.preventDefault(),e.stopPropagation();const i=r();if(!i)return;const d=i.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=t,f=e.pointerId,p={x:e.clientX,y:e.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=P,z=C,window.addEventListener("pointermove",y),window.addEventListener("pointerup",z),window.addEventListener("pointercancel",z),w.emit("resizeStart",{direction:t}),M()},subscribe:function(e){return w.on("change",e)},destroy:function(){y&&window.removeEventListener("pointermove",y),z&&(window.removeEventListener("pointerup",z),window.removeEventListener("pointercancel",z)),w.off()}}}function Ni(e){return Array.from(e.querySelectorAll(Si)).filter(e=>null!==e.offsetParent||"A"===e.tagName)}function Yi(e,t){if("Tab"!==e.key)return;const i=Ni(t);if(0===i.length)return void e.preventDefault();const n=i[0],o=i[i.length-1],s=document.activeElement;e.shiftKey?s===n&&(o.focus(),e.preventDefault()):s===o&&(n.focus(),e.preventDefault())}function Xi(e){const t=Ni(e);return t.length>0&&(t[0].focus(),!0)}function qi(e){const t=Ni(e);return t.length>0&&(t[t.length-1].focus(),!0)}function Ui(e){return e.contains(document.activeElement)}function ji(e){let t=null;return{activate(){t=document.activeElement,Xi(e)},deactivate(){t&&"function"==typeof t.focus&&t.focus(),t=null},handleKeyDown(t){Yi(t,e)},containsFocus:()=>Ui(e)}}function Ki(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Zi(e,t){return{x:e.x+t.x,y:e.y+t.y}}function Ji(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Qi(e,t,i){return{x:e.x+(t.width-i.width)/2,y:e.y+(t.height-i.height)/2}}function en(e){const t=e.getBoundingClientRect();return{position:{x:t.left,y:t.top},size:{width:t.width,height:t.height}}}function tn(e){return Ce(e)}function nn(e){return Ce(e)}function on(e,t,i){return e&&!t&&!i}function sn(e,t){const i=[];let n=t(e);for(;n;)i.push(n),n=t(n);return i}function an(e,t){const i=[];let n=t(e);for(;n;)i.push(n),n=t(n);return i}function rn(e,t){let i=e,n=t(i);for(;n;)i=n,n=t(i);return i}function dn(e,t,i){const n=e.x+t.width/2,o=e.y+t.height/2;return{x:i.x-n,y:i.y-o,originX:i.x-e.x,originY:i.y-e.y}}function ln(e,t,i){const n=e.x+t.width/2,o=e.y+t.height/2;return{x:i.x-n,y:i.y-o,originX:i.x-e.x,originY:i.y-e.y}}function hn(e,t,i){const n=e.x+t.width/2,o=e.y+t.height/2;return{x:i.x-n,y:i.y-o,originX:i.x-e.x,originY:i.y-e.y}}function cn(e){return{"--modal-transform-x":`${e.x}px`,"--modal-transform-y":`${e.y}px`,"--modal-origin-x":`${e.originX}px`,"--modal-origin-y":`${e.originY}px`}}function gn(){return{x:typeof window<"u"?window.innerWidth/2:0,y:typeof window<"u"?window.innerHeight-40:0}}function un(e,t){const i=document.querySelector(`.modal-dock-item[data-modal-id="${e}"]`);if(i){const e=i.getBoundingClientRect();return{x:e.left+e.width/2,y:e.top+e.height/2}}const n=document.querySelector('[data-dock-container="true"]');if(n){const e=n.getBoundingClientRect();return{x:e.left+e.width/2,y:e.top+e.height/2}}return t??gn()}function mn(e){const{getId:t,getElement:i,getPosition:n,setPosition:o,getHasBeenDragged:s,setHasBeenDragged:a,getHasBeenResized:r,getSize:d,areAnimationsEnabled:l=()=>!0,onMinimizeComplete:h,onOpenStart:c}=e;let g="none",u=!1,m=null,p=null,f=null,w=null,y=null,z=null,v=null;const M=si();function P(){return{type:g,isAnimating:u,transform:m?{...m}:null}}function C(){M.emit("change",P())}function x(){z&&(clearTimeout(z),z=null)}function I(){const e=i();!e||v||(v=Bi(e,b))}function b(e){switch(x(),e){case Ei.MINIMIZE:"minimize"===g&&A();break;case Ei.RESTORE:"restore"===g?k():"open"===g&&S();break;case Ei.CLOSE:case Ei.CLOSE_CENTERED:case Ei.CHILD_DISAPPEAR:"close"===g&&R();break;case Ei.CHILD_APPEAR:"open"===g&&S()}}function A(){"minimize"===g&&(x(),w?(w(),w=null):y&&(null==h||h(y.position,!0,y.size)),M.emit("animationEnd",{type:"minimize"}),y=null)}function k(){if("restore"!==g)return;x(),g="none",u=!1,m=null;const e=i();e&&(e.setAttribute("data-state","open"),e.setAttribute("data-animation-phase","idle")),M.emit("animationEnd",{type:"restore"}),C()}function S(){if("open"!==g)return;x(),g="none",u=!1,m=null;const e=i();e&&(e.setAttribute("data-state","open"),e.setAttribute("data-animation-phase","idle")),M.emit("animationEnd",{type:"open"}),C()}function R(){if("close"!==g)return;x(),g="none",u=!1;const e=i();e&&(e.setAttribute("data-state","closed"),e.setAttribute("data-animation-phase","idle")),M.emit("animationEnd",{type:"close"}),f&&(f(),f=null),C()}return{getState:P,isAnimating:()=>u,getAnimationType:()=>g,getTransform:()=>m?{...m}:null,getPendingOpenSource:()=>p?{...p}:null,setPendingOpenSource:e=>{p=e?{...e}:null},startMinimize:function(e,c){const p=i();if(u||!p)return!1;if(I(),x(),!l()){const e=p.getBoundingClientRect(),t=s()?n():{x:e.left,y:e.top},i=r()?d():{width:e.width,height:e.height};return s()||(o(t),a(!0)),c?c():null==h||h(t,!0,i),!0}const f=p.getBoundingClientRect(),v=s()?n():{x:f.left,y:f.top},P=r()?d():{width:f.width,height:f.height};s()||(o(v),a(!0));const b=e??un(t());return m=dn(v,P,b),w=c||null,y={position:v,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"),M.emit("animationStart",{type:"minimize"}),C()})}),z=setTimeout(()=>{"minimize"===g&&A()},Ie.minimize+be),!0},startRestore:function(e,n){const s=i();if(I(),x(),!l()){const t=e||{x:window.innerWidth/2,y:window.innerHeight/2};return o(t),void a(!0)}const r=un(t()),d=e||{x:window.innerWidth/2,y:window.innerHeight/2},h=n||{width:480,height:400};o(d),a(!0),m=ln(d,h,r),g="restore",u=!0,s&&(s.setAttribute("data-state","restoring"),s.setAttribute("data-animation-phase","animate")),M.emit("animationStart",{type:"restore"}),C(),z=setTimeout(()=>{"restore"===g&&k()},Ie.restore+be)},startOpen:function(){const e=i();if(!p||!e||u)return!1;if(I(),x(),!l())return p=null,!1;const t=p,r=e.getBoundingClientRect(),d=s()?n():{x:r.left,y:r.top},h=r.width,f=r.height;return s()||(o(d),a(!0)),m=hn(d,{width:h,height:f},t),g="open",u=!0,p=null,e.setAttribute("data-state","opening"),e.setAttribute("data-animation-phase","animate"),M.emit("animationStart",{type:"open"}),null==c||c(),C(),z=setTimeout(()=>{"open"===g&&S()},Ie.open+be),!0},startClose:function(e){const t=i();return!u&&(I(),x(),l()?(f=e,g="close",u=!0,t&&(t.setAttribute("data-state","closing"),t.setAttribute("data-animation-phase","animate")),M.emit("animationStart",{type:"close"}),C(),z=setTimeout(()=>{"close"===g&&R()},Ie.close+be),!0):(e(),!0))},forceClearMinimize:function(){x(),"minimize"===g&&(g="none",u=!1,m=null,w=null,y=null,C())},destroy:function(){x(),null==v||v(),v=null,M.off()},subscribe:e=>M.on("change",e)}}function pn(e){const t={"z-index":e.zIndex};return e.animationTransform?(t.left=`${e.position.x}px`,t.top=`${e.position.y}px`,t["--genie-origin-x"]=`${e.animationTransform.originX}px`,t["--genie-origin-y"]=`${e.animationTransform.originY}px`,t["--genie-translate-x"]=`${e.animationTransform.x}px`,t["--genie-translate-y"]=`${e.animationTransform.y}px`):e.hasBeenDragged&&(t.left=`${e.position.x}px`,t.top=`${e.position.y}px`,e.isAnimatingPosition||(t.transform="none")),e.hasBeenResized?(t.width=`${e.size.width}px`,t.height=`${e.size.height}px`,t["max-width"]="none",t["max-height"]="none"):(e.preferredHeight&&(t["min-height"]=e.preferredHeight),e.maxWidth&&(t["max-width"]=e.maxWidth)),e.glowEnabled&&e.glow&&(t["--modal-glow-color"]=e.glow.color,t["--modal-glow-intensity"]=String(e.glow.intensity??"medium")),t}function fn(e){const t=["modal-dialog"];return e.isDragging&&t.push("modal-dragging"),e.isResizing&&t.push("modal-resizing"),e.hasBeenDragged&&t.push("modal-positioned"),e.isMinimizing&&t.push("modal-minimizing"),e.isRestoring&&t.push("modal-restoring"),e.isOpening&&t.push("modal-opening"),e.isClosing&&t.push("modal-closing"),e.showCentered&&t.push("modal-centered"),e.isTransparent||t.push("modal-solid"),e.isTransparent&&t.push("modal-transparent"),e.glowEnabled&&t.push("modal-glow"),e.hasChild&&t.push("modal-has-child"),e.isChildModal&&t.push("modal-is-child"),e.wasRestored&&t.push("modal-was-restored"),e.isVisibleByAnimation&&t.push("modal-visible-by-animation"),e.isAwaitingRestore&&t.push("modal-awaiting-restore"),e.isAwaitingChildOpen&&t.push("modal-awaiting-child-open"),e.isAnimatingToCenter&&t.push("modal-animating-to-center"),e.isAnimatingPosition&&t.push("modal-animating-position"),e.isAttentionAnimating&&t.push("modal-attention"),e.glowStabilizing&&e.glowEnabled&&t.push("modal-glow-stabilizing"),t}class wn{constructor(e={}){t(this,"element",null),t(this,"resizeHandler",null),t(this,"options"),this.options=e}mount(e){var t,i;this.element=e,this.options.onWindowResize&&(this.resizeHandler=this.options.onWindowResize,window.addEventListener("resize",this.resizeHandler)),null==(i=(t=this.options).onMount)||i.call(t)}destroy(){var e,t;this.resizeHandler&&(window.removeEventListener("resize",this.resizeHandler),this.resizeHandler=null),this.element=null,null==(t=(e=this.options).onDestroy)||t.call(e)}getElement(){return this.element}isMounted(){return null!==this.element}}class yn{constructor(e){t(this,"id"),t(this,"dataId"),t(this,"configHelper"),t(this,"getDragBehavior"),t(this,"getElement"),this.id=e.id,this.dataId=e.dataId,this.configHelper=e.configHelper,this.getDragBehavior=e.getDragBehavior,this.getElement=e.getElement}constrainToViewport(e){const t=this.getDragBehavior();t.hasBeenDragged()&&t.constrainToViewport(e)}shouldApplySmartPositioning(){return!("smart"!==this.configHelper.getPositioning("strategy")||this.getDragBehavior().hasBeenDragged())}applySmartPositioning(){if("smart"!==this.configHelper.getPositioning("strategy"))return!1;const e=De(this.id),t=jt();if(null!=e&&e.parentId||t&&t.childId===this.id||null!=e&&e.hasBeenDragged||null!=e&&e.position)return!1;const i=this.getElement()||Ce(this.id);if(!i)return!1;const n=i.offsetWidth,o=i.offsetHeight;if(n<=0||o<=0)return!1;const s=this.configHelper.getPositioning("modalGap"),a=We().filter(e=>e.id!==this.id),r=fe(this.configHelper.getPositioning("avoidElements")),d=Me(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[e,t]of d.positions)e!==this.id&&h.set(e,t);h.size>0&&qe(h);const c=this.getDragBehavior();return c.setPosition(l),c.setHasBeenDragged(!0),$e(this.id,l,{size:{width:n,height:o}}),!0}scheduleSmartPositioning(){Ri(()=>this.getElement()||Ce(this.id)).then(()=>{this.applySmartPositioning()}).catch(()=>{this.applySmartPositioning()})}centerChildOnParent(e){var t,i;const n=De(e);if(!n)return!1;const o=this.getElement()||Ce(this.id),s=Ce(e),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==(t=n.size)?void 0:t.width)??(null==s?void 0:s.offsetWidth)??(null==a?void 0:a.width)??480,l=(null==(i=n.size)?void 0:i.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),$e(this.id,g,{size:{width:h,height:c}}),(!n.position||!n.size)&&a&&$e(e,{x:a.left,y:a.top},{size:{width:d,height:l}});const m={x:g.x-r.x,y:g.y-r.y};return Ut(e,this.id,m),!0}scheduleCenterChildOnParent(e){Ri(()=>this.getElement()).then(()=>{this.centerChildOnParent(e)}).catch(()=>{this.centerChildOnParent(e)})}}class zn{constructor(e){t(this,"options"),this.options=e}startDrag(e){const t=this.options.getElement();!this.options.configHelper.isFeatureEnabled("drag")||!t||this.options.getDragBehavior().onPointerDown(e,t)}startResize(e,t){const i=this.options.getState();!this.options.configHelper.isFeatureEnabled("resize")||i.hasChild||this.options.getResizeBehavior().startResize(e,t)}handlePointerMove(e){const t=this.options.getElement();if(!t)return;const i=this.options.getDragBehavior(),n=i.isDragging(),o=this.options.getResizeBehavior(),s=o.hasBeenResized()?o.getSize():{width:t.offsetWidth,height:t.offsetHeight};i.onPointerMove(e,s),n&&i.isDragging()&&this.options.onDragMove()}handlePointerUp(e){const t=this.options.getElement();if(!t)return;const i=this.options.getDragBehavior(),n=i.isDragging();i.onPointerUp(e,t),n&&!this.options.getResizeBehavior().justFinishedResizing()&&this.options.onDragEnd()}handleKeyDown(e){var t,i;this.options.closeOnEscape&&"Escape"===e.key&&this.options.isTopModal()&&(e.stopPropagation(),null==(i=(t=this.options).onClose)||i.call(t))}handleTabKey(e){const t=this.options.getElement();t&&Yi(e,t)}focusFirst(){const e=this.options.getElement();e&&Xi(e)}}class vn{constructor(e){t(this,"id"),t(this,"options"),t(this,"_isHandlingMinimize",!1),t(this,"_isAttentionAnimating",!1),t(this,"_wasRestored"),t(this,"_glowStabilizing",!1),t(this,"_restoreHold",!1),t(this,"_isAnimatingToCenter",!1),t(this,"_cancelParentAnimationCleanup",null),t(this,"_parentFlipInFlight",!1),t(this,"_deferredParentTarget",null),t(this,"_parentFlipStartTime",0),this.id=e.id,this.options=e,this._wasRestored=!1}handlePendingStates(){if(!De(this.id)||this.handlePendingForceClose()||(this.handlePendingMinimize(),this.handlePendingMinimizeWithParent(),this.handlePendingRestore(),this.handlePendingChildRestore(),this.handlePendingClose()))return;const e=this.handlePendingParentLink(),t=this.handlePendingOpen(e);this.handlePendingAttention(),this.handlePendingParentAnimation(),this.handleChildCentering(e,t)}handlePendingForceClose(){var e,t;return!!Dt(this.id)&&(Et(this.id),Mt(this.id),null==(t=(e=this.options.options).onClose)||t.call(e),!0)}handlePendingMinimize(){if(!Ct(this.id)||this._isHandlingMinimize)return;this._isHandlingMinimize=!0,Xt();const e=this.options.getElement();if(e){const t=this.options.getDragBehavior(),i=this.options.getResizeBehavior(),n=e.getBoundingClientRect(),o=t.hasBeenDragged()?t.getPosition():{x:n.left,y:n.top},s=i.hasBeenResized()?i.getSize():{width:n.width,height:n.height};Ye(this.id,{position:o,size:s,hasBeenDragged:!0})}this.options.getAnimationController().startMinimize(void 0,()=>{xt(this.id),this._isHandlingMinimize=!1})||(this._isHandlingMinimize=!1)}handlePendingMinimizeWithParent(){if(!It(this.id)||this._isHandlingMinimize)return;this._isHandlingMinimize=!0;const e=this.options.getElement();if(e){const t=this.options.getDragBehavior(),i=this.options.getResizeBehavior(),n=e.getBoundingClientRect(),o=t.hasBeenDragged()?t.getPosition():{x:n.left,y:n.top},s=i.hasBeenResized()?i.getSize():{width:n.width,height:n.height};Ye(this.id,{position:o,size:s,hasBeenDragged:!0})}this.options.getAnimationController().startMinimize(void 0,()=>{bt(this.id),rt(this.id),this._isHandlingMinimize=!1})}handlePendingRestore(){if(!Bt(this.id))return;const e=De(this.id),t=this.options.getAnimationController();Ht(this.id),t.startRestore((null==e?void 0:e.position)??void 0,(null==e?void 0:e.size)??void 0),requestAnimationFrame(()=>{this.options.focusFirst()})}handlePendingChildRestore(){if(!Tt(this.id))return;const e=De(this.id),t=this.options.getAnimationController();Ot(this.id),t.startRestore((null==e?void 0:e.position)??void 0,(null==e?void 0:e.size)??void 0),at(this.id),this._wasRestored=!0}handlePendingClose(){var e,t;return!!St(this.id)&&(Rt(this.id),this.options.getAnimationController().startClose(()=>{var e,t;ut(this.id),Mt(this.id),null==(t=(e=this.options.options).onClose)||t.call(e)})||(ut(this.id),Mt(this.id),null==(t=(e=this.options.options).onClose)||t.call(e)),!0)}handlePendingParentLink(){const e=jt();return e&&e.childId===this.id&&(Ye(this.id,{parentId:e.parentId}),this._wasRestored=!0),qt(this.id)}handlePendingOpen(e){var t;if(!At(this.id))return!1;kt(this.id);const i=this.options.getDragBehavior(),n=this.options.getResizeBehavior();Ye(this.id,{position:null,hasBeenDragged:!1,size:null}),i.setPosition({x:0,y:0}),i.setHasBeenDragged(!1),n.reset();const o=Yt(this.id)||this.options.options.openSourcePosition||null,s=!!e||!(null==(t=De(this.id))||!t.parentId);let a=!1;return o?(a=!0,this.options.getAnimationController().setPendingOpenSource(o),s&&e?this.openChildModalWithAnimation(e.parentId):this.openStandaloneModalWithAnimation()):s||this.options.getPositioning().scheduleSmartPositioning(),requestAnimationFrame(()=>{this.options.focusFirst()}),a}openChildModalWithAnimation(e){const t=this.options.getPositioning(),i=this.options.getAnimationController();Ri(()=>this.options.getElement()).then(()=>{t.centerChildOnParent(e)&&(i.startOpen(),this._wasRestored=!0)}).catch(()=>{t.centerChildOnParent(e)&&(i.startOpen(),this._wasRestored=!0)})}openStandaloneModalWithAnimation(){const e=this.options.getPositioning(),t=this.options.getAnimationController();Ri(()=>this.options.getElement()).then(()=>{e.applySmartPositioning(),t.startOpen()}).catch(()=>{e.applySmartPositioning(),t.startOpen()})}handlePendingAttention(){Ft(this.id)&&(Lt(this.id),this.id,this._isAttentionAnimating=!0,setTimeout(()=>{this._isAttentionAnimating=!1,this.id,this.options.onStateChange()},600))}handlePendingParentAnimation(){if(!Gt(this.id))return;const e=$t(this.id);if(e){if(this._parentFlipInFlight&&Date.now()-this._parentFlipStartTime<Ie.parentRetargetInterval)return void(this._deferredParentTarget=e);this._deferredParentTarget=null,this.startParentFlip(e)}}startParentFlip(e){var t,i;const n=this.options.getDragBehavior(),o=this.options.getElement(),s=o?{x:o.getBoundingClientRect().left,y:o.getBoundingClientRect().top}:(null==(t=De(this.id))?void 0:t.position)??null;Ye(this.id,{position:e,hasBeenDragged:!0,isAnimatingPosition:!0}),n.setPosition(e),n.setHasBeenDragged(!0),null==(i=this._cancelParentAnimationCleanup)||i.call(this),this._parentFlipInFlight=!0,this._parentFlipStartTime=Date.now();const a=this.id,r=()=>{this._parentFlipInFlight=!1,this._cancelParentAnimationCleanup=null,Ve(a);const e=this._deferredParentTarget;e?(this._deferredParentTarget=null,this.startParentFlip(e)):Kt(a)};o&&s?this._cancelParentAnimationCleanup=Re(o,s,e,{duration:Ie.parentMove,onComplete:r}):setTimeout(r,Ie.parentMove+be)}handleChildCentering(e,t){e&&this.options.getElement()&&!t&&this.options.getPositioning().scheduleCenterChildOnParent(e.parentId)}get wasRestored(){return this._wasRestored}set wasRestored(e){this._wasRestored=e}get isAttentionAnimating(){return this._isAttentionAnimating}get glowStabilizing(){return this._glowStabilizing}set glowStabilizing(e){this._glowStabilizing=e}get restoreHold(){return this._restoreHold}set restoreHold(e){this._restoreHold=e}get isAnimatingToCenter(){return this._isAnimatingToCenter}set isAnimatingToCenter(e){this._isAnimatingToCenter=e}get isHandlingMinimize(){return this._isHandlingMinimize}}class Mn{constructor(e){var i,n,o,s;t(this,"id"),t(this,"dataId"),t(this,"options"),t(this,"drag"),t(this,"resize"),t(this,"animation"),t(this,"positioning"),t(this,"lifecycle"),t(this,"interactions"),t(this,"stateManager"),t(this,"overlayClosing",!1),t(this,"emitter",si()),t(this,"unsubscribeState",null),t(this,"cachedState",null),this.id=e.id,this.dataId=e.id,this.options=e,this.drag=$i({initialPosition:{x:0,y:0},constrain:!0}),this.resize=Vi({minWidth:(null==(n=null==(i=e.config)?void 0:i.appearance)?void 0:n.minWidth)??mi().appearance.minWidth,minHeight:(null==(s=null==(o=e.config)?void 0:o.appearance)?void 0:s.minHeight)??mi().appearance.minHeight,getPosition:()=>this.drag.getPosition(),setPosition:e=>this.drag.setPosition(e),getHasBeenDragged:()=>this.drag.hasBeenDragged(),setHasBeenDragged:e=>this.drag.setHasBeenDragged(e),getElement:()=>this.element,onResizeEnd:(e,t)=>this.handleResizeEnd(e,t)}),this.animation=mn({getId:()=>this.id,getElement:()=>this.element,getPosition:()=>this.drag.getPosition(),setPosition:e=>this.drag.setPosition(e),getHasBeenDragged:()=>this.drag.hasBeenDragged(),setHasBeenDragged:e=>this.drag.setHasBeenDragged(e),getHasBeenResized:()=>this.resize.hasBeenResized(),getSize:()=>this.resize.getSize(),areAnimationsEnabled:()=>this.options.configHelper.isFeatureEnabled("animations"),onMinimizeComplete:(e,t,i)=>{Ye(this.id,{position:e,size:i,hasBeenDragged:t}),it(this.id)},onOpenStart:()=>{const e=De(this.id);null!=e&&e.parentId&&(this.stateManager.wasRestored=!0)}}),this.positioning=new yn({id:this.id,dataId:this.dataId,configHelper:e.configHelper,getDragBehavior:()=>this.drag,getElement:()=>this.element}),this.interactions=new zn({id:this.id,configHelper:e.configHelper,getDragBehavior:()=>this.drag,getResizeBehavior:()=>this.resize,getElement:()=>this.element,getState:()=>{var e;return{hasChild:!(null==(e=De(this.id))||!e.childId)}},onDragMove:()=>{if("realtime"===mi().parentChild.movementMode){const e=this.drag.getPosition();$e(this.id,e,{drag:!0,realtime:!0})}},onDragEnd:()=>{const e=this.drag.getPosition();$e(this.id,e,{drag:!0}),"animated"===mi().parentChild.movementMode&&Kt(this.id)},onClose:()=>this.close(),closeOnEscape:e.closeOnEscape,isTopModal:()=>de(this.id)}),this.stateManager=new vn({id:this.id,options:{glow:e.glow,openSourcePosition:e.openSourcePosition,onClose:e.onClose},getDragBehavior:()=>this.drag,getResizeBehavior:()=>this.resize,getAnimationController:()=>this.animation,getElement:()=>this.element,getPositioning:()=>this.positioning,onStateChange:()=>this.notifyStateChange(),focusFirst:()=>this.interactions.focusFirst()}),_t(e.id)&&(this.stateManager.wasRestored=!0),this.lifecycle=new wn({onMount:()=>{this.handleStateChange(),this.handlePendingStates(),this.notifyStateChange()},onDestroy:()=>{var e;null==(e=this.unsubscribeState)||e.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()}),e.skipRegistration||this.register(e.autoOpen??!1),this.handleStateChange(),this.handlePendingStates()}mount(e){this.lifecycle.mount(e)}destroy(){this.lifecycle.destroy()}get element(){return this.lifecycle.getElement()}handleWindowResize(){if(!this.element||!this.drag.hasBeenDragged())return;const e=this.resize.hasBeenResized()?this.resize.getSize():{width:this.element.offsetWidth,height:this.element.offsetHeight};this.positioning.constrainToViewport(e),this.resize.hasBeenResized()&&this.resize.constrainToViewport(),this.notifyStateChange()}register(e){oe({id:this.id,title:this.options.title,icon:this.options.icon??"",isOpen:e,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}),e&&re(this.id)}getState(){if(this.cachedState)return this.cachedState;const e=De(this.id),t=this.drag.getState(),i=this.resize.getState(),n=this.animation.getState(),o=!!e&&(e.isOpen||St(this.id))&&(!e.isMinimized||Ct(this.id))&&(!e.isHiddenWithParent||It(this.id)||Tt(this.id)),s=!(null==e||!e.childId),a=!(null==e||!e.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==e?void 0:e.isAnimatingPosition)??!1,u=g&&null!=e&&e.position?e.position:t.position,m=!!g||t.hasBeenDragged,p=(Tt(this.id)||Bt(this.id))&&!d,f=(a||_t(this.id))&&!l&&(!m||!!this.animation.getPendingOpenSource()),w=d||l||this.stateManager.restoreHold,y=o&&!m&&!c&&!this.animation.getPendingOpenSource()&&!p&&!f;let z="closed";r?z="minimizing":d?z="restoring":l?z="opening":h?z="closing":null!=e&&e.isMinimized?z="minimized":o&&(z="open");const v=this.options.configHelper.isFeatureEnabled("drag"),M=this.options.configHelper.isFeatureEnabled("resize"),P=this.options.configHelper.isFeatureEnabled("minimize"),C=!!this.options.glow,x=pn({position:u,hasBeenDragged:m,hasBeenResized:i.hasBeenResized,size:i.size,animationTransform:n.transform,zIndex:(null==e?void 0:e.zIndex)??1e3,glowEnabled:C,glow:this.options.glow??null,maxWidth:this.options.maxWidth,preferredHeight:this.options.preferredHeight,isAnimatingPosition:g}),I=fn({isDragging:t.isDragging,isResizing:i.isResizing,hasBeenDragged:m,isMinimizing:r,isRestoring:d,isOpening:l,isClosing:h,showCentered:y,isTransparent:(null==e?void 0:e.isTransparent)??!1,glowEnabled:C,hasChild:s,isChildModal:a,wasRestored:this.stateManager.wasRestored,isVisibleByAnimation:w,isAwaitingRestore:p,isAwaitingChildOpen:f,isAnimatingToCenter:this.stateManager.isAnimatingToCenter,isAnimatingPosition:(null==e?void 0:e.isAnimatingPosition)??!1,isAttentionAnimating:this.stateManager.isAttentionAnimating,glowStabilizing:this.stateManager.glowStabilizing});return this.cachedState={position:t.position,size:i.size,zIndex:(null==e?void 0:e.zIndex)??1e3,isDragging:t.isDragging,isResizing:i.isResizing,hasBeenDragged:t.hasBeenDragged,hasBeenResized:i.hasBeenResized,isMinimizing:r,isRestoring:d,isOpening:l,isClosing:h,isAnyAnimating:c,animationTransform:n.transform,isVisible:o,showCentered:y,isAwaitingRestore:p,isAwaitingChildOpen:f,isVisibleByAnimation:w,hasChild:s,isChildModal:a,showOverlay:s||this.overlayClosing,isTransparent:(null==e?void 0:e.isTransparent)??!1,isAttentionAnimating:this.stateManager.isAttentionAnimating,glowStabilizing:this.stateManager.glowStabilizing,isAnimatingPosition:(null==e?void 0:e.isAnimatingPosition)??!1,isAnimatingToCenter:this.stateManager.isAnimatingToCenter,wasRestored:this.stateManager.wasRestored,overlayClosing:this.overlayClosing,glowEnabled:C,draggable:v,resizable:M,minimizable:P,dataState:z,dataAnimationPhase:n.isAnimating?"animate":"idle",style:x,cssClasses:I},this.cachedState}subscribe(e){return this.emitter.on("stateChange",e)}notifyStateChange(){this.cachedState=null,this.emitter.emit("stateChange",this.getState())}startDrag(e){this.interactions.startDrag(e)}startResize(e,t){this.interactions.startResize(e,t)}handlePointerMove(e){this.interactions.handlePointerMove(e)}handlePointerUp(e){this.interactions.handlePointerUp(e)}handleKeyDown(e){this.interactions.handleKeyDown(e)}handleTabKey(e){this.interactions.handleTabKey(e)}minimize(){this.options.configHelper.isFeatureEnabled("minimize")&&it(this.id)}close(){var e,t;Dt(this.id)&&Et(this.id),zt(this.id),null==(t=(e=this.options).onClose)||t.call(e)}toggleTransparency(){lt(this.id)}bringToFront(){re(this.id)}setOpenSourcePosition(e){this.animation.setPendingOpenSource(e)}updateGlow(e){this.options.glow!==e&&(this.options.glow=e,Ye(this.id,{glow:e??null}),this.notifyStateChange())}focusFirst(){this.interactions.focusFirst()}handleResizeEnd(e,t){const i=De(this.id);if(null!=i&&i.parentId){const n=De(i.parentId),o=Ce(i.parentId);if(n&&o){const i=n.position??{x:o.getBoundingClientRect().left,y:o.getBoundingClientRect().top},s=n.size??{width:o.offsetWidth,height:o.offsetHeight},a={x:i.x+(s.width-t.width)/2,y:i.y+(s.height-t.height)/2},r=e;this.stateManager.isAnimatingToCenter=!0,this.drag.setPosition(a);const d={x:a.x-i.x,y:a.y-i.y};Ye(this.id,{position:a,size:t,hasBeenDragged:!0,offsetFromParent:d});const l=this.lifecycle.getElement();return void(l?Re(l,r,a,{duration:Ie.centerAfterResize,onComplete:()=>{this.stateManager.isAnimatingToCenter=!1}}):this.stateManager.isAnimatingToCenter=!1)}}Ye(this.id,{position:e,size:t,hasBeenDragged:!0})}handleStateChange(){const e=De(this.id);if(e){if((e.parentId||_t(this.id))&&(this.stateManager.wasRestored=!0),!this.drag.isDragging()&&!this.resize.isResizing()&&e.position){const t=this.drag.getPosition(),i=e.position;(Math.abs(t.x-i.x)>.5||Math.abs(t.y-i.y)>.5)&&(this.drag.setPosition(i),e.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 Pn(e){return new Mn(e)}export{Ai as ANIMATION_DURATIONS,Ei as ANIMATION_NAMES,Mi as CSS,Pi as CSS_CLASSES,xi as DATA_ATTRIBUTES,Ci as DATA_ATTRS,ki as DEFAULTS,Ie as DURATIONS,Ae as EASINGS,Si as FOCUSABLE_SELECTORS,Mn as ModalController,zn as ModalInteractions,wn as ModalLifecycle,yn as ModalPositioning,vn as ModalStateManager,Ii as RESIZE_DIRECTIONS,bi as RESIZE_DIRECTION_LABELS,ie as _getInternalState,te as _resetInternalState,ii as acquireModalZIndex,Qe as animateModalsToPositions,qe as applyLayoutPositions,J as batchUpdates,re as bringToFront,Qi as calculateCenteredChildPosition,Jt as calculateChildCenterPosition,Zi as calculateChildPosition,Oi as calculateDockDragPosition,Me as calculateEqualSpaceLayout,pe as calculateMinDistance,dn as calculateMinimizeTransform,Ki as calculateOffsetFromParent,hn as calculateOpenTransform,ue as calculateOverlap,Ji as calculateParentPosition,ln as calculateRestoreTransform,Me as calculateSmartLayout,me as calculateTotalOverlap,Je as cleanupResizeListener,Wt as clearActiveAttention,et as clearPendingParentAnimation,Ve as clearPositionAnimation,vt as closeAllModals,zt as closeModal,we as computeAvailableArea,fn as computeCssClasses,pn as computeStyle,Ti as constrainDockPosition,ge as constrainSizeToViewport,ce as constrainToViewport,Yt as consumeOpenSourcePosition,Lt as consumePendingAttention,Ot as consumePendingChildRestore,Rt as consumePendingClose,Et as consumePendingForceClose,xt as consumePendingMinimize,Xt as consumePendingMinimizeTarget,bt as consumePendingMinimizeWithParent,kt as consumePendingOpen,$t as consumePendingParentAnimation,qt as consumePendingParentLink,Ht as consumePendingRestore,Ui as containsFocus,mn as createAnimationController,zi as createConfigHelper,vi as createConfigResolver,$i as createDragBehavior,si as createEventEmitter,ji as createFocusTrap,yt as createModal,Pn as createModalController,ne as createModalRegistration,Vi as createResizeBehavior,ri as defaultConfig,pt as endAttentionAnimation,rt as finalizeChildMinimize,Mt as finalizeModalClose,nn as findChildModalElement,tn as findParentModalElement,rn as findRootAncestor,Re as flipAnimate,Xi as focusFirstElement,qi as focusLastElement,an as getAncestorIds,_i as getBackdropConfig,mi as getConfig,ui as getConfigVersion,gn as getDefaultDockTarget,sn as getDescendantIds,Li as getDockClasses,Fi as getDockContainerClasses,Le as getDockItemElement,un as getDockItemPosition,Fe as getDockOrder,ke as getDuration,Se as getEasing,fe as getElementBounds,Ni as getFocusableElements,ni as getLayerZIndex,Hi as getMinimizedModals,en as getModalBounds,Ce as getModalDialogElement,We as getModalLayoutInfos,De as getModalState,Oe as getModalsStore,Pt as getModalsToClose,_e as getOpenModalBounds,Ge as getOpenModalBoundsWithIds,Nt as getOpenSourcePosition,Zt as getPendingParentAnimation,jt as getPendingParentLink,K as getStateVersion,je as handleWindowResize,Wi as hasOpenModals,Ft as hasPendingAttention,Tt as hasPendingChildRestore,St as hasPendingClose,Dt as hasPendingForceClose,Ct as hasPendingMinimize,It as hasPendingMinimizeWithParent,At as hasPendingOpen,Gt as hasPendingParentAnimation,_t as hasPendingParentLinkFor,Bt as hasPendingRestore,dt as hideChildWithParent,Ze as initializeResizeListener,ti as initializeStacking,Gi as isBackdropEnabled,yi as isFeatureEnabled,He as isModalAnimating,Ee as isModalOpen,Be as isModalRegistered,de as isTopModal,Ut as linkModals,wi as mergeConfig,it as minimizeModal,ai as normalizeBackdropConfig,Di as onAnimationEnd,ft as openChildModal,wt as openModal,oe as registerModal,le as reorderDock,fi as resetConfig,ut as resetModalTransparency,oi as resetStacking,ot as restoreAllMinimizedModals,st as restoreChildModal,nt as restoreModal,xe as screenCenter,pi as setConfig,O as setDockPositionGetterInternal,Te as setModalAnimating,L as setRegistryCallbacksInternal,L as setRegistryFunctions,H as setURLCallbacks,H as setURLStateCallbacks,Bi as setupAnimationEndListener,ct as shakeElement,on as shouldChildBeVisible,mt as startAttentionAnimation,Vt as storeOpenSourcePosition,Z as subscribe,ci as subscribeToConfig,Pe as toDataId,lt as toggleModalTransparency,cn as transformToCSSVars,Yi as trapFocus,ht as triggerAttention,Kt as triggerCascadingParentAnimations,Xe as triggerRearrangement,gt as triggerRejection,at as unhideChildModal,se as unregisterModal,Ye as updateModal,$e as updateModalPosition,Ne as updateModalSize,Ri as whenHasDimensions};
|
package/dist/react.d.ts
CHANGED
|
@@ -1,12 +1,101 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export
|
|
9
|
-
|
|
10
|
-
export
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
import { BaseModalProps } from '../../../core/types';
|
|
2
|
+
import { default as default_2 } from 'react';
|
|
3
|
+
import { JSX } from 'react/jsx-runtime';
|
|
4
|
+
import { ModalId } from '../../core/types';
|
|
5
|
+
import { ModalLibraryConfig } from '../../core/config';
|
|
6
|
+
import { ReactNode } from 'react';
|
|
7
|
+
|
|
8
|
+
export declare function Dock({ renderIcon: renderIconProp }: DockProps): JSX.Element | null;
|
|
9
|
+
|
|
10
|
+
export declare interface DockProps {
|
|
11
|
+
|
|
12
|
+
renderIcon?: (icon: string) => ReactNode;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export declare function Modal({ id, title, icon, maxWidth, preferredHeight, autoOpen, glow, config, closeOnEscape, onClose, children, footer, renderIcon, }: ModalProps): JSX.Element;
|
|
16
|
+
|
|
17
|
+
export declare interface ModalProps extends BaseModalProps {
|
|
18
|
+
children?: ReactNode;
|
|
19
|
+
footer?: ReactNode;
|
|
20
|
+
|
|
21
|
+
renderIcon?: () => ReactNode;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export declare function ModalProvider({ config: configOverride, children }: ModalProviderProps): default_2.FunctionComponentElement<default_2.ProviderProps<Partial<ModalLibraryConfig> | undefined>>;
|
|
25
|
+
|
|
26
|
+
export declare interface ModalProviderProps {
|
|
27
|
+
|
|
28
|
+
config?: Partial<ModalLibraryConfig>;
|
|
29
|
+
|
|
30
|
+
children?: ReactNode;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
declare interface ModalsSnapshot {
|
|
34
|
+
modals: Map<ModalId, unknown>;
|
|
35
|
+
minimizedCount: number;
|
|
36
|
+
openCount: number;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export declare function useModal(id: ModalId): {
|
|
40
|
+
open: (sourceElement: HTMLElement) => void;
|
|
41
|
+
close: () => void;
|
|
42
|
+
minimize: () => void;
|
|
43
|
+
restore: () => void;
|
|
44
|
+
openChild: (childId: ModalId, sourceElement?: HTMLElement) => void;
|
|
45
|
+
shake: () => void;
|
|
46
|
+
bringToFront: () => void;
|
|
47
|
+
isOpen: boolean;
|
|
48
|
+
isMinimized: boolean;
|
|
49
|
+
isRegistered: boolean;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export declare function useModals(): ModalsSnapshot;
|
|
53
|
+
|
|
54
|
+
declare interface WizardControls {
|
|
55
|
+
currentStep: number;
|
|
56
|
+
totalSteps: number;
|
|
57
|
+
isFirstStep: boolean;
|
|
58
|
+
isLastStep: boolean;
|
|
59
|
+
canProceed: boolean;
|
|
60
|
+
progress: number;
|
|
61
|
+
steps: Array<{
|
|
62
|
+
title: string;
|
|
63
|
+
}>;
|
|
64
|
+
next: () => void;
|
|
65
|
+
back: () => void;
|
|
66
|
+
goToStep: (index: number) => void;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export declare function WizardModal({ id, onComplete, onStepChange, footer, showProgress, showNavigation, maxWidth, children, onClose, ...modalProps }: WizardModalProps): JSX.Element;
|
|
70
|
+
|
|
71
|
+
export declare interface WizardModalProps extends Omit<ModalProps, 'children' | 'footer'> {
|
|
72
|
+
|
|
73
|
+
onComplete?: () => void;
|
|
74
|
+
|
|
75
|
+
onStepChange?: (step: number, direction: 'forward' | 'backward') => void;
|
|
76
|
+
|
|
77
|
+
footer?: (controls: WizardControls) => ReactNode;
|
|
78
|
+
|
|
79
|
+
showProgress?: boolean;
|
|
80
|
+
|
|
81
|
+
showNavigation?: boolean;
|
|
82
|
+
|
|
83
|
+
children?: ReactNode;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export declare function WizardStep({ children }: WizardStepProps): JSX.Element;
|
|
87
|
+
|
|
88
|
+
export declare namespace WizardStep {
|
|
89
|
+
var displayName: string;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export declare interface WizardStepProps {
|
|
93
|
+
|
|
94
|
+
title?: string;
|
|
95
|
+
|
|
96
|
+
canProceed?: boolean;
|
|
97
|
+
|
|
98
|
+
children?: ReactNode;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export { }
|
package/dist/react.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as n,Fragment as t}from"react/jsx-runtime";import i,{useRef as r,createContext as o,useContext as a,useState as l,useEffect as s,useMemo as d,useCallback as c,Children as u,isValidElement as p,useSyncExternalStore as m}from"react";import{C as h,R as g,a as f,g as b,c as v,M as w,b as y,i as C,t as z,r as x,u as k,d as I,e as N,f as D,h as E,j as S,k as T,l as $,m as L,n as M,o as P,p as R,s as A,q as O,v as B,w as W,x as H,y as F,z as j,A as V,B as G,D as X,E as K,F as q,G as U,H as Y,I as _}from"./runtime.js";import{createPortal as J}from"react-dom";function Q({target:e="#modal-portal",children:n}){const t=r(null);if(null===t.current)if("string"==typeof e){let n=document.querySelector(e);n||(e.startsWith("#")?(n=document.createElement("div"),n.id=e.slice(1),document.body.appendChild(n)):n=document.body),t.current=n}else t.current=e;return J(n,t.current)}const Z=o(null),ee=o(void 0),ne=o(void 0);function te({title:t,customIcon:i,icon:r,isTransparent:o=!1,titleId:l,headerLayout:s="macos",onStartDrag:d,onToggleStyle:c,onMinimize:u,onClose:p,minimizable:m=!0,minimizeDisabled:g=!1,transparencyEnabled:f=!0}){const b=a(ne),v="macos"===s;function w(e){e.target.closest("button")||null==d||d(e)}const y=[h.header,d&&h.headerDraggable,o&&"transparent"].filter(Boolean).join(" "),C=i??(r&&b?b(r):null);return e("header",v?{className:y,onPointerDown:w,children:[e("div",{className:h.headerTrafficLights,children:[n("button",{type:"button",className:`${h.headerLight} ${h.headerLightClose}`,onClick:p,"aria-label":"Close"}),m&&n("button",{type:"button",className:`${h.headerLight} ${h.headerLightMinimize}${g?` ${h.headerLightDisabled}`:""}`,onClick:g?void 0:u,disabled:g,"aria-label":"Minimize",title:g?"Enable dock to minimize":void 0}),f&&n("button",{type:"button",className:`${h.headerLight} ${h.headerLightStyle}`,onClick:c,"aria-label":"Toggle style"})]}),e("div",{className:h.headerMacCenter,children:[C&&n("div",{className:h.headerIcon,children:C}),n("div",{className:h.headerTitleGroup,children:n("h2",l?{id:l,className:h.headerTitle,children:t}:{className:h.headerTitle,children:t})})]}),n("div",{className:h.headerMacSpacer})]}:{className:y,onPointerDown:w,children:[e("div",{className:h.headerTitleGroup,children:[C&&n("div",{className:h.headerIcon,children:C}),n("h2",l?{id:l,className:h.headerTitle,children:t}:{className:h.headerTitle,children:t})]}),e("div",{className:h.headerActions,children:[f&&n("button",{type:"button",className:`${h.headerBtnWindows} ${h.headerBtnWindowsStyle}`,onClick:c,"aria-label":"Toggle style",children:"◇"}),m&&n("button",{type:"button",className:`${h.headerBtnWindows}${g?` ${h.headerBtnWindowsDisabled}`:""}`,onClick:g?void 0:u,disabled:g,"aria-label":"Minimize",title:g?"Enable dock to minimize":void 0,children:"–"}),n("button",{type:"button",className:`${h.headerBtnWindows} ${h.headerBtnWindowsClose}`,onClick:p,"aria-label":"Close",children:"×"})]})]})}function ie({onStartResize:e}){return e?n("div",{className:h.resizeHandles,role:"group","aria-label":"Resize handles",children:g.map(t=>n("div",{className:`${h.resizeHandle} ${h.resizePrefix}${t}`,role:"separator",tabIndex:0,"aria-label":f[t],"aria-orientation":"n"===t||"s"===t?"horizontal":"vertical",onPointerDown:n=>e(n,t)},t))}):null}function re(e){return e.replace(/-([a-z])/g,(e,n)=>n.toUpperCase())}const oe={position:{x:0,y:0},size:{width:0,height:0},zIndex:1e3,isDragging:!1,isResizing:!1,hasBeenDragged:!1,hasBeenResized:!1,isMinimizing:!1,isRestoring:!1,isOpening:!1,isClosing:!1,isAnyAnimating:!1,animationTransform:null,isVisible:!1,showCentered:!1,isAwaitingRestore:!1,isAwaitingChildOpen:!1,isVisibleByAnimation:!1,hasChild:!1,isChildModal:!1,showOverlay:!1,isTransparent:!1,isAttentionAnimating:!1,glowStabilizing:!1,isAnimatingPosition:!1,isAnimatingToCenter:!1,wasRestored:!1,overlayClosing:!1,glowEnabled:!1,draggable:!0,resizable:!0,minimizable:!0,dataState:"closed",dataAnimationPhase:"none",style:{},cssClasses:[h.modal]};function ae({id:t,title:i,renderIcon:o,icon:u,description:p,maxWidth:m="600px",preferredHeight:g,autoOpen:f=!1,openSourcePosition:x,glow:k,config:I,providerConfig:N,closeOnEscape:D=!0,onClose:E,children:S,footer:T,skipRegistration:$=!1}){const L=r(null),M=r(null),P=a(ee),R=N??P,A=function(e={}){const{modalConfig:n}=e,t=a(ee),[i,r]=l(()=>b());return s(()=>{const e=setInterval(()=>{const e=b();e!==i&&r(e)},50);return()=>clearInterval(e)},[i]),d(()=>({...v({getModalConfig:()=>n,getProviderConfig:()=>t??void 0}),providerConfig:t}),[n,t,i])}({modalConfig:I}),O=A.getEffectiveConfig().portalTarget,B=!A.isFeatureEnabled("dock"),W=A.isFeatureEnabled("transparency"),H=A.getAppearance("headerLayout"),[F,j]=l(oe),V=z(t),G=`modal-title-${V}`,X=p?`modal-desc-${V}`:void 0;s(()=>{const e=new w({id:t,title:i,icon:u,config:I,providerConfig:R,maxWidth:m,preferredHeight:g,glow:k,closeOnEscape:D,autoOpen:f,openSourcePosition:x,onClose:E,skipRegistration:$,configHelper:A});M.current=e;const n=e.subscribe(e=>{j(e)});return j(e.getState()),()=>{n(),e.destroy(),M.current=null}},[t]),s(()=>{L.current&&M.current&&F.isVisible&&M.current.mount(L.current)},[F.isVisible]),s(()=>{var e;null==(e=M.current)||e.updateGlow(k)},[k]);const K=r(F.isVisible);K.current=F.isVisible,s(()=>{if(!D)return;const e=e=>{"Escape"===e.key&&K.current&&(e._modalEscapeHandled||M.current&&C(t)&&(M.current.handleKeyDown(e),e._modalEscapeHandled=!0))};return document.addEventListener("keydown",e,!0),()=>document.removeEventListener("keydown",e,!0)},[D,t]),s(()=>{M.current&&void 0!==x&&M.current.setOpenSourcePosition(x)},[x]);const q=c(e=>{var n;null==(n=M.current)||n.startDrag(e.nativeEvent)},[]),U=c(e=>{var n;null==(n=M.current)||n.handlePointerMove(e.nativeEvent)},[]),Y=c(e=>{var n;null==(n=M.current)||n.handlePointerUp(e.nativeEvent)},[]),_=c(e=>{var n;null==(n=M.current)||n.handleKeyDown(e.nativeEvent)},[]),J=c(()=>{var e;null==(e=M.current)||e.minimize()},[]),ne=c(()=>{var e;null==(e=M.current)||e.close()},[]),ae=c(()=>{var e;null==(e=M.current)||e.toggleTransparency()},[]),le=c((e,n)=>{var t;null==(t=M.current)||t.startResize(e.nativeEvent,n)},[]),se=d(()=>function(e){const n={};for(const[t,i]of Object.entries(e))t.startsWith("--")?n[t]=i:n[re(t)]=i;return n}(F.style),[F.style]);return F.isVisible?n(Q,{target:O,children:n(Z.Provider,{value:t,children:e("div",{ref:L,className:F.cssClasses.join(" "),"data-modal-id":V,"data-state":F.dataState,"data-animation-phase":F.dataAnimationPhase,style:se,role:"dialog","aria-modal":"true","aria-labelledby":G,"aria-describedby":X,tabIndex:-1,onKeyDown:_,onPointerMove:U,onPointerUp:Y,onPointerDownCapture:()=>y(t),children:[p&&n("span",{id:X,className:"sr-only",children:p}),n(te,{title:i,customIcon:null==o?void 0:o(),icon:u,isTransparent:F.isTransparent,titleId:G,headerLayout:H,onStartDrag:F.draggable?q:void 0,onToggleStyle:ae,onMinimize:J,onClose:ne,minimizable:F.minimizable,minimizeDisabled:B,transparencyEnabled:W}),n("div",{className:h.body,children:S}),T&&n("div",{className:h.footer,children:T}),n(ie,{onStartResize:F.resizable&&!F.hasChild?le:void 0}),F.showOverlay&&n("div",{className:`${h.childOverlay}${F.overlayClosing?` ${h.overlayClosing}`:""}`})]})})}):null}function le({id:e,title:t,icon:i,maxWidth:r="600px",preferredHeight:o,autoOpen:l=!1,glow:d,config:c,closeOnEscape:u=!0,onClose:p,children:m,footer:h,renderIcon:g}){const f=a(ee),b=a(ne);return s(()=>(x(I({id:e,title:t,icon:i,autoOpen:l,glow:d})),l&&y(e),()=>{k(e)}),[e]),n(ae,{id:e,title:t,icon:i,renderIcon:g??(i&&b?()=>b(i):void 0),maxWidth:r,preferredHeight:o,autoOpen:l,glow:d,config:c,providerConfig:f??void 0,closeOnEscape:u,onClose:p,skipRegistration:!0,footer:h,children:m})}function se({children:e}){return n(t,{children:e})}function de(e){var n;return p(e)&&(e.type===se||"WizardStep"===(null==(n=e.type)?void 0:n.displayName))}function ce({id:t,onComplete:i,onStepChange:o,footer:a,showProgress:d=!0,showNavigation:p=!0,maxWidth:m="500px",children:h,onClose:g,...f}){const b=u.toArray(h).filter(de),[v,w]=l(0),[y,C]=l("forward"),[z,x]=l(!1),[k,I]=l(0),N=r(v),D=b[v],E=(null==D?void 0:D.props.canProceed)??!0;s(()=>{if(v!==N.current){C(v>N.current?"forward":"backward"),x(!0),I(e=>e+1);const e=setTimeout(()=>x(!1),300);return N.current=v,()=>clearTimeout(e)}},[v]);const S=c(()=>{if(E)if(v>=b.length-1)null==i||i();else{const e=v+1;w(e),null==o||o(e,"forward")}},[v,b.length,E,i,o]),T=c(()=>{if(v>0){const e=v-1;w(e),null==o||o(e,"backward")}},[v,o]),$=c(e=>{e<v&&e>=0&&(w(e),null==o||o(e,"backward"))},[v,o]),L=0===v,M=v===b.length-1,P=b.length>0?(v+1)/b.length*100:0,R=b.length,A=b.map(e=>({title:e.props.title||""})),O={currentStep:v,totalSteps:R,isFirstStep:L,isLastStep:M,canProceed:E,progress:P,steps:A,next:S,back:T,goToStep:$},B=c(()=>{w(0),null==g||g()},[g]),W=d&&R>1,H=p?e("div",{className:"wizard-navigation",style:pe.navigation,children:[n("button",{className:"wizard-btn-back",style:{...pe.button,...L?pe.buttonDisabled:{}},onClick:T,disabled:L,children:"Back"}),n("button",{className:"wizard-btn-next",style:{...pe.button,...pe.buttonPrimary,...E?{}:pe.buttonDisabled},onClick:S,disabled:!E,children:M?"Finish":"Next"})]}):null;return e(le,{id:t,maxWidth:m,onClose:B,footer:a?a(O):H,...f,children:[e("div",{className:"wizard-viewport",style:ue.viewport,children:[W&&n("div",{className:"wizard-progress",style:pe.progress,children:A.map((t,i)=>e("div",{style:pe.stepItem,children:[n("button",{className:`wizard-step-dot ${i===v?"active":""} ${i<v?"completed":""}`,style:{...pe.stepDot,...i===v?pe.stepDotActive:{},...i<v?pe.stepDotCompleted:{}},onClick:()=>$(i),disabled:i>=v}),t.title&&n("span",{style:pe.stepTitle,children:t.title})]},i))}),n("div",{className:"wizard-container",style:ue.container,children:n("div",{className:"wizard-step-content "+(z?"forward"===y?"wizard-slide-left":"wizard-slide-right":""),style:ue.stepContent,children:D},k)})]}),n("style",{children:me})]})}se.displayName="WizardStep";const ue={viewport:{display:"flex",flexDirection:"column",height:"100%",overflow:"hidden"},container:{display:"flex",flexDirection:"column",flex:1,minHeight:0},stepContent:{flex:1,overflowY:"auto"}},pe={progress:{display:"flex",justifyContent:"center",alignItems:"flex-start",gap:"24px",padding:"12px 16px",borderBottom:"1px solid rgba(255, 255, 255, 0.1)"},stepItem:{display:"flex",flexDirection:"column",alignItems:"center",gap:"6px"},stepDot:{width:"10px",height:"10px",borderRadius:"50%",border:"2px solid rgba(255, 255, 255, 0.3)",background:"transparent",padding:0,cursor:"pointer",transition:"all 0.2s ease"},stepDotActive:{borderColor:"#6366f1",background:"#6366f1",transform:"scale(1.2)"},stepDotCompleted:{borderColor:"#6366f1",background:"#6366f1",opacity:.6},stepTitle:{fontSize:"11px",color:"rgba(255, 255, 255, 0.6)",textAlign:"center",maxWidth:"80px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},navigation:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"12px 16px",borderTop:"1px solid rgba(255, 255, 255, 0.1)",gap:"12px"},button:{padding:"8px 16px",borderRadius:"6px",border:"1px solid rgba(255, 255, 255, 0.2)",background:"rgba(255, 255, 255, 0.05)",color:"rgba(255, 255, 255, 0.8)",cursor:"pointer",fontSize:"14px",fontWeight:500,transition:"all 0.2s ease"},buttonPrimary:{background:"linear-gradient(135deg, #6366f1, #8b5cf6)",border:"none",color:"white"},buttonDisabled:{opacity:.4,cursor:"not-allowed"}},me="\n .wizard-slide-left {\n animation: wizardSlideInFromRight 0.3s ease forwards;\n }\n .wizard-slide-right {\n animation: wizardSlideInFromLeft 0.3s ease forwards;\n }\n @keyframes wizardSlideInFromRight {\n from { opacity: 0; transform: translateX(30px); }\n to { opacity: 1; transform: translateX(0); }\n }\n @keyframes wizardSlideInFromLeft {\n from { opacity: 0; transform: translateX(-30px); }\n to { opacity: 1; transform: translateX(0); }\n }\n";function he({className:e}){const t=a(ee),[,i]=l(0);s(()=>{const e=setInterval(()=>{i(e=>e+1)},50);return()=>clearInterval(e)},[]);const r=T(),o=(null==t?void 0:t.portalTarget)??r.portalTarget,d=N(),c=D(),u=E(),p=S("MODAL")-1;if(!d||!u)return null;const m=[h.backdrop,c.visible&&"backdrop-visible",c.blockClicks&&"backdrop-blocking",e].filter(Boolean).join(" ");return n(Q,{target:o,children:n("div",{className:m,style:{zIndex:p},"aria-hidden":"true"})})}function ge({config:e,children:n}){s(()=>{$(),L();const n=T(),t=(null==e?void 0:e.portalTarget)??n.portalTarget;let i=null;return"string"==typeof t&&"undefined"!=typeof document&&(document.querySelector(t)||(i=document.createElement("div"),i.id=t.replace("#",""),document.body.appendChild(i))),()=>{M(),P(),i&&i.remove()}},[e]);const t=d(()=>e,[e]);return i.createElement(ee.Provider,{value:t},i.createElement(i.Fragment,null,n,i.createElement(he,null)))}function fe({modal:t,childModal:i,labelMode:r="beside",renderIcon:o,animationDelay:l=0}){const s=a(ne),d=o??s,u=c(e=>{R(t.id)?A(e.currentTarget):O(t.id)},[t.id]),p=z(t.id),m=!!t.glow,g=!!t.lastChildId,f=[h.dockItem,m&&h.dockItemHasGlow,g&&h.dockItemHasChild,"beside"===r&&h.dockItemLabelBeside,"below"===r&&h.dockItemLabelBelow].filter(Boolean).join(" "),b={...t.glow?{"--modal-dock-glow-color":t.glow.color}:{},animationDelay:l>0?`${l}ms`:void 0};return e("button",{className:f,"data-modal-id":p,"aria-label":`Restore ${t.title}`,onClick:u,style:b,children:[n("span",{className:h.dockItemIcon,children:t.icon&&d?d(t.icon):n("span",{className:h.dockItemIconPlaceholder,children:t.title.charAt(0)})}),"hidden"!==r&&n("span",{className:h.dockItemLabel,children:t.title}),n("span",{className:h.dockItemGlow}),g&&i&&n("span",{className:h.dockChildIndicator,children:i.icon&&d?d(i.icon):n("span",{children:"+"})})]})}function be({renderIcon:t}){var i,o,d;const u=a(ne),p=a(ee),m=t??u,[g,f]=l(0),[v,w]=l(0),[y,C]=l("horizontal"),[z,x]=l({x:100,y:100}),[k,I]=l(!1),N=r(null),D=r({x:0,y:0}),E=r(null);s(()=>B(()=>{f(e=>e+1),w(b())}),[]);const $=T(),L=S("DOCK"),M=(null==(i=null==p?void 0:p.dock)?void 0:i.position)??$.dock.position,P=(null==(o=null==p?void 0:p.dock)?void 0:o.labelMode)??$.dock.labelMode,R=(null==(d=null==p?void 0:p.features)?void 0:d.dock)??$.features.dock,A=(null==p?void 0:p.portalTarget)??$.portalTarget,O=G(),X=W(),K=c(e=>{var n;"free"===M&&(I(!0),E.current=e.pointerId,D.current={x:e.clientX-z.x,y:e.clientY-z.y},null==(n=e.currentTarget)||n.setPointerCapture(e.pointerId))},[M,z]);if(s(()=>{if(!k)return;const e=e=>{if(e.pointerId!==E.current||!N.current)return;const n=N.current.getBoundingClientRect(),t=F(e.clientX,e.clientY,D.current,n.width,n.height);x(t)},n=e=>{e.pointerId===E.current&&(I(!1),E.current=null)};return window.addEventListener("pointermove",e),window.addEventListener("pointerup",n),window.addEventListener("pointercancel",n),()=>{window.removeEventListener("pointermove",e),window.removeEventListener("pointerup",n),window.removeEventListener("pointercancel",n)}},[k]),s(()=>{if("free"!==M)return;const e=()=>{if(!N.current)return;const e=N.current.getBoundingClientRect(),n=j(z,e.width,e.height);n.x===z.x&&n.y===z.y||x(n)};return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[M,z]),!R)return null;const q=H(M,0===X.length),U=V(M,y),Y={zIndex:L,..."free"===M?{left:`${z.x}px`,top:`${z.y}px`}:{}};return n(Q,{target:A,children:n("div",{ref:N,className:q,style:Y,"data-dock-container":"true",children:e("div",{className:U,children:["free"===M&&n("button",{type:"button",className:`${h.dockHandle}${k?` ${h.dockHandleDragging}`:""}`,onPointerDown:K,"aria-label":"Drag dock"}),X.map((e,t)=>{const i=e.lastChildId?O.get(e.lastChildId):null;return n(fe,{modal:e,childModal:i,labelMode:P,renderIcon:m??void 0,animationDelay:50*t},String(e.id))})]})})})}function ve(e,n){if(!_(e))throw new Error(`Cannot call ${n}() on unregistered modal "${String(e)}". Ensure the Modal component is rendered.`)}const we=new Map;function ye(e){const n=c(()=>function(e){const n=G().get(e),t=void 0!==n&&!n.isMinimized,i=(null==n?void 0:n.isMinimized)??!1,r=void 0!==n,o=we.get(e);if(o&&o.isOpen===t&&o.isMinimized===i&&o.isRegistered===r)return o;const a={isOpen:t,isMinimized:i,isRegistered:r};return we.set(e,a),a}(e),[e]);return{...m(B,n,n),open:c(n=>{ve(e,"open"),X(e,n)},[e]),close:c(()=>{ve(e,"close"),K(e)},[e]),minimize:c(()=>{ve(e,"minimize"),q(e)},[e]),restore:c(()=>{ve(e,"restore"),O(e)},[e]),openChild:c((n,t)=>{ve(e,"openChild"),U(n,e,t??document.body)},[e]),shake:c(()=>{ve(e,"shake"),Y(e)},[e]),bringToFront:c(()=>{ve(e,"bringToFront"),y(e)},[e])}}let Ce=null,ze=null;function xe(){const e=G();if(Ce===e&&ze)return ze;const n=Array.from(e.values()),t=n.filter(e=>e.isMinimized).length,i=n.filter(e=>!e.isMinimized).length;return ze&&ze.minimizedCount===t&&ze.openCount===i?(Ce=e,ze={...ze,modals:e},ze):(Ce=e,ze={modals:e,minimizedCount:t,openCount:i},ze)}function ke(){return m(B,xe,xe)}export{be as Dock,le as Modal,ge as ModalProvider,ce as WizardModal,se as WizardStep,ye as useModal,ke as useModals};
|
|
1
|
+
import{jsxs as e,jsx as n,Fragment as t}from"react/jsx-runtime";import i,{useRef as r,createContext as o,useContext as a,useState as l,useEffect as s,useMemo as d,useCallback as c,Children as u,isValidElement as m,useSyncExternalStore as p}from"react";import{bringToFront as g,isTopModal as h,registerModal as f,createModalRegistration as b,unregisterModal as v,isModalAnimating as y,shakeElement as w,restoreModal as C,subscribe as z,getModalsStore as k,openModal as x,closeModal as I,minimizeModal as N,openChildModal as E,triggerAttention as M,isModalRegistered as S}from"./core.js";import{CSS as D,RESIZE_DIRECTIONS as T,RESIZE_DIRECTION_LABELS as $}from"./core.js";import{ModalController as L}from"./core.js";import{toDataId as R}from"./core.js";import{createPortal as P}from"react-dom";import{getConfigVersion as O,getConfig as A}from"./core.js";import{createConfigResolver as B}from"./core.js";import{getLayerZIndex as j,initializeStacking as W,resetStacking as H}from"./core.js";import{initializeResizeListener as F,cleanupResizeListener as V}from"./core.js";import{isBackdropEnabled as X,getBackdropConfig as G,hasOpenModals as _}from"./core.js";import{getMinimizedModals as K,getDockContainerClasses as U,getDockClasses as Y,calculateDockDragPosition as Z,constrainDockPosition as q}from"./core.js";function J({target:e="#modal-portal",children:n}){const t=r(null);if(null===t.current)if("string"==typeof e){let n=document.querySelector(e);n||(e.startsWith("#")?(n=document.createElement("div"),n.id=e.slice(1),document.body.appendChild(n)):n=document.body),t.current=n}else t.current=e;return P(n,t.current)}const Q=o(null),ee=o(void 0),ne=o(void 0);function te({title:t,customIcon:i,icon:r,isTransparent:o=!1,titleId:l,headerLayout:s="macos",onStartDrag:d,onToggleStyle:c,onMinimize:u,onClose:m,minimizable:p=!0,minimizeDisabled:g=!1,transparencyEnabled:h=!0}){const f=a(ne),b="macos"===s;function v(e){e.target.closest("button")||null==d||d(e)}const y=[D.header,d&&D.headerDraggable,o&&"transparent"].filter(Boolean).join(" "),w=i??(r&&f?f(r):null);return e("header",b?{className:y,onPointerDown:v,children:[e("div",{className:D.headerTrafficLights,children:[n("button",{type:"button",className:`${D.headerLight} ${D.headerLightClose}`,onClick:m,"aria-label":"Close"}),p&&n("button",{type:"button",className:`${D.headerLight} ${D.headerLightMinimize}${g?` ${D.headerLightDisabled}`:""}`,onClick:g?void 0:u,disabled:g,"aria-label":"Minimize",title:g?"Enable dock to minimize":void 0}),h&&n("button",{type:"button",className:`${D.headerLight} ${D.headerLightStyle}`,onClick:c,"aria-label":"Toggle style"})]}),e("div",{className:D.headerMacCenter,children:[w&&n("div",{className:D.headerIcon,children:w}),n("div",{className:D.headerTitleGroup,children:n("h2",l?{id:l,className:D.headerTitle,children:t}:{className:D.headerTitle,children:t})})]}),n("div",{className:D.headerMacSpacer})]}:{className:y,onPointerDown:v,children:[e("div",{className:D.headerTitleGroup,children:[w&&n("div",{className:D.headerIcon,children:w}),n("h2",l?{id:l,className:D.headerTitle,children:t}:{className:D.headerTitle,children:t})]}),e("div",{className:D.headerActions,children:[h&&n("button",{type:"button",className:`${D.headerBtnWindows} ${D.headerBtnWindowsStyle}`,onClick:c,"aria-label":"Toggle style",children:"◇"}),p&&n("button",{type:"button",className:`${D.headerBtnWindows}${g?` ${D.headerBtnWindowsDisabled}`:""}`,onClick:g?void 0:u,disabled:g,"aria-label":"Minimize",title:g?"Enable dock to minimize":void 0,children:"–"}),n("button",{type:"button",className:`${D.headerBtnWindows} ${D.headerBtnWindowsClose}`,onClick:m,"aria-label":"Close",children:"×"})]})]})}function ie({onStartResize:e}){return e?n("div",{className:D.resizeHandles,role:"group","aria-label":"Resize handles",children:T.map(t=>n("div",{className:`${D.resizeHandle} ${D.resizePrefix}${t}`,role:"separator",tabIndex:0,"aria-label":$[t],"aria-orientation":"n"===t||"s"===t?"horizontal":"vertical",onPointerDown:n=>e(n,t)},t))}):null}function re(e){return e.replace(/-([a-z])/g,(e,n)=>n.toUpperCase())}const oe={position:{x:0,y:0},size:{width:0,height:0},zIndex:1e3,isDragging:!1,isResizing:!1,hasBeenDragged:!1,hasBeenResized:!1,isMinimizing:!1,isRestoring:!1,isOpening:!1,isClosing:!1,isAnyAnimating:!1,animationTransform:null,isVisible:!1,showCentered:!1,isAwaitingRestore:!1,isAwaitingChildOpen:!1,isVisibleByAnimation:!1,hasChild:!1,isChildModal:!1,showOverlay:!1,isTransparent:!1,isAttentionAnimating:!1,glowStabilizing:!1,isAnimatingPosition:!1,isAnimatingToCenter:!1,wasRestored:!1,overlayClosing:!1,glowEnabled:!1,draggable:!0,resizable:!0,minimizable:!0,dataState:"closed",dataAnimationPhase:"none",style:{},cssClasses:[D.modal]};function ae({id:t,title:i,renderIcon:o,icon:u,description:m,maxWidth:p="600px",preferredHeight:f,autoOpen:b=!1,openSourcePosition:v,glow:y,config:w,providerConfig:C,closeOnEscape:z=!0,onClose:k,children:x,footer:I,skipRegistration:N=!1}){const E=r(null),M=r(null),S=a(ee),T=C??S,$=function(e={}){const{modalConfig:n}=e,t=a(ee),[i,r]=l(()=>O());return s(()=>{const e=setInterval(()=>{const e=O();e!==i&&r(e)},50);return()=>clearInterval(e)},[i]),d(()=>({...B({getModalConfig:()=>n,getProviderConfig:()=>t??void 0}),providerConfig:t}),[n,t,i])}({modalConfig:w}),P=$.getEffectiveConfig().portalTarget,A=!$.isFeatureEnabled("dock"),j=$.isFeatureEnabled("transparency"),W=$.getAppearance("headerLayout"),[H,F]=l(oe),V=R(t),X=`modal-title-${V}`,G=m?`modal-desc-${V}`:void 0;s(()=>{const e=new L({id:t,title:i,icon:u,config:w,providerConfig:T,maxWidth:p,preferredHeight:f,glow:y,closeOnEscape:z,autoOpen:b,openSourcePosition:v,onClose:k,skipRegistration:N,configHelper:$});M.current=e;const n=e.subscribe(e=>{F(e)});return F(e.getState()),()=>{n(),e.destroy(),M.current=null}},[t]),s(()=>{E.current&&M.current&&H.isVisible&&M.current.mount(E.current)},[H.isVisible]),s(()=>{var e;null==(e=M.current)||e.updateGlow(y)},[y]);const _=r(H.isVisible);_.current=H.isVisible,s(()=>{if(!z)return;const e=e=>{"Escape"===e.key&&_.current&&(e._modalEscapeHandled||M.current&&h(t)&&(M.current.handleKeyDown(e),e._modalEscapeHandled=!0))};return document.addEventListener("keydown",e,!0),()=>document.removeEventListener("keydown",e,!0)},[z,t]),s(()=>{M.current&&void 0!==v&&M.current.setOpenSourcePosition(v)},[v]);const K=c(e=>{var n;null==(n=M.current)||n.startDrag(e.nativeEvent)},[]),U=c(e=>{var n;null==(n=M.current)||n.handlePointerMove(e.nativeEvent)},[]),Y=c(e=>{var n;null==(n=M.current)||n.handlePointerUp(e.nativeEvent)},[]),Z=c(e=>{var n;null==(n=M.current)||n.handleKeyDown(e.nativeEvent)},[]),q=c(()=>{var e;null==(e=M.current)||e.minimize()},[]),ne=c(()=>{var e;null==(e=M.current)||e.close()},[]),ae=c(()=>{var e;null==(e=M.current)||e.toggleTransparency()},[]),le=c((e,n)=>{var t;null==(t=M.current)||t.startResize(e.nativeEvent,n)},[]),se=d(()=>function(e){const n={};for(const[t,i]of Object.entries(e))t.startsWith("--")?n[t]=i:n[re(t)]=i;return n}(H.style),[H.style]);return H.isVisible?n(J,{target:P,children:n(Q.Provider,{value:t,children:e("div",{ref:E,className:H.cssClasses.join(" "),"data-modal-id":V,"data-state":H.dataState,"data-animation-phase":H.dataAnimationPhase,style:se,role:"dialog","aria-modal":"true","aria-labelledby":X,"aria-describedby":G,tabIndex:-1,onKeyDown:Z,onPointerMove:U,onPointerUp:Y,onPointerDownCapture:()=>g(t),children:[m&&n("span",{id:G,className:"sr-only",children:m}),n(te,{title:i,customIcon:null==o?void 0:o(),icon:u,isTransparent:H.isTransparent,titleId:X,headerLayout:W,onStartDrag:H.draggable?K:void 0,onToggleStyle:ae,onMinimize:q,onClose:ne,minimizable:H.minimizable,minimizeDisabled:A,transparencyEnabled:j}),n("div",{className:D.body,children:x}),I&&n("div",{className:D.footer,children:I}),n(ie,{onStartResize:H.resizable&&!H.hasChild?le:void 0}),H.showOverlay&&n("div",{className:`${D.childOverlay}${H.overlayClosing?` ${D.overlayClosing}`:""}`})]})})}):null}function le({id:e,title:t,icon:i,maxWidth:r="600px",preferredHeight:o,autoOpen:l=!1,glow:d,config:c,closeOnEscape:u=!0,onClose:m,children:p,footer:h,renderIcon:y}){const w=a(ee),C=a(ne);return s(()=>(f(b({id:e,title:t,icon:i,autoOpen:l,glow:d})),l&&g(e),()=>{v(e)}),[e]),n(ae,{id:e,title:t,icon:i,renderIcon:y??(i&&C?()=>C(i):void 0),maxWidth:r,preferredHeight:o,autoOpen:l,glow:d,config:c,providerConfig:w??void 0,closeOnEscape:u,onClose:m,skipRegistration:!0,footer:h,children:p})}function se({children:e}){return n(t,{children:e})}function de(e){var n;return m(e)&&(e.type===se||"WizardStep"===(null==(n=e.type)?void 0:n.displayName))}function ce({id:t,onComplete:i,onStepChange:o,footer:a,showProgress:d=!0,showNavigation:m=!0,maxWidth:p="500px",children:g,onClose:h,...f}){const b=u.toArray(g).filter(de),[v,y]=l(0),[w,C]=l("forward"),[z,k]=l(!1),[x,I]=l(0),N=r(v),E=b[v],M=(null==E?void 0:E.props.canProceed)??!0;s(()=>{if(v!==N.current){C(v>N.current?"forward":"backward"),k(!0),I(e=>e+1);const e=setTimeout(()=>k(!1),300);return N.current=v,()=>clearTimeout(e)}},[v]);const S=c(()=>{if(M)if(v>=b.length-1)null==i||i();else{const e=v+1;y(e),null==o||o(e,"forward")}},[v,b.length,M,i,o]),D=c(()=>{if(v>0){const e=v-1;y(e),null==o||o(e,"backward")}},[v,o]),T=c(e=>{e<v&&e>=0&&(y(e),null==o||o(e,"backward"))},[v,o]),$=0===v,L=v===b.length-1,R=b.length>0?(v+1)/b.length*100:0,P=b.length,O=b.map(e=>({title:e.props.title||""})),A={currentStep:v,totalSteps:P,isFirstStep:$,isLastStep:L,canProceed:M,progress:R,steps:O,next:S,back:D,goToStep:T},B=c(()=>{y(0),null==h||h()},[h]),j=d&&P>1,W=m?e("div",{className:"wizard-navigation",style:me.navigation,children:[n("button",{className:"wizard-btn-back",style:{...me.button,...$?me.buttonDisabled:{}},onClick:D,disabled:$,children:"Back"}),n("button",{className:"wizard-btn-next",style:{...me.button,...me.buttonPrimary,...M?{}:me.buttonDisabled},onClick:S,disabled:!M,children:L?"Finish":"Next"})]}):null;return e(le,{id:t,maxWidth:p,onClose:B,footer:a?a(A):W,...f,children:[e("div",{className:"wizard-viewport",style:ue.viewport,children:[j&&n("div",{className:"wizard-progress",style:me.progress,children:O.map((t,i)=>e("div",{style:me.stepItem,children:[n("button",{className:`wizard-step-dot ${i===v?"active":""} ${i<v?"completed":""}`,style:{...me.stepDot,...i===v?me.stepDotActive:{},...i<v?me.stepDotCompleted:{}},onClick:()=>T(i),disabled:i>=v}),t.title&&n("span",{style:me.stepTitle,children:t.title})]},i))}),n("div",{className:"wizard-container",style:ue.container,children:n("div",{className:"wizard-step-content "+(z?"forward"===w?"wizard-slide-left":"wizard-slide-right":""),style:ue.stepContent,children:E},x)})]}),n("style",{children:pe})]})}se.displayName="WizardStep";const ue={viewport:{display:"flex",flexDirection:"column",height:"100%",overflow:"hidden"},container:{display:"flex",flexDirection:"column",flex:1,minHeight:0},stepContent:{flex:1,overflowY:"auto"}},me={progress:{display:"flex",justifyContent:"center",alignItems:"flex-start",gap:"24px",padding:"12px 16px",borderBottom:"1px solid rgba(255, 255, 255, 0.1)"},stepItem:{display:"flex",flexDirection:"column",alignItems:"center",gap:"6px"},stepDot:{width:"10px",height:"10px",borderRadius:"50%",border:"2px solid rgba(255, 255, 255, 0.3)",background:"transparent",padding:0,cursor:"pointer",transition:"all 0.2s ease"},stepDotActive:{borderColor:"#6366f1",background:"#6366f1",transform:"scale(1.2)"},stepDotCompleted:{borderColor:"#6366f1",background:"#6366f1",opacity:.6},stepTitle:{fontSize:"11px",color:"rgba(255, 255, 255, 0.6)",textAlign:"center",maxWidth:"80px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},navigation:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"12px 16px",borderTop:"1px solid rgba(255, 255, 255, 0.1)",gap:"12px"},button:{padding:"8px 16px",borderRadius:"6px",border:"1px solid rgba(255, 255, 255, 0.2)",background:"rgba(255, 255, 255, 0.05)",color:"rgba(255, 255, 255, 0.8)",cursor:"pointer",fontSize:"14px",fontWeight:500,transition:"all 0.2s ease"},buttonPrimary:{background:"linear-gradient(135deg, #6366f1, #8b5cf6)",border:"none",color:"white"},buttonDisabled:{opacity:.4,cursor:"not-allowed"}},pe="\n .wizard-slide-left {\n animation: wizardSlideInFromRight 0.3s ease forwards;\n }\n .wizard-slide-right {\n animation: wizardSlideInFromLeft 0.3s ease forwards;\n }\n @keyframes wizardSlideInFromRight {\n from { opacity: 0; transform: translateX(30px); }\n to { opacity: 1; transform: translateX(0); }\n }\n @keyframes wizardSlideInFromLeft {\n from { opacity: 0; transform: translateX(-30px); }\n to { opacity: 1; transform: translateX(0); }\n }\n";function ge({className:e}){const t=a(ee),[,i]=l(0);s(()=>{const e=setInterval(()=>{i(e=>e+1)},50);return()=>clearInterval(e)},[]);const r=A(),o=(null==t?void 0:t.portalTarget)??r.portalTarget,d=X(),c=G(),u=_(),m=j("MODAL")-1;if(!d||!u)return null;const p=[D.backdrop,c.visible&&"backdrop-visible",c.blockClicks&&"backdrop-blocking",e].filter(Boolean).join(" ");return n(J,{target:o,children:n("div",{className:p,style:{zIndex:m},"aria-hidden":"true"})})}function he({config:e,children:n}){s(()=>{W(),F();const n=A(),t=(null==e?void 0:e.portalTarget)??n.portalTarget;let i=null;return"string"==typeof t&&typeof document<"u"&&(document.querySelector(t)||(i=document.createElement("div"),i.id=t.replace("#",""),document.body.appendChild(i))),()=>{H(),V(),i&&i.remove()}},[e]);const t=d(()=>e,[e]);return i.createElement(ee.Provider,{value:t},i.createElement(i.Fragment,null,n,i.createElement(ge,null)))}function fe({modal:t,childModal:i,labelMode:r="beside",renderIcon:o,animationDelay:l=0}){const s=a(ne),d=o??s,u=c(e=>{y(t.id)?w(e.currentTarget):C(t.id)},[t.id]),m=R(t.id),p=!!t.glow,g=!!t.lastChildId,h=[D.dockItem,p&&D.dockItemHasGlow,g&&D.dockItemHasChild,"beside"===r&&D.dockItemLabelBeside,"below"===r&&D.dockItemLabelBelow].filter(Boolean).join(" "),f={...t.glow?{"--modal-dock-glow-color":t.glow.color}:{},animationDelay:l>0?`${l}ms`:void 0};return e("button",{className:h,"data-modal-id":m,"aria-label":`Restore ${t.title}`,onClick:u,style:f,children:[n("span",{className:D.dockItemIcon,children:t.icon&&d?d(t.icon):n("span",{className:D.dockItemIconPlaceholder,children:t.title.charAt(0)})}),"hidden"!==r&&n("span",{className:D.dockItemLabel,children:t.title}),n("span",{className:D.dockItemGlow}),g&&i&&n("span",{className:D.dockChildIndicator,children:i.icon&&d?d(i.icon):n("span",{children:"+"})})]})}function be({renderIcon:t}){var i,o,d;const u=a(ne),m=a(ee),p=t??u,[g,h]=l(0),[f,b]=l(0),[v,y]=l("horizontal"),[w,C]=l({x:100,y:100}),[x,I]=l(!1),N=r(null),E=r({x:0,y:0}),M=r(null);s(()=>z(()=>{h(e=>e+1),b(O())}),[]);const S=A(),T=j("DOCK"),$=(null==(i=null==m?void 0:m.dock)?void 0:i.position)??S.dock.position,L=(null==(o=null==m?void 0:m.dock)?void 0:o.labelMode)??S.dock.labelMode,R=(null==(d=null==m?void 0:m.features)?void 0:d.dock)??S.features.dock,P=(null==m?void 0:m.portalTarget)??S.portalTarget,B=k(),W=K(),H=c(e=>{var n;"free"===$&&(I(!0),M.current=e.pointerId,E.current={x:e.clientX-w.x,y:e.clientY-w.y},null==(n=e.currentTarget)||n.setPointerCapture(e.pointerId))},[$,w]);if(s(()=>{if(!x)return;const e=e=>{if(e.pointerId!==M.current||!N.current)return;const n=N.current.getBoundingClientRect(),t=Z(e.clientX,e.clientY,E.current,n.width,n.height);C(t)},n=e=>{e.pointerId===M.current&&(I(!1),M.current=null)};return window.addEventListener("pointermove",e),window.addEventListener("pointerup",n),window.addEventListener("pointercancel",n),()=>{window.removeEventListener("pointermove",e),window.removeEventListener("pointerup",n),window.removeEventListener("pointercancel",n)}},[x]),s(()=>{if("free"!==$)return;const e=()=>{if(!N.current)return;const e=N.current.getBoundingClientRect(),n=q(w,e.width,e.height);(n.x!==w.x||n.y!==w.y)&&C(n)};return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[$,w]),!R)return null;const F=U($,0===W.length),V=Y($,v),X={zIndex:T,..."free"===$?{left:`${w.x}px`,top:`${w.y}px`}:{}};return n(J,{target:P,children:n("div",{ref:N,className:F,style:X,"data-dock-container":"true",children:e("div",{className:V,children:["free"===$&&n("button",{type:"button",className:`${D.dockHandle}${x?` ${D.dockHandleDragging}`:""}`,onPointerDown:H,"aria-label":"Drag dock"}),W.map((e,t)=>{const i=e.lastChildId?B.get(e.lastChildId):null;return n(fe,{modal:e,childModal:i,labelMode:L,renderIcon:p??void 0,animationDelay:50*t},String(e.id))})]})})})}function ve(e,n){if(!S(e))throw new Error(`Cannot call ${n}() on unregistered modal "${String(e)}". Ensure the Modal component is rendered.`)}const ye=new Map;function we(e){const n=c(()=>function(e){const n=k().get(e),t=void 0!==n&&!n.isMinimized,i=(null==n?void 0:n.isMinimized)??!1,r=void 0!==n,o=ye.get(e);if(o&&o.isOpen===t&&o.isMinimized===i&&o.isRegistered===r)return o;const a={isOpen:t,isMinimized:i,isRegistered:r};return ye.set(e,a),a}(e),[e]);return{...p(z,n,n),open:c(n=>{ve(e,"open"),x(e,n)},[e]),close:c(()=>{ve(e,"close"),I(e)},[e]),minimize:c(()=>{ve(e,"minimize"),N(e)},[e]),restore:c(()=>{ve(e,"restore"),C(e)},[e]),openChild:c((n,t)=>{ve(e,"openChild"),E(n,e,t??document.body)},[e]),shake:c(()=>{ve(e,"shake"),M(e)},[e]),bringToFront:c(()=>{ve(e,"bringToFront"),g(e)},[e])}}let Ce=null,ze=null;function ke(){const e=k();if(Ce===e&&ze)return ze;const n=Array.from(e.values()),t=n.filter(e=>e.isMinimized).length,i=n.filter(e=>!e.isMinimized).length;return ze&&ze.minimizedCount===t&&ze.openCount===i?(Ce=e,ze={...ze,modals:e},ze):(Ce=e,ze={modals:e,minimizedCount:t,openCount:i},ze)}function xe(){return p(z,ke,ke)}export{be as Dock,le as Modal,he as ModalProvider,ce as WizardModal,se as WizardStep,we as useModal,xe as useModals};
|