import{w,K as B,L as C,v as t,k as V,p as i,q as y,x as l,U as f,l as r,C as k,s as v,N as u,B as h,z as O,X as E,D as a,u as $}from"./x-CuOWXDIc.js";const g={key:0,class:"modal__header"},S={class:"modal__title"},z={key:1,class:"modal__footer"},N={__name:"Modal",props:{modelValue:{type:Boolean,default:!1},title:{type:String,default:""},size:{type:String,default:"md"},closable:{type:Boolean,default:!0},closeOnOverlay:{type:Boolean,default:!0},closeOnEscape:{type:Boolean,default:!0},persistent:{type:Boolean,default:!1},bodyClass:{type:String,default:""}},emits:["update:modelValue","close"],setup(e,{emit:p}){const s=e,c=p;function n(){s.persistent||(c("update:modelValue",!1),c("close"))}function b(){s.closeOnOverlay&&n()}function m(o){o.key==="Escape"&&s.closeOnEscape&&n()}return w(()=>s.modelValue,o=>{document.body.style.overflow=o?"hidden":""}),B(()=>document.addEventListener("keydown",m)),C(()=>{document.removeEventListener("keydown",m),document.body.style.overflow=""}),(o,d)=>(t(),V($,{to:"body"},[i(k,{name:"fade"},{default:y(()=>[e.modelValue?(t(),l("div",{key:0,class:"modal-overlay",onMousedown:d[0]||(d[0]=f(()=>{},["stop"])),onClick:d[1]||(d[1]=f(()=>{},["stop"]))},[r("div",{class:"modal-overlay__backdrop",onClick:b}),i(k,{name:"scale"},{default:y(()=>[e.modelValue?(t(),l("div",{key:0,class:v(["modal",`modal--${e.size}`])},[e.title||o.$slots.header||e.closable?(t(),l("div",g,[u(o.$slots,"header",{},()=>[r("h3",S,h(e.title),1)]),e.closable&&!e.persistent?(t(),l("button",{key:0,class:"modal__close",onClick:n},[i(O(E),{class:"icon-lg"})])):a("",!0)])):a("",!0),r("div",{class:v(["modal__body",e.bodyClass])},[u(o.$slots,"default")],2),o.$slots.footer?(t(),l("div",z,[u(o.$slots,"footer")])):a("",!0)],2)):a("",!0)]),_:3})],32)):a("",!0)]),_:3})]))}};export{N as _};
