import{ao as R,ap as T,aq as z,ar as F,as as H,ba as I,bb as q,g as D,at as w,c as u,o,w as d,l as r,a as $,m as s,E as c,ag as i,am as B,an as x,ah as P,bd as L,bS as K,n as y,t as g,e as h,b as M,s as U}from"./Dk4AzF7j.js";import{D as G,a as J,b as Q,c as W,d as C,e as S,f as X,g as Y}from"./CR2z6V-x.js";const Z={slots:{overlay:"fixed inset-0 bg-elevated/75",content:"fixed bg-default divide-y divide-default flex flex-col focus:outline-none",header:"flex items-center gap-1.5 p-4 sm:px-6 min-h-16",wrapper:"",body:"flex-1 overflow-y-auto p-4 sm:p-6",footer:"flex items-center gap-1.5 p-4 sm:px-6",title:"text-highlighted font-semibold",description:"mt-1 text-muted text-sm",close:"absolute top-4 end-4"},variants:{transition:{true:{overlay:"data-[state=open]:animate-[fade-in_200ms_ease-out] data-[state=closed]:animate-[fade-out_200ms_ease-in]",content:"data-[state=open]:animate-[scale-in_200ms_ease-out] data-[state=closed]:animate-[scale-out_200ms_ease-in]"}},fullscreen:{true:{content:"inset-0"},false:{content:"top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[calc(100vw-2rem)] max-w-lg max-h-[calc(100dvh-2rem)] sm:max-h-[calc(100dvh-4rem)] rounded-lg shadow-lg ring ring-default overflow-hidden"}}}},te={__name:"UModal",props:{title:{type:String,required:!1},description:{type:String,required:!1},content:{type:Object,required:!1},overlay:{type:Boolean,required:!1,default:!0},transition:{type:Boolean,required:!1,default:!0},fullscreen:{type:Boolean,required:!1},portal:{type:[Boolean,String],required:!1,skipCheck:!0,default:!0},close:{type:[Boolean,Object],required:!1,default:!0},closeIcon:{type:String,required:!1},dismissible:{type:Boolean,required:!1,default:!0},class:{type:null,required:!1},ui:{type:null,required:!1},open:{type:Boolean,required:!1},defaultOpen:{type:Boolean,required:!1},modal:{type:Boolean,required:!1,default:!0}},emits:["after:leave","after:enter","close:prevent","update:open"],setup(a,{emit:O}){const e=a,m=O,t=R(),{t:E}=T(),k=z(),V=F(H(e,"open","defaultOpen","modal"),m),A=I(q(()=>e.portal)),N=q(()=>e.content),j=D(()=>{const l={closeAutoFocus:f=>f.preventDefault()};return e.dismissible?l:["pointerDownOutside","interactOutside","escapeKeyDown"].reduce((v,p)=>(v[p]=b=>{b.preventDefault(),m("close:prevent")},v),l)}),n=D(()=>w({extend:w(Z),...k.ui?.modal||{}})({transition:e.transition,fullscreen:e.fullscreen}));return(l,f)=>(o(),u(s(Y),B(x(s(V))),{default:d(({open:v,close:p})=>[t.default?(o(),u(s(G),{key:0,"as-child":"",class:c(e.class)},{default:d(()=>[i(l.$slots,"default",{open:v})]),_:2},1032,["class"])):r("",!0),$(s(J),B(x(s(A))),{default:d(()=>[a.overlay?(o(),u(s(Q),{key:0,class:c(n.value.overlay({class:e.ui?.overlay}))},null,8,["class"])):r("",!0),$(s(W),P({class:n.value.content({class:[!t.default&&e.class,e.ui?.content]})},N.value,{onAfterEnter:f[0]||(f[0]=b=>m("after:enter")),onAfterLeave:f[1]||(f[1]=b=>m("after:leave"))},L(j.value)),{default:d(()=>[t.content&&(a.title||t.title||a.description||t.description)?(o(),u(s(K),{key:0},{default:d(()=>[a.title||t.title?(o(),u(s(C),{key:0},{default:d(()=>[i(l.$slots,"title",{},()=>[y(g(a.title),1)])]),_:3})):r("",!0),a.description||t.description?(o(),u(s(S),{key:1},{default:d(()=>[i(l.$slots,"description",{},()=>[y(g(a.description),1)])]),_:3})):r("",!0)]),_:3})):r("",!0),i(l.$slots,"content",{close:p},()=>[t.header||a.title||t.title||a.description||t.description||e.close||t.close?(o(),h("div",{key:0,class:c(n.value.header({class:e.ui?.header}))},[i(l.$slots,"header",{close:p},()=>[M("div",{class:c(n.value.wrapper({class:e.ui?.wrapper}))},[a.title||t.title?(o(),u(s(C),{key:0,class:c(n.value.title({class:e.ui?.title}))},{default:d(()=>[i(l.$slots,"title",{},()=>[y(g(a.title),1)])]),_:3},8,["class"])):r("",!0),a.description||t.description?(o(),u(s(S),{key:1,class:c(n.value.description({class:e.ui?.description}))},{default:d(()=>[i(l.$slots,"description",{},()=>[y(g(a.description),1)])]),_:3},8,["class"])):r("",!0)],2),i(l.$slots,"actions"),e.close||t.close?(o(),u(s(X),{key:0,"as-child":""},{default:d(()=>[i(l.$slots,"close",{close:p,ui:n.value},()=>[e.close?(o(),u(U,P({key:0,icon:a.closeIcon||s(k).ui.icons.close,color:"neutral",variant:"ghost","aria-label":s(E)("modal.close")},typeof e.close=="object"?e.close:{},{class:n.value.close({class:e.ui?.close})}),null,16,["icon","aria-label","class"])):r("",!0)])]),_:2},1024)):r("",!0)])],2)):r("",!0),t.body?(o(),h("div",{key:1,class:c(n.value.body({class:e.ui?.body}))},[i(l.$slots,"body",{close:p})],2)):r("",!0),t.footer?(o(),h("div",{key:2,class:c(n.value.footer({class:e.ui?.footer}))},[i(l.$slots,"footer",{close:p})],2)):r("",!0)])]),_:2},1040,["class"])]),_:2},1040)]),_:3},16))}};export{te as _};
