import{b as I,i as V,Y as _,m as c,c as g,Q as B,_ as U,s as Z,Z as $,a6 as q,an as D,ak as G}from"./normalize-8daa80b1.js";import{i as Q,g as Y}from"./base-a9e1396c.js";import{U as P,f as x}from"./el-button-4f2e1711.js";import{d as j,f as H}from"./config-provider-ecb8405d.js";import{a as J}from"./el-overlay-27e164ea.js";const K=I({center:{type:Boolean,default:!1},alignCenter:{type:Boolean,default:!1},closeIcon:{type:Q},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({...K,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=$().emit,{nextZIndex:v}=j();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=H("namespace",q),O=g(()=>{const o={},n=`--${E.value}-dialog`;return e.fullscreen||(e.top&&(o[`${n}-margin-top`]=e.top),e.width&&(o[`${n}-width`]=Y(e.width))),o}),h=g(()=>e.alignCenter?{display:"flex"}:{});function k(){l("opened")}function S(){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(){G&&(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&&J(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(),U(()=>{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)}),Z(()=>{e.modelValue&&(t.value=!0,i.value=!0,C())}),{afterEnter:k,afterLeave:S,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,K as b,te as c,ne as d,se as u};
