@radui/ui 0.0.20 → 0.0.22
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.
- package/dist/components/Accordion.js +1 -1
- package/dist/components/Avatar.js +1 -1
- package/dist/components/Button.js +1 -1
- package/dist/components/Callout.js +1 -1
- package/dist/components/Dropdown.js +1 -1
- package/dist/components/Modal.js +2 -3
- package/dist/components/Progress.js +1 -1
- package/dist/components/Switch.js +1 -0
- package/dist/components/Tabs.js +1 -1
- package/dist/components/TextArea.js +1 -1
- package/dist/components/Toggle.js +1 -0
- package/dist/components/ToggleGroup.js +1 -0
- package/dist/components/Tooltip.js +1 -1
- package/dist/themes/default.css +1 -1
- package/dist/themes/default.css.map +1 -1
- package/package.json +17 -15
|
@@ -1 +1 @@
|
|
|
1
|
-
'use client';import e,{useState as
|
|
1
|
+
'use client';import e,{createContext as t,useRef as n,useState as r,useEffect as a,useContext as o,useId as c}from"react";var l=t({}),i=function(e){return e.querySelectorAll("[data-rad-ui-batch-element]")},u=function(e){void 0===e&&(e=[]);var t=null;return e.forEach((function(e){e.hasAttribute("data-rad-ui-focus-element")&&(t=e)})),t},d=function(t){var o=t.children,c=t.customRootClass,d=n(null),s=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):"")}(c,"Accordion"),v=r(null),f=v[0],m=v[1],p=r(null),b=p[0],h=p[1];a((function(){}),[]);return e.createElement(l.Provider,{value:{rootClass:s,activeItem:f,setActiveItem:m,focusNextItem:function(){var e=function(e){var t=u(e),n=null==t?void 0:t.nextElementSibling;return n||e[e.length-1]}(i(null==d?void 0:d.current));if(h(e),e){var t=e.querySelector("button");null==t||t.focus()}},focusPrevItem:function(){var e=function(e){void 0===e&&(e=[]);var t=u(e),n=null==t?void 0:t.previousElementSibling;return n||e[0]}(i(null==d?void 0:d.current));if(h(e),e){var t=e.querySelector("button");null==t||t.focus()}},focusItem:b,setFocusItem:h,accordionRef:d}},e.createElement("div",{className:"".concat(s,"-root"),ref:d},o))},s=function(){return s=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var a in t=arguments[n])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},s.apply(this,arguments)};"function"==typeof SuppressedError&&SuppressedError;var v=t({}),f=function(t){var i=t.children,u=t.value,d=t.className,f=void 0===d?"":d,m=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 a=0;for(r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]])}return n}(t,["children","value","className"]),p=n(null),b=r(u),h=b[0],E=b[1],y=o(l),I=y.rootClass,g=y.activeItem,N=y.focusItem,O=r(h===g),x=O[0],A=O[1];a((function(){A(h===g)}),[g]);var w=c(),C=!1;(null==N?void 0:N.id)==="accordion-data-item-".concat(w)&&(C=!0);var S=function(){var e=null==p?void 0:p.current;e&&e.setAttribute("data-rad-ui-focus-element","")};return e.createElement(v.Provider,{value:{itemValue:h,setItemValue:E,handleBlurEvent:function(e){var t=null==p?void 0:p.current;t&&t.removeAttribute("data-rad-ui-focus-element")},handleClickEvent:function(){S()},handleFocusEvent:function(){S()}}},e.createElement("div",s({ref:p,className:"".concat(I,"-item ").concat(f)},m,{id:"accordion-data-item-".concat(w),role:"region","aria-labelledby":"accordion-trigger-".concat(w),"aria-hidden":!x,"data-state":x?"open":"closed","data-rad-ui-batch-element":!0},C?{"data-rad-ui-focus-element":""}:{}),i))},m=function(t){var n=t.children,r=t.className,a=void 0===r?"":r;return e.createElement("div",{className:a},n)},p=function(t){var n=t.children,r=t.index,a=t.className,c=void 0===a?"":a,i=o(l),u=i.setActiveItem,d=i.rootClass,s=i.focusNextItem,f=i.focusPrevItem,m=i.activeItem,p=o(v),b=p.itemValue,h=p.handleBlurEvent,E=p.handleClickEvent,y=p.handleFocusEvent;return e.createElement("button",{type:"button",className:"".concat(d,"-trigger ").concat(c),onBlur:h,onFocus:function(){y()},onKeyDown:function(e){"ArrowDown"===e.key&&(e.preventDefault(),s()),"ArrowUp"===e.key&&(e.preventDefault(),f())},onClick:function(){m!==b?m!==b&&(u(b),E()):u(null)},"aria-expanded":m===b,"aria-controls":"content-".concat(r)},n)},b=function(t){var n=t.children,r=t.index;t.activeIndex;var a=t.className,c=void 0===a?"":a,i=o(l),u=i.activeItem,d=i.rootClass,s=o(v).itemValue;return e.createElement("div",{className:"".concat(d,"-content ").concat(c),id:"content-".concat(r),role:"region","aria-labelledby":"section-".concat(r),hidden:s!==u},n)},h=function(t){var n=t.items;return e.createElement(d,null,n.map((function(t,n){return e.createElement(f,{value:n,key:n},e.createElement(m,null,e.createElement(p,null,t.title)),e.createElement(b,null,t.content))})))};h.Root=d;export{h as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use client';import t,{useState as a,useEffect as
|
|
1
|
+
'use client';import t,{useState as a,useEffect as e}from"react";var r=function(){return r=Object.assign||function(t){for(var a,e=1,r=arguments.length;e<r;e++)for(var o in a=arguments[e])Object.prototype.hasOwnProperty.call(a,o)&&(t[o]=a[o]);return t},r.apply(this,arguments)};function o(t,a){var e={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&a.indexOf(r)<0&&(e[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(t);o<r.length;o++)a.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(e[r[o]]=t[r[o]])}return e}"function"==typeof SuppressedError&&SuppressedError;var c=function(t,a){void 0===t&&(t=""),void 0===a&&(a="");var e=a.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();return t||(a?"".concat("rad-ui","-").concat(e):"")},n=function(a){var e=a.children,r=a.customRootClass,o=c(r,"Avatar");return t.createElement("span",{className:"".concat(o,"-root")},e)},s=function(n){var s=n.src,l=n.alt,u=n.customRootClass,m=n.className,f=o(n,["src","alt","customRootClass","className"]),i=c(u,"Avatar"),p=a(!1),v=p[0],b=p[1];return e((function(){}),[v]),v||!s||0===s.length?t.createElement(t.Fragment,null):t.createElement("img",r({src:s,alt:l,onError:function(){b(!0)},onLoad:function(){b(!1)},className:"".concat(i," ").concat(m)},f))},l=function(a){var e=a.fallback,n=a.customRootClass,s=o(a,["fallback","customRootClass"]),l=c(n,"Avatar");return t.createElement("span",r({className:"".concat(l,"-fallback")},s),e)},u=function(a){a.children;var e=a.customRootClass,c=a.fallback,u=a.className,m=a.src,f=a.alt,i=o(a,["children","customRootClass","fallback","className","src","alt"]);return t.createElement(n,{customRootClass:e},t.createElement(s,r({src:m,alt:f,className:u,customRootClass:e},i)),t.createElement(l,{customRootClass:e,fallback:c}))};u.displayName="Avatar",u.Root=n,u.Image=s,u.Fallback=l;export{u as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use client';import t from"react";var o=function(){return o=Object.assign||function(t){for(var o,r=1,e=arguments.length;r<e;r++)for(var
|
|
1
|
+
'use client';import t from"react";var o=function(){return o=Object.assign||function(t){for(var o,r=1,e=arguments.length;r<e;r++)for(var a in o=arguments[r])Object.prototype.hasOwnProperty.call(o,a)&&(t[a]=o[a]);return t},o.apply(this,arguments)};"function"==typeof SuppressedError&&SuppressedError;var r="Button",e=function(e){var a=e.children,n=e.type,c=void 0===n?"button":n,i=e.customRootClass,l=void 0===i?"":i,s=e.color,p=void 0===s?"":s,u=e.className,d=void 0===u?"":u,v=e.variant,f=void 0===v?"solid":v,y=e.size,b=void 0===y?"":y,m=function(t,o){var r={};for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&o.indexOf(e)<0&&(r[e]=t[e]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(e=Object.getOwnPropertySymbols(t);a<e.length;a++)o.indexOf(e[a])<0&&Object.prototype.propertyIsEnumerable.call(t,e[a])&&(r[e[a]]=t[e[a]])}return r}(e,["children","type","customRootClass","color","className","variant","size"]),O=function(t,o){void 0===t&&(t=""),void 0===o&&(o="");var r=o.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();return t||(o?"".concat("rad-ui","-").concat(r):"")}(l,r);return t.createElement("button",o({type:c,className:"".concat(O," button-").concat(f," ").concat(d," "),"data-accent-color":null!=p?p:void 0,"data-size":b},m),a)};e.displayName=r;export{e as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use client';import o from"react";var r=function(){return r=Object.assign||function(o){for(var r,t=1,e=arguments.length;t<e;t++)for(var a in r=arguments[t])Object.prototype.hasOwnProperty.call(r,a)&&(o[a]=r[a]);return o},r.apply(this,arguments)};function t(o,r){var t={};for(var e in o)Object.prototype.hasOwnProperty.call(o,e)&&r.indexOf(e)<0&&(t[e]=o[e]);if(null!=o&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(e=Object.getOwnPropertySymbols(o);a<e.length;a++)r.indexOf(e[a])<0&&Object.prototype.propertyIsEnumerable.call(o,e[a])&&(t[e[a]]=o[e[a]])}return t}"function"==typeof SuppressedError&&SuppressedError;var e="Callout",a=function(a){var c=a.children,l=a.className,n=a.color,s=a.customRootClass,i=t(a,["children","className","color","customRootClass"]),u=function(o,r){void 0===o&&(o=""),void 0===r&&(r="");var t=r.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();return o||(r?"".concat("rad-ui","-").concat(t):"")}(s,e);return
|
|
1
|
+
'use client';import o from"react";var r=function(){return r=Object.assign||function(o){for(var r,t=1,e=arguments.length;t<e;t++)for(var a in r=arguments[t])Object.prototype.hasOwnProperty.call(r,a)&&(o[a]=r[a]);return o},r.apply(this,arguments)};function t(o,r){var t={};for(var e in o)Object.prototype.hasOwnProperty.call(o,e)&&r.indexOf(e)<0&&(t[e]=o[e]);if(null!=o&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(e=Object.getOwnPropertySymbols(o);a<e.length;a++)r.indexOf(e[a])<0&&Object.prototype.propertyIsEnumerable.call(o,e[a])&&(t[e[a]]=o[e[a]])}return t}"function"==typeof SuppressedError&&SuppressedError;var e="Callout",a=function(a){var c=a.children,l=a.className,n=a.color,s=a.customRootClass,i=t(a,["children","className","color","customRootClass"]),u=function(o,r){void 0===o&&(o=""),void 0===r&&(r="");var t=r.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();return o||(r?"".concat("rad-ui","-").concat(t):"")}(s,e);return o.createElement("div",r({className:"".concat(u," ").concat(l),"data-accent-color":null!=n?n:void 0},i),c)};a.displayName=e;var c=function(e){var c=e.children,l=e.className,n=void 0===l?"":l,s=e.color,i=e.customRootClass,u=t(e,["children","className","color","customRootClass"]);return o.createElement(a,r({customRootClass:i,className:"".concat(n),color:null!=s?s:void 0},u),c)};c.displayName="Callout",c.Root=a;export{c 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"==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
|
+
'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 m(e){return e instanceof HTMLElement||e instanceof a(e).HTMLElement}function p(e){return"undefined"!=typeof ShadowRoot&&(e instanceof ShadowRoot||e instanceof a(e).ShadowRoot)}function g(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 v(e){return["table","td","th"].includes(s(e))}function h(e){return[":popover-open",":modal"].some((t=>{try{return e.matches(t)}catch(e){return!1}}))}function y(e){const t=w(),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 w(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function x(e){return["html","body","#document"].includes(s(e))}function b(e){return a(e).getComputedStyle(e)}function E(e){return d(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function R(e){if("html"===s(e))return e;const t=e.assignedSlot||e.parentNode||p(e)&&e.host||u(e);return p(t)?t.host:t}function C(e){const t=R(e);return x(t)?e.ownerDocument?e.ownerDocument.body:e.body:m(t)&&g(t)?t:C(t)}function P(e,t,n){var r;void 0===t&&(t=[]),void 0===n&&(n=!0);const o=C(e),i=o===(null==(r=e.ownerDocument)?void 0:r.body),l=a(o);return i?t.concat(l,l.visualViewport||[],g(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&&p(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 M(e){return"composedPath"in e?e.composedPath()[0]:e.target}const S=["top","right","bottom","left"],D=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"},I={start:"end",end:"start"};function B(e,t,n){return A(e,D(t,n))}function _(e,t){return"function"==typeof e?e(t):e}function j(e){return e.split("-")[0]}function V(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(j(e))?"y":"x"}function $(e){return K(X(e))}function Y(e){return e.replace(/start|end/g,(e=>I[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){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function Q(e,t,n){let{reference:r,floating:o}=e;const i=X(t),l=$(t),c=z(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 m;switch(s){case"top":m={x:u,y:r.y-o.height};break;case"bottom":m={x:u,y:r.y+r.height};break;case"right":m={x:r.x+r.width,y:f};break;case"left":m={x:r.x-o.width,y:f};break;default:m={x:r.x,y:r.y}}switch(V(t)){case"start":m[l]-=d*(n&&a?-1:1);break;case"end":m[l]+=d*(n&&a?-1:1)}return m}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:m=0}=_(t,e),p=U(m),g=c[d?"floating"===f?"reference":"floating":f],v=Z(await i.getClippingRect({element:null==(n=await(null==i.isElement?void 0:i.isElement(g)))||n?g:g.contextElement||await(null==i.getDocumentElement?void 0:i.getDocumentElement(c.floating)),boundary:a,rootBoundary:u,strategy:s})),h="floating"===f?{x:r,y:o,width:l.floating.width,height:l.floating.height}: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},x=Z(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:h,offsetParent:y,strategy:s}):h);return{top:(v.top-x.top+p.top)/w.y,bottom:(x.bottom-v.bottom+p.bottom)/w.y,left:(v.left-x.left+p.left)/w.x,right:(x.right-v.right+p.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 S.some((t=>e[t]>=0))}function te(e){const t=b(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 ne(e){return d(e)?e:e.contextElement}function re(e){const t=ne(e);if(!m(t))return H(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=te(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 oe=H(0);function ie(e){const t=a(e);return w()&&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=H(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):H(0);let s=(o.left+c.x)/l.x,u=(o.top+c.y)/l.y,f=o.width/l.x,m=o.height/l.y;if(i){const e=a(i),t=r&&d(r)?a(r):r;let n=e,o=n.frameElement;for(;o&&r&&t!==n;){const e=re(o),t=o.getBoundingClientRect(),r=b(o),i=t.left+(o.clientLeft+parseFloat(r.paddingLeft))*e.x,l=t.top+(o.clientTop+parseFloat(r.paddingTop))*e.y;s*=e.x,u*=e.y,f*=e.x,m*=e.y,s+=i,u+=l,n=a(o),o=n.frameElement}}return Z({width:f,height:m,x:s,y:u})}function ce(e){return le(u(e)).left+E(e).scrollLeft}function se(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+ce(e);const c=-n.scrollTop;return"rtl"===b(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=le(e,!0,"fixed"===t),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=m(e)?re(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=ie(e);r={...t,x:t.x-n.x,y:t.y-n.y}}return Z(r)}function ae(e,t){const n=R(e);return!(n===t||!d(n)||x(n))&&("fixed"===b(n).position||ae(n,t))}function ue(e,t,n){const r=m(t),o=u(t),i="fixed"===n,l=le(e,!0,i,t);let c={scrollLeft:0,scrollTop:0};const a=H(0);if(r||!r&&!i)if(("body"!==s(t)||g(o))&&(c=E(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=ce(o));return{x:l.left+c.scrollLeft-a.x,y:l.top+c.scrollTop-a.y,width:l.width,height:l.height}}function fe(e){return"static"===b(e).position}function de(e,t){return m(e)&&"fixed"!==b(e).position?t?t(e):e.offsetParent:null}function me(e,t){const n=a(e);if(h(e))return n;if(!m(e)){let t=R(e);for(;t&&!x(t);){if(d(t)&&!fe(t))return t;t=R(t)}return n}let r=de(e,t);for(;r&&v(r)&&fe(r);)r=de(r,t);return r&&x(r)&&fe(r)&&!y(r)?n:r||function(e){let t=R(e);for(;m(t)&&!x(t);){if(h(t))return null;if(y(t))return t;t=R(t)}return null}(e)||n}const pe={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i="fixed"===o,l=u(r),c=!!t&&h(t.floating);if(r===l||c&&i)return n;let a={scrollLeft:0,scrollTop:0},f=H(1);const d=H(0),p=m(r);if((p||!p&&!i)&&(("body"!==s(r)||g(l))&&(a=E(r)),m(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?h(t)?[]: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?R(e):e;for(;d(l)&&!x(l);){const t=b(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&&ae(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=se(t,n,o);return e.top=A(r.top,e.top),e.right=D(r.right,e.right),e.bottom=D(r.bottom,e.bottom),e.left=A(r.left,e.left),e}),se(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,r=await n(e.floating);return{reference:ue(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}},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 m={rootMargin:-F(u)+"px "+-F(o.clientWidth-(a+f))+"px "+-F(o.clientHeight-(u+d))+"px "+-F(a)+"px",threshold:A(0,D(1,s))||1};let p=!0;function g(e){const t=e[0].intersectionRatio;if(t!==s){if(!p)return l();t?l(!1,t):n=setTimeout((()=>{l(!1,1e-7)}),1e3)}p=!1}try{r=new IntersectionObserver(g,{...m,root:o.ownerDocument})}catch(e){r=new IntersectionObserver(g,m)}r.observe(e)}(!0),i}(a,n):null;let m,p=-1,g=null;l&&(g=new ResizeObserver((e=>{let[r]=e;r&&r.target===a&&g&&(g.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame((()=>{var e;null==(e=g)||e.observe(t)}))),n()})),a&&!s&&g.observe(a),g.observe(t));let v=s?le(e):null;return s&&function t(){const r=le(e);!v||r.x===v.x&&r.y===v.y&&r.width===v.width&&r.height===v.height||n();v=r,m=requestAnimationFrame(t)}(),n(),()=>{var e;f.forEach((e=>{o&&e.removeEventListener("scroll",n),i&&e.removeEventListener("resize",n)})),null==d||d(),null==(e=g)||e.disconnect(),g=null,s&&cancelAnimationFrame(m)}}const ve=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=V(n),s="y"===X(n),a=["left","top"].includes(l)?-1:1,u=i&&s?-1:1,f=_(t,e);let{mainAxis:d,crossAxis:m,alignmentAxis:p}="number"==typeof f?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...f};return c&&"number"==typeof p&&(m="end"===c?-1*p:p),s?{x:m*u,y:d*a}:{x:d*a,y:m*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}}}}},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}=_(e,t),a={x:n,y:r},u=await G(t,s),f=X(j(o)),d=K(f);let m=a[d],p=a[f];if(i){const e="y"===d?"bottom":"right";m=B(m+u["y"===d?"top":"left"],m,m-u[e])}if(l){const e="y"===f?"bottom":"right";p=B(p+u["y"===f?"top":"left"],p,p-u[e])}const g=c.fn({...t,[d]:m,[f]:p});return{...g,data:{x:g.x-n,y:g.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:m="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:g=!0,...v}=_(e,t);if(null!=(n=i.arrow)&&n.alignmentOffset)return{};const h=j(o),y=X(c),w=j(c)===c,x=await(null==s.isRTL?void 0:s.isRTL(a.floating)),b=d||(w||!g?[q(c)]:function(e){const t=q(e);return[Y(e),t,Y(t)]}(c)),E="none"!==p;!d&&E&&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[]}}(j(e),"start"===n,r);return o&&(i=i.map((e=>e+"-"+o)),t&&(i=i.concat(i.map(Y)))),i}(c,g,p,x));const R=[c,...b],C=await G(t,v),P=[];let L=(null==(r=i.flip)?void 0:r.overflows)||[];if(u&&P.push(C[h]),f){const e=function(e,t,n){void 0===n&&(n=!1);const r=V(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,x);P.push(C[e[0]],C[e[1]])}if(L=[...L,{placement:o,overflows:P}],!P.every((e=>e<=0))){var O,k;const e=((null==(O=i.flip)?void 0:O.index)||0)+1,t=R[e];if(t)return{data:{index:e,overflows:L},reset:{placement:t}};let n=null==(k=L.filter((e=>e.overflows[0]<=0)).sort(((e,t)=>e.overflows[1]-t.overflows[1]))[0])?void 0:k.placement;if(!n)switch(m){case"bestFit":{var T;const e=null==(T=L.filter((e=>{if(E){const t=X(e.placement);return t===y||"y"===t}return!0})).map((e=>[e.placement,e.overflows.filter((e=>e>0)).reduce(((e,t)=>e+t),0)])).sort(((e,t)=>e[1]-t[1]))[0])?void 0:T[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}=_(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},m=$(o),p=z(m),g=await l.getDimensions(a),v="y"===m,h=v?"top":"left",y=v?"bottom":"right",w=v?"clientHeight":"clientWidth",x=i.reference[p]+i.reference[m]-d[m]-i.floating[p],b=d[m]-i.reference[m],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[p]);const C=x/2-b/2,P=R/2-g[p]/2-1,L=D(f[h],P),O=D(f[y],P),k=L,T=R-g[p]-O,M=R/2-g[p]/2+C,S=B(k,M,T),A=!s.arrow&&null!=V(o)&&M!==S&&i.reference[p]/2-(M<k?L:O)-g[p]/2<0,N=A?M<k?M-k:M-T:0;return{[m]:d[m]+N,data:{[m]:S,centerOffset:M-S-N,...A&&{alignmentOffset:N}},reset:A}}}),be=(e,t,n)=>{const r=new Map,o={platform:pe,...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,m={},p=0;for(let n=0;n<c.length;n++){const{name:i,fn:g}=c[n],{x:v,y:h,data:y,reset:w}=await g({x:u,y:f,initialPlacement:r,placement:d,strategy:o,middlewareData:m,rects:a,platform:l,elements:{reference:e,floating:t}});u=null!=v?v:u,f=null!=h?h:f,m={...m,[i]:{...m[i],...y}},w&&p<=50&&(p++,"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:m}})(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 Ce(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Pe(e,t){const n=Ce(e);return Math.round(t*n)/n}function Le(t){const n=e.useRef(t);return Ee((()=>{n.current=t})),n}const Oe=e=>({name:"arrow",options:e,fn(t){const{element:n,padding:r}="function"==typeof e?e(t):e;return n&&(o=n,{}.hasOwnProperty.call(o,"current"))?null!=n.current?xe({element:n.current,padding:r}).fn(t):{}:n?xe({element:n,padding:r}).fn(t):{};var o}}),ke=(e,t)=>({...ve(e),options:[e,t]}),Te=(e,t)=>({...he(e),options:[e,t]}),Me=(e,t)=>({...ye(e),options:[e,t]}),Se=(e,t)=>({...we(e),options:[e,t]}),De={...e},Ae=De.useInsertionEffect||(e=>e());function Ne(t){const n=e.useRef((()=>{if("production"!==process.env.NODE_ENV)throw new Error("Cannot call an event handler while rendering.")}));return Ae((()=>{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 Fe="undefined"!=typeof document?n:r;function He(){return He=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},He.apply(this,arguments)}let We=!1,Ie=0;const Be=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+Ie++;const _e=De.useId||function(){const[t,n]=e.useState((()=>We?Be():void 0));return Fe((()=>{null==t&&n(Be())}),[]),e.useEffect((()=>{We=!0}),[]),t};let je;"production"!==process.env.NODE_ENV&&(je=new Set);const Ve=e.forwardRef((function(t,n){const{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:m,...p}={},...g}=t;"production"!==process.env.NODE_ENV&&(n||function(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];const o="Floating UI: "+n.join(" ");var i;null!=(e=je)&&e.has(o)||(null==(i=je)||i.add(o),console.warn(o))}("The `ref` prop is required for `FloatingArrow`."));const v=_e(),[h,y]=e.useState(!1);if(Fe((()=>{if(!o)return;"rtl"===b(o).direction&&y(!0)}),[o]),!o)return null;const w=2*a,x=w/2,E=l/2*(s/-8+1),R=c/2*s/4,[C,P]=r.split("-"),L=!!d,O="top"===C||"bottom"===C,k=u&&"end"===P?"bottom":"top";let T=u&&"end"===P?"right":"left";u&&h&&(T="end"===P?"left":"right");const M=null!=(null==i?void 0:i.x)?u||i.x:"",S=null!=(null==i?void 0:i.y)?u||i.y:"",D=d||"M0,0 H"+l+" L"+(l-E)+","+(c-R)+" Q"+l/2+","+c+" "+E+","+(c-R)+" Z",A={top:L?"rotate(180deg)":"",left:L?"rotate(90deg)":"rotate(-90deg)",bottom:L?"":"rotate(180deg)",right:L?"rotate(-90deg)":"rotate(90deg)"}[C];return e.createElement("svg",He({},g,{"aria-hidden":!0,ref:n,width:L?l:l+w,height:l,viewBox:"0 0 "+l+" "+(c>l?c:l),style:{position:"absolute",pointerEvents:"none",[T]:M,[k]:S,[C]:O||L?"100%":"calc(100% - "+w/2+"px)",transform:""+A+(null!=m?m:""),...p}}),w>0&&e.createElement("path",{clipPath:"url(#"+v+")",fill:"none",stroke:f,strokeWidth:w+(d?0:1),d:D}),e.createElement("path",{stroke:w&&!d?g.fill:"none",d:D}),e.createElement("clipPath",{id:v},e.createElement("rect",{x:-x,y:x*(L?-1:1),width:l+w,height:l})))}));const Ke=e.createContext(null),ze=e.createContext(null),Xe=()=>{var t;return(null==(t=e.useContext(Ke))?void 0:t.id)||null},$e=()=>e.useContext(ze);function Ye(e){return"data-floating-ui-"+e}function qe(e){const t=o(e);return Fe((()=>{t.current=e})),t}const Ue=Ye("safe-polygon");function Ze(e,t,n){return n&&!O(n)?0:"number"==typeof e?e:null==e?void 0: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}const Ge={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},Je={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},et=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}};function tt(t){const{open:n=!1,onOpenChange:r,elements:o}=t,i=_e(),l=e.useRef({}),[c]=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)))||[])}}}())),s=null!=Xe();if("production"!==process.env.NODE_ENV){const e=o.reference;e&&!d(e)&&function(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];const o="Floating UI: "+n.join(" ");var i;null!=(e=je)&&e.has(o)||(null==(i=je)||i.add(o),console.error(o))}("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `refs.setPositionReference()`","instead.")}const[a,u]=e.useState(o.reference),f=Ne(((e,t,n)=>{l.current.openEvent=e?t:void 0,c.emit("openchange",{open:e,event:t,reason:n,nested:s}),null==r||r(e,t,n)})),m=e.useMemo((()=>({setPositionReference:u})),[]),p=e.useMemo((()=>({reference:a||o.reference||null,floating:o.floating||null,domReference:o.reference})),[a,o.reference,o.floating]);return e.useMemo((()=>({dataRef:l,open:n,onOpenChange:f,elements:p,events:c,floatingId:i,refs:m})),[n,f,p,c,i,m])}function nt(t){void 0===t&&(t={});const{nodeId:n}=t,r=tt({...t,elements:{reference:null,floating:null,...t.elements}}),o=t.rootContext||r,i=o.elements,[c,s]=e.useState(null),[a,u]=e.useState(null),f=(null==i?void 0:i.reference)||c,m=e.useRef(null),p=$e();Fe((()=>{f&&(m.current=f)}),[f]);const g=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,m]=e.useState({x:0,y:0,strategy:r,placement:n,middlewareData:{},isPositioned:!1}),[p,g]=e.useState(o);Re(p,o)||g(o);const[v,h]=e.useState(null),[y,w]=e.useState(null),x=e.useCallback((e=>{e!==C.current&&(C.current=e,h(e))}),[]),b=e.useCallback((e=>{e!==P.current&&(P.current=e,w(e))}),[]),E=c||v,R=s||y,C=e.useRef(null),P=e.useRef(null),L=e.useRef(d),O=null!=u,k=Le(u),T=Le(i),M=e.useCallback((()=>{if(!C.current||!P.current)return;const e={placement:n,strategy:r,middleware:p};T.current&&(e.platform=T.current),be(C.current,P.current,e).then((e=>{const t={...e,isPositioned:!0};S.current&&!Re(L.current,t)&&(L.current=t,l.flushSync((()=>{m(t)})))}))}),[p,n,r,T]);Ee((()=>{!1===f&&L.current.isPositioned&&(L.current.isPositioned=!1,m((e=>({...e,isPositioned:!1}))))}),[f]);const S=e.useRef(!1);Ee((()=>(S.current=!0,()=>{S.current=!1})),[]),Ee((()=>{if(E&&(C.current=E),R&&(P.current=R),E&&R){if(k.current)return k.current(E,R,M);M()}}),[E,R,M,k,O]);const D=e.useMemo((()=>({reference:C,floating:P,setReference:x,setFloating:b})),[x,b]),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=Pe(A.floating,d.x),n=Pe(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:M,refs:D,elements:A,floatingStyles:N})),[d,M,D,A,N])}({...t,elements:{...i,...a&&{reference:a}}}),v=e.useCallback((e=>{const t=d(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:e}:e;u(t),g.refs.setReference(t)}),[g.refs]),h=e.useCallback((e=>{(d(e)||null===e)&&(m.current=e,s(e)),(d(g.refs.reference.current)||null===g.refs.reference.current||null!==e&&!d(e))&&g.refs.setReference(e)}),[g.refs]),y=e.useMemo((()=>({...g.refs,setReference:h,setPositionReference:v,domReference:m})),[g.refs,h,v]),w=e.useMemo((()=>({...g.elements,domReference:f})),[g.elements,f]),x=e.useMemo((()=>({...g,...o,refs:y,elements:w,nodeId:n})),[g,y,w,n,o]);return Fe((()=>{o.dataRef.current.floatingContext=x;const e=null==p?void 0:p.nodesRef.current.find((e=>e.id===n));e&&(e.context=x)})),e.useMemo((()=>({...g,context:x,refs:y,elements:w})),[g,y,w,x])}const rt="active",ot="selected";function it(e,t,n){const r=new Map,o="item"===n;let i=e;if(o&&e){const{[rt]:t,[ot]: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&&[rt,ot].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 lt=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);var ct=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,p=n.placement,g=void 0===p?"top":p,v=n.children,h=n.open,y=void 0!==h&&h;n.hoverDelay;var w=n.showArrow,E=void 0===w||w,C=n.pop,S=void 0===C?t.createElement(t.Fragment,null):C;!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 D,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):"")}(a,l),F=o(null),H=i(y),W=H[0],I=H[1],B=nt({placement:g,whileElementsMounted:ge,open:W,middleware:[(D={element:F},{...Oe(D),options:[D,A]}),ke(9),Me({mainAxis:!0,fallbackStrategy:"initialPlacement"}),Te({crossAxis:!1}),Se({strategy:"referenceHidden"})],onOpenChange:I}),_=B.refs,j=B.floatingStyles,V=B.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=lt.get(c))?r:c,a=_e(),u=null!=Xe(),f=e.useMemo((()=>"tooltip"===s||"label"===c?{["aria-"+("label"===c?"labelledby":"describedby")]:o?i:void 0}:{"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"}}),[s,i,u,o,a,c]),d=e.useMemo((()=>{const e={id:i,...s&&{role:s}};return"tooltip"===s||"label"===c?e:{...e,..."menu"===s&&{"aria-labelledby":a}}}),[s,i,a,c]),m=e.useCallback((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{}}),[i,c]);return e.useMemo((()=>l?{reference:f,floating:d,item:m}:{}),[l,f,d,m])}(V),z=function(t,n){void 0===n&&(n={});const{open:r,onOpenChange:o,elements:i,dataRef:l}=t,{enabled:c=!0,escapeKey:s=!0,outsidePress:a=!0,outsidePressEvent:u="pointerdown",referencePress:f=!1,referencePressEvent:p="pointerdown",ancestorScroll:g=!1,bubbles:v,capture:h}=n,y=$e(),w=Ne("function"==typeof a?a:()=>!1),E="function"==typeof a?w:a,C=e.useRef(!1),O=e.useRef(!1),{escapeKey:S,outsidePress:D}=et(v),{escapeKey:A,outsidePress:N}=et(h),F=Ne((e=>{var t;if(!r||!c||!s||"Escape"!==e.key)return;const n=null==(t=l.current.floatingContext)?void 0:t.nodeId,i=y?Qe(y.nodesRef.current,n):[];if(!S&&(e.stopPropagation(),i.length>0)){let e=!0;if(i.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")})),H=Ne((e=>{var t;const n=()=>{var t;F(e),null==(t=M(e))||t.removeEventListener("keydown",n)};null==(t=M(e))||t.addEventListener("keydown",n)})),W=Ne((e=>{var t;const n=C.current;C.current=!1;const r=O.current;if(O.current=!1,"click"===u&&r)return;if(n)return;if("function"==typeof E&&!E(e))return;const c=M(e),s="["+Ye("inert")+"]",a=k(i.floating).querySelectorAll(s);let f=d(c)?c:null;for(;f&&!x(f);){const e=R(f);if(x(e)||!d(e))break;f=e}if(a.length&&d(c)&&!c.matches("html,body")&&!L(c,i.floating)&&Array.from(a).every((e=>!L(f,e))))return;if(m(c)&&_){const t=c.clientWidth>0&&c.scrollWidth>c.clientWidth,n=c.clientHeight>0&&c.scrollHeight>c.clientHeight;let r=n&&e.offsetX>c.clientWidth;if(n&&"rtl"===b(c).direction&&(r=e.offsetX<=c.offsetWidth-c.clientWidth),r||t&&e.offsetY>c.clientHeight)return}const p=null==(t=l.current.floatingContext)?void 0:t.nodeId,g=y&&Qe(y.nodesRef.current,p).some((t=>{var n;return T(e,null==(n=t.context)?void 0:n.elements.floating)}));if(T(e,i.floating)||T(e,i.domReference)||g)return;const v=y?Qe(y.nodesRef.current,p):[];if(v.length>0){let e=!0;if(v.forEach((t=>{var n;null==(n=t.context)||!n.open||t.context.dataRef.current.__outsidePressBubbles||(e=!1)})),!e)return}o(!1,e,"outside-press")})),I=Ne((e=>{var t;const n=()=>{var t;W(e),null==(t=M(e))||t.removeEventListener(u,n)};null==(t=M(e))||t.addEventListener(u,n)}));e.useEffect((()=>{if(!r||!c)return;function e(e){o(!1,e,"ancestor-scroll")}l.current.__escapeKeyBubbles=S,l.current.__outsidePressBubbles=D;const t=k(i.floating);s&&t.addEventListener("keydown",A?H:F,A),E&&t.addEventListener(u,N?I:W,N);let n=[];return g&&(d(i.domReference)&&(n=P(i.domReference)),d(i.floating)&&(n=n.concat(P(i.floating))),!d(i.reference)&&i.reference&&i.reference.contextElement&&(n=n.concat(P(i.reference.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})})),()=>{s&&t.removeEventListener("keydown",A?H:F,A),E&&t.removeEventListener(u,N?I:W,N),n.forEach((t=>{t.removeEventListener("scroll",e)}))}}),[l,i,s,E,u,r,o,g,c,S,D,F,A,H,W,N,I]),e.useEffect((()=>{C.current=!1}),[E,u]);const B=e.useMemo((()=>({onKeyDown:F,[Ge[p]]:e=>{f&&o(!1,e.nativeEvent,"reference-press")}})),[F,o,f,p]),_=e.useMemo((()=>({onKeyDown:F,onMouseDown(){O.current=!0},onMouseUp(){O.current=!0},[Je[u]]:()=>{C.current=!0}})),[F,u]);return e.useMemo((()=>c?{reference:B,floating:_}:{}),[c,B,_])}(V),X=function(t,n){void 0===n&&(n={});const{open:r,onOpenChange:o,dataRef:i,events:l,elements:c}=t,{enabled:s=!0,delay:a=0,handleClose:u=null,mouseOnly:f=!1,restMs:m=0,move:p=!0}=n,g=$e(),v=Xe(),h=qe(u),y=qe(a),w=qe(r),x=e.useRef(),b=e.useRef(-1),E=e.useRef(),R=e.useRef(-1),C=e.useRef(!0),P=e.useRef(!1),T=e.useRef((()=>{})),M=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(s)return l.on("openchange",e),()=>{l.off("openchange",e)};function e(e){let{open:t}=e;t||(clearTimeout(b.current),clearTimeout(R.current),C.current=!0)}}),[s,l]),e.useEffect((()=>{if(!s)return;if(!h.current)return;if(!r)return;function e(e){M()&&o(!1,e,"hover")}const t=k(c.floating).documentElement;return t.addEventListener("mouseleave",e),()=>{t.removeEventListener("mouseleave",e)}}),[c.floating,r,o,s,h,M]);const S=e.useCallback((function(e,t,n){void 0===t&&(t=!0),void 0===n&&(n="hover");const r=Ze(y.current,"close",x.current);r&&!E.current?(clearTimeout(b.current),b.current=window.setTimeout((()=>o(!1,e,n)),r)):t&&(clearTimeout(b.current),o(!1,e,n))}),[y,o]),D=Ne((()=>{T.current(),E.current=void 0})),A=Ne((()=>{if(P.current){const e=k(c.floating).body;e.style.pointerEvents="",e.removeAttribute(Ue),P.current=!1}}));e.useEffect((()=>{if(s&&d(c.domReference)){var e;const t=c.domReference;return r&&t.addEventListener("mouseleave",a),null==(e=c.floating)||e.addEventListener("mouseleave",a),p&&t.addEventListener("mousemove",n,{once:!0}),t.addEventListener("mouseenter",n),t.addEventListener("mouseleave",l),()=>{var e;r&&t.removeEventListener("mouseleave",a),null==(e=c.floating)||e.removeEventListener("mouseleave",a),p&&t.removeEventListener("mousemove",n),t.removeEventListener("mouseenter",n),t.removeEventListener("mouseleave",l)}}function t(){return!!i.current.openEvent&&["click","mousedown"].includes(i.current.openEvent.type)}function n(e){if(clearTimeout(b.current),C.current=!1,f&&!O(x.current)||m>0&&!Ze(y.current,"open"))return;const t=Ze(y.current,"open",x.current);t?b.current=window.setTimeout((()=>{w.current||o(!0,e,"hover")}),t):o(!0,e,"hover")}function l(e){if(t())return;T.current();const n=k(c.floating);if(clearTimeout(R.current),h.current&&i.current.floatingContext){r||clearTimeout(b.current),E.current=h.current({...i.current.floatingContext,tree:g,x:e.clientX,y:e.clientY,onClose(){A(),D(),S(e,!0,"safe-polygon")}});const t=E.current;return n.addEventListener("mousemove",t),void(T.current=()=>{n.removeEventListener("mousemove",t)})}("touch"!==x.current||!L(c.floating,e.relatedTarget))&&S(e)}function a(e){t()||i.current.floatingContext&&(null==h.current||h.current({...i.current.floatingContext,tree:g,x:e.clientX,y:e.clientY,onClose(){A(),D(),S(e)}})(e))}}),[c,s,t,f,m,p,S,D,A,o,r,w,g,y,h,i]),Fe((()=>{var e;if(s&&r&&null!=(e=h.current)&&e.__options.blockPointerEvents&&M()){const e=k(c.floating).body;e.setAttribute(Ue,""),e.style.pointerEvents="none",P.current=!0;const n=c.floating;if(d(c.domReference)&&n){var t;const e=c.domReference,r=null==g||null==(t=g.nodesRef.current.find((e=>e.id===v)))||null==(t=t.context)?void 0:t.elements.floating;return r&&(r.style.pointerEvents=""),e.style.pointerEvents="auto",n.style.pointerEvents="auto",()=>{e.style.pointerEvents="",n.style.pointerEvents=""}}}}),[s,r,v,c,g,h,M]),Fe((()=>{r||(x.current=void 0,D(),A())}),[r,D,A]),e.useEffect((()=>()=>{D(),clearTimeout(b.current),clearTimeout(R.current),A()}),[s,c.domReference,D,A]);const N=e.useMemo((()=>{function e(e){x.current=e.pointerType}return{onPointerDown:e,onPointerEnter:e,onMouseMove(e){const{nativeEvent:t}=e;function n(){C.current||w.current||o(!0,t,"hover")}f&&!O(x.current)||r||0===m||(clearTimeout(R.current),"touch"===x.current?n():R.current=window.setTimeout(n,m))}}}),[f,o,r,w,m]),F=e.useMemo((()=>({onMouseEnter(){clearTimeout(b.current)},onMouseLeave(e){S(e.nativeEvent,!1)}})),[S]);return e.useMemo((()=>s?{reference:N,floating:F}:{}),[s,N,F])}(V,{}),$=function(t){void 0===t&&(t=[]);const n=t.map((e=>null==e?void 0:e.reference)),r=t.map((e=>null==e?void 0:e.floating)),o=t.map((e=>null==e?void 0:e.item)),i=e.useCallback((e=>it(e,t,"reference")),n),l=e.useCallback((e=>it(e,t,"floating")),r),c=e.useCallback((e=>it(e,t,"item")),o);return e.useMemo((()=>({getReferenceProps:i,getFloatingProps:l,getItemProps:c})),[i,l,c])}([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(f),ref:_.setReference},Y({onClick:function(){console.log("click")}})),v),W&&t.createElement("div",c({className:"".concat(N,"-floating-element"),ref:_.setFloating,style:j},q()),E&&t.createElement(Ve,{className:"rad-ui-arrow ".concat(N,"-arrow"),ref:F,context:V}),S))},st=function(e){var n=e.list,r=void 0===n?[]:n;e.selected;return t.createElement("div",{className:"relative"},t.createElement(ct,{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{st as default};
|
package/dist/components/Modal.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
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}
|
|
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";function l(e){return s(e)?(e.nodeName||"").toLowerCase():"#document"}function u(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function c(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 u(e).Node}function a(e){return e instanceof Element||e instanceof u(e).Element}function f(e){return e instanceof HTMLElement||e instanceof u(e).HTMLElement}function d(e){return"undefined"!=typeof ShadowRoot&&(e instanceof ShadowRoot||e instanceof u(e).ShadowRoot)}function p(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 m(e){return["table","td","th"].includes(l(e))}function h(e){return[":popover-open",":modal"].some((t=>{try{return e.matches(t)}catch(e){return!1}}))}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(l(e))}function w(e){return u(e).getComputedStyle(e)}function b(e){return a(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function x(e){if("html"===l(e))return e;const t=e.assignedSlot||e.parentNode||d(e)&&e.host||c(e);return d(t)?t.host:t}function E(e){const t=x(e);return y(t)?e.ownerDocument?e.ownerDocument.body:e.body:f(t)&&p(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=u(o);return i?t.concat(l,l.visualViewport||[],p(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&&d(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 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/")&&(!O()&&0===e.width&&0===e.height||O()&&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 O(){const e=/android/i;return e.test(T())||e.test(N())}function A(e){return(null==e?void 0:e.ownerDocument)||document}function k(e){return"composedPath"in e?e.composedPath()[0]:e.target}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 f(e)&&e.matches(M)}(e))}const F=Math.min,P=Math.max,W=Math.round,j=e=>({x:e,y:e});function V(e){return e.split("-")[0]}function B(e){return["top","bottom"].includes(V(e))?"y":"x"}function H(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}
|
|
2
2
|
/*!
|
|
3
3
|
* tabbable 6.2.0
|
|
4
4
|
* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
|
|
5
|
-
*/
|
|
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};
|
|
5
|
+
*/var q=["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(","),_="undefined"==typeof Element,U=_?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,$=!_&&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},z=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)},X=function e(t,n,r){for(var o=[],i=Array.from(t);i.length;){var l=i.shift();if(!z(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{U.call(l,q)&&r.filter(l)&&(n||!t.includes(l))&&o.push(l);var s=l.shadowRoot||"function"==typeof r.getShadowRoot&&r.getShadowRoot(l),a=!z(s,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(l));if(s&&a){var f=e(!0===s?l.children:s.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},Y=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},K=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))&&!Y(e)?0:e.tabIndex},G=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},J=function(e){return"INPUT"===e.tagName},Q=function(e){return function(e){return J(e)&&"radio"===e.type}(e)&&!function(e){if(!e.name)return!0;var t,n=e.form||$(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)},Z=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=U.call(e,"details>summary:first-of-type")?e.parentElement:e;if(U.call(o,"details:not([open]) *"))return!0;if(n&&"full"!==n&&"legacy-full"!==n){if("non-zero-area"===n)return Z(e)}else{if("function"==typeof r){for(var i=e;e;){var l=e.parentElement,u=$(e);if(l&&!l.shadowRoot&&!0===r(l))return Z(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&&$(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,s,a;u=!(null===(s=l=null===(c=i=$(l))||void 0===c?void 0:c.host)||void 0===s||null===(a=s.ownerDocument)||void 0===a||!a.contains(l))}return u}(e))return!e.getClientRects().length;if("legacy-full"!==n)return!0}return!1},te=function(e,t){return!(t.disabled||z(t)||function(e){return J(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!!U.call(t,"fieldset[disabled] *")||!r.contains(e)}return!0}t=t.parentElement}return!1}(t))},ne=function(e,t){return!(Q(t)||K(t)<0||!te(e,t))},re=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},oe=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=K(e);return n<0&&t&&!Y(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(G).reduce((function(e,t){return t.isScope?e.push.apply(e,t.content):e.push(t.content),e}),[]).concat(n)},ie=function(e,t){var n;return n=(t=t||{}).getShadowRoot?X([e],t.includeContainer,{filter:ne.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:re}):function(e,t,n){if(z(e))return[];var r=Array.prototype.slice.apply(e.querySelectorAll(q));return t&&U.call(e,q)&&r.unshift(e),r.filter(n)}(e,t.includeContainer,ne.bind(null,t)),oe(n)},le=function(e,t){if(t=t||{},!e)throw new Error("No node provided");return!1!==U.call(e,q)&&ne(t,e)};function ue(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=V(t),s="y"===i,a=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:a,y:r.y-o.height};break;case"bottom":p={x:a,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&&s?-1:1);break;case"end":p[l]+=d*(n&&s?-1:1)}return p}function ce(e){const t=w(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=f(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 se(e){return a(e)?e:e.contextElement}function ae(e){const t=se(e);if(!f(t))return j(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=ce(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 fe=j(0);function de(e){const t=u(e);return g()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:fe}function pe(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);const o=e.getBoundingClientRect(),i=se(e);let l=j(1);t&&(r?a(r)&&(l=ae(r)):l=ae(e));const c=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==u(e))&&t}(i,n,r)?de(i):j(0);let s=(o.left+c.x)/l.x,f=(o.top+c.y)/l.y,d=o.width/l.x,p=o.height/l.y;if(i){const e=u(i),t=r&&a(r)?u(r):r;let n=e,o=n.frameElement;for(;o&&r&&t!==n;){const e=ae(o),t=o.getBoundingClientRect(),r=w(o),i=t.left+(o.clientLeft+parseFloat(r.paddingLeft))*e.x,l=t.top+(o.clientTop+parseFloat(r.paddingTop))*e.y;s*=e.x,f*=e.y,d*=e.x,p*=e.y,s+=i,f+=l,n=u(o),o=n.frameElement}}return H({width:d,height:p,x:s,y:f})}function me(e){return pe(c(e)).left+b(e).scrollLeft}function he(e,t,n){let r;if("viewport"===t)r=function(e,t){const n=u(e),r=c(e),o=n.visualViewport;let i=r.clientWidth,l=r.clientHeight,s=0,a=0;if(o){i=o.width,l=o.height;const e=g();(!e||e&&"fixed"===t)&&(s=o.offsetLeft,a=o.offsetTop)}return{width:i,height:l,x:s,y:a}}(e,n);else if("document"===t)r=function(e){const t=c(e),n=b(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+me(e);const u=-n.scrollTop;return"rtl"===w(r).direction&&(l+=P(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:l,y:u}}(c(e));else if(a(t))r=function(e,t){const n=pe(e,!0,"fixed"===t),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=f(e)?ae(e):j(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=de(e);r={...t,x:t.x-n.x,y:t.y-n.y}}return H(r)}function ve(e,t){const n=x(e);return!(n===t||!a(n)||y(n))&&("fixed"===w(n).position||ve(n,t))}function ge(e,t,n){const r=f(t),o=c(t),i="fixed"===n,u=pe(e,!0,i,t);let s={scrollLeft:0,scrollTop:0};const a=j(0);if(r||!r&&!i)if(("body"!==l(t)||p(o))&&(s=b(t)),r){const e=pe(t,!0,i,t);a.x=e.x+t.clientLeft,a.y=e.y+t.clientTop}else o&&(a.x=me(o));return{x:u.left+s.scrollLeft-a.x,y:u.top+s.scrollTop-a.y,width:u.width,height:u.height}}function ye(e){return"static"===w(e).position}function we(e,t){return f(e)&&"fixed"!==w(e).position?t?t(e):e.offsetParent:null}function be(e,t){const n=u(e);if(h(e))return n;if(!f(e)){let t=x(e);for(;t&&!y(t);){if(a(t)&&!ye(t))return t;t=x(t)}return n}let r=we(e,t);for(;r&&m(r)&&ye(r);)r=we(r,t);return r&&y(r)&&ye(r)&&!v(r)?n:r||function(e){let t=x(e);for(;f(t)&&!y(t);){if(h(t))return null;if(v(t))return t;t=x(t)}return null}(e)||n}const xe={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i="fixed"===o,u=c(r),s=!!t&&h(t.floating);if(r===u||s&&i)return n;let a={scrollLeft:0,scrollTop:0},d=j(1);const m=j(0),v=f(r);if((v||!v&&!i)&&(("body"!==l(r)||p(u))&&(a=b(r)),f(r))){const e=pe(r);d=ae(r),m.x=e.x+r.clientLeft,m.y=e.y+r.clientTop}return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-a.scrollLeft*d.x+m.x,y:n.y*d.y-a.scrollTop*d.y+m.y}},getDocumentElement:c,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[..."clippingAncestors"===n?h(t)?[]:function(e,t){const n=t.get(e);if(n)return n;let r=R(e,[],!1).filter((e=>a(e)&&"body"!==l(e))),o=null;const i="fixed"===w(e).position;let u=i?x(e):e;for(;a(u)&&!y(u);){const t=w(u),n=v(u);n||"fixed"!==t.position||(o=null),(i?!n&&!o:!n&&"static"===t.position&&o&&["absolute","fixed"].includes(o.position)||p(u)&&!n&&ve(e,u))?r=r.filter((e=>e!==u)):o=t,u=x(u)}return t.set(e,r),r}(t,this._c):[].concat(n),r],u=i[0],c=i.reduce(((e,n)=>{const r=he(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}),he(t,u,o));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}},getOffsetParent:be,getElementRects:async function(e){const t=this.getOffsetParent||be,n=this.getDimensions,r=await n(e.floating);return{reference:ge(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){const{width:t,height:n}=ce(e);return{width:t,height:n}},getScale:ae,isElement:a,isRTL:function(e){return"rtl"===w(e).direction}},Ee=(e,t,n)=>{const r=new Map,o={platform:xe,...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 s=await l.getElementRects({reference:e,floating:t,strategy:o}),{x:a,y:f}=ue(s,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:a,y:f,initialPlacement:r,placement:d,strategy:o,middlewareData:p,rects:s,platform:l,elements:{reference:e,floating:t}});a=null!=v?v:a,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&&(s=!0===w.rects?await l.getElementRects({reference:e,floating:t,strategy:o}):w.rects),({x:a,y:f}=ue(s,d,c))),n=-1)}return{x:a,y:f,placement:d,strategy:o,middlewareData:p}})(e,t,{...o,platform:i})};var Re="undefined"!=typeof document?n:r;function Se(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(!Se(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)&&!Se(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 Te(e,t){const n=Ce(e);return Math.round(t*n)/n}function Ne(t){const n=e.useRef(t);return Re((()=>{n.current=t})),n}const Le={...e},Oe=Le.useInsertionEffect||(e=>e());function Ae(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)}),[])}let ke=0;function Me(e,t){void 0===t&&(t={});const{preventScroll:n=!1,cancelPrevious:r=!0,sync:o=!1}=t;r&&cancelAnimationFrame(ke);const i=()=>null==e?void 0:e.focus({preventScroll:n});o?i():ke=requestAnimationFrame(i)}var Ie="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 Fe=!1,Pe=0;const We=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+Pe++;const je=Le.useId||function(){const[t,n]=e.useState((()=>Fe?We():void 0));return Ie((()=>{null==t&&n(We())}),[]),e.useEffect((()=>{Fe=!0}),[]),t};let Ve;"production"!==process.env.NODE_ENV&&(Ve=new Set);const Be=e.createContext(null),He=e.createContext(null),qe=()=>{var t;return(null==(t=e.useContext(Be))?void 0:t.id)||null},_e=()=>e.useContext(He);function Ue(e){return"data-floating-ui-"+e}function $e(e){const t=o(e);return Ie((()=>{t.current=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}let Xe=new WeakMap,Ye=new WeakSet,Ke={},Ge=0;const Je=e=>e&&(e.host||Je(e.parentNode)),Qe=(e,t)=>t.map((t=>{if(e.contains(t))return t;const n=Je(t);return e.contains(n)?n:null})).filter((e=>null!=e));function Ze(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,u=Qe(t,e),c=new Set,s=new Set(u),a=[];Ke[o]||(Ke[o]=new WeakMap);const f=Ke[o];return u.forEach((function e(t){t&&!c.has(t)&&(c.add(t),t.parentNode&&e(t.parentNode))})),function e(t){t&&!s.has(t)&&[].forEach.call(t.children,(t=>{if("script"!==l(t))if(c.has(t))e(t);else{const e=i?t.getAttribute(i):null,n=null!==e&&"false"!==e,r=(Xe.get(t)||0)+1,l=(f.get(t)||0)+1;Xe.set(t,r),f.set(t,l),a.push(t),1===r&&n&&Ye.add(t),1===l&&t.setAttribute(o,""),!n&&i&&t.setAttribute(i,"true")}}))}(t),c.clear(),Ge++,()=>{a.forEach((e=>{const t=(Xe.get(e)||0)-1,n=(f.get(e)||0)-1;Xe.set(e,t),f.set(e,n),t||(!Ye.has(e)&&i&&e.removeAttribute(i),Ye.delete(e)),n||e.removeAttribute(o)})),Ge--,Ge||(Xe=new WeakMap,Xe=new WeakMap,Ye=new WeakSet,Ke={})}}(e.concat(Array.from(r.querySelectorAll("[aria-live]"))),r,t,n)}const et=()=>({getShadowRoot:!0,displayCheck:"function"==typeof ResizeObserver&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function tt(e,t){const n=ie(e,et());"prev"===t&&n.reverse();const r=n.indexOf(S(A(e)));return n.slice(r+1)[0]}function nt(){return tt(document.body,"next")}function rt(){return tt(document.body,"prev")}function ot(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!C(n,r)}function it(e){ie(e,et()).forEach((e=>{e.dataset.tabindex=e.getAttribute("tabindex")||"",e.setAttribute("tabindex","-1")}))}function lt(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 ut={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 ct(e){"Tab"===e.key&&(e.target,clearTimeout(undefined))}const st=e.forwardRef((function(t,n){const[r,o]=e.useState();Ie((()=>(/apple/i.test(navigator.vendor)&&o("button"),document.addEventListener("keydown",ct),()=>{document.removeEventListener("keydown",ct)})),[]);const i={ref:n,tabIndex:0,role:r,"aria-hidden":!r||void 0,[Ue("focus-guard")]:"",style:ut};return e.createElement("span",De({},t,i))})),at=e.createContext(null),ft=Ue("portal");function dt(t){const{children:n,id:r,root:o=null,preserveTabOrder:l=!0}=t,u=function(t){void 0===t&&(t={});const{id:n,root:r}=t,o=je(),i=pt(),[l,u]=e.useState(null),c=e.useRef(null);return Ie((()=>()=>{null==l||l.remove(),queueMicrotask((()=>{c.current=null}))}),[l]),Ie((()=>{if(!o)return;if(c.current)return;const e=n?document.getElementById(n):null;if(!e)return;const t=document.createElement("div");t.id=o,t.setAttribute(ft,""),e.appendChild(t),c.current=t,u(t)}),[n,o]),Ie((()=>{if(!o)return;if(c.current)return;let e=r||(null==i?void 0:i.portalNode);e&&!a(e)&&(e=e.current),e=e||document.body;let t=null;n&&(t=document.createElement("div"),t.id=n,e.appendChild(t));const l=document.createElement("div");l.id=o,l.setAttribute(ft,""),e=t||e,e.appendChild(l),c.current=l,u(l)}),[n,r,o,i]),l}({id:r,root:o}),[c,s]=e.useState(null),f=e.useRef(null),d=e.useRef(null),p=e.useRef(null),m=e.useRef(null),h=!!c&&!c.modal&&c.open&&l&&!(!o&&!u);return e.useEffect((()=>{if(u&&l&&(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&&ot(e)){("focusin"===e.type?lt:it)(u)}}}),[u,l,null==c?void 0:c.modal]),e.createElement(at.Provider,{value:e.useMemo((()=>({preserveTabOrder:l,beforeOutsideRef:f,afterOutsideRef:d,beforeInsideRef:p,afterInsideRef:m,portalNode:u,setFocusManagerState:s})),[l,u])},h&&u&&e.createElement(st,{"data-type":"outside",ref:f,onFocus:e=>{if(ot(e,u)){var t;null==(t=p.current)||t.focus()}else{const e=rt()||(null==c?void 0:c.refs.domReference.current);null==e||e.focus()}}}),h&&u&&e.createElement("span",{"aria-owns":u.id,style:ut}),u&&i.createPortal(n,u),h&&u&&e.createElement(st,{"data-type":"outside",ref:d,onFocus:e=>{if(ot(e,u)){var t;null==(t=m.current)||t.focus()}else{const t=nt()||(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 pt=()=>e.useContext(at),mt=20;let ht=[];function vt(e){ht=ht.filter((e=>e.isConnected));let t=e;if(t&&"body"!==l(t)){if(!le(t,et())){const e=ie(t,et())[0];e&&(t=e)}ht.push(t),ht.length>mt&&(ht=ht.slice(-mt))}}function gt(){return ht.slice().reverse().find((e=>e.isConnected))}const yt=e.forwardRef((function(t,n){return e.createElement("button",De({},t,{type:"button",ref:n,tabIndex:-1,style:ut}))}));function wt(t){const{context:n,children:r,disabled:o=!1,order:i=["content"],guards:l=!0,initialFocus:u=0,returnFocus:c=!0,restoreFocus:s=!1,modal:a=!0,visuallyHiddenDismiss:d=!1,closeOnFocusOut:p=!0}=t,{open:m,refs:h,nodeId:v,onOpenChange:g,events:y,dataRef:w,floatingId:b,elements:{domReference:x,floating:E}}=n,R="number"==typeof u&&u<0,T=D(x)&&R,N="undefined"==typeof HTMLElement||!("inert"in HTMLElement.prototype)||l,M=$e(i),F=$e(u),P=$e(c),W=_e(),j=pt(),V=e.useRef(null),B=e.useRef(null),H=e.useRef(!1),q=e.useRef(!1),_=e.useRef(-1),U=null!=j,$=null==E?void 0:E.firstElementChild,z=(null==$?void 0:$.id)===b?$:E,X=Ae((function(e){return void 0===e&&(e=z),e?ie(e,et()):[]})),Y=Ae((e=>{const t=X(e);return M.current.map((e=>x&&"reference"===e?x:z&&"floating"===e?z:t)).filter(Boolean).flat()}));function K(t){return!o&&d&&a?e.createElement(yt,{ref:"start"===t?V:B,onClick:e=>g(!1,e.nativeEvent)},"string"==typeof d?d:"Dismiss"):null}e.useEffect((()=>{if(o)return;if(!a)return;function e(e){if("Tab"===e.key){C(z,S(A(z)))&&0===X().length&&!T&&I(e);const t=Y(),n=k(e);"reference"===M.current[0]&&n===x&&(I(e),e.shiftKey?Me(t[t.length-1]):Me(t[1])),"floating"===M.current[1]&&n===z&&e.shiftKey&&(I(e),Me(t[0]))}}const t=A(z);return t.addEventListener("keydown",e),()=>{t.removeEventListener("keydown",e)}}),[o,x,z,a,M,T,X,Y]),e.useEffect((()=>{if(!o&&E)return E.addEventListener("focusin",e),()=>{E.removeEventListener("focusin",e)};function e(e){const t=k(e),n=X().indexOf(t);-1!==n&&(_.current=n)}}),[o,E,X]),e.useEffect((()=>{if(!o&&p)return E&&f(x)?(x.addEventListener("focusout",t),x.addEventListener("pointerdown",e),E.addEventListener("focusout",t),()=>{x.removeEventListener("focusout",t),x.removeEventListener("pointerdown",e),E.removeEventListener("focusout",t)}):void 0;function e(){q.current=!0,setTimeout((()=>{q.current=!1}))}function t(e){const t=e.relatedTarget;queueMicrotask((()=>{const n=!(C(x,t)||C(E,t)||C(t,E)||C(null==j?void 0:j.portalNode,t)||null!=t&&t.hasAttribute(Ue("focus-guard"))||W&&(ze(W.nodesRef.current,v).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}(W.nodesRef.current,v).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}))));if(s&&n&&S(A(z))===A(z).body){f(z)&&(null==z||z.focus());const e=_.current,t=X(),n=t[e]||t[t.length-1]||z;f(n)&&n.focus()}!T&&a||!t||!n||q.current||t===gt()||(H.current=!0,g(!1,e))}))}}),[o,x,E,z,a,v,W,j,g,p,s,X,T]),e.useEffect((()=>{var e;if(o)return;const t=Array.from((null==j||null==(e=j.portalNode)?void 0:e.querySelectorAll("["+Ue("portal")+"]"))||[]);if(E){const e=[E,...t,V.current,B.current,M.current.includes("reference")||T?x:null].filter((e=>null!=e)),n=a||T?Ze(e,N,!N):Ze(e);return()=>{n()}}}),[o,x,E,a,M,j,T,N]),Ie((()=>{if(o||!f(z))return;const e=S(A(z));queueMicrotask((()=>{const t=Y(z),n=F.current,r=("number"==typeof n?t[n]:n.current)||z,o=C(z,e);R||o||!m||Me(r,{preventScroll:r===z})}))}),[o,m,z,R,Y,F]),Ie((()=>{if(o||!z)return;let e=!1;const t=A(z),n=S(t);let r=w.current.openEvent;function i(t){let{open:n,reason:o,event:i,nested:l}=t;n&&(r=i),"escape-key"===o&&h.domReference.current&&vt(h.domReference.current),"hover"===o&&"mouseleave"===i.type&&(H.current=!0),"outside-press"===o&&(l?(H.current=!1,e=!0):H.current=!(function(e){return!(0!==e.mozInputSource||!e.isTrusted)||(O()&&e.pointerType?"click"===e.type&&1===e.buttons:0===e.detail&&!e.pointerType)}(i)||L(i)))}return vt(n),y.on("openchange",i),()=>{y.off("openchange",i);const n=S(t),o=C(E,n)||W&&ze(W.nodesRef.current,v).some((e=>{var t;return C(null==(t=e.context)?void 0:t.elements.floating,n)}));(o||r&&["click","mousedown"].includes(r.type))&&h.domReference.current&&vt(h.domReference.current);const l=gt();P.current&&!H.current&&f(l)&&(l===n||n===t.body||o)&&Me(l,{cancelPrevious:!1,preventScroll:e})}}),[o,E,z,P,w,h,y,W,v]),Ie((()=>{if(!o&&j)return j.setFocusManagerState({modal:a,closeOnFocusOut:p,open:m,onOpenChange:g,refs:h}),()=>{j.setFocusManagerState(null)}}),[o,j,a,m,g,h,p]),Ie((()=>{if(o)return;if(!z)return;if("function"!=typeof MutationObserver)return;if(R)return;const e=()=>{const e=z.getAttribute("tabindex"),t=X(),n=S(A(E)),r=t.indexOf(n);-1!==r&&(_.current=r),M.current.includes("floating")||n!==h.domReference.current&&0===t.length?"0"!==e&&z.setAttribute("tabindex","0"):"-1"!==e&&z.setAttribute("tabindex","-1")};e();const t=new MutationObserver(e);return t.observe(z,{childList:!0,subtree:!0,attributes:!0}),()=>{t.disconnect()}}),[o,E,z,h,M,X,R]);const G=!o&&N&&(!a||!T)&&(U||a);return e.createElement(e.Fragment,null,G&&e.createElement(st,{"data-type":"inside",ref:null==j?void 0:j.beforeInsideRef,onFocus:e=>{if(a){const e=Y();Me("reference"===i[0]?e[0]:e[e.length-1])}else if(null!=j&&j.preserveTabOrder&&j.portalNode)if(H.current=!1,ot(e,j.portalNode)){const e=nt()||x;null==e||e.focus()}else{var t;null==(t=j.beforeOutsideRef.current)||t.focus()}}}),!T&&K("start"),r,K("end"),G&&e.createElement(st,{"data-type":"inside",ref:null==j?void 0:j.afterInsideRef,onFocus:e=>{if(a)Me(Y()[0]);else if(null!=j&&j.preserveTabOrder&&j.portalNode)if(p&&(H.current=!0),ot(e,j.portalNode)){const e=rt()||x;null==e||e.focus()}else{var t;null==(t=j.afterOutsideRef.current)||t.focus()}}}))}const bt=new Set,xt=e.forwardRef((function(t,n){const{lockScroll:r=!1,...o}=t,i=je();return Ie((()=>{if(!r)return;bt.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.scrollX,u=t.top?parseFloat(t.top):window.scrollY;if(t.overflow="hidden",o&&(t[n]=o+"px"),e){var c,s;const e=(null==(c=window.visualViewport)?void 0:c.offsetLeft)||0,n=(null==(s=window.visualViewport)?void 0:s.offsetTop)||0;Object.assign(t,{position:"fixed",top:-(u-Math.floor(n))+"px",left:-(l-Math.floor(e))+"px",right:"0"})}return()=>{bt.delete(i),0===bt.size&&(Object.assign(t,{overflow:"",[n]:""}),e&&(Object.assign(t,{position:"",top:"",left:"",right:""}),window.scrollTo(l,u)))}}),[i,r]),e.createElement("div",De({ref:n},o,{style:{position:"fixed",overflow:"auto",top:0,right:0,bottom:0,left:0,...o.style}}))}));function Et(t){const{open:n=!1,onOpenChange:r,elements:o}=t,i=je(),l=e.useRef({}),[u]=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)))||[])}}}())),c=null!=qe();if("production"!==process.env.NODE_ENV){const e=o.reference;e&&!a(e)&&function(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];const o="Floating UI: "+n.join(" ");var i;null!=(e=Ve)&&e.has(o)||(null==(i=Ve)||i.add(o),console.error(o))}("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `refs.setPositionReference()`","instead.")}const[s,f]=e.useState(o.reference),d=Ae(((e,t,n)=>{l.current.openEvent=e?t:void 0,u.emit("openchange",{open:e,event:t,reason:n,nested:c}),null==r||r(e,t,n)})),p=e.useMemo((()=>({setPositionReference:f})),[]),m=e.useMemo((()=>({reference:s||o.reference||null,floating:o.floating||null,domReference:o.reference})),[s,o.reference,o.floating]);return e.useMemo((()=>({dataRef:l,open:n,onOpenChange:d,elements:m,events:u,floatingId:i,refs:p})),[n,d,m,u,i,p])}function Rt(t){void 0===t&&(t={});const{nodeId:n}=t,r=Et({...t,elements:{reference:null,floating:null,...t.elements}}),o=t.rootContext||r,l=o.elements,[u,c]=e.useState(null),[s,f]=e.useState(null),d=(null==l?void 0:l.reference)||u,p=e.useRef(null),m=_e();Ie((()=>{d&&(p.current=d)}),[d]);const h=function(t){void 0===t&&(t={});const{placement:n="bottom",strategy:r="absolute",middleware:o=[],platform:l,elements:{reference:u,floating:c}={},transform:s=!0,whileElementsMounted:a,open:f}=t,[d,p]=e.useState({x:0,y:0,strategy:r,placement:n,middlewareData:{},isPositioned:!1}),[m,h]=e.useState(o);Se(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),N=null!=a,L=Ne(a),O=Ne(l),A=e.useCallback((()=>{if(!S.current||!C.current)return;const e={placement:n,strategy:r,middleware:m};O.current&&(e.platform=O.current),Ee(S.current,C.current,e).then((e=>{const t={...e,isPositioned:!0};k.current&&!Se(T.current,t)&&(T.current=t,i.flushSync((()=>{p(t)})))}))}),[m,n,r,O]);Re((()=>{!1===f&&T.current.isPositioned&&(T.current.isPositioned=!1,p((e=>({...e,isPositioned:!1}))))}),[f]);const k=e.useRef(!1);Re((()=>(k.current=!0,()=>{k.current=!1})),[]),Re((()=>{if(E&&(S.current=E),R&&(C.current=R),E&&R){if(L.current)return L.current(E,R,A);A()}}),[E,R,A,L,N]);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=Te(I.floating,d.x),n=Te(I.floating,d.y);return s?{...e,transform:"translate("+t+"px, "+n+"px)",...Ce(I.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:t,top:n}}),[r,s,I.floating,d.x,d.y]);return e.useMemo((()=>({...d,update:A,refs:M,elements:I,floatingStyles:D})),[d,A,M,I,D])}({...t,elements:{...l,...s&&{reference:s}}}),v=e.useCallback((e=>{const t=a(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:e}:e;f(t),h.refs.setReference(t)}),[h.refs]),g=e.useCallback((e=>{(a(e)||null===e)&&(p.current=e,c(e)),(a(h.refs.reference.current)||null===h.refs.reference.current||null!==e&&!a(e))&&h.refs.setReference(e)}),[h.refs]),y=e.useMemo((()=>({...h.refs,setReference:g,setPositionReference:v,domReference:p})),[h.refs,g,v]),w=e.useMemo((()=>({...h.elements,domReference:d})),[h.elements,d]),b=e.useMemo((()=>({...h,...o,refs:y,elements:w,nodeId:n})),[h,y,w,n,o]);return Ie((()=>{o.dataRef.current.floatingContext=b;const e=null==m?void 0:m.nodesRef.current.find((e=>e.id===n));e&&(e.context=b)})),e.useMemo((()=>({...h,context:b,refs:y,elements:w})),[h,y,w,b])}var St=function(e){var n=e.open,r=void 0===n||n,o=e.onClose,i=e.children,l=Rt().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(dt,null,t.createElement(xt,{className:"overlay",lockScroll:!0},t.createElement(wt,{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{St as Modal,St as default};
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
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,l=e.maxValue,s=void 0===l?100:l,u=e.customRootClass,i=e.renderLabel,p=t(u,n);if(o<c||o>s)throw new Error("value should be greater than or equal to ".concat(c," and less than or equal to ").concat(s));return r.createElement("div",{role:"progressbar",className:"".concat(p,"-indicator"),style:{transform:"translateX(-".concat(s-o,"%)")},"aria-valuenow":o,"aria-valuemax":s,"aria-valuemin":c},null==i?void 0:i(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,{useState as t}from"react";var r=function(){return r=Object.assign||function(e){for(var t,r=1,o=arguments.length;r<o;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},r.apply(this,arguments)};"function"==typeof SuppressedError&&SuppressedError;var o="Switch",n=function(n){n.children;var c=n.customRootClass,a=void 0===c?"":c;n.className,n.color;var l=n.defaultChecked,s=n.checked,i=n.onChange,p=function(e,t){var r={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(r[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(o=Object.getOwnPropertySymbols(e);n<o.length;n++)t.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(e,o[n])&&(r[o[n]]=e[o[n]])}return r}(n,["children","customRootClass","className","color","defaultChecked","checked","onChange"]),u=function(e,t){void 0===e&&(e=""),void 0===t&&(t="");var r=t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();return e||(t?"".concat("rad-ui","-").concat(r):"")}(a,o),f=t(s||l),d=f[0],h=f[1];return e.createElement(e.Fragment,null,e.createElement("input",r({type:"checkbox",className:"".concat(u)},p,{checked:d})),e.createElement("button",{type:"button",onClick:function(){var e=!d;h(e),i(e)},role:"switch"},d?"on":"off"))};n.displayName=o;export{n as default};
|
package/dist/components/Tabs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use client';import t,
|
|
1
|
+
'use client';import e,{createContext as a,useContext as t,useRef as n,useEffect as r,useState as o}from"react";var c=function(){return c=Object.assign||function(e){for(var a,t=1,n=arguments.length;t<n;t++)for(var r in a=arguments[t])Object.prototype.hasOwnProperty.call(a,r)&&(e[r]=a[r]);return e},c.apply(this,arguments)};function l(e,a){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&a.indexOf(n)<0&&(t[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)a.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(t[n[r]]=e[n[r]])}return t}"function"==typeof SuppressedError&&SuppressedError;var i=function(e,a){void 0===e&&(e=""),void 0===a&&(a="");var t=a.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();return e||(a?"".concat("rad-ui","-").concat(t):"")},s=a(null),u=function(a){var o=a.tab,u=a.setActiveTab,v=a.activeTab,b=a.className,f=a.customRootClass,m=a.index,d=l(a,["tab","setActiveTab","activeTab","className","customRootClass","index"]),p=t(s);p.tabs;var T=p.previousTab,y=p.nextTab,N=n(null);r((function(){v===o.value&&N.current.focus()}),[v]);var E=i(f,"TabTrigger"),g=v===o.value;return e.createElement("button",c({ref:N,role:"tab",key:m,className:"".concat(E," ").concat(g?"active":""," ").concat(b)},d,{onKeyDown:function(e){"ArrowLeft"==e.key&&T(),"ArrowRight"==e.key&&y()},onClick:function(){return function(e){u(e.value)}(o)}}),e.createElement("span",{className:"".concat(E,"-inner")},o.label))};u.displayName="TabTrigger";var v="TabList",b=function(a){var n=a.className,r=void 0===n?"":n,o=a.customRootClass,c=i(void 0===o?"":o,v),l=t(s),b=l.tabs,f=l.activeTab,m=l.setActiveTab;return e.createElement("div",{role:"tablist","aria-orientation":"horizontal","aria-label":"todo",className:"".concat(c," ").concat(r)},b.map((function(a,t){return e.createElement(u,{activeTab:f,setActiveTab:m,key:t,tab:a,index:t})})))};b.displayName=v;var f="TabContent",m=function(a){var n=a.className,r=a.customRootClass,o=i(r,f),c=t(s),l=c.tabs,u=c.activeTab;return c.setActiveTab,e.createElement("div",{className:"".concat(o," ").concat(n)},l.map((function(a,t){return a.value===u?e.createElement("div",{key:t},a.content):null})))};m.displayName=f;var d="Tabs",p=function(a){var t=a.children,n=a.defaultTab,r=void 0===n?"":n,u=a.customRootClass,v=a.tabs,b=void 0===v?[]:v,f=a.className,m=a.color,p=l(a,["children","defaultTab","customRootClass","tabs","className","color"]),T=i(u,d),y=o(r||b[0].value||""),N=y[0],E=y[1];return e.createElement(s.Provider,{value:{activeTab:N,setActiveTab:E,nextTab:function(){var e=b.findIndex((function(e){return e.value===N}))+1;e<b.length&&E(b[e].value)},previousTab:function(){var e=b.findIndex((function(e){return e.value===N}))-1;e>=0&&E(b[e].value)},tabs:b}},e.createElement("div",c({className:"".concat(T," ").concat(f),"data-accent-color":m},p),t))};p.displayName=d;var T=function(a){var t=a.tabs,n=void 0===t?[]:t;l(a,["tabs"]);var r=o(n[0].value||"");r[0],r[1];var c=n[0].value||"";return e.createElement(p,{tabs:n,defaultTab:c},e.createElement(b,null),e.createElement(m,null))};T.List=b,T.Content=m,T.Root=p;export{T as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use client';import e from"react";var r=function(
|
|
1
|
+
'use client';import e from"react";"function"==typeof SuppressedError&&SuppressedError;var t=function(t){var r=t.children,o=t.customRootClass,a=void 0===o?"":o,c=t.className,n=void 0===c?"":c,l=function(e,t){void 0===e&&(e=""),void 0===t&&(t="");var r=t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();return e||(t?"".concat("rad-ui","-").concat(r):"")}(a,"TextArea");return e.createElement("div",{className:"".concat(l).concat(n)},r)},r=function(t){var r=t.children,o=t.placeholder,a=void 0===o?"":o;return e.createElement("textarea",{placeholder:a},r)},o=function(o){var a=o.customRootClass,c=void 0===a?"":a,n=o.className,l=void 0===n?"":n,s=o.children;return function(e,t){var r={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(r[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(o=Object.getOwnPropertySymbols(e);a<o.length;a++)t.indexOf(o[a])<0&&Object.prototype.propertyIsEnumerable.call(e,o[a])&&(r[o[a]]=e[o[a]])}}(o,["customRootClass","className","children"]),e.createElement(t,{customRootClass:c,className:"".concat(l)},e.createElement(r,{placeholder:"enter text"},s),s)};o.Input=r,o.Root=t;export{o as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use client';import e,{useState as r}from"react";var t=function(){return t=Object.assign||function(e){for(var r,t=1,o=arguments.length;t<o;t++)for(var a in r=arguments[t])Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a]);return e},t.apply(this,arguments)};"function"==typeof SuppressedError&&SuppressedError;var o=function(o){var a=o.defaultPressed,n=o.customRootClass,s=void 0===n?"":n,c=o.children;o.className;var l=o.pressed,i=o.onChange,p=function(e,r){var t={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&r.indexOf(o)<0&&(t[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(o=Object.getOwnPropertySymbols(e);a<o.length;a++)r.indexOf(o[a])<0&&Object.prototype.propertyIsEnumerable.call(e,o[a])&&(t[o[a]]=e[o[a]])}return t}(o,["defaultPressed","customRootClass","children","className","pressed","onChange"]),d=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,"Toggle"),u=r(l||a),f=u[0],v=u[1];return e.createElement("button",t({className:"".concat(d),onClick:function(){var e=!f;v(e),i(e)},"data-state":f?"on":"off",type:"button","data-disabled":p.disabled?"":void 0,"aria-pressed":l},p),c)};export{o as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use client';import e,{createContext as t,useState as l,useContext as r}from"react";var n=t({}),o=function(t){var r=t.type,o=void 0===r?"multiple":r,i=t.value,a=void 0===i?null:i,c=t.children,u=l(a||[]),v=u[0],p=u[1];return e.createElement("div",{className:"toggle-group"},e.createElement(n.Provider,{value:{activeToggles:v,setActiveToggles:p,type:o}},c))};function i(e,t,l){if(l||2===arguments.length)for(var r,n=0,o=t.length;n<o;n++)!r&&n in t||(r||(r=Array.prototype.slice.call(t,0,n)),r[n]=t[n]);return e.concat(r||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var a=function(t){var l,o=t.children,a=t.value,c=void 0===a?null:a;!function(e,t){var l={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(l[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(r=Object.getOwnPropertySymbols(e);n<r.length;n++)t.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(e,r[n])&&(l[r[n]]=e[r[n]])}}(t,["children","value"]);var u=r(n),v=null==u?void 0:u.type,p=null===(l=null==u?void 0:u.activeToggles)||void 0===l?void 0:l.includes(c);return e.createElement("div",{className:"".concat(p?"bg-blue-600":""),onClick:function(){!function(){var e=(null==u?void 0:u.activeToggles)||[];if("single"===v)return p?void(null==u||u.setActiveToggles([])):void(null==u||u.setActiveToggles([c]));"multiple"===v&&(e=p?e.filter((function(e){return e!==c})):i(i([],e,!0),[c],!1)),null==u||u.setActiveToggles(e)}()}},o)},c=function(t){var l=t.type,r=void 0===l?"single":l;return e.createElement(o,{type:r},e.createElement(a,{value:"one"},"item 1"),e.createElement(a,{value:"two"},"item 2"),e.createElement(a,{value:"three"},"item 3"),e.createElement(a,{value:"four"},"item 4"))};c.Root=o,c.Item=a;export{c as default};
|