1 line
27 KiB
JavaScript
1 line
27 KiB
JavaScript
import{$ as e,Ct as t,Dt as n,H as r,I as i,N as a,Q as o,S as s,_t as c,b as l,dt as u,et as d,g as f,gt as p,j as m,mt as h,nt as g,st as _,v,w as y,z as b}from"./vue.runtime.esm-bundler-DQjudA8G.js";import{C as x,a as S,b as C,h as w}from"./dist-t_U6YImb.js";import{t as T}from"./createContext-BefgL9WT.js";import{r as E}from"./useForwardPropsEmits-ixfQllIc.js";import{t as D}from"./Primitive-jhoGcsVx.js";import{t as O}from"./useForwardExpose-OKJAPp5E.js";var k=0;function A(){e(e=>{if(!C)return;let t=document.querySelectorAll(`[data-reka-focus-guard]`);document.body.insertAdjacentElement(`afterbegin`,t[0]??j()),document.body.insertAdjacentElement(`beforeend`,t[1]??j()),k++,e(()=>{k===1&&document.querySelectorAll(`[data-reka-focus-guard]`).forEach(e=>e.remove()),k--})})}function j(){let e=document.createElement(`span`);return e.setAttribute(`data-reka-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}function ee(e){let t=h(),n=f(()=>t.value?.width??0),r=f(()=>t.value?.height??0);return i(()=>{let n=S(e);if(n){t.value={width:n.offsetWidth,height:n.offsetHeight};let e=new ResizeObserver(e=>{if(!Array.isArray(e)||!e.length)return;let r=e[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=n.offsetWidth,a=n.offsetHeight;t.value={width:i,height:a}});return e.observe(n,{box:`border-box`}),()=>e.unobserve(n)}else t.value=void 0}),{width:n,height:r}}function M(e){let t=x(``,1e3);return{search:t,handleTypeaheadSearch:(n,r)=>{if(t.value+=n,e)e(n);else{let e=E(),n=r.map(e=>({...e,textValue:e.value?.textValue??e.ref.textContent?.trim()??``})),i=n.find(t=>t.ref===e),a=ne(n.map(e=>e.textValue),t.value,i?.textValue),o=n.find(e=>e.textValue===a);return o&&o.ref.focus(),o?.ref}},resetTypeahead:()=>{t.value=``}}}function te(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function ne(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=te(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}var[re,N]=T(`PopperRoot`),ie=y({inheritAttrs:!1,__name:`PopperRoot`,setup(e){let t=h();return N({anchor:t,onAnchorChange:e=>t.value=e}),(e,t)=>r(e.$slots,`default`)}}),ae=y({__name:`PopperAnchor`,props:{reference:{type:null,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e){let n=e,{forwardRef:i,currentElement:a}=O(),o=re();return d(()=>{o.onAnchorChange(n.reference??a.value)}),(e,n)=>(b(),v(t(D),{ref:t(i),as:e.as,"as-child":e.asChild},{default:g(()=>[r(e.$slots,`default`)]),_:3},8,[`as`,`as-child`]))}});function oe(e){return e!==null}function se(e){return{name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=ce(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}}}function ce(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var le=[`top`,`right`,`bottom`,`left`],P=Math.min,F=Math.max,ue=Math.round,de=Math.floor,I=e=>({x:e,y:e}),fe={left:`right`,right:`left`,bottom:`top`,top:`bottom`},pe={start:`end`,end:`start`};function me(e,t,n){return F(e,P(t,n))}function L(e,t){return typeof e==`function`?e(t):e}function R(e){return e.split(`-`)[0]}function z(e){return e.split(`-`)[1]}function he(e){return e===`x`?`y`:`x`}function ge(e){return e===`y`?`height`:`width`}var _e=new Set([`top`,`bottom`]);function B(e){return _e.has(R(e))?`y`:`x`}function ve(e){return he(B(e))}function ye(e,t,n){n===void 0&&(n=!1);let r=z(e),i=ve(e),a=ge(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=Oe(o)),[o,Oe(o)]}function be(e){let t=Oe(e);return[xe(e),t,xe(t)]}function xe(e){return e.replace(/start|end/g,e=>pe[e])}var Se=[`left`,`right`],Ce=[`right`,`left`],we=[`top`,`bottom`],Te=[`bottom`,`top`];function Ee(e,t,n){switch(e){case`top`:case`bottom`:return n?t?Ce:Se:t?Se:Ce;case`left`:case`right`:return t?we:Te;default:return[]}}function De(e,t,n,r){let i=z(e),a=Ee(R(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(xe)))),a}function Oe(e){return e.replace(/left|right|bottom|top/g,e=>fe[e])}function ke(e){return{top:0,right:0,bottom:0,left:0,...e}}function Ae(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:ke(e)}function je(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function Me(e,t,n){let{reference:r,floating:i}=e,a=B(t),o=ve(t),s=ge(o),c=R(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(z(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}var Ne=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=a.filter(Boolean),c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=Me(l,r,c),f=r,p={},m=0;for(let n=0;n<s.length;n++){let{name:a,fn:h}=s[n],{x:g,y:_,data:v,reset:y}=await h({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:p,rects:l,platform:o,elements:{reference:e,floating:t}});u=g??u,d=_??d,p={...p,[a]:{...p[a],...v}},y&&m<=50&&(m++,typeof y==`object`&&(y.placement&&(f=y.placement),y.rects&&(l=y.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):y.rects),{x:u,y:d}=Me(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:p}};async function V(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=L(t,e),p=Ae(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=je(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=je(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var Pe=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=L(e,t)||{};if(l==null)return{};let d=Ae(u),f={x:n,y:r},p=ve(i),m=ge(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=P(d[_],T),D=P(d[v],T),O=E,k=C-h[m]-D,A=C/2-h[m]/2+w,j=me(O,A,k),ee=!c.arrow&&z(i)!=null&&A!==j&&a.reference[m]/2-(A<O?E:D)-h[m]/2<0,M=ee?A<O?A-O:A-k:0;return{[p]:f[p]+M,data:{[p]:j,centerOffset:A-j-M,...ee&&{alignmentOffset:M}},reset:ee}}}),Fe=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=L(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=R(r),_=B(o),v=R(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[Oe(o)]:be(o)),x=p!==`none`;!d&&x&&b.push(...De(o,m,p,y));let S=[o,...b],C=await V(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=ye(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==B(t))||T.every(e=>B(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=B(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function Ie(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Le(e){return le.some(t=>e[t]>=0)}var Re=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n}=t,{strategy:r=`referenceHidden`,...i}=L(e,t);switch(r){case`referenceHidden`:{let e=Ie(await V(t,{...i,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Le(e)}}}case`escaped`:{let e=Ie(await V(t,{...i,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:Le(e)}}}default:return{}}}}},ze=new Set([`left`,`top`]);async function Be(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=R(n),s=z(n),c=B(n)===`y`,l=ze.has(o)?-1:1,u=a&&c?-1:1,d=L(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var Ve=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await Be(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},He=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i}=t,{mainAxis:a=!0,crossAxis:o=!1,limiter:s={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...c}=L(e,t),l={x:n,y:r},u=await V(t,c),d=B(R(i)),f=he(d),p=l[f],m=l[d];if(a){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=p+u[e],r=p-u[t];p=me(n,p,r)}if(o){let e=d===`y`?`top`:`left`,t=d===`y`?`bottom`:`right`,n=m+u[e],r=m-u[t];m=me(n,m,r)}let h=s.fn({...t,[f]:p,[d]:m});return{...h,data:{x:h.x-n,y:h.y-r,enabled:{[f]:a,[d]:o}}}}}},Ue=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=L(e,t),u={x:n,y:r},d=B(i),f=he(d),p=u[f],m=u[d],h=L(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=ze.has(R(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},We=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=L(e,t),u=await V(t,l),d=R(i),f=z(i),p=B(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=P(h-u[g],v),x=P(m-u[_],y),S=!t.middlewareData.shift,C=b,w=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(w=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),S&&!f){let e=F(u.left,0),t=F(u.right,0),n=F(u.top,0),r=F(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:F(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:F(u.top,u.bottom))}await c({...t,availableWidth:w,availableHeight:C});let T=await o.getDimensions(s.floating);return m!==T.width||h!==T.height?{reset:{rects:!0}}:{}}}};function Ge(){return typeof window<`u`}function H(e){return Ke(e)?(e.nodeName||``).toLowerCase():`#document`}function U(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function W(e){return((Ke(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Ke(e){return Ge()?e instanceof Node||e instanceof U(e).Node:!1}function G(e){return Ge()?e instanceof Element||e instanceof U(e).Element:!1}function K(e){return Ge()?e instanceof HTMLElement||e instanceof U(e).HTMLElement:!1}function qe(e){return!Ge()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof U(e).ShadowRoot}var Je=new Set([`inline`,`contents`]);function q(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=Y(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!Je.has(i)}var Ye=new Set([`table`,`td`,`th`]);function Xe(e){return Ye.has(H(e))}var Ze=[`:popover-open`,`:modal`];function Qe(e){return Ze.some(t=>{try{return e.matches(t)}catch{return!1}})}var $e=[`transform`,`translate`,`scale`,`rotate`,`perspective`],et=[`transform`,`translate`,`scale`,`rotate`,`perspective`,`filter`],tt=[`paint`,`layout`,`strict`,`content`];function nt(e){let t=it(),n=G(e)?Y(e):e;return $e.some(e=>n[e]?n[e]!==`none`:!1)||(n.containerType?n.containerType!==`normal`:!1)||!t&&(n.backdropFilter?n.backdropFilter!==`none`:!1)||!t&&(n.filter?n.filter!==`none`:!1)||et.some(e=>(n.willChange||``).includes(e))||tt.some(e=>(n.contain||``).includes(e))}function rt(e){let t=X(e);for(;K(t)&&!J(t);){if(nt(t))return t;if(Qe(t))return null;t=X(t)}return null}function it(){return typeof CSS>`u`||!CSS.supports?!1:CSS.supports(`-webkit-backdrop-filter`,`none`)}var at=new Set([`html`,`body`,`#document`]);function J(e){return at.has(H(e))}function Y(e){return U(e).getComputedStyle(e)}function ot(e){return G(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function X(e){if(H(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||qe(e)&&e.host||W(e);return qe(t)?t.host:t}function st(e){let t=X(e);return J(t)?e.ownerDocument?e.ownerDocument.body:e.body:K(t)&&q(t)?t:st(t)}function ct(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=st(e),i=r===e.ownerDocument?.body,a=U(r);if(i){let e=lt(a);return t.concat(a,a.visualViewport||[],q(r)?r:[],e&&n?ct(e):[])}return t.concat(r,ct(r,[],n))}function lt(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function ut(e){let t=Y(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=K(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=ue(n)!==a||ue(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function dt(e){return G(e)?e:e.contextElement}function Z(e){let t=dt(e);if(!K(t))return I(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=ut(t),o=(a?ue(n.width):n.width)/r,s=(a?ue(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var ft=I(0);function pt(e){let t=U(e);return!it()||!t.visualViewport?ft:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function mt(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==U(e)?!1:t}function Q(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=dt(e),o=I(1);t&&(r?G(r)&&(o=Z(r)):o=Z(e));let s=mt(a,n,r)?pt(a):I(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=U(a),t=r&&G(r)?U(r):r,n=e,i=lt(n);for(;i&&r&&t!==n;){let e=Z(i),t=i.getBoundingClientRect(),r=Y(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=U(i),i=lt(n)}}return je({width:u,height:d,x:c,y:l})}function ht(e,t){let n=ot(e).scrollLeft;return t?t.left+n:Q(W(e)).left+n}function gt(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-ht(e,n),y:n.top+t.scrollTop}}function _t(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=W(r),s=t?Qe(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=I(1),u=I(0),d=K(r);if((d||!d&&!a)&&((H(r)!==`body`||q(o))&&(c=ot(r)),K(r))){let e=Q(r);l=Z(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?gt(o,c):I(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function vt(e){return Array.from(e.getClientRects())}function yt(e){let t=W(e),n=ot(e),r=e.ownerDocument.body,i=F(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=F(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+ht(e),s=-n.scrollTop;return Y(r).direction===`rtl`&&(o+=F(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var bt=25;function xt(e,t){let n=U(e),r=W(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=it();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=ht(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=bt&&(a-=o)}else l<=bt&&(a+=l);return{width:a,height:o,x:s,y:c}}var St=new Set([`absolute`,`fixed`]);function Ct(e,t){let n=Q(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=K(e)?Z(e):I(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function wt(e,t,n){let r;if(t===`viewport`)r=xt(e,n);else if(t===`document`)r=yt(W(e));else if(G(t))r=Ct(t,n);else{let n=pt(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return je(r)}function Tt(e,t){let n=X(e);return n===t||!G(n)||J(n)?!1:Y(n).position===`fixed`||Tt(n,t)}function Et(e,t){let n=t.get(e);if(n)return n;let r=ct(e,[],!1).filter(e=>G(e)&&H(e)!==`body`),i=null,a=Y(e).position===`fixed`,o=a?X(e):e;for(;G(o)&&!J(o);){let t=Y(o),n=nt(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&St.has(i.position)||q(o)&&!n&&Tt(e,o))?r=r.filter(e=>e!==o):i=t,o=X(o)}return t.set(e,r),r}function Dt(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?Qe(t)?[]:Et(t,this._c):[].concat(n),r],o=a[0],s=a.reduce((e,n)=>{let r=wt(t,n,i);return e.top=F(r.top,e.top),e.right=P(r.right,e.right),e.bottom=P(r.bottom,e.bottom),e.left=F(r.left,e.left),e},wt(t,o,i));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}}function Ot(e){let{width:t,height:n}=ut(e);return{width:t,height:n}}function kt(e,t,n){let r=K(t),i=W(t),a=n===`fixed`,o=Q(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=I(0);function l(){c.x=ht(i)}if(r||!r&&!a)if((H(t)!==`body`||q(i))&&(s=ot(t)),r){let e=Q(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();a&&!r&&i&&l();let u=i&&!r&&!a?gt(i,s):I(0);return{x:o.left+s.scrollLeft-c.x-u.x,y:o.top+s.scrollTop-c.y-u.y,width:o.width,height:o.height}}function At(e){return Y(e).position===`static`}function jt(e,t){if(!K(e)||Y(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return W(e)===n&&(n=n.ownerDocument.body),n}function Mt(e,t){let n=U(e);if(Qe(e))return n;if(!K(e)){let t=X(e);for(;t&&!J(t);){if(G(t)&&!At(t))return t;t=X(t)}return n}let r=jt(e,t);for(;r&&Xe(r)&&At(r);)r=jt(r,t);return r&&J(r)&&At(r)&&!nt(r)?n:r||rt(e)||n}var Nt=async function(e){let t=this.getOffsetParent||Mt,n=this.getDimensions,r=await n(e.floating);return{reference:kt(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Pt(e){return Y(e).direction===`rtl`}var Ft={convertOffsetParentRelativeRectToViewportRelativeRect:_t,getDocumentElement:W,getClippingRect:Dt,getOffsetParent:Mt,getElementRects:Nt,getClientRects:vt,getDimensions:Ot,getScale:Z,isElement:G,isRTL:Pt};function It(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Lt(e,t){let n=null,r,i=W(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=de(d),h=de(i.clientWidth-(u+f)),g=de(i.clientHeight-(d+p)),_=de(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:F(0,P(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(n!==c){if(!y)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!It(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function Rt(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=dt(e),u=i||a?[...l?ct(l):[],...ct(t)]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?Lt(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),p.observe(t));let m,h=c?Q(e):null;c&&g();function g(){let t=Q(e);h&&!It(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var zt=Ve,Bt=He,Vt=Fe,Ht=We,Ut=Re,Wt=Pe,Gt=Ue,Kt=(e,t,n)=>{let r=new Map,i={platform:Ft,...n},a={...i.platform,_c:r};return Ne(e,t,{...i,platform:a})};function qt(e){return typeof e==`object`&&!!e&&`$el`in e}function Jt(e){if(qt(e)){let t=e.$el;return Ke(t)&&H(t)===`#comment`?null:t}return e}function $(e){return typeof e==`function`?e():t(e)}function Yt(e){return{name:`arrow`,options:e,fn(t){let n=Jt($(e.element));return n==null?{}:Wt({element:n,padding:e.padding}).fn(t)}}}function Xt(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Zt(e,t){let n=Xt(e);return Math.round(t*n)/n}function Qt(e,t,n){n===void 0&&(n={});let r=n.whileElementsMounted,i=f(()=>$(n.open)??!0),a=f(()=>$(n.middleware)),s=f(()=>$(n.placement)??`bottom`),l=f(()=>$(n.strategy)??`absolute`),d=f(()=>$(n.transform)??!0),m=f(()=>Jt(e.value)),g=f(()=>Jt(t.value)),v=h(0),y=h(0),b=h(l.value),x=h(s.value),S=c({}),C=h(!1),w=f(()=>{let e={position:b.value,left:`0`,top:`0`};if(!g.value)return e;let t=Zt(g.value,v.value),n=Zt(g.value,y.value);return d.value?{...e,transform:`translate(`+t+`px, `+n+`px)`,...Xt(g.value)>=1.5&&{willChange:`transform`}}:{position:b.value,left:t+`px`,top:n+`px`}}),T;function E(){if(m.value==null||g.value==null)return;let e=i.value;Kt(m.value,g.value,{middleware:a.value,placement:s.value,strategy:l.value}).then(t=>{v.value=t.x,y.value=t.y,b.value=t.strategy,x.value=t.placement,S.value=t.middlewareData,C.value=e!==!1})}function D(){typeof T==`function`&&(T(),T=void 0)}function O(){if(D(),r===void 0){E();return}if(m.value!=null&&g.value!=null){T=r(m.value,g.value,E);return}}function k(){i.value||(C.value=!1)}return o([a,s,l,i],E,{flush:`sync`}),o([m,g],O,{flush:`sync`}),o(i,k,{flush:`sync`}),_()&&u(D),{x:p(v),y:p(y),strategy:p(b),placement:p(x),middlewareData:p(S),isPositioned:p(C),floatingStyles:w,update:E}}var $t={side:`bottom`,sideOffset:0,sideFlip:!0,align:`center`,alignOffset:0,alignFlip:!0,arrowPadding:0,hideShiftedArrow:!0,avoidCollisions:!0,collisionBoundary:()=>[],collisionPadding:0,sticky:`partial`,hideWhenDetached:!1,positionStrategy:`fixed`,updatePositionStrategy:`optimized`,prioritizePosition:!1},[en,tn]=T(`PopperContent`),nn=y({inheritAttrs:!1,__name:`PopperContent`,props:m({side:{type:null,required:!1},sideOffset:{type:Number,required:!1},sideFlip:{type:Boolean,required:!1},align:{type:null,required:!1},alignOffset:{type:Number,required:!1},alignFlip:{type:Boolean,required:!1},avoidCollisions:{type:Boolean,required:!1},collisionBoundary:{type:null,required:!1},collisionPadding:{type:[Number,Object],required:!1},arrowPadding:{type:Number,required:!1},hideShiftedArrow:{type:Boolean,required:!1},sticky:{type:String,required:!1},hideWhenDetached:{type:Boolean,required:!1},positionStrategy:{type:String,required:!1},updatePositionStrategy:{type:String,required:!1},disableUpdateOnLayoutShift:{type:Boolean,required:!1},prioritizePosition:{type:Boolean,required:!1},reference:{type:null,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},{...$t}),emits:[`placed`],setup(i,{emit:o}){let c=i,u=o,p=re(),{forwardRef:m,currentElement:_}=O(),v=h(),y=h(),{width:x,height:S}=ee(y),C=f(()=>c.side+(c.align===`center`?``:`-${c.align}`)),T=f(()=>typeof c.collisionPadding==`number`?c.collisionPadding:{top:0,right:0,bottom:0,left:0,...c.collisionPadding}),E=f(()=>Array.isArray(c.collisionBoundary)?c.collisionBoundary:[c.collisionBoundary]),k=f(()=>({padding:T.value,boundary:E.value.filter(oe),altBoundary:E.value.length>0})),A=f(()=>({mainAxis:c.sideFlip,crossAxis:c.alignFlip})),j=w(()=>[zt({mainAxis:c.sideOffset+S.value,alignmentAxis:c.alignOffset}),c.prioritizePosition&&c.avoidCollisions&&Vt({...k.value,...A.value}),c.avoidCollisions&&Bt({mainAxis:!0,crossAxis:!!c.prioritizePosition,limiter:c.sticky===`partial`?Gt():void 0,...k.value}),!c.prioritizePosition&&c.avoidCollisions&&Vt({...k.value,...A.value}),Ht({...k.value,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--reka-popper-available-width`,`${n}px`),o.setProperty(`--reka-popper-available-height`,`${r}px`),o.setProperty(`--reka-popper-anchor-width`,`${i}px`),o.setProperty(`--reka-popper-anchor-height`,`${a}px`)}}),y.value&&Yt({element:y.value,padding:c.arrowPadding}),se({arrowWidth:x.value,arrowHeight:S.value}),c.hideWhenDetached&&Ut({strategy:`referenceHidden`,...k.value})]),{floatingStyles:M,placement:te,isPositioned:ne,middlewareData:N,update:ie}=Qt(f(()=>c.reference??p.anchor.value),v,{strategy:c.positionStrategy,placement:C,whileElementsMounted:(...e)=>Rt(...e,{layoutShift:!c.disableUpdateOnLayoutShift,animationFrame:c.updatePositionStrategy===`always`}),middleware:j}),ae=f(()=>ce(te.value)[0]),le=f(()=>ce(te.value)[1]);d(()=>{ne.value&&u(`placed`)});let P=f(()=>{let e=N.value.arrow?.centerOffset!==0;return c.hideShiftedArrow&&e}),F=h(``);return e(()=>{_.value&&(F.value=window.getComputedStyle(_.value).zIndex)}),tn({placedSide:ae,onArrowChange:e=>y.value=e,arrowX:f(()=>N.value.arrow?.x??0),arrowY:f(()=>N.value.arrow?.y??0),shouldHideArrow:P}),(e,i)=>(b(),l(`div`,{ref_key:`floatingRef`,ref:v,"data-reka-popper-content-wrapper":``,style:n({...t(M),transform:t(ne)?t(M).transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:F.value,"--reka-popper-transform-origin":[t(N).transformOrigin?.x,t(N).transformOrigin?.y].join(` `),...t(N).hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}})},[s(t(D),a({ref:t(m)},e.$attrs,{"as-child":c.asChild,as:e.as,"data-side":ae.value,"data-align":le.value,style:{animation:t(ne)?void 0:`none`}}),{default:g(()=>[r(e.$slots,`default`)]),_:3},16,[`as-child`,`as`,`data-side`,`data-align`,`style`])],4))}});export{ie as a,ae as i,nn as n,M as o,en as r,A as s,$t as t}; |