import{defineComponent as I,ref as r,computed as T,createVNode as o,Transition as k,withDirectives as D,vShow as F,nextTick as B}from"vue";import{getTransitionProps as L}from"../_util/transition.mjs";import j from"./IDialogPropTypes.mjs";import{offset as q}from"./util.mjs";const z={width:0,height:0,overflow:"hidden",outline:"none"},G={outline:"none"},U=I({compatConfig:{MODE:3},name:"DialogContent",inheritAttrs:!1,props:{...j(),motionName:String,ariaId:String,onVisibleChanged:Function,onMousedown:Function,onMouseup:Function},setup(i,{expose:b,slots:l,attrs:a}){const s=r(),c=r(),u=r();b({focus:()=>{s.value?.focus({preventScroll:!0})},changeActive:e=>{const{activeElement:t}=document;e&&t===c.value?s.value.focus({preventScroll:!0}):!e&&t===s.value&&c.value.focus({preventScroll:!0})}});const d=r(),C=T(()=>{const{width:e,height:t}=i,n={};return e!==void 0&&(n.width=typeof e=="number"?`${e}px`:e),t!==void 0&&(n.height=typeof t=="number"?`${t}px`:t),d.value&&(n.transformOrigin=d.value),n}),S=()=>{B(()=>{if(u.value){const e=q(u.value);d.value=i.mousePosition?`${i.mousePosition.x-e.left}px ${i.mousePosition.y-e.top}px`:""}})},f=e=>{i.onVisibleChanged(e)};return()=>{const{prefixCls:e,footer:t=l.footer?.(),title:n=l.title?.(),ariaId:$,closable:x,closeIcon:w=l.closeIcon?.(),onClose:P,bodyStyle:M,bodyProps:N,onMousedown:R,onMouseup:E,visible:m,modalRender:v=l.modalRender,destroyOnClose:O,motionName:V}=i;let p;t&&(p=o("div",{class:`${e}-footer`},[t]));let y;n&&(y=o("div",{class:`${e}-header`},[o("div",{class:`${e}-title`,id:$},[n])]));let h;x&&(h=o("button",{type:"button",onClick:P,"aria-label":"Close",class:`${e}-close`},[w||o("span",{class:`${e}-close-x`},null)]));const g=o("div",{class:`${e}-content`},[h,y,o("div",{class:`${e}-body`,style:M,...N},[l.default?.()]),p]),A=L(V);return o(k,{...A,onBeforeEnter:S,onAfterEnter:()=>f(!0),onAfterLeave:()=>f(!1)},{default:()=>[m||!O?D(o("div",{...a,ref:u,key:"dialog-element",role:"document",style:[C.value,a.style],class:[e,a.class],onMousedown:R,onMouseup:E},[o("div",{tabindex:0,ref:s,style:G},[v?v({originVNode:g}):g]),o("div",{tabindex:0,ref:c,style:z},null)]),[[F,m]]):null]})}}});export{U as default};
