import{a7 as e,a8 as t,a as o,Q as a,a9 as i,i as n,aa as l,p as s,g as r,ab as c,h as u,ac as d,ad as f,r as v,w as p,e as h,ae as g}from"./index.3938ccd1.js";import{Q as m}from"./QScrollObserver.987c6245.js";import{Q as y}from"./QResizeObserver.01a9102c.js";var z=e({name:"QPageContainer",setup(e,{slots:u}){const{proxy:{$q:d}}=r(),f=n(l,t);if(f===t)return t;s(c,!0);const v=o((()=>{const e={};return!0===f.header.space&&(e.paddingTop=`${f.header.size}px`),!0===f.right.space&&(e["padding"+(!0===d.lang.rtl?"Left":"Right")]=`${f.right.size}px`),!0===f.footer.space&&(e.paddingBottom=`${f.footer.size}px`),!0===f.left.space&&(e["padding"+(!0===d.lang.rtl?"Right":"Left")]=`${f.left.size}px`),e}));return()=>a("div",{class:"q-page-container",style:v.value},i(u.default))}}),w=e({name:"QLayout",props:{container:Boolean,view:{type:String,default:"hhh lpr fff",validator:e=>/^(h|l)h(h|r) lpr (f|l)f(f|r)$/.test(e.toLowerCase())},onScroll:Function,onScrollHeight:Function,onResize:Function},setup(e,{slots:t,emit:i}){const{proxy:{$q:n}}=r(),c=u(null),z=u(n.screen.height),w=u(!0===e.container?0:n.screen.width),b=u({position:0,direction:"down",inflectionPoint:0}),x=u(0),$=u(!0===d.value?0:f()),L=o((()=>"q-layout q-layout--"+(!0===e.container?"containerized":"standard"))),q=o((()=>!1===e.container?{minHeight:n.screen.height+"px"}:null)),Q=o((()=>0!==$.value?{[!0===n.lang.rtl?"left":"right"]:`${$.value}px`}:null)),R=o((()=>0!==$.value?{[!0===n.lang.rtl?"right":"left"]:0,[!0===n.lang.rtl?"left":"right"]:`-${$.value}px`,width:`calc(100% + ${$.value}px)`}:null));function S(t){if(!0===e.container||!0!==document.qScrollPrevented){const o={position:t.position.top,direction:t.direction,directionChanged:t.directionChanged,inflectionPoint:t.inflectionPoint.top,delta:t.delta.top};b.value=o,void 0!==e.onScroll&&i("scroll",o)}}function C(t){const{height:o,width:a}=t;let n=!1;z.value!==o&&(n=!0,z.value=o,void 0!==e.onScrollHeight&&i("scrollHeight",o),T()),w.value!==a&&(n=!0,w.value=a),!0===n&&void 0!==e.onResize&&i("resize",t)}function H({height:e}){x.value!==e&&(x.value=e,T())}function T(){if(!0===e.container){const e=z.value>x.value?f():0;$.value!==e&&($.value=e)}}let P=null;const j={instances:{},view:o((()=>e.view)),isContainer:o((()=>e.container)),rootRef:c,height:z,containerHeight:x,scrollbarWidth:$,totalWidth:o((()=>w.value+$.value)),rows:o((()=>{const t=e.view.toLowerCase().split(" ");return{top:t[0].split(""),middle:t[1].split(""),bottom:t[2].split("")}})),header:v({size:0,offset:0,space:!1}),right:v({size:300,offset:0,space:!1}),footer:v({size:0,offset:0,space:!1}),left:v({size:300,offset:0,space:!1}),scroll:b,animate(){null!==P?clearTimeout(P):document.body.classList.add("q-body--layout-animate"),P=setTimeout((()=>{P=null,document.body.classList.remove("q-body--layout-animate")}),155)},update(e,t,o){j[e][t]=o}};if(s(l,j),f()>0){let t=function(){i=null,l.classList.remove("hide-scrollbar")},o=function(){if(null===i){if(l.scrollHeight>n.screen.height)return;l.classList.add("hide-scrollbar")}else clearTimeout(i);i=setTimeout(t,300)},a=function(e){null!==i&&"remove"===e&&(clearTimeout(i),t()),window[`${e}EventListener`]("resize",o)},i=null;const l=document.body;p((()=>!0!==e.container?"add":"remove"),a),!0!==e.container&&a("add"),h((()=>{a("remove")}))}return()=>{const o=g(t.default,[a(m,{onScroll:S}),a(y,{onResize:C})]),i=a("div",{class:L.value,style:q.value,ref:!0===e.container?void 0:c,tabindex:-1},o);return!0===e.container?a("div",{class:"q-layout-container overflow-hidden",ref:c},[a(y,{onResize:H}),a("div",{class:"absolute-full",style:Q.value},[a("div",{class:"scroll",style:R.value},[i])])]):i}}});export{z as Q,w as a};
