import{a6 as P,bF as y,bG as D,ag as h,bl as S,bH as w,r as x,bI as F,w as f,an as I,L as v,as as B,bJ as L,bK as R,bL as g,f as m,bn as T,bM as O}from"./index.737529e8.1750111005555.js";const A=P({fullscreen:Boolean,retainFocus:{type:Boolean,default:!0},scrollable:Boolean,...y({origin:"center center",scrollStrategy:"block",transition:{component:D},zIndex:2400})},"VDialog"),M=h()({name:"VDialog",props:A(),emits:{"update:modelValue":a=>!0},setup(a,b){let{slots:c}=b;const r=S(a,"modelValue"),{scopeId:p}=w(),t=x();function i(l){var n,s;const e=l.relatedTarget,o=l.target;if(e!==o&&((n=t.value)!=null&&n.contentEl)&&((s=t.value)!=null&&s.globalTop)&&![document,t.value.contentEl].includes(o)&&!t.value.contentEl.contains(o)){const u=O(t.value.contentEl);if(!u.length)return;const d=u[0],E=u[u.length-1];e===d?E.focus():d.focus()}}F&&f(()=>r.value&&a.retainFocus,l=>{l?document.addEventListener("focusin",i):document.removeEventListener("focusin",i)},{immediate:!0}),f(r,async l=>{var e,o;await R(),l?(e=t.value.contentEl)==null||e.focus({preventScroll:!0}):(o=t.value.activatorEl)==null||o.focus({preventScroll:!0})});const V=I(()=>v({"aria-haspopup":"dialog","aria-expanded":String(r.value)},a.activatorProps));return B(()=>{const[l]=g.filterProps(a);return m(g,v({ref:t,class:["v-dialog",{"v-dialog--fullscreen":a.fullscreen,"v-dialog--scrollable":a.scrollable},a.class],style:a.style},l,{modelValue:r.value,"onUpdate:modelValue":e=>r.value=e,"aria-modal":"true",activatorProps:V.value,role:"dialog"},p),{activator:c.activator,default:function(){for(var e=arguments.length,o=new Array(e),n=0;n<e;n++)o[n]=arguments[n];return m(T,{root:"VDialog"},{default:()=>{var s;return[(s=c.default)==null?void 0:s.call(c,...o)]}})}})}),L({},t)}});export{M as V};
