import{b as I,i as V,Z as _,m as c,c as g,Q as B,$,s as U,_ as Z,a6 as j,an as D,aj as q}from"./normalize-040897f0.js";import{i as G,g as Q}from"./base-4c430c4f.js";import{U as P,f as x}from"./el-button-0ee2e9a3.js";import{c as H,f as J}from"./config-provider-d42b9336.js";import{a as K}from"./el-overlay-b5a20fb9.js";const W=I({center:{type:Boolean,default:!1},alignCenter:{type:Boolean,default:!1},closeIcon:{type:G},customClass:{type:String,default:""},draggable:{type:Boolean,default:!1},fullscreen:{type:Boolean,default:!1},showClose:{type:Boolean,default:!0},title:{type:String,default:""}}),te={close:()=>!0},ne=I({...W,appendToBody:{type:Boolean,default:!1},beforeClose:{type:V(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}}),ae={open:()=>!0,opened:()=>!0,close:()=>!0,closed:()=>!0,[P]:e=>_(e),openAutoFocus:()=>!0,closeAutoFocus:()=>!0},se=(e,a)=>{const l=Z().emit,{nextZIndex:v}=H();let p="";const F=x(),T=x(),t=c(!1),f=c(!1),i=c(!1),d=c(e.zIndex||v());let s,u;const E=J("namespace",j),O=g(()=>{const o={},n=`--${E.value}-dialog`;return e.fullscreen||(e.top&&(o[`${n}-margin-top`]=e.top),e.width&&(o[`${n}-width`]=Q(e.width))),o}),h=g(()=>e.alignCenter?{display:"flex"}:{});function S(){l("opened")}function k(){l("closed"),l(P,!1),e.destroyOnClose&&(i.value=!1)}function A(){l("close")}function C(){u==null||u(),s==null||s(),e.openDelay&&e.openDelay>0?{stop:s}=D(()=>b(),e.openDelay):b()}function r(){s==null||s(),u==null||u(),e.closeDelay&&e.closeDelay>0?{stop:u}=D(()=>m(),e.closeDelay):m()}function y(){function o(n){n||(f.value=!0,t.value=!1)}e.beforeClose?e.beforeClose(o):r()}function w(){e.closeOnClickModal&&y()}function b(){q&&(t.value=!0)}function m(){t.value=!1}function N(){l("openAutoFocus")}function M(){l("closeAutoFocus")}function z(o){var n;((n=o.detail)==null?void 0:n.focusReason)==="pointer"&&o.preventDefault()}e.lockScroll&&K(t);function L(){e.closeOnPressEscape&&y()}return B(()=>e.modelValue,o=>{o?(f.value=!1,C(),i.value=!0,d.value=e.zIndex?d.value++:v(),$(()=>{l("open"),a.value&&(a.value.scrollTop=0)})):t.value&&r()}),B(()=>e.fullscreen,o=>{a.value&&(o?(p=a.value.style.transform,a.value.style.transform=""):a.value.style.transform=p)}),U(()=>{e.modelValue&&(t.value=!0,i.value=!0,C())}),{afterEnter:S,afterLeave:k,beforeLeave:A,handleClose:y,onModalClick:w,close:r,doClose:m,onOpenAutoFocus:N,onCloseAutoFocus:M,onCloseRequested:L,onFocusoutPrevented:z,titleId:F,bodyId:T,closed:f,style:O,overlayDialogStyle:h,rendered:i,visible:t,zIndex:d}};export{ae as a,W as b,te as c,ne as d,se as u};
