UNPKG

@wikimedia/codex

Version:

Codex Design System for Wikimedia

2 lines (1 loc) 23.5 kB
var Xt=Object.defineProperty,qt=Object.defineProperties;var Gt=Object.getOwnPropertyDescriptors;var at=Object.getOwnPropertySymbols;var Tt=Object.prototype.hasOwnProperty,Ht=Object.prototype.propertyIsEnumerable;var wt=(t,e,n)=>e in t?Xt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,E=(t,e)=>{for(var n in e||(e={}))Tt.call(e,n)&&wt(t,n,e[n]);if(at)for(var n of at(e))Ht.call(e,n)&&wt(t,n,e[n]);return t},H=(t,e)=>qt(t,Gt(e));var st=(t,e)=>{var n={};for(var i in t)Tt.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(t!=null&&at)for(var i of at(t))e.indexOf(i)<0&&Ht.call(t,i)&&(n[i]=t[i]);return n};var W=(t,e,n)=>wt(t,typeof e!="symbol"?e+"":e,n);var D=(t,e,n)=>new Promise((i,o)=>{var r=c=>{try{l(n.next(c))}catch(a){o(a)}},s=c=>{try{l(n.throw(c))}catch(a){o(a)}},l=c=>c.done?i(c.value):Promise.resolve(c.value).then(r,s);l((n=n.apply(t,e)).next())});import{bo as Jt,a4 as Qt}from"./DemoBaseLayout.vue_vue_type_style_index_0_lang-Gun7AocI.js";/* empty css */const Zt=["top","right","bottom","left"],K=Math.min,A=Math.max,ut=Math.round,ft=Math.floor,$=t=>({x:t,y:t}),te={left:"right",right:"left",bottom:"top",top:"bottom"},ee={start:"end",end:"start"};function yt(t,e,n){return A(t,K(e,n))}function Q(t,e){return typeof t=="function"?t(e):t}function X(t){return t.split("-")[0]}function it(t){return t.split("-")[1]}function Bt(t){return t==="x"?"y":"x"}function Et(t){return t==="y"?"height":"width"}function G(t){return["top","bottom"].includes(X(t))?"y":"x"}function Ct(t){return Bt(G(t))}function ne(t,e,n){n===void 0&&(n=!1);const i=it(t),o=Ct(t),r=Et(o);let s=o==="x"?i===(n?"end":"start")?"right":"left":i==="start"?"bottom":"top";return e.reference[r]>e.floating[r]&&(s=dt(s)),[s,dt(s)]}function ie(t){const e=dt(t);return[bt(t),e,bt(e)]}function bt(t){return t.replace(/start|end/g,e=>ee[e])}function oe(t,e,n){const i=["left","right"],o=["right","left"],r=["top","bottom"],s=["bottom","top"];switch(t){case"top":case"bottom":return n?e?o:i:e?i:o;case"left":case"right":return e?r:s;default:return[]}}function se(t,e,n,i){const o=it(t);let r=oe(X(t),n==="start",i);return o&&(r=r.map(s=>s+"-"+o),e&&(r=r.concat(r.map(bt)))),r}function dt(t){return t.replace(/left|right|bottom|top/g,e=>te[e])}function re(t){return E({top:0,right:0,bottom:0,left:0},t)}function Vt(t){return typeof t!="number"?re(t):{top:t,right:t,bottom:t,left:t}}function ht(t){const{x:e,y:n,width:i,height:o}=t;return{width:i,height:o,top:n,left:e,right:e+i,bottom:n+o,x:e,y:n}}function Dt(t,e,n){let{reference:i,floating:o}=t;const r=G(e),s=Ct(e),l=Et(s),c=X(e),a=r==="y",h=i.x+i.width/2-o.width/2,f=i.y+i.height/2-o.height/2,m=i[l]/2-o[l]/2;let u;switch(c){case"top":u={x:h,y:i.y-o.height};break;case"bottom":u={x:h,y:i.y+i.height};break;case"right":u={x:i.x+i.width,y:f};break;case"left":u={x:i.x-o.width,y:f};break;default:u={x:i.x,y:i.y}}switch(it(e)){case"start":u[s]-=m*(n&&a?-1:1);break;case"end":u[s]+=m*(n&&a?-1:1);break}return u}const le=(t,e,n)=>D(void 0,null,function*(){const{placement:i="bottom",strategy:o="absolute",middleware:r=[],platform:s}=n,l=r.filter(Boolean),c=yield s.isRTL==null?void 0:s.isRTL(e);let a=yield s.getElementRects({reference:t,floating:e,strategy:o}),{x:h,y:f}=Dt(a,i,c),m=i,u={},p=0;for(let d=0;d<l.length;d++){const{name:w,fn:g}=l[d],{x,y,data:v,reset:b}=yield g({x:h,y:f,initialPlacement:i,placement:m,strategy:o,middlewareData:u,rects:a,platform:s,elements:{reference:t,floating:e}});h=x!=null?x:h,f=y!=null?y:f,u=H(E({},u),{[w]:E(E({},u[w]),v)}),b&&p<=50&&(p++,typeof b=="object"&&(b.placement&&(m=b.placement),b.rects&&(a=b.rects===!0?yield s.getElementRects({reference:t,floating:e,strategy:o}):b.rects),{x:h,y:f}=Dt(a,m,c)),d=-1)}return{x:h,y:f,placement:m,strategy:o,middlewareData:u}});function rt(t,e){return D(this,null,function*(){var n;e===void 0&&(e={});const{x:i,y:o,platform:r,rects:s,elements:l,strategy:c}=t,{boundary:a="clippingAncestors",rootBoundary:h="viewport",elementContext:f="floating",altBoundary:m=!1,padding:u=0}=Q(e,t),p=Vt(u),w=l[m?f==="floating"?"reference":"floating":f],g=ht(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:a,rootBoundary:h,strategy:c})),x=f==="floating"?{x:i,y:o,width:s.floating.width,height:s.floating.height}:s.reference,y=yield r.getOffsetParent==null?void 0:r.getOffsetParent(l.floating),v=(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},b=ht(r.convertOffsetParentRelativeRectToViewportRelativeRect?yield r.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:x,offsetParent:y,strategy:c}):x);return{top:(g.top-b.top+p.top)/v.y,bottom:(b.bottom-g.bottom+p.bottom)/v.y,left:(g.left-b.left+p.left)/v.x,right:(b.right-g.right+p.right)/v.x}})}const ce=t=>({name:"arrow",options:t,fn(n){return D(this,null,function*(){const{x:i,y:o,placement:r,rects:s,platform:l,elements:c,middlewareData:a}=n,{element:h,padding:f=0}=Q(t,n)||{};if(h==null)return{};const m=Vt(f),u={x:i,y:o},p=Ct(r),d=Et(p),w=yield l.getDimensions(h),g=p==="y",x=g?"top":"left",y=g?"bottom":"right",v=g?"clientHeight":"clientWidth",b=s.reference[d]+s.reference[p]-u[p]-s.floating[d],k=u[p]-s.reference[p],z=yield l.getOffsetParent==null?void 0:l.getOffsetParent(h);let R=z?z[v]:0;(!R||!(yield l.isElement==null?void 0:l.isElement(z)))&&(R=c.floating[v]||s.floating[d]);const N=b/2-k/2,F=R/2-w[d]/2-1,L=K(m[x],F),_=K(m[y],F),M=L,j=R-w[d]-_,C=R/2-w[d]/2+N,T=yt(M,C,j),Z=!a.arrow&&it(r)!=null&&C!==T&&s.reference[d]/2-(C<M?L:_)-w[d]/2<0,I=Z?C<M?C-M:C-j:0;return{[p]:u[p]+I,data:E({[p]:T,centerOffset:C-T-I},Z&&{alignmentOffset:I}),reset:Z}})}}),ae=function(t){return t===void 0&&(t={}),{name:"flip",options:t,fn(n){return D(this,null,function*(){var i,o;const{placement:r,middlewareData:s,rects:l,initialPlacement:c,platform:a,elements:h}=n,C=Q(t,n),{mainAxis:f=!0,crossAxis:m=!0,fallbackPlacements:u,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:d="none",flipAlignment:w=!0}=C,g=st(C,["mainAxis","crossAxis","fallbackPlacements","fallbackStrategy","fallbackAxisSideDirection","flipAlignment"]);if((i=s.arrow)!=null&&i.alignmentOffset)return{};const x=X(r),y=G(c),v=X(c)===c,b=yield a.isRTL==null?void 0:a.isRTL(h.floating),k=u||(v||!w?[dt(c)]:ie(c)),z=d!=="none";!u&&z&&k.push(...se(c,w,d,b));const R=[c,...k],N=yield rt(n,g),F=[];let L=((o=s.flip)==null?void 0:o.overflows)||[];if(f&&F.push(N[x]),m){const T=ne(r,l,b);F.push(N[T[0]],N[T[1]])}if(L=[...L,{placement:r,overflows:F}],!F.every(T=>T<=0)){var _,M;const T=(((_=s.flip)==null?void 0:_.index)||0)+1,Z=R[T];if(Z)return{data:{index:T,overflows:L},reset:{placement:Z}};let I=(M=L.filter(tt=>tt.overflows[0]<=0).sort((tt,U)=>tt.overflows[1]-U.overflows[1])[0])==null?void 0:M.placement;if(!I)switch(p){case"bestFit":{var j;const tt=(j=L.filter(U=>{if(z){const Y=G(U.placement);return Y===y||Y==="y"}return!0}).map(U=>[U.placement,U.overflows.filter(Y=>Y>0).reduce((Y,Kt)=>Y+Kt,0)]).sort((U,Y)=>U[1]-Y[1])[0])==null?void 0:j[0];tt&&(I=tt);break}case"initialPlacement":I=c;break}if(r!==I)return{reset:{placement:I}}}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 Pt(t){return Zt.some(e=>t[e]>=0)}const fe=function(t){return t===void 0&&(t={}),{name:"hide",options:t,fn(n){return D(this,null,function*(){const{rects:i}=n,s=Q(t,n),{strategy:o="referenceHidden"}=s,r=st(s,["strategy"]);switch(o){case"referenceHidden":{const l=yield rt(n,H(E({},r),{elementContext:"reference"})),c=St(l,i.reference);return{data:{referenceHiddenOffsets:c,referenceHidden:Pt(c)}}}case"escaped":{const l=yield rt(n,H(E({},r),{altBoundary:!0})),c=St(l,i.floating);return{data:{escapedOffsets:c,escaped:Pt(c)}}}default:return{}}})}}};function ue(t,e){return D(this,null,function*(){const{placement:n,platform:i,elements:o}=t,r=yield i.isRTL==null?void 0:i.isRTL(o.floating),s=X(n),l=it(n),c=G(n)==="y",a=["left","top"].includes(s)?-1:1,h=r&&c?-1:1,f=Q(e,t);let{mainAxis:m,crossAxis:u,alignmentAxis:p}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return l&&typeof p=="number"&&(u=l==="end"?p*-1:p),c?{x:u*h,y:m*a}:{x:m*a,y:u*h}})}const de=function(t){return t===void 0&&(t=0),{name:"offset",options:t,fn(n){return D(this,null,function*(){var i,o;const{x:r,y:s,placement:l,middlewareData:c}=n,a=yield ue(n,t);return l===((i=c.offset)==null?void 0:i.placement)&&(o=c.arrow)!=null&&o.alignmentOffset?{}:{x:r+a.x,y:s+a.y,data:H(E({},a),{placement:l})}})}}},he=function(t){return t===void 0&&(t={}),{name:"shift",options:t,fn(n){return D(this,null,function*(){const{x:i,y:o,placement:r}=n,g=Q(t,n),{mainAxis:s=!0,crossAxis:l=!1,limiter:c={fn:x=>{let{x:y,y:v}=x;return{x:y,y:v}}}}=g,a=st(g,["mainAxis","crossAxis","limiter"]),h={x:i,y:o},f=yield rt(n,a),m=G(X(r)),u=Bt(m);let p=h[u],d=h[m];if(s){const x=u==="y"?"top":"left",y=u==="y"?"bottom":"right",v=p+f[x],b=p-f[y];p=yt(v,p,b)}if(l){const x=m==="y"?"top":"left",y=m==="y"?"bottom":"right",v=d+f[x],b=d-f[y];d=yt(v,d,b)}const w=c.fn(H(E({},n),{[u]:p,[m]:d}));return H(E({},w),{data:{x:w.x-i,y:w.y-o,enabled:{[u]:s,[m]:l}}})})}}},me=function(t){return t===void 0&&(t={}),{name:"size",options:t,fn(n){return D(this,null,function*(){var i,o;const{placement:r,rects:s,platform:l,elements:c}=n,L=Q(t,n),{apply:a=()=>{}}=L,h=st(L,["apply"]),f=yield rt(n,h),m=X(r),u=it(r),p=G(r)==="y",{width:d,height:w}=s.floating;let g,x;m==="top"||m==="bottom"?(g=m,x=u===((yield l.isRTL==null?void 0:l.isRTL(c.floating))?"start":"end")?"left":"right"):(x=m,g=u==="end"?"top":"bottom");const y=w-f.top-f.bottom,v=d-f.left-f.right,b=K(w-f[g],y),k=K(d-f[x],v),z=!n.middlewareData.shift;let R=b,N=k;if((i=n.middlewareData.shift)!=null&&i.enabled.x&&(N=v),(o=n.middlewareData.shift)!=null&&o.enabled.y&&(R=y),z&&!u){const _=A(f.left,0),M=A(f.right,0),j=A(f.top,0),C=A(f.bottom,0);p?N=d-2*(_!==0||M!==0?_+M:A(f.left,f.right)):R=w-2*(j!==0||C!==0?j+C:A(f.top,f.bottom))}yield a(H(E({},n),{availableWidth:N,availableHeight:R}));const F=yield l.getDimensions(c.floating);return d!==F.width||w!==F.height?{reset:{rects:!0}}:{}})}}};function mt(){return typeof window!="undefined"}function ot(t){return Nt(t)?(t.nodeName||"").toLowerCase():"#document"}function O(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function V(t){var e;return(e=(Nt(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function Nt(t){return mt()?t instanceof Node||t instanceof O(t).Node:!1}function S(t){return mt()?t instanceof Element||t instanceof O(t).Element:!1}function B(t){return mt()?t instanceof HTMLElement||t instanceof O(t).HTMLElement:!1}function kt(t){return!mt()||typeof ShadowRoot=="undefined"?!1:t instanceof ShadowRoot||t instanceof O(t).ShadowRoot}function ct(t){const{overflow:e,overflowX:n,overflowY:i,display:o}=P(t);return/auto|scroll|overlay|hidden|clip/.test(e+i+n)&&!["inline","contents"].includes(o)}function pe(t){return["table","td","th"].includes(ot(t))}function pt(t){return[":popover-open",":modal"].some(e=>{try{return t.matches(e)}catch(n){return!1}})}function At(t){const e=Ot(),n=S(t)?P(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(i=>(n.willChange||"").includes(i))||["paint","layout","strict","content"].some(i=>(n.contain||"").includes(i))}function ge(t){let e=q(t);for(;B(e)&&!nt(e);){if(At(e))return e;if(pt(e))return null;e=q(e)}return null}function Ot(){return typeof CSS=="undefined"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function nt(t){return["html","body","#document"].includes(ot(t))}function P(t){return O(t).getComputedStyle(t)}function gt(t){return S(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function q(t){if(ot(t)==="html")return t;const e=t.assignedSlot||t.parentNode||kt(t)&&t.host||V(t);return kt(e)?e.host:e}function It(t){const e=q(t);return nt(e)?t.ownerDocument?t.ownerDocument.body:t.body:B(e)&&ct(e)?e:It(e)}function lt(t,e,n){var i;e===void 0&&(e=[]),n===void 0&&(n=!0);const o=It(t),r=o===((i=t.ownerDocument)==null?void 0:i.body),s=O(o);if(r){const l=vt(s);return e.concat(s,s.visualViewport||[],ct(o)?o:[],l&&n?lt(l):[])}return e.concat(o,lt(o,[],n))}function vt(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function zt(t){const e=P(t);let n=parseFloat(e.width)||0,i=parseFloat(e.height)||0;const o=B(t),r=o?t.offsetWidth:n,s=o?t.offsetHeight:i,l=ut(n)!==r||ut(i)!==s;return l&&(n=r,i=s),{width:n,height:i,$:l}}function Rt(t){return S(t)?t:t.contextElement}function et(t){const e=Rt(t);if(!B(e))return $(1);const n=e.getBoundingClientRect(),{width:i,height:o,$:r}=zt(e);let s=(r?ut(n.width):n.width)/i,l=(r?ut(n.height):n.height)/o;return(!s||!Number.isFinite(s))&&(s=1),(!l||!Number.isFinite(l))&&(l=1),{x:s,y:l}}const we=$(0);function _t(t){const e=O(t);return!Ot()||!e.visualViewport?we:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function xe(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==O(t)?!1:e}function J(t,e,n,i){e===void 0&&(e=!1),n===void 0&&(n=!1);const o=t.getBoundingClientRect(),r=Rt(t);let s=$(1);e&&(i?S(i)&&(s=et(i)):s=et(t));const l=xe(r,n,i)?_t(r):$(0);let c=(o.left+l.x)/s.x,a=(o.top+l.y)/s.y,h=o.width/s.x,f=o.height/s.y;if(r){const m=O(r),u=i&&S(i)?O(i):i;let p=m,d=vt(p);for(;d&&i&&u!==p;){const w=et(d),g=d.getBoundingClientRect(),x=P(d),y=g.left+(d.clientLeft+parseFloat(x.paddingLeft))*w.x,v=g.top+(d.clientTop+parseFloat(x.paddingTop))*w.y;c*=w.x,a*=w.y,h*=w.x,f*=w.y,c+=y,a+=v,p=O(d),d=vt(p)}}return ht({width:h,height:f,x:c,y:a})}function Lt(t,e){const n=gt(t).scrollLeft;return e?e.left+n:J(V(t)).left+n}function jt(t,e,n){n===void 0&&(n=!1);const i=t.getBoundingClientRect(),o=i.left+e.scrollLeft-(n?0:Lt(t,i)),r=i.top+e.scrollTop;return{x:o,y:r}}function ye(t){let{elements:e,rect:n,offsetParent:i,strategy:o}=t;const r=o==="fixed",s=V(i),l=e?pt(e.floating):!1;if(i===s||l&&r)return n;let c={scrollLeft:0,scrollTop:0},a=$(1);const h=$(0),f=B(i);if((f||!f&&!r)&&((ot(i)!=="body"||ct(s))&&(c=gt(i)),B(i))){const u=J(i);a=et(i),h.x=u.x+i.clientLeft,h.y=u.y+i.clientTop}const m=s&&!f&&!r?jt(s,c,!0):$(0);return{width:n.width*a.x,height:n.height*a.y,x:n.x*a.x-c.scrollLeft*a.x+h.x+m.x,y:n.y*a.y-c.scrollTop*a.y+h.y+m.y}}function be(t){return Array.from(t.getClientRects())}function ve(t){const e=V(t),n=gt(t),i=t.ownerDocument.body,o=A(e.scrollWidth,e.clientWidth,i.scrollWidth,i.clientWidth),r=A(e.scrollHeight,e.clientHeight,i.scrollHeight,i.clientHeight);let s=-n.scrollLeft+Lt(t);const l=-n.scrollTop;return P(i).direction==="rtl"&&(s+=A(e.clientWidth,i.clientWidth)-o),{width:o,height:r,x:s,y:l}}function Ee(t,e){const n=O(t),i=V(t),o=n.visualViewport;let r=i.clientWidth,s=i.clientHeight,l=0,c=0;if(o){r=o.width,s=o.height;const a=Ot();(!a||a&&e==="fixed")&&(l=o.offsetLeft,c=o.offsetTop)}return{width:r,height:s,x:l,y:c}}function Ce(t,e){const n=J(t,!0,e==="fixed"),i=n.top+t.clientTop,o=n.left+t.clientLeft,r=B(t)?et(t):$(1),s=t.clientWidth*r.x,l=t.clientHeight*r.y,c=o*r.x,a=i*r.y;return{width:s,height:l,x:c,y:a}}function Ft(t,e,n){let i;if(e==="viewport")i=Ee(t,n);else if(e==="document")i=ve(V(t));else if(S(e))i=Ce(e,n);else{const o=_t(t);i={x:e.x-o.x,y:e.y-o.y,width:e.width,height:e.height}}return ht(i)}function Ut(t,e){const n=q(t);return n===e||!S(n)||nt(n)?!1:P(n).position==="fixed"||Ut(n,e)}function Ae(t,e){const n=e.get(t);if(n)return n;let i=lt(t,[],!1).filter(l=>S(l)&&ot(l)!=="body"),o=null;const r=P(t).position==="fixed";let s=r?q(t):t;for(;S(s)&&!nt(s);){const l=P(s),c=At(s);!c&&l.position==="fixed"&&(o=null),(r?!c&&!o:!c&&l.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||ct(s)&&!c&&Ut(t,s))?i=i.filter(h=>h!==s):o=l,s=q(s)}return e.set(t,i),i}function Oe(t){let{element:e,boundary:n,rootBoundary:i,strategy:o}=t;const s=[...n==="clippingAncestors"?pt(e)?[]:Ae(e,this._c):[].concat(n),i],l=s[0],c=s.reduce((a,h)=>{const f=Ft(e,h,o);return a.top=A(f.top,a.top),a.right=K(f.right,a.right),a.bottom=K(f.bottom,a.bottom),a.left=A(f.left,a.left),a},Ft(e,l,o));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function Re(t){const{width:e,height:n}=zt(t);return{width:e,height:n}}function Le(t,e,n){const i=B(e),o=V(e),r=n==="fixed",s=J(t,!0,r,e);let l={scrollLeft:0,scrollTop:0};const c=$(0);if(i||!i&&!r)if((ot(e)!=="body"||ct(o))&&(l=gt(e)),i){const m=J(e,!0,r,e);c.x=m.x+e.clientLeft,c.y=m.y+e.clientTop}else o&&(c.x=Lt(o));const a=o&&!i&&!r?jt(o,l):$(0),h=s.left+l.scrollLeft-c.x-a.x,f=s.top+l.scrollTop-c.y-a.y;return{x:h,y:f,width:s.width,height:s.height}}function xt(t){return P(t).position==="static"}function Mt(t,e){if(!B(t)||P(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return V(t)===n&&(n=n.ownerDocument.body),n}function Yt(t,e){const n=O(t);if(pt(t))return n;if(!B(t)){let o=q(t);for(;o&&!nt(o);){if(S(o)&&!xt(o))return o;o=q(o)}return n}let i=Mt(t,e);for(;i&&pe(i)&&xt(i);)i=Mt(i,e);return i&&nt(i)&&xt(i)&&!At(i)?n:i||ge(t)||n}const Te=function(t){return D(this,null,function*(){const e=this.getOffsetParent||Yt,n=this.getDimensions,i=yield n(t.floating);return{reference:Le(t.reference,yield e(t.floating),t.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}})};function He(t){return P(t).direction==="rtl"}const De={convertOffsetParentRelativeRectToViewportRelativeRect:ye,getDocumentElement:V,getClippingRect:Oe,getOffsetParent:Yt,getElementRects:Te,getClientRects:be,getDimensions:Re,getScale:et,isElement:S,isRTL:He};function Se(t,e){let n=null,i;const o=V(t);function r(){var l;clearTimeout(i),(l=n)==null||l.disconnect(),n=null}function s(l,c){l===void 0&&(l=!1),c===void 0&&(c=1),r();const{left:a,top:h,width:f,height:m}=t.getBoundingClientRect();if(l||e(),!f||!m)return;const u=ft(h),p=ft(o.clientWidth-(a+f)),d=ft(o.clientHeight-(h+m)),w=ft(a),x={rootMargin:-u+"px "+-p+"px "+-d+"px "+-w+"px",threshold:A(0,K(1,c))||1};let y=!0;function v(b){const k=b[0].intersectionRatio;if(k!==c){if(!y)return s();k?s(!1,k):i=setTimeout(()=>{s(!1,1e-7)},1e3)}y=!1}try{n=new IntersectionObserver(v,H(E({},x),{root:o.ownerDocument}))}catch(b){n=new IntersectionObserver(v,x)}n.observe(t)}return s(!0),r}function Pe(t,e,n,i){i===void 0&&(i={});const{ancestorScroll:o=!0,ancestorResize:r=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=i,a=Rt(t),h=o||r?[...a?lt(a):[],...lt(e)]:[];h.forEach(g=>{o&&g.addEventListener("scroll",n,{passive:!0}),r&&g.addEventListener("resize",n)});const f=a&&l?Se(a,n):null;let m=-1,u=null;s&&(u=new ResizeObserver(g=>{let[x]=g;x&&x.target===a&&u&&(u.unobserve(e),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var y;(y=u)==null||y.observe(e)})),n()}),a&&!c&&u.observe(a),u.observe(e));let p,d=c?J(t):null;c&&w();function w(){const g=J(t);d&&(g.x!==d.x||g.y!==d.y||g.width!==d.width||g.height!==d.height)&&n(),d=g,p=requestAnimationFrame(w)}return n(),()=>{var g;h.forEach(x=>{o&&x.removeEventListener("scroll",n),r&&x.removeEventListener("resize",n)}),f==null||f(),(g=u)==null||g.disconnect(),u=null,c&&cancelAnimationFrame(p)}}const ke=de,Fe=he,Me=ae,ze=me,We=fe,_e=ce,$e=(t,e,n)=>{const i=new Map,o=E({platform:De},n),r=H(E({},o.platform),{_c:i});return le(t,e,H(E({},o),{platform:r}))};function Be(t,e=Jt){let i=Array.from(t).reduce((r,s)=>r*31+s.charCodeAt(0)&4294967295,0);i=i>>>0;const o=i.toString(36);return"".concat(e,"-").concat(o)}const Wt=new Map;class $t{constructor(e,n){W(this,"referenceElement");W(this,"tooltipElement");W(this,"textContent");W(this,"placement");W(this,"autoUpdateCleanup");W(this,"referenceElementHandlers");W(this,"tooltipElementHandlers");W(this,"escapeHandler");W(this,"timeoutId");var r,s;const i=e.ownerDocument,o=this.generateTooltipId(n.textContent);this.referenceElement=e,this.textContent=n.textContent,this.placement=(r=n.placement)!=null?r:"bottom",this.timeoutId=null,this.tooltipElement=i.createElement("div"),this.tooltipElement.classList.add("cdx-tooltip"),this.tooltipElement.role="tooltip",this.tooltipElement.id=o,this.referenceElement.setAttribute("aria-describedby",o),this.tooltipElement.textContent=this.textContent,(s=this.referenceElement.parentElement)==null||s.appendChild(this.tooltipElement),this.referenceElementHandlers={},this.referenceElementHandlers.mouseenter=this.show.bind(this),this.referenceElementHandlers.mouseleave=this.hideAfterDelay.bind(this),this.referenceElementHandlers.focus=this.show.bind(this),this.referenceElementHandlers.blur=this.hide.bind(this),this.tooltipElementHandlers={},this.tooltipElementHandlers.mouseenter=this.show.bind(this),this.tooltipElementHandlers.mouseleave=this.hideAfterDelay.bind(this),this.escapeHandler=this.onKeyup.bind(this),this.addEventListeners(),this.autoUpdateCleanup=Pe(this.referenceElement,this.tooltipElement,()=>this.update())}generateTooltipId(e){var o;const n=e.trim(),i=(o=Wt.get(n))!=null?o:0;return Wt.set(n,i+1),Be(n+"-"+i,"cdx-tooltip")}isVisible(){return this.tooltipElement.style.display==="block"}show(){this.timeoutId&&clearTimeout(this.timeoutId),this.tooltipElement.style.display="block",this.tooltipElement.ownerDocument.addEventListener("keyup",this.escapeHandler)}hide(){this.tooltipElement.style.display="none",this.tooltipElement.ownerDocument.removeEventListener("keyup",this.escapeHandler)}hideAfterDelay(){this.timeoutId=setTimeout(this.hide.bind(this),250)}onKeyup(e){e.key==="Escape"&&this.isVisible()&&this.hide()}addEventListeners(){Object.keys(this.referenceElementHandlers).forEach(e=>{this.referenceElement.addEventListener(e,this.referenceElementHandlers[e])}),Object.keys(this.tooltipElementHandlers).forEach(e=>{this.tooltipElement.addEventListener(e,this.tooltipElementHandlers[e])})}removeEventListeners(){Object.keys(this.referenceElementHandlers).forEach(e=>{this.referenceElement.removeEventListener(e,this.referenceElementHandlers[e])}),Object.keys(this.tooltipElementHandlers).forEach(e=>{this.tooltipElement.removeEventListener(e,this.tooltipElementHandlers[e])})}update(){$e(this.referenceElement,this.tooltipElement,{placement:this.placement,middleware:[ke(4),Me(),Fe(),We()]}).then(({x:e,y:n,middlewareData:i})=>{var r,s,l;const o=(s=(r=i.offset)==null?void 0:r.placement)!=null?s:this.placement;Object.assign(this.tooltipElement.style,{left:"".concat(e,"px"),top:"".concat(n,"px"),visibility:(l=i.hide)!=null&&l.referenceHidden?"hidden":"visible",transformOrigin:Qt[o]})})}updateWithOptions(e){var n;this.textContent=e.textContent,this.placement=(n=e.placement)!=null?n:this.placement,this.tooltipElement.textContent=this.textContent,this.update()}remove(){this.tooltipElement.remove(),this.autoUpdateCleanup(),this.removeEventListeners()}}const je={mounted(t,{value:e,arg:n}){e&&(typeof e=="string"&&e.trim()===""||(t.tooltip=new $t(t,{textContent:String(e),placement:n})))},updated(t,{value:e,arg:n}){e!==null&&(t.tooltip?t.tooltip.updateWithOptions({textContent:String(e),placement:n}):t.tooltip=new $t(t,{textContent:String(e),placement:n}))},beforeUnmount(t){t.tooltip&&t.tooltip.remove()}};export{je as C,Pe as a,_e as b,$e as c,Me as f,ot as g,We as h,Nt as i,ke as o,ze as s};