@radui/ui 0.0.23 → 0.0.25
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/README.md +2 -0
- package/dist/components/Accordion.js +1 -1
- package/dist/components/AlertDialog.js +5 -0
- package/dist/components/Avatar.js +1 -1
- package/dist/components/AvatarGroup.js +1 -0
- package/dist/components/Badge.js +1 -1
- package/dist/components/Dropdown.js +1 -1
- package/dist/components/Heading.js +1 -1
- package/dist/components/Modal.js +2 -2
- package/dist/components/RadioGroup.js +1 -0
- package/dist/components/Skeleton.js +1 -0
- package/dist/components/Switch.js +1 -1
- package/dist/components/Tabs.js +1 -1
- package/dist/components/Tooltip.js +1 -1
- package/dist/components/Tree.js +1 -0
- package/dist/themes/default.css +1 -2
- package/package.json +11 -9
- package/dist/themes/default.css.map +0 -1
package/README.md
CHANGED
|
@@ -1 +1 @@
|
|
|
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({}),
|
|
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({}),u=function(e){return e.querySelectorAll("[data-rad-ui-batch-element]")},i=function(e){var t=null;return e.forEach((function(e){e.hasAttribute("data-rad-ui-focus-element")&&(t=e)})),t},s=function(t){var o=t.children,c=t.customRootClass,s=n(null),d=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:d,activeItem:f,setActiveItem:m,focusNextItem:function(){var e=function(e){var t=i(e),n=null==t?void 0:t.nextElementSibling;return n||e[e.length-1]}(u(null==s?void 0:s.current));if(h(e),e){var t=e.querySelector("button");null==t||t.focus()}},focusPrevItem:function(){var e=function(e){var t=i(e),n=null==t?void 0:t.previousElementSibling;return n||e[0]}(u(null==s?void 0:s.current));if(h(e),e){var t=e.querySelector("button");null==t||t.focus()}},focusItem:b,setFocusItem:h,accordionRef:s}},e.createElement("div",{className:"".concat(d,"-root"),ref:s},o))},d=function(){return d=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},d.apply(this,arguments)};"function"==typeof SuppressedError&&SuppressedError;var v=t({}),f=function(t){var u=t.children,i=t.value,s=t.className,f=void 0===s?"":s,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(i),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",d({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":""}:{}),u))},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,u=o(l),i=u.setActiveItem,s=u.rootClass,d=u.focusNextItem,f=u.focusPrevItem,m=u.activeItem,p=o(v),b=p.itemValue,h=p.handleBlurEvent,E=p.handleClickEvent,y=p.handleFocusEvent;return e.createElement("button",{type:"button",className:"".concat(s,"-trigger ").concat(c),onBlur:h,onFocus:function(){y()},onKeyDown:function(e){"ArrowDown"===e.key&&(e.preventDefault(),d()),"ArrowUp"===e.key&&(e.preventDefault(),f())},onClick:function(){m===b?i(null):m!==b&&(i(b),E())},"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,u=o(l),i=u.activeItem,s=u.rootClass,d=o(v).itemValue;return e.createElement("div",{className:"".concat(s,"-content ").concat(c),id:"content-".concat(r),role:"region","aria-labelledby":"section-".concat(r),hidden:d!==i},n)},h=function(t){var n=t.items;return e.createElement(s,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=s;export{h as default};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
'use client';import*as e from"react";import t,{createContext as n,useLayoutEffect as r,useEffect as o,useRef as i,useState as l,useContext as u}from"react";import*as c from"react-dom";var a=n({isOpen:!1,handleOpenChange:function(){},rootClass:"",handleOverlayClick:function(){}});function s(){return"undefined"!=typeof window}function f(e){return m(e)?(e.nodeName||"").toLowerCase():"#document"}function d(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function p(e){var t;return null==(t=(m(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function m(e){return!!s()&&(e instanceof Node||e instanceof d(e).Node)}function h(e){return!!s()&&(e instanceof Element||e instanceof d(e).Element)}function v(e){return!!s()&&(e instanceof HTMLElement||e instanceof d(e).HTMLElement)}function g(e){return!(!s()||"undefined"==typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof d(e).ShadowRoot)}function y(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=O(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function b(e){return["table","td","th"].includes(f(e))}function w(e){return[":popover-open",":modal"].some((t=>{try{return e.matches(t)}catch(e){return!1}}))}function x(e){const t=E(),n=h(e)?O(e):e;return"none"!==n.transform||"none"!==n.perspective||!!n.containerType&&"normal"!==n.containerType||!t&&!!n.backdropFilter&&"none"!==n.backdropFilter||!t&&!!n.filter&&"none"!==n.filter||["transform","perspective","filter"].some((e=>(n.willChange||"").includes(e)))||["paint","layout","strict","content"].some((e=>(n.contain||"").includes(e)))}function E(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function R(e){return["html","body","#document"].includes(f(e))}function O(e){return d(e).getComputedStyle(e)}function S(e){return h(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function C(e){if("html"===f(e))return e;const t=e.assignedSlot||e.parentNode||g(e)&&e.host||p(e);return g(t)?t.host:t}function A(e){const t=C(e);return R(t)?e.ownerDocument?e.ownerDocument.body:e.body:v(t)&&y(t)?t:A(t)}function k(e,t,n){var r;void 0===t&&(t=[]),void 0===n&&(n=!0);const o=A(e),i=o===(null==(r=e.ownerDocument)?void 0:r.body),l=d(o);if(i){const e=N(l);return t.concat(l,l.visualViewport||[],y(o)?o:[],e&&n?k(e):[])}return t.concat(o,k(o,[],n))}function N(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function T(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 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&&g(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function M(){const e=navigator.userAgentData;return null!=e&&e.platform?e.platform:navigator.platform}function D(){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 F(e){return!D().includes("jsdom/")&&(!P()&&0===e.width&&0===e.height||P()&&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 P(){const e=/android/i;return e.test(M())||e.test(D())}function I(e){return(null==e?void 0:e.ownerDocument)||document}function j(e){return"composedPath"in e?e.composedPath()[0]:e.target}function W(e){e.preventDefault(),e.stopPropagation()}function B(e){return!!e&&("combobox"===e.getAttribute("role")&&function(e){return v(e)&&e.matches("input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])")}(e))}const V=Math.min,H=Math.max,q=Math.round,$=e=>({x:e,y:e});function U(e){return e.split("-")[0]}function _(e){return["top","bottom"].includes(U(e))?"y":"x"}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}}
|
|
2
|
+
/*!
|
|
3
|
+
* tabbable 6.2.0
|
|
4
|
+
* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
|
|
5
|
+
*/var X=["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(","),Y="undefined"==typeof Element,K=Y?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,G=!Y&&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)},J=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{K.call(l,X)&&r.filter(l)&&(n||!t.includes(l))&&o.push(l);var a=l.shadowRoot||"function"==typeof r.getShadowRoot&&r.getShadowRoot(l),s=!Z(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},Q=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},ee=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))&&!Q(e)?0:e.tabIndex},te=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},ne=function(e){return"INPUT"===e.tagName},re=function(e){return function(e){return ne(e)&&"radio"===e.type}(e)&&!function(e){if(!e.name)return!0;var t,n=e.form||G(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)},oe=function(e){var t=e.getBoundingClientRect(),n=t.width,r=t.height;return 0===n&&0===r},ie=function(e,t){var n=t.displayCheck,r=t.getShadowRoot;if("hidden"===getComputedStyle(e).visibility)return!0;var o=K.call(e,"details>summary:first-of-type")?e.parentElement:e;if(K.call(o,"details:not([open]) *"))return!0;if(n&&"full"!==n&&"legacy-full"!==n){if("non-zero-area"===n)return oe(e)}else{if("function"==typeof r){for(var i=e;e;){var l=e.parentElement,u=G(e);if(l&&!l.shadowRoot&&!0===r(l))return oe(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&&G(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=G(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},le=function(e,t){return!(t.disabled||Z(t)||function(e){return ne(e)&&"hidden"===e.type}(t)||ie(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!!K.call(t,"fieldset[disabled] *")||!r.contains(e)}return!0}t=t.parentElement}return!1}(t))},ue=function(e,t){return!(re(t)||ee(t)<0||!le(e,t))},ce=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},ae=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=ee(e);return n<0&&t&&!Q(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(te).reduce((function(e,t){return t.isScope?e.push.apply(e,t.content):e.push(t.content),e}),[]).concat(n)},se=function(e,t){var n;return n=(t=t||{}).getShadowRoot?J([e],t.includeContainer,{filter:ue.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:ce}):function(e,t,n){if(Z(e))return[];var r=Array.prototype.slice.apply(e.querySelectorAll(X));return t&&K.call(e,X)&&r.unshift(e),r.filter(n)}(e,t.includeContainer,ue.bind(null,t)),ae(n)};function fe(e,t,n){let{reference:r,floating:o}=e;const i=_(t),l=function(e){return"x"===_(e)?"y":"x"}(t),u="y"===l?"height":"width";const c=U(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 de(e){const t=O(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=v(e),i=o?e.offsetWidth:n,l=o?e.offsetHeight:r,u=q(n)!==i||q(r)!==l;return u&&(n=i,r=l),{width:n,height:r,$:u}}function pe(e){return h(e)?e:e.contextElement}function me(e){const t=pe(e);if(!v(t))return $(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=de(t);let l=(i?q(n.width):n.width)/r,u=(i?q(n.height):n.height)/o;return l&&Number.isFinite(l)||(l=1),u&&Number.isFinite(u)||(u=1),{x:l,y:u}}const he=$(0);function ve(e){const t=d(e);return E()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:he}function ge(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);const o=e.getBoundingClientRect(),i=pe(e);let l=$(1);t&&(r?h(r)&&(l=me(r)):l=me(e));const u=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==d(e))&&t}(i,n,r)?ve(i):$(0);let c=(o.left+u.x)/l.x,a=(o.top+u.y)/l.y,s=o.width/l.x,f=o.height/l.y;if(i){const e=d(i),t=r&&h(r)?d(r):r;let n=e,o=N(n);for(;o&&r&&t!==n;){const e=me(o),t=o.getBoundingClientRect(),r=O(o),i=t.left+(o.clientLeft+parseFloat(r.paddingLeft))*e.x,l=t.top+(o.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,a*=e.y,s*=e.x,f*=e.y,c+=i,a+=l,n=d(o),o=N(n)}}return z({width:s,height:f,x:c,y:a})}function ye(e,t){const n=S(e).scrollLeft;return t?t.left+n:ge(p(e)).left+n}function be(e,t,n){void 0===n&&(n=!1);const r=e.getBoundingClientRect();return{x:r.left+t.scrollLeft-(n?0:ye(e,r)),y:r.top+t.scrollTop}}function we(e,t,n){let r;if("viewport"===t)r=function(e,t){const n=d(e),r=p(e),o=n.visualViewport;let i=r.clientWidth,l=r.clientHeight,u=0,c=0;if(o){i=o.width,l=o.height;const e=E();(!e||e&&"fixed"===t)&&(u=o.offsetLeft,c=o.offsetTop)}return{width:i,height:l,x:u,y:c}}(e,n);else if("document"===t)r=function(e){const t=p(e),n=S(e),r=e.ownerDocument.body,o=H(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=H(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let l=-n.scrollLeft+ye(e);const u=-n.scrollTop;return"rtl"===O(r).direction&&(l+=H(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:l,y:u}}(p(e));else if(h(t))r=function(e,t){const n=ge(e,!0,"fixed"===t),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=v(e)?me(e):$(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=ve(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return z(r)}function xe(e,t){const n=C(e);return!(n===t||!h(n)||R(n))&&("fixed"===O(n).position||xe(n,t))}function Ee(e,t,n){const r=v(t),o=p(t),i="fixed"===n,l=ge(e,!0,i,t);let u={scrollLeft:0,scrollTop:0};const c=$(0);if(r||!r&&!i)if(("body"!==f(t)||y(o))&&(u=S(t)),r){const e=ge(t,!0,i,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else o&&(c.x=ye(o));const a=!o||r||i?$(0):be(o,u);return{x:l.left+u.scrollLeft-c.x-a.x,y:l.top+u.scrollTop-c.y-a.y,width:l.width,height:l.height}}function Re(e){return"static"===O(e).position}function Oe(e,t){if(!v(e)||"fixed"===O(e).position)return null;if(t)return t(e);let n=e.offsetParent;return p(e)===n&&(n=n.ownerDocument.body),n}function Se(e,t){const n=d(e);if(w(e))return n;if(!v(e)){let t=C(e);for(;t&&!R(t);){if(h(t)&&!Re(t))return t;t=C(t)}return n}let r=Oe(e,t);for(;r&&b(r)&&Re(r);)r=Oe(r,t);return r&&R(r)&&Re(r)&&!x(r)?n:r||function(e){let t=C(e);for(;v(t)&&!R(t);){if(x(t))return t;if(w(t))return null;t=C(t)}return null}(e)||n}const Ce={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i="fixed"===o,l=p(r),u=!!t&&w(t.floating);if(r===l||u&&i)return n;let c={scrollLeft:0,scrollTop:0},a=$(1);const s=$(0),d=v(r);if((d||!d&&!i)&&(("body"!==f(r)||y(l))&&(c=S(r)),v(r))){const e=ge(r);a=me(r),s.x=e.x+r.clientLeft,s.y=e.y+r.clientTop}const m=!l||d||i?$(0):be(l,c,!0);return{width:n.width*a.x,height:n.height*a.y,x:n.x*a.x-c.scrollLeft*a.x+s.x+m.x,y:n.y*a.y-c.scrollTop*a.y+s.y+m.y}},getDocumentElement:p,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[..."clippingAncestors"===n?w(t)?[]:function(e,t){const n=t.get(e);if(n)return n;let r=k(e,[],!1).filter((e=>h(e)&&"body"!==f(e))),o=null;const i="fixed"===O(e).position;let l=i?C(e):e;for(;h(l)&&!R(l);){const t=O(l),n=x(l);n||"fixed"!==t.position||(o=null),(i?!n&&!o:!n&&"static"===t.position&&o&&["absolute","fixed"].includes(o.position)||y(l)&&!n&&xe(e,l))?r=r.filter((e=>e!==l)):o=t,l=C(l)}return t.set(e,r),r}(t,this._c):[].concat(n),r],l=i[0],u=i.reduce(((e,n)=>{const r=we(t,n,o);return e.top=H(r.top,e.top),e.right=V(r.right,e.right),e.bottom=V(r.bottom,e.bottom),e.left=H(r.left,e.left),e}),we(t,l,o));return{width:u.right-u.left,height:u.bottom-u.top,x:u.left,y:u.top}},getOffsetParent:Se,getElementRects:async function(e){const t=this.getOffsetParent||Se,n=this.getDimensions,r=await n(e.floating);return{reference:Ee(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}=de(e);return{width:t,height:n}},getScale:me,isElement:h,isRTL:function(e){return"rtl"===O(e).direction}},Ae=(e,t,n)=>{const r=new Map,o={platform:Ce,...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}=fe(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:b}=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}},b&&m<=50&&(m++,"object"==typeof b&&(b.placement&&(d=b.placement),b.rects&&(a=!0===b.rects?await l.getElementRects({reference:e,floating:t,strategy:o}):b.rects),({x:s,y:f}=fe(a,d,c))),n=-1)}return{x:s,y:f,placement:d,strategy:o,middlewareData:p}})(e,t,{...o,platform:i})};var ke="undefined"!=typeof document?r:o;function Ne(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(!Ne(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)&&!Ne(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function Te(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Le(e,t){const n=Te(e);return Math.round(t*n)/n}function Me(t){const n=e.useRef(t);return ke((()=>{n.current=t})),n}const De={...e},Fe=De.useInsertionEffect||(e=>e());function Pe(t){const n=e.useRef((()=>{if("production"!==process.env.NODE_ENV)throw new Error("Cannot call an event handler while rendering.")}));return Fe((()=>{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 Ie=0;function je(e,t){void 0===t&&(t={});const{preventScroll:n=!1,cancelPrevious:r=!0,sync:o=!1}=t;r&&cancelAnimationFrame(Ie);const i=()=>null==e?void 0:e.focus({preventScroll:n});o?i():Ie=requestAnimationFrame(i)}var We="undefined"!=typeof document?r:o;function Be(){return Be=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},Be.apply(this,arguments)}let Ve=!1,He=0;const qe=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+He++;const $e=De.useId||function(){const[t,n]=e.useState((()=>Ve?qe():void 0));return We((()=>{null==t&&n(qe())}),[]),e.useEffect((()=>{Ve=!0}),[]),t};let Ue;"production"!==process.env.NODE_ENV&&(Ue=new Set);const _e=e.createContext(null),ze=e.createContext(null),Xe=()=>e.useContext(ze);function Ye(e){return"data-floating-ui-"+e}function Ke(e){const t=i(e);return We((()=>{t.current=e})),t}function Ge(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 Ze=new WeakMap,Je=new WeakSet,Qe={},et=0;const tt=e=>e&&(e.host||tt(e.parentNode));function nt(e,t,n,r){const o="data-floating-ui-inert",i=r?"inert":n?"aria-hidden":null,l=(u=t,e.map((e=>{if(u.contains(e))return e;const t=tt(e);return u.contains(t)?t:null})).filter((e=>null!=e)));var u;const c=new Set,a=new Set(l),s=[];Qe[o]||(Qe[o]=new WeakMap);const d=Qe[o];return l.forEach((function e(t){if(!t||c.has(t))return;c.add(t),t.parentNode&&e(t.parentNode)})),function e(t){if(!t||a.has(t))return;[].forEach.call(t.children,(t=>{if("script"!==f(t))if(c.has(t))e(t);else{const e=i?t.getAttribute(i):null,n=null!==e&&"false"!==e,r=(Ze.get(t)||0)+1,l=(d.get(t)||0)+1;Ze.set(t,r),d.set(t,l),s.push(t),1===r&&n&&Je.add(t),1===l&&t.setAttribute(o,""),!n&&i&&t.setAttribute(i,"true")}}))}(t),c.clear(),et++,()=>{s.forEach((e=>{const t=(Ze.get(e)||0)-1,n=(d.get(e)||0)-1;Ze.set(e,t),d.set(e,n),t||(!Je.has(e)&&i&&e.removeAttribute(i),Je.delete(e)),n||e.removeAttribute(o)})),et--,et||(Ze=new WeakMap,Ze=new WeakMap,Je=new WeakSet,Qe={})}}function rt(e,t,n){void 0===t&&(t=!1),void 0===n&&(n=!1);const r=I(e[0]).body;return nt(e.concat(Array.from(r.querySelectorAll("[aria-live]"))),r,t,n)}const ot=()=>({getShadowRoot:!0,displayCheck:"function"==typeof ResizeObserver&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function it(e,t){const n=se(e,ot());"prev"===t&&n.reverse();const r=n.indexOf(T(I(e)));return n.slice(r+1)[0]}function lt(){return it(document.body,"next")}function ut(){return it(document.body,"prev")}function ct(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!L(n,r)}function at(e){se(e,ot()).forEach((e=>{e.dataset.tabindex=e.getAttribute("tabindex")||"",e.setAttribute("tabindex","-1")}))}function st(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 ft={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 dt(e){"Tab"===e.key&&(e.target,clearTimeout(undefined))}const pt=e.forwardRef((function(t,n){const[r,o]=e.useState();We((()=>(/apple/i.test(navigator.vendor)&&o("button"),document.addEventListener("keydown",dt),()=>{document.removeEventListener("keydown",dt)})),[]);const i={ref:n,tabIndex:0,role:r,"aria-hidden":!r||void 0,[Ye("focus-guard")]:"",style:ft};return e.createElement("span",Be({},t,i))})),mt=e.createContext(null),ht=Ye("portal");const vt=()=>e.useContext(mt),gt="data-floating-ui-focusable";let yt=[];function bt(e){yt=yt.filter((e=>e.isConnected));let t=e;if(t&&"body"!==f(t)){if(!function(e,t){if(t=t||{},!e)throw new Error("No node provided");return!1!==K.call(e,X)&&ue(t,e)}(t,ot())){const e=se(t,ot())[0];e&&(t=e)}yt.push(t),yt.length>20&&(yt=yt.slice(-20))}}function wt(){return yt.slice().reverse().find((e=>e.isConnected))}const xt=e.forwardRef((function(t,n){return e.createElement("button",Be({},t,{type:"button",ref:n,tabIndex:-1,style:ft}))}));let Et=0;let Rt=()=>{};function Ot(t){const{open:n=!1,onOpenChange:r,elements:o}=t,i=$e(),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!=((null==(a=e.useContext(_e))?void 0:a.id)||null);var a;if("production"!==process.env.NODE_ENV){const e=o.reference;e&&!h(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=Ue)&&e.has(o)||(null==(i=Ue)||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=Pe(((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])}var St={Portal:function(t){const{children:n,id:r,root:o,preserveTabOrder:i=!0}=t,l=function(t){void 0===t&&(t={});const{id:n,root:r}=t,o=$e(),i=vt(),[l,u]=e.useState(null),c=e.useRef(null);return We((()=>()=>{null==l||l.remove(),queueMicrotask((()=>{c.current=null}))}),[l]),We((()=>{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(ht,""),e.appendChild(t),c.current=t,u(t)}),[n,o]),We((()=>{if(null===r)return;if(!o)return;if(c.current)return;let e=r||(null==i?void 0:i.portalNode);e&&!h(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(ht,""),e=t||e,e.appendChild(l),c.current=l,u(l)}),[n,r,o,i]),l}({id:r,root:o}),[u,a]=e.useState(null),s=e.useRef(null),f=e.useRef(null),d=e.useRef(null),p=e.useRef(null),m=null==u?void 0:u.modal,v=null==u?void 0:u.open,g=!!u&&!u.modal&&u.open&&i&&!(!o&&!l);return e.useEffect((()=>{if(l&&i&&!m)return l.addEventListener("focusin",e,!0),l.addEventListener("focusout",e,!0),()=>{l.removeEventListener("focusin",e,!0),l.removeEventListener("focusout",e,!0)};function e(e){if(l&&ct(e)){("focusin"===e.type?st:at)(l)}}}),[l,i,m]),e.useEffect((()=>{l&&(v||st(l))}),[v,l]),e.createElement(mt.Provider,{value:e.useMemo((()=>({preserveTabOrder:i,beforeOutsideRef:s,afterOutsideRef:f,beforeInsideRef:d,afterInsideRef:p,portalNode:l,setFocusManagerState:a})),[i,l])},g&&l&&e.createElement(pt,{"data-type":"outside",ref:s,onFocus:e=>{if(ct(e,l)){var t;null==(t=d.current)||t.focus()}else{const e=ut()||(null==u?void 0:u.refs.domReference.current);null==e||e.focus()}}}),g&&l&&e.createElement("span",{"aria-owns":l.id,style:ft}),l&&c.createPortal(n,l),g&&l&&e.createElement(pt,{"data-type":"outside",ref:f,onFocus:e=>{if(ct(e,l)){var t;null==(t=p.current)||t.focus()}else{const t=lt()||(null==u?void 0:u.refs.domReference.current);null==t||t.focus(),(null==u?void 0:u.closeOnFocusOut)&&(null==u||u.onOpenChange(!1,e.nativeEvent,"focus-out"))}}}))},Overlay:e.forwardRef((function(t,n){const{lockScroll:r=!1,...o}=t;return We((()=>{if(r)return Et++,1===Et&&(Rt=function(){const e=/iP(hone|ad|od)|iOS/.test(M()),t=document.body.style,n=Math.round(document.documentElement.getBoundingClientRect().left)+document.documentElement.scrollLeft?"paddingLeft":"paddingRight",r=window.innerWidth-document.documentElement.clientWidth,o=t.left?parseFloat(t.left):window.scrollX,i=t.top?parseFloat(t.top):window.scrollY;if(t.overflow="hidden",r&&(t[n]=r+"px"),e){var l,u;const e=(null==(l=window.visualViewport)?void 0:l.offsetLeft)||0,n=(null==(u=window.visualViewport)?void 0:u.offsetTop)||0;Object.assign(t,{position:"fixed",top:-(i-Math.floor(n))+"px",left:-(o-Math.floor(e))+"px",right:"0"})}return()=>{Object.assign(t,{overflow:"",[n]:""}),e&&(Object.assign(t,{position:"",top:"",left:"",right:""}),window.scrollTo(o,i))}}()),()=>{Et--,0===Et&&Rt()}}),[r]),e.createElement("div",Be({ref:n},o,{style:{position:"fixed",overflow:"auto",top:0,right:0,bottom:0,left:0,...o.style}}))})),FocusManager:function(t){const{context:n,children:r,disabled:o=!1,order:i=["content"],guards:l=!0,initialFocus:u=0,returnFocus:c=!0,restoreFocus:a=!1,modal:s=!0,visuallyHiddenDismiss:f=!1,closeOnFocusOut:d=!0}=t,{open:p,refs:m,nodeId:h,onOpenChange:g,events:y,dataRef:b,floatingId:w,elements:{domReference:x,floating:E}}=n,R="number"==typeof u&&u<0,O=B(x)&&R,S="undefined"==typeof HTMLElement||!("inert"in HTMLElement.prototype)||l,C=Ke(i),A=Ke(u),k=Ke(c),N=Xe(),M=vt(),D=e.useRef(null),V=e.useRef(null),H=e.useRef(!1),q=e.useRef(!1),$=e.useRef(-1),U=null!=M,_=(z=E)?z.hasAttribute(gt)?z:z.querySelector("["+gt+"]")||z:null;var z;const X=Pe((function(e){return void 0===e&&(e=_),e?se(e,ot()):[]})),Y=Pe((e=>{const t=X(e);return C.current.map((e=>x&&"reference"===e?x:_&&"floating"===e?_:t)).filter(Boolean).flat()}));function K(t){return!o&&f&&s?e.createElement(xt,{ref:"start"===t?D:V,onClick:e=>g(!1,e.nativeEvent)},"string"==typeof f?f:"Dismiss"):null}e.useEffect((()=>{H.current=!1}),[o]),e.useEffect((()=>{if(o)return;if(!s)return;function e(e){if("Tab"===e.key){L(_,T(I(_)))&&0===X().length&&!O&&W(e);const t=Y(),n=j(e);"reference"===C.current[0]&&n===x&&(W(e),e.shiftKey?je(t[t.length-1]):je(t[1])),"floating"===C.current[1]&&n===_&&e.shiftKey&&(W(e),je(t[0]))}}const t=I(_);return t.addEventListener("keydown",e),()=>{t.removeEventListener("keydown",e)}}),[o,x,_,s,C,O,X,Y]),e.useEffect((()=>{if(!o&&E)return E.addEventListener("focusin",e),()=>{E.removeEventListener("focusin",e)};function e(e){const t=j(e),n=X().indexOf(t);-1!==n&&($.current=n)}}),[o,E,X]),e.useEffect((()=>{if(!o&&d)return E&&v(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=!(L(x,t)||L(E,t)||L(t,E)||L(null==M?void 0:M.portalNode,t)||null!=t&&t.hasAttribute(Ye("focus-guard"))||N&&(Ge(N.nodesRef.current,h).find((e=>{var n,r;return L(null==(n=e.context)?void 0:n.elements.floating,t)||L(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}(N.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}))));if(a&&n&&T(I(_))===I(_).body){v(_)&&_.focus();const e=$.current,t=X(),n=t[e]||t[t.length-1]||_;v(n)&&n.focus()}!O&&s||!t||!n||q.current||t===wt()||(H.current=!0,g(!1,e,"focus-out"))}))}}),[o,x,E,_,s,h,N,M,g,d,a,X,O]),e.useEffect((()=>{var e;if(o)return;const t=Array.from((null==M||null==(e=M.portalNode)?void 0:e.querySelectorAll("["+Ye("portal")+"]"))||[]);if(E){const e=[E,...t,D.current,V.current,C.current.includes("reference")||O?x:null].filter((e=>null!=e)),n=s||O?rt(e,S,!S):rt(e);return()=>{n()}}}),[o,x,E,s,C,M,O,S]),We((()=>{if(o||!v(_))return;const e=T(I(_));queueMicrotask((()=>{const t=Y(_),n=A.current,r=("number"==typeof n?t[n]:n.current)||_,o=L(_,e);R||o||!p||je(r,{preventScroll:r===_})}))}),[o,p,_,R,Y,A]),We((()=>{if(o||!_)return;let e=!1;const t=I(_),n=T(t);let r=b.current.openEvent;function i(t){let{open:n,reason:o,event:i,nested:l}=t;n&&(r=i),"escape-key"===o&&m.domReference.current&&bt(m.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)||(P()&&e.pointerType?"click"===e.type&&1===e.buttons:0===e.detail&&!e.pointerType)}(i)||F(i)))}bt(n),y.on("openchange",i);const l=t.createElement("span");return l.setAttribute("tabindex","-1"),l.setAttribute("aria-hidden","true"),Object.assign(l.style,ft),U&&x&&x.insertAdjacentElement("afterend",l),()=>{y.off("openchange",i);const n=T(t),o=L(E,n)||N&&Ge(N.nodesRef.current,h).some((e=>{var t;return L(null==(t=e.context)?void 0:t.elements.floating,n)}));(o||r&&["click","mousedown"].includes(r.type))&&m.domReference.current&&bt(m.domReference.current);const u="boolean"==typeof k.current?wt()||l:k.current.current||l;queueMicrotask((()=>{k.current&&!H.current&&v(u)&&(u===n||n===t.body||o)&&u.focus({preventScroll:e}),l.remove()}))}}),[o,E,_,k,b,m,y,N,h,U,x]),We((()=>{if(!o&&M)return M.setFocusManagerState({modal:s,closeOnFocusOut:d,open:p,onOpenChange:g,refs:m}),()=>{M.setFocusManagerState(null)}}),[o,M,s,p,g,m,d]),We((()=>{if(o)return;if(!_)return;if("function"!=typeof MutationObserver)return;if(R)return;const e=()=>{const e=_.getAttribute("tabindex"),t=X(),n=T(I(E)),r=t.indexOf(n);-1!==r&&($.current=r),C.current.includes("floating")||n!==m.domReference.current&&0===t.length?"0"!==e&&_.setAttribute("tabindex","0"):"-1"!==e&&_.setAttribute("tabindex","-1")};e();const t=new MutationObserver(e);return t.observe(_,{childList:!0,subtree:!0,attributes:!0}),()=>{t.disconnect()}}),[o,E,_,m,C,X,R]);const G=!o&&S&&(!s||!O)&&(U||s);return e.createElement(e.Fragment,null,G&&e.createElement(pt,{"data-type":"inside",ref:null==M?void 0:M.beforeInsideRef,onFocus:e=>{if(s){const e=Y();je("reference"===i[0]?e[0]:e[e.length-1])}else if(null!=M&&M.preserveTabOrder&&M.portalNode)if(H.current=!1,ct(e,M.portalNode)){const e=lt()||x;null==e||e.focus()}else{var t;null==(t=M.beforeOutsideRef.current)||t.focus()}}}),!O&&K("start"),r,K("end"),G&&e.createElement(pt,{"data-type":"inside",ref:null==M?void 0:M.afterInsideRef,onFocus:e=>{if(s)je(Y()[0]);else if(null!=M&&M.preserveTabOrder&&M.portalNode)if(d&&(H.current=!0),ct(e,M.portalNode)){const e=ut()||x;null==e||e.focus()}else{var t;null==(t=M.afterOutsideRef.current)||t.focus()}}}))},useFloating:function(t){void 0===t&&(t={});const{nodeId:n}=t,r=Ot({...t,elements:{reference:null,floating:null,...t.elements}}),o=t.rootContext||r,i=o.elements,[l,u]=e.useState(null),[a,s]=e.useState(null),f=(null==i?void 0:i.domReference)||l,d=e.useRef(null),p=Xe();We((()=>{f&&(d.current=f)}),[f]);const m=function(t){void 0===t&&(t={});const{placement:n="bottom",strategy:r="absolute",middleware:o=[],platform:i,elements:{reference:l,floating:u}={},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);Ne(m,o)||h(o);const[v,g]=e.useState(null),[y,b]=e.useState(null),w=e.useCallback((e=>{e!==O.current&&(O.current=e,g(e))}),[]),x=e.useCallback((e=>{e!==S.current&&(S.current=e,b(e))}),[]),E=l||v,R=u||y,O=e.useRef(null),S=e.useRef(null),C=e.useRef(d),A=null!=s,k=Me(s),N=Me(i),T=Me(f),L=e.useCallback((()=>{if(!O.current||!S.current)return;const e={placement:n,strategy:r,middleware:m};N.current&&(e.platform=N.current),Ae(O.current,S.current,e).then((e=>{const t={...e,isPositioned:!1!==T.current};M.current&&!Ne(C.current,t)&&(C.current=t,c.flushSync((()=>{p(t)})))}))}),[m,n,r,N,T]);ke((()=>{!1===f&&C.current.isPositioned&&(C.current.isPositioned=!1,p((e=>({...e,isPositioned:!1}))))}),[f]);const M=e.useRef(!1);ke((()=>(M.current=!0,()=>{M.current=!1})),[]),ke((()=>{if(E&&(O.current=E),R&&(S.current=R),E&&R){if(k.current)return k.current(E,R,L);L()}}),[E,R,L,k,A]);const D=e.useMemo((()=>({reference:O,floating:S,setReference:w,setFloating:x})),[w,x]),F=e.useMemo((()=>({reference:E,floating:R})),[E,R]),P=e.useMemo((()=>{const e={position:r,left:0,top:0};if(!F.floating)return e;const t=Le(F.floating,d.x),n=Le(F.floating,d.y);return a?{...e,transform:"translate("+t+"px, "+n+"px)",...Te(F.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:t,top:n}}),[r,a,F.floating,d.x,d.y]);return e.useMemo((()=>({...d,update:L,refs:D,elements:F,floatingStyles:P})),[d,L,D,F,P])}({...t,elements:{...i,...a&&{reference:a}}}),v=e.useCallback((e=>{const t=h(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:e}:e;s(t),m.refs.setReference(t)}),[m.refs]),g=e.useCallback((e=>{(h(e)||null===e)&&(d.current=e,u(e)),(h(m.refs.reference.current)||null===m.refs.reference.current||null!==e&&!h(e))&&m.refs.setReference(e)}),[m.refs]),y=e.useMemo((()=>({...m.refs,setReference:g,setPositionReference:v,domReference:d})),[m.refs,g,v]),b=e.useMemo((()=>({...m.elements,domReference:f})),[m.elements,f]),w=e.useMemo((()=>({...m,...o,refs:y,elements:b,nodeId:n})),[m,y,b,n,o]);return We((()=>{o.dataRef.current.floatingContext=w;const e=null==p?void 0:p.nodesRef.current.find((e=>e.id===n));e&&(e.context=w)})),e.useMemo((()=>({...m,context:w,refs:y,elements:b})),[m,y,b,w])}},Ct="AlertDialog",At=function(e){var n=e.children,r=e.customRootClass,o=void 0===r?"":r,i=e.open,u=e.onOpenChange,c=e.onClickOutside,s=void 0===c?function(){}:c,f=St.useFloating().context,d=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):"")}(o,Ct),p=l(i),m=p[0],h=p[1],v={isOpen:m,handleOpenChange:function(e){h(e),u(e)},floaterContext:f,rootClass:d,handleOverlayClick:function(){s()}};return t.createElement(a.Provider,{value:v},t.createElement("div",{className:d},n))};At.displayName=Ct;var kt=function(e){var n=e.children,r=u(a),o=r.isOpen,i=r.rootClass;return t.createElement(t.Fragment,null,o&&t.createElement("div",{className:"".concat(i,"-content")},n))},Nt=function(){return Nt=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},Nt.apply(this,arguments)};function Tt(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}"function"==typeof SuppressedError&&SuppressedError;var Lt=function(e){var n=e.role,r=void 0===n?"button":n,o=e.label,i=void 0===o?"":o,l=e.description,u=void 0===l?"":l,c=e.disabled,a=void 0!==c&&c,s=e.children,f=Tt(e,["role","label","description","disabled","children"]);return i&&(f["aria-label"]=i),u&&(f["aria-description"]=u),a&&(f["aria-disabled"]="true",u||(f["aria-description"]="Disabled Button")),t.createElement("button",Nt({role:r,disabled:a},f),s)},Mt=function(e){var n=e.children,r=Tt(e,["children"]),o=u(a);o.isOpen;var i=o.handleOpenChange;return o.floaterContext,t.createElement(Lt,Nt({onClick:function(){return i(!0)}},r),n)},Dt=function(e){var n=e.children,r=u(a).rootClass,o=document.getElementsByClassName(r)[0];return t.createElement(St.Portal,{root:o||("development"===process.env.NODE_ENV&&console.warn('AlertDialog: No element found with class "'.concat(r,'". ')+"Falling back to document.body. Dark mode styling may not work correctly."),document.body)},n)},Ft=function(){var e=u(a),n=e.isOpen,r=e.rootClass,o=e.handleOverlayClick;return t.createElement(t.Fragment,null,n&&t.createElement(St.Overlay,{className:"".concat(r,"-overlay"),onClick:o}))},Pt=function(e){var n=e.children,r=u(a).handleOpenChange;return t.createElement(Lt,{onClick:function(){return r(!1)}},n)},It=function(e){var n=e.children,r=u(a).handleOpenChange;return t.createElement(Lt,{onClick:function(){return r(!1)}},n)},jt=function(e){var n=e.children,r=e.open,o=void 0!==r&&r,i=e.onOpenChange,u=e.content,c=l(o),a=c[0];return c[1],t.createElement(At,{open:a,onOpenChange:i},t.createElement(Mt,null,n),t.createElement(Dt,null,t.createElement(Ft,null),t.createElement(kt,null,u,t.createElement(Pt,null,"Cancel"),t.createElement(It,null,"Action"))))};export{jt as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use client';import
|
|
1
|
+
'use client';import a,{createContext as r,useState as e,useContext as t}from"react";var o=function(){return o=Object.assign||function(a){for(var r,e=1,t=arguments.length;e<t;e++)for(var o in r=arguments[e])Object.prototype.hasOwnProperty.call(r,o)&&(a[o]=r[o]);return a},o.apply(this,arguments)};function c(a,r){var e={};for(var t in a)Object.prototype.hasOwnProperty.call(a,t)&&r.indexOf(t)<0&&(e[t]=a[t]);if(null!=a&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(t=Object.getOwnPropertySymbols(a);o<t.length;o++)r.indexOf(t[o])<0&&Object.prototype.propertyIsEnumerable.call(a,t[o])&&(e[t[o]]=a[t[o]])}return e}"function"==typeof SuppressedError&&SuppressedError;var s=r({}),l=function(a,r){void 0===a&&(a=""),void 0===r&&(r="");var e=r.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();return a||(r?"".concat("rad-ui","-").concat(e):"")},n=function(r){var t=r.children,n=r.className,i=void 0===n?"":n,m=r.customRootClass,u=void 0===m?"":m,d=r.src,f=c(r,["children","className","customRootClass","src"]),p=l(u,"Avatar"),v=l(u,"Fallback"),E=e(!1),h=E[0],y=E[1],b=e(!d),g=b[0],N=b[1],O={rootClass:p,fallBackRootClass:v,isImageLoaded:h,hasError:g,setHasError:N,handleLoadImage:function(){y(!0),N(!1)},handleErrorImage:function(){y(!1),N(!0)},src:d};return a.createElement(s.Provider,{value:O},a.createElement("span",o({className:"".concat(p," ").concat(i)},f),t))},i=function(r){var e=r.children,o=r.className,c=void 0===o?"":o,l=t(s),n=l.hasError,i=l.fallBackRootClass;return n?a.createElement("span",{className:"".concat(i," ").concat(c)},e):null},m=function(r){var e=r.src,l=r.alt,n=void 0===l?"Avatar":l,i=r.className,m=void 0===i?"":i,u=c(r,["src","alt","className"]),d=t(s),f=d.handleErrorImage,p=d.handleLoadImage,v=d.hasError;return!e||v?null:a.createElement("img",o({src:e,alt:n,onError:f,onLoad:p,className:m},u))},u=function(r){var e=r.customRootClass,t=void 0===e?"":e,s=r.fallback,l=r.className,u=r.src,d=r.alt,f=c(r,["customRootClass","fallback","className","src","alt"]);return a.createElement(n,{src:u,customRootClass:t},a.createElement(m,o({src:u,alt:d,className:l},f)),a.createElement(i,null,s))};u.displayName="Avatar",u.Root=n,u.Image=m,u.Fallback=i;export{u as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use client';import a,{createContext as r,useState as e,useContext as t}from"react";var o=function(){return o=Object.assign||function(a){for(var r,e=1,t=arguments.length;e<t;e++)for(var o in r=arguments[e])Object.prototype.hasOwnProperty.call(r,o)&&(a[o]=r[o]);return a},o.apply(this,arguments)};function s(a,r){var e={};for(var t in a)Object.prototype.hasOwnProperty.call(a,t)&&r.indexOf(t)<0&&(e[t]=a[t]);if(null!=a&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(t=Object.getOwnPropertySymbols(a);o<t.length;o++)r.indexOf(t[o])<0&&Object.prototype.propertyIsEnumerable.call(a,t[o])&&(e[t[o]]=a[t[o]])}return e}"function"==typeof SuppressedError&&SuppressedError;var c=function(a,r){void 0===a&&(a=""),void 0===r&&(r="");var e=r.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();return a||(r?"".concat("rad-ui","-").concat(e):"")},n=function(r){var e=r.customRootClass,t=void 0===e?"":e,n=r.children,l=r.className,i=s(r,["customRootClass","children","className"]),m=c(t,"AvatarGroup");return a.createElement("div",o({className:"".concat(m," ").concat(l)},i),n)},l=r({}),i=function(r){var t=r.children,n=r.className,i=void 0===n?"":n,m=r.customRootClass,u=void 0===m?"":m,v=r.src,d=s(r,["children","className","customRootClass","src"]),p=c(u,"Avatar"),f=c(u,"Fallback"),E=e(!1),h=E[0],y=E[1],N=e(!v),g=N[0],b=N[1],O={rootClass:p,fallBackRootClass:f,isImageLoaded:h,hasError:g,setHasError:b,handleLoadImage:function(){y(!0),b(!1)},handleErrorImage:function(){y(!1),b(!0)},src:v};return a.createElement(l.Provider,{value:O},a.createElement("span",o({className:"".concat(p," ").concat(i)},d),t))},m=function(r){var e=r.children,o=r.className,s=void 0===o?"":o,c=t(l),n=c.hasError,i=c.fallBackRootClass;return n?a.createElement("span",{className:"".concat(i," ").concat(s)},e):null},u=function(r){var e=r.src,c=r.alt,n=void 0===c?"Avatar":c,i=r.className,m=void 0===i?"":i,u=s(r,["src","alt","className"]),v=t(l),d=v.handleErrorImage,p=v.handleLoadImage,f=v.hasError;return!e||f?null:a.createElement("img",o({src:e,alt:n,onError:d,onLoad:p,className:m},u))},v=function(r){var e=r.avatars,t=void 0===e?[]:e;r.size;var c=r.customRootClass,l=void 0===c?"":c,v=r.className,d=s(r,["avatars","size","customRootClass","className"]);return a.createElement(n,o({customRootClass:l,className:v},d),t.map((function(r,e){return a.createElement(i,{key:e,src:r.src},a.createElement(u,{src:r.src,alt:r.alt}),a.createElement(m,null,r.fallback))})))};v.displayName="AvatarGroup",v.Root=n,v.AvatarRoot=i,v.AvatarImage=u,v.AvatarFallback=m;export{v as default};
|
package/dist/components/Badge.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use client';import r from"react";var
|
|
1
|
+
'use client';import r from"react";var e=function(){return e=Object.assign||function(r){for(var e,o=1,t=arguments.length;o<t;o++)for(var a in e=arguments[o])Object.prototype.hasOwnProperty.call(e,a)&&(r[a]=e[a]);return r},e.apply(this,arguments)};function o(r,e){var o={};for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&e.indexOf(t)<0&&(o[t]=r[t]);if(null!=r&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(t=Object.getOwnPropertySymbols(r);a<t.length;a++)e.indexOf(t[a])<0&&Object.prototype.propertyIsEnumerable.call(r,t[a])&&(o[t[a]]=r[t[a]])}return o}"function"==typeof SuppressedError&&SuppressedError;var t="Badge",a=function(a){var n=a.children,c=a.customRootClass,l=a.className,s=a.color,u=o(a,["children","customRootClass","className","color"]),i=function(r,e){void 0===r&&(r=""),void 0===e&&(e="");var o=e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();return r||(e?"".concat("rad-ui","-").concat(o):"")}(c,t);return r.createElement("span",e({className:"".concat(i," ").concat(l),"data-accent-color":null!=s?s:void 0},u),n)};a.displayName=t;var n=function(e){var o=e.children;return r.createElement(r.Fragment,null,o)},c=function(t){var c=t.children,l=t.customRootClass,s=t.className,u=t.color,i=o(t,["children","customRootClass","className","color"]);return r.createElement(a,e({customRootClass:l,className:"".concat(s),color:null!=u?u:void 0},i),r.createElement(n,null,c))};c.Root=a,c.Content=n;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 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=d(e)?b(e):e;return"none"!==n.transform||"none"!==n.perspective||!!n.containerType&&"normal"!==n.containerType||!t&&!!n.backdropFilter&&"none"!==n.backdropFilter||!t&&!!n.filter&&"none"!==n.filter||["transform","perspective","filter"].some((e=>(n.willChange||"").includes(e)))||["paint","layout","strict","content"].some((e=>(n.contain||"").includes(e)))}function w(){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);if(i){const e=function(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}(l);return t.concat(l,l.visualViewport||[],g(o)?o:[],e&&n?P(e):[])}return 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 j(e,t,n){return A(e,D(t,n))}function B(e,t){return"function"==typeof e?e(t):e}function _(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(_(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=_(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}=B(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(y(t))return t;if(h(t))return null;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=_(n),c=V(n),s="y"===X(n),a=["left","top"].includes(l)?-1:1,u=i&&s?-1:1,f=B(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}=B(e,t),a={x:n,y:r},u=await G(t,s),f=X(_(o)),d=K(f);let m=a[d],p=a[f];if(i){const e="y"===d?"bottom":"right";m=j(m+u["y"===d?"top":"left"],m,m-u[e])}if(l){const e="y"===f?"bottom":"right";p=j(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}=B(e,t);if(null!=(n=i.arrow)&&n.alignmentOffset)return{};const h=_(o),y=X(c),w=_(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[]}}(_(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}=B(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}=B(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=j(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 je=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+Ie++;const Be=De.useId||function(){const[t,n]=e.useState((()=>We?je():void 0));return Fe((()=>{null==t&&n(je())}),[]),e.useEffect((()=>{We=!0}),[]),t};let _e;"production"!==process.env.NODE_ENV&&(_e=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=_e)&&e.has(o)||(null==(i=_e)||i.add(o),console.warn(o))}("The `ref` prop is required for `FloatingArrow`."));const v=Be(),[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=Be(),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=_e)&&e.has(o)||(null==(i=_e)||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],j=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=j.refs,_=j.floatingStyles,V=j.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=Be(),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)&&B){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 j=e.useMemo((()=>({onKeyDown:F,[Ge[p]]:e=>{f&&o(!1,e.nativeEvent,"reference-press")}})),[F,o,f,p]),B=e.useMemo((()=>({onKeyDown:F,onMouseDown(){O.current=!0},onMouseUp(){O.current=!0},[Je[u]]:()=>{C.current=!0}})),[F,u]);return e.useMemo((()=>c?{reference:j,floating:B}:{}),[c,j,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:B.setReference},Y({onClick:function(){console.log("click")}})),v),W&&t.createElement("div",c({className:"".concat(N,"-floating-element"),ref:B.setFloating,style:_},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};
|
|
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(){return"undefined"!=typeof window}function u(e){return d(e)?(e.nodeName||"").toLowerCase():"#document"}function a(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function f(e){var t;return null==(t=(d(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function d(e){return!!s()&&(e instanceof Node||e instanceof a(e).Node)}function m(e){return!!s()&&(e instanceof Element||e instanceof a(e).Element)}function p(e){return!!s()&&(e instanceof HTMLElement||e instanceof a(e).HTMLElement)}function g(e){return!(!s()||"undefined"==typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof a(e).ShadowRoot)}function v(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=E(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function h(e){return["table","td","th"].includes(u(e))}function y(e){return[":popover-open",":modal"].some((t=>{try{return e.matches(t)}catch(e){return!1}}))}function w(e){const t=x(),n=m(e)?E(e):e;return"none"!==n.transform||"none"!==n.perspective||!!n.containerType&&"normal"!==n.containerType||!t&&!!n.backdropFilter&&"none"!==n.backdropFilter||!t&&!!n.filter&&"none"!==n.filter||["transform","perspective","filter"].some((e=>(n.willChange||"").includes(e)))||["paint","layout","strict","content"].some((e=>(n.contain||"").includes(e)))}function x(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function b(e){return["html","body","#document"].includes(u(e))}function E(e){return a(e).getComputedStyle(e)}function R(e){return m(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function C(e){if("html"===u(e))return e;const t=e.assignedSlot||e.parentNode||g(e)&&e.host||f(e);return g(t)?t.host:t}function L(e){const t=C(e);return b(t)?e.ownerDocument?e.ownerDocument.body:e.body:p(t)&&v(t)?t:L(t)}function P(e,t,n){var r;void 0===t&&(t=[]),void 0===n&&(n=!0);const o=L(e),i=o===(null==(r=e.ownerDocument)?void 0:r.body),l=a(o);if(i){const e=O(l);return t.concat(l,l.visualViewport||[],v(o)?o:[],e&&n?P(e):[])}return t.concat(o,P(o,[],n))}function O(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function T(e,t){if(!e||!t)return!1;const n=null==t.getRootNode?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&g(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function k(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}function M(e){return(null==e?void 0:e.ownerDocument)||document}function S(e,t){if(null==t)return!1;if("composedPath"in e)return e.composedPath().includes(t);const n=e;return null!=n.target&&t.contains(n.target)}function A(e){return"composedPath"in e?e.composedPath()[0]:e.target}const D=["top","right","bottom","left"],N=Math.min,F=Math.max,H=Math.round,W=Math.floor,j=e=>({x:e,y:e}),B={left:"right",right:"left",bottom:"top",top:"bottom"},I={start:"end",end:"start"};function _(e,t,n){return F(e,N(t,n))}function V(e,t){return"function"==typeof e?e(t):e}function K(e){return e.split("-")[0]}function z(e){return e.split("-")[1]}function X(e){return"x"===e?"y":"x"}function Y(e){return"y"===e?"height":"width"}function $(e){return["top","bottom"].includes(K(e))?"y":"x"}function q(e){return X($(e))}function U(e){return e.replace(/start|end/g,(e=>I[e]))}function Z(e){return e.replace(/left|right|bottom|top/g,(e=>B[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 G(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 J(e,t,n){let{reference:r,floating:o}=e;const i=$(t),l=q(t),c=Y(l),s=K(t),u="y"===i,a=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:a,y:r.y-o.height};break;case"bottom":m={x:a,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(z(t)){case"start":m[l]-=d*(n&&u?-1:1);break;case"end":m[l]+=d*(n&&u?-1:1)}return m}async function ee(e,t){var n;void 0===t&&(t={});const{x:r,y:o,platform:i,rects:l,elements:c,strategy:s}=e,{boundary:u="clippingAncestors",rootBoundary:a="viewport",elementContext:f="floating",altBoundary:d=!1,padding:m=0}=V(t,e),p=Q(m),g=c[d?"floating"===f?"reference":"floating":f],v=G(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:u,rootBoundary:a,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=G(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 te(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function ne(e){return D.some((t=>e[t]>=0))}function re(e){const t=E(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=H(n)!==i||H(r)!==l;return c&&(n=i,r=l),{width:n,height:r,$:c}}function oe(e){return m(e)?e:e.contextElement}function ie(e){const t=oe(e);if(!p(t))return j(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=re(t);let l=(i?H(n.width):n.width)/r,c=(i?H(n.height):n.height)/o;return l&&Number.isFinite(l)||(l=1),c&&Number.isFinite(c)||(c=1),{x:l,y:c}}const le=j(0);function ce(e){const t=a(e);return x()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:le}function se(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);const o=e.getBoundingClientRect(),i=oe(e);let l=j(1);t&&(r?m(r)&&(l=ie(r)):l=ie(e));const c=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==a(e))&&t}(i,n,r)?ce(i):j(0);let s=(o.left+c.x)/l.x,u=(o.top+c.y)/l.y,f=o.width/l.x,d=o.height/l.y;if(i){const e=a(i),t=r&&m(r)?a(r):r;let n=e,o=O(n);for(;o&&r&&t!==n;){const e=ie(o),t=o.getBoundingClientRect(),r=E(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,d*=e.y,s+=i,u+=l,n=a(o),o=O(n)}}return G({width:f,height:d,x:s,y:u})}function ue(e,t){const n=R(e).scrollLeft;return t?t.left+n:se(f(e)).left+n}function ae(e,t,n){void 0===n&&(n=!1);const r=e.getBoundingClientRect();return{x:r.left+t.scrollLeft-(n?0:ue(e,r)),y:r.top+t.scrollTop}}function fe(e,t,n){let r;if("viewport"===t)r=function(e,t){const n=a(e),r=f(e),o=n.visualViewport;let i=r.clientWidth,l=r.clientHeight,c=0,s=0;if(o){i=o.width,l=o.height;const e=x();(!e||e&&"fixed"===t)&&(c=o.offsetLeft,s=o.offsetTop)}return{width:i,height:l,x:c,y:s}}(e,n);else if("document"===t)r=function(e){const t=f(e),n=R(e),r=e.ownerDocument.body,o=F(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=F(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let l=-n.scrollLeft+ue(e);const c=-n.scrollTop;return"rtl"===E(r).direction&&(l+=F(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:l,y:c}}(f(e));else if(m(t))r=function(e,t){const n=se(e,!0,"fixed"===t),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=p(e)?ie(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=ce(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return G(r)}function de(e,t){const n=C(e);return!(n===t||!m(n)||b(n))&&("fixed"===E(n).position||de(n,t))}function me(e,t,n){const r=p(t),o=f(t),i="fixed"===n,l=se(e,!0,i,t);let c={scrollLeft:0,scrollTop:0};const s=j(0);if(r||!r&&!i)if(("body"!==u(t)||v(o))&&(c=R(t)),r){const e=se(t,!0,i,t);s.x=e.x+t.clientLeft,s.y=e.y+t.clientTop}else o&&(s.x=ue(o));const a=!o||r||i?j(0):ae(o,c);return{x:l.left+c.scrollLeft-s.x-a.x,y:l.top+c.scrollTop-s.y-a.y,width:l.width,height:l.height}}function pe(e){return"static"===E(e).position}function ge(e,t){if(!p(e)||"fixed"===E(e).position)return null;if(t)return t(e);let n=e.offsetParent;return f(e)===n&&(n=n.ownerDocument.body),n}function ve(e,t){const n=a(e);if(y(e))return n;if(!p(e)){let t=C(e);for(;t&&!b(t);){if(m(t)&&!pe(t))return t;t=C(t)}return n}let r=ge(e,t);for(;r&&h(r)&&pe(r);)r=ge(r,t);return r&&b(r)&&pe(r)&&!w(r)?n:r||function(e){let t=C(e);for(;p(t)&&!b(t);){if(w(t))return t;if(y(t))return null;t=C(t)}return null}(e)||n}const he={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i="fixed"===o,l=f(r),c=!!t&&y(t.floating);if(r===l||c&&i)return n;let s={scrollLeft:0,scrollTop:0},a=j(1);const d=j(0),m=p(r);if((m||!m&&!i)&&(("body"!==u(r)||v(l))&&(s=R(r)),p(r))){const e=se(r);a=ie(r),d.x=e.x+r.clientLeft,d.y=e.y+r.clientTop}const g=!l||m||i?j(0):ae(l,s,!0);return{width:n.width*a.x,height:n.height*a.y,x:n.x*a.x-s.scrollLeft*a.x+d.x+g.x,y:n.y*a.y-s.scrollTop*a.y+d.y+g.y}},getDocumentElement:f,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[..."clippingAncestors"===n?y(t)?[]:function(e,t){const n=t.get(e);if(n)return n;let r=P(e,[],!1).filter((e=>m(e)&&"body"!==u(e))),o=null;const i="fixed"===E(e).position;let l=i?C(e):e;for(;m(l)&&!b(l);){const t=E(l),n=w(l);n||"fixed"!==t.position||(o=null),(i?!n&&!o:!n&&"static"===t.position&&o&&["absolute","fixed"].includes(o.position)||v(l)&&!n&&de(e,l))?r=r.filter((e=>e!==l)):o=t,l=C(l)}return t.set(e,r),r}(t,this._c):[].concat(n),r],l=i[0],c=i.reduce(((e,n)=>{const r=fe(t,n,o);return e.top=F(r.top,e.top),e.right=N(r.right,e.right),e.bottom=N(r.bottom,e.bottom),e.left=F(r.left,e.left),e}),fe(t,l,o));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}},getOffsetParent:ve,getElementRects:async function(e){const t=this.getOffsetParent||ve,n=this.getDimensions,r=await n(e.floating);return{reference:me(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}=re(e);return{width:t,height:n}},getScale:ie,isElement:m,isRTL:function(e){return"rtl"===E(e).direction}};function ye(e,t,n,r){void 0===r&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:l="function"==typeof ResizeObserver,layoutShift:c="function"==typeof IntersectionObserver,animationFrame:s=!1}=r,u=oe(e),a=o||i?[...u?P(u):[],...P(t)]:[];a.forEach((e=>{o&&e.addEventListener("scroll",n,{passive:!0}),i&&e.addEventListener("resize",n)}));const d=u&&c?function(e,t){let n,r=null;const o=f(e);function i(){var e;clearTimeout(n),null==(e=r)||e.disconnect(),r=null}return function l(c,s){void 0===c&&(c=!1),void 0===s&&(s=1),i();const{left:u,top:a,width:f,height:d}=e.getBoundingClientRect();if(c||t(),!f||!d)return;const m={rootMargin:-W(a)+"px "+-W(o.clientWidth-(u+f))+"px "+-W(o.clientHeight-(a+d))+"px "+-W(u)+"px",threshold:F(0,N(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}(u,n):null;let m,p=-1,g=null;l&&(g=new ResizeObserver((e=>{let[r]=e;r&&r.target===u&&g&&(g.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame((()=>{var e;null==(e=g)||e.observe(t)}))),n()})),u&&!s&&g.observe(u),g.observe(t));let v=s?se(e):null;return s&&function t(){const r=se(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;a.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 we=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=K(n),c=z(n),s="y"===$(n),u=["left","top"].includes(l)?-1:1,a=i&&s?-1:1,f=V(t,e);let{mainAxis:d,crossAxis:m,alignmentAxis:p}="number"==typeof f?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return c&&"number"==typeof p&&(m="end"===c?-1*p:p),s?{x:m*a,y:d*u}:{x:d*u,y:m*a}}(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}}}}},xe=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:i=!0,crossAxis:l=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...s}=V(e,t),u={x:n,y:r},a=await ee(t,s),f=$(K(o)),d=X(f);let m=u[d],p=u[f];if(i){const e="y"===d?"bottom":"right";m=_(m+a["y"===d?"top":"left"],m,m-a[e])}if(l){const e="y"===f?"bottom":"right";p=_(p+a["y"===f?"top":"left"],p,p-a[e])}const g=c.fn({...t,[d]:m,[f]:p});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[d]:i,[f]:l}}}}}},be=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:l,initialPlacement:c,platform:s,elements:u}=t,{mainAxis:a=!0,crossAxis:f=!0,fallbackPlacements:d,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:g=!0,...v}=V(e,t);if(null!=(n=i.arrow)&&n.alignmentOffset)return{};const h=K(o),y=$(c),w=K(c)===c,x=await(null==s.isRTL?void 0:s.isRTL(u.floating)),b=d||(w||!g?[Z(c)]:function(e){const t=Z(e);return[U(e),t,U(t)]}(c)),E="none"!==p;!d&&E&&b.push(...function(e,t,n,r){const o=z(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[]}}(K(e),"start"===n,r);return o&&(i=i.map((e=>e+"-"+o)),t&&(i=i.concat(i.map(U)))),i}(c,g,p,x));const R=[c,...b],C=await ee(t,v),L=[];let P=(null==(r=i.flip)?void 0:r.overflows)||[];if(a&&L.push(C[h]),f){const e=function(e,t,n){void 0===n&&(n=!1);const r=z(e),o=q(e),i=Y(o);let l="x"===o?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[i]>t.floating[i]&&(l=Z(l)),[l,Z(l)]}(o,l,x);L.push(C[e[0]],C[e[1]])}if(P=[...P,{placement:o,overflows:L}],!L.every((e=>e<=0))){var O,T;const e=((null==(O=i.flip)?void 0:O.index)||0)+1,t=R[e];if(t)return{data:{index:e,overflows:P},reset:{placement:t}};let n=null==(T=P.filter((e=>e.overflows[0]<=0)).sort(((e,t)=>e.overflows[1]-t.overflows[1]))[0])?void 0:T.placement;if(!n)switch(m){case"bestFit":{var k;const e=null==(k=P.filter((e=>{if(E){const t=$(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:k[0];e&&(n=e);break}case"initialPlacement":n=c}if(o!==n)return{reset:{placement:n}}}return{}}}},Ee=function(e){return void 0===e&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...o}=V(e,t);switch(r){case"referenceHidden":{const e=te(await ee(t,{...o,elementContext:"reference"}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:ne(e)}}}case"escaped":{const e=te(await ee(t,{...o,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:ne(e)}}}default:return{}}}}},Re=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:u,padding:a=0}=V(e,t)||{};if(null==u)return{};const f=Q(a),d={x:n,y:r},m=q(o),p=Y(m),g=await l.getDimensions(u),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(u));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,L=R/2-g[p]/2-1,P=N(f[h],L),O=N(f[y],L),T=P,k=R-g[p]-O,M=R/2-g[p]/2+C,S=_(T,M,k),A=!s.arrow&&null!=z(o)&&M!==S&&i.reference[p]/2-(M<T?P:O)-g[p]/2<0,D=A?M<T?M-T:M-k:0;return{[m]:d[m]+D,data:{[m]:S,centerOffset:M-S-D,...A&&{alignmentOffset:D}},reset:A}}}),Ce=(e,t,n)=>{const r=new Map,o={platform:he,...n},i={...o.platform,_c:r};return(async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:l}=n,c=i.filter(Boolean),s=await(null==l.isRTL?void 0:l.isRTL(t));let u=await l.getElementRects({reference:e,floating:t,strategy:o}),{x:a,y:f}=J(u,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:a,y:f,initialPlacement:r,placement:d,strategy:o,middlewareData:m,rects:u,platform:l,elements:{reference:e,floating:t}});a=null!=v?v:a,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&&(u=!0===w.rects?await l.getElementRects({reference:e,floating:t,strategy:o}):w.rects),({x:a,y:f}=J(u,d,s))),n=-1)}return{x:a,y:f,placement:d,strategy:o,middlewareData:m}})(e,t,{...o,platform:i})};var Le="undefined"!=typeof document?n:r;function Pe(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;0!=r--;)if(!Pe(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;0!=r--;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;0!=r--;){const n=o[r];if(("_owner"!==n||!e.$$typeof)&&!Pe(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function Oe(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Te(e,t){const n=Oe(e);return Math.round(t*n)/n}function ke(t){const n=e.useRef(t);return Le((()=>{n.current=t})),n}const Me=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?Re({element:n.current,padding:r}).fn(t):{}:n?Re({element:n,padding:r}).fn(t):{};var o}}),Se=(e,t)=>({...we(e),options:[e,t]}),Ae=(e,t)=>({...xe(e),options:[e,t]}),De=(e,t)=>({...be(e),options:[e,t]}),Ne=(e,t)=>({...Ee(e),options:[e,t]}),Fe={...e},He=Fe.useInsertionEffect||(e=>e());function We(t){const n=e.useRef((()=>{if("production"!==process.env.NODE_ENV)throw new Error("Cannot call an event handler while rendering.")}));return He((()=>{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 je="undefined"!=typeof document?n:r;function Be(){return Be=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},Be.apply(this,arguments)}let Ie=!1,_e=0;const Ve=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+_e++;const Ke=Fe.useId||function(){const[t,n]=e.useState((()=>Ie?Ve():void 0));return je((()=>{null==t&&n(Ve())}),[]),e.useEffect((()=>{Ie=!0}),[]),t};let ze;"production"!==process.env.NODE_ENV&&(ze=new Set);const Xe=e.forwardRef((function(t,n){const{context:{placement:r,elements:{floating:o},middlewareData:{arrow:i,shift:l}},width:c=14,height:s=7,tipRadius:u=0,strokeWidth:a=0,staticOffset:f,stroke:d,d:m,style:{transform:p,...g}={},...v}=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=ze)&&e.has(o)||(null==(i=ze)||i.add(o),console.warn(o))}("The `ref` prop is required for `FloatingArrow`."));const h=Ke(),[y,w]=e.useState(!1);if(je((()=>{if(!o)return;"rtl"===E(o).direction&&w(!0)}),[o]),!o)return null;const[x,b]=r.split("-"),R="top"===x||"bottom"===x;let C=f;(R&&null!=l&&l.x||!R&&null!=l&&l.y)&&(C=null);const L=2*a,P=L/2,O=c/2*(u/-8+1),T=s/2*u/4,k=!!m,M=C&&"end"===b?"bottom":"top";let S=C&&"end"===b?"right":"left";C&&y&&(S="end"===b?"left":"right");const A=null!=(null==i?void 0:i.x)?C||i.x:"",D=null!=(null==i?void 0:i.y)?C||i.y:"",N=m||"M0,0 H"+c+" L"+(c-O)+","+(s-T)+" Q"+c/2+","+s+" "+O+","+(s-T)+" Z",F={top:k?"rotate(180deg)":"",left:k?"rotate(90deg)":"rotate(-90deg)",bottom:k?"":"rotate(180deg)",right:k?"rotate(-90deg)":"rotate(90deg)"}[x];return e.createElement("svg",Be({},v,{"aria-hidden":!0,ref:n,width:k?c:c+L,height:c,viewBox:"0 0 "+c+" "+(s>c?s:c),style:{position:"absolute",pointerEvents:"none",[S]:A,[M]:D,[x]:R||k?"100%":"calc(100% - "+L/2+"px)",transform:[F,p].filter((e=>!!e)).join(" "),...g}}),L>0&&e.createElement("path",{clipPath:"url(#"+h+")",fill:"none",stroke:d,strokeWidth:L+(m?0:1),d:N}),e.createElement("path",{stroke:L&&!m?v.fill:"none",d:N}),e.createElement("clipPath",{id:h},e.createElement("rect",{x:-P,y:P*(k?-1:1),width:c+L,height:c})))}));const Ye=e.createContext(null),$e=e.createContext(null),qe=()=>{var t;return(null==(t=e.useContext(Ye))?void 0:t.id)||null},Ue=()=>e.useContext($e);function Ze(e){return"data-floating-ui-"+e}function Qe(e){const t=o(e);return je((()=>{t.current=e})),t}const Ge=Ze("safe-polygon");function Je(e,t,n){return n&&!k(n)?0:"number"==typeof e?e:null==e?void 0:e[t]}function et(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 tt="data-floating-ui-focusable",nt={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},rt={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},ot=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 it(t){const{open:n=!1,onOpenChange:r,elements:o}=t,i=Ke(),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!=qe();if("production"!==process.env.NODE_ENV){const e=o.reference;e&&!m(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=ze)&&e.has(o)||(null==(i=ze)||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[u,a]=e.useState(o.reference),f=We(((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)})),d=e.useMemo((()=>({setPositionReference:a})),[]),p=e.useMemo((()=>({reference:u||o.reference||null,floating:o.floating||null,domReference:o.reference})),[u,o.reference,o.floating]);return e.useMemo((()=>({dataRef:l,open:n,onOpenChange:f,elements:p,events:c,floatingId:i,refs:d})),[n,f,p,c,i,d])}function lt(t){void 0===t&&(t={});const{nodeId:n}=t,r=it({...t,elements:{reference:null,floating:null,...t.elements}}),o=t.rootContext||r,i=o.elements,[c,s]=e.useState(null),[u,a]=e.useState(null),f=(null==i?void 0:i.domReference)||c,d=e.useRef(null),p=Ue();je((()=>{f&&(d.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:u=!0,whileElementsMounted:a,open:f}=t,[d,m]=e.useState({x:0,y:0,strategy:r,placement:n,middlewareData:{},isPositioned:!1}),[p,g]=e.useState(o);Pe(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!==L.current&&(L.current=e,w(e))}),[]),E=c||v,R=s||y,C=e.useRef(null),L=e.useRef(null),P=e.useRef(d),O=null!=a,T=ke(a),k=ke(i),M=ke(f),S=e.useCallback((()=>{if(!C.current||!L.current)return;const e={placement:n,strategy:r,middleware:p};k.current&&(e.platform=k.current),Ce(C.current,L.current,e).then((e=>{const t={...e,isPositioned:!1!==M.current};A.current&&!Pe(P.current,t)&&(P.current=t,l.flushSync((()=>{m(t)})))}))}),[p,n,r,k,M]);Le((()=>{!1===f&&P.current.isPositioned&&(P.current.isPositioned=!1,m((e=>({...e,isPositioned:!1}))))}),[f]);const A=e.useRef(!1);Le((()=>(A.current=!0,()=>{A.current=!1})),[]),Le((()=>{if(E&&(C.current=E),R&&(L.current=R),E&&R){if(T.current)return T.current(E,R,S);S()}}),[E,R,S,T,O]);const D=e.useMemo((()=>({reference:C,floating:L,setReference:x,setFloating:b})),[x,b]),N=e.useMemo((()=>({reference:E,floating:R})),[E,R]),F=e.useMemo((()=>{const e={position:r,left:0,top:0};if(!N.floating)return e;const t=Te(N.floating,d.x),n=Te(N.floating,d.y);return u?{...e,transform:"translate("+t+"px, "+n+"px)",...Oe(N.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:t,top:n}}),[r,u,N.floating,d.x,d.y]);return e.useMemo((()=>({...d,update:S,refs:D,elements:N,floatingStyles:F})),[d,S,D,N,F])}({...t,elements:{...i,...u&&{reference:u}}}),v=e.useCallback((e=>{const t=m(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:e}:e;a(t),g.refs.setReference(t)}),[g.refs]),h=e.useCallback((e=>{(m(e)||null===e)&&(d.current=e,s(e)),(m(g.refs.reference.current)||null===g.refs.reference.current||null!==e&&!m(e))&&g.refs.setReference(e)}),[g.refs]),y=e.useMemo((()=>({...g.refs,setReference:h,setPositionReference:v,domReference:d})),[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 je((()=>{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 ct="active",st="selected";function ut(e,t,n){const r=new Map,o="item"===n;let i=e;if(o&&e){const{[ct]:t,[st]:n,...r}=e;i=r}return{..."floating"===n&&{tabIndex:-1,[tt]:""},...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&&[ct,st].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 at=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);var ft=function(n){var r=n.popperName,l=void 0===r?"":r,s=n.customRootClass,u=void 0===s?"":s;n.activationStrategy;var a=n.className,f=void 0===a?"":a,d=n.placement,g=void 0===d?"top":d,v=n.children,h=n.open,y=void 0!==h&&h;n.hoverDelay;var w=n.showArrow,R=void 0===w||w,L=n.pop,O=void 0===L?t.createElement(t.Fragment,null):L;!function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}}(n,["popperName","customRootClass","activationStrategy","className","placement","children","open","hoverDelay","showArrow","pop"]);var D,N,F=function(e,t){void 0===e&&(e=""),void 0===t&&(t="");var n=t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();return e||(t?"".concat("rad-ui","-").concat(n):"")}(u,l),H=o(null),W=i(y),j=W[0],B=W[1],I=lt({placement:g,whileElementsMounted:ye,open:j,middleware:[(D={element:H},{...Me(D),options:[D,N]}),Se(9),De({mainAxis:!0,fallbackStrategy:"initialPlacement"}),Ae({crossAxis:!1}),Ne({strategy:"referenceHidden"})],onOpenChange:B}),_=I.refs,V=I.floatingStyles,K=I.context,z=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=at.get(c))?r:c,u=Ke(),a=null!=qe(),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:u},..."menu"===s&&a&&{role:"menuitem"},..."select"===c&&{"aria-autocomplete":"none"},..."combobox"===c&&{"aria-autocomplete":"list"}}),[s,i,a,o,u,c]),d=e.useMemo((()=>{const e={id:i,...s&&{role:s}};return"tooltip"===s||"label"===c?e:{...e,..."menu"===s&&{"aria-labelledby":u}}}),[s,i,u,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])}(K),X=function(t,n){void 0===n&&(n={});const{open:r,onOpenChange:o,elements:i,dataRef:l}=t,{enabled:c=!0,escapeKey:s=!0,outsidePress:u=!0,outsidePressEvent:a="pointerdown",referencePress:f=!1,referencePressEvent:d="pointerdown",ancestorScroll:g=!1,bubbles:v,capture:h}=n,y=Ue(),w=We("function"==typeof u?u:()=>!1),R="function"==typeof u?w:u,L=e.useRef(!1),O=e.useRef(!1),{escapeKey:k,outsidePress:D}=ot(v),{escapeKey:N,outsidePress:F}=ot(h),H=e.useRef(!1),W=We((e=>{var t;if(!r||!c||!s||"Escape"!==e.key)return;if(H.current)return;const n=null==(t=l.current.floatingContext)?void 0:t.nodeId,i=y?et(y.nodesRef.current,n):[];if(!k&&(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")})),j=We((e=>{var t;const n=()=>{var t;W(e),null==(t=A(e))||t.removeEventListener("keydown",n)};null==(t=A(e))||t.addEventListener("keydown",n)})),B=We((e=>{var t;const n=L.current;L.current=!1;const r=O.current;if(O.current=!1,"click"===a&&r)return;if(n)return;if("function"==typeof R&&!R(e))return;const c=A(e),s="["+Ze("inert")+"]",u=M(i.floating).querySelectorAll(s);let f=m(c)?c:null;for(;f&&!b(f);){const e=C(f);if(b(e)||!m(e))break;f=e}if(u.length&&m(c)&&!c.matches("html,body")&&!T(c,i.floating)&&Array.from(u).every((e=>!T(f,e))))return;if(p(c)&&V){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"===E(c).direction&&(r=e.offsetX<=c.offsetWidth-c.clientWidth),r||t&&e.offsetY>c.clientHeight)return}const d=null==(t=l.current.floatingContext)?void 0:t.nodeId,g=y&&et(y.nodesRef.current,d).some((t=>{var n;return S(e,null==(n=t.context)?void 0:n.elements.floating)}));if(S(e,i.floating)||S(e,i.domReference)||g)return;const v=y?et(y.nodesRef.current,d):[];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=We((e=>{var t;const n=()=>{var t;B(e),null==(t=A(e))||t.removeEventListener(a,n)};null==(t=A(e))||t.addEventListener(a,n)}));e.useEffect((()=>{if(!r||!c)return;l.current.__escapeKeyBubbles=k,l.current.__outsidePressBubbles=D;let e=-1;function t(e){o(!1,e,"ancestor-scroll")}function n(){window.clearTimeout(e),H.current=!0}function u(){e=window.setTimeout((()=>{H.current=!1}),x()?5:0)}const f=M(i.floating);s&&(f.addEventListener("keydown",N?j:W,N),f.addEventListener("compositionstart",n),f.addEventListener("compositionend",u)),R&&f.addEventListener(a,F?I:B,F);let d=[];return g&&(m(i.domReference)&&(d=P(i.domReference)),m(i.floating)&&(d=d.concat(P(i.floating))),!m(i.reference)&&i.reference&&i.reference.contextElement&&(d=d.concat(P(i.reference.contextElement)))),d=d.filter((e=>{var t;return e!==(null==(t=f.defaultView)?void 0:t.visualViewport)})),d.forEach((e=>{e.addEventListener("scroll",t,{passive:!0})})),()=>{s&&(f.removeEventListener("keydown",N?j:W,N),f.removeEventListener("compositionstart",n),f.removeEventListener("compositionend",u)),R&&f.removeEventListener(a,F?I:B,F),d.forEach((e=>{e.removeEventListener("scroll",t)})),window.clearTimeout(e)}}),[l,i,s,R,a,r,o,g,c,k,D,W,N,j,B,F,I]),e.useEffect((()=>{L.current=!1}),[R,a]);const _=e.useMemo((()=>({onKeyDown:W,[nt[d]]:e=>{f&&o(!1,e.nativeEvent,"reference-press")}})),[W,o,f,d]),V=e.useMemo((()=>({onKeyDown:W,onMouseDown(){O.current=!0},onMouseUp(){O.current=!0},[rt[a]]:()=>{L.current=!0}})),[W,a]);return e.useMemo((()=>c?{reference:_,floating:V}:{}),[c,_,V])}(K),Y=function(t,n){void 0===n&&(n={});const{open:r,onOpenChange:o,dataRef:i,events:l,elements:c}=t,{enabled:s=!0,delay:u=0,handleClose:a=null,mouseOnly:f=!1,restMs:d=0,move:p=!0}=n,g=Ue(),v=qe(),h=Qe(a),y=Qe(u),w=Qe(r),x=e.useRef(),b=e.useRef(-1),E=e.useRef(),R=e.useRef(-1),C=e.useRef(!0),L=e.useRef(!1),P=e.useRef((()=>{})),O=e.useRef(!1),S=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,O.current=!1)}}),[s,l]),e.useEffect((()=>{if(!s)return;if(!h.current)return;if(!r)return;function e(e){S()&&o(!1,e,"hover")}const t=M(c.floating).documentElement;return t.addEventListener("mouseleave",e),()=>{t.removeEventListener("mouseleave",e)}}),[c.floating,r,o,s,h,S]);const A=e.useCallback((function(e,t,n){void 0===t&&(t=!0),void 0===n&&(n="hover");const r=Je(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=We((()=>{P.current(),E.current=void 0})),N=We((()=>{if(L.current){const e=M(c.floating).body;e.style.pointerEvents="",e.removeAttribute(Ge),L.current=!1}}));e.useEffect((()=>{if(s&&m(c.domReference)){var e;const t=c.domReference;return r&&t.addEventListener("mouseleave",u),null==(e=c.floating)||e.addEventListener("mouseleave",u),p&&t.addEventListener("mousemove",n,{once:!0}),t.addEventListener("mouseenter",n),t.addEventListener("mouseleave",l),()=>{var e;r&&t.removeEventListener("mouseleave",u),null==(e=c.floating)||e.removeEventListener("mouseleave",u),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&&!k(x.current)||d>0&&!Je(y.current,"open"))return;const t=Je(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;P.current();const n=M(c.floating);if(clearTimeout(R.current),O.current=!1,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(){N(),D(),A(e,!0,"safe-polygon")}});const t=E.current;return n.addEventListener("mousemove",t),void(P.current=()=>{n.removeEventListener("mousemove",t)})}("touch"!==x.current||!T(c.floating,e.relatedTarget))&&A(e)}function u(e){t()||i.current.floatingContext&&(null==h.current||h.current({...i.current.floatingContext,tree:g,x:e.clientX,y:e.clientY,onClose(){N(),D(),A(e)}})(e))}}),[c,s,t,f,d,p,A,D,N,o,r,w,g,y,h,i]),je((()=>{var e;if(s&&r&&null!=(e=h.current)&&e.__options.blockPointerEvents&&S()){L.current=!0;const e=c.floating;if(m(c.domReference)&&e){var t;const n=M(c.floating).body;n.setAttribute(Ge,"");const r=c.domReference,o=null==g||null==(t=g.nodesRef.current.find((e=>e.id===v)))||null==(t=t.context)?void 0:t.elements.floating;return o&&(o.style.pointerEvents=""),n.style.pointerEvents="none",r.style.pointerEvents="auto",e.style.pointerEvents="auto",()=>{n.style.pointerEvents="",r.style.pointerEvents="",e.style.pointerEvents=""}}}}),[s,r,v,c,g,h,S]),je((()=>{r||(x.current=void 0,O.current=!1,D(),N())}),[r,D,N]),e.useEffect((()=>()=>{D(),clearTimeout(b.current),clearTimeout(R.current),N()}),[s,c.domReference,D,N]);const F=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&&!k(x.current)||r||0===d||O.current&&e.movementX**2+e.movementY**2<2||(clearTimeout(R.current),"touch"===x.current?n():(O.current=!0,R.current=window.setTimeout(n,d)))}}}),[f,o,r,w,d]),H=e.useMemo((()=>({onMouseEnter(){clearTimeout(b.current)},onMouseLeave(e){A(e.nativeEvent,!1)}})),[A]);return e.useMemo((()=>s?{reference:F,floating:H}:{}),[s,F,H])}(K,{}),$=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=>ut(e,t,"reference")),n),l=e.useCallback((e=>ut(e,t,"floating")),r),c=e.useCallback((e=>ut(e,t,"item")),o);return e.useMemo((()=>({getReferenceProps:i,getFloatingProps:l,getItemProps:c})),[i,l,c])}([Y,z,X]),q=$.getReferenceProps,U=$.getFloatingProps;return t.createElement("span",null,t.createElement("span",c({className:"rad-ui-popper ".concat(F,"-reference-element ").concat(f),ref:_.setReference},q({onClick:function(){console.log("click")}})),v),j&&t.createElement("div",c({className:"".concat(F,"-floating-element"),ref:_.setFloating,style:V},U()),R&&t.createElement(Xe,{className:"rad-ui-arrow ".concat(F,"-arrow"),ref:H,context:K}),O))},dt=function(e){var n=e.list,r=void 0===n?[]:n;e.selected;return t.createElement("div",{className:"relative"},t.createElement(ft,{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{dt as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use client';import
|
|
1
|
+
'use client';import t from"react";var e=function(){return e=Object.assign||function(t){for(var e,a=1,r=arguments.length;a<r;a++)for(var o in e=arguments[a])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},e.apply(this,arguments)};"function"==typeof SuppressedError&&SuppressedError;var a=[{label:"H1",tag:"h1"},{label:"H2",tag:"h2"},{label:"H3",tag:"h3"},{label:"H4",tag:"h4"},{label:"H5",tag:"h5"},{label:"H6",tag:"h6"}],r=function(r){var o=r.children,n=r.as,c=void 0===n?void 0:n,l=r.customRootClass,i=void 0===l?"":l,s=r.className,u=void 0===s?"":s,p=function(t,e){var a={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(a[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(a[r[o]]=t[r[o]])}return a}(r,["children","as","customRootClass","className"]),f=function(t,e){void 0===t&&(t=""),void 0===e&&(e="");var a=e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();return t||(e?"".concat("rad-ui","-").concat(a):"")}(i,c||"h1");if(void 0!==c&&a.find((function(t){return t.tag===c}))){var d=a.find((function(t){return t.tag===c})).tag;return t.createElement(d,e({className:"".concat(f," ").concat(u)},p),o)}return t.createElement("h1",e({className:"".concat(f," ").concat(u)},p),o)};r.displayName="Heading";export{r as default};
|