import{C as Z,ai as E,O as v,r as ne,bM as z,aq as ae,a2 as P,a5 as R,c4 as k,ad as D,m as se,c2 as ue,c5 as le,c6 as ie,q as re,ah as U,c7 as ce}from"./index-CD7iYaFT.js";const M=Symbol.for("vuetify:layout"),X=Symbol.for("vuetify:layout-item"),N=1e3,fe=Z({overlaps:{type:Array,default:()=>[]},fullHeight:Boolean},"layout"),pe=Z({name:{type:String},order:{type:[Number,String],default:0},absolute:Boolean},"layout-item");function me(){const s=E(M);if(!s)throw new Error("[Vuetify] Could not find injected layout");return{getLayoutItem:s.getLayoutItem,mainRect:s.mainRect,mainStyles:s.mainStyles}}function ge(s){const u=E(M);if(!u)throw new Error("[Vuetify] Could not find injected layout");const d=s.id??`layout-item-${ue()}`,i=k("useLayoutItem");U(X,{id:d});const n=D(!1);le(()=>n.value=!0),ie(()=>n.value=!1);const{layoutItemStyles:r,layoutItemScrimStyles:c}=u.register(i,{...s,active:v(()=>n.value?!1:s.active.value),id:d});return re(()=>u.unregister(d)),{layoutItemStyles:r,layoutRect:u.layoutRect,layoutItemScrimStyles:c}}const ve=(s,u,d,i)=>{let n={top:0,left:0,right:0,bottom:0};const r=[{id:"",layer:{...n}}];for(const c of s){const p=u.get(c),g=d.get(c),$=i.get(c);if(!p||!g||!$)continue;const h={...n,[p.value]:parseInt(n[p.value],10)+($.value?parseInt(g.value,10):0)};r.push({id:c,layer:h}),n=h}return r};function he(s){const u=E(M,null),d=v(()=>u?u.rootZIndex.value-100:N),i=ne([]),n=z(new Map),r=z(new Map),c=z(new Map),p=z(new Map),g=z(new Map),{resizeRef:$,contentRect:h}=ae(),F=v(()=>{const t=new Map,l=s.overlaps??[];for(const e of l.filter(a=>a.includes(":"))){const[a,o]=e.split(":");if(!i.value.includes(a)||!i.value.includes(o))continue;const m=n.get(a),f=n.get(o),S=r.get(a),L=r.get(o);!m||!f||!S||!L||(t.set(o,{position:m.value,amount:parseInt(S.value,10)}),t.set(a,{position:f.value,amount:-parseInt(L.value,10)}))}return t}),I=v(()=>{const t=[...new Set([...c.values()].map(e=>e.value))].sort((e,a)=>e-a),l=[];for(const e of t){const a=i.value.filter(o=>c.get(o)?.value===e);l.push(...a)}return ve(l,n,r,p)}),H=v(()=>!Array.from(g.values()).some(t=>t.value)),b=v(()=>I.value[I.value.length-1].layer),W=P(()=>({"--v-layout-left":R(b.value.left),"--v-layout-right":R(b.value.right),"--v-layout-top":R(b.value.top),"--v-layout-bottom":R(b.value.bottom),...H.value?void 0:{transition:"none"}})),x=v(()=>I.value.slice(1).map((t,l)=>{let{id:e}=t;const{layer:a}=I.value[l],o=r.get(e),m=n.get(e);return{id:e,...a,size:Number(o.value),position:m.value}})),T=t=>x.value.find(l=>l.id===t),Y=k("createLayout"),j=D(!1);se(()=>{j.value=!0}),U(M,{register:(t,l)=>{let{id:e,order:a,position:o,layoutSize:m,elementSize:f,active:S,disableTransitions:L,absolute:J}=l;c.set(e,a),n.set(e,o),r.set(e,m),p.set(e,S),L&&g.set(e,L);const q=ce(X,Y?.vnode).indexOf(t);q>-1?i.value.splice(q,0,e):i.value.push(e);const B=v(()=>x.value.findIndex(w=>w.id===e)),O=v(()=>d.value+I.value.length*2-B.value*2),Q=v(()=>{const w=o.value==="left"||o.value==="right",V=o.value==="right",te=o.value==="bottom",A=f.value??m.value,oe=A===0?"%":"px",K={[o.value]:0,zIndex:O.value,transform:`translate${w?"X":"Y"}(${(S.value?0:-(A===0?100:A))*(V||te?-1:1)}${oe})`,position:J.value||d.value!==N?"absolute":"fixed",...H.value?void 0:{transition:"none"}};if(!j.value)return K;const y=x.value[B.value],C=F.value.get(e);return C&&(y[C.position]+=C.amount),{...K,height:w?`calc(100% - ${y.top}px - ${y.bottom}px)`:f.value?`${f.value}px`:void 0,left:V?void 0:`${y.left}px`,right:V?`${y.right}px`:void 0,top:o.value!=="bottom"?`${y.top}px`:void 0,bottom:o.value!=="top"?`${y.bottom}px`:void 0,width:w?f.value?`${f.value}px`:void 0:`calc(100% - ${y.left}px - ${y.right}px)`}}),ee=v(()=>({zIndex:O.value-1}));return{layoutItemStyles:Q,layoutItemScrimStyles:ee,zIndex:O}},unregister:t=>{c.delete(t),n.delete(t),r.delete(t),p.delete(t),g.delete(t),i.value=i.value.filter(l=>l!==t)},mainRect:b,mainStyles:W,getLayoutItem:T,items:x,layoutRect:h,rootZIndex:d});const _=P(()=>["v-layout",{"v-layout--full-height":s.fullHeight}]),G=P(()=>({zIndex:u?d.value:void 0,position:u?"relative":void 0,overflow:u?"hidden":void 0}));return{layoutClasses:_,layoutStyles:G,getLayoutItem:T,items:x,layoutRect:h,layoutRef:$}}export{M as V,ge as a,pe as b,he as c,fe as m,me as u};
