import{k as P,G as B,am as _,l as $,af as q,q as c,aE as G,e as D,x,J as Z,z as J,aF as j}from"./index-7ed2d026.js";import{i as H,V as I,a1 as K,d as F,I as Q}from"./el-button-e2db9d24.js";import{U as S}from"./index-dc664f45.js";import{c as W}from"./el-message-box-b36f6f03.js";import{i as X}from"./el-scrollbar-5933f25d.js";const Y=P({center:Boolean,alignCenter:Boolean,closeIcon:{type:H},customClass:{type:String,default:""},draggable:Boolean,fullscreen:Boolean,showClose:{type:Boolean,default:!0},title:{type:String,default:""},ariaLevel:{type:String,default:"2"}}),ae={close:()=>!0},se=P({...Y,appendToBody:Boolean,appendTo:{type:B(String),default:"body"},beforeClose:{type:B(Function)},destroyOnClose:Boolean,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:Boolean,modalClass:String,width:{type:[String,Number]},zIndex:{type:Number},trapFocus:{type:Boolean,default:!1},headerAriaLevel:{type:String,default:"2"}}),ue={open:()=>!0,opened:()=>!0,close:()=>!0,closed:()=>!0,[S]:e=>_(e),openAutoFocus:()=>!0,closeAutoFocus:()=>!0},ie=(e,a)=>{var v;const l=$().emit,{nextZIndex:p}=q();let C="";const T=I(),E=I(),t=c(!1),d=c(!1),i=c(!1),r=c((v=e.zIndex)!=null?v:p());let s,u;const h=G("namespace",j),O=D(()=>{const o={},n=`--${h.value}-dialog`;return e.fullscreen||(e.top&&(o[`${n}-margin-top`]=e.top),e.width&&(o[`${n}-width`]=K(e.width))),o}),k=D(()=>e.alignCenter?{display:"flex"}:{});function A(){l("opened")}function w(){l("closed"),l(S,!1),e.destroyOnClose&&(i.value=!1)}function L(){l("close")}function g(){u==null||u(),s==null||s(),e.openDelay&&e.openDelay>0?{stop:s}=F(()=>b(),e.openDelay):b()}function f(){s==null||s(),u==null||u(),e.closeDelay&&e.closeDelay>0?{stop:u}=F(()=>m(),e.closeDelay):m()}function y(){function o(n){n||(d.value=!0,t.value=!1)}e.beforeClose?e.beforeClose(o):f()}function N(){e.closeOnClickModal&&y()}function b(){Q&&(t.value=!0)}function m(){t.value=!1}function z(){l("openAutoFocus")}function M(){l("closeAutoFocus")}function V(o){var n;((n=o.detail)==null?void 0:n.focusReason)==="pointer"&&o.preventDefault()}e.lockScroll&&W(t);function U(){e.closeOnPressEscape&&y()}return x(()=>e.modelValue,o=>{o?(d.value=!1,g(),i.value=!0,r.value=X(e.zIndex)?p():r.value++,Z(()=>{l("open"),a.value&&(a.value.scrollTop=0)})):t.value&&f()}),x(()=>e.fullscreen,o=>{a.value&&(o?(C=a.value.style.transform,a.value.style.transform=""):a.value.style.transform=C)}),J(()=>{e.modelValue&&(t.value=!0,i.value=!0,g())}),{afterEnter:A,afterLeave:w,beforeLeave:L,handleClose:y,onModalClick:N,close:f,doClose:m,onOpenAutoFocus:z,onCloseAutoFocus:M,onCloseRequested:U,onFocusoutPrevented:V,titleId:T,bodyId:E,closed:d,style:O,overlayDialogStyle:k,rendered:i,visible:t,zIndex:r}};export{ue as a,Y as b,ae as c,se as d,ie as u};
