import{aO as E,cn as ne,ay as U,bv as ae,br as se,O as v,bt as ue,bZ as k,bI as D,cy as le,bw as ie,bJ as X,c3 as C,bM as z,bO as re,an as ce,U as R}from"#entry";const O=Symbol.for("vuetify:layout"),q=Symbol.for("vuetify:layout-item"),N=1e3,fe=D({overlaps:{type:Array,default:()=>[]},fullHeight:Boolean},"layout"),pe=D({name:{type:String},order:{type:[Number,String],default:0},absolute:Boolean},"layout-item");function me(){const s=E(O);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(O);if(!u)throw new Error("[Vuetify] Could not find injected layout");const d=s.id??`layout-item-${ne()}`,i=U("useLayoutItem");X(q,{id:d});const n=k(!1);ae(()=>n.value=!0),se(()=>n.value=!1);const{layoutItemStyles:r,layoutItemScrimStyles:c}=u.register(i,{...s,active:v(()=>n.value?!1:s.active.value),id:d});return ue(()=>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 b={...n,[p.value]:parseInt(n[p.value],10)+($.value?parseInt(g.value,10):0)};r.push({id:c,layer:b}),n=b}return r};function be(s){const u=E(O,null),d=v(()=>u?u.rootZIndex.value-100:N),i=re([]),n=z(new Map),r=z(new Map),c=z(new Map),p=z(new Map),g=z(new Map),{resizeRef:$,contentRect:b}=le(),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),w=r.get(o);!m||!f||!S||!w||(t.set(o,{position:m.value,amount:parseInt(S.value,10)}),t.set(a,{position:f.value,amount:-parseInt(w.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)),h=v(()=>I.value[I.value.length-1].layer),J=C(()=>({"--v-layout-left":R(h.value.left),"--v-layout-right":R(h.value.right),"--v-layout-top":R(h.value.top),"--v-layout-bottom":R(h.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),W=U("createLayout"),Z=k(!1);ie(()=>{Z.value=!0}),X(O,{register:(t,l)=>{let{id:e,order:a,position:o,layoutSize:m,elementSize:f,active:S,disableTransitions:w,absolute:G}=l;c.set(e,a),n.set(e,o),r.set(e,m),p.set(e,S),w&&g.set(e,w);const j=ce(q,W?.vnode).indexOf(t);j>-1?i.value.splice(j,0,e):i.value.push(e);const B=v(()=>x.value.findIndex(L=>L.id===e)),M=v(()=>d.value+I.value.length*2-B.value*2),Q=v(()=>{const L=o.value==="left"||o.value==="right",A=o.value==="right",te=o.value==="bottom",P=f.value??m.value,oe=P===0?"%":"px",K={[o.value]:0,zIndex:M.value,transform:`translate${L?"X":"Y"}(${(S.value?0:-(P===0?100:P))*(A||te?-1:1)}${oe})`,position:G.value||d.value!==N?"absolute":"fixed",...H.value?void 0:{transition:"none"}};if(!Z.value)return K;const y=x.value[B.value],V=F.value.get(e);return V&&(y[V.position]+=V.amount),{...K,height:L?`calc(100% - ${y.top}px - ${y.bottom}px)`:f.value?`${f.value}px`:void 0,left:A?void 0:`${y.left}px`,right:A?`${y.right}px`:void 0,top:o.value!=="bottom"?`${y.top}px`:void 0,bottom:o.value!=="top"?`${y.bottom}px`:void 0,width:L?f.value?`${f.value}px`:void 0:`calc(100% - ${y.left}px - ${y.right}px)`}}),ee=v(()=>({zIndex:M.value-1}));return{layoutItemStyles:Q,layoutItemScrimStyles:ee,zIndex:M}},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:h,mainStyles:J,getLayoutItem:T,items:x,layoutRect:b,rootZIndex:d});const Y=C(()=>["v-layout",{"v-layout--full-height":s.fullHeight}]),_=C(()=>({zIndex:u?d.value:void 0,position:u?"relative":void 0,overflow:u?"hidden":void 0}));return{layoutClasses:Y,layoutStyles:_,getLayoutItem:T,items:x,layoutRect:b,layoutRef:$}}export{fe as a,ge as b,be as c,pe as m,me as u};
