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