var e=Object.defineProperty,o=Object.defineProperties,l=Object.getOwnPropertyDescriptors,a=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,t=Object.prototype.propertyIsEnumerable,r=(o,l,a)=>l in o?e(o,l,{enumerable:!0,configurable:!0,writable:!0,value:a}):o[l]=a,s=(e,o)=>{for(var l in o||(o={}))n.call(o,l)&&r(e,l,o[l]);if(a)for(var l of a(o))t.call(o,l)&&r(e,l,o[l]);return e};import{a2 as u,ae as i,bt as d,ak as c,a8 as f,cl as v,a as p,b$ as y,c as g,cX as b,by as m,ag as C,af as B,bv as S,w as O,o as w,ad as x,aZ as A,n as h}from"./index-ip5gDR6L.js";import{U as j,a as I}from"./index-CHAf6FpU.js";import{u as D}from"./index-D17cYxP7.js";import{u as L}from"./use-form-item-BDb3ZgPk.js";const E=Symbol("dialogInjectionKey"),F="dialog-fade",P=u({center:Boolean,alignCenter:{type:Boolean,default:void 0},closeIcon:{type:i},draggable:{type:Boolean,default:void 0},overflow:{type:Boolean,default:void 0},fullscreen:Boolean,headerClass:String,bodyClass:String,footerClass:String,showClose:{type:Boolean,default:!0},title:{type:String,default:""},ariaLevel:{type:String,default:"2"}}),k={close:()=>!0},z=u((N=s({},P),T={appendToBody:Boolean,appendTo:{type:I.to.type,default:"body"},beforeClose:{type:c(Function)},destroyOnClose:Boolean,closeOnClickModal:{type:Boolean,default:!0},closeOnPressEscape:{type:Boolean,default:!0},lockScroll:{type:Boolean,default:!0},modal:{type:Boolean,default:!0},modalPenetrable:Boolean,openDelay:{type:Number,default:0},closeDelay:{type:Number,default:0},top:{type:String},modelValue:Boolean,modalClass:String,headerClass:String,bodyClass:String,footerClass:String,width:{type:[String,Number]},zIndex:{type:Number},trapFocus:Boolean,headerAriaLevel:{type:String,default:"2"},transition:{type:c([String,Object]),default:void 0}},o(N,l(T))));var N,T;const $={open:()=>!0,opened:()=>!0,close:()=>!0,closed:()=>!0,[j]:e=>d(e),openAutoFocus:()=>!0,closeAutoFocus:()=>!0},M=(e,o)=>{var l;const a=f().emit,{nextZIndex:n}=v();let t="";const r=L(),u=L(),i=p(!1),d=p(!1),c=p(!1),I=p(null!=(l=e.zIndex)?l:n());let E,P;const k=y(),z=g(()=>{var e,o;return null!=(o=null==(e=k.value)?void 0:e.namespace)?o:b}),N=g(()=>{var e;return null==(e=k.value)?void 0:e.dialog}),T=g(()=>{const o={},l=`--${z.value}-dialog`;return e.fullscreen||(e.top&&(o[`${l}-margin-top`]=e.top),e.width&&(o[`${l}-width`]=m(e.width))),o}),$=g(()=>{var o,l,a;return null!=(a=null!=(l=e.draggable)?l:null==(o=N.value)?void 0:o.draggable)&&a&&!e.fullscreen}),M=g(()=>{var o,l,a;return null!=(a=null!=(l=e.alignCenter)?l:null==(o=N.value)?void 0:o.alignCenter)&&a}),V=g(()=>{var o,l,a;return null!=(a=null!=(l=e.overflow)?l:null==(o=N.value)?void 0:o.overflow)&&a}),_=g(()=>M.value?{display:"flex"}:{}),R=g(()=>{var o,l,a;const n=null!=(a=null!=(l=e.transition)?l:null==(o=N.value)?void 0:o.transition)?a:F,t={name:n,onAfterEnter:Z,onBeforeLeave:K,onAfterLeave:q};if(C(n)){const e=s({},n),o=(e,o)=>l=>{B(e)?e.forEach(e=>{S(e)&&e(l)}):S(e)&&e(l),o()};return e.onAfterEnter=o(e.onAfterEnter,Z),e.onBeforeLeave=o(e.onBeforeLeave,K),e.onAfterLeave=o(e.onAfterLeave,q),e.name||(e.name=F),e}return t});function Z(){a("opened")}function q(){a("closed"),a(j,!1),e.destroyOnClose&&(c.value=!1)}function K(){a("close")}function U(){null==P||P(),null==E||E(),e.openDelay&&e.openDelay>0?({stop:E}=x(()=>H(),e.openDelay)):H()}function X(){null==E||E(),null==P||P(),e.closeDelay&&e.closeDelay>0?({stop:P}=x(()=>J(),e.closeDelay)):J()}function G(){e.beforeClose?e.beforeClose(function(e){e||(d.value=!0,i.value=!1)}):X()}function H(){A&&(i.value=!0)}function J(){i.value=!1}return e.lockScroll&&D(i),O(()=>e.zIndex,()=>{var o;I.value=null!=(o=e.zIndex)?o:n()}),O(()=>e.modelValue,l=>{var t;l?(d.value=!1,U(),c.value=!0,I.value=null!=(t=e.zIndex)?t:n(),h(()=>{a("open"),o.value&&(o.value.parentElement.scrollTop=0,o.value.parentElement.scrollLeft=0,o.value.scrollTop=0)})):i.value&&X()}),O(()=>e.fullscreen,e=>{o.value&&(e?(t=o.value.style.transform,o.value.style.transform=""):o.value.style.transform=t)}),w(()=>{e.modelValue&&(i.value=!0,c.value=!0,U())}),{afterEnter:Z,afterLeave:q,beforeLeave:K,handleClose:G,onModalClick:function(){e.closeOnClickModal&&G()},close:X,doClose:J,onOpenAutoFocus:function(){a("openAutoFocus")},onCloseAutoFocus:function(){a("closeAutoFocus")},onCloseRequested:function(){e.closeOnPressEscape&&G()},onFocusoutPrevented:function(e){var o;"pointer"===(null==(o=e.detail)?void 0:o.focusReason)&&e.preventDefault()},titleId:r,bodyId:u,closed:d,style:T,overlayDialogStyle:_,rendered:c,visible:i,zIndex:I,transitionConfig:R,_draggable:$,_alignCenter:M,_overflow:V}};export{P as a,E as b,$ as c,k as d,z as e,M as u};
