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