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