Skip to content

The only tool you need to know what is happening and how to fix it.

19.0 KB
Raw Blame
const $t=["top","right","bottom","left"],j=Math.min,C=Math.max,ot=Math.round,nt=Math.floor,W=t=>({x:t,y:t}),zt={left:"right",right:"left",bottom:"top",top:"bottom"},_t={start:"end",end:"start"};function ut(t,e,n){return C(t,j(e,n))}function $(t,e){return typeof t=="function"?t(e):t}function z(t){return t.split("-")[0]}function J(t){return t.split("-")[1]}function ht(t){return t==="x"?"y":"x"}function gt(t){return t==="y"?"height":"width"}const It=new Set(["top","bottom"]);function k(t){return It.has(z(t))?"y":"x"}function pt(t){return ht(k(t))}function Xt(t,e,n){n===void 0&&(n=!1);const o=J(t),i=pt(t),s=gt(i);let r=i==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(r=it(r)),[r,it(r)]}function jt(t){const e=it(t);return[dt(t),e,dt(e)]}function dt(t){return t.replace(/start|end/g,e=>_t[e])}const vt=["left","right"],bt=["right","left"],Yt=["top","bottom"],qt=["bottom","top"];function Ut(t,e,n){switch(t){case"top":case"bottom":return n?e?bt:vt:e?vt:bt;case"left":case"right":return e?Yt:qt;default:return[]}}function Kt(t,e,n,o){const i=J(t);let s=Ut(z(t),n==="start",o);return i&&(s=s.map(r=>r+"-"+i),e&&(s=s.concat(s.map(dt)))),s}function it(t){return t.replace(/left|right|bottom|top/g,e=>zt[e])}function Gt(t){return{top:0,right:0,bottom:0,left:0,...t}}function Et(t){return typeof t!="number"?Gt(t):{top:t,right:t,bottom:t,left:t}}function st(t){const{x:e,y:n,width:o,height:i}=t;return{width:o,height:i,top:n,left:e,right:e+o,bottom:n+i,x:e,y:n}}function At(t,e,n){let{reference:o,floating:i}=t;const s=k(e),r=pt(e),c=gt(r),a=z(e),l=s==="y",u=o.x+o.width/2-i.width/2,d=o.y+o.height/2-i.height/2,h=o[c]/2-i[c]/2;let f;switch(a){case"top":f={x:u,y:o.y-i.height};break;case"bottom":f={x:u,y:o.y+o.height};break;case"right":f={x:o.x+o.width,y:d};break;case"left":f={x:o.x-i.width,y:d};break;default:f={x:o.x,y:o.y}}switch(J(e)){case"start":f[r]-=h*(n&&l?-1:1);break;case"end":f[r]+=h*(n&&l?-1:1);break}return f}const Jt=async(t,e,n)=>{const{placement:o="bottom",strategy:i="absolute",middleware:s=[],platform:r}=n,c=s.filter(Boolean),a=await(r.isRTL==null?void 0:r.isRTL(e));let l=await r.getElementRects({reference:t,floating:e,strategy:i}),{x:u,y:d}=At(l,o,a),h=o,f={},m=0;for(let g=0;g<c.length;g++){const{name:p,fn:w}=c[g],{x,y,data:b,reset:v}=await w({x:u,y:d,initialPlacement:o,placement:h,strategy:i,middlewareData:f,rects:l,platform:r,elements:{reference:t,floating:e}});u=x??u,d=y??d,f={...f,[p]:{...f[p],...b}},v&&m<=50&&(m++,typeof v=="object"&&(v.placement&&(h=v.placement),v.rects&&(l=v.rects===!0?await r.getElementRects({reference:t,floating:e,strategy:i}):v.rects),{x:u,y:d}=At(l,h,a)),g=-1)}return{x:u,y:d,placement:h,strategy:i,middlewareData:f}};async function Z(t,e){var n;e===void 0&&(e={});const{x:o,y:i,platform:s,rects:r,elements:c,strategy:a}=t,{boundary:l="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:h=!1,padding:f=0}=$(e,t),m=Et(f),p=c[h?d==="floating"?"reference":"floating":d],w=st(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(p)))==null||n?p:p.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(c.floating)),boundary:l,rootBoundary:u,strategy:a})),x=d==="floating"?{x:o,y:i,width:r.floating.width,height:r.floating.height}:r.reference,y=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c.floating)),b=await(s.isElement==null?void 0:s.isElement(y))?await(s.getScale==null?void 0:s.getScale(y))||{x:1,y:1}:{x:1,y:1},v=st(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:x,offsetParent:y,strategy:a}):x);return{top:(w.top-v.top+m.top)/b.y,bottom:(v.bottom-w.bottom+m.bottom)/b.y,left:(w.left-v.left+m.left)/b.x,right:(v.right-w.right+m.right)/b.x}}const Qt=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:o,placement:i,rects:s,platform:r,elements:c,middlewareData:a}=e,{element:l,padding:u=0}=$(t,e)||{};if(l==null)return{};const d=Et(u),h={x:n,y:o},f=pt(i),m=gt(f),g=await r.getDimensions(l),p=f==="y",w=p?"top":"left",x=p?"bottom":"right",y=p?"clientHeight":"clientWidth",b=s.reference[m]+s.reference[f]-h[f]-s.floating[m],v=h[f]-s.reference[f],R=await(r.getOffsetParent==null?void 0:r.getOffsetParent(l));let A=R?R[y]:0;(!A||!await(r.isElement==null?void 0:r.isElement(R)))&&(A=c.floating[y]||s.floating[m]);const N=b/2-v/2,M=A/2-g[m]/2-1,L=j(d[w],M),_=j(d[x],M),F=L,I=A-g[m]-_,O=A/2-g[m]/2+N,q=ut(F,O,I),V=!a.arrow&&J(i)!=null&&O!==q&&s.reference[m]/2-(O<F?L:_)-g[m]/2<0,T=V?O<F?O-F:O-I:0;return{[f]:h[f]+T,data:{[f]:q,centerOffset:O-q-T,...V&&{alignmentOffset:T}},reset:V}}}),Zt=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,o;const{placement:i,middlewareData:s,rects:r,initialPlacement:c,platform:a,elements:l}=e,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:h,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:g=!0,...p}=$(t,e);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const w=z(i),x=k(c),y=z(c)===c,b=await(a.isRTL==null?void 0:a.isRTL(l.floating)),v=h||(y||!g?[it(c)]:jt(c)),R=m!=="none";!h&&R&&v.push(...Kt(c,g,m,b));const A=[c,...v],N=await Z(e,p),M=[];let L=((o=s.flip)==null?void 0:o.overflows)||[];if(u&&M.push(N[w]),d){const O=Xt(i,r,b);M.push(N[O[0]],N[O[1]])}if(L=[...L,{placement:i,overflows:M}],!M.every(O=>O<=0)){var _,F;const O=(((_=s.flip)==null?void 0:_.index)||0)+1,q=A[O];if(q&&(!(d==="alignment"?x!==k(q):!1)||L.every(E=>k(E.placement)===x?E.overflows[0]>0:!0)))return{data:{index:O,overflows:L},reset:{placement:q}};let V=(F=L.filter(T=>T.overflows[0]<=0).sort((T,E)=>T.overflows[1]-E.overflows[1])[0])==null?void 0:F.placement;if(!V)switch(f){case"bestFit":{var I;const T=(I=L.filter(E=>{if(R){const X=k(E.placement);return X===x||X==="y"}return!0}).map(E=>[E.placement,E.overflows.filter(X=>X>0).reduce((X,Vt)=>X+Vt,0)]).sort((E,X)=>E[1]-X[1])[0])==null?void 0:I[0];T&&(V=T);break}case"initialPlacement":V=c;break}if(i!==V)return{reset:{placement:V}}}return{}}}};function Ot(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function Rt(t){return $t.some(e=>t[e]>=0)}const te=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n}=e,{strategy:o="referenceHidden",...i}=$(t,e);switch(o){case"referenceHidden":{const s=await Z(e,{...i,elementContext:"reference"}),r=Ot(s,n.reference);return{data:{referenceHiddenOffsets:r,referenceHidden:Rt(r)}}}case"escaped":{const s=await Z(e,{...i,altBoundary:!0}),r=Ot(s,n.floating);return{data:{escapedOffsets:r,escaped:Rt(r)}}}default:return{}}}}},Dt=new Set(["left","top"]);async function ee(t,e){const{placement:n,platform:o,elements:i}=t,s=await(o.isRTL==null?void 0:o.isRTL(i.floating)),r=z(n),c=J(n),a=k(n)==="y",l=Dt.has(r)?-1:1,u=s&&a?-1:1,d=$(e,t);let{mainAxis:h,crossAxis:f,alignmentAxis:m}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return c&&typeof m=="number"&&(f=c==="end"?m*-1:m),a?{x:f*u,y:h*l}:{x:h*l,y:f*u}}const ne=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,o;const{x:i,y:s,placement:r,middlewareData:c}=e,a=await ee(e,t);return r===((n=c.offset)==null?void 0:n.placement)&&(o=c.arrow)!=null&&o.alignmentOffset?{}:{x:i+a.x,y:s+a.y,data:{...a,placement:r}}}}},oe=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:o,placement:i}=e,{mainAxis:s=!0,crossAxis:r=!1,limiter:c={fn:p=>{let{x:w,y:x}=p;return{x:w,y:x}}},...a}=$(t,e),l={x:n,y:o},u=await Z(e,a),d=k(z(i)),h=ht(d);let f=l[h],m=l[d];if(s){const p=h==="y"?"top":"left",w=h==="y"?"bottom":"right",x=f+u[p],y=f-u[w];f=ut(x,f,y)}if(r){const p=d==="y"?"top":"left",w=d==="y"?"bottom":"right",x=m+u[p],y=m-u[w];m=ut(x,m,y)}const g=c.fn({...e,[h]:f,[d]:m});return{...g,data:{x:g.x-n,y:g.y-o,enabled:{[h]:s,[d]:r}}}}}},ie=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:o,placement:i,rects:s,middlewareData:r}=e,{offset:c=0,mainAxis:a=!0,crossAxis:l=!0}=$(t,e),u={x:n,y:o},d=k(i),h=ht(d);let f=u[h],m=u[d];const g=$(c,e),p=typeof g=="number"?{mainAxis:g,crossAxis:0}:{mainAxis:0,crossAxis:0,...g};if(a){const y=h==="y"?"height":"width",b=s.reference[h]-s.floating[y]+p.mainAxis,v=s.reference[h]+s.reference[y]-p.mainAxis;f<b?f=b:f>v&&(f=v)}if(l){var w,x;const y=h==="y"?"width":"height",b=Dt.has(z(i)),v=s.reference[d]-s.floating[y]+(b&&((w=r.offset)==null?void 0:w[d])||0)+(b?0:p.crossAxis),R=s.reference[d]+s.reference[y]+(b?0:((x=r.offset)==null?void 0:x[d])||0)-(b?p.crossAxis:0);m<v?m=v:m>R&&(m=R)}return{[h]:f,[d]:m}}}},se=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,o;const{placement:i,rects:s,platform:r,elements:c}=e,{apply:a=()=>{},...l}=$(t,e),u=await Z(e,l),d=z(i),h=J(i),f=k(i)==="y",{width:m,height:g}=s.floating;let p,w;d==="top"||d==="bottom"?(p=d,w=h===(await(r.isRTL==null?void 0:r.isRTL(c.floating))?"start":"end")?"left":"right"):(w=d,p=h==="end"?"top":"bottom");const x=g-u.top-u.bottom,y=m-u.left-u.right,b=j(g-u[p],x),v=j(m-u[w],y),R=!e.middlewareData.shift;let A=b,N=v;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(N=y),(o=e.middlewareData.shift)!=null&&o.enabled.y&&(A=x),R&&!h){const L=C(u.left,0),_=C(u.right,0),F=C(u.top,0),I=C(u.bottom,0);f?N=m-2*(L!==0||_!==0?L+_:C(u.left,u.right)):A=g-2*(F!==0||I!==0?F+I:C(u.top,u.bottom))}await a({...e,availableWidth:N,availableHeight:A});const M=await r.getDimensions(c.floating);return m!==M.width||g!==M.height?{reset:{rects:!0}}:{}}}};function rt(){return typeof window<"u"}function Q(t){return Pt(t)?(t.nodeName||"").toLowerCase():"#document"}function S(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function H(t){var e;return(e=(Pt(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function Pt(t){return rt()?t instanceof Node||t instanceof S(t).Node:!1}function D(t){return rt()?t instanceof Element||t instanceof S(t).Element:!1}function B(t){return rt()?t instanceof HTMLElement||t instanceof S(t).HTMLElement:!1}function Ct(t){return!rt()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof S(t).ShadowRoot}const re=new Set(["inline","contents"]);function et(t){const{overflow:e,overflowX:n,overflowY:o,display:i}=P(t);return/auto|scroll|overlay|hidden|clip/.test(e+o+n)&&!re.has(i)}const ce=new Set(["table","td","th"]);function le(t){return ce.has(Q(t))}const fe=[":popover-open",":modal"];function ct(t){return fe.some(e=>{try{return t.matches(e)}catch{return!1}})}const ae=["transform","translate","scale","rotate","perspective"],ue=["transform","translate","scale","rotate","perspective","filter"],de=["paint","layout","strict","content"];function wt(t){const e=xt(),n=D(t)?P(t):t;return ae.some(o=>n[o]?n[o]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||ue.some(o=>(n.willChange||"").includes(o))||de.some(o=>(n.contain||"").includes(o))}function me(t){let e=Y(t);for(;B(e)&&!G(e);){if(wt(e))return e;if(ct(e))return null;e=Y(e)}return null}function xt(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const he=new Set(["html","body","#document"]);function G(t){return he.has(Q(t))}function P(t){return S(t).getComputedStyle(t)}function lt(t){return D(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Y(t){if(Q(t)==="html")return t;const e=t.assignedSlot||t.parentNode||Ct(t)&&t.host||H(t);return Ct(e)?e.host:e}function Mt(t){const e=Y(t);return G(e)?t.ownerDocument?t.ownerDocument.body:t.body:B(e)&&et(e)?e:Mt(e)}function tt(t,e,n){var o;e===void 0&&(e=[]),n===void 0&&(n=!0);const i=Mt(t),s=i===((o=t.ownerDocument)==null?void 0:o.body),r=S(i);if(s){const c=mt(r);return e.concat(r,r.visualViewport||[],et(i)?i:[],c&&n?tt(c):[])}return e.concat(i,tt(i,[],n))}function mt(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function Ft(t){const e=P(t);let n=parseFloat(e.width)||0,o=parseFloat(e.height)||0;const i=B(t),s=i?t.offsetWidth:n,r=i?t.offsetHeight:o,c=ot(n)!==s||ot(o)!==r;return c&&(n=s,o=r),{width:n,height:o,$:c}}function yt(t){return D(t)?t:t.contextElement}function K(t){const e=yt(t);if(!B(e))return W(1);const n=e.getBoundingClientRect(),{width:o,height:i,$:s}=Ft(e);let r=(s?ot(n.width):n.width)/o,c=(s?ot(n.height):n.height)/i;return(!r||!Number.isFinite(r))&&(r=1),(!c||!Number.isFinite(c))&&(c=1),{x:r,y:c}}const ge=W(0);function kt(t){const e=S(t);return!xt()||!e.visualViewport?ge:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function pe(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==S(t)?!1:e}function U(t,e,n,o){e===void 0&&(e=!1),n===void 0&&(n=!1);const i=t.getBoundingClientRect(),s=yt(t);let r=W(1);e&&(o?D(o)&&(r=K(o)):r=K(t));const c=pe(s,n,o)?kt(s):W(0);let a=(i.left+c.x)/r.x,l=(i.top+c.y)/r.y,u=i.width/r.x,d=i.height/r.y;if(s){const h=S(s),f=o&&D(o)?S(o):o;let m=h,g=mt(m);for(;g&&o&&f!==m;){const p=K(g),w=g.getBoundingClientRect(),x=P(g),y=w.left+(g.clientLeft+parseFloat(x.paddingLeft))*p.x,b=w.top+(g.clientTop+parseFloat(x.paddingTop))*p.y;a*=p.x,l*=p.y,u*=p.x,d*=p.y,a+=y,l+=b,m=S(g),g=mt(m)}}return st({width:u,height:d,x:a,y:l})}function ft(t,e){const n=lt(t).scrollLeft;return e?e.left+n:U(H(t)).left+n}function Wt(t,e){const n=t.getBoundingClientRect(),o=n.left+e.scrollLeft-ft(t,n),i=n.top+e.scrollTop;return{x:o,y:i}}function we(t){let{elements:e,rect:n,offsetParent:o,strategy:i}=t;const s=i==="fixed",r=H(o),c=e?ct(e.floating):!1;if(o===r||c&&s)return n;let a={scrollLeft:0,scrollTop:0},l=W(1);const u=W(0),d=B(o);if((d||!d&&!s)&&((Q(o)!=="body"||et(r))&&(a=lt(o)),B(o))){const f=U(o);l=K(o),u.x=f.x+o.clientLeft,u.y=f.y+o.clientTop}const h=r&&!d&&!s?Wt(r,a):W(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-a.scrollLeft*l.x+u.x+h.x,y:n.y*l.y-a.scrollTop*l.y+u.y+h.y}}function xe(t){return Array.from(t.getClientRects())}function ye(t){const e=H(t),n=lt(t),o=t.ownerDocument.body,i=C(e.scrollWidth,e.clientWidth,o.scrollWidth,o.clientWidth),s=C(e.scrollHeight,e.clientHeight,o.scrollHeight,o.clientHeight);let r=-n.scrollLeft+ft(t);const c=-n.scrollTop;return P(o).direction==="rtl"&&(r+=C(e.clientWidth,o.clientWidth)-i),{width:i,height:s,x:r,y:c}}const St=25;function ve(t,e){const n=S(t),o=H(t),i=n.visualViewport;let s=o.clientWidth,r=o.clientHeight,c=0,a=0;if(i){s=i.width,r=i.height;const u=xt();(!u||u&&e==="fixed")&&(c=i.offsetLeft,a=i.offsetTop)}const l=ft(o);if(l<=0){const u=o.ownerDocument,d=u.body,h=getComputedStyle(d),f=u.compatMode==="CSS1Compat"&&parseFloat(h.marginLeft)+parseFloat(h.marginRight)||0,m=Math.abs(o.clientWidth-d.clientWidth-f);m<=St&&(s-=m)}else l<=St&&(s+=l);return{width:s,height:r,x:c,y:a}}const be=new Set(["absolute","fixed"]);function Ae(t,e){const n=U(t,!0,e==="fixed"),o=n.top+t.clientTop,i=n.left+t.clientLeft,s=B(t)?K(t):W(1),r=t.clientWidth*s.x,c=t.clientHeight*s.y,a=i*s.x,l=o*s.y;return{width:r,height:c,x:a,y:l}}function Lt(t,e,n){let o;if(e==="viewport")o=ve(t,n);else if(e==="document")o=ye(H(t));else if(D(e))o=Ae(e,n);else{const i=kt(t);o={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return st(o)}function Bt(t,e){const n=Y(t);return n===e||!D(n)||G(n)?!1:P(n).position==="fixed"||Bt(n,e)}function Oe(t,e){const n=e.get(t);if(n)return n;let o=tt(t,[],!1).filter(c=>D(c)&&Q(c)!=="body"),i=null;const s=P(t).position==="fixed";let r=s?Y(t):t;for(;D(r)&&!G(r);){const c=P(r),a=wt(r);!a&&c.position==="fixed"&&(i=null),(s?!a&&!i:!a&&c.position==="static"&&!!i&&be.has(i.position)||et(r)&&!a&&Bt(t,r))?o=o.filter(u=>u!==r):i=c,r=Y(r)}return e.set(t,o),o}function Re(t){let{element:e,boundary:n,rootBoundary:o,strategy:i}=t;const r=[...n==="clippingAncestors"?ct(e)?[]:Oe(e,this._c):[].concat(n),o],c=r[0],a=r.reduce((l,u)=>{const d=Lt(e,u,i);return l.top=C(d.top,l.top),l.right=j(d.right,l.right),l.bottom=j(d.bottom,l.bottom),l.left=C(d.left,l.left),l},Lt(e,c,i));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function Ce(t){const{width:e,height:n}=Ft(t);return{width:e,height:n}}function Se(t,e,n){const o=B(e),i=H(e),s=n==="fixed",r=U(t,!0,s,e);let c={scrollLeft:0,scrollTop:0};const a=W(0);function l(){a.x=ft(i)}if(o||!o&&!s)if((Q(e)!=="body"||et(i))&&(c=lt(e)),o){const f=U(e,!0,s,e);a.x=f.x+e.clientLeft,a.y=f.y+e.clientTop}else i&&l();s&&!o&&i&&l();const u=i&&!o&&!s?Wt(i,c):W(0),d=r.left+c.scrollLeft-a.x-u.x,h=r.top+c.scrollTop-a.y-u.y;return{x:d,y:h,width:r.width,height:r.height}}function at(t){return P(t).position==="static"}function Tt(t,e){if(!B(t)||P(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return H(t)===n&&(n=n.ownerDocument.body),n}function Ht(t,e){const n=S(t);if(ct(t))return n;if(!B(t)){let i=Y(t);for(;i&&!G(i);){if(D(i)&&!at(i))return i;i=Y(i)}return n}let o=Tt(t,e);for(;o&&le(o)&&at(o);)o=Tt(o,e);return o&&G(o)&&at(o)&&!wt(o)?n:o||me(t)||n}const Le=async function(t){const e=this.getOffsetParent||Ht,n=this.getDimensions,o=await n(t.floating);return{reference:Se(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function Te(t){return P(t).direction==="rtl"}const Ee={convertOffsetParentRelativeRectToViewportRelativeRect:we,getDocumentElement:H,getClippingRect:Re,getOffsetParent:Ht,getElementRects:Le,getClientRects:xe,getDimensions:Ce,getScale:K,isElement:D,isRTL:Te};function Nt(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function De(t,e){let n=null,o;const i=H(t);function s(){var c;clearTimeout(o),(c=n)==null||c.disconnect(),n=null}function r(c,a){c===void 0&&(c=!1),a===void 0&&(a=1),s();const l=t.getBoundingClientRect(),{left:u,top:d,width:h,height:f}=l;if(c||e(),!h||!f)return;const m=nt(d),g=nt(i.clientWidth-(u+h)),p=nt(i.clientHeight-(d+f)),w=nt(u),y={rootMargin:-m+"px "+-g+"px "+-p+"px "+-w+"px",threshold:C(0,j(1,a))||1};let b=!0;function v(R){const A=R[0].intersectionRatio;if(A!==a){if(!b)return r();A?r(!1,A):o=setTimeout(()=>{r(!1,1e-7)},1e3)}A===1&&!Nt(l,t.getBoundingClientRect())&&r(),b=!1}try{n=new IntersectionObserver(v,{...y,root:i.ownerDocument})}catch{n=new IntersectionObserver(v,y)}n.observe(t)}return r(!0),s}function Pe(t,e,n,o){o===void 0&&(o={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:r=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:a=!1}=o,l=yt(t),u=i||s?[...l?tt(l):[],...tt(e)]:[];u.forEach(w=>{i&&w.addEventListener("scroll",n,{passive:!0}),s&&w.addEventListener("resize",n)});const d=l&&c?De(l,n):null;let h=-1,f=null;r&&(f=new ResizeObserver(w=>{let[x]=w;x&&x.target===l&&f&&(f.unobserve(e),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var y;(y=f)==null||y.observe(e)})),n()}),l&&!a&&f.observe(l),f.observe(e));let m,g=a?U(t):null;a&&p();function p(){const w=U(t);g&&!Nt(g,w)&&n(),g=w,m=requestAnimationFrame(p)}return n(),()=>{var w;u.forEach(x=>{i&&x.removeEventListener("scroll",n),s&&x.removeEventListener("resize",n)}),d?.(),(w=f)==null||w.disconnect(),f=null,a&&cancelAnimationFrame(m)}}const Me=ne,Fe=oe,ke=Zt,We=se,Be=te,He=Qt,Ne=ie,Ve=(t,e,n)=>{const o=new Map,i={platform:Ee,...n},s={...i.platform,_c:o};return Jt(t,e,{...i,platform:s})};export{We as a,He as b,Ve as c,Pe as d,ke as f,Be as h,Ne as l,Me as o,Fe as s};