import{P as e,Q as t,S as n,U as r,_ as i,b as a,et as o,j as s,s as c}from"./runtime-core.esm-bundler-Babufkcf.js";import{t as l}from"./create-CGAkPJkS.js";import{r as u}from"./Platform-BxNC0BGj.js";import{i as d,r as f,t as p}from"./symbols-0I_wUpZS.js";import{a as m,r as h}from"./QIcon-cTVL6ikA.js";import{v as g}from"./index-uCtpzrM3.js";import{t as _}from"./QScrollObserver-BRBp4hLA.js";import{t as v}from"./QResizeObserver-FXLPiXDR.js";var y=l({name:`QPageContainer`,setup(t,{slots:r}){let{proxy:{$q:o}}=i(),s=n(f,p);if(s===p)return console.error(`QPageContainer needs to be child of QLayout`),p;e(d,!0);let l=c(()=>{let e={};return s.header.space&&(e.paddingTop=`${s.header.size}px`),s.right.space&&(e[`padding${o.lang.rtl?`Left`:`Right`}`]=`${s.right.size}px`),s.footer.space&&(e.paddingBottom=`${s.footer.size}px`),s.left.space&&(e[`padding${o.lang.rtl?`Right`:`Left`}`]=`${s.left.size}px`),e});return()=>a(`div`,{class:`q-page-container`,style:l.value},m(r.default))}}),b=/^(h|l)h(h|r) lpr (f|l)f(f|r)$/,x=l({name:`QLayout`,props:{container:Boolean,view:{type:String,default:`hhh lpr fff`,validator:e=>b.test(e.toLowerCase())},onScroll:Function,onScrollHeight:Function,onResize:Function},setup(n,{slots:l,emit:d}){let{proxy:{$q:p}}=i(),m=o(null),y=o(p.screen.height),b=o(n.container?0:p.screen.width),x=o({position:0,direction:`down`,inflectionPoint:0}),S=o(0),C=o(u.value?0:g()),w=c(()=>`q-layout q-layout--`+(n.container?`containerized`:`standard`)),T=c(()=>n.container?null:{minHeight:p.screen.height+`px`}),E=c(()=>C.value===0?null:{[p.lang.rtl?`left`:`right`]:`${C.value}px`}),D=c(()=>C.value===0?null:{[p.lang.rtl?`right`:`left`]:0,[p.lang.rtl?`left`:`right`]:`-${C.value}px`,width:`calc(100% + ${C.value}px)`});function O(e){if(n.container||!document.qScrollPrevented){let t={position:e.position.top,direction:e.direction,directionChanged:e.directionChanged,inflectionPoint:e.inflectionPoint.top,delta:e.delta.top};x.value=t,n.onScroll!==void 0&&d(`scroll`,t)}}function k(e){let{height:t,width:r}=e,i=!1;y.value!==t&&(i=!0,y.value=t,n.onScrollHeight!==void 0&&d(`scrollHeight`,t),j()),b.value!==r&&(i=!0,b.value=r),i&&n.onResize!==void 0&&d(`resize`,e)}function A({height:e}){S.value!==e&&(S.value=e,j())}function j(){if(n.container){let e=y.value>S.value?g():0;C.value!==e&&(C.value=e)}}let M=null,N={instances:{},view:c(()=>n.view),isContainer:c(()=>n.container),rootRef:m,height:y,containerHeight:S,scrollbarWidth:C,totalWidth:c(()=>b.value+C.value),rows:c(()=>{let e=n.view.toLowerCase().split(` `);return{top:[...e[0]],middle:[...e[1]],bottom:[...e[2]]}}),header:t({size:0,offset:0,space:!1}),right:t({size:300,offset:0,space:!1}),footer:t({size:0,offset:0,space:!1}),left:t({size:300,offset:0,space:!1}),scroll:x,animate(){M===null?document.body.classList.add(`q-body--layout-animate`):clearTimeout(M),M=setTimeout(()=>{M=null,document.body.classList.remove(`q-body--layout-animate`)},155)},update(e,t,n){N[e][t]=n}};if(e(f,N),g()>0){let e=null,t=document.body,i=()=>{e=null,t.classList.remove(`hide-scrollbar`)},a=()=>{if(e===null){if(t.scrollHeight>p.screen.height)return;t.classList.add(`hide-scrollbar`)}else clearTimeout(e);e=setTimeout(i,300)},o=t=>{e!==null&&t===`remove`&&(clearTimeout(e),i()),window[`${t}EventListener`](`resize`,a)};r(()=>n.container?`remove`:`add`,o),n.container||o(`add`),s(()=>{o(`remove`)})}return()=>{let e=h(l.default,[a(_,{onScroll:O}),a(v,{onResize:k})]),t=a(`div`,{class:w.value,style:T.value,ref:n.container?void 0:m,tabindex:-1},e);return n.container?a(`div`,{class:`q-layout-container overflow-hidden`,ref:m},[a(v,{onResize:A}),a(`div`,{class:`absolute-full`,style:E.value},[a(`div`,{class:`scroll`,style:D.value},[t])])]):t}}});export{y as n,x as t};