@radui/ui 0.0.18 → 0.0.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- 'use client';import*as e from"react";import t,{useLayoutEffect as n,useEffect as r,useRef as o,useState as i}from"react";import*as l from"react-dom";var c=function(){return c=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},c.apply(this,arguments)};"function"==typeof SuppressedError&&SuppressedError;function s(e){return f(e)?(e.nodeName||"").toLowerCase():"#document"}function a(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function u(e){var t;return null==(t=(f(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function f(e){return e instanceof Node||e instanceof a(e).Node}function d(e){return e instanceof Element||e instanceof a(e).Element}function p(e){return e instanceof HTMLElement||e instanceof a(e).HTMLElement}function m(e){return"undefined"!=typeof ShadowRoot&&(e instanceof ShadowRoot||e instanceof a(e).ShadowRoot)}function v(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=x(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function g(e){return["table","td","th"].includes(s(e))}function h(e){const t=w(),n=x(e);return"none"!==n.transform||"none"!==n.perspective||!!n.containerType&&"normal"!==n.containerType||!t&&!!n.backdropFilter&&"none"!==n.backdropFilter||!t&&!!n.filter&&"none"!==n.filter||["transform","perspective","filter"].some((e=>(n.willChange||"").includes(e)))||["paint","layout","strict","content"].some((e=>(n.contain||"").includes(e)))}function y(e){let t=R(e);for(;p(t)&&!b(t);){if(h(t))return t;t=R(t)}return null}function w(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function b(e){return["html","body","#document"].includes(s(e))}function x(e){return a(e).getComputedStyle(e)}function E(e){return d(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function R(e){if("html"===s(e))return e;const t=e.assignedSlot||e.parentNode||m(e)&&e.host||u(e);return m(t)?t.host:t}function L(e){const t=R(e);return b(t)?e.ownerDocument?e.ownerDocument.body:e.body:p(t)&&v(t)?t:L(t)}function P(e,t,n){var r;void 0===t&&(t=[]),void 0===n&&(n=!0);const o=L(e),i=o===(null==(r=e.ownerDocument)?void 0:r.body),l=a(o);return i?t.concat(l,l.visualViewport||[],v(o)?o:[],l.frameElement&&n?P(l.frameElement):[]):t.concat(o,P(o,[],n))}function C(e,t){if(!e||!t)return!1;const n=null==t.getRootNode?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&m(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function O(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}function k(e){return(null==e?void 0:e.ownerDocument)||document}function T(e,t){if(null==t)return!1;if("composedPath"in e)return e.composedPath().includes(t);const n=e;return null!=n.target&&t.contains(n.target)}function S(e){return"composedPath"in e?e.composedPath()[0]:e.target}const D=["top","right","bottom","left"],M=Math.min,A=Math.max,N=Math.round,F=Math.floor,H=e=>({x:e,y:e}),W={left:"right",right:"left",bottom:"top",top:"bottom"},B={start:"end",end:"start"};function I(e,t,n){return A(e,M(t,n))}function _(e,t){return"function"==typeof e?e(t):e}function V(e){return e.split("-")[0]}function j(e){return e.split("-")[1]}function K(e){return"x"===e?"y":"x"}function z(e){return"y"===e?"height":"width"}function X(e){return["top","bottom"].includes(V(e))?"y":"x"}function $(e){return K(X(e))}function Y(e){return e.replace(/start|end/g,(e=>B[e]))}function q(e){return e.replace(/left|right|bottom|top/g,(e=>W[e]))}function U(e){return"number"!=typeof e?function(e){return{top:0,right:0,bottom:0,left:0,...e}}(e):{top:e,right:e,bottom:e,left:e}}function Z(e){return{...e,top:e.y,left:e.x,right:e.x+e.width,bottom:e.y+e.height}}function Q(e,t,n){let{reference:r,floating:o}=e;const i=X(t),l=$(t),c=z(l),s=V(t),a="y"===i,u=r.x+r.width/2-o.width/2,f=r.y+r.height/2-o.height/2,d=r[c]/2-o[c]/2;let p;switch(s){case"top":p={x:u,y:r.y-o.height};break;case"bottom":p={x:u,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:f};break;case"left":p={x:r.x-o.width,y:f};break;default:p={x:r.x,y:r.y}}switch(j(t)){case"start":p[l]-=d*(n&&a?-1:1);break;case"end":p[l]+=d*(n&&a?-1:1)}return p}async function G(e,t){var n;void 0===t&&(t={});const{x:r,y:o,platform:i,rects:l,elements:c,strategy:s}=e,{boundary:a="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:d=!1,padding:p=0}=_(t,e),m=U(p),v=c[d?"floating"===f?"reference":"floating":f],g=Z(await i.getClippingRect({element:null==(n=await(null==i.isElement?void 0:i.isElement(v)))||n?v:v.contextElement||await(null==i.getDocumentElement?void 0:i.getDocumentElement(c.floating)),boundary:a,rootBoundary:u,strategy:s})),h="floating"===f?{...l.floating,x:r,y:o}:l.reference,y=await(null==i.getOffsetParent?void 0:i.getOffsetParent(c.floating)),w=await(null==i.isElement?void 0:i.isElement(y))&&await(null==i.getScale?void 0:i.getScale(y))||{x:1,y:1},b=Z(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:h,offsetParent:y,strategy:s}):h);return{top:(g.top-b.top+m.top)/w.y,bottom:(b.bottom-g.bottom+m.bottom)/w.y,left:(g.left-b.left+m.left)/w.x,right:(b.right-g.right+m.right)/w.x}}function J(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function ee(e){return D.some((t=>e[t]>=0))}const te=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:l,middlewareData:c}=t,s=await async function(e,t){const{placement:n,platform:r,elements:o}=e,i=await(null==r.isRTL?void 0:r.isRTL(o.floating)),l=V(n),c=j(n),s="y"===X(n),a=["left","top"].includes(l)?-1:1,u=i&&s?-1:1,f=_(t,e);let{mainAxis:d,crossAxis:p,alignmentAxis:m}="number"==typeof f?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...f};return c&&"number"==typeof m&&(p="end"===c?-1*m:m),s?{x:p*u,y:d*a}:{x:d*a,y:p*u}}(t,e);return l===(null==(n=c.offset)?void 0:n.placement)&&null!=(r=c.arrow)&&r.alignmentOffset?{}:{x:o+s.x,y:i+s.y,data:{...s,placement:l}}}}};function ne(e){const t=x(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=p(e),i=o?e.offsetWidth:n,l=o?e.offsetHeight:r,c=N(n)!==i||N(r)!==l;return c&&(n=i,r=l),{width:n,height:r,$:c}}function re(e){return d(e)?e:e.contextElement}function oe(e){const t=re(e);if(!p(t))return H(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=ne(t);let l=(i?N(n.width):n.width)/r,c=(i?N(n.height):n.height)/o;return l&&Number.isFinite(l)||(l=1),c&&Number.isFinite(c)||(c=1),{x:l,y:c}}const ie=H(0);function le(e){const t=a(e);return w()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:ie}function ce(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);const o=e.getBoundingClientRect(),i=re(e);let l=H(1);t&&(r?d(r)&&(l=oe(r)):l=oe(e));const c=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==a(e))&&t}(i,n,r)?le(i):H(0);let s=(o.left+c.x)/l.x,u=(o.top+c.y)/l.y,f=o.width/l.x,p=o.height/l.y;if(i){const e=a(i),t=r&&d(r)?a(r):r;let n=e.frameElement;for(;n&&r&&t!==e;){const e=oe(n),t=n.getBoundingClientRect(),r=x(n),o=t.left+(n.clientLeft+parseFloat(r.paddingLeft))*e.x,i=t.top+(n.clientTop+parseFloat(r.paddingTop))*e.y;s*=e.x,u*=e.y,f*=e.x,p*=e.y,s+=o,u+=i,n=a(n).frameElement}}return Z({width:f,height:p,x:s,y:u})}const se=[":popover-open",":modal"];function ae(e){let t=!1,n=0,r=0;if(se.forEach((n=>{!function(n){try{t=t||e.matches(n)}catch(e){}}(n)})),t){const t=y(e);if(t){const e=t.getBoundingClientRect();n=e.x,r=e.y}}return[t,n,r]}function ue(e){return ce(u(e)).left+E(e).scrollLeft}function fe(e,t,n){let r;if("viewport"===t)r=function(e,t){const n=a(e),r=u(e),o=n.visualViewport;let i=r.clientWidth,l=r.clientHeight,c=0,s=0;if(o){i=o.width,l=o.height;const e=w();(!e||e&&"fixed"===t)&&(c=o.offsetLeft,s=o.offsetTop)}return{width:i,height:l,x:c,y:s}}(e,n);else if("document"===t)r=function(e){const t=u(e),n=E(e),r=e.ownerDocument.body,o=A(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=A(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let l=-n.scrollLeft+ue(e);const c=-n.scrollTop;return"rtl"===x(r).direction&&(l+=A(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:l,y:c}}(u(e));else if(d(t))r=function(e,t){const n=ce(e,!0,"fixed"===t),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=p(e)?oe(e):H(1);return{width:e.clientWidth*i.x,height:e.clientHeight*i.y,x:o*i.x,y:r*i.y}}(t,n);else{const n=le(e);r={...t,x:t.x-n.x,y:t.y-n.y}}return Z(r)}function de(e,t){const n=R(e);return!(n===t||!d(n)||b(n))&&("fixed"===x(n).position||de(n,t))}function pe(e,t,n,r){const o=p(t),i=u(t),l="fixed"===n,c=ce(e,!0,l,t);let a={scrollLeft:0,scrollTop:0};const f=H(0);if(o||!o&&!l)if(("body"!==s(t)||v(i))&&(a=E(t)),o){const e=ce(t,!0,l,t);f.x=e.x+t.clientLeft,f.y=e.y+t.clientTop}else i&&(f.x=ue(i));let d=c.left+a.scrollLeft-f.x,m=c.top+a.scrollTop-f.y;const[g,h,y]=ae(r);return g&&(d+=h,m+=y,o&&(d+=t.clientLeft,m+=t.clientTop)),{x:d,y:m,width:c.width,height:c.height}}function me(e,t){return p(e)&&"fixed"!==x(e).position?t?t(e):e.offsetParent:null}function ve(e,t){const n=a(e);if(!p(e))return n;let r=me(e,t);for(;r&&g(r)&&"static"===x(r).position;)r=me(r,t);return r&&("html"===s(r)||"body"===s(r)&&"static"===x(r).position&&!h(r))?n:r||y(e)||n}const ge={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i=u(r),[l]=t?ae(t.floating):[!1];if(r===i||l)return n;let c={scrollLeft:0,scrollTop:0},a=H(1);const f=H(0),d=p(r);if((d||!d&&"fixed"!==o)&&(("body"!==s(r)||v(i))&&(c=E(r)),p(r))){const e=ce(r);a=oe(r),f.x=e.x+r.clientLeft,f.y=e.y+r.clientTop}return{width:n.width*a.x,height:n.height*a.y,x:n.x*a.x-c.scrollLeft*a.x+f.x,y:n.y*a.y-c.scrollTop*a.y+f.y}},getDocumentElement:u,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[..."clippingAncestors"===n?function(e,t){const n=t.get(e);if(n)return n;let r=P(e,[],!1).filter((e=>d(e)&&"body"!==s(e))),o=null;const i="fixed"===x(e).position;let l=i?R(e):e;for(;d(l)&&!b(l);){const t=x(l),n=h(l);n||"fixed"!==t.position||(o=null),(i?!n&&!o:!n&&"static"===t.position&&o&&["absolute","fixed"].includes(o.position)||v(l)&&!n&&de(e,l))?r=r.filter((e=>e!==l)):o=t,l=R(l)}return t.set(e,r),r}(t,this._c):[].concat(n),r],l=i[0],c=i.reduce(((e,n)=>{const r=fe(t,n,o);return e.top=A(r.top,e.top),e.right=M(r.right,e.right),e.bottom=M(r.bottom,e.bottom),e.left=A(r.left,e.left),e}),fe(t,l,o));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}},getOffsetParent:ve,getElementRects:async function(e){const t=this.getOffsetParent||ve,n=this.getDimensions;return{reference:pe(e.reference,await t(e.floating),e.strategy,e.floating),floating:{x:0,y:0,...await n(e.floating)}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){const{width:t,height:n}=ne(e);return{width:t,height:n}},getScale:oe,isElement:d,isRTL:function(e){return"rtl"===x(e).direction}};function he(e,t,n,r){void 0===r&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:l="function"==typeof ResizeObserver,layoutShift:c="function"==typeof IntersectionObserver,animationFrame:s=!1}=r,a=re(e),f=o||i?[...a?P(a):[],...P(t)]:[];f.forEach((e=>{o&&e.addEventListener("scroll",n,{passive:!0}),i&&e.addEventListener("resize",n)}));const d=a&&c?function(e,t){let n,r=null;const o=u(e);function i(){var e;clearTimeout(n),null==(e=r)||e.disconnect(),r=null}return function l(c,s){void 0===c&&(c=!1),void 0===s&&(s=1),i();const{left:a,top:u,width:f,height:d}=e.getBoundingClientRect();if(c||t(),!f||!d)return;const p={rootMargin:-F(u)+"px "+-F(o.clientWidth-(a+f))+"px "+-F(o.clientHeight-(u+d))+"px "+-F(a)+"px",threshold:A(0,M(1,s))||1};let m=!0;function v(e){const t=e[0].intersectionRatio;if(t!==s){if(!m)return l();t?l(!1,t):n=setTimeout((()=>{l(!1,1e-7)}),100)}m=!1}try{r=new IntersectionObserver(v,{...p,root:o.ownerDocument})}catch(e){r=new IntersectionObserver(v,p)}r.observe(e)}(!0),i}(a,n):null;let p,m=-1,v=null;l&&(v=new ResizeObserver((e=>{let[r]=e;r&&r.target===a&&v&&(v.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame((()=>{var e;null==(e=v)||e.observe(t)}))),n()})),a&&!s&&v.observe(a),v.observe(t));let g=s?ce(e):null;return s&&function t(){const r=ce(e);!g||r.x===g.x&&r.y===g.y&&r.width===g.width&&r.height===g.height||n();g=r,p=requestAnimationFrame(t)}(),n(),()=>{var e;f.forEach((e=>{o&&e.removeEventListener("scroll",n),i&&e.removeEventListener("resize",n)})),null==d||d(),null==(e=v)||e.disconnect(),v=null,s&&cancelAnimationFrame(p)}}const ye=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:i=!0,crossAxis:l=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...s}=_(e,t),a={x:n,y:r},u=await G(t,s),f=X(V(o)),d=K(f);let p=a[d],m=a[f];if(i){const e="y"===d?"bottom":"right";p=I(p+u["y"===d?"top":"left"],p,p-u[e])}if(l){const e="y"===f?"bottom":"right";m=I(m+u["y"===f?"top":"left"],m,m-u[e])}const v=c.fn({...t,[d]:p,[f]:m});return{...v,data:{x:v.x-n,y:v.y-r}}}}},we=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:l,initialPlacement:c,platform:s,elements:a}=t,{mainAxis:u=!0,crossAxis:f=!0,fallbackPlacements:d,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:v=!0,...g}=_(e,t);if(null!=(n=i.arrow)&&n.alignmentOffset)return{};const h=V(o),y=V(c)===c,w=await(null==s.isRTL?void 0:s.isRTL(a.floating)),b=d||(y||!v?[q(c)]:function(e){const t=q(e);return[Y(e),t,Y(t)]}(c));d||"none"===m||b.push(...function(e,t,n,r){const o=j(e);let i=function(e,t,n){const r=["left","right"],o=["right","left"],i=["top","bottom"],l=["bottom","top"];switch(e){case"top":case"bottom":return n?t?o:r:t?r:o;case"left":case"right":return t?i:l;default:return[]}}(V(e),"start"===n,r);return o&&(i=i.map((e=>e+"-"+o)),t&&(i=i.concat(i.map(Y)))),i}(c,v,m,w));const x=[c,...b],E=await G(t,g),R=[];let L=(null==(r=i.flip)?void 0:r.overflows)||[];if(u&&R.push(E[h]),f){const e=function(e,t,n){void 0===n&&(n=!1);const r=j(e),o=$(e),i=z(o);let l="x"===o?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[i]>t.floating[i]&&(l=q(l)),[l,q(l)]}(o,l,w);R.push(E[e[0]],E[e[1]])}if(L=[...L,{placement:o,overflows:R}],!R.every((e=>e<=0))){var P,C;const e=((null==(P=i.flip)?void 0:P.index)||0)+1,t=x[e];if(t)return{data:{index:e,overflows:L},reset:{placement:t}};let n=null==(C=L.filter((e=>e.overflows[0]<=0)).sort(((e,t)=>e.overflows[1]-t.overflows[1]))[0])?void 0:C.placement;if(!n)switch(p){case"bestFit":{var O;const e=null==(O=L.map((e=>[e.placement,e.overflows.filter((e=>e>0)).reduce(((e,t)=>e+t),0)])).sort(((e,t)=>e[1]-t[1]))[0])?void 0:O[0];e&&(n=e);break}case"initialPlacement":n=c}if(o!==n)return{reset:{placement:n}}}return{}}}},be=function(e){return void 0===e&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...o}=_(e,t);switch(r){case"referenceHidden":{const e=J(await G(t,{...o,elementContext:"reference"}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:ee(e)}}}case"escaped":{const e=J(await G(t,{...o,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:ee(e)}}}default:return{}}}}},xe=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:i,platform:l,elements:c,middlewareData:s}=t,{element:a,padding:u=0}=_(e,t)||{};if(null==a)return{};const f=U(u),d={x:n,y:r},p=$(o),m=z(p),v=await l.getDimensions(a),g="y"===p,h=g?"top":"left",y=g?"bottom":"right",w=g?"clientHeight":"clientWidth",b=i.reference[m]+i.reference[p]-d[p]-i.floating[m],x=d[p]-i.reference[p],E=await(null==l.getOffsetParent?void 0:l.getOffsetParent(a));let R=E?E[w]:0;R&&await(null==l.isElement?void 0:l.isElement(E))||(R=c.floating[w]||i.floating[m]);const L=b/2-x/2,P=R/2-v[m]/2-1,C=M(f[h],P),O=M(f[y],P),k=C,T=R-v[m]-O,S=R/2-v[m]/2+L,D=I(k,S,T),A=!s.arrow&&null!=j(o)&&S!==D&&i.reference[m]/2-(S<k?C:O)-v[m]/2<0,N=A?S<k?S-k:S-T:0;return{[p]:d[p]+N,data:{[p]:D,centerOffset:S-D-N,...A&&{alignmentOffset:N}},reset:A}}}),Ee=(e,t,n)=>{const r=new Map,o={platform:ge,...n},i={...o.platform,_c:r};return(async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:l}=n,c=i.filter(Boolean),s=await(null==l.isRTL?void 0:l.isRTL(t));let a=await l.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:f}=Q(a,r,s),d=r,p={},m=0;for(let n=0;n<c.length;n++){const{name:i,fn:v}=c[n],{x:g,y:h,data:y,reset:w}=await v({x:u,y:f,initialPlacement:r,placement:d,strategy:o,middlewareData:p,rects:a,platform:l,elements:{reference:e,floating:t}});u=null!=g?g:u,f=null!=h?h:f,p={...p,[i]:{...p[i],...y}},w&&m<=50&&(m++,"object"==typeof w&&(w.placement&&(d=w.placement),w.rects&&(a=!0===w.rects?await l.getElementRects({reference:e,floating:t,strategy:o}):w.rects),({x:u,y:f}=Q(a,d,s))),n=-1)}return{x:u,y:f,placement:d,strategy:o,middlewareData:p}})(e,t,{...o,platform:i})};var Re="undefined"!=typeof document?n:r;function Le(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;0!=r--;)if(!Le(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;0!=r--;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;0!=r--;){const n=o[r];if(("_owner"!==n||!e.$$typeof)&&!Le(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function Pe(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Ce(e,t){const n=Pe(e);return Math.round(t*n)/n}function Oe(t){const n=e.useRef(t);return Re((()=>{n.current=t})),n}const ke=e["useInsertionEffect".toString()]||(e=>e());function Te(t){const n=e.useRef((()=>{if("production"!==process.env.NODE_ENV)throw new Error("Cannot call an event handler while rendering.")}));return ke((()=>{n.current=t})),e.useCallback((function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return null==n.current?void 0:n.current(...t)}),[])}var Se="undefined"!=typeof document?n:r;function De(){return De=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},De.apply(this,arguments)}let Me=!1,Ae=0;const Ne=()=>"floating-ui-"+Ae++;const Fe=e["useId".toString()]||function(){const[t,n]=e.useState((()=>Me?Ne():void 0));return Se((()=>{null==t&&n(Ne())}),[]),e.useEffect((()=>{Me||(Me=!0)}),[]),t},He=e.forwardRef((function(t,n){let{context:{placement:r,elements:{floating:o},middlewareData:{arrow:i}},width:l=14,height:c=7,tipRadius:s=0,strokeWidth:a=0,staticOffset:u,stroke:f,d:d,style:{transform:p,...m}={},...v}=t;"production"!==process.env.NODE_ENV&&(n||console.warn("Floating UI: The `ref` prop is required for the `FloatingArrow`","component."));const g=Fe();if(!o)return null;a*=2;const h=a/2,y=l/2*(s/-8+1),w=c/2*s/4,[b,x]=r.split("-"),E=ge.isRTL(o),R=!!d,L="top"===b||"bottom"===b,P=u&&"end"===x?"bottom":"top";let C=u&&"end"===x?"right":"left";u&&E&&(C="end"===x?"left":"right");const O=null!=(null==i?void 0:i.x)?u||i.x:"",k=null!=(null==i?void 0:i.y)?u||i.y:"",T=d||"M0,0 H"+l+" L"+(l-y)+","+(c-w)+" Q"+l/2+","+c+" "+y+","+(c-w)+" Z",S={top:R?"rotate(180deg)":"",left:R?"rotate(90deg)":"rotate(-90deg)",bottom:R?"":"rotate(180deg)",right:R?"rotate(-90deg)":"rotate(90deg)"}[b];return e.createElement("svg",De({},v,{"aria-hidden":!0,ref:n,width:R?l:l+a,height:l,viewBox:"0 0 "+l+" "+(c>l?c:l),style:{position:"absolute",pointerEvents:"none",[C]:O,[P]:k,[b]:L||R?"100%":"calc(100% - "+a/2+"px)",transform:""+S+(null!=p?p:""),...m}}),a>0&&e.createElement("path",{clipPath:"url(#"+g+")",fill:"none",stroke:f,strokeWidth:a+(d?0:1),d:T}),e.createElement("path",{stroke:a&&!d?v.fill:"none",d:T}),e.createElement("clipPath",{id:g},e.createElement("rect",{x:-h,y:h*(R?-1:1),width:l+a,height:l})))}));const We=e.createContext(null),Be=e.createContext(null),Ie=()=>{var t;return(null==(t=e.useContext(We))?void 0:t.id)||null},_e=()=>e.useContext(Be);function Ve(e){return"data-floating-ui-"+e}function je(e){const t=o(e);return Se((()=>{t.current=e})),t}const Ke=Ve("safe-polygon");function ze(e,t,n){return n&&!O(n)?0:"number"==typeof e?e:null==e?void 0:e[t]}function Xe(e,t){let n=e.filter((e=>{var n;return e.parentId===t&&(null==(n=e.context)?void 0:n.open)})),r=n;for(;r.length;)r=e.filter((e=>{var t;return null==(t=r)?void 0:t.some((t=>{var n;return e.parentId===t.id&&(null==(n=e.context)?void 0:n.open)}))})),n=n.concat(r);return n}const $e={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},Ye={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},qe=e=>{var t,n;return{escapeKey:"boolean"==typeof e?e:null!=(t=null==e?void 0:e.escapeKey)&&t,outsidePress:"boolean"==typeof e?e:null==(n=null==e?void 0:e.outsidePress)||n}};let Ue;function Ze(t){var n;void 0===t&&(t={});const{open:r=!1,onOpenChange:o,nodeId:i}=t;if("production"!==process.env.NODE_ENV){var c;const e="Floating UI: Cannot pass a virtual element to the `elements.reference` option, as it must be a real DOM element. Use `refs.setPositionReference` instead.";var s,a;if(null!=(c=t.elements)&&c.reference&&!d(t.elements.reference))if(null==(s=Ue)||!s.has(e))null==(a=Ue)||a.add(e),console.error(e)}const[u,f]=e.useState(null),p=(null==(n=t.elements)?void 0:n.reference)||u,m=function(t){void 0===t&&(t={});const{placement:n="bottom",strategy:r="absolute",middleware:o=[],platform:i,elements:{reference:c,floating:s}={},transform:a=!0,whileElementsMounted:u,open:f}=t,[d,p]=e.useState({x:0,y:0,strategy:r,placement:n,middlewareData:{},isPositioned:!1}),[m,v]=e.useState(o);Le(m,o)||v(o);const[g,h]=e.useState(null),[y,w]=e.useState(null),b=e.useCallback((e=>{e!==L.current&&(L.current=e,h(e))}),[]),x=e.useCallback((e=>{e!==P.current&&(P.current=e,w(e))}),[]),E=c||g,R=s||y,L=e.useRef(null),P=e.useRef(null),C=e.useRef(d),O=null!=u,k=Oe(u),T=Oe(i),S=e.useCallback((()=>{if(!L.current||!P.current)return;const e={placement:n,strategy:r,middleware:m};T.current&&(e.platform=T.current),Ee(L.current,P.current,e).then((e=>{const t={...e,isPositioned:!0};D.current&&!Le(C.current,t)&&(C.current=t,l.flushSync((()=>{p(t)})))}))}),[m,n,r,T]);Re((()=>{!1===f&&C.current.isPositioned&&(C.current.isPositioned=!1,p((e=>({...e,isPositioned:!1}))))}),[f]);const D=e.useRef(!1);Re((()=>(D.current=!0,()=>{D.current=!1})),[]),Re((()=>{if(E&&(L.current=E),R&&(P.current=R),E&&R){if(k.current)return k.current(E,R,S);S()}}),[E,R,S,k,O]);const M=e.useMemo((()=>({reference:L,floating:P,setReference:b,setFloating:x})),[b,x]),A=e.useMemo((()=>({reference:E,floating:R})),[E,R]),N=e.useMemo((()=>{const e={position:r,left:0,top:0};if(!A.floating)return e;const t=Ce(A.floating,d.x),n=Ce(A.floating,d.y);return a?{...e,transform:"translate("+t+"px, "+n+"px)",...Pe(A.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:t,top:n}}),[r,a,A.floating,d.x,d.y]);return e.useMemo((()=>({...d,update:S,refs:M,elements:A,floatingStyles:N})),[d,S,M,A,N])}(t),v=_e(),g=null!=Ie(),h=Te(((e,t,n)=>{e&&(w.current.openEvent=t),b.emit("openchange",{open:e,event:t,reason:n,nested:g}),null==o||o(e,t,n)})),y=e.useRef(null),w=e.useRef({}),b=e.useState((()=>function(){const e=new Map;return{emit(t,n){var r;null==(r=e.get(t))||r.forEach((e=>e(n)))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){var r;e.set(t,(null==(r=e.get(t))?void 0:r.filter((e=>e!==n)))||[])}}}()))[0],x=Fe(),E=e.useCallback((e=>{const t=d(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:e}:e;m.refs.setReference(t)}),[m.refs]),R=e.useCallback((e=>{(d(e)||null===e)&&(y.current=e,f(e)),(d(m.refs.reference.current)||null===m.refs.reference.current||null!==e&&!d(e))&&m.refs.setReference(e)}),[m.refs]),L=e.useMemo((()=>({...m.refs,setReference:R,setPositionReference:E,domReference:y})),[m.refs,R,E]),P=e.useMemo((()=>({...m.elements,domReference:p})),[m.elements,p]),C=e.useMemo((()=>({...m,refs:L,elements:P,dataRef:w,nodeId:i,floatingId:x,events:b,open:r,onOpenChange:h})),[m,i,x,b,r,h,L,P]);return Se((()=>{const e=null==v?void 0:v.nodesRef.current.find((e=>e.id===i));e&&(e.context=C)})),e.useMemo((()=>({...m,context:C,refs:L,elements:P})),[m,L,P,C])}"production"!==process.env.NODE_ENV&&(Ue=new Set);const Qe="active",Ge="selected";function Je(e,t,n){const r=new Map,o="item"===n;let i=e;if(o&&e){const{[Qe]:t,[Ge]:n,...r}=e;i=r}return{..."floating"===n&&{tabIndex:-1},...i,...t.map((t=>{const r=t?t[n]:null;return"function"==typeof r?e?r(e):null:r})).concat(e).reduce(((e,t)=>t?(Object.entries(t).forEach((t=>{let[n,i]=t;var l;o&&[Qe,Ge].includes(n)||(0===n.indexOf("on")?(r.has(n)||r.set(n,[]),"function"==typeof i&&(null==(l=r.get(n))||l.push(i),e[n]=function(){for(var e,t=arguments.length,o=new Array(t),i=0;i<t;i++)o[i]=arguments[i];return null==(e=r.get(n))?void 0:e.map((e=>e(...o))).find((e=>void 0!==e))})):e[n]=i)})),e):e),{})}}const et=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);var tt=function(n){var r=n.popperName,l=void 0===r?"":r,s=n.customRootClass,a=void 0===s?"":s;n.activationStrategy;var u=n.className,f=void 0===u?"":u,m=n.placement,v=void 0===m?"top":m,g=n.children,h=n.open,y=void 0!==h&&h;n.hoverDelay;var w=n.showArrow,E=void 0===w||w,L=n.pop,D=void 0===L?t.createElement(t.Fragment,null):L;!function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}}(n,["popperName","customRootClass","activationStrategy","className","placement","children","open","hoverDelay","showArrow","pop"]);var M,A=function(e,t){void 0===e&&(e=""),void 0===t&&(t="");var n=t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();return e||(t?"".concat("rad-ui","-").concat(n):"")}(a,l),N=o(null),F=i(y),H=F[0],W=F[1],B=Ze({placement:v,whileElementsMounted:he,open:H,middleware:[(M={element:N},{name:"arrow",options:M,fn(e){const{element:t,padding:n}="function"==typeof M?M(e):M;return t&&(r=t,{}.hasOwnProperty.call(r,"current"))?null!=t.current?xe({element:t.current,padding:n}).fn(e):{}:t?xe({element:t,padding:n}).fn(e):{};var r}}),te(9),we({mainAxis:!0,fallbackStrategy:"initialPlacement"}),ye({crossAxis:!1}),be({strategy:"referenceHidden"})],onOpenChange:W}),I=B.refs,_=B.floatingStyles,V=B.context,j=function(t,n){var r;void 0===n&&(n={});const{open:o,floatingId:i}=t,{enabled:l=!0,role:c="dialog"}=n,s=null!=(r=et.get(c))?r:c,a=Fe(),u=null!=Ie();return e.useMemo((()=>{if(!l)return{};const e={id:i,...s&&{role:s}};return"tooltip"===s||"label"===c?{reference:{["aria-"+("label"===c?"labelledby":"describedby")]:o?i:void 0},floating:e}:{reference:{"aria-expanded":o?"true":"false","aria-haspopup":"alertdialog"===s?"dialog":s,"aria-controls":o?i:void 0,..."listbox"===s&&{role:"combobox"},..."menu"===s&&{id:a},..."menu"===s&&u&&{role:"menuitem"},..."select"===c&&{"aria-autocomplete":"none"},..."combobox"===c&&{"aria-autocomplete":"list"}},floating:{...e,..."menu"===s&&{"aria-labelledby":a}},item(e){let{active:t,selected:n}=e;const r={role:"option",...t&&{id:i+"-option"}};switch(c){case"select":return{...r,"aria-selected":t&&n};case"combobox":return{...r,...t&&{"aria-selected":!0}}}return{}}}}),[l,c,s,o,i,a,u])}(V),K=function(t,n){void 0===n&&(n={});const{open:r,onOpenChange:o,nodeId:i,elements:{reference:l,domReference:c,floating:s},dataRef:a}=t,{enabled:u=!0,escapeKey:f=!0,outsidePress:m=!0,outsidePressEvent:v="pointerdown",referencePress:g=!1,referencePressEvent:h="pointerdown",ancestorScroll:y=!1,bubbles:w,capture:E}=n,L=_e(),O=Te("function"==typeof m?m:()=>!1),D="function"==typeof m?O:m,M=e.useRef(!1),A=e.useRef(!1),{escapeKey:N,outsidePress:F}=qe(w),{escapeKey:H,outsidePress:W}=qe(E),B=Te((e=>{if(!r||!u||!f||"Escape"!==e.key)return;const t=L?Xe(L.nodesRef.current,i):[];if(!N&&(e.stopPropagation(),t.length>0)){let e=!0;if(t.forEach((t=>{var n;null==(n=t.context)||!n.open||t.context.dataRef.current.__escapeKeyBubbles||(e=!1)})),!e)return}o(!1,function(e){return"nativeEvent"in e}(e)?e.nativeEvent:e,"escape-key")})),I=Te((e=>{var t;const n=()=>{var t;B(e),null==(t=S(e))||t.removeEventListener("keydown",n)};null==(t=S(e))||t.addEventListener("keydown",n)})),_=Te((e=>{const t=M.current;M.current=!1;const n=A.current;if(A.current=!1,"click"===v&&n)return;if(t)return;if("function"==typeof D&&!D(e))return;const r=S(e),l="["+Ve("inert")+"]",a=k(s).querySelectorAll(l);let u=d(r)?r:null;for(;u&&!b(u);){const e=R(u);if(b(e)||!d(e))break;u=e}if(a.length&&d(r)&&!r.matches("html,body")&&!C(r,s)&&Array.from(a).every((e=>!C(u,e))))return;if(p(r)&&s){const t=r.clientWidth>0&&r.scrollWidth>r.clientWidth,n=r.clientHeight>0&&r.scrollHeight>r.clientHeight;let o=n&&e.offsetX>r.clientWidth;if(n&&"rtl"===x(r).direction&&(o=e.offsetX<=r.offsetWidth-r.clientWidth),o||t&&e.offsetY>r.clientHeight)return}const f=L&&Xe(L.nodesRef.current,i).some((t=>{var n;return T(e,null==(n=t.context)?void 0:n.elements.floating)}));if(T(e,s)||T(e,c)||f)return;const m=L?Xe(L.nodesRef.current,i):[];if(m.length>0){let e=!0;if(m.forEach((t=>{var n;null==(n=t.context)||!n.open||t.context.dataRef.current.__outsidePressBubbles||(e=!1)})),!e)return}o(!1,e,"outside-press")})),V=Te((e=>{var t;const n=()=>{var t;_(e),null==(t=S(e))||t.removeEventListener(v,n)};null==(t=S(e))||t.addEventListener(v,n)}));return e.useEffect((()=>{if(!r||!u)return;function e(e){o(!1,e,"ancestor-scroll")}a.current.__escapeKeyBubbles=N,a.current.__outsidePressBubbles=F;const t=k(s);f&&t.addEventListener("keydown",H?I:B,H),D&&t.addEventListener(v,W?V:_,W);let n=[];return y&&(d(c)&&(n=P(c)),d(s)&&(n=n.concat(P(s))),!d(l)&&l&&l.contextElement&&(n=n.concat(P(l.contextElement)))),n=n.filter((e=>{var n;return e!==(null==(n=t.defaultView)?void 0:n.visualViewport)})),n.forEach((t=>{t.addEventListener("scroll",e,{passive:!0})})),()=>{f&&t.removeEventListener("keydown",H?I:B,H),D&&t.removeEventListener(v,W?V:_,W),n.forEach((t=>{t.removeEventListener("scroll",e)}))}}),[a,s,c,l,f,D,v,r,o,y,u,N,F,B,H,I,_,W,V]),e.useEffect((()=>{M.current=!1}),[D,v]),e.useMemo((()=>u?{reference:{onKeyDown:B,[$e[h]]:e=>{g&&o(!1,e.nativeEvent,"reference-press")}},floating:{onKeyDown:B,onMouseDown(){A.current=!0},onMouseUp(){A.current=!0},[Ye[v]]:()=>{M.current=!0}}}:{}),[u,g,v,h,o,B])}(V),z=function(t,n){void 0===n&&(n={});const{open:r,onOpenChange:o,dataRef:i,events:l,elements:{domReference:c,floating:s},refs:a}=t,{enabled:u=!0,delay:f=0,handleClose:p=null,mouseOnly:m=!1,restMs:v=0,move:g=!0}=n,h=_e(),y=Ie(),w=je(p),b=je(f),x=e.useRef(),E=e.useRef(),R=e.useRef(),L=e.useRef(),P=e.useRef(!0),T=e.useRef(!1),S=e.useRef((()=>{})),D=e.useCallback((()=>{var e;const t=null==(e=i.current.openEvent)?void 0:e.type;return(null==t?void 0:t.includes("mouse"))&&"mousedown"!==t}),[i]);e.useEffect((()=>{if(u)return l.on("openchange",e),()=>{l.off("openchange",e)};function e(e){let{open:t}=e;t||(clearTimeout(E.current),clearTimeout(L.current),P.current=!0)}}),[u,l]),e.useEffect((()=>{if(!u||!w.current||!r)return;function e(e){D()&&o(!1,e,"hover")}const t=k(s).documentElement;return t.addEventListener("mouseleave",e),()=>{t.removeEventListener("mouseleave",e)}}),[s,r,o,u,w,D]);const M=e.useCallback((function(e,t,n){void 0===t&&(t=!0),void 0===n&&(n="hover");const r=ze(b.current,"close",x.current);r&&!R.current?(clearTimeout(E.current),E.current=setTimeout((()=>o(!1,e,n)),r)):t&&(clearTimeout(E.current),o(!1,e,n))}),[b,o]),A=e.useCallback((()=>{S.current(),R.current=void 0}),[]),N=e.useCallback((()=>{if(T.current){const e=k(a.floating.current).body;e.style.pointerEvents="",e.removeAttribute(Ke),T.current=!1}}),[a]);return e.useEffect((()=>{if(u&&d(c)){const e=c;return r&&e.addEventListener("mouseleave",a),null==s||s.addEventListener("mouseleave",a),g&&e.addEventListener("mousemove",n,{once:!0}),e.addEventListener("mouseenter",n),e.addEventListener("mouseleave",l),()=>{r&&e.removeEventListener("mouseleave",a),null==s||s.removeEventListener("mouseleave",a),g&&e.removeEventListener("mousemove",n),e.removeEventListener("mouseenter",n),e.removeEventListener("mouseleave",l)}}function e(){return!!i.current.openEvent&&["click","mousedown"].includes(i.current.openEvent.type)}function n(e){if(clearTimeout(E.current),P.current=!1,m&&!O(x.current)||v>0&&0===ze(b.current,"open"))return;const t=ze(b.current,"open",x.current);t?E.current=setTimeout((()=>{o(!0,e,"hover")}),t):o(!0,e,"hover")}function l(n){if(e())return;S.current();const o=k(s);if(clearTimeout(L.current),w.current){r||clearTimeout(E.current),R.current=w.current({...t,tree:h,x:n.clientX,y:n.clientY,onClose(){N(),A(),M(n,!0,"safe-polygon")}});const e=R.current;return o.addEventListener("mousemove",e),void(S.current=()=>{o.removeEventListener("mousemove",e)})}("touch"!==x.current||!C(s,n.relatedTarget))&&M(n)}function a(n){e()||null==w.current||w.current({...t,tree:h,x:n.clientX,y:n.clientY,onClose(){N(),A(),M(n)}})(n)}}),[c,s,u,t,m,v,g,M,A,N,o,r,h,b,w,i]),Se((()=>{var e;if(u&&r&&null!=(e=w.current)&&e.__options.blockPointerEvents&&D()){const e=k(s).body;if(e.setAttribute(Ke,""),e.style.pointerEvents="none",T.current=!0,d(c)&&s){var t;const e=c,n=null==h||null==(t=h.nodesRef.current.find((e=>e.id===y)))||null==(t=t.context)?void 0:t.elements.floating;return n&&(n.style.pointerEvents=""),e.style.pointerEvents="auto",s.style.pointerEvents="auto",()=>{e.style.pointerEvents="",s.style.pointerEvents=""}}}}),[u,r,y,s,c,h,w,D]),Se((()=>{r||(x.current=void 0,A(),N())}),[r,A,N]),e.useEffect((()=>()=>{A(),clearTimeout(E.current),clearTimeout(L.current),N()}),[u,c,A,N]),e.useMemo((()=>{if(!u)return{};function e(e){x.current=e.pointerType}return{reference:{onPointerDown:e,onPointerEnter:e,onMouseMove(e){r||0===v||(clearTimeout(L.current),L.current=setTimeout((()=>{P.current||o(!0,e.nativeEvent,"hover")}),v))}},floating:{onMouseEnter(){clearTimeout(E.current)},onMouseLeave(e){M(e.nativeEvent,!1)}}}}),[u,v,r,o,M])}(V,{}),X=function(t){void 0===t&&(t=[]);const n=t,r=e.useCallback((e=>Je(e,t,"reference")),n),o=e.useCallback((e=>Je(e,t,"floating")),n),i=e.useCallback((e=>Je(e,t,"item")),t.map((e=>null==e?void 0:e.item)));return e.useMemo((()=>({getReferenceProps:r,getFloatingProps:o,getItemProps:i})),[r,o,i])}([z,j,K]),$=X.getReferenceProps,Y=X.getFloatingProps;return t.createElement("span",null,t.createElement("span",c({className:"rad-ui-popper ".concat(A,"-reference-element ").concat(f),ref:I.setReference},$({onClick:function(){console.log("click")}})),g),H&&t.createElement("div",c({className:"".concat(A,"-floating-element"),ref:I.setFloating,style:_},Y()),E&&t.createElement(He,{className:"rad-ui-arrow ".concat(A,"-arrow"),ref:N,context:V}),D))},nt=function(e){var n=e.list,r=void 0===n?[]:n;e.selected;return t.createElement("div",{className:"relative"},t.createElement(tt,{open:!1,placement:"bottom-start",popperName:"dropdown",pop:t.createElement((function(){return t.createElement("ul",{className:"bg-white px-2 py-2 shadow-lg rounded-md"},r.map((function(e,n){return t.createElement("li",{key:n},e.value)})))}),null)},t.createElement("span",null,"Dropdown")))};export{nt as default};
1
+ 'use client';import*as e from"react";import t,{useLayoutEffect as n,useEffect as r,useRef as o,useState as i}from"react";import*as l from"react-dom";var c=function(){return c=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},c.apply(this,arguments)};"function"==typeof SuppressedError&&SuppressedError;function s(e){return f(e)?(e.nodeName||"").toLowerCase():"#document"}function a(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function u(e){var t;return null==(t=(f(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function f(e){return e instanceof Node||e instanceof a(e).Node}function d(e){return e instanceof Element||e instanceof a(e).Element}function p(e){return e instanceof HTMLElement||e instanceof a(e).HTMLElement}function m(e){return"undefined"!=typeof ShadowRoot&&(e instanceof ShadowRoot||e instanceof a(e).ShadowRoot)}function v(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=b(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function g(e){return["table","td","th"].includes(s(e))}function h(e){const t=y(),n=b(e);return"none"!==n.transform||"none"!==n.perspective||!!n.containerType&&"normal"!==n.containerType||!t&&!!n.backdropFilter&&"none"!==n.backdropFilter||!t&&!!n.filter&&"none"!==n.filter||["transform","perspective","filter"].some((e=>(n.willChange||"").includes(e)))||["paint","layout","strict","content"].some((e=>(n.contain||"").includes(e)))}function y(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function w(e){return["html","body","#document"].includes(s(e))}function b(e){return a(e).getComputedStyle(e)}function x(e){return d(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function E(e){if("html"===s(e))return e;const t=e.assignedSlot||e.parentNode||m(e)&&e.host||u(e);return m(t)?t.host:t}function R(e){const t=E(e);return w(t)?e.ownerDocument?e.ownerDocument.body:e.body:p(t)&&v(t)?t:R(t)}function P(e,t,n){var r;void 0===t&&(t=[]),void 0===n&&(n=!0);const o=R(e),i=o===(null==(r=e.ownerDocument)?void 0:r.body),l=a(o);return i?t.concat(l,l.visualViewport||[],v(o)?o:[],l.frameElement&&n?P(l.frameElement):[]):t.concat(o,P(o,[],n))}function L(e,t){if(!e||!t)return!1;const n=null==t.getRootNode?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&m(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function O(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}function C(e){return(null==e?void 0:e.ownerDocument)||document}function k(e,t){if(null==t)return!1;if("composedPath"in e)return e.composedPath().includes(t);const n=e;return null!=n.target&&t.contains(n.target)}function T(e){return"composedPath"in e?e.composedPath()[0]:e.target}const S=["top","right","bottom","left"],D=Math.min,M=Math.max,A=Math.round,N=Math.floor,F=e=>({x:e,y:e}),H={left:"right",right:"left",bottom:"top",top:"bottom"},W={start:"end",end:"start"};function B(e,t,n){return M(e,D(t,n))}function I(e,t){return"function"==typeof e?e(t):e}function _(e){return e.split("-")[0]}function V(e){return e.split("-")[1]}function j(e){return"x"===e?"y":"x"}function K(e){return"y"===e?"height":"width"}function z(e){return["top","bottom"].includes(_(e))?"y":"x"}function X(e){return j(z(e))}function $(e){return e.replace(/start|end/g,(e=>W[e]))}function Y(e){return e.replace(/left|right|bottom|top/g,(e=>H[e]))}function q(e){return"number"!=typeof e?function(e){return{top:0,right:0,bottom:0,left:0,...e}}(e):{top:e,right:e,bottom:e,left:e}}function U(e){return{...e,top:e.y,left:e.x,right:e.x+e.width,bottom:e.y+e.height}}function Z(e,t,n){let{reference:r,floating:o}=e;const i=z(t),l=X(t),c=K(l),s=_(t),a="y"===i,u=r.x+r.width/2-o.width/2,f=r.y+r.height/2-o.height/2,d=r[c]/2-o[c]/2;let p;switch(s){case"top":p={x:u,y:r.y-o.height};break;case"bottom":p={x:u,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:f};break;case"left":p={x:r.x-o.width,y:f};break;default:p={x:r.x,y:r.y}}switch(V(t)){case"start":p[l]-=d*(n&&a?-1:1);break;case"end":p[l]+=d*(n&&a?-1:1)}return p}async function Q(e,t){var n;void 0===t&&(t={});const{x:r,y:o,platform:i,rects:l,elements:c,strategy:s}=e,{boundary:a="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:d=!1,padding:p=0}=I(t,e),m=q(p),v=c[d?"floating"===f?"reference":"floating":f],g=U(await i.getClippingRect({element:null==(n=await(null==i.isElement?void 0:i.isElement(v)))||n?v:v.contextElement||await(null==i.getDocumentElement?void 0:i.getDocumentElement(c.floating)),boundary:a,rootBoundary:u,strategy:s})),h="floating"===f?{...l.floating,x:r,y:o}:l.reference,y=await(null==i.getOffsetParent?void 0:i.getOffsetParent(c.floating)),w=await(null==i.isElement?void 0:i.isElement(y))&&await(null==i.getScale?void 0:i.getScale(y))||{x:1,y:1},b=U(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:h,offsetParent:y,strategy:s}):h);return{top:(g.top-b.top+m.top)/w.y,bottom:(b.bottom-g.bottom+m.bottom)/w.y,left:(g.left-b.left+m.left)/w.x,right:(b.right-g.right+m.right)/w.x}}function G(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function J(e){return S.some((t=>e[t]>=0))}const ee=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:l,middlewareData:c}=t,s=await async function(e,t){const{placement:n,platform:r,elements:o}=e,i=await(null==r.isRTL?void 0:r.isRTL(o.floating)),l=_(n),c=V(n),s="y"===z(n),a=["left","top"].includes(l)?-1:1,u=i&&s?-1:1,f=I(t,e);let{mainAxis:d,crossAxis:p,alignmentAxis:m}="number"==typeof f?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...f};return c&&"number"==typeof m&&(p="end"===c?-1*m:m),s?{x:p*u,y:d*a}:{x:d*a,y:p*u}}(t,e);return l===(null==(n=c.offset)?void 0:n.placement)&&null!=(r=c.arrow)&&r.alignmentOffset?{}:{x:o+s.x,y:i+s.y,data:{...s,placement:l}}}}};function te(e){const t=b(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=p(e),i=o?e.offsetWidth:n,l=o?e.offsetHeight:r,c=A(n)!==i||A(r)!==l;return c&&(n=i,r=l),{width:n,height:r,$:c}}function ne(e){return d(e)?e:e.contextElement}function re(e){const t=ne(e);if(!p(t))return F(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=te(t);let l=(i?A(n.width):n.width)/r,c=(i?A(n.height):n.height)/o;return l&&Number.isFinite(l)||(l=1),c&&Number.isFinite(c)||(c=1),{x:l,y:c}}const oe=F(0);function ie(e){const t=a(e);return y()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:oe}function le(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);const o=e.getBoundingClientRect(),i=ne(e);let l=F(1);t&&(r?d(r)&&(l=re(r)):l=re(e));const c=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==a(e))&&t}(i,n,r)?ie(i):F(0);let s=(o.left+c.x)/l.x,u=(o.top+c.y)/l.y,f=o.width/l.x,p=o.height/l.y;if(i){const e=a(i),t=r&&d(r)?a(r):r;let n=e.frameElement;for(;n&&r&&t!==e;){const e=re(n),t=n.getBoundingClientRect(),r=b(n),o=t.left+(n.clientLeft+parseFloat(r.paddingLeft))*e.x,i=t.top+(n.clientTop+parseFloat(r.paddingTop))*e.y;s*=e.x,u*=e.y,f*=e.x,p*=e.y,s+=o,u+=i,n=a(n).frameElement}}return U({width:f,height:p,x:s,y:u})}const ce=[":popover-open",":modal"];function se(e){return ce.some((t=>{try{return e.matches(t)}catch(e){return!1}}))}function ae(e){return le(u(e)).left+x(e).scrollLeft}function ue(e,t,n){let r;if("viewport"===t)r=function(e,t){const n=a(e),r=u(e),o=n.visualViewport;let i=r.clientWidth,l=r.clientHeight,c=0,s=0;if(o){i=o.width,l=o.height;const e=y();(!e||e&&"fixed"===t)&&(c=o.offsetLeft,s=o.offsetTop)}return{width:i,height:l,x:c,y:s}}(e,n);else if("document"===t)r=function(e){const t=u(e),n=x(e),r=e.ownerDocument.body,o=M(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=M(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let l=-n.scrollLeft+ae(e);const c=-n.scrollTop;return"rtl"===b(r).direction&&(l+=M(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:l,y:c}}(u(e));else if(d(t))r=function(e,t){const n=le(e,!0,"fixed"===t),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=p(e)?re(e):F(1);return{width:e.clientWidth*i.x,height:e.clientHeight*i.y,x:o*i.x,y:r*i.y}}(t,n);else{const n=ie(e);r={...t,x:t.x-n.x,y:t.y-n.y}}return U(r)}function fe(e,t){const n=E(e);return!(n===t||!d(n)||w(n))&&("fixed"===b(n).position||fe(n,t))}function de(e,t,n){const r=p(t),o=u(t),i="fixed"===n,l=le(e,!0,i,t);let c={scrollLeft:0,scrollTop:0};const a=F(0);if(r||!r&&!i)if(("body"!==s(t)||v(o))&&(c=x(t)),r){const e=le(t,!0,i,t);a.x=e.x+t.clientLeft,a.y=e.y+t.clientTop}else o&&(a.x=ae(o));return{x:l.left+c.scrollLeft-a.x,y:l.top+c.scrollTop-a.y,width:l.width,height:l.height}}function pe(e,t){return p(e)&&"fixed"!==b(e).position?t?t(e):e.offsetParent:null}function me(e,t){const n=a(e);if(!p(e)||se(e))return n;let r=pe(e,t);for(;r&&g(r)&&"static"===b(r).position;)r=pe(r,t);return r&&("html"===s(r)||"body"===s(r)&&"static"===b(r).position&&!h(r))?n:r||function(e){let t=E(e);for(;p(t)&&!w(t);){if(h(t))return t;t=E(t)}return null}(e)||n}const ve={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i="fixed"===o,l=u(r),c=!!t&&se(t.floating);if(r===l||c&&i)return n;let a={scrollLeft:0,scrollTop:0},f=F(1);const d=F(0),m=p(r);if((m||!m&&!i)&&(("body"!==s(r)||v(l))&&(a=x(r)),p(r))){const e=le(r);f=re(r),d.x=e.x+r.clientLeft,d.y=e.y+r.clientTop}return{width:n.width*f.x,height:n.height*f.y,x:n.x*f.x-a.scrollLeft*f.x+d.x,y:n.y*f.y-a.scrollTop*f.y+d.y}},getDocumentElement:u,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[..."clippingAncestors"===n?function(e,t){const n=t.get(e);if(n)return n;let r=P(e,[],!1).filter((e=>d(e)&&"body"!==s(e))),o=null;const i="fixed"===b(e).position;let l=i?E(e):e;for(;d(l)&&!w(l);){const t=b(l),n=h(l);n||"fixed"!==t.position||(o=null),(i?!n&&!o:!n&&"static"===t.position&&o&&["absolute","fixed"].includes(o.position)||v(l)&&!n&&fe(e,l))?r=r.filter((e=>e!==l)):o=t,l=E(l)}return t.set(e,r),r}(t,this._c):[].concat(n),r],l=i[0],c=i.reduce(((e,n)=>{const r=ue(t,n,o);return e.top=M(r.top,e.top),e.right=D(r.right,e.right),e.bottom=D(r.bottom,e.bottom),e.left=M(r.left,e.left),e}),ue(t,l,o));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}},getOffsetParent:me,getElementRects:async function(e){const t=this.getOffsetParent||me,n=this.getDimensions;return{reference:de(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,...await n(e.floating)}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){const{width:t,height:n}=te(e);return{width:t,height:n}},getScale:re,isElement:d,isRTL:function(e){return"rtl"===b(e).direction}};function ge(e,t,n,r){void 0===r&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:l="function"==typeof ResizeObserver,layoutShift:c="function"==typeof IntersectionObserver,animationFrame:s=!1}=r,a=ne(e),f=o||i?[...a?P(a):[],...P(t)]:[];f.forEach((e=>{o&&e.addEventListener("scroll",n,{passive:!0}),i&&e.addEventListener("resize",n)}));const d=a&&c?function(e,t){let n,r=null;const o=u(e);function i(){var e;clearTimeout(n),null==(e=r)||e.disconnect(),r=null}return function l(c,s){void 0===c&&(c=!1),void 0===s&&(s=1),i();const{left:a,top:u,width:f,height:d}=e.getBoundingClientRect();if(c||t(),!f||!d)return;const p={rootMargin:-N(u)+"px "+-N(o.clientWidth-(a+f))+"px "+-N(o.clientHeight-(u+d))+"px "+-N(a)+"px",threshold:M(0,D(1,s))||1};let m=!0;function v(e){const t=e[0].intersectionRatio;if(t!==s){if(!m)return l();t?l(!1,t):n=setTimeout((()=>{l(!1,1e-7)}),100)}m=!1}try{r=new IntersectionObserver(v,{...p,root:o.ownerDocument})}catch(e){r=new IntersectionObserver(v,p)}r.observe(e)}(!0),i}(a,n):null;let p,m=-1,v=null;l&&(v=new ResizeObserver((e=>{let[r]=e;r&&r.target===a&&v&&(v.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame((()=>{var e;null==(e=v)||e.observe(t)}))),n()})),a&&!s&&v.observe(a),v.observe(t));let g=s?le(e):null;return s&&function t(){const r=le(e);!g||r.x===g.x&&r.y===g.y&&r.width===g.width&&r.height===g.height||n();g=r,p=requestAnimationFrame(t)}(),n(),()=>{var e;f.forEach((e=>{o&&e.removeEventListener("scroll",n),i&&e.removeEventListener("resize",n)})),null==d||d(),null==(e=v)||e.disconnect(),v=null,s&&cancelAnimationFrame(p)}}const he=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:i=!0,crossAxis:l=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...s}=I(e,t),a={x:n,y:r},u=await Q(t,s),f=z(_(o)),d=j(f);let p=a[d],m=a[f];if(i){const e="y"===d?"bottom":"right";p=B(p+u["y"===d?"top":"left"],p,p-u[e])}if(l){const e="y"===f?"bottom":"right";m=B(m+u["y"===f?"top":"left"],m,m-u[e])}const v=c.fn({...t,[d]:p,[f]:m});return{...v,data:{x:v.x-n,y:v.y-r}}}}},ye=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:l,initialPlacement:c,platform:s,elements:a}=t,{mainAxis:u=!0,crossAxis:f=!0,fallbackPlacements:d,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:v=!0,...g}=I(e,t);if(null!=(n=i.arrow)&&n.alignmentOffset)return{};const h=_(o),y=_(c)===c,w=await(null==s.isRTL?void 0:s.isRTL(a.floating)),b=d||(y||!v?[Y(c)]:function(e){const t=Y(e);return[$(e),t,$(t)]}(c));d||"none"===m||b.push(...function(e,t,n,r){const o=V(e);let i=function(e,t,n){const r=["left","right"],o=["right","left"],i=["top","bottom"],l=["bottom","top"];switch(e){case"top":case"bottom":return n?t?o:r:t?r:o;case"left":case"right":return t?i:l;default:return[]}}(_(e),"start"===n,r);return o&&(i=i.map((e=>e+"-"+o)),t&&(i=i.concat(i.map($)))),i}(c,v,m,w));const x=[c,...b],E=await Q(t,g),R=[];let P=(null==(r=i.flip)?void 0:r.overflows)||[];if(u&&R.push(E[h]),f){const e=function(e,t,n){void 0===n&&(n=!1);const r=V(e),o=X(e),i=K(o);let l="x"===o?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[i]>t.floating[i]&&(l=Y(l)),[l,Y(l)]}(o,l,w);R.push(E[e[0]],E[e[1]])}if(P=[...P,{placement:o,overflows:R}],!R.every((e=>e<=0))){var L,O;const e=((null==(L=i.flip)?void 0:L.index)||0)+1,t=x[e];if(t)return{data:{index:e,overflows:P},reset:{placement:t}};let n=null==(O=P.filter((e=>e.overflows[0]<=0)).sort(((e,t)=>e.overflows[1]-t.overflows[1]))[0])?void 0:O.placement;if(!n)switch(p){case"bestFit":{var C;const e=null==(C=P.map((e=>[e.placement,e.overflows.filter((e=>e>0)).reduce(((e,t)=>e+t),0)])).sort(((e,t)=>e[1]-t[1]))[0])?void 0:C[0];e&&(n=e);break}case"initialPlacement":n=c}if(o!==n)return{reset:{placement:n}}}return{}}}},we=function(e){return void 0===e&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...o}=I(e,t);switch(r){case"referenceHidden":{const e=G(await Q(t,{...o,elementContext:"reference"}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:J(e)}}}case"escaped":{const e=G(await Q(t,{...o,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:J(e)}}}default:return{}}}}},be=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:i,platform:l,elements:c,middlewareData:s}=t,{element:a,padding:u=0}=I(e,t)||{};if(null==a)return{};const f=q(u),d={x:n,y:r},p=X(o),m=K(p),v=await l.getDimensions(a),g="y"===p,h=g?"top":"left",y=g?"bottom":"right",w=g?"clientHeight":"clientWidth",b=i.reference[m]+i.reference[p]-d[p]-i.floating[m],x=d[p]-i.reference[p],E=await(null==l.getOffsetParent?void 0:l.getOffsetParent(a));let R=E?E[w]:0;R&&await(null==l.isElement?void 0:l.isElement(E))||(R=c.floating[w]||i.floating[m]);const P=b/2-x/2,L=R/2-v[m]/2-1,O=D(f[h],L),C=D(f[y],L),k=O,T=R-v[m]-C,S=R/2-v[m]/2+P,M=B(k,S,T),A=!s.arrow&&null!=V(o)&&S!==M&&i.reference[m]/2-(S<k?O:C)-v[m]/2<0,N=A?S<k?S-k:S-T:0;return{[p]:d[p]+N,data:{[p]:M,centerOffset:S-M-N,...A&&{alignmentOffset:N}},reset:A}}}),xe=(e,t,n)=>{const r=new Map,o={platform:ve,...n},i={...o.platform,_c:r};return(async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:l}=n,c=i.filter(Boolean),s=await(null==l.isRTL?void 0:l.isRTL(t));let a=await l.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:f}=Z(a,r,s),d=r,p={},m=0;for(let n=0;n<c.length;n++){const{name:i,fn:v}=c[n],{x:g,y:h,data:y,reset:w}=await v({x:u,y:f,initialPlacement:r,placement:d,strategy:o,middlewareData:p,rects:a,platform:l,elements:{reference:e,floating:t}});u=null!=g?g:u,f=null!=h?h:f,p={...p,[i]:{...p[i],...y}},w&&m<=50&&(m++,"object"==typeof w&&(w.placement&&(d=w.placement),w.rects&&(a=!0===w.rects?await l.getElementRects({reference:e,floating:t,strategy:o}):w.rects),({x:u,y:f}=Z(a,d,s))),n=-1)}return{x:u,y:f,placement:d,strategy:o,middlewareData:p}})(e,t,{...o,platform:i})};var Ee="undefined"!=typeof document?n:r;function Re(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;0!=r--;)if(!Re(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;0!=r--;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;0!=r--;){const n=o[r];if(("_owner"!==n||!e.$$typeof)&&!Re(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function Pe(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Le(e,t){const n=Pe(e);return Math.round(t*n)/n}function Oe(t){const n=e.useRef(t);return Ee((()=>{n.current=t})),n}const Ce=e["useInsertionEffect".toString()]||(e=>e());function ke(t){const n=e.useRef((()=>{if("production"!==process.env.NODE_ENV)throw new Error("Cannot call an event handler while rendering.")}));return Ce((()=>{n.current=t})),e.useCallback((function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return null==n.current?void 0:n.current(...t)}),[])}var Te="undefined"!=typeof document?n:r;function Se(){return Se=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Se.apply(this,arguments)}let De=!1,Me=0;const Ae=()=>"floating-ui-"+Me++;const Ne=e["useId".toString()]||function(){const[t,n]=e.useState((()=>De?Ae():void 0));return Te((()=>{null==t&&n(Ae())}),[]),e.useEffect((()=>{De||(De=!0)}),[]),t},Fe=e.forwardRef((function(t,n){let{context:{placement:r,elements:{floating:o},middlewareData:{arrow:i}},width:l=14,height:c=7,tipRadius:s=0,strokeWidth:a=0,staticOffset:u,stroke:f,d:d,style:{transform:p,...m}={},...v}=t;"production"!==process.env.NODE_ENV&&(n||console.warn("Floating UI: The `ref` prop is required for the `FloatingArrow`","component."));const g=Ne();if(!o)return null;a*=2;const h=a/2,y=l/2*(s/-8+1),w=c/2*s/4,[b,x]=r.split("-"),E=ve.isRTL(o),R=!!d,P="top"===b||"bottom"===b,L=u&&"end"===x?"bottom":"top";let O=u&&"end"===x?"right":"left";u&&E&&(O="end"===x?"left":"right");const C=null!=(null==i?void 0:i.x)?u||i.x:"",k=null!=(null==i?void 0:i.y)?u||i.y:"",T=d||"M0,0 H"+l+" L"+(l-y)+","+(c-w)+" Q"+l/2+","+c+" "+y+","+(c-w)+" Z",S={top:R?"rotate(180deg)":"",left:R?"rotate(90deg)":"rotate(-90deg)",bottom:R?"":"rotate(180deg)",right:R?"rotate(-90deg)":"rotate(90deg)"}[b];return e.createElement("svg",Se({},v,{"aria-hidden":!0,ref:n,width:R?l:l+a,height:l,viewBox:"0 0 "+l+" "+(c>l?c:l),style:{position:"absolute",pointerEvents:"none",[O]:C,[L]:k,[b]:P||R?"100%":"calc(100% - "+a/2+"px)",transform:""+S+(null!=p?p:""),...m}}),a>0&&e.createElement("path",{clipPath:"url(#"+g+")",fill:"none",stroke:f,strokeWidth:a+(d?0:1),d:T}),e.createElement("path",{stroke:a&&!d?v.fill:"none",d:T}),e.createElement("clipPath",{id:g},e.createElement("rect",{x:-h,y:h*(R?-1:1),width:l+a,height:l})))}));const He=e.createContext(null),We=e.createContext(null),Be=()=>{var t;return(null==(t=e.useContext(He))?void 0:t.id)||null},Ie=()=>e.useContext(We);function _e(e){return"data-floating-ui-"+e}function Ve(e){const t=o(e);return Te((()=>{t.current=e})),t}const je=_e("safe-polygon");function Ke(e,t,n){return n&&!O(n)?0:"number"==typeof e?e:null==e?void 0:e[t]}function ze(e,t){let n=e.filter((e=>{var n;return e.parentId===t&&(null==(n=e.context)?void 0:n.open)})),r=n;for(;r.length;)r=e.filter((e=>{var t;return null==(t=r)?void 0:t.some((t=>{var n;return e.parentId===t.id&&(null==(n=e.context)?void 0:n.open)}))})),n=n.concat(r);return n}const Xe={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},$e={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},Ye=e=>{var t,n;return{escapeKey:"boolean"==typeof e?e:null!=(t=null==e?void 0:e.escapeKey)&&t,outsidePress:"boolean"==typeof e?e:null==(n=null==e?void 0:e.outsidePress)||n}};let qe;function Ue(t){var n;void 0===t&&(t={});const{open:r=!1,onOpenChange:o,nodeId:i}=t;if("production"!==process.env.NODE_ENV){var c;const e="Floating UI: Cannot pass a virtual element to the `elements.reference` option, as it must be a real DOM element. Use `refs.setPositionReference` instead.";var s,a;if(null!=(c=t.elements)&&c.reference&&!d(t.elements.reference))if(null==(s=qe)||!s.has(e))null==(a=qe)||a.add(e),console.error(e)}const[u,f]=e.useState(null),p=(null==(n=t.elements)?void 0:n.reference)||u,m=function(t){void 0===t&&(t={});const{placement:n="bottom",strategy:r="absolute",middleware:o=[],platform:i,elements:{reference:c,floating:s}={},transform:a=!0,whileElementsMounted:u,open:f}=t,[d,p]=e.useState({x:0,y:0,strategy:r,placement:n,middlewareData:{},isPositioned:!1}),[m,v]=e.useState(o);Re(m,o)||v(o);const[g,h]=e.useState(null),[y,w]=e.useState(null),b=e.useCallback((e=>{e!==P.current&&(P.current=e,h(e))}),[]),x=e.useCallback((e=>{e!==L.current&&(L.current=e,w(e))}),[]),E=c||g,R=s||y,P=e.useRef(null),L=e.useRef(null),O=e.useRef(d),C=null!=u,k=Oe(u),T=Oe(i),S=e.useCallback((()=>{if(!P.current||!L.current)return;const e={placement:n,strategy:r,middleware:m};T.current&&(e.platform=T.current),xe(P.current,L.current,e).then((e=>{const t={...e,isPositioned:!0};D.current&&!Re(O.current,t)&&(O.current=t,l.flushSync((()=>{p(t)})))}))}),[m,n,r,T]);Ee((()=>{!1===f&&O.current.isPositioned&&(O.current.isPositioned=!1,p((e=>({...e,isPositioned:!1}))))}),[f]);const D=e.useRef(!1);Ee((()=>(D.current=!0,()=>{D.current=!1})),[]),Ee((()=>{if(E&&(P.current=E),R&&(L.current=R),E&&R){if(k.current)return k.current(E,R,S);S()}}),[E,R,S,k,C]);const M=e.useMemo((()=>({reference:P,floating:L,setReference:b,setFloating:x})),[b,x]),A=e.useMemo((()=>({reference:E,floating:R})),[E,R]),N=e.useMemo((()=>{const e={position:r,left:0,top:0};if(!A.floating)return e;const t=Le(A.floating,d.x),n=Le(A.floating,d.y);return a?{...e,transform:"translate("+t+"px, "+n+"px)",...Pe(A.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:t,top:n}}),[r,a,A.floating,d.x,d.y]);return e.useMemo((()=>({...d,update:S,refs:M,elements:A,floatingStyles:N})),[d,S,M,A,N])}(t),v=Ie(),g=null!=Be(),h=ke(((e,t,n)=>{e&&(w.current.openEvent=t),b.emit("openchange",{open:e,event:t,reason:n,nested:g}),null==o||o(e,t,n)})),y=e.useRef(null),w=e.useRef({}),b=e.useState((()=>function(){const e=new Map;return{emit(t,n){var r;null==(r=e.get(t))||r.forEach((e=>e(n)))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){var r;e.set(t,(null==(r=e.get(t))?void 0:r.filter((e=>e!==n)))||[])}}}()))[0],x=Ne(),E=e.useCallback((e=>{const t=d(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:e}:e;m.refs.setReference(t)}),[m.refs]),R=e.useCallback((e=>{(d(e)||null===e)&&(y.current=e,f(e)),(d(m.refs.reference.current)||null===m.refs.reference.current||null!==e&&!d(e))&&m.refs.setReference(e)}),[m.refs]),P=e.useMemo((()=>({...m.refs,setReference:R,setPositionReference:E,domReference:y})),[m.refs,R,E]),L=e.useMemo((()=>({...m.elements,domReference:p})),[m.elements,p]),O=e.useMemo((()=>({...m,refs:P,elements:L,dataRef:w,nodeId:i,floatingId:x,events:b,open:r,onOpenChange:h})),[m,i,x,b,r,h,P,L]);return Te((()=>{const e=null==v?void 0:v.nodesRef.current.find((e=>e.id===i));e&&(e.context=O)})),e.useMemo((()=>({...m,context:O,refs:P,elements:L})),[m,P,L,O])}"production"!==process.env.NODE_ENV&&(qe=new Set);const Ze="active",Qe="selected";function Ge(e,t,n){const r=new Map,o="item"===n;let i=e;if(o&&e){const{[Ze]:t,[Qe]:n,...r}=e;i=r}return{..."floating"===n&&{tabIndex:-1},...i,...t.map((t=>{const r=t?t[n]:null;return"function"==typeof r?e?r(e):null:r})).concat(e).reduce(((e,t)=>t?(Object.entries(t).forEach((t=>{let[n,i]=t;var l;o&&[Ze,Qe].includes(n)||(0===n.indexOf("on")?(r.has(n)||r.set(n,[]),"function"==typeof i&&(null==(l=r.get(n))||l.push(i),e[n]=function(){for(var e,t=arguments.length,o=new Array(t),i=0;i<t;i++)o[i]=arguments[i];return null==(e=r.get(n))?void 0:e.map((e=>e(...o))).find((e=>void 0!==e))})):e[n]=i)})),e):e),{})}}const Je=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);var et=function(n){var r=n.popperName,l=void 0===r?"":r,s=n.customRootClass,a=void 0===s?"":s;n.activationStrategy;var u=n.className,f=void 0===u?"":u,m=n.placement,v=void 0===m?"top":m,g=n.children,h=n.open,y=void 0!==h&&h;n.hoverDelay;var x=n.showArrow,R=void 0===x||x,S=n.pop,D=void 0===S?t.createElement(t.Fragment,null):S;!function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}}(n,["popperName","customRootClass","activationStrategy","className","placement","children","open","hoverDelay","showArrow","pop"]);var M,A=function(e,t){void 0===e&&(e=""),void 0===t&&(t="");var n=t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();return e||(t?"".concat("rad-ui","-").concat(n):"")}(a,l),N=o(null),F=i(y),H=F[0],W=F[1],B=Ue({placement:v,whileElementsMounted:ge,open:H,middleware:[(M={element:N},{name:"arrow",options:M,fn(e){const{element:t,padding:n}="function"==typeof M?M(e):M;return t&&(r=t,{}.hasOwnProperty.call(r,"current"))?null!=t.current?be({element:t.current,padding:n}).fn(e):{}:t?be({element:t,padding:n}).fn(e):{};var r}}),ee(9),ye({mainAxis:!0,fallbackStrategy:"initialPlacement"}),he({crossAxis:!1}),we({strategy:"referenceHidden"})],onOpenChange:W}),I=B.refs,_=B.floatingStyles,V=B.context,j=function(t,n){var r;void 0===n&&(n={});const{open:o,floatingId:i}=t,{enabled:l=!0,role:c="dialog"}=n,s=null!=(r=Je.get(c))?r:c,a=Ne(),u=null!=Be();return e.useMemo((()=>{if(!l)return{};const e={id:i,...s&&{role:s}};return"tooltip"===s||"label"===c?{reference:{["aria-"+("label"===c?"labelledby":"describedby")]:o?i:void 0},floating:e}:{reference:{"aria-expanded":o?"true":"false","aria-haspopup":"alertdialog"===s?"dialog":s,"aria-controls":o?i:void 0,..."listbox"===s&&{role:"combobox"},..."menu"===s&&{id:a},..."menu"===s&&u&&{role:"menuitem"},..."select"===c&&{"aria-autocomplete":"none"},..."combobox"===c&&{"aria-autocomplete":"list"}},floating:{...e,..."menu"===s&&{"aria-labelledby":a}},item(e){let{active:t,selected:n}=e;const r={role:"option",...t&&{id:i+"-option"}};switch(c){case"select":return{...r,"aria-selected":t&&n};case"combobox":return{...r,...t&&{"aria-selected":!0}}}return{}}}}),[l,c,s,o,i,a,u])}(V),K=function(t,n){void 0===n&&(n={});const{open:r,onOpenChange:o,nodeId:i,elements:{reference:l,domReference:c,floating:s},dataRef:a}=t,{enabled:u=!0,escapeKey:f=!0,outsidePress:m=!0,outsidePressEvent:v="pointerdown",referencePress:g=!1,referencePressEvent:h="pointerdown",ancestorScroll:y=!1,bubbles:x,capture:R}=n,O=Ie(),S=ke("function"==typeof m?m:()=>!1),D="function"==typeof m?S:m,M=e.useRef(!1),A=e.useRef(!1),{escapeKey:N,outsidePress:F}=Ye(x),{escapeKey:H,outsidePress:W}=Ye(R),B=ke((e=>{if(!r||!u||!f||"Escape"!==e.key)return;const t=O?ze(O.nodesRef.current,i):[];if(!N&&(e.stopPropagation(),t.length>0)){let e=!0;if(t.forEach((t=>{var n;null==(n=t.context)||!n.open||t.context.dataRef.current.__escapeKeyBubbles||(e=!1)})),!e)return}o(!1,function(e){return"nativeEvent"in e}(e)?e.nativeEvent:e,"escape-key")})),I=ke((e=>{var t;const n=()=>{var t;B(e),null==(t=T(e))||t.removeEventListener("keydown",n)};null==(t=T(e))||t.addEventListener("keydown",n)})),_=ke((e=>{const t=M.current;M.current=!1;const n=A.current;if(A.current=!1,"click"===v&&n)return;if(t)return;if("function"==typeof D&&!D(e))return;const r=T(e),l="["+_e("inert")+"]",a=C(s).querySelectorAll(l);let u=d(r)?r:null;for(;u&&!w(u);){const e=E(u);if(w(e)||!d(e))break;u=e}if(a.length&&d(r)&&!r.matches("html,body")&&!L(r,s)&&Array.from(a).every((e=>!L(u,e))))return;if(p(r)&&s){const t=r.clientWidth>0&&r.scrollWidth>r.clientWidth,n=r.clientHeight>0&&r.scrollHeight>r.clientHeight;let o=n&&e.offsetX>r.clientWidth;if(n&&"rtl"===b(r).direction&&(o=e.offsetX<=r.offsetWidth-r.clientWidth),o||t&&e.offsetY>r.clientHeight)return}const f=O&&ze(O.nodesRef.current,i).some((t=>{var n;return k(e,null==(n=t.context)?void 0:n.elements.floating)}));if(k(e,s)||k(e,c)||f)return;const m=O?ze(O.nodesRef.current,i):[];if(m.length>0){let e=!0;if(m.forEach((t=>{var n;null==(n=t.context)||!n.open||t.context.dataRef.current.__outsidePressBubbles||(e=!1)})),!e)return}o(!1,e,"outside-press")})),V=ke((e=>{var t;const n=()=>{var t;_(e),null==(t=T(e))||t.removeEventListener(v,n)};null==(t=T(e))||t.addEventListener(v,n)}));return e.useEffect((()=>{if(!r||!u)return;function e(e){o(!1,e,"ancestor-scroll")}a.current.__escapeKeyBubbles=N,a.current.__outsidePressBubbles=F;const t=C(s);f&&t.addEventListener("keydown",H?I:B,H),D&&t.addEventListener(v,W?V:_,W);let n=[];return y&&(d(c)&&(n=P(c)),d(s)&&(n=n.concat(P(s))),!d(l)&&l&&l.contextElement&&(n=n.concat(P(l.contextElement)))),n=n.filter((e=>{var n;return e!==(null==(n=t.defaultView)?void 0:n.visualViewport)})),n.forEach((t=>{t.addEventListener("scroll",e,{passive:!0})})),()=>{f&&t.removeEventListener("keydown",H?I:B,H),D&&t.removeEventListener(v,W?V:_,W),n.forEach((t=>{t.removeEventListener("scroll",e)}))}}),[a,s,c,l,f,D,v,r,o,y,u,N,F,B,H,I,_,W,V]),e.useEffect((()=>{M.current=!1}),[D,v]),e.useMemo((()=>u?{reference:{onKeyDown:B,[Xe[h]]:e=>{g&&o(!1,e.nativeEvent,"reference-press")}},floating:{onKeyDown:B,onMouseDown(){A.current=!0},onMouseUp(){A.current=!0},[$e[v]]:()=>{M.current=!0}}}:{}),[u,g,v,h,o,B])}(V),z=function(t,n){void 0===n&&(n={});const{open:r,onOpenChange:o,dataRef:i,events:l,elements:{domReference:c,floating:s},refs:a}=t,{enabled:u=!0,delay:f=0,handleClose:p=null,mouseOnly:m=!1,restMs:v=0,move:g=!0}=n,h=Ie(),y=Be(),w=Ve(p),b=Ve(f),x=e.useRef(),E=e.useRef(),R=e.useRef(),P=e.useRef(),k=e.useRef(!0),T=e.useRef(!1),S=e.useRef((()=>{})),D=e.useCallback((()=>{var e;const t=null==(e=i.current.openEvent)?void 0:e.type;return(null==t?void 0:t.includes("mouse"))&&"mousedown"!==t}),[i]);e.useEffect((()=>{if(u)return l.on("openchange",e),()=>{l.off("openchange",e)};function e(e){let{open:t}=e;t||(clearTimeout(E.current),clearTimeout(P.current),k.current=!0)}}),[u,l]),e.useEffect((()=>{if(!u||!w.current||!r)return;function e(e){D()&&o(!1,e,"hover")}const t=C(s).documentElement;return t.addEventListener("mouseleave",e),()=>{t.removeEventListener("mouseleave",e)}}),[s,r,o,u,w,D]);const M=e.useCallback((function(e,t,n){void 0===t&&(t=!0),void 0===n&&(n="hover");const r=Ke(b.current,"close",x.current);r&&!R.current?(clearTimeout(E.current),E.current=setTimeout((()=>o(!1,e,n)),r)):t&&(clearTimeout(E.current),o(!1,e,n))}),[b,o]),A=e.useCallback((()=>{S.current(),R.current=void 0}),[]),N=e.useCallback((()=>{if(T.current){const e=C(a.floating.current).body;e.style.pointerEvents="",e.removeAttribute(je),T.current=!1}}),[a]);return e.useEffect((()=>{if(u&&d(c)){const e=c;return r&&e.addEventListener("mouseleave",a),null==s||s.addEventListener("mouseleave",a),g&&e.addEventListener("mousemove",n,{once:!0}),e.addEventListener("mouseenter",n),e.addEventListener("mouseleave",l),()=>{r&&e.removeEventListener("mouseleave",a),null==s||s.removeEventListener("mouseleave",a),g&&e.removeEventListener("mousemove",n),e.removeEventListener("mouseenter",n),e.removeEventListener("mouseleave",l)}}function e(){return!!i.current.openEvent&&["click","mousedown"].includes(i.current.openEvent.type)}function n(e){if(clearTimeout(E.current),k.current=!1,m&&!O(x.current)||v>0&&0===Ke(b.current,"open"))return;const t=Ke(b.current,"open",x.current);t?E.current=setTimeout((()=>{o(!0,e,"hover")}),t):o(!0,e,"hover")}function l(n){if(e())return;S.current();const o=C(s);if(clearTimeout(P.current),w.current){r||clearTimeout(E.current),R.current=w.current({...t,tree:h,x:n.clientX,y:n.clientY,onClose(){N(),A(),M(n,!0,"safe-polygon")}});const e=R.current;return o.addEventListener("mousemove",e),void(S.current=()=>{o.removeEventListener("mousemove",e)})}("touch"!==x.current||!L(s,n.relatedTarget))&&M(n)}function a(n){e()||null==w.current||w.current({...t,tree:h,x:n.clientX,y:n.clientY,onClose(){N(),A(),M(n)}})(n)}}),[c,s,u,t,m,v,g,M,A,N,o,r,h,b,w,i]),Te((()=>{var e;if(u&&r&&null!=(e=w.current)&&e.__options.blockPointerEvents&&D()){const e=C(s).body;if(e.setAttribute(je,""),e.style.pointerEvents="none",T.current=!0,d(c)&&s){var t;const e=c,n=null==h||null==(t=h.nodesRef.current.find((e=>e.id===y)))||null==(t=t.context)?void 0:t.elements.floating;return n&&(n.style.pointerEvents=""),e.style.pointerEvents="auto",s.style.pointerEvents="auto",()=>{e.style.pointerEvents="",s.style.pointerEvents=""}}}}),[u,r,y,s,c,h,w,D]),Te((()=>{r||(x.current=void 0,A(),N())}),[r,A,N]),e.useEffect((()=>()=>{A(),clearTimeout(E.current),clearTimeout(P.current),N()}),[u,c,A,N]),e.useMemo((()=>{if(!u)return{};function e(e){x.current=e.pointerType}return{reference:{onPointerDown:e,onPointerEnter:e,onMouseMove(e){r||0===v||(clearTimeout(P.current),P.current=setTimeout((()=>{k.current||o(!0,e.nativeEvent,"hover")}),v))}},floating:{onMouseEnter(){clearTimeout(E.current)},onMouseLeave(e){M(e.nativeEvent,!1)}}}}),[u,v,r,o,M])}(V,{}),X=function(t){void 0===t&&(t=[]);const n=t,r=e.useCallback((e=>Ge(e,t,"reference")),n),o=e.useCallback((e=>Ge(e,t,"floating")),n),i=e.useCallback((e=>Ge(e,t,"item")),t.map((e=>null==e?void 0:e.item)));return e.useMemo((()=>({getReferenceProps:r,getFloatingProps:o,getItemProps:i})),[r,o,i])}([z,j,K]),$=X.getReferenceProps,Y=X.getFloatingProps;return t.createElement("span",null,t.createElement("span",c({className:"rad-ui-popper ".concat(A,"-reference-element ").concat(f),ref:I.setReference},$({onClick:function(){console.log("click")}})),g),H&&t.createElement("div",c({className:"".concat(A,"-floating-element"),ref:I.setFloating,style:_},Y()),R&&t.createElement(Fe,{className:"rad-ui-arrow ".concat(A,"-arrow"),ref:N,context:V}),D))},tt=function(e){var n=e.list,r=void 0===n?[]:n;e.selected;return t.createElement("div",{className:"relative"},t.createElement(et,{open:!1,placement:"bottom-start",popperName:"dropdown",pop:t.createElement((function(){return t.createElement("ul",{className:"bg-white px-2 py-2 shadow-lg rounded-md"},r.map((function(e,n){return t.createElement("li",{key:n},e.value)})))}),null)},t.createElement("span",null,"Dropdown")))};export{tt as default};
@@ -1,6 +1,6 @@
1
- 'use client';import*as e from"react";import t,{useLayoutEffect as n,useEffect as r,useRef as o}from"react";import*as i from"react-dom";import{createPortal as l}from"react-dom";function u(e){return s(e)?(e.nodeName||"").toLowerCase():"#document"}function c(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function a(e){var t;return null==(t=(s(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function s(e){return e instanceof Node||e instanceof c(e).Node}function f(e){return e instanceof Element||e instanceof c(e).Element}function d(e){return e instanceof HTMLElement||e instanceof c(e).HTMLElement}function p(e){return"undefined"!=typeof ShadowRoot&&(e instanceof ShadowRoot||e instanceof c(e).ShadowRoot)}function m(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=b(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function h(e){return["table","td","th"].includes(u(e))}function v(e){const t=y(),n=b(e);return"none"!==n.transform||"none"!==n.perspective||!!n.containerType&&"normal"!==n.containerType||!t&&!!n.backdropFilter&&"none"!==n.backdropFilter||!t&&!!n.filter&&"none"!==n.filter||["transform","perspective","filter"].some((e=>(n.willChange||"").includes(e)))||["paint","layout","strict","content"].some((e=>(n.contain||"").includes(e)))}function g(e){let t=E(e);for(;d(t)&&!w(t);){if(v(t))return t;t=E(t)}return null}function y(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function w(e){return["html","body","#document"].includes(u(e))}function b(e){return c(e).getComputedStyle(e)}function x(e){return f(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function E(e){if("html"===u(e))return e;const t=e.assignedSlot||e.parentNode||p(e)&&e.host||a(e);return p(t)?t.host:t}function R(e){const t=E(e);return w(t)?e.ownerDocument?e.ownerDocument.body:e.body:d(t)&&m(t)?t:R(t)}function S(e,t,n){var r;void 0===t&&(t=[]),void 0===n&&(n=!0);const o=R(e),i=o===(null==(r=e.ownerDocument)?void 0:r.body),l=c(o);return i?t.concat(l,l.visualViewport||[],m(o)?o:[],l.frameElement&&n?S(l.frameElement):[]):t.concat(o,S(o,[],n))}function C(e){let t=e.activeElement;for(;null!=(null==(n=t)||null==(n=n.shadowRoot)?void 0:n.activeElement);){var n;t=t.shadowRoot.activeElement}return t}function T(e,t){if(!e||!t)return!1;const n=null==t.getRootNode?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&p(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function O(){const e=navigator.userAgentData;return null!=e&&e.platform?e.platform:navigator.platform}function N(){const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map((e=>{let{brand:t,version:n}=e;return t+"/"+n})).join(" "):navigator.userAgent}function L(e){return!N().includes("jsdom/")&&(!k()&&0===e.width&&0===e.height||k()&&1===e.width&&1===e.height&&0===e.pressure&&0===e.detail&&"mouse"===e.pointerType||e.width<1&&e.height<1&&0===e.pressure&&0===e.detail&&"touch"===e.pointerType)}function k(){const e=/android/i;return e.test(O())||e.test(N())}function A(e){return(null==e?void 0:e.ownerDocument)||document}const M="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function I(e){e.preventDefault(),e.stopPropagation()}function D(e){return!!e&&("combobox"===e.getAttribute("role")&&function(e){return d(e)&&e.matches(M)}(e))}const F=Math.min,P=Math.max,W=Math.round,V=e=>({x:e,y:e});function j(e){return e.split("-")[0]}function B(e){return["top","bottom"].includes(j(e))?"y":"x"}function H(e){return{...e,top:e.y,left:e.x,right:e.x+e.width,bottom:e.y+e.height}}function q(e,t,n){let{reference:r,floating:o}=e;const i=B(t),l=function(e){return"x"===B(e)?"y":"x"}(t),u="y"===l?"height":"width";const c=j(t),a="y"===i,s=r.x+r.width/2-o.width/2,f=r.y+r.height/2-o.height/2,d=r[u]/2-o[u]/2;let p;switch(c){case"top":p={x:s,y:r.y-o.height};break;case"bottom":p={x:s,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:f};break;case"left":p={x:r.x-o.width,y:f};break;default:p={x:r.x,y:r.y}}switch(function(e){return e.split("-")[1]}(t)){case"start":p[l]-=d*(n&&a?-1:1);break;case"end":p[l]+=d*(n&&a?-1:1)}return p}function _(e){const t=b(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=d(e),i=o?e.offsetWidth:n,l=o?e.offsetHeight:r,u=W(n)!==i||W(r)!==l;return u&&(n=i,r=l),{width:n,height:r,$:u}}function U(e){return f(e)?e:e.contextElement}function $(e){const t=U(e);if(!d(t))return V(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=_(t);let l=(i?W(n.width):n.width)/r,u=(i?W(n.height):n.height)/o;return l&&Number.isFinite(l)||(l=1),u&&Number.isFinite(u)||(u=1),{x:l,y:u}}const z=V(0);function X(e){const t=c(e);return y()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:z}function Y(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);const o=e.getBoundingClientRect(),i=U(e);let l=V(1);t&&(r?f(r)&&(l=$(r)):l=$(e));const u=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==c(e))&&t}(i,n,r)?X(i):V(0);let a=(o.left+u.x)/l.x,s=(o.top+u.y)/l.y,d=o.width/l.x,p=o.height/l.y;if(i){const e=c(i),t=r&&f(r)?c(r):r;let n=e.frameElement;for(;n&&r&&t!==e;){const e=$(n),t=n.getBoundingClientRect(),r=b(n),o=t.left+(n.clientLeft+parseFloat(r.paddingLeft))*e.x,i=t.top+(n.clientTop+parseFloat(r.paddingTop))*e.y;a*=e.x,s*=e.y,d*=e.x,p*=e.y,a+=o,s+=i,n=c(n).frameElement}}return H({width:d,height:p,x:a,y:s})}const K=[":popover-open",":modal"];function G(e){let t=!1,n=0,r=0;if(K.forEach((n=>{!function(n){try{t=t||e.matches(n)}catch(e){}}(n)})),t){const t=g(e);if(t){const e=t.getBoundingClientRect();n=e.x,r=e.y}}return[t,n,r]}function J(e){return Y(a(e)).left+x(e).scrollLeft}function Q(e,t,n){let r;if("viewport"===t)r=function(e,t){const n=c(e),r=a(e),o=n.visualViewport;let i=r.clientWidth,l=r.clientHeight,u=0,s=0;if(o){i=o.width,l=o.height;const e=y();(!e||e&&"fixed"===t)&&(u=o.offsetLeft,s=o.offsetTop)}return{width:i,height:l,x:u,y:s}}(e,n);else if("document"===t)r=function(e){const t=a(e),n=x(e),r=e.ownerDocument.body,o=P(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=P(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let l=-n.scrollLeft+J(e);const u=-n.scrollTop;return"rtl"===b(r).direction&&(l+=P(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:l,y:u}}(a(e));else if(f(t))r=function(e,t){const n=Y(e,!0,"fixed"===t),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=d(e)?$(e):V(1);return{width:e.clientWidth*i.x,height:e.clientHeight*i.y,x:o*i.x,y:r*i.y}}(t,n);else{const n=X(e);r={...t,x:t.x-n.x,y:t.y-n.y}}return H(r)}function Z(e,t){const n=E(e);return!(n===t||!f(n)||w(n))&&("fixed"===b(n).position||Z(n,t))}function ee(e,t,n,r){const o=d(t),i=a(t),l="fixed"===n,c=Y(e,!0,l,t);let s={scrollLeft:0,scrollTop:0};const f=V(0);if(o||!o&&!l)if(("body"!==u(t)||m(i))&&(s=x(t)),o){const e=Y(t,!0,l,t);f.x=e.x+t.clientLeft,f.y=e.y+t.clientTop}else i&&(f.x=J(i));let p=c.left+s.scrollLeft-f.x,h=c.top+s.scrollTop-f.y;const[v,g,y]=G(r);return v&&(p+=g,h+=y,o&&(p+=t.clientLeft,h+=t.clientTop)),{x:p,y:h,width:c.width,height:c.height}}function te(e,t){return d(e)&&"fixed"!==b(e).position?t?t(e):e.offsetParent:null}function ne(e,t){const n=c(e);if(!d(e))return n;let r=te(e,t);for(;r&&h(r)&&"static"===b(r).position;)r=te(r,t);return r&&("html"===u(r)||"body"===u(r)&&"static"===b(r).position&&!v(r))?n:r||g(e)||n}const re={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i=a(r),[l]=t?G(t.floating):[!1];if(r===i||l)return n;let c={scrollLeft:0,scrollTop:0},s=V(1);const f=V(0),p=d(r);if((p||!p&&"fixed"!==o)&&(("body"!==u(r)||m(i))&&(c=x(r)),d(r))){const e=Y(r);s=$(r),f.x=e.x+r.clientLeft,f.y=e.y+r.clientTop}return{width:n.width*s.x,height:n.height*s.y,x:n.x*s.x-c.scrollLeft*s.x+f.x,y:n.y*s.y-c.scrollTop*s.y+f.y}},getDocumentElement:a,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[..."clippingAncestors"===n?function(e,t){const n=t.get(e);if(n)return n;let r=S(e,[],!1).filter((e=>f(e)&&"body"!==u(e))),o=null;const i="fixed"===b(e).position;let l=i?E(e):e;for(;f(l)&&!w(l);){const t=b(l),n=v(l);n||"fixed"!==t.position||(o=null),(i?!n&&!o:!n&&"static"===t.position&&o&&["absolute","fixed"].includes(o.position)||m(l)&&!n&&Z(e,l))?r=r.filter((e=>e!==l)):o=t,l=E(l)}return t.set(e,r),r}(t,this._c):[].concat(n),r],l=i[0],c=i.reduce(((e,n)=>{const r=Q(t,n,o);return e.top=P(r.top,e.top),e.right=F(r.right,e.right),e.bottom=F(r.bottom,e.bottom),e.left=P(r.left,e.left),e}),Q(t,l,o));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}},getOffsetParent:ne,getElementRects:async function(e){const t=this.getOffsetParent||ne,n=this.getDimensions;return{reference:ee(e.reference,await t(e.floating),e.strategy,e.floating),floating:{x:0,y:0,...await n(e.floating)}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){const{width:t,height:n}=_(e);return{width:t,height:n}},getScale:$,isElement:f,isRTL:function(e){return"rtl"===b(e).direction}},oe=(e,t,n)=>{const r=new Map,o={platform:re,...n},i={...o.platform,_c:r};return(async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:l}=n,u=i.filter(Boolean),c=await(null==l.isRTL?void 0:l.isRTL(t));let a=await l.getElementRects({reference:e,floating:t,strategy:o}),{x:s,y:f}=q(a,r,c),d=r,p={},m=0;for(let n=0;n<u.length;n++){const{name:i,fn:h}=u[n],{x:v,y:g,data:y,reset:w}=await h({x:s,y:f,initialPlacement:r,placement:d,strategy:o,middlewareData:p,rects:a,platform:l,elements:{reference:e,floating:t}});s=null!=v?v:s,f=null!=g?g:f,p={...p,[i]:{...p[i],...y}},w&&m<=50&&(m++,"object"==typeof w&&(w.placement&&(d=w.placement),w.rects&&(a=!0===w.rects?await l.getElementRects({reference:e,floating:t,strategy:o}):w.rects),({x:s,y:f}=q(a,d,c))),n=-1)}return{x:s,y:f,placement:d,strategy:o,middlewareData:p}})(e,t,{...o,platform:i})};var ie="undefined"!=typeof document?n:r;function le(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;0!=r--;)if(!le(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;0!=r--;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;0!=r--;){const n=o[r];if(("_owner"!==n||!e.$$typeof)&&!le(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function ue(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function ce(e,t){const n=ue(e);return Math.round(t*n)/n}function ae(t){const n=e.useRef(t);return ie((()=>{n.current=t})),n}
1
+ 'use client';import*as e from"react";import t,{useLayoutEffect as n,useEffect as r,useRef as o}from"react";import*as i from"react-dom";import{createPortal as l}from"react-dom";function u(e){return s(e)?(e.nodeName||"").toLowerCase():"#document"}function c(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function a(e){var t;return null==(t=(s(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function s(e){return e instanceof Node||e instanceof c(e).Node}function f(e){return e instanceof Element||e instanceof c(e).Element}function d(e){return e instanceof HTMLElement||e instanceof c(e).HTMLElement}function p(e){return"undefined"!=typeof ShadowRoot&&(e instanceof ShadowRoot||e instanceof c(e).ShadowRoot)}function m(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=w(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function h(e){return["table","td","th"].includes(u(e))}function v(e){const t=g(),n=w(e);return"none"!==n.transform||"none"!==n.perspective||!!n.containerType&&"normal"!==n.containerType||!t&&!!n.backdropFilter&&"none"!==n.backdropFilter||!t&&!!n.filter&&"none"!==n.filter||["transform","perspective","filter"].some((e=>(n.willChange||"").includes(e)))||["paint","layout","strict","content"].some((e=>(n.contain||"").includes(e)))}function g(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function y(e){return["html","body","#document"].includes(u(e))}function w(e){return c(e).getComputedStyle(e)}function b(e){return f(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function x(e){if("html"===u(e))return e;const t=e.assignedSlot||e.parentNode||p(e)&&e.host||a(e);return p(t)?t.host:t}function E(e){const t=x(e);return y(t)?e.ownerDocument?e.ownerDocument.body:e.body:d(t)&&m(t)?t:E(t)}function R(e,t,n){var r;void 0===t&&(t=[]),void 0===n&&(n=!0);const o=E(e),i=o===(null==(r=e.ownerDocument)?void 0:r.body),l=c(o);return i?t.concat(l,l.visualViewport||[],m(o)?o:[],l.frameElement&&n?R(l.frameElement):[]):t.concat(o,R(o,[],n))}function S(e){let t=e.activeElement;for(;null!=(null==(n=t)||null==(n=n.shadowRoot)?void 0:n.activeElement);){var n;t=t.shadowRoot.activeElement}return t}function C(e,t){if(!e||!t)return!1;const n=null==t.getRootNode?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&p(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function T(){const e=navigator.userAgentData;return null!=e&&e.platform?e.platform:navigator.platform}function O(){const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map((e=>{let{brand:t,version:n}=e;return t+"/"+n})).join(" "):navigator.userAgent}function N(e){return!O().includes("jsdom/")&&(!k()&&0===e.width&&0===e.height||k()&&1===e.width&&1===e.height&&0===e.pressure&&0===e.detail&&"mouse"===e.pointerType||e.width<1&&e.height<1&&0===e.pressure&&0===e.detail&&"touch"===e.pointerType)}function k(){const e=/android/i;return e.test(T())||e.test(O())}function A(e){return(null==e?void 0:e.ownerDocument)||document}const L="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function M(e){e.preventDefault(),e.stopPropagation()}function I(e){return!!e&&("combobox"===e.getAttribute("role")&&function(e){return d(e)&&e.matches(L)}(e))}const D=Math.min,F=Math.max,P=Math.round,W=e=>({x:e,y:e});function V(e){return e.split("-")[0]}function j(e){return["top","bottom"].includes(V(e))?"y":"x"}function B(e){return{...e,top:e.y,left:e.x,right:e.x+e.width,bottom:e.y+e.height}}function H(e,t,n){let{reference:r,floating:o}=e;const i=j(t),l=function(e){return"x"===j(e)?"y":"x"}(t),u="y"===l?"height":"width";const c=V(t),a="y"===i,s=r.x+r.width/2-o.width/2,f=r.y+r.height/2-o.height/2,d=r[u]/2-o[u]/2;let p;switch(c){case"top":p={x:s,y:r.y-o.height};break;case"bottom":p={x:s,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:f};break;case"left":p={x:r.x-o.width,y:f};break;default:p={x:r.x,y:r.y}}switch(function(e){return e.split("-")[1]}(t)){case"start":p[l]-=d*(n&&a?-1:1);break;case"end":p[l]+=d*(n&&a?-1:1)}return p}function q(e){const t=w(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=d(e),i=o?e.offsetWidth:n,l=o?e.offsetHeight:r,u=P(n)!==i||P(r)!==l;return u&&(n=i,r=l),{width:n,height:r,$:u}}function _(e){return f(e)?e:e.contextElement}function U(e){const t=_(e);if(!d(t))return W(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=q(t);let l=(i?P(n.width):n.width)/r,u=(i?P(n.height):n.height)/o;return l&&Number.isFinite(l)||(l=1),u&&Number.isFinite(u)||(u=1),{x:l,y:u}}const $=W(0);function z(e){const t=c(e);return g()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:$}function X(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);const o=e.getBoundingClientRect(),i=_(e);let l=W(1);t&&(r?f(r)&&(l=U(r)):l=U(e));const u=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==c(e))&&t}(i,n,r)?z(i):W(0);let a=(o.left+u.x)/l.x,s=(o.top+u.y)/l.y,d=o.width/l.x,p=o.height/l.y;if(i){const e=c(i),t=r&&f(r)?c(r):r;let n=e.frameElement;for(;n&&r&&t!==e;){const e=U(n),t=n.getBoundingClientRect(),r=w(n),o=t.left+(n.clientLeft+parseFloat(r.paddingLeft))*e.x,i=t.top+(n.clientTop+parseFloat(r.paddingTop))*e.y;a*=e.x,s*=e.y,d*=e.x,p*=e.y,a+=o,s+=i,n=c(n).frameElement}}return B({width:d,height:p,x:a,y:s})}const Y=[":popover-open",":modal"];function K(e){return Y.some((t=>{try{return e.matches(t)}catch(e){return!1}}))}function G(e){return X(a(e)).left+b(e).scrollLeft}function J(e,t,n){let r;if("viewport"===t)r=function(e,t){const n=c(e),r=a(e),o=n.visualViewport;let i=r.clientWidth,l=r.clientHeight,u=0,s=0;if(o){i=o.width,l=o.height;const e=g();(!e||e&&"fixed"===t)&&(u=o.offsetLeft,s=o.offsetTop)}return{width:i,height:l,x:u,y:s}}(e,n);else if("document"===t)r=function(e){const t=a(e),n=b(e),r=e.ownerDocument.body,o=F(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=F(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let l=-n.scrollLeft+G(e);const u=-n.scrollTop;return"rtl"===w(r).direction&&(l+=F(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:l,y:u}}(a(e));else if(f(t))r=function(e,t){const n=X(e,!0,"fixed"===t),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=d(e)?U(e):W(1);return{width:e.clientWidth*i.x,height:e.clientHeight*i.y,x:o*i.x,y:r*i.y}}(t,n);else{const n=z(e);r={...t,x:t.x-n.x,y:t.y-n.y}}return B(r)}function Q(e,t){const n=x(e);return!(n===t||!f(n)||y(n))&&("fixed"===w(n).position||Q(n,t))}function Z(e,t,n){const r=d(t),o=a(t),i="fixed"===n,l=X(e,!0,i,t);let c={scrollLeft:0,scrollTop:0};const s=W(0);if(r||!r&&!i)if(("body"!==u(t)||m(o))&&(c=b(t)),r){const e=X(t,!0,i,t);s.x=e.x+t.clientLeft,s.y=e.y+t.clientTop}else o&&(s.x=G(o));return{x:l.left+c.scrollLeft-s.x,y:l.top+c.scrollTop-s.y,width:l.width,height:l.height}}function ee(e,t){return d(e)&&"fixed"!==w(e).position?t?t(e):e.offsetParent:null}function te(e,t){const n=c(e);if(!d(e)||K(e))return n;let r=ee(e,t);for(;r&&h(r)&&"static"===w(r).position;)r=ee(r,t);return r&&("html"===u(r)||"body"===u(r)&&"static"===w(r).position&&!v(r))?n:r||function(e){let t=x(e);for(;d(t)&&!y(t);){if(v(t))return t;t=x(t)}return null}(e)||n}const ne={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i="fixed"===o,l=a(r),c=!!t&&K(t.floating);if(r===l||c&&i)return n;let s={scrollLeft:0,scrollTop:0},f=W(1);const p=W(0),h=d(r);if((h||!h&&!i)&&(("body"!==u(r)||m(l))&&(s=b(r)),d(r))){const e=X(r);f=U(r),p.x=e.x+r.clientLeft,p.y=e.y+r.clientTop}return{width:n.width*f.x,height:n.height*f.y,x:n.x*f.x-s.scrollLeft*f.x+p.x,y:n.y*f.y-s.scrollTop*f.y+p.y}},getDocumentElement:a,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[..."clippingAncestors"===n?function(e,t){const n=t.get(e);if(n)return n;let r=R(e,[],!1).filter((e=>f(e)&&"body"!==u(e))),o=null;const i="fixed"===w(e).position;let l=i?x(e):e;for(;f(l)&&!y(l);){const t=w(l),n=v(l);n||"fixed"!==t.position||(o=null),(i?!n&&!o:!n&&"static"===t.position&&o&&["absolute","fixed"].includes(o.position)||m(l)&&!n&&Q(e,l))?r=r.filter((e=>e!==l)):o=t,l=x(l)}return t.set(e,r),r}(t,this._c):[].concat(n),r],l=i[0],c=i.reduce(((e,n)=>{const r=J(t,n,o);return e.top=F(r.top,e.top),e.right=D(r.right,e.right),e.bottom=D(r.bottom,e.bottom),e.left=F(r.left,e.left),e}),J(t,l,o));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}},getOffsetParent:te,getElementRects:async function(e){const t=this.getOffsetParent||te,n=this.getDimensions;return{reference:Z(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,...await n(e.floating)}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){const{width:t,height:n}=q(e);return{width:t,height:n}},getScale:U,isElement:f,isRTL:function(e){return"rtl"===w(e).direction}},re=(e,t,n)=>{const r=new Map,o={platform:ne,...n},i={...o.platform,_c:r};return(async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:l}=n,u=i.filter(Boolean),c=await(null==l.isRTL?void 0:l.isRTL(t));let a=await l.getElementRects({reference:e,floating:t,strategy:o}),{x:s,y:f}=H(a,r,c),d=r,p={},m=0;for(let n=0;n<u.length;n++){const{name:i,fn:h}=u[n],{x:v,y:g,data:y,reset:w}=await h({x:s,y:f,initialPlacement:r,placement:d,strategy:o,middlewareData:p,rects:a,platform:l,elements:{reference:e,floating:t}});s=null!=v?v:s,f=null!=g?g:f,p={...p,[i]:{...p[i],...y}},w&&m<=50&&(m++,"object"==typeof w&&(w.placement&&(d=w.placement),w.rects&&(a=!0===w.rects?await l.getElementRects({reference:e,floating:t,strategy:o}):w.rects),({x:s,y:f}=H(a,d,c))),n=-1)}return{x:s,y:f,placement:d,strategy:o,middlewareData:p}})(e,t,{...o,platform:i})};var oe="undefined"!=typeof document?n:r;function ie(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;0!=r--;)if(!ie(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;0!=r--;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;0!=r--;){const n=o[r];if(("_owner"!==n||!e.$$typeof)&&!ie(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function le(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function ue(e,t){const n=le(e);return Math.round(t*n)/n}function ce(t){const n=e.useRef(t);return oe((()=>{n.current=t})),n}
2
2
  /*!
3
3
  * tabbable 6.2.0
4
4
  * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
5
5
  */
6
- var se=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[href]:not([inert])","button:not([inert])","[tabindex]:not(slot):not([inert])","audio[controls]:not([inert])","video[controls]:not([inert])",'[contenteditable]:not([contenteditable="false"]):not([inert])',"details>summary:first-of-type:not([inert])","details:not([inert])"].join(","),fe="undefined"==typeof Element,de=fe?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,pe=!fe&&Element.prototype.getRootNode?function(e){var t;return null==e||null===(t=e.getRootNode)||void 0===t?void 0:t.call(e)}:function(e){return null==e?void 0:e.ownerDocument},me=function e(t,n){var r;void 0===n&&(n=!0);var o=null==t||null===(r=t.getAttribute)||void 0===r?void 0:r.call(t,"inert");return""===o||"true"===o||n&&t&&e(t.parentNode)},he=function e(t,n,r){for(var o=[],i=Array.from(t);i.length;){var l=i.shift();if(!me(l,!1))if("SLOT"===l.tagName){var u=l.assignedElements(),c=e(u.length?u:l.children,!0,r);r.flatten?o.push.apply(o,c):o.push({scopeParent:l,candidates:c})}else{de.call(l,se)&&r.filter(l)&&(n||!t.includes(l))&&o.push(l);var a=l.shadowRoot||"function"==typeof r.getShadowRoot&&r.getShadowRoot(l),s=!me(a,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(l));if(a&&s){var f=e(!0===a?l.children:a.children,!0,r);r.flatten?o.push.apply(o,f):o.push({scopeParent:l,candidates:f})}else i.unshift.apply(i,l.children)}}return o},ve=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},ge=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||function(e){var t,n=null==e||null===(t=e.getAttribute)||void 0===t?void 0:t.call(e,"contenteditable");return""===n||"true"===n}(e))&&!ve(e)?0:e.tabIndex},ye=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},we=function(e){return"INPUT"===e.tagName},be=function(e){return function(e){return we(e)&&"radio"===e.type}(e)&&!function(e){if(!e.name)return!0;var t,n=e.form||pe(e),r=function(e){return n.querySelectorAll('input[type="radio"][name="'+e+'"]')};if("undefined"!=typeof window&&void 0!==window.CSS&&"function"==typeof window.CSS.escape)t=r(window.CSS.escape(e.name));else try{t=r(e.name)}catch(e){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",e.message),!1}var o=function(e,t){for(var n=0;n<e.length;n++)if(e[n].checked&&e[n].form===t)return e[n]}(t,e.form);return!o||o===e}(e)},xe=function(e){var t=e.getBoundingClientRect(),n=t.width,r=t.height;return 0===n&&0===r},Ee=function(e,t){var n=t.displayCheck,r=t.getShadowRoot;if("hidden"===getComputedStyle(e).visibility)return!0;var o=de.call(e,"details>summary:first-of-type")?e.parentElement:e;if(de.call(o,"details:not([open]) *"))return!0;if(n&&"full"!==n&&"legacy-full"!==n){if("non-zero-area"===n)return xe(e)}else{if("function"==typeof r){for(var i=e;e;){var l=e.parentElement,u=pe(e);if(l&&!l.shadowRoot&&!0===r(l))return xe(e);e=e.assignedSlot?e.assignedSlot:l||u===e.ownerDocument?l:u.host}e=i}if(function(e){var t,n,r,o,i=e&&pe(e),l=null===(t=i)||void 0===t?void 0:t.host,u=!1;if(i&&i!==e)for(u=!!(null!==(n=l)&&void 0!==n&&null!==(r=n.ownerDocument)&&void 0!==r&&r.contains(l)||null!=e&&null!==(o=e.ownerDocument)&&void 0!==o&&o.contains(e));!u&&l;){var c,a,s;u=!(null===(a=l=null===(c=i=pe(l))||void 0===c?void 0:c.host)||void 0===a||null===(s=a.ownerDocument)||void 0===s||!s.contains(l))}return u}(e))return!e.getClientRects().length;if("legacy-full"!==n)return!0}return!1},Re=function(e,t){return!(t.disabled||me(t)||function(e){return we(e)&&"hidden"===e.type}(t)||Ee(t,e)||function(e){return"DETAILS"===e.tagName&&Array.prototype.slice.apply(e.children).some((function(e){return"SUMMARY"===e.tagName}))}(t)||function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var t=e.parentElement;t;){if("FIELDSET"===t.tagName&&t.disabled){for(var n=0;n<t.children.length;n++){var r=t.children.item(n);if("LEGEND"===r.tagName)return!!de.call(t,"fieldset[disabled] *")||!r.contains(e)}return!0}t=t.parentElement}return!1}(t))},Se=function(e,t){return!(be(t)||ge(t)<0||!Re(e,t))},Ce=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},Te=function e(t){var n=[],r=[];return t.forEach((function(t,o){var i=!!t.scopeParent,l=i?t.scopeParent:t,u=function(e,t){var n=ge(e);return n<0&&t&&!ve(e)?0:n}(l,i),c=i?e(t.candidates):l;0===u?i?n.push.apply(n,c):n.push(l):r.push({documentOrder:o,tabIndex:u,item:t,isScope:i,content:c})})),r.sort(ye).reduce((function(e,t){return t.isScope?e.push.apply(e,t.content):e.push(t.content),e}),[]).concat(n)},Oe=function(e,t){var n;return n=(t=t||{}).getShadowRoot?he([e],t.includeContainer,{filter:Se.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:Ce}):function(e,t,n){if(me(e))return[];var r=Array.prototype.slice.apply(e.querySelectorAll(se));return t&&de.call(e,se)&&r.unshift(e),r.filter(n)}(e,t.includeContainer,Se.bind(null,t)),Te(n)};const Ne=e["useInsertionEffect".toString()]||(e=>e());let Le=0;function ke(e,t){void 0===t&&(t={});const{preventScroll:n=!1,cancelPrevious:r=!0,sync:o=!1}=t;r&&cancelAnimationFrame(Le);const i=()=>null==e?void 0:e.focus({preventScroll:n});o?i():Le=requestAnimationFrame(i)}var Ae="undefined"!=typeof document?n:r;function Me(){return Me=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Me.apply(this,arguments)}let Ie=!1,De=0;const Fe=()=>"floating-ui-"+De++;const Pe=e["useId".toString()]||function(){const[t,n]=e.useState((()=>Ie?Fe():void 0));return Ae((()=>{null==t&&n(Fe())}),[]),e.useEffect((()=>{Ie||(Ie=!0)}),[]),t};const We=e.createContext(null),Ve=e.createContext(null),je=()=>e.useContext(Ve);function Be(e){return"data-floating-ui-"+e}function He(e){const t=o(e);return Ae((()=>{t.current=e})),t}function qe(e,t){let n=e.filter((e=>{var n;return e.parentId===t&&(null==(n=e.context)?void 0:n.open)})),r=n;for(;r.length;)r=e.filter((e=>{var t;return null==(t=r)?void 0:t.some((t=>{var n;return e.parentId===t.id&&(null==(n=e.context)?void 0:n.open)}))})),n=n.concat(r);return n}let _e=new WeakMap,Ue=new WeakSet,$e={},ze=0;const Xe=e=>e&&(e.host||Xe(e.parentNode)),Ye=(e,t)=>t.map((t=>{if(e.contains(t))return t;const n=Xe(t);return e.contains(n)?n:null})).filter((e=>null!=e));function Ke(e,t,n){void 0===t&&(t=!1),void 0===n&&(n=!1);const r=A(e[0]).body;return function(e,t,n,r){const o="data-floating-ui-inert",i=r?"inert":n?"aria-hidden":null,l=Ye(t,e),u=new Set,c=new Set(l),a=[];$e[o]||($e[o]=new WeakMap);const s=$e[o];return l.forEach((function e(t){t&&!u.has(t)&&(u.add(t),t.parentNode&&e(t.parentNode))})),function e(t){t&&!c.has(t)&&Array.prototype.forEach.call(t.children,(t=>{if(u.has(t))e(t);else{const e=i?t.getAttribute(i):null,n=null!==e&&"false"!==e,r=(_e.get(t)||0)+1,l=(s.get(t)||0)+1;_e.set(t,r),s.set(t,l),a.push(t),1===r&&n&&Ue.add(t),1===l&&t.setAttribute(o,""),!n&&i&&t.setAttribute(i,"true")}}))}(t),u.clear(),ze++,()=>{a.forEach((e=>{const t=(_e.get(e)||0)-1,n=(s.get(e)||0)-1;_e.set(e,t),s.set(e,n),t||(!Ue.has(e)&&i&&e.removeAttribute(i),Ue.delete(e)),n||e.removeAttribute(o)})),ze--,ze||(_e=new WeakMap,_e=new WeakMap,Ue=new WeakSet,$e={})}}(e.concat(Array.from(r.querySelectorAll("[aria-live]"))),r,t,n)}const Ge=()=>({getShadowRoot:!0,displayCheck:"function"==typeof ResizeObserver&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function Je(e,t){const n=Oe(e,Ge());"prev"===t&&n.reverse();const r=n.indexOf(C(A(e)));return n.slice(r+1)[0]}function Qe(){return Je(document.body,"next")}function Ze(){return Je(document.body,"prev")}function et(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!T(n,r)}function tt(e){Oe(e,Ge()).forEach((e=>{e.dataset.tabindex=e.getAttribute("tabindex")||"",e.setAttribute("tabindex","-1")}))}function nt(e){e.querySelectorAll("[data-tabindex]").forEach((e=>{const t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute("tabindex",t):e.removeAttribute("tabindex")}))}const rt={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0};function ot(e){"Tab"===e.key&&(e.target,clearTimeout(undefined))}const it=e.forwardRef((function(t,n){const[r,o]=e.useState();Ae((()=>(/apple/i.test(navigator.vendor)&&o("button"),document.addEventListener("keydown",ot),()=>{document.removeEventListener("keydown",ot)})),[]);const i={ref:n,tabIndex:0,role:r,"aria-hidden":!r||void 0,[Be("focus-guard")]:"",style:rt};return e.createElement("span",Me({},t,i))})),lt=e.createContext(null),ut=Be("portal");function ct(t){let{children:n,id:r,root:o=null,preserveTabOrder:i=!0}=t;const u=function(t){let{id:n,root:r}=void 0===t?{}:t;const[o,i]=e.useState(null),l=Pe(),u=at(),c=e.useRef(null);return Ae((()=>()=>{null==o||o.remove(),queueMicrotask((()=>{c.current=null}))}),[o]),Ae((()=>{if(c.current)return;const e=n?document.getElementById(n):null;if(!e)return;const t=document.createElement("div");t.id=l,t.setAttribute(ut,""),e.appendChild(t),c.current=t,i(t)}),[n,l]),Ae((()=>{if(c.current)return;let e=r||(null==u?void 0:u.portalNode);e&&!f(e)&&(e=e.current),e=e||document.body;let t=null;n&&(t=document.createElement("div"),t.id=n,e.appendChild(t));const o=document.createElement("div");o.id=l,o.setAttribute(ut,""),e=t||e,e.appendChild(o),c.current=o,i(o)}),[n,r,l,u]),o}({id:r,root:o}),[c,a]=e.useState(null),s=e.useRef(null),d=e.useRef(null),p=e.useRef(null),m=e.useRef(null),h=!!c&&!c.modal&&c.open&&i&&!(!o&&!u);return e.useEffect((()=>{if(u&&i&&(null==c||!c.modal))return u.addEventListener("focusin",e,!0),u.addEventListener("focusout",e,!0),()=>{u.removeEventListener("focusin",e,!0),u.removeEventListener("focusout",e,!0)};function e(e){if(u&&et(e)){("focusin"===e.type?nt:tt)(u)}}}),[u,i,null==c?void 0:c.modal]),e.createElement(lt.Provider,{value:e.useMemo((()=>({preserveTabOrder:i,beforeOutsideRef:s,afterOutsideRef:d,beforeInsideRef:p,afterInsideRef:m,portalNode:u,setFocusManagerState:a})),[i,u])},h&&u&&e.createElement(it,{"data-type":"outside",ref:s,onFocus:e=>{if(et(e,u)){var t;null==(t=p.current)||t.focus()}else{const e=Ze()||(null==c?void 0:c.refs.domReference.current);null==e||e.focus()}}}),h&&u&&e.createElement("span",{"aria-owns":u.id,style:rt}),u&&l(n,u),h&&u&&e.createElement(it,{"data-type":"outside",ref:d,onFocus:e=>{if(et(e,u)){var t;null==(t=m.current)||t.focus()}else{const t=Qe()||(null==c?void 0:c.refs.domReference.current);null==t||t.focus(),(null==c?void 0:c.closeOnFocusOut)&&(null==c||c.onOpenChange(!1,e.nativeEvent))}}}))}const at=()=>e.useContext(lt),st=20;let ft=[];function dt(e){ft=ft.filter((e=>e.isConnected)),e&&"body"!==u(e)&&(ft.push(e),ft.length>st&&(ft=ft.slice(-st)))}function pt(){return ft.slice().reverse().find((e=>e.isConnected))}const mt=e.forwardRef((function(t,n){return e.createElement("button",Me({},t,{type:"button",ref:n,tabIndex:-1,style:rt}))}));function ht(t){const{context:n,children:r,disabled:o=!1,order:i=["content"],guards:l=!0,initialFocus:u=0,returnFocus:c=!0,modal:a=!0,visuallyHiddenDismiss:s=!1,closeOnFocusOut:f=!0}=t,{open:p,refs:m,nodeId:h,onOpenChange:v,events:g,dataRef:y,elements:{domReference:w,floating:b}}=n,x="number"==typeof u&&u<0,E=D(w)&&x,R="undefined"==typeof HTMLElement||!("inert"in HTMLElement.prototype)||l,S=He(i),O=He(u),N=He(c),M=je(),F=at(),P=e.useRef(null),W=e.useRef(null),V=e.useRef(!1),j=e.useRef(!1),B=null!=F,H=e.useCallback((function(e){return void 0===e&&(e=b),e?Oe(e,Ge()):[]}),[b]),q=e.useCallback((e=>{const t=H(e);return S.current.map((e=>w&&"reference"===e?w:b&&"floating"===e?b:t)).filter(Boolean).flat()}),[w,b,S,H]);function _(t){return!o&&s&&a?e.createElement(mt,{ref:"start"===t?P:W,onClick:e=>v(!1,e.nativeEvent)},"string"==typeof s?s:"Dismiss"):null}e.useEffect((()=>{if(o||!a)return;function e(e){if("Tab"===e.key){T(b,C(A(b)))&&0===H().length&&!E&&I(e);const t=q(),n=function(e){return"composedPath"in e?e.composedPath()[0]:e.target}(e);"reference"===S.current[0]&&n===w&&(I(e),e.shiftKey?ke(t[t.length-1]):ke(t[1])),"floating"===S.current[1]&&n===b&&e.shiftKey&&(I(e),ke(t[0]))}}const t=A(b);return t.addEventListener("keydown",e),()=>{t.removeEventListener("keydown",e)}}),[o,w,b,a,S,E,H,q]),e.useEffect((()=>{if(!o&&f)return b&&d(w)?(w.addEventListener("focusout",t),w.addEventListener("pointerdown",e),!a&&b.addEventListener("focusout",t),()=>{w.removeEventListener("focusout",t),w.removeEventListener("pointerdown",e),!a&&b.removeEventListener("focusout",t)}):void 0;function e(){j.current=!0,setTimeout((()=>{j.current=!1}))}function t(e){const t=e.relatedTarget;queueMicrotask((()=>{const n=!(T(w,t)||T(b,t)||T(t,b)||T(null==F?void 0:F.portalNode,t)||null!=t&&t.hasAttribute(Be("focus-guard"))||M&&(qe(M.nodesRef.current,h).find((e=>{var n,r;return T(null==(n=e.context)?void 0:n.elements.floating,t)||T(null==(r=e.context)?void 0:r.elements.domReference,t)}))||function(e,t){var n;let r=[],o=null==(n=e.find((e=>e.id===t)))?void 0:n.parentId;for(;o;){const t=e.find((e=>e.id===o));o=null==t?void 0:t.parentId,t&&(r=r.concat(t))}return r}(M.nodesRef.current,h).find((e=>{var n,r;return(null==(n=e.context)?void 0:n.elements.floating)===t||(null==(r=e.context)?void 0:r.elements.domReference)===t}))));t&&n&&!j.current&&t!==pt()&&(V.current=!0,v(!1,e))}))}}),[o,w,b,a,h,M,F,v,f]),e.useEffect((()=>{var e;if(o)return;const t=Array.from((null==F||null==(e=F.portalNode)?void 0:e.querySelectorAll("["+Be("portal")+"]"))||[]);if(b){const e=[b,...t,P.current,W.current,S.current.includes("reference")||E?w:null].filter((e=>null!=e)),n=a||E?Ke(e,R,!R):Ke(e);return()=>{n()}}}),[o,w,b,a,S,F,E,R]),Ae((()=>{if(o||!b)return;const e=C(A(b));queueMicrotask((()=>{const t=q(b),n=O.current,r=("number"==typeof n?t[n]:n.current)||b,o=T(b,e);x||o||!p||ke(r,{preventScroll:r===b})}))}),[o,p,b,x,q,O]),Ae((()=>{if(o||!b)return;let e=!1;const t=A(b),n=C(t),r=y.current;function i(t){let{reason:n,event:r,nested:o}=t;"escape-key"===n&&m.domReference.current&&dt(m.domReference.current),"hover"===n&&"mouseleave"===r.type&&(V.current=!0),"outside-press"===n&&(o?(V.current=!1,e=!0):V.current=!(function(e){return!(0!==e.mozInputSource||!e.isTrusted)||(k()&&e.pointerType?"click"===e.type&&1===e.buttons:0===e.detail&&!e.pointerType)}(r)||L(r)))}return dt(n),g.on("openchange",i),()=>{g.off("openchange",i);const n=C(t),o=T(b,n)||M&&qe(M.nodesRef.current,h).some((e=>{var t;return T(null==(t=e.context)?void 0:t.elements.floating,n)}));(o||r.openEvent&&["click","mousedown"].includes(r.openEvent.type))&&m.domReference.current&&dt(m.domReference.current);const l=pt();N.current&&!V.current&&d(l)&&(l===n||n===t.body||o)&&ke(l,{cancelPrevious:!1,preventScroll:e})}}),[o,b,N,y,m,g,M,h]),Ae((()=>{if(!o&&F)return F.setFocusManagerState({modal:a,closeOnFocusOut:f,open:p,onOpenChange:v,refs:m}),()=>{F.setFocusManagerState(null)}}),[o,F,a,p,v,m,f]),Ae((()=>{if(o||!b||"function"!=typeof MutationObserver||x)return;const e=()=>{const e=b.getAttribute("tabindex");S.current.includes("floating")||C(A(b))!==m.domReference.current&&0===H().length?"0"!==e&&b.setAttribute("tabindex","0"):"-1"!==e&&b.setAttribute("tabindex","-1")};e();const t=new MutationObserver(e);return t.observe(b,{childList:!0,subtree:!0,attributes:!0}),()=>{t.disconnect()}}),[o,b,m,S,H,x]);const U=!o&&R&&(B||a);return e.createElement(e.Fragment,null,U&&e.createElement(it,{"data-type":"inside",ref:null==F?void 0:F.beforeInsideRef,onFocus:e=>{if(a){const e=q();ke("reference"===i[0]?e[0]:e[e.length-1])}else if(null!=F&&F.preserveTabOrder&&F.portalNode)if(V.current=!1,et(e,F.portalNode)){const e=Qe()||w;null==e||e.focus()}else{var t;null==(t=F.beforeOutsideRef.current)||t.focus()}}}),!E&&_("start"),r,_("end"),U&&e.createElement(it,{"data-type":"inside",ref:null==F?void 0:F.afterInsideRef,onFocus:e=>{if(a)ke(q()[0]);else if(null!=F&&F.preserveTabOrder&&F.portalNode)if(f&&(V.current=!0),et(e,F.portalNode)){const e=Ze()||w;null==e||e.focus()}else{var t;null==(t=F.afterOutsideRef.current)||t.focus()}}}))}const vt=new Set,gt=e.forwardRef((function(t,n){let{lockScroll:r=!1,...o}=t;const i=Pe();return Ae((()=>{if(!r)return;vt.add(i);const e=/iP(hone|ad|od)|iOS/.test(O()),t=document.body.style,n=Math.round(document.documentElement.getBoundingClientRect().left)+document.documentElement.scrollLeft?"paddingLeft":"paddingRight",o=window.innerWidth-document.documentElement.clientWidth,l=t.left?parseFloat(t.left):window.pageXOffset,u=t.top?parseFloat(t.top):window.pageYOffset;if(t.overflow="hidden",o&&(t[n]=o+"px"),e){var c,a;const e=(null==(c=window.visualViewport)?void 0:c.offsetLeft)||0,n=(null==(a=window.visualViewport)?void 0:a.offsetTop)||0;Object.assign(t,{position:"fixed",top:-(u-Math.floor(n))+"px",left:-(l-Math.floor(e))+"px",right:"0"})}return()=>{vt.delete(i),0===vt.size&&(Object.assign(t,{overflow:"",[n]:""}),e&&(Object.assign(t,{position:"",top:"",left:"",right:""}),window.scrollTo(l,u)))}}),[i,r]),e.createElement("div",Me({ref:n},o,{style:{position:"fixed",overflow:"auto",top:0,right:0,bottom:0,left:0,...o.style}}))}));let yt;function wt(t){var n;void 0===t&&(t={});const{open:r=!1,onOpenChange:o,nodeId:l}=t;if("production"!==process.env.NODE_ENV){var u;const e="Floating UI: Cannot pass a virtual element to the `elements.reference` option, as it must be a real DOM element. Use `refs.setPositionReference` instead.";var c,a;if(null!=(u=t.elements)&&u.reference&&!f(t.elements.reference))if(null==(c=yt)||!c.has(e))null==(a=yt)||a.add(e),console.error(e)}const[s,d]=e.useState(null),p=(null==(n=t.elements)?void 0:n.reference)||s,m=function(t){void 0===t&&(t={});const{placement:n="bottom",strategy:r="absolute",middleware:o=[],platform:l,elements:{reference:u,floating:c}={},transform:a=!0,whileElementsMounted:s,open:f}=t,[d,p]=e.useState({x:0,y:0,strategy:r,placement:n,middlewareData:{},isPositioned:!1}),[m,h]=e.useState(o);le(m,o)||h(o);const[v,g]=e.useState(null),[y,w]=e.useState(null),b=e.useCallback((e=>{e!==S.current&&(S.current=e,g(e))}),[]),x=e.useCallback((e=>{e!==C.current&&(C.current=e,w(e))}),[]),E=u||v,R=c||y,S=e.useRef(null),C=e.useRef(null),T=e.useRef(d),O=null!=s,N=ae(s),L=ae(l),k=e.useCallback((()=>{if(!S.current||!C.current)return;const e={placement:n,strategy:r,middleware:m};L.current&&(e.platform=L.current),oe(S.current,C.current,e).then((e=>{const t={...e,isPositioned:!0};A.current&&!le(T.current,t)&&(T.current=t,i.flushSync((()=>{p(t)})))}))}),[m,n,r,L]);ie((()=>{!1===f&&T.current.isPositioned&&(T.current.isPositioned=!1,p((e=>({...e,isPositioned:!1}))))}),[f]);const A=e.useRef(!1);ie((()=>(A.current=!0,()=>{A.current=!1})),[]),ie((()=>{if(E&&(S.current=E),R&&(C.current=R),E&&R){if(N.current)return N.current(E,R,k);k()}}),[E,R,k,N,O]);const M=e.useMemo((()=>({reference:S,floating:C,setReference:b,setFloating:x})),[b,x]),I=e.useMemo((()=>({reference:E,floating:R})),[E,R]),D=e.useMemo((()=>{const e={position:r,left:0,top:0};if(!I.floating)return e;const t=ce(I.floating,d.x),n=ce(I.floating,d.y);return a?{...e,transform:"translate("+t+"px, "+n+"px)",...ue(I.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:t,top:n}}),[r,a,I.floating,d.x,d.y]);return e.useMemo((()=>({...d,update:k,refs:M,elements:I,floatingStyles:D})),[d,k,M,I,D])}(t),h=je(),v=null!=((null==(g=e.useContext(We))?void 0:g.id)||null);var g;const y=function(t){const n=e.useRef((()=>{if("production"!==process.env.NODE_ENV)throw new Error("Cannot call an event handler while rendering.")}));return Ne((()=>{n.current=t})),e.useCallback((function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return null==n.current?void 0:n.current(...t)}),[])}(((e,t,n)=>{e&&(b.current.openEvent=t),x.emit("openchange",{open:e,event:t,reason:n,nested:v}),null==o||o(e,t,n)})),w=e.useRef(null),b=e.useRef({}),x=e.useState((()=>function(){const e=new Map;return{emit(t,n){var r;null==(r=e.get(t))||r.forEach((e=>e(n)))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){var r;e.set(t,(null==(r=e.get(t))?void 0:r.filter((e=>e!==n)))||[])}}}()))[0],E=Pe(),R=e.useCallback((e=>{const t=f(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:e}:e;m.refs.setReference(t)}),[m.refs]),S=e.useCallback((e=>{(f(e)||null===e)&&(w.current=e,d(e)),(f(m.refs.reference.current)||null===m.refs.reference.current||null!==e&&!f(e))&&m.refs.setReference(e)}),[m.refs]),C=e.useMemo((()=>({...m.refs,setReference:S,setPositionReference:R,domReference:w})),[m.refs,S,R]),T=e.useMemo((()=>({...m.elements,domReference:p})),[m.elements,p]),O=e.useMemo((()=>({...m,refs:C,elements:T,dataRef:b,nodeId:l,floatingId:E,events:x,open:r,onOpenChange:y})),[m,l,E,x,r,y,C,T]);return Ae((()=>{const e=null==h?void 0:h.nodesRef.current.find((e=>e.id===l));e&&(e.context=O)})),e.useMemo((()=>({...m,context:O,refs:C,elements:T})),[m,C,T,O])}"production"!==process.env.NODE_ENV&&(yt=new Set);var bt=function(e){var n=e.open,r=void 0===n||n,o=e.onClose,i=e.children,l=wt().context;return t.createElement("div",{className:"modal"},t.createElement("div",{className:"modal__content"},t.createElement("div",null,i),t.createElement("div",null,r&&t.createElement(ct,null,t.createElement(gt,{className:"overlay",lockScroll:!0},t.createElement(ht,{context:l},t.createElement("div",{className:"fixed bg-black/80 overflow-auto w-screen h-screen grid place-items-center"},t.createElement("div",{className:"bg-white p-4 inline-block rounded-md shadow-lg"},t.createElement("button",{onClick:function(){o(!1)}},"Close"),t.createElement("div",null,"Modal Content",t.createElement("div",null,t.createElement("input",{type:"text",autoFocus:!0})))))))))))};export{bt as Modal,bt as default};
6
+ var ae=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[href]:not([inert])","button:not([inert])","[tabindex]:not(slot):not([inert])","audio[controls]:not([inert])","video[controls]:not([inert])",'[contenteditable]:not([contenteditable="false"]):not([inert])',"details>summary:first-of-type:not([inert])","details:not([inert])"].join(","),se="undefined"==typeof Element,fe=se?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,de=!se&&Element.prototype.getRootNode?function(e){var t;return null==e||null===(t=e.getRootNode)||void 0===t?void 0:t.call(e)}:function(e){return null==e?void 0:e.ownerDocument},pe=function e(t,n){var r;void 0===n&&(n=!0);var o=null==t||null===(r=t.getAttribute)||void 0===r?void 0:r.call(t,"inert");return""===o||"true"===o||n&&t&&e(t.parentNode)},me=function e(t,n,r){for(var o=[],i=Array.from(t);i.length;){var l=i.shift();if(!pe(l,!1))if("SLOT"===l.tagName){var u=l.assignedElements(),c=e(u.length?u:l.children,!0,r);r.flatten?o.push.apply(o,c):o.push({scopeParent:l,candidates:c})}else{fe.call(l,ae)&&r.filter(l)&&(n||!t.includes(l))&&o.push(l);var a=l.shadowRoot||"function"==typeof r.getShadowRoot&&r.getShadowRoot(l),s=!pe(a,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(l));if(a&&s){var f=e(!0===a?l.children:a.children,!0,r);r.flatten?o.push.apply(o,f):o.push({scopeParent:l,candidates:f})}else i.unshift.apply(i,l.children)}}return o},he=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},ve=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||function(e){var t,n=null==e||null===(t=e.getAttribute)||void 0===t?void 0:t.call(e,"contenteditable");return""===n||"true"===n}(e))&&!he(e)?0:e.tabIndex},ge=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},ye=function(e){return"INPUT"===e.tagName},we=function(e){return function(e){return ye(e)&&"radio"===e.type}(e)&&!function(e){if(!e.name)return!0;var t,n=e.form||de(e),r=function(e){return n.querySelectorAll('input[type="radio"][name="'+e+'"]')};if("undefined"!=typeof window&&void 0!==window.CSS&&"function"==typeof window.CSS.escape)t=r(window.CSS.escape(e.name));else try{t=r(e.name)}catch(e){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",e.message),!1}var o=function(e,t){for(var n=0;n<e.length;n++)if(e[n].checked&&e[n].form===t)return e[n]}(t,e.form);return!o||o===e}(e)},be=function(e){var t=e.getBoundingClientRect(),n=t.width,r=t.height;return 0===n&&0===r},xe=function(e,t){var n=t.displayCheck,r=t.getShadowRoot;if("hidden"===getComputedStyle(e).visibility)return!0;var o=fe.call(e,"details>summary:first-of-type")?e.parentElement:e;if(fe.call(o,"details:not([open]) *"))return!0;if(n&&"full"!==n&&"legacy-full"!==n){if("non-zero-area"===n)return be(e)}else{if("function"==typeof r){for(var i=e;e;){var l=e.parentElement,u=de(e);if(l&&!l.shadowRoot&&!0===r(l))return be(e);e=e.assignedSlot?e.assignedSlot:l||u===e.ownerDocument?l:u.host}e=i}if(function(e){var t,n,r,o,i=e&&de(e),l=null===(t=i)||void 0===t?void 0:t.host,u=!1;if(i&&i!==e)for(u=!!(null!==(n=l)&&void 0!==n&&null!==(r=n.ownerDocument)&&void 0!==r&&r.contains(l)||null!=e&&null!==(o=e.ownerDocument)&&void 0!==o&&o.contains(e));!u&&l;){var c,a,s;u=!(null===(a=l=null===(c=i=de(l))||void 0===c?void 0:c.host)||void 0===a||null===(s=a.ownerDocument)||void 0===s||!s.contains(l))}return u}(e))return!e.getClientRects().length;if("legacy-full"!==n)return!0}return!1},Ee=function(e,t){return!(t.disabled||pe(t)||function(e){return ye(e)&&"hidden"===e.type}(t)||xe(t,e)||function(e){return"DETAILS"===e.tagName&&Array.prototype.slice.apply(e.children).some((function(e){return"SUMMARY"===e.tagName}))}(t)||function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var t=e.parentElement;t;){if("FIELDSET"===t.tagName&&t.disabled){for(var n=0;n<t.children.length;n++){var r=t.children.item(n);if("LEGEND"===r.tagName)return!!fe.call(t,"fieldset[disabled] *")||!r.contains(e)}return!0}t=t.parentElement}return!1}(t))},Re=function(e,t){return!(we(t)||ve(t)<0||!Ee(e,t))},Se=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},Ce=function e(t){var n=[],r=[];return t.forEach((function(t,o){var i=!!t.scopeParent,l=i?t.scopeParent:t,u=function(e,t){var n=ve(e);return n<0&&t&&!he(e)?0:n}(l,i),c=i?e(t.candidates):l;0===u?i?n.push.apply(n,c):n.push(l):r.push({documentOrder:o,tabIndex:u,item:t,isScope:i,content:c})})),r.sort(ge).reduce((function(e,t){return t.isScope?e.push.apply(e,t.content):e.push(t.content),e}),[]).concat(n)},Te=function(e,t){var n;return n=(t=t||{}).getShadowRoot?me([e],t.includeContainer,{filter:Re.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:Se}):function(e,t,n){if(pe(e))return[];var r=Array.prototype.slice.apply(e.querySelectorAll(ae));return t&&fe.call(e,ae)&&r.unshift(e),r.filter(n)}(e,t.includeContainer,Re.bind(null,t)),Ce(n)};const Oe=e["useInsertionEffect".toString()]||(e=>e());let Ne=0;function ke(e,t){void 0===t&&(t={});const{preventScroll:n=!1,cancelPrevious:r=!0,sync:o=!1}=t;r&&cancelAnimationFrame(Ne);const i=()=>null==e?void 0:e.focus({preventScroll:n});o?i():Ne=requestAnimationFrame(i)}var Ae="undefined"!=typeof document?n:r;function Le(){return Le=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Le.apply(this,arguments)}let Me=!1,Ie=0;const De=()=>"floating-ui-"+Ie++;const Fe=e["useId".toString()]||function(){const[t,n]=e.useState((()=>Me?De():void 0));return Ae((()=>{null==t&&n(De())}),[]),e.useEffect((()=>{Me||(Me=!0)}),[]),t};const Pe=e.createContext(null),We=e.createContext(null),Ve=()=>e.useContext(We);function je(e){return"data-floating-ui-"+e}function Be(e){const t=o(e);return Ae((()=>{t.current=e})),t}function He(e,t){let n=e.filter((e=>{var n;return e.parentId===t&&(null==(n=e.context)?void 0:n.open)})),r=n;for(;r.length;)r=e.filter((e=>{var t;return null==(t=r)?void 0:t.some((t=>{var n;return e.parentId===t.id&&(null==(n=e.context)?void 0:n.open)}))})),n=n.concat(r);return n}let qe=new WeakMap,_e=new WeakSet,Ue={},$e=0;const ze=e=>e&&(e.host||ze(e.parentNode)),Xe=(e,t)=>t.map((t=>{if(e.contains(t))return t;const n=ze(t);return e.contains(n)?n:null})).filter((e=>null!=e));function Ye(e,t,n){void 0===t&&(t=!1),void 0===n&&(n=!1);const r=A(e[0]).body;return function(e,t,n,r){const o="data-floating-ui-inert",i=r?"inert":n?"aria-hidden":null,l=Xe(t,e),u=new Set,c=new Set(l),a=[];Ue[o]||(Ue[o]=new WeakMap);const s=Ue[o];return l.forEach((function e(t){t&&!u.has(t)&&(u.add(t),t.parentNode&&e(t.parentNode))})),function e(t){t&&!c.has(t)&&Array.prototype.forEach.call(t.children,(t=>{if(u.has(t))e(t);else{const e=i?t.getAttribute(i):null,n=null!==e&&"false"!==e,r=(qe.get(t)||0)+1,l=(s.get(t)||0)+1;qe.set(t,r),s.set(t,l),a.push(t),1===r&&n&&_e.add(t),1===l&&t.setAttribute(o,""),!n&&i&&t.setAttribute(i,"true")}}))}(t),u.clear(),$e++,()=>{a.forEach((e=>{const t=(qe.get(e)||0)-1,n=(s.get(e)||0)-1;qe.set(e,t),s.set(e,n),t||(!_e.has(e)&&i&&e.removeAttribute(i),_e.delete(e)),n||e.removeAttribute(o)})),$e--,$e||(qe=new WeakMap,qe=new WeakMap,_e=new WeakSet,Ue={})}}(e.concat(Array.from(r.querySelectorAll("[aria-live]"))),r,t,n)}const Ke=()=>({getShadowRoot:!0,displayCheck:"function"==typeof ResizeObserver&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function Ge(e,t){const n=Te(e,Ke());"prev"===t&&n.reverse();const r=n.indexOf(S(A(e)));return n.slice(r+1)[0]}function Je(){return Ge(document.body,"next")}function Qe(){return Ge(document.body,"prev")}function Ze(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!C(n,r)}function et(e){Te(e,Ke()).forEach((e=>{e.dataset.tabindex=e.getAttribute("tabindex")||"",e.setAttribute("tabindex","-1")}))}function tt(e){e.querySelectorAll("[data-tabindex]").forEach((e=>{const t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute("tabindex",t):e.removeAttribute("tabindex")}))}const nt={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0};function rt(e){"Tab"===e.key&&(e.target,clearTimeout(undefined))}const ot=e.forwardRef((function(t,n){const[r,o]=e.useState();Ae((()=>(/apple/i.test(navigator.vendor)&&o("button"),document.addEventListener("keydown",rt),()=>{document.removeEventListener("keydown",rt)})),[]);const i={ref:n,tabIndex:0,role:r,"aria-hidden":!r||void 0,[je("focus-guard")]:"",style:nt};return e.createElement("span",Le({},t,i))})),it=e.createContext(null),lt=je("portal");function ut(t){let{children:n,id:r,root:o=null,preserveTabOrder:i=!0}=t;const u=function(t){let{id:n,root:r}=void 0===t?{}:t;const[o,i]=e.useState(null),l=Fe(),u=ct(),c=e.useRef(null);return Ae((()=>()=>{null==o||o.remove(),queueMicrotask((()=>{c.current=null}))}),[o]),Ae((()=>{if(c.current)return;const e=n?document.getElementById(n):null;if(!e)return;const t=document.createElement("div");t.id=l,t.setAttribute(lt,""),e.appendChild(t),c.current=t,i(t)}),[n,l]),Ae((()=>{if(c.current)return;let e=r||(null==u?void 0:u.portalNode);e&&!f(e)&&(e=e.current),e=e||document.body;let t=null;n&&(t=document.createElement("div"),t.id=n,e.appendChild(t));const o=document.createElement("div");o.id=l,o.setAttribute(lt,""),e=t||e,e.appendChild(o),c.current=o,i(o)}),[n,r,l,u]),o}({id:r,root:o}),[c,a]=e.useState(null),s=e.useRef(null),d=e.useRef(null),p=e.useRef(null),m=e.useRef(null),h=!!c&&!c.modal&&c.open&&i&&!(!o&&!u);return e.useEffect((()=>{if(u&&i&&(null==c||!c.modal))return u.addEventListener("focusin",e,!0),u.addEventListener("focusout",e,!0),()=>{u.removeEventListener("focusin",e,!0),u.removeEventListener("focusout",e,!0)};function e(e){if(u&&Ze(e)){("focusin"===e.type?tt:et)(u)}}}),[u,i,null==c?void 0:c.modal]),e.createElement(it.Provider,{value:e.useMemo((()=>({preserveTabOrder:i,beforeOutsideRef:s,afterOutsideRef:d,beforeInsideRef:p,afterInsideRef:m,portalNode:u,setFocusManagerState:a})),[i,u])},h&&u&&e.createElement(ot,{"data-type":"outside",ref:s,onFocus:e=>{if(Ze(e,u)){var t;null==(t=p.current)||t.focus()}else{const e=Qe()||(null==c?void 0:c.refs.domReference.current);null==e||e.focus()}}}),h&&u&&e.createElement("span",{"aria-owns":u.id,style:nt}),u&&l(n,u),h&&u&&e.createElement(ot,{"data-type":"outside",ref:d,onFocus:e=>{if(Ze(e,u)){var t;null==(t=m.current)||t.focus()}else{const t=Je()||(null==c?void 0:c.refs.domReference.current);null==t||t.focus(),(null==c?void 0:c.closeOnFocusOut)&&(null==c||c.onOpenChange(!1,e.nativeEvent))}}}))}const ct=()=>e.useContext(it),at=20;let st=[];function ft(e){st=st.filter((e=>e.isConnected)),e&&"body"!==u(e)&&(st.push(e),st.length>at&&(st=st.slice(-at)))}function dt(){return st.slice().reverse().find((e=>e.isConnected))}const pt=e.forwardRef((function(t,n){return e.createElement("button",Le({},t,{type:"button",ref:n,tabIndex:-1,style:nt}))}));function mt(t){const{context:n,children:r,disabled:o=!1,order:i=["content"],guards:l=!0,initialFocus:u=0,returnFocus:c=!0,modal:a=!0,visuallyHiddenDismiss:s=!1,closeOnFocusOut:f=!0}=t,{open:p,refs:m,nodeId:h,onOpenChange:v,events:g,dataRef:y,elements:{domReference:w,floating:b}}=n,x="number"==typeof u&&u<0,E=I(w)&&x,R="undefined"==typeof HTMLElement||!("inert"in HTMLElement.prototype)||l,T=Be(i),O=Be(u),L=Be(c),D=Ve(),F=ct(),P=e.useRef(null),W=e.useRef(null),V=e.useRef(!1),j=e.useRef(!1),B=null!=F,H=e.useCallback((function(e){return void 0===e&&(e=b),e?Te(e,Ke()):[]}),[b]),q=e.useCallback((e=>{const t=H(e);return T.current.map((e=>w&&"reference"===e?w:b&&"floating"===e?b:t)).filter(Boolean).flat()}),[w,b,T,H]);function _(t){return!o&&s&&a?e.createElement(pt,{ref:"start"===t?P:W,onClick:e=>v(!1,e.nativeEvent)},"string"==typeof s?s:"Dismiss"):null}e.useEffect((()=>{if(o||!a)return;function e(e){if("Tab"===e.key){C(b,S(A(b)))&&0===H().length&&!E&&M(e);const t=q(),n=function(e){return"composedPath"in e?e.composedPath()[0]:e.target}(e);"reference"===T.current[0]&&n===w&&(M(e),e.shiftKey?ke(t[t.length-1]):ke(t[1])),"floating"===T.current[1]&&n===b&&e.shiftKey&&(M(e),ke(t[0]))}}const t=A(b);return t.addEventListener("keydown",e),()=>{t.removeEventListener("keydown",e)}}),[o,w,b,a,T,E,H,q]),e.useEffect((()=>{if(!o&&f)return b&&d(w)?(w.addEventListener("focusout",t),w.addEventListener("pointerdown",e),!a&&b.addEventListener("focusout",t),()=>{w.removeEventListener("focusout",t),w.removeEventListener("pointerdown",e),!a&&b.removeEventListener("focusout",t)}):void 0;function e(){j.current=!0,setTimeout((()=>{j.current=!1}))}function t(e){const t=e.relatedTarget;queueMicrotask((()=>{const n=!(C(w,t)||C(b,t)||C(t,b)||C(null==F?void 0:F.portalNode,t)||null!=t&&t.hasAttribute(je("focus-guard"))||D&&(He(D.nodesRef.current,h).find((e=>{var n,r;return C(null==(n=e.context)?void 0:n.elements.floating,t)||C(null==(r=e.context)?void 0:r.elements.domReference,t)}))||function(e,t){var n;let r=[],o=null==(n=e.find((e=>e.id===t)))?void 0:n.parentId;for(;o;){const t=e.find((e=>e.id===o));o=null==t?void 0:t.parentId,t&&(r=r.concat(t))}return r}(D.nodesRef.current,h).find((e=>{var n,r;return(null==(n=e.context)?void 0:n.elements.floating)===t||(null==(r=e.context)?void 0:r.elements.domReference)===t}))));t&&n&&!j.current&&t!==dt()&&(V.current=!0,v(!1,e))}))}}),[o,w,b,a,h,D,F,v,f]),e.useEffect((()=>{var e;if(o)return;const t=Array.from((null==F||null==(e=F.portalNode)?void 0:e.querySelectorAll("["+je("portal")+"]"))||[]);if(b){const e=[b,...t,P.current,W.current,T.current.includes("reference")||E?w:null].filter((e=>null!=e)),n=a||E?Ye(e,R,!R):Ye(e);return()=>{n()}}}),[o,w,b,a,T,F,E,R]),Ae((()=>{if(o||!b)return;const e=S(A(b));queueMicrotask((()=>{const t=q(b),n=O.current,r=("number"==typeof n?t[n]:n.current)||b,o=C(b,e);x||o||!p||ke(r,{preventScroll:r===b})}))}),[o,p,b,x,q,O]),Ae((()=>{if(o||!b)return;let e=!1;const t=A(b),n=S(t),r=y.current;function i(t){let{reason:n,event:r,nested:o}=t;"escape-key"===n&&m.domReference.current&&ft(m.domReference.current),"hover"===n&&"mouseleave"===r.type&&(V.current=!0),"outside-press"===n&&(o?(V.current=!1,e=!0):V.current=!(function(e){return!(0!==e.mozInputSource||!e.isTrusted)||(k()&&e.pointerType?"click"===e.type&&1===e.buttons:0===e.detail&&!e.pointerType)}(r)||N(r)))}return ft(n),g.on("openchange",i),()=>{g.off("openchange",i);const n=S(t),o=C(b,n)||D&&He(D.nodesRef.current,h).some((e=>{var t;return C(null==(t=e.context)?void 0:t.elements.floating,n)}));(o||r.openEvent&&["click","mousedown"].includes(r.openEvent.type))&&m.domReference.current&&ft(m.domReference.current);const l=dt();L.current&&!V.current&&d(l)&&(l===n||n===t.body||o)&&ke(l,{cancelPrevious:!1,preventScroll:e})}}),[o,b,L,y,m,g,D,h]),Ae((()=>{if(!o&&F)return F.setFocusManagerState({modal:a,closeOnFocusOut:f,open:p,onOpenChange:v,refs:m}),()=>{F.setFocusManagerState(null)}}),[o,F,a,p,v,m,f]),Ae((()=>{if(o||!b||"function"!=typeof MutationObserver||x)return;const e=()=>{const e=b.getAttribute("tabindex");T.current.includes("floating")||S(A(b))!==m.domReference.current&&0===H().length?"0"!==e&&b.setAttribute("tabindex","0"):"-1"!==e&&b.setAttribute("tabindex","-1")};e();const t=new MutationObserver(e);return t.observe(b,{childList:!0,subtree:!0,attributes:!0}),()=>{t.disconnect()}}),[o,b,m,T,H,x]);const U=!o&&R&&(B||a);return e.createElement(e.Fragment,null,U&&e.createElement(ot,{"data-type":"inside",ref:null==F?void 0:F.beforeInsideRef,onFocus:e=>{if(a){const e=q();ke("reference"===i[0]?e[0]:e[e.length-1])}else if(null!=F&&F.preserveTabOrder&&F.portalNode)if(V.current=!1,Ze(e,F.portalNode)){const e=Je()||w;null==e||e.focus()}else{var t;null==(t=F.beforeOutsideRef.current)||t.focus()}}}),!E&&_("start"),r,_("end"),U&&e.createElement(ot,{"data-type":"inside",ref:null==F?void 0:F.afterInsideRef,onFocus:e=>{if(a)ke(q()[0]);else if(null!=F&&F.preserveTabOrder&&F.portalNode)if(f&&(V.current=!0),Ze(e,F.portalNode)){const e=Qe()||w;null==e||e.focus()}else{var t;null==(t=F.afterOutsideRef.current)||t.focus()}}}))}const ht=new Set,vt=e.forwardRef((function(t,n){let{lockScroll:r=!1,...o}=t;const i=Fe();return Ae((()=>{if(!r)return;ht.add(i);const e=/iP(hone|ad|od)|iOS/.test(T()),t=document.body.style,n=Math.round(document.documentElement.getBoundingClientRect().left)+document.documentElement.scrollLeft?"paddingLeft":"paddingRight",o=window.innerWidth-document.documentElement.clientWidth,l=t.left?parseFloat(t.left):window.pageXOffset,u=t.top?parseFloat(t.top):window.pageYOffset;if(t.overflow="hidden",o&&(t[n]=o+"px"),e){var c,a;const e=(null==(c=window.visualViewport)?void 0:c.offsetLeft)||0,n=(null==(a=window.visualViewport)?void 0:a.offsetTop)||0;Object.assign(t,{position:"fixed",top:-(u-Math.floor(n))+"px",left:-(l-Math.floor(e))+"px",right:"0"})}return()=>{ht.delete(i),0===ht.size&&(Object.assign(t,{overflow:"",[n]:""}),e&&(Object.assign(t,{position:"",top:"",left:"",right:""}),window.scrollTo(l,u)))}}),[i,r]),e.createElement("div",Le({ref:n},o,{style:{position:"fixed",overflow:"auto",top:0,right:0,bottom:0,left:0,...o.style}}))}));let gt;function yt(t){var n;void 0===t&&(t={});const{open:r=!1,onOpenChange:o,nodeId:l}=t;if("production"!==process.env.NODE_ENV){var u;const e="Floating UI: Cannot pass a virtual element to the `elements.reference` option, as it must be a real DOM element. Use `refs.setPositionReference` instead.";var c,a;if(null!=(u=t.elements)&&u.reference&&!f(t.elements.reference))if(null==(c=gt)||!c.has(e))null==(a=gt)||a.add(e),console.error(e)}const[s,d]=e.useState(null),p=(null==(n=t.elements)?void 0:n.reference)||s,m=function(t){void 0===t&&(t={});const{placement:n="bottom",strategy:r="absolute",middleware:o=[],platform:l,elements:{reference:u,floating:c}={},transform:a=!0,whileElementsMounted:s,open:f}=t,[d,p]=e.useState({x:0,y:0,strategy:r,placement:n,middlewareData:{},isPositioned:!1}),[m,h]=e.useState(o);ie(m,o)||h(o);const[v,g]=e.useState(null),[y,w]=e.useState(null),b=e.useCallback((e=>{e!==S.current&&(S.current=e,g(e))}),[]),x=e.useCallback((e=>{e!==C.current&&(C.current=e,w(e))}),[]),E=u||v,R=c||y,S=e.useRef(null),C=e.useRef(null),T=e.useRef(d),O=null!=s,N=ce(s),k=ce(l),A=e.useCallback((()=>{if(!S.current||!C.current)return;const e={placement:n,strategy:r,middleware:m};k.current&&(e.platform=k.current),re(S.current,C.current,e).then((e=>{const t={...e,isPositioned:!0};L.current&&!ie(T.current,t)&&(T.current=t,i.flushSync((()=>{p(t)})))}))}),[m,n,r,k]);oe((()=>{!1===f&&T.current.isPositioned&&(T.current.isPositioned=!1,p((e=>({...e,isPositioned:!1}))))}),[f]);const L=e.useRef(!1);oe((()=>(L.current=!0,()=>{L.current=!1})),[]),oe((()=>{if(E&&(S.current=E),R&&(C.current=R),E&&R){if(N.current)return N.current(E,R,A);A()}}),[E,R,A,N,O]);const M=e.useMemo((()=>({reference:S,floating:C,setReference:b,setFloating:x})),[b,x]),I=e.useMemo((()=>({reference:E,floating:R})),[E,R]),D=e.useMemo((()=>{const e={position:r,left:0,top:0};if(!I.floating)return e;const t=ue(I.floating,d.x),n=ue(I.floating,d.y);return a?{...e,transform:"translate("+t+"px, "+n+"px)",...le(I.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:t,top:n}}),[r,a,I.floating,d.x,d.y]);return e.useMemo((()=>({...d,update:A,refs:M,elements:I,floatingStyles:D})),[d,A,M,I,D])}(t),h=Ve(),v=null!=((null==(g=e.useContext(Pe))?void 0:g.id)||null);var g;const y=function(t){const n=e.useRef((()=>{if("production"!==process.env.NODE_ENV)throw new Error("Cannot call an event handler while rendering.")}));return Oe((()=>{n.current=t})),e.useCallback((function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return null==n.current?void 0:n.current(...t)}),[])}(((e,t,n)=>{e&&(b.current.openEvent=t),x.emit("openchange",{open:e,event:t,reason:n,nested:v}),null==o||o(e,t,n)})),w=e.useRef(null),b=e.useRef({}),x=e.useState((()=>function(){const e=new Map;return{emit(t,n){var r;null==(r=e.get(t))||r.forEach((e=>e(n)))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){var r;e.set(t,(null==(r=e.get(t))?void 0:r.filter((e=>e!==n)))||[])}}}()))[0],E=Fe(),R=e.useCallback((e=>{const t=f(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:e}:e;m.refs.setReference(t)}),[m.refs]),S=e.useCallback((e=>{(f(e)||null===e)&&(w.current=e,d(e)),(f(m.refs.reference.current)||null===m.refs.reference.current||null!==e&&!f(e))&&m.refs.setReference(e)}),[m.refs]),C=e.useMemo((()=>({...m.refs,setReference:S,setPositionReference:R,domReference:w})),[m.refs,S,R]),T=e.useMemo((()=>({...m.elements,domReference:p})),[m.elements,p]),O=e.useMemo((()=>({...m,refs:C,elements:T,dataRef:b,nodeId:l,floatingId:E,events:x,open:r,onOpenChange:y})),[m,l,E,x,r,y,C,T]);return Ae((()=>{const e=null==h?void 0:h.nodesRef.current.find((e=>e.id===l));e&&(e.context=O)})),e.useMemo((()=>({...m,context:O,refs:C,elements:T})),[m,C,T,O])}"production"!==process.env.NODE_ENV&&(gt=new Set);var wt=function(e){var n=e.open,r=void 0===n||n,o=e.onClose,i=e.children,l=yt().context;return t.createElement("div",{className:"modal"},t.createElement("div",{className:"modal__content"},t.createElement("div",null,i),t.createElement("div",null,r&&t.createElement(ut,null,t.createElement(vt,{className:"overlay",lockScroll:!0},t.createElement(mt,{context:l},t.createElement("div",{className:"fixed bg-black/80 overflow-auto w-screen h-screen grid place-items-center"},t.createElement("div",{className:"bg-white p-4 inline-block rounded-md shadow-lg"},t.createElement("button",{onClick:function(){o(!1)}},"Close"),t.createElement("div",null,"Modal Content",t.createElement("div",null,t.createElement("input",{type:"text",autoFocus:!0})))))))))))};export{wt as Modal,wt as default};
@@ -1 +1 @@
1
- 'use client';import e,{useState as a,useEffect as r}from"react";var t=function(t){var l=t.value,n=t.maxValue,m=t.label;console.log(m);var o=a(0),s=o[0],c=o[1];return r((function(){c(l/n*100)}),[l,n]),e.createElement("div",{className:"bg-gray-300 rounded-md"},e.createElement("div",{role:"progressbar",className:"bg-red-800 rounded-md text-right","aria-valuenow":l,"aria-valuemax":n,"aria-valuemin":0,style:{width:"".concat(s,"%")}},e.createElement("span",{className:"text-gray-1000 p-2 text-sm"},m)))};export{t as default};
1
+ 'use client';import r from"react";var e=function(){return e=Object.assign||function(r){for(var e,t=1,o=arguments.length;t<o;t++)for(var a in e=arguments[t])Object.prototype.hasOwnProperty.call(e,a)&&(r[a]=e[a]);return r},e.apply(this,arguments)};"function"==typeof SuppressedError&&SuppressedError;var t=function(r,e){void 0===r&&(r=""),void 0===e&&(e="");var t=e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();return r||(e?"".concat("rad-ui","-").concat(t):"")};function o(e){var o=e.children,a=e.customRootClass,c=t(a,n);return r.createElement("div",{className:c},o)}function a(e){var o=e.value,a=e.minValue,c=void 0===a?0:a,s=e.maxValue,l=void 0===s?100:s,i=e.customRootClass,u=e.renderLabel,p=t(i,n);if(o<c||o>l)throw new Error("value should be smaller then ".concat(c," and bigger then ").concat(l));return r.createElement("div",{role:"progressbar",className:"".concat(p,"-indicator"),style:{transform:"translateX(-".concat(l-o,"%)")},"aria-valuenow":o,"aria-valuemax":l,"aria-valuemin":c},u&&u(o))}var n="Progress";function c(t){var n=t.customRootClass,c=function(r,e){var t={};for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&e.indexOf(o)<0&&(t[o]=r[o]);if(null!=r&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(o=Object.getOwnPropertySymbols(r);a<o.length;a++)e.indexOf(o[a])<0&&Object.prototype.propertyIsEnumerable.call(r,o[a])&&(t[o[a]]=r[o[a]])}return t}(t,["customRootClass"]);return r.createElement(o,{customRootClass:n},r.createElement(a,e({customRootClass:n},c)))}c.displayName=n,c.Root=o,c.Indicator=a;export{n as COMPONENT_NAME,c as default};
@@ -0,0 +1 @@
1
+ 'use client';import e from"react";var r=function(){return r=Object.assign||function(e){for(var r,t=1,a=arguments.length;t<a;t++)for(var n in r=arguments[t])Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n]);return e},r.apply(this,arguments)};function t(e,r){var t={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&r.indexOf(a)<0&&(t[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(a=Object.getOwnPropertySymbols(e);n<a.length;n++)r.indexOf(a[n])<0&&Object.prototype.propertyIsEnumerable.call(e,a[n])&&(t[a[n]]=e[a[n]])}return t}"function"==typeof SuppressedError&&SuppressedError;var a=function(a){var n=a.children,c=a.className,l=void 0===c?"":c,o=a.customRootClass,s=void 0===o?"":o,i=t(a,["children","className","customRootClass"]),u=function(e,r){void 0===e&&(e=""),void 0===r&&(r="");var t=r.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();return e||(r?"".concat("rad-ui","-").concat(t):"")}(s,"Table");return e.createElement("div",r({className:"".concat(u,"-wrapper ").concat(l)},i),e.createElement("table",{className:u},n))},n=function(a){var n=a.children,c=a.className,l=void 0===c?"header":c,o=t(a,["children","className"]);return e.createElement("thead",r({className:l},o),n)},c=function(a){var n=a.children,c=a.className,l=void 0===c?"":c,o=t(a,["children","className"]);return e.createElement("tbody",r({className:l},o),n)},l=function(a){var n=a.children,c=a.className,l=void 0===c?"row":c,o=t(a,["children","className"]);return e.createElement("tr",r({className:l},o),n)},o=function(a){var n=a.children,c=a.className,l=void 0===c?"cell-header":c,o=t(a,["children","className"]);return e.createElement("th",r({className:l},o),n)},s=function(a){var n=a.children,c=a.className,l=void 0===c?"cell":c,o=t(a,["children","className"]);return e.createElement("td",r({className:l},o),n)},i=function(r){var t=r.columns,i=void 0===t?[]:t,u=r.data,m=void 0===u?[]:u,d=i.map((function(e){return(null==e?void 0:e.key)||""}));return e.createElement(a,null,e.createElement(n,null,e.createElement(l,null,i.map((function(r){return e.createElement(o,{key:(null==r?void 0:r.key)||""},(null==r?void 0:r.name)||"")})))),e.createElement(c,null,m.map((function(r){return e.createElement(l,{key:r.id},d.map((function(t){if(r[t])return e.createElement(s,{key:t},r[t])})))}))))};i.Root=a,i.Body=c,i.Head=n,i.Row=l;export{i as default};
@@ -1 +1 @@
1
- 'use client';import*as e from"react";import t,{useLayoutEffect as n,useEffect as r,useRef as o,useState as i}from"react";import*as l from"react-dom";var c=function(){return c=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},c.apply(this,arguments)};function s(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}"function"==typeof SuppressedError&&SuppressedError;function a(e){return d(e)?(e.nodeName||"").toLowerCase():"#document"}function u(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function f(e){var t;return null==(t=(d(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function d(e){return e instanceof Node||e instanceof u(e).Node}function p(e){return e instanceof Element||e instanceof u(e).Element}function m(e){return e instanceof HTMLElement||e instanceof u(e).HTMLElement}function v(e){return"undefined"!=typeof ShadowRoot&&(e instanceof ShadowRoot||e instanceof u(e).ShadowRoot)}function g(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=E(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function h(e){return["table","td","th"].includes(a(e))}function y(e){const t=b(),n=E(e);return"none"!==n.transform||"none"!==n.perspective||!!n.containerType&&"normal"!==n.containerType||!t&&!!n.backdropFilter&&"none"!==n.backdropFilter||!t&&!!n.filter&&"none"!==n.filter||["transform","perspective","filter"].some((e=>(n.willChange||"").includes(e)))||["paint","layout","strict","content"].some((e=>(n.contain||"").includes(e)))}function w(e){let t=L(e);for(;m(t)&&!x(t);){if(y(t))return t;t=L(t)}return null}function b(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function x(e){return["html","body","#document"].includes(a(e))}function E(e){return u(e).getComputedStyle(e)}function R(e){return p(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function L(e){if("html"===a(e))return e;const t=e.assignedSlot||e.parentNode||v(e)&&e.host||f(e);return v(t)?t.host:t}function P(e){const t=L(e);return x(t)?e.ownerDocument?e.ownerDocument.body:e.body:m(t)&&g(t)?t:P(t)}function C(e,t,n){var r;void 0===t&&(t=[]),void 0===n&&(n=!0);const o=P(e),i=o===(null==(r=e.ownerDocument)?void 0:r.body),l=u(o);return i?t.concat(l,l.visualViewport||[],g(o)?o:[],l.frameElement&&n?C(l.frameElement):[]):t.concat(o,C(o,[],n))}function O(e,t){if(!e||!t)return!1;const n=null==t.getRootNode?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&v(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function T(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}function k(e){return(null==e?void 0:e.ownerDocument)||document}function S(e,t){if(null==t)return!1;if("composedPath"in e)return e.composedPath().includes(t);const n=e;return null!=n.target&&t.contains(n.target)}function D(e){return"composedPath"in e?e.composedPath()[0]:e.target}const M=["top","right","bottom","left"],A=Math.min,N=Math.max,F=Math.round,H=Math.floor,W=e=>({x:e,y:e}),B={left:"right",right:"left",bottom:"top",top:"bottom"},I={start:"end",end:"start"};function _(e,t,n){return N(e,A(t,n))}function V(e,t){return"function"==typeof e?e(t):e}function j(e){return e.split("-")[0]}function K(e){return e.split("-")[1]}function z(e){return"x"===e?"y":"x"}function X(e){return"y"===e?"height":"width"}function $(e){return["top","bottom"].includes(j(e))?"y":"x"}function Y(e){return z($(e))}function q(e){return e.replace(/start|end/g,(e=>I[e]))}function U(e){return e.replace(/left|right|bottom|top/g,(e=>B[e]))}function Z(e){return"number"!=typeof e?function(e){return{top:0,right:0,bottom:0,left:0,...e}}(e):{top:e,right:e,bottom:e,left:e}}function Q(e){return{...e,top:e.y,left:e.x,right:e.x+e.width,bottom:e.y+e.height}}function G(e,t,n){let{reference:r,floating:o}=e;const i=$(t),l=Y(t),c=X(l),s=j(t),a="y"===i,u=r.x+r.width/2-o.width/2,f=r.y+r.height/2-o.height/2,d=r[c]/2-o[c]/2;let p;switch(s){case"top":p={x:u,y:r.y-o.height};break;case"bottom":p={x:u,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:f};break;case"left":p={x:r.x-o.width,y:f};break;default:p={x:r.x,y:r.y}}switch(K(t)){case"start":p[l]-=d*(n&&a?-1:1);break;case"end":p[l]+=d*(n&&a?-1:1)}return p}async function J(e,t){var n;void 0===t&&(t={});const{x:r,y:o,platform:i,rects:l,elements:c,strategy:s}=e,{boundary:a="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:d=!1,padding:p=0}=V(t,e),m=Z(p),v=c[d?"floating"===f?"reference":"floating":f],g=Q(await i.getClippingRect({element:null==(n=await(null==i.isElement?void 0:i.isElement(v)))||n?v:v.contextElement||await(null==i.getDocumentElement?void 0:i.getDocumentElement(c.floating)),boundary:a,rootBoundary:u,strategy:s})),h="floating"===f?{...l.floating,x:r,y:o}:l.reference,y=await(null==i.getOffsetParent?void 0:i.getOffsetParent(c.floating)),w=await(null==i.isElement?void 0:i.isElement(y))&&await(null==i.getScale?void 0:i.getScale(y))||{x:1,y:1},b=Q(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:h,offsetParent:y,strategy:s}):h);return{top:(g.top-b.top+m.top)/w.y,bottom:(b.bottom-g.bottom+m.bottom)/w.y,left:(g.left-b.left+m.left)/w.x,right:(b.right-g.right+m.right)/w.x}}function ee(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function te(e){return M.some((t=>e[t]>=0))}const ne=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:l,middlewareData:c}=t,s=await async function(e,t){const{placement:n,platform:r,elements:o}=e,i=await(null==r.isRTL?void 0:r.isRTL(o.floating)),l=j(n),c=K(n),s="y"===$(n),a=["left","top"].includes(l)?-1:1,u=i&&s?-1:1,f=V(t,e);let{mainAxis:d,crossAxis:p,alignmentAxis:m}="number"==typeof f?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...f};return c&&"number"==typeof m&&(p="end"===c?-1*m:m),s?{x:p*u,y:d*a}:{x:d*a,y:p*u}}(t,e);return l===(null==(n=c.offset)?void 0:n.placement)&&null!=(r=c.arrow)&&r.alignmentOffset?{}:{x:o+s.x,y:i+s.y,data:{...s,placement:l}}}}};function re(e){const t=E(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=m(e),i=o?e.offsetWidth:n,l=o?e.offsetHeight:r,c=F(n)!==i||F(r)!==l;return c&&(n=i,r=l),{width:n,height:r,$:c}}function oe(e){return p(e)?e:e.contextElement}function ie(e){const t=oe(e);if(!m(t))return W(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=re(t);let l=(i?F(n.width):n.width)/r,c=(i?F(n.height):n.height)/o;return l&&Number.isFinite(l)||(l=1),c&&Number.isFinite(c)||(c=1),{x:l,y:c}}const le=W(0);function ce(e){const t=u(e);return b()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:le}function se(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);const o=e.getBoundingClientRect(),i=oe(e);let l=W(1);t&&(r?p(r)&&(l=ie(r)):l=ie(e));const c=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==u(e))&&t}(i,n,r)?ce(i):W(0);let s=(o.left+c.x)/l.x,a=(o.top+c.y)/l.y,f=o.width/l.x,d=o.height/l.y;if(i){const e=u(i),t=r&&p(r)?u(r):r;let n=e.frameElement;for(;n&&r&&t!==e;){const e=ie(n),t=n.getBoundingClientRect(),r=E(n),o=t.left+(n.clientLeft+parseFloat(r.paddingLeft))*e.x,i=t.top+(n.clientTop+parseFloat(r.paddingTop))*e.y;s*=e.x,a*=e.y,f*=e.x,d*=e.y,s+=o,a+=i,n=u(n).frameElement}}return Q({width:f,height:d,x:s,y:a})}const ae=[":popover-open",":modal"];function ue(e){let t=!1,n=0,r=0;if(ae.forEach((n=>{!function(n){try{t=t||e.matches(n)}catch(e){}}(n)})),t){const t=w(e);if(t){const e=t.getBoundingClientRect();n=e.x,r=e.y}}return[t,n,r]}function fe(e){return se(f(e)).left+R(e).scrollLeft}function de(e,t,n){let r;if("viewport"===t)r=function(e,t){const n=u(e),r=f(e),o=n.visualViewport;let i=r.clientWidth,l=r.clientHeight,c=0,s=0;if(o){i=o.width,l=o.height;const e=b();(!e||e&&"fixed"===t)&&(c=o.offsetLeft,s=o.offsetTop)}return{width:i,height:l,x:c,y:s}}(e,n);else if("document"===t)r=function(e){const t=f(e),n=R(e),r=e.ownerDocument.body,o=N(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=N(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let l=-n.scrollLeft+fe(e);const c=-n.scrollTop;return"rtl"===E(r).direction&&(l+=N(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:l,y:c}}(f(e));else if(p(t))r=function(e,t){const n=se(e,!0,"fixed"===t),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=m(e)?ie(e):W(1);return{width:e.clientWidth*i.x,height:e.clientHeight*i.y,x:o*i.x,y:r*i.y}}(t,n);else{const n=ce(e);r={...t,x:t.x-n.x,y:t.y-n.y}}return Q(r)}function pe(e,t){const n=L(e);return!(n===t||!p(n)||x(n))&&("fixed"===E(n).position||pe(n,t))}function me(e,t,n,r){const o=m(t),i=f(t),l="fixed"===n,c=se(e,!0,l,t);let s={scrollLeft:0,scrollTop:0};const u=W(0);if(o||!o&&!l)if(("body"!==a(t)||g(i))&&(s=R(t)),o){const e=se(t,!0,l,t);u.x=e.x+t.clientLeft,u.y=e.y+t.clientTop}else i&&(u.x=fe(i));let d=c.left+s.scrollLeft-u.x,p=c.top+s.scrollTop-u.y;const[v,h,y]=ue(r);return v&&(d+=h,p+=y,o&&(d+=t.clientLeft,p+=t.clientTop)),{x:d,y:p,width:c.width,height:c.height}}function ve(e,t){return m(e)&&"fixed"!==E(e).position?t?t(e):e.offsetParent:null}function ge(e,t){const n=u(e);if(!m(e))return n;let r=ve(e,t);for(;r&&h(r)&&"static"===E(r).position;)r=ve(r,t);return r&&("html"===a(r)||"body"===a(r)&&"static"===E(r).position&&!y(r))?n:r||w(e)||n}const he={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i=f(r),[l]=t?ue(t.floating):[!1];if(r===i||l)return n;let c={scrollLeft:0,scrollTop:0},s=W(1);const u=W(0),d=m(r);if((d||!d&&"fixed"!==o)&&(("body"!==a(r)||g(i))&&(c=R(r)),m(r))){const e=se(r);s=ie(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}return{width:n.width*s.x,height:n.height*s.y,x:n.x*s.x-c.scrollLeft*s.x+u.x,y:n.y*s.y-c.scrollTop*s.y+u.y}},getDocumentElement:f,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[..."clippingAncestors"===n?function(e,t){const n=t.get(e);if(n)return n;let r=C(e,[],!1).filter((e=>p(e)&&"body"!==a(e))),o=null;const i="fixed"===E(e).position;let l=i?L(e):e;for(;p(l)&&!x(l);){const t=E(l),n=y(l);n||"fixed"!==t.position||(o=null),(i?!n&&!o:!n&&"static"===t.position&&o&&["absolute","fixed"].includes(o.position)||g(l)&&!n&&pe(e,l))?r=r.filter((e=>e!==l)):o=t,l=L(l)}return t.set(e,r),r}(t,this._c):[].concat(n),r],l=i[0],c=i.reduce(((e,n)=>{const r=de(t,n,o);return e.top=N(r.top,e.top),e.right=A(r.right,e.right),e.bottom=A(r.bottom,e.bottom),e.left=N(r.left,e.left),e}),de(t,l,o));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}},getOffsetParent:ge,getElementRects:async function(e){const t=this.getOffsetParent||ge,n=this.getDimensions;return{reference:me(e.reference,await t(e.floating),e.strategy,e.floating),floating:{x:0,y:0,...await n(e.floating)}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){const{width:t,height:n}=re(e);return{width:t,height:n}},getScale:ie,isElement:p,isRTL:function(e){return"rtl"===E(e).direction}};function ye(e,t,n,r){void 0===r&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:l="function"==typeof ResizeObserver,layoutShift:c="function"==typeof IntersectionObserver,animationFrame:s=!1}=r,a=oe(e),u=o||i?[...a?C(a):[],...C(t)]:[];u.forEach((e=>{o&&e.addEventListener("scroll",n,{passive:!0}),i&&e.addEventListener("resize",n)}));const d=a&&c?function(e,t){let n,r=null;const o=f(e);function i(){var e;clearTimeout(n),null==(e=r)||e.disconnect(),r=null}return function l(c,s){void 0===c&&(c=!1),void 0===s&&(s=1),i();const{left:a,top:u,width:f,height:d}=e.getBoundingClientRect();if(c||t(),!f||!d)return;const p={rootMargin:-H(u)+"px "+-H(o.clientWidth-(a+f))+"px "+-H(o.clientHeight-(u+d))+"px "+-H(a)+"px",threshold:N(0,A(1,s))||1};let m=!0;function v(e){const t=e[0].intersectionRatio;if(t!==s){if(!m)return l();t?l(!1,t):n=setTimeout((()=>{l(!1,1e-7)}),100)}m=!1}try{r=new IntersectionObserver(v,{...p,root:o.ownerDocument})}catch(e){r=new IntersectionObserver(v,p)}r.observe(e)}(!0),i}(a,n):null;let p,m=-1,v=null;l&&(v=new ResizeObserver((e=>{let[r]=e;r&&r.target===a&&v&&(v.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame((()=>{var e;null==(e=v)||e.observe(t)}))),n()})),a&&!s&&v.observe(a),v.observe(t));let g=s?se(e):null;return s&&function t(){const r=se(e);!g||r.x===g.x&&r.y===g.y&&r.width===g.width&&r.height===g.height||n();g=r,p=requestAnimationFrame(t)}(),n(),()=>{var e;u.forEach((e=>{o&&e.removeEventListener("scroll",n),i&&e.removeEventListener("resize",n)})),null==d||d(),null==(e=v)||e.disconnect(),v=null,s&&cancelAnimationFrame(p)}}const we=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:i=!0,crossAxis:l=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...s}=V(e,t),a={x:n,y:r},u=await J(t,s),f=$(j(o)),d=z(f);let p=a[d],m=a[f];if(i){const e="y"===d?"bottom":"right";p=_(p+u["y"===d?"top":"left"],p,p-u[e])}if(l){const e="y"===f?"bottom":"right";m=_(m+u["y"===f?"top":"left"],m,m-u[e])}const v=c.fn({...t,[d]:p,[f]:m});return{...v,data:{x:v.x-n,y:v.y-r}}}}},be=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:l,initialPlacement:c,platform:s,elements:a}=t,{mainAxis:u=!0,crossAxis:f=!0,fallbackPlacements:d,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:v=!0,...g}=V(e,t);if(null!=(n=i.arrow)&&n.alignmentOffset)return{};const h=j(o),y=j(c)===c,w=await(null==s.isRTL?void 0:s.isRTL(a.floating)),b=d||(y||!v?[U(c)]:function(e){const t=U(e);return[q(e),t,q(t)]}(c));d||"none"===m||b.push(...function(e,t,n,r){const o=K(e);let i=function(e,t,n){const r=["left","right"],o=["right","left"],i=["top","bottom"],l=["bottom","top"];switch(e){case"top":case"bottom":return n?t?o:r:t?r:o;case"left":case"right":return t?i:l;default:return[]}}(j(e),"start"===n,r);return o&&(i=i.map((e=>e+"-"+o)),t&&(i=i.concat(i.map(q)))),i}(c,v,m,w));const x=[c,...b],E=await J(t,g),R=[];let L=(null==(r=i.flip)?void 0:r.overflows)||[];if(u&&R.push(E[h]),f){const e=function(e,t,n){void 0===n&&(n=!1);const r=K(e),o=Y(e),i=X(o);let l="x"===o?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[i]>t.floating[i]&&(l=U(l)),[l,U(l)]}(o,l,w);R.push(E[e[0]],E[e[1]])}if(L=[...L,{placement:o,overflows:R}],!R.every((e=>e<=0))){var P,C;const e=((null==(P=i.flip)?void 0:P.index)||0)+1,t=x[e];if(t)return{data:{index:e,overflows:L},reset:{placement:t}};let n=null==(C=L.filter((e=>e.overflows[0]<=0)).sort(((e,t)=>e.overflows[1]-t.overflows[1]))[0])?void 0:C.placement;if(!n)switch(p){case"bestFit":{var O;const e=null==(O=L.map((e=>[e.placement,e.overflows.filter((e=>e>0)).reduce(((e,t)=>e+t),0)])).sort(((e,t)=>e[1]-t[1]))[0])?void 0:O[0];e&&(n=e);break}case"initialPlacement":n=c}if(o!==n)return{reset:{placement:n}}}return{}}}},xe=function(e){return void 0===e&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...o}=V(e,t);switch(r){case"referenceHidden":{const e=ee(await J(t,{...o,elementContext:"reference"}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:te(e)}}}case"escaped":{const e=ee(await J(t,{...o,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:te(e)}}}default:return{}}}}},Ee=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:i,platform:l,elements:c,middlewareData:s}=t,{element:a,padding:u=0}=V(e,t)||{};if(null==a)return{};const f=Z(u),d={x:n,y:r},p=Y(o),m=X(p),v=await l.getDimensions(a),g="y"===p,h=g?"top":"left",y=g?"bottom":"right",w=g?"clientHeight":"clientWidth",b=i.reference[m]+i.reference[p]-d[p]-i.floating[m],x=d[p]-i.reference[p],E=await(null==l.getOffsetParent?void 0:l.getOffsetParent(a));let R=E?E[w]:0;R&&await(null==l.isElement?void 0:l.isElement(E))||(R=c.floating[w]||i.floating[m]);const L=b/2-x/2,P=R/2-v[m]/2-1,C=A(f[h],P),O=A(f[y],P),T=C,k=R-v[m]-O,S=R/2-v[m]/2+L,D=_(T,S,k),M=!s.arrow&&null!=K(o)&&S!==D&&i.reference[m]/2-(S<T?C:O)-v[m]/2<0,N=M?S<T?S-T:S-k:0;return{[p]:d[p]+N,data:{[p]:D,centerOffset:S-D-N,...M&&{alignmentOffset:N}},reset:M}}}),Re=(e,t,n)=>{const r=new Map,o={platform:he,...n},i={...o.platform,_c:r};return(async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:l}=n,c=i.filter(Boolean),s=await(null==l.isRTL?void 0:l.isRTL(t));let a=await l.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:f}=G(a,r,s),d=r,p={},m=0;for(let n=0;n<c.length;n++){const{name:i,fn:v}=c[n],{x:g,y:h,data:y,reset:w}=await v({x:u,y:f,initialPlacement:r,placement:d,strategy:o,middlewareData:p,rects:a,platform:l,elements:{reference:e,floating:t}});u=null!=g?g:u,f=null!=h?h:f,p={...p,[i]:{...p[i],...y}},w&&m<=50&&(m++,"object"==typeof w&&(w.placement&&(d=w.placement),w.rects&&(a=!0===w.rects?await l.getElementRects({reference:e,floating:t,strategy:o}):w.rects),({x:u,y:f}=G(a,d,s))),n=-1)}return{x:u,y:f,placement:d,strategy:o,middlewareData:p}})(e,t,{...o,platform:i})};var Le="undefined"!=typeof document?n:r;function Pe(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;0!=r--;)if(!Pe(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;0!=r--;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;0!=r--;){const n=o[r];if(("_owner"!==n||!e.$$typeof)&&!Pe(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function Ce(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Oe(e,t){const n=Ce(e);return Math.round(t*n)/n}function Te(t){const n=e.useRef(t);return Le((()=>{n.current=t})),n}const ke=e["useInsertionEffect".toString()]||(e=>e());function Se(t){const n=e.useRef((()=>{if("production"!==process.env.NODE_ENV)throw new Error("Cannot call an event handler while rendering.")}));return ke((()=>{n.current=t})),e.useCallback((function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return null==n.current?void 0:n.current(...t)}),[])}var De="undefined"!=typeof document?n:r;function Me(){return Me=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Me.apply(this,arguments)}let Ae=!1,Ne=0;const Fe=()=>"floating-ui-"+Ne++;const He=e["useId".toString()]||function(){const[t,n]=e.useState((()=>Ae?Fe():void 0));return De((()=>{null==t&&n(Fe())}),[]),e.useEffect((()=>{Ae||(Ae=!0)}),[]),t},We=e.forwardRef((function(t,n){let{context:{placement:r,elements:{floating:o},middlewareData:{arrow:i}},width:l=14,height:c=7,tipRadius:s=0,strokeWidth:a=0,staticOffset:u,stroke:f,d:d,style:{transform:p,...m}={},...v}=t;"production"!==process.env.NODE_ENV&&(n||console.warn("Floating UI: The `ref` prop is required for the `FloatingArrow`","component."));const g=He();if(!o)return null;a*=2;const h=a/2,y=l/2*(s/-8+1),w=c/2*s/4,[b,x]=r.split("-"),E=he.isRTL(o),R=!!d,L="top"===b||"bottom"===b,P=u&&"end"===x?"bottom":"top";let C=u&&"end"===x?"right":"left";u&&E&&(C="end"===x?"left":"right");const O=null!=(null==i?void 0:i.x)?u||i.x:"",T=null!=(null==i?void 0:i.y)?u||i.y:"",k=d||"M0,0 H"+l+" L"+(l-y)+","+(c-w)+" Q"+l/2+","+c+" "+y+","+(c-w)+" Z",S={top:R?"rotate(180deg)":"",left:R?"rotate(90deg)":"rotate(-90deg)",bottom:R?"":"rotate(180deg)",right:R?"rotate(-90deg)":"rotate(90deg)"}[b];return e.createElement("svg",Me({},v,{"aria-hidden":!0,ref:n,width:R?l:l+a,height:l,viewBox:"0 0 "+l+" "+(c>l?c:l),style:{position:"absolute",pointerEvents:"none",[C]:O,[P]:T,[b]:L||R?"100%":"calc(100% - "+a/2+"px)",transform:""+S+(null!=p?p:""),...m}}),a>0&&e.createElement("path",{clipPath:"url(#"+g+")",fill:"none",stroke:f,strokeWidth:a+(d?0:1),d:k}),e.createElement("path",{stroke:a&&!d?v.fill:"none",d:k}),e.createElement("clipPath",{id:g},e.createElement("rect",{x:-h,y:h*(R?-1:1),width:l+a,height:l})))}));const Be=e.createContext(null),Ie=e.createContext(null),_e=()=>{var t;return(null==(t=e.useContext(Be))?void 0:t.id)||null},Ve=()=>e.useContext(Ie);function je(e){return"data-floating-ui-"+e}function Ke(e){const t=o(e);return De((()=>{t.current=e})),t}const ze=je("safe-polygon");function Xe(e,t,n){return n&&!T(n)?0:"number"==typeof e?e:null==e?void 0:e[t]}function $e(e,t){let n=e.filter((e=>{var n;return e.parentId===t&&(null==(n=e.context)?void 0:n.open)})),r=n;for(;r.length;)r=e.filter((e=>{var t;return null==(t=r)?void 0:t.some((t=>{var n;return e.parentId===t.id&&(null==(n=e.context)?void 0:n.open)}))})),n=n.concat(r);return n}const Ye={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},qe={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},Ue=e=>{var t,n;return{escapeKey:"boolean"==typeof e?e:null!=(t=null==e?void 0:e.escapeKey)&&t,outsidePress:"boolean"==typeof e?e:null==(n=null==e?void 0:e.outsidePress)||n}};let Ze;function Qe(t){var n;void 0===t&&(t={});const{open:r=!1,onOpenChange:o,nodeId:i}=t;if("production"!==process.env.NODE_ENV){var c;const e="Floating UI: Cannot pass a virtual element to the `elements.reference` option, as it must be a real DOM element. Use `refs.setPositionReference` instead.";var s,a;if(null!=(c=t.elements)&&c.reference&&!p(t.elements.reference))if(null==(s=Ze)||!s.has(e))null==(a=Ze)||a.add(e),console.error(e)}const[u,f]=e.useState(null),d=(null==(n=t.elements)?void 0:n.reference)||u,m=function(t){void 0===t&&(t={});const{placement:n="bottom",strategy:r="absolute",middleware:o=[],platform:i,elements:{reference:c,floating:s}={},transform:a=!0,whileElementsMounted:u,open:f}=t,[d,p]=e.useState({x:0,y:0,strategy:r,placement:n,middlewareData:{},isPositioned:!1}),[m,v]=e.useState(o);Pe(m,o)||v(o);const[g,h]=e.useState(null),[y,w]=e.useState(null),b=e.useCallback((e=>{e!==L.current&&(L.current=e,h(e))}),[]),x=e.useCallback((e=>{e!==P.current&&(P.current=e,w(e))}),[]),E=c||g,R=s||y,L=e.useRef(null),P=e.useRef(null),C=e.useRef(d),O=null!=u,T=Te(u),k=Te(i),S=e.useCallback((()=>{if(!L.current||!P.current)return;const e={placement:n,strategy:r,middleware:m};k.current&&(e.platform=k.current),Re(L.current,P.current,e).then((e=>{const t={...e,isPositioned:!0};D.current&&!Pe(C.current,t)&&(C.current=t,l.flushSync((()=>{p(t)})))}))}),[m,n,r,k]);Le((()=>{!1===f&&C.current.isPositioned&&(C.current.isPositioned=!1,p((e=>({...e,isPositioned:!1}))))}),[f]);const D=e.useRef(!1);Le((()=>(D.current=!0,()=>{D.current=!1})),[]),Le((()=>{if(E&&(L.current=E),R&&(P.current=R),E&&R){if(T.current)return T.current(E,R,S);S()}}),[E,R,S,T,O]);const M=e.useMemo((()=>({reference:L,floating:P,setReference:b,setFloating:x})),[b,x]),A=e.useMemo((()=>({reference:E,floating:R})),[E,R]),N=e.useMemo((()=>{const e={position:r,left:0,top:0};if(!A.floating)return e;const t=Oe(A.floating,d.x),n=Oe(A.floating,d.y);return a?{...e,transform:"translate("+t+"px, "+n+"px)",...Ce(A.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:t,top:n}}),[r,a,A.floating,d.x,d.y]);return e.useMemo((()=>({...d,update:S,refs:M,elements:A,floatingStyles:N})),[d,S,M,A,N])}(t),v=Ve(),g=null!=_e(),h=Se(((e,t,n)=>{e&&(w.current.openEvent=t),b.emit("openchange",{open:e,event:t,reason:n,nested:g}),null==o||o(e,t,n)})),y=e.useRef(null),w=e.useRef({}),b=e.useState((()=>function(){const e=new Map;return{emit(t,n){var r;null==(r=e.get(t))||r.forEach((e=>e(n)))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){var r;e.set(t,(null==(r=e.get(t))?void 0:r.filter((e=>e!==n)))||[])}}}()))[0],x=He(),E=e.useCallback((e=>{const t=p(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:e}:e;m.refs.setReference(t)}),[m.refs]),R=e.useCallback((e=>{(p(e)||null===e)&&(y.current=e,f(e)),(p(m.refs.reference.current)||null===m.refs.reference.current||null!==e&&!p(e))&&m.refs.setReference(e)}),[m.refs]),L=e.useMemo((()=>({...m.refs,setReference:R,setPositionReference:E,domReference:y})),[m.refs,R,E]),P=e.useMemo((()=>({...m.elements,domReference:d})),[m.elements,d]),C=e.useMemo((()=>({...m,refs:L,elements:P,dataRef:w,nodeId:i,floatingId:x,events:b,open:r,onOpenChange:h})),[m,i,x,b,r,h,L,P]);return De((()=>{const e=null==v?void 0:v.nodesRef.current.find((e=>e.id===i));e&&(e.context=C)})),e.useMemo((()=>({...m,context:C,refs:L,elements:P})),[m,L,P,C])}"production"!==process.env.NODE_ENV&&(Ze=new Set);const Ge="active",Je="selected";function et(e,t,n){const r=new Map,o="item"===n;let i=e;if(o&&e){const{[Ge]:t,[Je]:n,...r}=e;i=r}return{..."floating"===n&&{tabIndex:-1},...i,...t.map((t=>{const r=t?t[n]:null;return"function"==typeof r?e?r(e):null:r})).concat(e).reduce(((e,t)=>t?(Object.entries(t).forEach((t=>{let[n,i]=t;var l;o&&[Ge,Je].includes(n)||(0===n.indexOf("on")?(r.has(n)||r.set(n,[]),"function"==typeof i&&(null==(l=r.get(n))||l.push(i),e[n]=function(){for(var e,t=arguments.length,o=new Array(t),i=0;i<t;i++)o[i]=arguments[i];return null==(e=r.get(n))?void 0:e.map((e=>e(...o))).find((e=>void 0!==e))})):e[n]=i)})),e):e),{})}}const tt=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);var nt=function(n){var r=n.popperName,l=void 0===r?"":r,a=n.customRootClass,u=void 0===a?"":a;n.activationStrategy;var f=n.className,d=void 0===f?"":f,v=n.placement,g=void 0===v?"top":v,h=n.children,y=n.open,w=void 0!==y&&y;n.hoverDelay;var b=n.showArrow,R=void 0===b||b,P=n.pop,M=void 0===P?t.createElement(t.Fragment,null):P;s(n,["popperName","customRootClass","activationStrategy","className","placement","children","open","hoverDelay","showArrow","pop"]);var A,N=function(e,t){void 0===e&&(e=""),void 0===t&&(t="");var n=t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();return e||(t?"".concat("rad-ui","-").concat(n):"")}(u,l),F=o(null),H=i(w),W=H[0],B=H[1],I=Qe({placement:g,whileElementsMounted:ye,open:W,middleware:[(A={element:F},{name:"arrow",options:A,fn(e){const{element:t,padding:n}="function"==typeof A?A(e):A;return t&&(r=t,{}.hasOwnProperty.call(r,"current"))?null!=t.current?Ee({element:t.current,padding:n}).fn(e):{}:t?Ee({element:t,padding:n}).fn(e):{};var r}}),ne(9),be({mainAxis:!0,fallbackStrategy:"initialPlacement"}),we({crossAxis:!1}),xe({strategy:"referenceHidden"})],onOpenChange:B}),_=I.refs,V=I.floatingStyles,j=I.context,K=function(t,n){var r;void 0===n&&(n={});const{open:o,floatingId:i}=t,{enabled:l=!0,role:c="dialog"}=n,s=null!=(r=tt.get(c))?r:c,a=He(),u=null!=_e();return e.useMemo((()=>{if(!l)return{};const e={id:i,...s&&{role:s}};return"tooltip"===s||"label"===c?{reference:{["aria-"+("label"===c?"labelledby":"describedby")]:o?i:void 0},floating:e}:{reference:{"aria-expanded":o?"true":"false","aria-haspopup":"alertdialog"===s?"dialog":s,"aria-controls":o?i:void 0,..."listbox"===s&&{role:"combobox"},..."menu"===s&&{id:a},..."menu"===s&&u&&{role:"menuitem"},..."select"===c&&{"aria-autocomplete":"none"},..."combobox"===c&&{"aria-autocomplete":"list"}},floating:{...e,..."menu"===s&&{"aria-labelledby":a}},item(e){let{active:t,selected:n}=e;const r={role:"option",...t&&{id:i+"-option"}};switch(c){case"select":return{...r,"aria-selected":t&&n};case"combobox":return{...r,...t&&{"aria-selected":!0}}}return{}}}}),[l,c,s,o,i,a,u])}(j),z=function(t,n){void 0===n&&(n={});const{open:r,onOpenChange:o,nodeId:i,elements:{reference:l,domReference:c,floating:s},dataRef:a}=t,{enabled:u=!0,escapeKey:f=!0,outsidePress:d=!0,outsidePressEvent:v="pointerdown",referencePress:g=!1,referencePressEvent:h="pointerdown",ancestorScroll:y=!1,bubbles:w,capture:b}=n,R=Ve(),P=Se("function"==typeof d?d:()=>!1),T="function"==typeof d?P:d,M=e.useRef(!1),A=e.useRef(!1),{escapeKey:N,outsidePress:F}=Ue(w),{escapeKey:H,outsidePress:W}=Ue(b),B=Se((e=>{if(!r||!u||!f||"Escape"!==e.key)return;const t=R?$e(R.nodesRef.current,i):[];if(!N&&(e.stopPropagation(),t.length>0)){let e=!0;if(t.forEach((t=>{var n;null==(n=t.context)||!n.open||t.context.dataRef.current.__escapeKeyBubbles||(e=!1)})),!e)return}o(!1,function(e){return"nativeEvent"in e}(e)?e.nativeEvent:e,"escape-key")})),I=Se((e=>{var t;const n=()=>{var t;B(e),null==(t=D(e))||t.removeEventListener("keydown",n)};null==(t=D(e))||t.addEventListener("keydown",n)})),_=Se((e=>{const t=M.current;M.current=!1;const n=A.current;if(A.current=!1,"click"===v&&n)return;if(t)return;if("function"==typeof T&&!T(e))return;const r=D(e),l="["+je("inert")+"]",a=k(s).querySelectorAll(l);let u=p(r)?r:null;for(;u&&!x(u);){const e=L(u);if(x(e)||!p(e))break;u=e}if(a.length&&p(r)&&!r.matches("html,body")&&!O(r,s)&&Array.from(a).every((e=>!O(u,e))))return;if(m(r)&&s){const t=r.clientWidth>0&&r.scrollWidth>r.clientWidth,n=r.clientHeight>0&&r.scrollHeight>r.clientHeight;let o=n&&e.offsetX>r.clientWidth;if(n&&"rtl"===E(r).direction&&(o=e.offsetX<=r.offsetWidth-r.clientWidth),o||t&&e.offsetY>r.clientHeight)return}const f=R&&$e(R.nodesRef.current,i).some((t=>{var n;return S(e,null==(n=t.context)?void 0:n.elements.floating)}));if(S(e,s)||S(e,c)||f)return;const d=R?$e(R.nodesRef.current,i):[];if(d.length>0){let e=!0;if(d.forEach((t=>{var n;null==(n=t.context)||!n.open||t.context.dataRef.current.__outsidePressBubbles||(e=!1)})),!e)return}o(!1,e,"outside-press")})),V=Se((e=>{var t;const n=()=>{var t;_(e),null==(t=D(e))||t.removeEventListener(v,n)};null==(t=D(e))||t.addEventListener(v,n)}));return e.useEffect((()=>{if(!r||!u)return;function e(e){o(!1,e,"ancestor-scroll")}a.current.__escapeKeyBubbles=N,a.current.__outsidePressBubbles=F;const t=k(s);f&&t.addEventListener("keydown",H?I:B,H),T&&t.addEventListener(v,W?V:_,W);let n=[];return y&&(p(c)&&(n=C(c)),p(s)&&(n=n.concat(C(s))),!p(l)&&l&&l.contextElement&&(n=n.concat(C(l.contextElement)))),n=n.filter((e=>{var n;return e!==(null==(n=t.defaultView)?void 0:n.visualViewport)})),n.forEach((t=>{t.addEventListener("scroll",e,{passive:!0})})),()=>{f&&t.removeEventListener("keydown",H?I:B,H),T&&t.removeEventListener(v,W?V:_,W),n.forEach((t=>{t.removeEventListener("scroll",e)}))}}),[a,s,c,l,f,T,v,r,o,y,u,N,F,B,H,I,_,W,V]),e.useEffect((()=>{M.current=!1}),[T,v]),e.useMemo((()=>u?{reference:{onKeyDown:B,[Ye[h]]:e=>{g&&o(!1,e.nativeEvent,"reference-press")}},floating:{onKeyDown:B,onMouseDown(){A.current=!0},onMouseUp(){A.current=!0},[qe[v]]:()=>{M.current=!0}}}:{}),[u,g,v,h,o,B])}(j),X=function(t,n){void 0===n&&(n={});const{open:r,onOpenChange:o,dataRef:i,events:l,elements:{domReference:c,floating:s},refs:a}=t,{enabled:u=!0,delay:f=0,handleClose:d=null,mouseOnly:m=!1,restMs:v=0,move:g=!0}=n,h=Ve(),y=_e(),w=Ke(d),b=Ke(f),x=e.useRef(),E=e.useRef(),R=e.useRef(),L=e.useRef(),P=e.useRef(!0),C=e.useRef(!1),S=e.useRef((()=>{})),D=e.useCallback((()=>{var e;const t=null==(e=i.current.openEvent)?void 0:e.type;return(null==t?void 0:t.includes("mouse"))&&"mousedown"!==t}),[i]);e.useEffect((()=>{if(u)return l.on("openchange",e),()=>{l.off("openchange",e)};function e(e){let{open:t}=e;t||(clearTimeout(E.current),clearTimeout(L.current),P.current=!0)}}),[u,l]),e.useEffect((()=>{if(!u||!w.current||!r)return;function e(e){D()&&o(!1,e,"hover")}const t=k(s).documentElement;return t.addEventListener("mouseleave",e),()=>{t.removeEventListener("mouseleave",e)}}),[s,r,o,u,w,D]);const M=e.useCallback((function(e,t,n){void 0===t&&(t=!0),void 0===n&&(n="hover");const r=Xe(b.current,"close",x.current);r&&!R.current?(clearTimeout(E.current),E.current=setTimeout((()=>o(!1,e,n)),r)):t&&(clearTimeout(E.current),o(!1,e,n))}),[b,o]),A=e.useCallback((()=>{S.current(),R.current=void 0}),[]),N=e.useCallback((()=>{if(C.current){const e=k(a.floating.current).body;e.style.pointerEvents="",e.removeAttribute(ze),C.current=!1}}),[a]);return e.useEffect((()=>{if(u&&p(c)){const e=c;return r&&e.addEventListener("mouseleave",a),null==s||s.addEventListener("mouseleave",a),g&&e.addEventListener("mousemove",n,{once:!0}),e.addEventListener("mouseenter",n),e.addEventListener("mouseleave",l),()=>{r&&e.removeEventListener("mouseleave",a),null==s||s.removeEventListener("mouseleave",a),g&&e.removeEventListener("mousemove",n),e.removeEventListener("mouseenter",n),e.removeEventListener("mouseleave",l)}}function e(){return!!i.current.openEvent&&["click","mousedown"].includes(i.current.openEvent.type)}function n(e){if(clearTimeout(E.current),P.current=!1,m&&!T(x.current)||v>0&&0===Xe(b.current,"open"))return;const t=Xe(b.current,"open",x.current);t?E.current=setTimeout((()=>{o(!0,e,"hover")}),t):o(!0,e,"hover")}function l(n){if(e())return;S.current();const o=k(s);if(clearTimeout(L.current),w.current){r||clearTimeout(E.current),R.current=w.current({...t,tree:h,x:n.clientX,y:n.clientY,onClose(){N(),A(),M(n,!0,"safe-polygon")}});const e=R.current;return o.addEventListener("mousemove",e),void(S.current=()=>{o.removeEventListener("mousemove",e)})}("touch"!==x.current||!O(s,n.relatedTarget))&&M(n)}function a(n){e()||null==w.current||w.current({...t,tree:h,x:n.clientX,y:n.clientY,onClose(){N(),A(),M(n)}})(n)}}),[c,s,u,t,m,v,g,M,A,N,o,r,h,b,w,i]),De((()=>{var e;if(u&&r&&null!=(e=w.current)&&e.__options.blockPointerEvents&&D()){const e=k(s).body;if(e.setAttribute(ze,""),e.style.pointerEvents="none",C.current=!0,p(c)&&s){var t;const e=c,n=null==h||null==(t=h.nodesRef.current.find((e=>e.id===y)))||null==(t=t.context)?void 0:t.elements.floating;return n&&(n.style.pointerEvents=""),e.style.pointerEvents="auto",s.style.pointerEvents="auto",()=>{e.style.pointerEvents="",s.style.pointerEvents=""}}}}),[u,r,y,s,c,h,w,D]),De((()=>{r||(x.current=void 0,A(),N())}),[r,A,N]),e.useEffect((()=>()=>{A(),clearTimeout(E.current),clearTimeout(L.current),N()}),[u,c,A,N]),e.useMemo((()=>{if(!u)return{};function e(e){x.current=e.pointerType}return{reference:{onPointerDown:e,onPointerEnter:e,onMouseMove(e){r||0===v||(clearTimeout(L.current),L.current=setTimeout((()=>{P.current||o(!0,e.nativeEvent,"hover")}),v))}},floating:{onMouseEnter(){clearTimeout(E.current)},onMouseLeave(e){M(e.nativeEvent,!1)}}}}),[u,v,r,o,M])}(j,{}),$=function(t){void 0===t&&(t=[]);const n=t,r=e.useCallback((e=>et(e,t,"reference")),n),o=e.useCallback((e=>et(e,t,"floating")),n),i=e.useCallback((e=>et(e,t,"item")),t.map((e=>null==e?void 0:e.item)));return e.useMemo((()=>({getReferenceProps:r,getFloatingProps:o,getItemProps:i})),[r,o,i])}([X,K,z]),Y=$.getReferenceProps,q=$.getFloatingProps;return t.createElement("span",null,t.createElement("span",c({className:"rad-ui-popper ".concat(N,"-reference-element ").concat(d),ref:_.setReference},Y({onClick:function(){console.log("click")}})),h),W&&t.createElement("div",c({className:"".concat(N,"-floating-element"),ref:_.setFloating,style:V},q()),R&&t.createElement(We,{className:"rad-ui-arrow ".concat(N,"-arrow"),ref:F,context:j}),M))},rt=function(e){var n=e.children;e.label;var r=s(e,["children","label"]);return t.createElement("div",null,t.createElement(nt,c({popperName:"Tooltip",pop:"hello"},r),n))};export{rt as default};
1
+ 'use client';import*as e from"react";import t,{useLayoutEffect as n,useEffect as r,useRef as o,useState as i}from"react";import*as l from"react-dom";var c=function(){return c=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},c.apply(this,arguments)};function s(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}"function"==typeof SuppressedError&&SuppressedError;function a(e){return d(e)?(e.nodeName||"").toLowerCase():"#document"}function u(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function f(e){var t;return null==(t=(d(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function d(e){return e instanceof Node||e instanceof u(e).Node}function p(e){return e instanceof Element||e instanceof u(e).Element}function m(e){return e instanceof HTMLElement||e instanceof u(e).HTMLElement}function v(e){return"undefined"!=typeof ShadowRoot&&(e instanceof ShadowRoot||e instanceof u(e).ShadowRoot)}function g(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=x(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function h(e){return["table","td","th"].includes(a(e))}function y(e){const t=w(),n=x(e);return"none"!==n.transform||"none"!==n.perspective||!!n.containerType&&"normal"!==n.containerType||!t&&!!n.backdropFilter&&"none"!==n.backdropFilter||!t&&!!n.filter&&"none"!==n.filter||["transform","perspective","filter"].some((e=>(n.willChange||"").includes(e)))||["paint","layout","strict","content"].some((e=>(n.contain||"").includes(e)))}function w(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function b(e){return["html","body","#document"].includes(a(e))}function x(e){return u(e).getComputedStyle(e)}function E(e){return p(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function R(e){if("html"===a(e))return e;const t=e.assignedSlot||e.parentNode||v(e)&&e.host||f(e);return v(t)?t.host:t}function P(e){const t=R(e);return b(t)?e.ownerDocument?e.ownerDocument.body:e.body:m(t)&&g(t)?t:P(t)}function L(e,t,n){var r;void 0===t&&(t=[]),void 0===n&&(n=!0);const o=P(e),i=o===(null==(r=e.ownerDocument)?void 0:r.body),l=u(o);return i?t.concat(l,l.visualViewport||[],g(o)?o:[],l.frameElement&&n?L(l.frameElement):[]):t.concat(o,L(o,[],n))}function O(e,t){if(!e||!t)return!1;const n=null==t.getRootNode?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&v(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function C(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}function k(e){return(null==e?void 0:e.ownerDocument)||document}function T(e,t){if(null==t)return!1;if("composedPath"in e)return e.composedPath().includes(t);const n=e;return null!=n.target&&t.contains(n.target)}function S(e){return"composedPath"in e?e.composedPath()[0]:e.target}const D=["top","right","bottom","left"],M=Math.min,A=Math.max,N=Math.round,F=Math.floor,H=e=>({x:e,y:e}),W={left:"right",right:"left",bottom:"top",top:"bottom"},B={start:"end",end:"start"};function I(e,t,n){return A(e,M(t,n))}function _(e,t){return"function"==typeof e?e(t):e}function V(e){return e.split("-")[0]}function j(e){return e.split("-")[1]}function K(e){return"x"===e?"y":"x"}function z(e){return"y"===e?"height":"width"}function X(e){return["top","bottom"].includes(V(e))?"y":"x"}function $(e){return K(X(e))}function Y(e){return e.replace(/start|end/g,(e=>B[e]))}function q(e){return e.replace(/left|right|bottom|top/g,(e=>W[e]))}function U(e){return"number"!=typeof e?function(e){return{top:0,right:0,bottom:0,left:0,...e}}(e):{top:e,right:e,bottom:e,left:e}}function Z(e){return{...e,top:e.y,left:e.x,right:e.x+e.width,bottom:e.y+e.height}}function Q(e,t,n){let{reference:r,floating:o}=e;const i=X(t),l=$(t),c=z(l),s=V(t),a="y"===i,u=r.x+r.width/2-o.width/2,f=r.y+r.height/2-o.height/2,d=r[c]/2-o[c]/2;let p;switch(s){case"top":p={x:u,y:r.y-o.height};break;case"bottom":p={x:u,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:f};break;case"left":p={x:r.x-o.width,y:f};break;default:p={x:r.x,y:r.y}}switch(j(t)){case"start":p[l]-=d*(n&&a?-1:1);break;case"end":p[l]+=d*(n&&a?-1:1)}return p}async function G(e,t){var n;void 0===t&&(t={});const{x:r,y:o,platform:i,rects:l,elements:c,strategy:s}=e,{boundary:a="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:d=!1,padding:p=0}=_(t,e),m=U(p),v=c[d?"floating"===f?"reference":"floating":f],g=Z(await i.getClippingRect({element:null==(n=await(null==i.isElement?void 0:i.isElement(v)))||n?v:v.contextElement||await(null==i.getDocumentElement?void 0:i.getDocumentElement(c.floating)),boundary:a,rootBoundary:u,strategy:s})),h="floating"===f?{...l.floating,x:r,y:o}:l.reference,y=await(null==i.getOffsetParent?void 0:i.getOffsetParent(c.floating)),w=await(null==i.isElement?void 0:i.isElement(y))&&await(null==i.getScale?void 0:i.getScale(y))||{x:1,y:1},b=Z(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:h,offsetParent:y,strategy:s}):h);return{top:(g.top-b.top+m.top)/w.y,bottom:(b.bottom-g.bottom+m.bottom)/w.y,left:(g.left-b.left+m.left)/w.x,right:(b.right-g.right+m.right)/w.x}}function J(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function ee(e){return D.some((t=>e[t]>=0))}const te=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:l,middlewareData:c}=t,s=await async function(e,t){const{placement:n,platform:r,elements:o}=e,i=await(null==r.isRTL?void 0:r.isRTL(o.floating)),l=V(n),c=j(n),s="y"===X(n),a=["left","top"].includes(l)?-1:1,u=i&&s?-1:1,f=_(t,e);let{mainAxis:d,crossAxis:p,alignmentAxis:m}="number"==typeof f?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...f};return c&&"number"==typeof m&&(p="end"===c?-1*m:m),s?{x:p*u,y:d*a}:{x:d*a,y:p*u}}(t,e);return l===(null==(n=c.offset)?void 0:n.placement)&&null!=(r=c.arrow)&&r.alignmentOffset?{}:{x:o+s.x,y:i+s.y,data:{...s,placement:l}}}}};function ne(e){const t=x(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=m(e),i=o?e.offsetWidth:n,l=o?e.offsetHeight:r,c=N(n)!==i||N(r)!==l;return c&&(n=i,r=l),{width:n,height:r,$:c}}function re(e){return p(e)?e:e.contextElement}function oe(e){const t=re(e);if(!m(t))return H(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=ne(t);let l=(i?N(n.width):n.width)/r,c=(i?N(n.height):n.height)/o;return l&&Number.isFinite(l)||(l=1),c&&Number.isFinite(c)||(c=1),{x:l,y:c}}const ie=H(0);function le(e){const t=u(e);return w()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:ie}function ce(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);const o=e.getBoundingClientRect(),i=re(e);let l=H(1);t&&(r?p(r)&&(l=oe(r)):l=oe(e));const c=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==u(e))&&t}(i,n,r)?le(i):H(0);let s=(o.left+c.x)/l.x,a=(o.top+c.y)/l.y,f=o.width/l.x,d=o.height/l.y;if(i){const e=u(i),t=r&&p(r)?u(r):r;let n=e.frameElement;for(;n&&r&&t!==e;){const e=oe(n),t=n.getBoundingClientRect(),r=x(n),o=t.left+(n.clientLeft+parseFloat(r.paddingLeft))*e.x,i=t.top+(n.clientTop+parseFloat(r.paddingTop))*e.y;s*=e.x,a*=e.y,f*=e.x,d*=e.y,s+=o,a+=i,n=u(n).frameElement}}return Z({width:f,height:d,x:s,y:a})}const se=[":popover-open",":modal"];function ae(e){return se.some((t=>{try{return e.matches(t)}catch(e){return!1}}))}function ue(e){return ce(f(e)).left+E(e).scrollLeft}function fe(e,t,n){let r;if("viewport"===t)r=function(e,t){const n=u(e),r=f(e),o=n.visualViewport;let i=r.clientWidth,l=r.clientHeight,c=0,s=0;if(o){i=o.width,l=o.height;const e=w();(!e||e&&"fixed"===t)&&(c=o.offsetLeft,s=o.offsetTop)}return{width:i,height:l,x:c,y:s}}(e,n);else if("document"===t)r=function(e){const t=f(e),n=E(e),r=e.ownerDocument.body,o=A(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=A(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let l=-n.scrollLeft+ue(e);const c=-n.scrollTop;return"rtl"===x(r).direction&&(l+=A(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:l,y:c}}(f(e));else if(p(t))r=function(e,t){const n=ce(e,!0,"fixed"===t),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=m(e)?oe(e):H(1);return{width:e.clientWidth*i.x,height:e.clientHeight*i.y,x:o*i.x,y:r*i.y}}(t,n);else{const n=le(e);r={...t,x:t.x-n.x,y:t.y-n.y}}return Z(r)}function de(e,t){const n=R(e);return!(n===t||!p(n)||b(n))&&("fixed"===x(n).position||de(n,t))}function pe(e,t,n){const r=m(t),o=f(t),i="fixed"===n,l=ce(e,!0,i,t);let c={scrollLeft:0,scrollTop:0};const s=H(0);if(r||!r&&!i)if(("body"!==a(t)||g(o))&&(c=E(t)),r){const e=ce(t,!0,i,t);s.x=e.x+t.clientLeft,s.y=e.y+t.clientTop}else o&&(s.x=ue(o));return{x:l.left+c.scrollLeft-s.x,y:l.top+c.scrollTop-s.y,width:l.width,height:l.height}}function me(e,t){return m(e)&&"fixed"!==x(e).position?t?t(e):e.offsetParent:null}function ve(e,t){const n=u(e);if(!m(e)||ae(e))return n;let r=me(e,t);for(;r&&h(r)&&"static"===x(r).position;)r=me(r,t);return r&&("html"===a(r)||"body"===a(r)&&"static"===x(r).position&&!y(r))?n:r||function(e){let t=R(e);for(;m(t)&&!b(t);){if(y(t))return t;t=R(t)}return null}(e)||n}const ge={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i="fixed"===o,l=f(r),c=!!t&&ae(t.floating);if(r===l||c&&i)return n;let s={scrollLeft:0,scrollTop:0},u=H(1);const d=H(0),p=m(r);if((p||!p&&!i)&&(("body"!==a(r)||g(l))&&(s=E(r)),m(r))){const e=ce(r);u=oe(r),d.x=e.x+r.clientLeft,d.y=e.y+r.clientTop}return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-s.scrollLeft*u.x+d.x,y:n.y*u.y-s.scrollTop*u.y+d.y}},getDocumentElement:f,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[..."clippingAncestors"===n?function(e,t){const n=t.get(e);if(n)return n;let r=L(e,[],!1).filter((e=>p(e)&&"body"!==a(e))),o=null;const i="fixed"===x(e).position;let l=i?R(e):e;for(;p(l)&&!b(l);){const t=x(l),n=y(l);n||"fixed"!==t.position||(o=null),(i?!n&&!o:!n&&"static"===t.position&&o&&["absolute","fixed"].includes(o.position)||g(l)&&!n&&de(e,l))?r=r.filter((e=>e!==l)):o=t,l=R(l)}return t.set(e,r),r}(t,this._c):[].concat(n),r],l=i[0],c=i.reduce(((e,n)=>{const r=fe(t,n,o);return e.top=A(r.top,e.top),e.right=M(r.right,e.right),e.bottom=M(r.bottom,e.bottom),e.left=A(r.left,e.left),e}),fe(t,l,o));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}},getOffsetParent:ve,getElementRects:async function(e){const t=this.getOffsetParent||ve,n=this.getDimensions;return{reference:pe(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,...await n(e.floating)}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){const{width:t,height:n}=ne(e);return{width:t,height:n}},getScale:oe,isElement:p,isRTL:function(e){return"rtl"===x(e).direction}};function he(e,t,n,r){void 0===r&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:l="function"==typeof ResizeObserver,layoutShift:c="function"==typeof IntersectionObserver,animationFrame:s=!1}=r,a=re(e),u=o||i?[...a?L(a):[],...L(t)]:[];u.forEach((e=>{o&&e.addEventListener("scroll",n,{passive:!0}),i&&e.addEventListener("resize",n)}));const d=a&&c?function(e,t){let n,r=null;const o=f(e);function i(){var e;clearTimeout(n),null==(e=r)||e.disconnect(),r=null}return function l(c,s){void 0===c&&(c=!1),void 0===s&&(s=1),i();const{left:a,top:u,width:f,height:d}=e.getBoundingClientRect();if(c||t(),!f||!d)return;const p={rootMargin:-F(u)+"px "+-F(o.clientWidth-(a+f))+"px "+-F(o.clientHeight-(u+d))+"px "+-F(a)+"px",threshold:A(0,M(1,s))||1};let m=!0;function v(e){const t=e[0].intersectionRatio;if(t!==s){if(!m)return l();t?l(!1,t):n=setTimeout((()=>{l(!1,1e-7)}),100)}m=!1}try{r=new IntersectionObserver(v,{...p,root:o.ownerDocument})}catch(e){r=new IntersectionObserver(v,p)}r.observe(e)}(!0),i}(a,n):null;let p,m=-1,v=null;l&&(v=new ResizeObserver((e=>{let[r]=e;r&&r.target===a&&v&&(v.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame((()=>{var e;null==(e=v)||e.observe(t)}))),n()})),a&&!s&&v.observe(a),v.observe(t));let g=s?ce(e):null;return s&&function t(){const r=ce(e);!g||r.x===g.x&&r.y===g.y&&r.width===g.width&&r.height===g.height||n();g=r,p=requestAnimationFrame(t)}(),n(),()=>{var e;u.forEach((e=>{o&&e.removeEventListener("scroll",n),i&&e.removeEventListener("resize",n)})),null==d||d(),null==(e=v)||e.disconnect(),v=null,s&&cancelAnimationFrame(p)}}const ye=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:i=!0,crossAxis:l=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...s}=_(e,t),a={x:n,y:r},u=await G(t,s),f=X(V(o)),d=K(f);let p=a[d],m=a[f];if(i){const e="y"===d?"bottom":"right";p=I(p+u["y"===d?"top":"left"],p,p-u[e])}if(l){const e="y"===f?"bottom":"right";m=I(m+u["y"===f?"top":"left"],m,m-u[e])}const v=c.fn({...t,[d]:p,[f]:m});return{...v,data:{x:v.x-n,y:v.y-r}}}}},we=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:l,initialPlacement:c,platform:s,elements:a}=t,{mainAxis:u=!0,crossAxis:f=!0,fallbackPlacements:d,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:v=!0,...g}=_(e,t);if(null!=(n=i.arrow)&&n.alignmentOffset)return{};const h=V(o),y=V(c)===c,w=await(null==s.isRTL?void 0:s.isRTL(a.floating)),b=d||(y||!v?[q(c)]:function(e){const t=q(e);return[Y(e),t,Y(t)]}(c));d||"none"===m||b.push(...function(e,t,n,r){const o=j(e);let i=function(e,t,n){const r=["left","right"],o=["right","left"],i=["top","bottom"],l=["bottom","top"];switch(e){case"top":case"bottom":return n?t?o:r:t?r:o;case"left":case"right":return t?i:l;default:return[]}}(V(e),"start"===n,r);return o&&(i=i.map((e=>e+"-"+o)),t&&(i=i.concat(i.map(Y)))),i}(c,v,m,w));const x=[c,...b],E=await G(t,g),R=[];let P=(null==(r=i.flip)?void 0:r.overflows)||[];if(u&&R.push(E[h]),f){const e=function(e,t,n){void 0===n&&(n=!1);const r=j(e),o=$(e),i=z(o);let l="x"===o?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[i]>t.floating[i]&&(l=q(l)),[l,q(l)]}(o,l,w);R.push(E[e[0]],E[e[1]])}if(P=[...P,{placement:o,overflows:R}],!R.every((e=>e<=0))){var L,O;const e=((null==(L=i.flip)?void 0:L.index)||0)+1,t=x[e];if(t)return{data:{index:e,overflows:P},reset:{placement:t}};let n=null==(O=P.filter((e=>e.overflows[0]<=0)).sort(((e,t)=>e.overflows[1]-t.overflows[1]))[0])?void 0:O.placement;if(!n)switch(p){case"bestFit":{var C;const e=null==(C=P.map((e=>[e.placement,e.overflows.filter((e=>e>0)).reduce(((e,t)=>e+t),0)])).sort(((e,t)=>e[1]-t[1]))[0])?void 0:C[0];e&&(n=e);break}case"initialPlacement":n=c}if(o!==n)return{reset:{placement:n}}}return{}}}},be=function(e){return void 0===e&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...o}=_(e,t);switch(r){case"referenceHidden":{const e=J(await G(t,{...o,elementContext:"reference"}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:ee(e)}}}case"escaped":{const e=J(await G(t,{...o,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:ee(e)}}}default:return{}}}}},xe=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:i,platform:l,elements:c,middlewareData:s}=t,{element:a,padding:u=0}=_(e,t)||{};if(null==a)return{};const f=U(u),d={x:n,y:r},p=$(o),m=z(p),v=await l.getDimensions(a),g="y"===p,h=g?"top":"left",y=g?"bottom":"right",w=g?"clientHeight":"clientWidth",b=i.reference[m]+i.reference[p]-d[p]-i.floating[m],x=d[p]-i.reference[p],E=await(null==l.getOffsetParent?void 0:l.getOffsetParent(a));let R=E?E[w]:0;R&&await(null==l.isElement?void 0:l.isElement(E))||(R=c.floating[w]||i.floating[m]);const P=b/2-x/2,L=R/2-v[m]/2-1,O=M(f[h],L),C=M(f[y],L),k=O,T=R-v[m]-C,S=R/2-v[m]/2+P,D=I(k,S,T),A=!s.arrow&&null!=j(o)&&S!==D&&i.reference[m]/2-(S<k?O:C)-v[m]/2<0,N=A?S<k?S-k:S-T:0;return{[p]:d[p]+N,data:{[p]:D,centerOffset:S-D-N,...A&&{alignmentOffset:N}},reset:A}}}),Ee=(e,t,n)=>{const r=new Map,o={platform:ge,...n},i={...o.platform,_c:r};return(async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:l}=n,c=i.filter(Boolean),s=await(null==l.isRTL?void 0:l.isRTL(t));let a=await l.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:f}=Q(a,r,s),d=r,p={},m=0;for(let n=0;n<c.length;n++){const{name:i,fn:v}=c[n],{x:g,y:h,data:y,reset:w}=await v({x:u,y:f,initialPlacement:r,placement:d,strategy:o,middlewareData:p,rects:a,platform:l,elements:{reference:e,floating:t}});u=null!=g?g:u,f=null!=h?h:f,p={...p,[i]:{...p[i],...y}},w&&m<=50&&(m++,"object"==typeof w&&(w.placement&&(d=w.placement),w.rects&&(a=!0===w.rects?await l.getElementRects({reference:e,floating:t,strategy:o}):w.rects),({x:u,y:f}=Q(a,d,s))),n=-1)}return{x:u,y:f,placement:d,strategy:o,middlewareData:p}})(e,t,{...o,platform:i})};var Re="undefined"!=typeof document?n:r;function Pe(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;0!=r--;)if(!Pe(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;0!=r--;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;0!=r--;){const n=o[r];if(("_owner"!==n||!e.$$typeof)&&!Pe(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function Le(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Oe(e,t){const n=Le(e);return Math.round(t*n)/n}function Ce(t){const n=e.useRef(t);return Re((()=>{n.current=t})),n}const ke=e["useInsertionEffect".toString()]||(e=>e());function Te(t){const n=e.useRef((()=>{if("production"!==process.env.NODE_ENV)throw new Error("Cannot call an event handler while rendering.")}));return ke((()=>{n.current=t})),e.useCallback((function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return null==n.current?void 0:n.current(...t)}),[])}var Se="undefined"!=typeof document?n:r;function De(){return De=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},De.apply(this,arguments)}let Me=!1,Ae=0;const Ne=()=>"floating-ui-"+Ae++;const Fe=e["useId".toString()]||function(){const[t,n]=e.useState((()=>Me?Ne():void 0));return Se((()=>{null==t&&n(Ne())}),[]),e.useEffect((()=>{Me||(Me=!0)}),[]),t},He=e.forwardRef((function(t,n){let{context:{placement:r,elements:{floating:o},middlewareData:{arrow:i}},width:l=14,height:c=7,tipRadius:s=0,strokeWidth:a=0,staticOffset:u,stroke:f,d:d,style:{transform:p,...m}={},...v}=t;"production"!==process.env.NODE_ENV&&(n||console.warn("Floating UI: The `ref` prop is required for the `FloatingArrow`","component."));const g=Fe();if(!o)return null;a*=2;const h=a/2,y=l/2*(s/-8+1),w=c/2*s/4,[b,x]=r.split("-"),E=ge.isRTL(o),R=!!d,P="top"===b||"bottom"===b,L=u&&"end"===x?"bottom":"top";let O=u&&"end"===x?"right":"left";u&&E&&(O="end"===x?"left":"right");const C=null!=(null==i?void 0:i.x)?u||i.x:"",k=null!=(null==i?void 0:i.y)?u||i.y:"",T=d||"M0,0 H"+l+" L"+(l-y)+","+(c-w)+" Q"+l/2+","+c+" "+y+","+(c-w)+" Z",S={top:R?"rotate(180deg)":"",left:R?"rotate(90deg)":"rotate(-90deg)",bottom:R?"":"rotate(180deg)",right:R?"rotate(-90deg)":"rotate(90deg)"}[b];return e.createElement("svg",De({},v,{"aria-hidden":!0,ref:n,width:R?l:l+a,height:l,viewBox:"0 0 "+l+" "+(c>l?c:l),style:{position:"absolute",pointerEvents:"none",[O]:C,[L]:k,[b]:P||R?"100%":"calc(100% - "+a/2+"px)",transform:""+S+(null!=p?p:""),...m}}),a>0&&e.createElement("path",{clipPath:"url(#"+g+")",fill:"none",stroke:f,strokeWidth:a+(d?0:1),d:T}),e.createElement("path",{stroke:a&&!d?v.fill:"none",d:T}),e.createElement("clipPath",{id:g},e.createElement("rect",{x:-h,y:h*(R?-1:1),width:l+a,height:l})))}));const We=e.createContext(null),Be=e.createContext(null),Ie=()=>{var t;return(null==(t=e.useContext(We))?void 0:t.id)||null},_e=()=>e.useContext(Be);function Ve(e){return"data-floating-ui-"+e}function je(e){const t=o(e);return Se((()=>{t.current=e})),t}const Ke=Ve("safe-polygon");function ze(e,t,n){return n&&!C(n)?0:"number"==typeof e?e:null==e?void 0:e[t]}function Xe(e,t){let n=e.filter((e=>{var n;return e.parentId===t&&(null==(n=e.context)?void 0:n.open)})),r=n;for(;r.length;)r=e.filter((e=>{var t;return null==(t=r)?void 0:t.some((t=>{var n;return e.parentId===t.id&&(null==(n=e.context)?void 0:n.open)}))})),n=n.concat(r);return n}const $e={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},Ye={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},qe=e=>{var t,n;return{escapeKey:"boolean"==typeof e?e:null!=(t=null==e?void 0:e.escapeKey)&&t,outsidePress:"boolean"==typeof e?e:null==(n=null==e?void 0:e.outsidePress)||n}};let Ue;function Ze(t){var n;void 0===t&&(t={});const{open:r=!1,onOpenChange:o,nodeId:i}=t;if("production"!==process.env.NODE_ENV){var c;const e="Floating UI: Cannot pass a virtual element to the `elements.reference` option, as it must be a real DOM element. Use `refs.setPositionReference` instead.";var s,a;if(null!=(c=t.elements)&&c.reference&&!p(t.elements.reference))if(null==(s=Ue)||!s.has(e))null==(a=Ue)||a.add(e),console.error(e)}const[u,f]=e.useState(null),d=(null==(n=t.elements)?void 0:n.reference)||u,m=function(t){void 0===t&&(t={});const{placement:n="bottom",strategy:r="absolute",middleware:o=[],platform:i,elements:{reference:c,floating:s}={},transform:a=!0,whileElementsMounted:u,open:f}=t,[d,p]=e.useState({x:0,y:0,strategy:r,placement:n,middlewareData:{},isPositioned:!1}),[m,v]=e.useState(o);Pe(m,o)||v(o);const[g,h]=e.useState(null),[y,w]=e.useState(null),b=e.useCallback((e=>{e!==P.current&&(P.current=e,h(e))}),[]),x=e.useCallback((e=>{e!==L.current&&(L.current=e,w(e))}),[]),E=c||g,R=s||y,P=e.useRef(null),L=e.useRef(null),O=e.useRef(d),C=null!=u,k=Ce(u),T=Ce(i),S=e.useCallback((()=>{if(!P.current||!L.current)return;const e={placement:n,strategy:r,middleware:m};T.current&&(e.platform=T.current),Ee(P.current,L.current,e).then((e=>{const t={...e,isPositioned:!0};D.current&&!Pe(O.current,t)&&(O.current=t,l.flushSync((()=>{p(t)})))}))}),[m,n,r,T]);Re((()=>{!1===f&&O.current.isPositioned&&(O.current.isPositioned=!1,p((e=>({...e,isPositioned:!1}))))}),[f]);const D=e.useRef(!1);Re((()=>(D.current=!0,()=>{D.current=!1})),[]),Re((()=>{if(E&&(P.current=E),R&&(L.current=R),E&&R){if(k.current)return k.current(E,R,S);S()}}),[E,R,S,k,C]);const M=e.useMemo((()=>({reference:P,floating:L,setReference:b,setFloating:x})),[b,x]),A=e.useMemo((()=>({reference:E,floating:R})),[E,R]),N=e.useMemo((()=>{const e={position:r,left:0,top:0};if(!A.floating)return e;const t=Oe(A.floating,d.x),n=Oe(A.floating,d.y);return a?{...e,transform:"translate("+t+"px, "+n+"px)",...Le(A.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:t,top:n}}),[r,a,A.floating,d.x,d.y]);return e.useMemo((()=>({...d,update:S,refs:M,elements:A,floatingStyles:N})),[d,S,M,A,N])}(t),v=_e(),g=null!=Ie(),h=Te(((e,t,n)=>{e&&(w.current.openEvent=t),b.emit("openchange",{open:e,event:t,reason:n,nested:g}),null==o||o(e,t,n)})),y=e.useRef(null),w=e.useRef({}),b=e.useState((()=>function(){const e=new Map;return{emit(t,n){var r;null==(r=e.get(t))||r.forEach((e=>e(n)))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){var r;e.set(t,(null==(r=e.get(t))?void 0:r.filter((e=>e!==n)))||[])}}}()))[0],x=Fe(),E=e.useCallback((e=>{const t=p(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:e}:e;m.refs.setReference(t)}),[m.refs]),R=e.useCallback((e=>{(p(e)||null===e)&&(y.current=e,f(e)),(p(m.refs.reference.current)||null===m.refs.reference.current||null!==e&&!p(e))&&m.refs.setReference(e)}),[m.refs]),P=e.useMemo((()=>({...m.refs,setReference:R,setPositionReference:E,domReference:y})),[m.refs,R,E]),L=e.useMemo((()=>({...m.elements,domReference:d})),[m.elements,d]),O=e.useMemo((()=>({...m,refs:P,elements:L,dataRef:w,nodeId:i,floatingId:x,events:b,open:r,onOpenChange:h})),[m,i,x,b,r,h,P,L]);return Se((()=>{const e=null==v?void 0:v.nodesRef.current.find((e=>e.id===i));e&&(e.context=O)})),e.useMemo((()=>({...m,context:O,refs:P,elements:L})),[m,P,L,O])}"production"!==process.env.NODE_ENV&&(Ue=new Set);const Qe="active",Ge="selected";function Je(e,t,n){const r=new Map,o="item"===n;let i=e;if(o&&e){const{[Qe]:t,[Ge]:n,...r}=e;i=r}return{..."floating"===n&&{tabIndex:-1},...i,...t.map((t=>{const r=t?t[n]:null;return"function"==typeof r?e?r(e):null:r})).concat(e).reduce(((e,t)=>t?(Object.entries(t).forEach((t=>{let[n,i]=t;var l;o&&[Qe,Ge].includes(n)||(0===n.indexOf("on")?(r.has(n)||r.set(n,[]),"function"==typeof i&&(null==(l=r.get(n))||l.push(i),e[n]=function(){for(var e,t=arguments.length,o=new Array(t),i=0;i<t;i++)o[i]=arguments[i];return null==(e=r.get(n))?void 0:e.map((e=>e(...o))).find((e=>void 0!==e))})):e[n]=i)})),e):e),{})}}const et=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);var tt=function(n){var r=n.popperName,l=void 0===r?"":r,a=n.customRootClass,u=void 0===a?"":a;n.activationStrategy;var f=n.className,d=void 0===f?"":f,v=n.placement,g=void 0===v?"top":v,h=n.children,y=n.open,w=void 0!==y&&y;n.hoverDelay;var E=n.showArrow,P=void 0===E||E,D=n.pop,M=void 0===D?t.createElement(t.Fragment,null):D;s(n,["popperName","customRootClass","activationStrategy","className","placement","children","open","hoverDelay","showArrow","pop"]);var A,N=function(e,t){void 0===e&&(e=""),void 0===t&&(t="");var n=t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();return e||(t?"".concat("rad-ui","-").concat(n):"")}(u,l),F=o(null),H=i(w),W=H[0],B=H[1],I=Ze({placement:g,whileElementsMounted:he,open:W,middleware:[(A={element:F},{name:"arrow",options:A,fn(e){const{element:t,padding:n}="function"==typeof A?A(e):A;return t&&(r=t,{}.hasOwnProperty.call(r,"current"))?null!=t.current?xe({element:t.current,padding:n}).fn(e):{}:t?xe({element:t,padding:n}).fn(e):{};var r}}),te(9),we({mainAxis:!0,fallbackStrategy:"initialPlacement"}),ye({crossAxis:!1}),be({strategy:"referenceHidden"})],onOpenChange:B}),_=I.refs,V=I.floatingStyles,j=I.context,K=function(t,n){var r;void 0===n&&(n={});const{open:o,floatingId:i}=t,{enabled:l=!0,role:c="dialog"}=n,s=null!=(r=et.get(c))?r:c,a=Fe(),u=null!=Ie();return e.useMemo((()=>{if(!l)return{};const e={id:i,...s&&{role:s}};return"tooltip"===s||"label"===c?{reference:{["aria-"+("label"===c?"labelledby":"describedby")]:o?i:void 0},floating:e}:{reference:{"aria-expanded":o?"true":"false","aria-haspopup":"alertdialog"===s?"dialog":s,"aria-controls":o?i:void 0,..."listbox"===s&&{role:"combobox"},..."menu"===s&&{id:a},..."menu"===s&&u&&{role:"menuitem"},..."select"===c&&{"aria-autocomplete":"none"},..."combobox"===c&&{"aria-autocomplete":"list"}},floating:{...e,..."menu"===s&&{"aria-labelledby":a}},item(e){let{active:t,selected:n}=e;const r={role:"option",...t&&{id:i+"-option"}};switch(c){case"select":return{...r,"aria-selected":t&&n};case"combobox":return{...r,...t&&{"aria-selected":!0}}}return{}}}}),[l,c,s,o,i,a,u])}(j),z=function(t,n){void 0===n&&(n={});const{open:r,onOpenChange:o,nodeId:i,elements:{reference:l,domReference:c,floating:s},dataRef:a}=t,{enabled:u=!0,escapeKey:f=!0,outsidePress:d=!0,outsidePressEvent:v="pointerdown",referencePress:g=!1,referencePressEvent:h="pointerdown",ancestorScroll:y=!1,bubbles:w,capture:E}=n,P=_e(),C=Te("function"==typeof d?d:()=>!1),D="function"==typeof d?C:d,M=e.useRef(!1),A=e.useRef(!1),{escapeKey:N,outsidePress:F}=qe(w),{escapeKey:H,outsidePress:W}=qe(E),B=Te((e=>{if(!r||!u||!f||"Escape"!==e.key)return;const t=P?Xe(P.nodesRef.current,i):[];if(!N&&(e.stopPropagation(),t.length>0)){let e=!0;if(t.forEach((t=>{var n;null==(n=t.context)||!n.open||t.context.dataRef.current.__escapeKeyBubbles||(e=!1)})),!e)return}o(!1,function(e){return"nativeEvent"in e}(e)?e.nativeEvent:e,"escape-key")})),I=Te((e=>{var t;const n=()=>{var t;B(e),null==(t=S(e))||t.removeEventListener("keydown",n)};null==(t=S(e))||t.addEventListener("keydown",n)})),_=Te((e=>{const t=M.current;M.current=!1;const n=A.current;if(A.current=!1,"click"===v&&n)return;if(t)return;if("function"==typeof D&&!D(e))return;const r=S(e),l="["+Ve("inert")+"]",a=k(s).querySelectorAll(l);let u=p(r)?r:null;for(;u&&!b(u);){const e=R(u);if(b(e)||!p(e))break;u=e}if(a.length&&p(r)&&!r.matches("html,body")&&!O(r,s)&&Array.from(a).every((e=>!O(u,e))))return;if(m(r)&&s){const t=r.clientWidth>0&&r.scrollWidth>r.clientWidth,n=r.clientHeight>0&&r.scrollHeight>r.clientHeight;let o=n&&e.offsetX>r.clientWidth;if(n&&"rtl"===x(r).direction&&(o=e.offsetX<=r.offsetWidth-r.clientWidth),o||t&&e.offsetY>r.clientHeight)return}const f=P&&Xe(P.nodesRef.current,i).some((t=>{var n;return T(e,null==(n=t.context)?void 0:n.elements.floating)}));if(T(e,s)||T(e,c)||f)return;const d=P?Xe(P.nodesRef.current,i):[];if(d.length>0){let e=!0;if(d.forEach((t=>{var n;null==(n=t.context)||!n.open||t.context.dataRef.current.__outsidePressBubbles||(e=!1)})),!e)return}o(!1,e,"outside-press")})),V=Te((e=>{var t;const n=()=>{var t;_(e),null==(t=S(e))||t.removeEventListener(v,n)};null==(t=S(e))||t.addEventListener(v,n)}));return e.useEffect((()=>{if(!r||!u)return;function e(e){o(!1,e,"ancestor-scroll")}a.current.__escapeKeyBubbles=N,a.current.__outsidePressBubbles=F;const t=k(s);f&&t.addEventListener("keydown",H?I:B,H),D&&t.addEventListener(v,W?V:_,W);let n=[];return y&&(p(c)&&(n=L(c)),p(s)&&(n=n.concat(L(s))),!p(l)&&l&&l.contextElement&&(n=n.concat(L(l.contextElement)))),n=n.filter((e=>{var n;return e!==(null==(n=t.defaultView)?void 0:n.visualViewport)})),n.forEach((t=>{t.addEventListener("scroll",e,{passive:!0})})),()=>{f&&t.removeEventListener("keydown",H?I:B,H),D&&t.removeEventListener(v,W?V:_,W),n.forEach((t=>{t.removeEventListener("scroll",e)}))}}),[a,s,c,l,f,D,v,r,o,y,u,N,F,B,H,I,_,W,V]),e.useEffect((()=>{M.current=!1}),[D,v]),e.useMemo((()=>u?{reference:{onKeyDown:B,[$e[h]]:e=>{g&&o(!1,e.nativeEvent,"reference-press")}},floating:{onKeyDown:B,onMouseDown(){A.current=!0},onMouseUp(){A.current=!0},[Ye[v]]:()=>{M.current=!0}}}:{}),[u,g,v,h,o,B])}(j),X=function(t,n){void 0===n&&(n={});const{open:r,onOpenChange:o,dataRef:i,events:l,elements:{domReference:c,floating:s},refs:a}=t,{enabled:u=!0,delay:f=0,handleClose:d=null,mouseOnly:m=!1,restMs:v=0,move:g=!0}=n,h=_e(),y=Ie(),w=je(d),b=je(f),x=e.useRef(),E=e.useRef(),R=e.useRef(),P=e.useRef(),L=e.useRef(!0),T=e.useRef(!1),S=e.useRef((()=>{})),D=e.useCallback((()=>{var e;const t=null==(e=i.current.openEvent)?void 0:e.type;return(null==t?void 0:t.includes("mouse"))&&"mousedown"!==t}),[i]);e.useEffect((()=>{if(u)return l.on("openchange",e),()=>{l.off("openchange",e)};function e(e){let{open:t}=e;t||(clearTimeout(E.current),clearTimeout(P.current),L.current=!0)}}),[u,l]),e.useEffect((()=>{if(!u||!w.current||!r)return;function e(e){D()&&o(!1,e,"hover")}const t=k(s).documentElement;return t.addEventListener("mouseleave",e),()=>{t.removeEventListener("mouseleave",e)}}),[s,r,o,u,w,D]);const M=e.useCallback((function(e,t,n){void 0===t&&(t=!0),void 0===n&&(n="hover");const r=ze(b.current,"close",x.current);r&&!R.current?(clearTimeout(E.current),E.current=setTimeout((()=>o(!1,e,n)),r)):t&&(clearTimeout(E.current),o(!1,e,n))}),[b,o]),A=e.useCallback((()=>{S.current(),R.current=void 0}),[]),N=e.useCallback((()=>{if(T.current){const e=k(a.floating.current).body;e.style.pointerEvents="",e.removeAttribute(Ke),T.current=!1}}),[a]);return e.useEffect((()=>{if(u&&p(c)){const e=c;return r&&e.addEventListener("mouseleave",a),null==s||s.addEventListener("mouseleave",a),g&&e.addEventListener("mousemove",n,{once:!0}),e.addEventListener("mouseenter",n),e.addEventListener("mouseleave",l),()=>{r&&e.removeEventListener("mouseleave",a),null==s||s.removeEventListener("mouseleave",a),g&&e.removeEventListener("mousemove",n),e.removeEventListener("mouseenter",n),e.removeEventListener("mouseleave",l)}}function e(){return!!i.current.openEvent&&["click","mousedown"].includes(i.current.openEvent.type)}function n(e){if(clearTimeout(E.current),L.current=!1,m&&!C(x.current)||v>0&&0===ze(b.current,"open"))return;const t=ze(b.current,"open",x.current);t?E.current=setTimeout((()=>{o(!0,e,"hover")}),t):o(!0,e,"hover")}function l(n){if(e())return;S.current();const o=k(s);if(clearTimeout(P.current),w.current){r||clearTimeout(E.current),R.current=w.current({...t,tree:h,x:n.clientX,y:n.clientY,onClose(){N(),A(),M(n,!0,"safe-polygon")}});const e=R.current;return o.addEventListener("mousemove",e),void(S.current=()=>{o.removeEventListener("mousemove",e)})}("touch"!==x.current||!O(s,n.relatedTarget))&&M(n)}function a(n){e()||null==w.current||w.current({...t,tree:h,x:n.clientX,y:n.clientY,onClose(){N(),A(),M(n)}})(n)}}),[c,s,u,t,m,v,g,M,A,N,o,r,h,b,w,i]),Se((()=>{var e;if(u&&r&&null!=(e=w.current)&&e.__options.blockPointerEvents&&D()){const e=k(s).body;if(e.setAttribute(Ke,""),e.style.pointerEvents="none",T.current=!0,p(c)&&s){var t;const e=c,n=null==h||null==(t=h.nodesRef.current.find((e=>e.id===y)))||null==(t=t.context)?void 0:t.elements.floating;return n&&(n.style.pointerEvents=""),e.style.pointerEvents="auto",s.style.pointerEvents="auto",()=>{e.style.pointerEvents="",s.style.pointerEvents=""}}}}),[u,r,y,s,c,h,w,D]),Se((()=>{r||(x.current=void 0,A(),N())}),[r,A,N]),e.useEffect((()=>()=>{A(),clearTimeout(E.current),clearTimeout(P.current),N()}),[u,c,A,N]),e.useMemo((()=>{if(!u)return{};function e(e){x.current=e.pointerType}return{reference:{onPointerDown:e,onPointerEnter:e,onMouseMove(e){r||0===v||(clearTimeout(P.current),P.current=setTimeout((()=>{L.current||o(!0,e.nativeEvent,"hover")}),v))}},floating:{onMouseEnter(){clearTimeout(E.current)},onMouseLeave(e){M(e.nativeEvent,!1)}}}}),[u,v,r,o,M])}(j,{}),$=function(t){void 0===t&&(t=[]);const n=t,r=e.useCallback((e=>Je(e,t,"reference")),n),o=e.useCallback((e=>Je(e,t,"floating")),n),i=e.useCallback((e=>Je(e,t,"item")),t.map((e=>null==e?void 0:e.item)));return e.useMemo((()=>({getReferenceProps:r,getFloatingProps:o,getItemProps:i})),[r,o,i])}([X,K,z]),Y=$.getReferenceProps,q=$.getFloatingProps;return t.createElement("span",null,t.createElement("span",c({className:"rad-ui-popper ".concat(N,"-reference-element ").concat(d),ref:_.setReference},Y({onClick:function(){console.log("click")}})),h),W&&t.createElement("div",c({className:"".concat(N,"-floating-element"),ref:_.setFloating,style:V},q()),P&&t.createElement(He,{className:"rad-ui-arrow ".concat(N,"-arrow"),ref:F,context:j}),M))},nt=function(e){var n=e.children;e.label;var r=s(e,["children","label"]);return t.createElement("div",null,t.createElement(tt,c({popperName:"Tooltip",pop:"hello"},r),n))};export{nt as default};