var q=Object.defineProperty,G=Object.defineProperties;var J=Object.getOwnPropertyDescriptors;var g=Object.getOwnPropertySymbols;var K=Object.prototype.hasOwnProperty,Q=Object.prototype.propertyIsEnumerable;var D=(e,o,t)=>o in e?q(e,o,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[o]=t,I=(e,o)=>{for(var t in o||(o={}))K.call(o,t)&&D(e,t,o[t]);if(g)for(var t of g(o))Q.call(o,t)&&D(e,t,o[t]);return e},P=(e,o)=>G(e,J(o));import{b as E,I as W,d as Y,J as j,K as H,L as x,M as X,O as R,P as ee,Q as F,R as oe}from"./base.b65bdcd1.js";import{U as h}from"./event.776e7e11.js";import{b as le}from"./index.efd5e5c6.js";import{r as f,c as O,w as T,W as te,o as ne,Y as ae}from"./index.965ac11d.js";const se=E({center:{type:Boolean,default:!1},alignCenter:{type:Boolean,default:!1},closeIcon:{type:W},customClass:{type:String,default:""},draggable:{type:Boolean,default:!1},fullscreen:{type:Boolean,default:!1},showClose:{type:Boolean,default:!0},title:{type:String,default:""}}),re={close:()=>!0},ye=E(P(I({},se),{appendToBody:{type:Boolean,default:!1},beforeClose:{type:Y(Function)},destroyOnClose:{type:Boolean,default:!1},closeOnClickModal:{type:Boolean,default:!0},closeOnPressEscape:{type:Boolean,default:!0},lockScroll:{type:Boolean,default:!0},modal:{type:Boolean,default:!0},openDelay:{type:Number,default:0},closeDelay:{type:Number,default:0},top:{type:String},modelValue:{type:Boolean,default:!1},modalClass:String,width:{type:[String,Number]},zIndex:{type:Number},trapFocus:{type:Boolean,default:!1}})),ve={open:()=>!0,opened:()=>!0,close:()=>!0,closed:()=>!0,[h]:e=>j(e),openAutoFocus:()=>!0,closeAutoFocus:()=>!0},me=(e,o)=>{const n=ae().emit,{nextZIndex:p}=H();let C="";const S=x(),k=x(),a=f(!1),d=f(!1),c=f(!1),r=f(e.zIndex||p());let u,i;const w=X("namespace",ee),A=O(()=>{const l={},s=`--${w.value}-dialog`;return e.fullscreen||(e.top&&(l[`${s}-margin-top`]=e.top),e.width&&(l[`${s}-width`]=R(e.width))),l}),M=O(()=>e.alignCenter?{display:"flex"}:{});function N(){n("opened")}function L(){n("closed"),n(h,!1),e.destroyOnClose&&(c.value=!1)}function z(){n("close")}function b(){i==null||i(),u==null||u(),e.openDelay&&e.openDelay>0?{stop:u}=F(()=>B(),e.openDelay):B()}function y(){u==null||u(),i==null||i(),e.closeDelay&&e.closeDelay>0?{stop:i}=F(()=>m(),e.closeDelay):m()}function v(){function l(s){s||(d.value=!0,a.value=!1)}e.beforeClose?e.beforeClose(l):y()}function V(){e.closeOnClickModal&&v()}function B(){!oe||(a.value=!0)}function m(){a.value=!1}function U(){n("openAutoFocus")}function _(){n("closeAutoFocus")}function $(l){var s;((s=l.detail)==null?void 0:s.focusReason)==="pointer"&&l.preventDefault()}e.lockScroll&&le(a);function Z(){e.closeOnPressEscape&&v()}return T(()=>e.modelValue,l=>{l?(d.value=!1,b(),c.value=!0,r.value=e.zIndex?r.value++:p(),te(()=>{n("open"),o.value&&(o.value.scrollTop=0)})):a.value&&y()}),T(()=>e.fullscreen,l=>{!o.value||(l?(C=o.value.style.transform,o.value.style.transform=""):o.value.style.transform=C)}),ne(()=>{e.modelValue&&(a.value=!0,c.value=!0,b())}),{afterEnter:N,afterLeave:L,beforeLeave:z,handleClose:v,onModalClick:V,close:y,doClose:m,onOpenAutoFocus:U,onCloseAutoFocus:_,onCloseRequested:Z,onFocusoutPrevented:$,titleId:S,bodyId:k,closed:d,style:A,overlayDialogStyle:M,rendered:c,visible:a,zIndex:r}};export{re as a,ye as b,ve as c,se as d,me as u};
