"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../utils/disposables.js"),t=require("../../utils/store.js"),o=require("./adjust-scrollbar-padding.js"),r=require("./handle-ios-locking.js"),l=require("./prevent-scroll.js");function s(e){let t={};for(let o of e)Object.assign(t,o(t));return t}let d=t.createStore((()=>new Map),{PUSH(t,o){var r;let l=null!=(r=this.get(t))?r:{doc:t,count:0,d:e.disposables(),meta:new Set,computedMeta:{}};return l.count++,l.meta.add(o),l.computedMeta=s(l.meta),this.set(t,l),this},POP(e,t){let o=this.get(e);return o&&(o.count--,o.meta.delete(t),o.computedMeta=s(o.meta)),this},SCROLL_PREVENT(e){let t={doc:e.doc,d:e.d,meta:()=>e.computedMeta},s=[r.handleIOSLocking(),o.adjustScrollbarPadding(),l.preventScroll()];s.forEach((e=>{let{before:o}=e;return null==o?void 0:o(t)})),s.forEach((e=>{let{after:o}=e;return null==o?void 0:o(t)}))},SCROLL_ALLOW(e){let{d:t}=e;t.dispose()},TEARDOWN(e){let{doc:t}=e;this.delete(t)}});d.subscribe((()=>{let e=d.getSnapshot(),t=new Map;for(let[o]of e)t.set(o,o.documentElement.style.overflow);for(let o of e.values()){let e="hidden"===t.get(o.doc),r=0!==o.count;(r&&!e||!r&&e)&&d.dispatch(o.count>0?"SCROLL_PREVENT":"SCROLL_ALLOW",o),0===o.count&&d.dispatch("TEARDOWN",o)}})),exports.overflows=d;
//# sourceMappingURL=overflow-store.js.map
