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