"use strict";const k=e=>e!=null&&typeof e=="object"||!1,m=e=>k(e)&&typeof e.nodeType=="number"&&[1,2,3,4,5,6,7,8,9,10,11].some(t=>e.nodeType===t)||!1,a=e=>m(e)&&e.nodeType===1||!1,w=e=>typeof e=="function"||!1,p="1.0.7",u="PositionObserver Error";class y{entries;static version=p;_tick;_root;_callback;constructor(t,i){if(!w(t))throw new Error(`${u}: ${t} is not a function.`);this.entries=new Map,this._callback=t,this._root=a(i?.root)?i.root:document?.documentElement,this._tick=0}observe=t=>{if(!a(t))throw new Error(`${u}: ${t} is not an instance of Element.`);this._root.contains(t)&&this._new(t).then(({boundingClientRect:i})=>{if(i&&!this.getEntry(t)){const{clientWidth:s,clientHeight:n}=this._root;this.entries.set(t,{target:t,boundingClientRect:i,clientWidth:s,clientHeight:n})}this._tick||(this._tick=requestAnimationFrame(this._runCallback))})};unobserve=t=>{this.entries.has(t)&&this.entries.delete(t)};_runCallback=()=>{if(!this.entries.size)return;const{clientWidth:t,clientHeight:i}=this._root,s=new Promise(n=>{const c=[];this.entries.forEach(({target:o,boundingClientRect:r,clientWidth:_,clientHeight:b})=>{this._root.contains(o)&&this._new(o).then(({boundingClientRect:h,isIntersecting:d})=>{if(!d)return;const{left:g,top:f}=h;if(r.top!==f||r.left!==g||_!==t||b!==i){const l={target:o,boundingClientRect:h,clientHeight:i,clientWidth:t};this.entries.set(o,l),c.push(l)}})}),n(c)});this._tick=requestAnimationFrame(async()=>{const n=await s;n.length&&this._callback(n,this),this._runCallback()})};_new=t=>new Promise(i=>{new IntersectionObserver(([s],n)=>{n.disconnect(),i(s)}).observe(t)});getEntry=t=>this.entries.get(t);disconnect=()=>{cancelAnimationFrame(this._tick),this.entries.clear(),this._tick=0}}exports.y=y; //# sourceMappingURL=index-CK2pD4GQ.js.map