@radui/ui 0.0.22 → 0.0.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Button.js +1 -1
- package/dist/components/Collapsible.js +1 -0
- package/dist/components/Dropdown.js +1 -1
- package/dist/components/Modal.js +2 -2
- package/dist/components/Toggle.js +1 -1
- package/dist/components/ToggleGroup.js +1 -1
- package/dist/components/Tooltip.js +1 -1
- package/dist/themes/default.css +1 -1
- package/dist/themes/default.css.map +1 -1
- package/package.json +12 -10
|
@@ -1 +1 @@
|
|
|
1
|
-
'use client';import
|
|
1
|
+
'use client';import e from"react";var t=function(){return t=Object.assign||function(e){for(var t,r=1,o=arguments.length;r<o;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},t.apply(this,arguments)};function r(e,t){var r={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(r[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(o=Object.getOwnPropertySymbols(e);a<o.length;a++)t.indexOf(o[a])<0&&Object.prototype.propertyIsEnumerable.call(e,o[a])&&(r[o[a]]=e[o[a]])}return r}"function"==typeof SuppressedError&&SuppressedError;var o=function(o){var a=o.role,n=void 0===a?"button":a,i=o.label,c=void 0===i?"":i,l=o.description,d=void 0===l?"":l,s=o.disabled,p=void 0!==s&&s,u=o.children,v=r(o,["role","label","description","disabled","children"]);return c&&(v["aria-label"]=c),d&&(v["aria-description"]=d),p&&(v["aria-disabled"]="true",d||(v["aria-description"]="Disabled Button")),e.createElement("button",t({role:n,disabled:p},v),u)},a="Button",n=function(n){var i=n.children,c=n.type,l=void 0===c?"button":c,d=n.customRootClass,s=void 0===d?"":d,p=n.className,u=void 0===p?"":p,v=n.color,b=n.variant,f=void 0===b?"solid":b,y=n.size,m=void 0===y?"medium":y,O=r(n,["children","type","customRootClass","className","color","variant","size"]),h=function(e,t){void 0===e&&(e=""),void 0===t&&(t="");var r=t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();return e||(t?"".concat("rad-ui","-").concat(r):"")}(s,a);return e.createElement(o,t({type:l,className:"".concat(h," button-").concat(f," ").concat(u," "),"data-accent-color":null!=v?v:void 0,"data-size":m},O),i)};n.displayName=a;export{n as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use client';import e,{useState as t}from"react";var r=function(){return r=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var l in t=arguments[r])Object.prototype.hasOwnProperty.call(t,l)&&(e[l]=t[l]);return e},r.apply(this,arguments)};function n(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var l=0;for(n=Object.getOwnPropertySymbols(e);l<n.length;l++)t.indexOf(n[l])<0&&Object.prototype.propertyIsEnumerable.call(e,n[l])&&(r[n[l]]=e[n[l]])}return r}"function"==typeof SuppressedError&&SuppressedError;var l=function(t){var l=t.role,o=void 0===l?"button":l,i=t.label,a=void 0===i?"":i,c=t.description,s=void 0===c?"":c,u=t.disabled,d=void 0!==u&&u,p=t.children,m=n(t,["role","label","description","disabled","children"]);return a&&(m["aria-label"]=a),s&&(m["aria-description"]=s),d&&(m["aria-disabled"]="true",s||(m["aria-description"]="Disabled Button")),e.createElement("button",r({role:o,disabled:d},m),p)},o=function(){return e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"size-6"},e.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 3.75v4.5m0-4.5h4.5m-4.5 0L9 9M3.75 20.25v-4.5m0 4.5h4.5m-4.5 0L9 15M20.25 3.75h-4.5m4.5 0v4.5m0-4.5L15 9m5.25 11.25h-4.5m4.5 0v-4.5m0 4.5L15 15"}))},i=function(){return e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"size-6"},e.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 9V4.5M9 9H4.5M9 9 3.75 3.75M9 15v4.5M9 15H4.5M9 15l-5.25 5.25M15 9h4.5M15 9V4.5M15 9l5.25-5.25M15 15h4.5M15 15v4.5m0-4.5 5.25 5.25"}))},a=function(r){var a,c,s=r.children,u=r.title,d=r.trigger,p=n(r,["children","title","trigger"]),m=t(null===(a=p.open)||void 0===a||a),v=m[0],f=m[1];return e.createElement("article",null,e.createElement("span",{style:{display:"flex",alignItems:"center"}},u&&e.createElement("p",null,u),d||e.createElement(l,{style:{marginInlineStart:"auto"},onClick:function(){return f((function(e){return!e}))}},v?e.createElement(i,null):e.createElement(o,null))),e.createElement("div",{"aria-hidden":!v,style:{overflow:"hidden",display:"flex",flexDirection:"column",height:(null!==(c=p.open)&&void 0!==c?c:v)?"auto":"0",transition:"all"}},s))};export{a 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=b(e);return"none"!==n.transform||"none"!==n.perspective||!!n.containerType&&"normal"!==n.containerType||!t&&!!n.backdropFilter&&"none"!==n.backdropFilter||!t&&!!n.filter&&"none"!==n.filter||["transform","perspective","filter"].some((e=>(n.willChange||"").includes(e)))||["paint","layout","strict","content"].some((e=>(n.contain||"").includes(e)))}function w(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function x(e){return["html","body","#document"].includes(s(e))}function b(e){return a(e).getComputedStyle(e)}function E(e){return d(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function R(e){if("html"===s(e))return e;const t=e.assignedSlot||e.parentNode||p(e)&&e.host||u(e);return p(t)?t.host:t}function C(e){const t=R(e);return x(t)?e.ownerDocument?e.ownerDocument.body:e.body:m(t)&&g(t)?t:C(t)}function P(e,t,n){var r;void 0===t&&(t=[]),void 0===n&&(n=!0);const o=C(e),i=o===(null==(r=e.ownerDocument)?void 0:r.body),l=a(o);return i?t.concat(l,l.visualViewport||[],g(o)?o:[],l.frameElement&&n?P(l.frameElement):[]):t.concat(o,P(o,[],n))}function L(e,t){if(!e||!t)return!1;const n=null==t.getRootNode?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&p(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function O(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}function k(e){return(null==e?void 0:e.ownerDocument)||document}function T(e,t){if(null==t)return!1;if("composedPath"in e)return e.composedPath().includes(t);const n=e;return null!=n.target&&t.contains(n.target)}function M(e){return"composedPath"in e?e.composedPath()[0]:e.target}const S=["top","right","bottom","left"],D=Math.min,A=Math.max,N=Math.round,F=Math.floor,H=e=>({x:e,y:e}),W={left:"right",right:"left",bottom:"top",top:"bottom"},I={start:"end",end:"start"};function B(e,t,n){return A(e,D(t,n))}function _(e,t){return"function"==typeof e?e(t):e}function j(e){return e.split("-")[0]}function V(e){return e.split("-")[1]}function K(e){return"x"===e?"y":"x"}function z(e){return"y"===e?"height":"width"}function X(e){return["top","bottom"].includes(j(e))?"y":"x"}function $(e){return K(X(e))}function Y(e){return e.replace(/start|end/g,(e=>I[e]))}function q(e){return e.replace(/left|right|bottom|top/g,(e=>W[e]))}function U(e){return"number"!=typeof e?function(e){return{top:0,right:0,bottom:0,left:0,...e}}(e):{top:e,right:e,bottom:e,left:e}}function Z(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function Q(e,t,n){let{reference:r,floating:o}=e;const i=X(t),l=$(t),c=z(l),s=j(t),a="y"===i,u=r.x+r.width/2-o.width/2,f=r.y+r.height/2-o.height/2,d=r[c]/2-o[c]/2;let m;switch(s){case"top":m={x:u,y:r.y-o.height};break;case"bottom":m={x:u,y:r.y+r.height};break;case"right":m={x:r.x+r.width,y:f};break;case"left":m={x:r.x-o.width,y:f};break;default:m={x:r.x,y:r.y}}switch(V(t)){case"start":m[l]-=d*(n&&a?-1:1);break;case"end":m[l]+=d*(n&&a?-1:1)}return m}async function G(e,t){var n;void 0===t&&(t={});const{x:r,y:o,platform:i,rects:l,elements:c,strategy:s}=e,{boundary:a="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:d=!1,padding:m=0}=_(t,e),p=U(m),g=c[d?"floating"===f?"reference":"floating":f],v=Z(await i.getClippingRect({element:null==(n=await(null==i.isElement?void 0:i.isElement(g)))||n?g:g.contextElement||await(null==i.getDocumentElement?void 0:i.getDocumentElement(c.floating)),boundary:a,rootBoundary:u,strategy:s})),h="floating"===f?{x:r,y:o,width:l.floating.width,height:l.floating.height}:l.reference,y=await(null==i.getOffsetParent?void 0:i.getOffsetParent(c.floating)),w=await(null==i.isElement?void 0:i.isElement(y))&&await(null==i.getScale?void 0:i.getScale(y))||{x:1,y:1},x=Z(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:h,offsetParent:y,strategy:s}):h);return{top:(v.top-x.top+p.top)/w.y,bottom:(x.bottom-v.bottom+p.bottom)/w.y,left:(v.left-x.left+p.left)/w.x,right:(x.right-v.right+p.right)/w.x}}function J(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function ee(e){return S.some((t=>e[t]>=0))}function te(e){const t=b(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=m(e),i=o?e.offsetWidth:n,l=o?e.offsetHeight:r,c=N(n)!==i||N(r)!==l;return c&&(n=i,r=l),{width:n,height:r,$:c}}function ne(e){return d(e)?e:e.contextElement}function re(e){const t=ne(e);if(!m(t))return H(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=te(t);let l=(i?N(n.width):n.width)/r,c=(i?N(n.height):n.height)/o;return l&&Number.isFinite(l)||(l=1),c&&Number.isFinite(c)||(c=1),{x:l,y:c}}const oe=H(0);function ie(e){const t=a(e);return w()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:oe}function le(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);const o=e.getBoundingClientRect(),i=ne(e);let l=H(1);t&&(r?d(r)&&(l=re(r)):l=re(e));const c=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==a(e))&&t}(i,n,r)?ie(i):H(0);let s=(o.left+c.x)/l.x,u=(o.top+c.y)/l.y,f=o.width/l.x,m=o.height/l.y;if(i){const e=a(i),t=r&&d(r)?a(r):r;let n=e,o=n.frameElement;for(;o&&r&&t!==n;){const e=re(o),t=o.getBoundingClientRect(),r=b(o),i=t.left+(o.clientLeft+parseFloat(r.paddingLeft))*e.x,l=t.top+(o.clientTop+parseFloat(r.paddingTop))*e.y;s*=e.x,u*=e.y,f*=e.x,m*=e.y,s+=i,u+=l,n=a(o),o=n.frameElement}}return Z({width:f,height:m,x:s,y:u})}function ce(e){return le(u(e)).left+E(e).scrollLeft}function se(e,t,n){let r;if("viewport"===t)r=function(e,t){const n=a(e),r=u(e),o=n.visualViewport;let i=r.clientWidth,l=r.clientHeight,c=0,s=0;if(o){i=o.width,l=o.height;const e=w();(!e||e&&"fixed"===t)&&(c=o.offsetLeft,s=o.offsetTop)}return{width:i,height:l,x:c,y:s}}(e,n);else if("document"===t)r=function(e){const t=u(e),n=E(e),r=e.ownerDocument.body,o=A(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=A(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let l=-n.scrollLeft+ce(e);const c=-n.scrollTop;return"rtl"===b(r).direction&&(l+=A(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:l,y:c}}(u(e));else if(d(t))r=function(e,t){const n=le(e,!0,"fixed"===t),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=m(e)?re(e):H(1);return{width:e.clientWidth*i.x,height:e.clientHeight*i.y,x:o*i.x,y:r*i.y}}(t,n);else{const n=ie(e);r={...t,x:t.x-n.x,y:t.y-n.y}}return Z(r)}function ae(e,t){const n=R(e);return!(n===t||!d(n)||x(n))&&("fixed"===b(n).position||ae(n,t))}function ue(e,t,n){const r=m(t),o=u(t),i="fixed"===n,l=le(e,!0,i,t);let c={scrollLeft:0,scrollTop:0};const a=H(0);if(r||!r&&!i)if(("body"!==s(t)||g(o))&&(c=E(t)),r){const e=le(t,!0,i,t);a.x=e.x+t.clientLeft,a.y=e.y+t.clientTop}else o&&(a.x=ce(o));return{x:l.left+c.scrollLeft-a.x,y:l.top+c.scrollTop-a.y,width:l.width,height:l.height}}function fe(e){return"static"===b(e).position}function de(e,t){return m(e)&&"fixed"!==b(e).position?t?t(e):e.offsetParent:null}function me(e,t){const n=a(e);if(h(e))return n;if(!m(e)){let t=R(e);for(;t&&!x(t);){if(d(t)&&!fe(t))return t;t=R(t)}return n}let r=de(e,t);for(;r&&v(r)&&fe(r);)r=de(r,t);return r&&x(r)&&fe(r)&&!y(r)?n:r||function(e){let t=R(e);for(;m(t)&&!x(t);){if(h(t))return null;if(y(t))return t;t=R(t)}return null}(e)||n}const pe={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i="fixed"===o,l=u(r),c=!!t&&h(t.floating);if(r===l||c&&i)return n;let a={scrollLeft:0,scrollTop:0},f=H(1);const d=H(0),p=m(r);if((p||!p&&!i)&&(("body"!==s(r)||g(l))&&(a=E(r)),m(r))){const e=le(r);f=re(r),d.x=e.x+r.clientLeft,d.y=e.y+r.clientTop}return{width:n.width*f.x,height:n.height*f.y,x:n.x*f.x-a.scrollLeft*f.x+d.x,y:n.y*f.y-a.scrollTop*f.y+d.y}},getDocumentElement:u,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[..."clippingAncestors"===n?h(t)?[]:function(e,t){const n=t.get(e);if(n)return n;let r=P(e,[],!1).filter((e=>d(e)&&"body"!==s(e))),o=null;const i="fixed"===b(e).position;let l=i?R(e):e;for(;d(l)&&!x(l);){const t=b(l),n=y(l);n||"fixed"!==t.position||(o=null),(i?!n&&!o:!n&&"static"===t.position&&o&&["absolute","fixed"].includes(o.position)||g(l)&&!n&&ae(e,l))?r=r.filter((e=>e!==l)):o=t,l=R(l)}return t.set(e,r),r}(t,this._c):[].concat(n),r],l=i[0],c=i.reduce(((e,n)=>{const r=se(t,n,o);return e.top=A(r.top,e.top),e.right=D(r.right,e.right),e.bottom=D(r.bottom,e.bottom),e.left=A(r.left,e.left),e}),se(t,l,o));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}},getOffsetParent:me,getElementRects:async function(e){const t=this.getOffsetParent||me,n=this.getDimensions,r=await n(e.floating);return{reference:ue(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){const{width:t,height:n}=te(e);return{width:t,height:n}},getScale:re,isElement:d,isRTL:function(e){return"rtl"===b(e).direction}};function ge(e,t,n,r){void 0===r&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:l="function"==typeof ResizeObserver,layoutShift:c="function"==typeof IntersectionObserver,animationFrame:s=!1}=r,a=ne(e),f=o||i?[...a?P(a):[],...P(t)]:[];f.forEach((e=>{o&&e.addEventListener("scroll",n,{passive:!0}),i&&e.addEventListener("resize",n)}));const d=a&&c?function(e,t){let n,r=null;const o=u(e);function i(){var e;clearTimeout(n),null==(e=r)||e.disconnect(),r=null}return function l(c,s){void 0===c&&(c=!1),void 0===s&&(s=1),i();const{left:a,top:u,width:f,height:d}=e.getBoundingClientRect();if(c||t(),!f||!d)return;const m={rootMargin:-F(u)+"px "+-F(o.clientWidth-(a+f))+"px "+-F(o.clientHeight-(u+d))+"px "+-F(a)+"px",threshold:A(0,D(1,s))||1};let p=!0;function g(e){const t=e[0].intersectionRatio;if(t!==s){if(!p)return l();t?l(!1,t):n=setTimeout((()=>{l(!1,1e-7)}),1e3)}p=!1}try{r=new IntersectionObserver(g,{...m,root:o.ownerDocument})}catch(e){r=new IntersectionObserver(g,m)}r.observe(e)}(!0),i}(a,n):null;let m,p=-1,g=null;l&&(g=new ResizeObserver((e=>{let[r]=e;r&&r.target===a&&g&&(g.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame((()=>{var e;null==(e=g)||e.observe(t)}))),n()})),a&&!s&&g.observe(a),g.observe(t));let v=s?le(e):null;return s&&function t(){const r=le(e);!v||r.x===v.x&&r.y===v.y&&r.width===v.width&&r.height===v.height||n();v=r,m=requestAnimationFrame(t)}(),n(),()=>{var e;f.forEach((e=>{o&&e.removeEventListener("scroll",n),i&&e.removeEventListener("resize",n)})),null==d||d(),null==(e=g)||e.disconnect(),g=null,s&&cancelAnimationFrame(m)}}const ve=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:l,middlewareData:c}=t,s=await async function(e,t){const{placement:n,platform:r,elements:o}=e,i=await(null==r.isRTL?void 0:r.isRTL(o.floating)),l=j(n),c=V(n),s="y"===X(n),a=["left","top"].includes(l)?-1:1,u=i&&s?-1:1,f=_(t,e);let{mainAxis:d,crossAxis:m,alignmentAxis:p}="number"==typeof f?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...f};return c&&"number"==typeof p&&(m="end"===c?-1*p:p),s?{x:m*u,y:d*a}:{x:d*a,y:m*u}}(t,e);return l===(null==(n=c.offset)?void 0:n.placement)&&null!=(r=c.arrow)&&r.alignmentOffset?{}:{x:o+s.x,y:i+s.y,data:{...s,placement:l}}}}},he=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:i=!0,crossAxis:l=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...s}=_(e,t),a={x:n,y:r},u=await G(t,s),f=X(j(o)),d=K(f);let m=a[d],p=a[f];if(i){const e="y"===d?"bottom":"right";m=B(m+u["y"===d?"top":"left"],m,m-u[e])}if(l){const e="y"===f?"bottom":"right";p=B(p+u["y"===f?"top":"left"],p,p-u[e])}const g=c.fn({...t,[d]:m,[f]:p});return{...g,data:{x:g.x-n,y:g.y-r}}}}},ye=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:l,initialPlacement:c,platform:s,elements:a}=t,{mainAxis:u=!0,crossAxis:f=!0,fallbackPlacements:d,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:g=!0,...v}=_(e,t);if(null!=(n=i.arrow)&&n.alignmentOffset)return{};const h=j(o),y=X(c),w=j(c)===c,x=await(null==s.isRTL?void 0:s.isRTL(a.floating)),b=d||(w||!g?[q(c)]:function(e){const t=q(e);return[Y(e),t,Y(t)]}(c)),E="none"!==p;!d&&E&&b.push(...function(e,t,n,r){const o=V(e);let i=function(e,t,n){const r=["left","right"],o=["right","left"],i=["top","bottom"],l=["bottom","top"];switch(e){case"top":case"bottom":return n?t?o:r:t?r:o;case"left":case"right":return t?i:l;default:return[]}}(j(e),"start"===n,r);return o&&(i=i.map((e=>e+"-"+o)),t&&(i=i.concat(i.map(Y)))),i}(c,g,p,x));const R=[c,...b],C=await G(t,v),P=[];let L=(null==(r=i.flip)?void 0:r.overflows)||[];if(u&&P.push(C[h]),f){const e=function(e,t,n){void 0===n&&(n=!1);const r=V(e),o=$(e),i=z(o);let l="x"===o?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[i]>t.floating[i]&&(l=q(l)),[l,q(l)]}(o,l,x);P.push(C[e[0]],C[e[1]])}if(L=[...L,{placement:o,overflows:P}],!P.every((e=>e<=0))){var O,k;const e=((null==(O=i.flip)?void 0:O.index)||0)+1,t=R[e];if(t)return{data:{index:e,overflows:L},reset:{placement:t}};let n=null==(k=L.filter((e=>e.overflows[0]<=0)).sort(((e,t)=>e.overflows[1]-t.overflows[1]))[0])?void 0:k.placement;if(!n)switch(m){case"bestFit":{var T;const e=null==(T=L.filter((e=>{if(E){const t=X(e.placement);return t===y||"y"===t}return!0})).map((e=>[e.placement,e.overflows.filter((e=>e>0)).reduce(((e,t)=>e+t),0)])).sort(((e,t)=>e[1]-t[1]))[0])?void 0:T[0];e&&(n=e);break}case"initialPlacement":n=c}if(o!==n)return{reset:{placement:n}}}return{}}}},we=function(e){return void 0===e&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...o}=_(e,t);switch(r){case"referenceHidden":{const e=J(await G(t,{...o,elementContext:"reference"}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:ee(e)}}}case"escaped":{const e=J(await G(t,{...o,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:ee(e)}}}default:return{}}}}},xe=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:i,platform:l,elements:c,middlewareData:s}=t,{element:a,padding:u=0}=_(e,t)||{};if(null==a)return{};const f=U(u),d={x:n,y:r},m=$(o),p=z(m),g=await l.getDimensions(a),v="y"===m,h=v?"top":"left",y=v?"bottom":"right",w=v?"clientHeight":"clientWidth",x=i.reference[p]+i.reference[m]-d[m]-i.floating[p],b=d[m]-i.reference[m],E=await(null==l.getOffsetParent?void 0:l.getOffsetParent(a));let R=E?E[w]:0;R&&await(null==l.isElement?void 0:l.isElement(E))||(R=c.floating[w]||i.floating[p]);const C=x/2-b/2,P=R/2-g[p]/2-1,L=D(f[h],P),O=D(f[y],P),k=L,T=R-g[p]-O,M=R/2-g[p]/2+C,S=B(k,M,T),A=!s.arrow&&null!=V(o)&&M!==S&&i.reference[p]/2-(M<k?L:O)-g[p]/2<0,N=A?M<k?M-k:M-T:0;return{[m]:d[m]+N,data:{[m]:S,centerOffset:M-S-N,...A&&{alignmentOffset:N}},reset:A}}}),be=(e,t,n)=>{const r=new Map,o={platform:pe,...n},i={...o.platform,_c:r};return(async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:l}=n,c=i.filter(Boolean),s=await(null==l.isRTL?void 0:l.isRTL(t));let a=await l.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:f}=Q(a,r,s),d=r,m={},p=0;for(let n=0;n<c.length;n++){const{name:i,fn:g}=c[n],{x:v,y:h,data:y,reset:w}=await g({x:u,y:f,initialPlacement:r,placement:d,strategy:o,middlewareData:m,rects:a,platform:l,elements:{reference:e,floating:t}});u=null!=v?v:u,f=null!=h?h:f,m={...m,[i]:{...m[i],...y}},w&&p<=50&&(p++,"object"==typeof w&&(w.placement&&(d=w.placement),w.rects&&(a=!0===w.rects?await l.getElementRects({reference:e,floating:t,strategy:o}):w.rects),({x:u,y:f}=Q(a,d,s))),n=-1)}return{x:u,y:f,placement:d,strategy:o,middlewareData:m}})(e,t,{...o,platform:i})};var Ee="undefined"!=typeof document?n:r;function Re(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;0!=r--;)if(!Re(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;0!=r--;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;0!=r--;){const n=o[r];if(("_owner"!==n||!e.$$typeof)&&!Re(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function Ce(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Pe(e,t){const n=Ce(e);return Math.round(t*n)/n}function Le(t){const n=e.useRef(t);return Ee((()=>{n.current=t})),n}const Oe=e=>({name:"arrow",options:e,fn(t){const{element:n,padding:r}="function"==typeof e?e(t):e;return n&&(o=n,{}.hasOwnProperty.call(o,"current"))?null!=n.current?xe({element:n.current,padding:r}).fn(t):{}:n?xe({element:n,padding:r}).fn(t):{};var o}}),ke=(e,t)=>({...ve(e),options:[e,t]}),Te=(e,t)=>({...he(e),options:[e,t]}),Me=(e,t)=>({...ye(e),options:[e,t]}),Se=(e,t)=>({...we(e),options:[e,t]}),De={...e},Ae=De.useInsertionEffect||(e=>e());function Ne(t){const n=e.useRef((()=>{if("production"!==process.env.NODE_ENV)throw new Error("Cannot call an event handler while rendering.")}));return Ae((()=>{n.current=t})),e.useCallback((function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return null==n.current?void 0:n.current(...t)}),[])}var Fe="undefined"!=typeof document?n:r;function He(){return He=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},He.apply(this,arguments)}let We=!1,Ie=0;const Be=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+Ie++;const _e=De.useId||function(){const[t,n]=e.useState((()=>We?Be():void 0));return Fe((()=>{null==t&&n(Be())}),[]),e.useEffect((()=>{We=!0}),[]),t};let je;"production"!==process.env.NODE_ENV&&(je=new Set);const Ve=e.forwardRef((function(t,n){const{context:{placement:r,elements:{floating:o},middlewareData:{arrow:i}},width:l=14,height:c=7,tipRadius:s=0,strokeWidth:a=0,staticOffset:u,stroke:f,d:d,style:{transform:m,...p}={},...g}=t;"production"!==process.env.NODE_ENV&&(n||function(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];const o="Floating UI: "+n.join(" ");var i;null!=(e=je)&&e.has(o)||(null==(i=je)||i.add(o),console.warn(o))}("The `ref` prop is required for `FloatingArrow`."));const v=_e(),[h,y]=e.useState(!1);if(Fe((()=>{if(!o)return;"rtl"===b(o).direction&&y(!0)}),[o]),!o)return null;const w=2*a,x=w/2,E=l/2*(s/-8+1),R=c/2*s/4,[C,P]=r.split("-"),L=!!d,O="top"===C||"bottom"===C,k=u&&"end"===P?"bottom":"top";let T=u&&"end"===P?"right":"left";u&&h&&(T="end"===P?"left":"right");const M=null!=(null==i?void 0:i.x)?u||i.x:"",S=null!=(null==i?void 0:i.y)?u||i.y:"",D=d||"M0,0 H"+l+" L"+(l-E)+","+(c-R)+" Q"+l/2+","+c+" "+E+","+(c-R)+" Z",A={top:L?"rotate(180deg)":"",left:L?"rotate(90deg)":"rotate(-90deg)",bottom:L?"":"rotate(180deg)",right:L?"rotate(-90deg)":"rotate(90deg)"}[C];return e.createElement("svg",He({},g,{"aria-hidden":!0,ref:n,width:L?l:l+w,height:l,viewBox:"0 0 "+l+" "+(c>l?c:l),style:{position:"absolute",pointerEvents:"none",[T]:M,[k]:S,[C]:O||L?"100%":"calc(100% - "+w/2+"px)",transform:""+A+(null!=m?m:""),...p}}),w>0&&e.createElement("path",{clipPath:"url(#"+v+")",fill:"none",stroke:f,strokeWidth:w+(d?0:1),d:D}),e.createElement("path",{stroke:w&&!d?g.fill:"none",d:D}),e.createElement("clipPath",{id:v},e.createElement("rect",{x:-x,y:x*(L?-1:1),width:l+w,height:l})))}));const Ke=e.createContext(null),ze=e.createContext(null),Xe=()=>{var t;return(null==(t=e.useContext(Ke))?void 0:t.id)||null},$e=()=>e.useContext(ze);function Ye(e){return"data-floating-ui-"+e}function qe(e){const t=o(e);return Fe((()=>{t.current=e})),t}const Ue=Ye("safe-polygon");function Ze(e,t,n){return n&&!O(n)?0:"number"==typeof e?e:null==e?void 0:e[t]}function Qe(e,t){let n=e.filter((e=>{var n;return e.parentId===t&&(null==(n=e.context)?void 0:n.open)})),r=n;for(;r.length;)r=e.filter((e=>{var t;return null==(t=r)?void 0:t.some((t=>{var n;return e.parentId===t.id&&(null==(n=e.context)?void 0:n.open)}))})),n=n.concat(r);return n}const Ge={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},Je={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},et=e=>{var t,n;return{escapeKey:"boolean"==typeof e?e:null!=(t=null==e?void 0:e.escapeKey)&&t,outsidePress:"boolean"==typeof e?e:null==(n=null==e?void 0:e.outsidePress)||n}};function tt(t){const{open:n=!1,onOpenChange:r,elements:o}=t,i=_e(),l=e.useRef({}),[c]=e.useState((()=>function(){const e=new Map;return{emit(t,n){var r;null==(r=e.get(t))||r.forEach((e=>e(n)))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){var r;e.set(t,(null==(r=e.get(t))?void 0:r.filter((e=>e!==n)))||[])}}}())),s=null!=Xe();if("production"!==process.env.NODE_ENV){const e=o.reference;e&&!d(e)&&function(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];const o="Floating UI: "+n.join(" ");var i;null!=(e=je)&&e.has(o)||(null==(i=je)||i.add(o),console.error(o))}("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `refs.setPositionReference()`","instead.")}const[a,u]=e.useState(o.reference),f=Ne(((e,t,n)=>{l.current.openEvent=e?t:void 0,c.emit("openchange",{open:e,event:t,reason:n,nested:s}),null==r||r(e,t,n)})),m=e.useMemo((()=>({setPositionReference:u})),[]),p=e.useMemo((()=>({reference:a||o.reference||null,floating:o.floating||null,domReference:o.reference})),[a,o.reference,o.floating]);return e.useMemo((()=>({dataRef:l,open:n,onOpenChange:f,elements:p,events:c,floatingId:i,refs:m})),[n,f,p,c,i,m])}function nt(t){void 0===t&&(t={});const{nodeId:n}=t,r=tt({...t,elements:{reference:null,floating:null,...t.elements}}),o=t.rootContext||r,i=o.elements,[c,s]=e.useState(null),[a,u]=e.useState(null),f=(null==i?void 0:i.reference)||c,m=e.useRef(null),p=$e();Fe((()=>{f&&(m.current=f)}),[f]);const g=function(t){void 0===t&&(t={});const{placement:n="bottom",strategy:r="absolute",middleware:o=[],platform:i,elements:{reference:c,floating:s}={},transform:a=!0,whileElementsMounted:u,open:f}=t,[d,m]=e.useState({x:0,y:0,strategy:r,placement:n,middlewareData:{},isPositioned:!1}),[p,g]=e.useState(o);Re(p,o)||g(o);const[v,h]=e.useState(null),[y,w]=e.useState(null),x=e.useCallback((e=>{e!==C.current&&(C.current=e,h(e))}),[]),b=e.useCallback((e=>{e!==P.current&&(P.current=e,w(e))}),[]),E=c||v,R=s||y,C=e.useRef(null),P=e.useRef(null),L=e.useRef(d),O=null!=u,k=Le(u),T=Le(i),M=e.useCallback((()=>{if(!C.current||!P.current)return;const e={placement:n,strategy:r,middleware:p};T.current&&(e.platform=T.current),be(C.current,P.current,e).then((e=>{const t={...e,isPositioned:!0};S.current&&!Re(L.current,t)&&(L.current=t,l.flushSync((()=>{m(t)})))}))}),[p,n,r,T]);Ee((()=>{!1===f&&L.current.isPositioned&&(L.current.isPositioned=!1,m((e=>({...e,isPositioned:!1}))))}),[f]);const S=e.useRef(!1);Ee((()=>(S.current=!0,()=>{S.current=!1})),[]),Ee((()=>{if(E&&(C.current=E),R&&(P.current=R),E&&R){if(k.current)return k.current(E,R,M);M()}}),[E,R,M,k,O]);const D=e.useMemo((()=>({reference:C,floating:P,setReference:x,setFloating:b})),[x,b]),A=e.useMemo((()=>({reference:E,floating:R})),[E,R]),N=e.useMemo((()=>{const e={position:r,left:0,top:0};if(!A.floating)return e;const t=Pe(A.floating,d.x),n=Pe(A.floating,d.y);return a?{...e,transform:"translate("+t+"px, "+n+"px)",...Ce(A.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:t,top:n}}),[r,a,A.floating,d.x,d.y]);return e.useMemo((()=>({...d,update:M,refs:D,elements:A,floatingStyles:N})),[d,M,D,A,N])}({...t,elements:{...i,...a&&{reference:a}}}),v=e.useCallback((e=>{const t=d(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:e}:e;u(t),g.refs.setReference(t)}),[g.refs]),h=e.useCallback((e=>{(d(e)||null===e)&&(m.current=e,s(e)),(d(g.refs.reference.current)||null===g.refs.reference.current||null!==e&&!d(e))&&g.refs.setReference(e)}),[g.refs]),y=e.useMemo((()=>({...g.refs,setReference:h,setPositionReference:v,domReference:m})),[g.refs,h,v]),w=e.useMemo((()=>({...g.elements,domReference:f})),[g.elements,f]),x=e.useMemo((()=>({...g,...o,refs:y,elements:w,nodeId:n})),[g,y,w,n,o]);return Fe((()=>{o.dataRef.current.floatingContext=x;const e=null==p?void 0:p.nodesRef.current.find((e=>e.id===n));e&&(e.context=x)})),e.useMemo((()=>({...g,context:x,refs:y,elements:w})),[g,y,w,x])}const rt="active",ot="selected";function it(e,t,n){const r=new Map,o="item"===n;let i=e;if(o&&e){const{[rt]:t,[ot]:n,...r}=e;i=r}return{..."floating"===n&&{tabIndex:-1},...i,...t.map((t=>{const r=t?t[n]:null;return"function"==typeof r?e?r(e):null:r})).concat(e).reduce(((e,t)=>t?(Object.entries(t).forEach((t=>{let[n,i]=t;var l;o&&[rt,ot].includes(n)||(0===n.indexOf("on")?(r.has(n)||r.set(n,[]),"function"==typeof i&&(null==(l=r.get(n))||l.push(i),e[n]=function(){for(var e,t=arguments.length,o=new Array(t),i=0;i<t;i++)o[i]=arguments[i];return null==(e=r.get(n))?void 0:e.map((e=>e(...o))).find((e=>void 0!==e))})):e[n]=i)})),e):e),{})}}const lt=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);var ct=function(n){var r=n.popperName,l=void 0===r?"":r,s=n.customRootClass,a=void 0===s?"":s;n.activationStrategy;var u=n.className,f=void 0===u?"":u,p=n.placement,g=void 0===p?"top":p,v=n.children,h=n.open,y=void 0!==h&&h;n.hoverDelay;var w=n.showArrow,E=void 0===w||w,C=n.pop,S=void 0===C?t.createElement(t.Fragment,null):C;!function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}}(n,["popperName","customRootClass","activationStrategy","className","placement","children","open","hoverDelay","showArrow","pop"]);var D,A,N=function(e,t){void 0===e&&(e=""),void 0===t&&(t="");var n=t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();return e||(t?"".concat("rad-ui","-").concat(n):"")}(a,l),F=o(null),H=i(y),W=H[0],I=H[1],B=nt({placement:g,whileElementsMounted:ge,open:W,middleware:[(D={element:F},{...Oe(D),options:[D,A]}),ke(9),Me({mainAxis:!0,fallbackStrategy:"initialPlacement"}),Te({crossAxis:!1}),Se({strategy:"referenceHidden"})],onOpenChange:I}),_=B.refs,j=B.floatingStyles,V=B.context,K=function(t,n){var r;void 0===n&&(n={});const{open:o,floatingId:i}=t,{enabled:l=!0,role:c="dialog"}=n,s=null!=(r=lt.get(c))?r:c,a=_e(),u=null!=Xe(),f=e.useMemo((()=>"tooltip"===s||"label"===c?{["aria-"+("label"===c?"labelledby":"describedby")]:o?i:void 0}:{"aria-expanded":o?"true":"false","aria-haspopup":"alertdialog"===s?"dialog":s,"aria-controls":o?i:void 0,..."listbox"===s&&{role:"combobox"},..."menu"===s&&{id:a},..."menu"===s&&u&&{role:"menuitem"},..."select"===c&&{"aria-autocomplete":"none"},..."combobox"===c&&{"aria-autocomplete":"list"}}),[s,i,u,o,a,c]),d=e.useMemo((()=>{const e={id:i,...s&&{role:s}};return"tooltip"===s||"label"===c?e:{...e,..."menu"===s&&{"aria-labelledby":a}}}),[s,i,a,c]),m=e.useCallback((e=>{let{active:t,selected:n}=e;const r={role:"option",...t&&{id:i+"-option"}};switch(c){case"select":return{...r,"aria-selected":t&&n};case"combobox":return{...r,...t&&{"aria-selected":!0}}}return{}}),[i,c]);return e.useMemo((()=>l?{reference:f,floating:d,item:m}:{}),[l,f,d,m])}(V),z=function(t,n){void 0===n&&(n={});const{open:r,onOpenChange:o,elements:i,dataRef:l}=t,{enabled:c=!0,escapeKey:s=!0,outsidePress:a=!0,outsidePressEvent:u="pointerdown",referencePress:f=!1,referencePressEvent:p="pointerdown",ancestorScroll:g=!1,bubbles:v,capture:h}=n,y=$e(),w=Ne("function"==typeof a?a:()=>!1),E="function"==typeof a?w:a,C=e.useRef(!1),O=e.useRef(!1),{escapeKey:S,outsidePress:D}=et(v),{escapeKey:A,outsidePress:N}=et(h),F=Ne((e=>{var t;if(!r||!c||!s||"Escape"!==e.key)return;const n=null==(t=l.current.floatingContext)?void 0:t.nodeId,i=y?Qe(y.nodesRef.current,n):[];if(!S&&(e.stopPropagation(),i.length>0)){let e=!0;if(i.forEach((t=>{var n;null==(n=t.context)||!n.open||t.context.dataRef.current.__escapeKeyBubbles||(e=!1)})),!e)return}o(!1,function(e){return"nativeEvent"in e}(e)?e.nativeEvent:e,"escape-key")})),H=Ne((e=>{var t;const n=()=>{var t;F(e),null==(t=M(e))||t.removeEventListener("keydown",n)};null==(t=M(e))||t.addEventListener("keydown",n)})),W=Ne((e=>{var t;const n=C.current;C.current=!1;const r=O.current;if(O.current=!1,"click"===u&&r)return;if(n)return;if("function"==typeof E&&!E(e))return;const c=M(e),s="["+Ye("inert")+"]",a=k(i.floating).querySelectorAll(s);let f=d(c)?c:null;for(;f&&!x(f);){const e=R(f);if(x(e)||!d(e))break;f=e}if(a.length&&d(c)&&!c.matches("html,body")&&!L(c,i.floating)&&Array.from(a).every((e=>!L(f,e))))return;if(m(c)&&_){const t=c.clientWidth>0&&c.scrollWidth>c.clientWidth,n=c.clientHeight>0&&c.scrollHeight>c.clientHeight;let r=n&&e.offsetX>c.clientWidth;if(n&&"rtl"===b(c).direction&&(r=e.offsetX<=c.offsetWidth-c.clientWidth),r||t&&e.offsetY>c.clientHeight)return}const p=null==(t=l.current.floatingContext)?void 0:t.nodeId,g=y&&Qe(y.nodesRef.current,p).some((t=>{var n;return T(e,null==(n=t.context)?void 0:n.elements.floating)}));if(T(e,i.floating)||T(e,i.domReference)||g)return;const v=y?Qe(y.nodesRef.current,p):[];if(v.length>0){let e=!0;if(v.forEach((t=>{var n;null==(n=t.context)||!n.open||t.context.dataRef.current.__outsidePressBubbles||(e=!1)})),!e)return}o(!1,e,"outside-press")})),I=Ne((e=>{var t;const n=()=>{var t;W(e),null==(t=M(e))||t.removeEventListener(u,n)};null==(t=M(e))||t.addEventListener(u,n)}));e.useEffect((()=>{if(!r||!c)return;function e(e){o(!1,e,"ancestor-scroll")}l.current.__escapeKeyBubbles=S,l.current.__outsidePressBubbles=D;const t=k(i.floating);s&&t.addEventListener("keydown",A?H:F,A),E&&t.addEventListener(u,N?I:W,N);let n=[];return g&&(d(i.domReference)&&(n=P(i.domReference)),d(i.floating)&&(n=n.concat(P(i.floating))),!d(i.reference)&&i.reference&&i.reference.contextElement&&(n=n.concat(P(i.reference.contextElement)))),n=n.filter((e=>{var n;return e!==(null==(n=t.defaultView)?void 0:n.visualViewport)})),n.forEach((t=>{t.addEventListener("scroll",e,{passive:!0})})),()=>{s&&t.removeEventListener("keydown",A?H:F,A),E&&t.removeEventListener(u,N?I:W,N),n.forEach((t=>{t.removeEventListener("scroll",e)}))}}),[l,i,s,E,u,r,o,g,c,S,D,F,A,H,W,N,I]),e.useEffect((()=>{C.current=!1}),[E,u]);const B=e.useMemo((()=>({onKeyDown:F,[Ge[p]]:e=>{f&&o(!1,e.nativeEvent,"reference-press")}})),[F,o,f,p]),_=e.useMemo((()=>({onKeyDown:F,onMouseDown(){O.current=!0},onMouseUp(){O.current=!0},[Je[u]]:()=>{C.current=!0}})),[F,u]);return e.useMemo((()=>c?{reference:B,floating:_}:{}),[c,B,_])}(V),X=function(t,n){void 0===n&&(n={});const{open:r,onOpenChange:o,dataRef:i,events:l,elements:c}=t,{enabled:s=!0,delay:a=0,handleClose:u=null,mouseOnly:f=!1,restMs:m=0,move:p=!0}=n,g=$e(),v=Xe(),h=qe(u),y=qe(a),w=qe(r),x=e.useRef(),b=e.useRef(-1),E=e.useRef(),R=e.useRef(-1),C=e.useRef(!0),P=e.useRef(!1),T=e.useRef((()=>{})),M=e.useCallback((()=>{var e;const t=null==(e=i.current.openEvent)?void 0:e.type;return(null==t?void 0:t.includes("mouse"))&&"mousedown"!==t}),[i]);e.useEffect((()=>{if(s)return l.on("openchange",e),()=>{l.off("openchange",e)};function e(e){let{open:t}=e;t||(clearTimeout(b.current),clearTimeout(R.current),C.current=!0)}}),[s,l]),e.useEffect((()=>{if(!s)return;if(!h.current)return;if(!r)return;function e(e){M()&&o(!1,e,"hover")}const t=k(c.floating).documentElement;return t.addEventListener("mouseleave",e),()=>{t.removeEventListener("mouseleave",e)}}),[c.floating,r,o,s,h,M]);const S=e.useCallback((function(e,t,n){void 0===t&&(t=!0),void 0===n&&(n="hover");const r=Ze(y.current,"close",x.current);r&&!E.current?(clearTimeout(b.current),b.current=window.setTimeout((()=>o(!1,e,n)),r)):t&&(clearTimeout(b.current),o(!1,e,n))}),[y,o]),D=Ne((()=>{T.current(),E.current=void 0})),A=Ne((()=>{if(P.current){const e=k(c.floating).body;e.style.pointerEvents="",e.removeAttribute(Ue),P.current=!1}}));e.useEffect((()=>{if(s&&d(c.domReference)){var e;const t=c.domReference;return r&&t.addEventListener("mouseleave",a),null==(e=c.floating)||e.addEventListener("mouseleave",a),p&&t.addEventListener("mousemove",n,{once:!0}),t.addEventListener("mouseenter",n),t.addEventListener("mouseleave",l),()=>{var e;r&&t.removeEventListener("mouseleave",a),null==(e=c.floating)||e.removeEventListener("mouseleave",a),p&&t.removeEventListener("mousemove",n),t.removeEventListener("mouseenter",n),t.removeEventListener("mouseleave",l)}}function t(){return!!i.current.openEvent&&["click","mousedown"].includes(i.current.openEvent.type)}function n(e){if(clearTimeout(b.current),C.current=!1,f&&!O(x.current)||m>0&&!Ze(y.current,"open"))return;const t=Ze(y.current,"open",x.current);t?b.current=window.setTimeout((()=>{w.current||o(!0,e,"hover")}),t):o(!0,e,"hover")}function l(e){if(t())return;T.current();const n=k(c.floating);if(clearTimeout(R.current),h.current&&i.current.floatingContext){r||clearTimeout(b.current),E.current=h.current({...i.current.floatingContext,tree:g,x:e.clientX,y:e.clientY,onClose(){A(),D(),S(e,!0,"safe-polygon")}});const t=E.current;return n.addEventListener("mousemove",t),void(T.current=()=>{n.removeEventListener("mousemove",t)})}("touch"!==x.current||!L(c.floating,e.relatedTarget))&&S(e)}function a(e){t()||i.current.floatingContext&&(null==h.current||h.current({...i.current.floatingContext,tree:g,x:e.clientX,y:e.clientY,onClose(){A(),D(),S(e)}})(e))}}),[c,s,t,f,m,p,S,D,A,o,r,w,g,y,h,i]),Fe((()=>{var e;if(s&&r&&null!=(e=h.current)&&e.__options.blockPointerEvents&&M()){const e=k(c.floating).body;e.setAttribute(Ue,""),e.style.pointerEvents="none",P.current=!0;const n=c.floating;if(d(c.domReference)&&n){var t;const e=c.domReference,r=null==g||null==(t=g.nodesRef.current.find((e=>e.id===v)))||null==(t=t.context)?void 0:t.elements.floating;return r&&(r.style.pointerEvents=""),e.style.pointerEvents="auto",n.style.pointerEvents="auto",()=>{e.style.pointerEvents="",n.style.pointerEvents=""}}}}),[s,r,v,c,g,h,M]),Fe((()=>{r||(x.current=void 0,D(),A())}),[r,D,A]),e.useEffect((()=>()=>{D(),clearTimeout(b.current),clearTimeout(R.current),A()}),[s,c.domReference,D,A]);const N=e.useMemo((()=>{function e(e){x.current=e.pointerType}return{onPointerDown:e,onPointerEnter:e,onMouseMove(e){const{nativeEvent:t}=e;function n(){C.current||w.current||o(!0,t,"hover")}f&&!O(x.current)||r||0===m||(clearTimeout(R.current),"touch"===x.current?n():R.current=window.setTimeout(n,m))}}}),[f,o,r,w,m]),F=e.useMemo((()=>({onMouseEnter(){clearTimeout(b.current)},onMouseLeave(e){S(e.nativeEvent,!1)}})),[S]);return e.useMemo((()=>s?{reference:N,floating:F}:{}),[s,N,F])}(V,{}),$=function(t){void 0===t&&(t=[]);const n=t.map((e=>null==e?void 0:e.reference)),r=t.map((e=>null==e?void 0:e.floating)),o=t.map((e=>null==e?void 0:e.item)),i=e.useCallback((e=>it(e,t,"reference")),n),l=e.useCallback((e=>it(e,t,"floating")),r),c=e.useCallback((e=>it(e,t,"item")),o);return e.useMemo((()=>({getReferenceProps:i,getFloatingProps:l,getItemProps:c})),[i,l,c])}([X,K,z]),Y=$.getReferenceProps,q=$.getFloatingProps;return t.createElement("span",null,t.createElement("span",c({className:"rad-ui-popper ".concat(N,"-reference-element ").concat(f),ref:_.setReference},Y({onClick:function(){console.log("click")}})),v),W&&t.createElement("div",c({className:"".concat(N,"-floating-element"),ref:_.setFloating,style:j},q()),E&&t.createElement(Ve,{className:"rad-ui-arrow ".concat(N,"-arrow"),ref:F,context:V}),S))},st=function(e){var n=e.list,r=void 0===n?[]:n;e.selected;return t.createElement("div",{className:"relative"},t.createElement(ct,{open:!1,placement:"bottom-start",popperName:"dropdown",pop:t.createElement((function(){return t.createElement("ul",{className:"bg-white px-2 py-2 shadow-lg rounded-md"},r.map((function(e,n){return t.createElement("li",{key:n},e.value)})))}),null)},t.createElement("span",null,"Dropdown")))};export{st as default};
|
|
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};
|
package/dist/components/Modal.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
'use client';import*as e from"react";import t,{useLayoutEffect as n,useEffect as r,useRef as o}from"react";import*as i from"react-dom";function l(e){return s(e)?(e.nodeName||"").toLowerCase():"#document"}function u(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function c(e){var t;return null==(t=(s(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function s(e){return e instanceof Node||e instanceof u(e).Node}function a(e){return e instanceof Element||e instanceof u(e).Element}function f(e){return e instanceof HTMLElement||e instanceof u(e).HTMLElement}function d(e){return"undefined"!=typeof ShadowRoot&&(e instanceof ShadowRoot||e instanceof u(e).ShadowRoot)}function p(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=w(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function m(e){return["table","td","th"].includes(l(e))}function h(e){return[":popover-open",":modal"].some((t=>{try{return e.matches(t)}catch(e){return!1}}))}function v(e){const t=g(),n=w(e);return"none"!==n.transform||"none"!==n.perspective||!!n.containerType&&"normal"!==n.containerType||!t&&!!n.backdropFilter&&"none"!==n.backdropFilter||!t&&!!n.filter&&"none"!==n.filter||["transform","perspective","filter"].some((e=>(n.willChange||"").includes(e)))||["paint","layout","strict","content"].some((e=>(n.contain||"").includes(e)))}function g(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function y(e){return["html","body","#document"].includes(l(e))}function w(e){return u(e).getComputedStyle(e)}function b(e){return a(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function x(e){if("html"===l(e))return e;const t=e.assignedSlot||e.parentNode||d(e)&&e.host||c(e);return d(t)?t.host:t}function E(e){const t=x(e);return y(t)?e.ownerDocument?e.ownerDocument.body:e.body:f(t)&&p(t)?t:E(t)}function R(e,t,n){var r;void 0===t&&(t=[]),void 0===n&&(n=!0);const o=E(e),i=o===(null==(r=e.ownerDocument)?void 0:r.body),l=u(o);return
|
|
1
|
+
'use client';import*as e from"react";import t,{useLayoutEffect as n,useEffect as r,useRef as o}from"react";import*as i from"react-dom";function l(e){return s(e)?(e.nodeName||"").toLowerCase():"#document"}function u(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function c(e){var t;return null==(t=(s(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function s(e){return e instanceof Node||e instanceof u(e).Node}function a(e){return e instanceof Element||e instanceof u(e).Element}function f(e){return e instanceof HTMLElement||e instanceof u(e).HTMLElement}function d(e){return"undefined"!=typeof ShadowRoot&&(e instanceof ShadowRoot||e instanceof u(e).ShadowRoot)}function p(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=w(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function m(e){return["table","td","th"].includes(l(e))}function h(e){return[":popover-open",":modal"].some((t=>{try{return e.matches(t)}catch(e){return!1}}))}function v(e){const t=g(),n=a(e)?w(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 g(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function y(e){return["html","body","#document"].includes(l(e))}function w(e){return u(e).getComputedStyle(e)}function b(e){return a(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function x(e){if("html"===l(e))return e;const t=e.assignedSlot||e.parentNode||d(e)&&e.host||c(e);return d(t)?t.host:t}function E(e){const t=x(e);return y(t)?e.ownerDocument?e.ownerDocument.body:e.body:f(t)&&p(t)?t:E(t)}function R(e,t,n){var r;void 0===t&&(t=[]),void 0===n&&(n=!0);const o=E(e),i=o===(null==(r=e.ownerDocument)?void 0:r.body),l=u(o);if(i){const e=function(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}(l);return t.concat(l,l.visualViewport||[],p(o)?o:[],e&&n?R(e):[])}return t.concat(o,R(o,[],n))}function S(e){let t=e.activeElement;for(;null!=(null==(n=t)||null==(n=n.shadowRoot)?void 0:n.activeElement);){var n;t=t.shadowRoot.activeElement}return t}function C(e,t){if(!e||!t)return!1;const n=null==t.getRootNode?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&d(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function O(){const e=navigator.userAgentData;return null!=e&&e.platform?e.platform:navigator.platform}function T(){const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map((e=>{let{brand:t,version:n}=e;return t+"/"+n})).join(" "):navigator.userAgent}function N(e){return!T().includes("jsdom/")&&(!L()&&0===e.width&&0===e.height||L()&&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 L(){const e=/android/i;return e.test(O())||e.test(T())}function A(e){return(null==e?void 0:e.ownerDocument)||document}function k(e){return"composedPath"in e?e.composedPath()[0]:e.target}const M="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function I(e){e.preventDefault(),e.stopPropagation()}function D(e){return!!e&&("combobox"===e.getAttribute("role")&&function(e){return f(e)&&e.matches(M)}(e))}const F=Math.min,P=Math.max,W=Math.round,j=e=>({x:e,y:e});function V(e){return e.split("-")[0]}function B(e){return["top","bottom"].includes(V(e))?"y":"x"}function H(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}
|
|
2
2
|
/*!
|
|
3
3
|
* tabbable 6.2.0
|
|
4
4
|
* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
|
|
5
|
-
*/var q=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[href]:not([inert])","button:not([inert])","[tabindex]:not(slot):not([inert])","audio[controls]:not([inert])","video[controls]:not([inert])",'[contenteditable]:not([contenteditable="false"]):not([inert])',"details>summary:first-of-type:not([inert])","details:not([inert])"].join(","),_="undefined"==typeof Element,U=_?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,$=!_&&Element.prototype.getRootNode?function(e){var t;return null==e||null===(t=e.getRootNode)||void 0===t?void 0:t.call(e)}:function(e){return null==e?void 0:e.ownerDocument},z=function e(t,n){var r;void 0===n&&(n=!0);var o=null==t||null===(r=t.getAttribute)||void 0===r?void 0:r.call(t,"inert");return""===o||"true"===o||n&&t&&e(t.parentNode)},X=function e(t,n,r){for(var o=[],i=Array.from(t);i.length;){var l=i.shift();if(!z(l,!1))if("SLOT"===l.tagName){var u=l.assignedElements(),c=e(u.length?u:l.children,!0,r);r.flatten?o.push.apply(o,c):o.push({scopeParent:l,candidates:c})}else{U.call(l,q)&&r.filter(l)&&(n||!t.includes(l))&&o.push(l);var s=l.shadowRoot||"function"==typeof r.getShadowRoot&&r.getShadowRoot(l),a=!z(s,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(l));if(s&&a){var f=e(!0===s?l.children:s.children,!0,r);r.flatten?o.push.apply(o,f):o.push({scopeParent:l,candidates:f})}else i.unshift.apply(i,l.children)}}return o},Y=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},K=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||function(e){var t,n=null==e||null===(t=e.getAttribute)||void 0===t?void 0:t.call(e,"contenteditable");return""===n||"true"===n}(e))&&!Y(e)?0:e.tabIndex},G=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},J=function(e){return"INPUT"===e.tagName},Q=function(e){return function(e){return J(e)&&"radio"===e.type}(e)&&!function(e){if(!e.name)return!0;var t,n=e.form||$(e),r=function(e){return n.querySelectorAll('input[type="radio"][name="'+e+'"]')};if("undefined"!=typeof window&&void 0!==window.CSS&&"function"==typeof window.CSS.escape)t=r(window.CSS.escape(e.name));else try{t=r(e.name)}catch(e){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",e.message),!1}var o=function(e,t){for(var n=0;n<e.length;n++)if(e[n].checked&&e[n].form===t)return e[n]}(t,e.form);return!o||o===e}(e)},Z=function(e){var t=e.getBoundingClientRect(),n=t.width,r=t.height;return 0===n&&0===r},ee=function(e,t){var n=t.displayCheck,r=t.getShadowRoot;if("hidden"===getComputedStyle(e).visibility)return!0;var o=U.call(e,"details>summary:first-of-type")?e.parentElement:e;if(U.call(o,"details:not([open]) *"))return!0;if(n&&"full"!==n&&"legacy-full"!==n){if("non-zero-area"===n)return Z(e)}else{if("function"==typeof r){for(var i=e;e;){var l=e.parentElement,u=$(e);if(l&&!l.shadowRoot&&!0===r(l))return Z(e);e=e.assignedSlot?e.assignedSlot:l||u===e.ownerDocument?l:u.host}e=i}if(function(e){var t,n,r,o,i=e&&$(e),l=null===(t=i)||void 0===t?void 0:t.host,u=!1;if(i&&i!==e)for(u=!!(null!==(n=l)&&void 0!==n&&null!==(r=n.ownerDocument)&&void 0!==r&&r.contains(l)||null!=e&&null!==(o=e.ownerDocument)&&void 0!==o&&o.contains(e));!u&&l;){var c,s,a;u=!(null===(s=l=null===(c=i=$(l))||void 0===c?void 0:c.host)||void 0===s||null===(a=s.ownerDocument)||void 0===a||!a.contains(l))}return u}(e))return!e.getClientRects().length;if("legacy-full"!==n)return!0}return!1},te=function(e,t){return!(t.disabled||z(t)||function(e){return J(e)&&"hidden"===e.type}(t)||ee(t,e)||function(e){return"DETAILS"===e.tagName&&Array.prototype.slice.apply(e.children).some((function(e){return"SUMMARY"===e.tagName}))}(t)||function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var t=e.parentElement;t;){if("FIELDSET"===t.tagName&&t.disabled){for(var n=0;n<t.children.length;n++){var r=t.children.item(n);if("LEGEND"===r.tagName)return!!U.call(t,"fieldset[disabled] *")||!r.contains(e)}return!0}t=t.parentElement}return!1}(t))},ne=function(e,t){return!(Q(t)||K(t)<0||!te(e,t))},re=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},oe=function e(t){var n=[],r=[];return t.forEach((function(t,o){var i=!!t.scopeParent,l=i?t.scopeParent:t,u=function(e,t){var n=K(e);return n<0&&t&&!Y(e)?0:n}(l,i),c=i?e(t.candidates):l;0===u?i?n.push.apply(n,c):n.push(l):r.push({documentOrder:o,tabIndex:u,item:t,isScope:i,content:c})})),r.sort(G).reduce((function(e,t){return t.isScope?e.push.apply(e,t.content):e.push(t.content),e}),[]).concat(n)},ie=function(e,t){var n;return n=(t=t||{}).getShadowRoot?X([e],t.includeContainer,{filter:ne.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:re}):function(e,t,n){if(z(e))return[];var r=Array.prototype.slice.apply(e.querySelectorAll(q));return t&&U.call(e,q)&&r.unshift(e),r.filter(n)}(e,t.includeContainer,ne.bind(null,t)),oe(n)},le=function(e,t){if(t=t||{},!e)throw new Error("No node provided");return!1!==U.call(e,q)&&ne(t,e)};function ue(e,t,n){let{reference:r,floating:o}=e;const i=B(t),l=function(e){return"x"===B(e)?"y":"x"}(t),u="y"===l?"height":"width";const c=V(t),s="y"===i,a=r.x+r.width/2-o.width/2,f=r.y+r.height/2-o.height/2,d=r[u]/2-o[u]/2;let p;switch(c){case"top":p={x:a,y:r.y-o.height};break;case"bottom":p={x:a,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:f};break;case"left":p={x:r.x-o.width,y:f};break;default:p={x:r.x,y:r.y}}switch(function(e){return e.split("-")[1]}(t)){case"start":p[l]-=d*(n&&s?-1:1);break;case"end":p[l]+=d*(n&&s?-1:1)}return p}function ce(e){const t=w(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=f(e),i=o?e.offsetWidth:n,l=o?e.offsetHeight:r,u=W(n)!==i||W(r)!==l;return u&&(n=i,r=l),{width:n,height:r,$:u}}function se(e){return a(e)?e:e.contextElement}function ae(e){const t=se(e);if(!f(t))return j(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=ce(t);let l=(i?W(n.width):n.width)/r,u=(i?W(n.height):n.height)/o;return l&&Number.isFinite(l)||(l=1),u&&Number.isFinite(u)||(u=1),{x:l,y:u}}const fe=j(0);function de(e){const t=u(e);return g()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:fe}function pe(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);const o=e.getBoundingClientRect(),i=se(e);let l=j(1);t&&(r?a(r)&&(l=ae(r)):l=ae(e));const c=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==u(e))&&t}(i,n,r)?de(i):j(0);let s=(o.left+c.x)/l.x,f=(o.top+c.y)/l.y,d=o.width/l.x,p=o.height/l.y;if(i){const e=u(i),t=r&&a(r)?u(r):r;let n=e,o=n.frameElement;for(;o&&r&&t!==n;){const e=ae(o),t=o.getBoundingClientRect(),r=w(o),i=t.left+(o.clientLeft+parseFloat(r.paddingLeft))*e.x,l=t.top+(o.clientTop+parseFloat(r.paddingTop))*e.y;s*=e.x,f*=e.y,d*=e.x,p*=e.y,s+=i,f+=l,n=u(o),o=n.frameElement}}return H({width:d,height:p,x:s,y:f})}function me(e){return pe(c(e)).left+b(e).scrollLeft}function he(e,t,n){let r;if("viewport"===t)r=function(e,t){const n=u(e),r=c(e),o=n.visualViewport;let i=r.clientWidth,l=r.clientHeight,s=0,a=0;if(o){i=o.width,l=o.height;const e=g();(!e||e&&"fixed"===t)&&(s=o.offsetLeft,a=o.offsetTop)}return{width:i,height:l,x:s,y:a}}(e,n);else if("document"===t)r=function(e){const t=c(e),n=b(e),r=e.ownerDocument.body,o=P(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=P(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let l=-n.scrollLeft+me(e);const u=-n.scrollTop;return"rtl"===w(r).direction&&(l+=P(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:l,y:u}}(c(e));else if(a(t))r=function(e,t){const n=pe(e,!0,"fixed"===t),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=f(e)?ae(e):j(1);return{width:e.clientWidth*i.x,height:e.clientHeight*i.y,x:o*i.x,y:r*i.y}}(t,n);else{const n=de(e);r={...t,x:t.x-n.x,y:t.y-n.y}}return H(r)}function ve(e,t){const n=x(e);return!(n===t||!a(n)||y(n))&&("fixed"===w(n).position||ve(n,t))}function ge(e,t,n){const r=f(t),o=c(t),i="fixed"===n,u=pe(e,!0,i,t);let s={scrollLeft:0,scrollTop:0};const a=j(0);if(r||!r&&!i)if(("body"!==l(t)||p(o))&&(s=b(t)),r){const e=pe(t,!0,i,t);a.x=e.x+t.clientLeft,a.y=e.y+t.clientTop}else o&&(a.x=me(o));return{x:u.left+s.scrollLeft-a.x,y:u.top+s.scrollTop-a.y,width:u.width,height:u.height}}function ye(e){return"static"===w(e).position}function we(e,t){return f(e)&&"fixed"!==w(e).position?t?t(e):e.offsetParent:null}function be(e,t){const n=u(e);if(h(e))return n;if(!f(e)){let t=x(e);for(;t&&!y(t);){if(a(t)&&!ye(t))return t;t=x(t)}return n}let r=we(e,t);for(;r&&m(r)&&ye(r);)r=we(r,t);return r&&y(r)&&ye(r)&&!v(r)?n:r||function(e){let t=x(e);for(;f(t)&&!y(t);){if(h(t))return null;if(v(t))return t;t=x(t)}return null}(e)||n}const xe={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i="fixed"===o,u=c(r),s=!!t&&h(t.floating);if(r===u||s&&i)return n;let a={scrollLeft:0,scrollTop:0},d=j(1);const m=j(0),v=f(r);if((v||!v&&!i)&&(("body"!==l(r)||p(u))&&(a=b(r)),f(r))){const e=pe(r);d=ae(r),m.x=e.x+r.clientLeft,m.y=e.y+r.clientTop}return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-a.scrollLeft*d.x+m.x,y:n.y*d.y-a.scrollTop*d.y+m.y}},getDocumentElement:c,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[..."clippingAncestors"===n?h(t)?[]:function(e,t){const n=t.get(e);if(n)return n;let r=R(e,[],!1).filter((e=>a(e)&&"body"!==l(e))),o=null;const i="fixed"===w(e).position;let u=i?x(e):e;for(;a(u)&&!y(u);){const t=w(u),n=v(u);n||"fixed"!==t.position||(o=null),(i?!n&&!o:!n&&"static"===t.position&&o&&["absolute","fixed"].includes(o.position)||p(u)&&!n&&ve(e,u))?r=r.filter((e=>e!==u)):o=t,u=x(u)}return t.set(e,r),r}(t,this._c):[].concat(n),r],u=i[0],c=i.reduce(((e,n)=>{const r=he(t,n,o);return e.top=P(r.top,e.top),e.right=F(r.right,e.right),e.bottom=F(r.bottom,e.bottom),e.left=P(r.left,e.left),e}),he(t,u,o));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}},getOffsetParent:be,getElementRects:async function(e){const t=this.getOffsetParent||be,n=this.getDimensions,r=await n(e.floating);return{reference:ge(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){const{width:t,height:n}=ce(e);return{width:t,height:n}},getScale:ae,isElement:a,isRTL:function(e){return"rtl"===w(e).direction}},Ee=(e,t,n)=>{const r=new Map,o={platform:xe,...n},i={...o.platform,_c:r};return(async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:l}=n,u=i.filter(Boolean),c=await(null==l.isRTL?void 0:l.isRTL(t));let s=await l.getElementRects({reference:e,floating:t,strategy:o}),{x:a,y:f}=ue(s,r,c),d=r,p={},m=0;for(let n=0;n<u.length;n++){const{name:i,fn:h}=u[n],{x:v,y:g,data:y,reset:w}=await h({x:a,y:f,initialPlacement:r,placement:d,strategy:o,middlewareData:p,rects:s,platform:l,elements:{reference:e,floating:t}});a=null!=v?v:a,f=null!=g?g:f,p={...p,[i]:{...p[i],...y}},w&&m<=50&&(m++,"object"==typeof w&&(w.placement&&(d=w.placement),w.rects&&(s=!0===w.rects?await l.getElementRects({reference:e,floating:t,strategy:o}):w.rects),({x:a,y:f}=ue(s,d,c))),n=-1)}return{x:a,y:f,placement:d,strategy:o,middlewareData:p}})(e,t,{...o,platform:i})};var Re="undefined"!=typeof document?n:r;function Se(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;0!=r--;)if(!Se(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;0!=r--;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;0!=r--;){const n=o[r];if(("_owner"!==n||!e.$$typeof)&&!Se(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function Ce(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Te(e,t){const n=Ce(e);return Math.round(t*n)/n}function Ne(t){const n=e.useRef(t);return Re((()=>{n.current=t})),n}const Le={...e},Oe=Le.useInsertionEffect||(e=>e());function Ae(t){const n=e.useRef((()=>{if("production"!==process.env.NODE_ENV)throw new Error("Cannot call an event handler while rendering.")}));return Oe((()=>{n.current=t})),e.useCallback((function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return null==n.current?void 0:n.current(...t)}),[])}let ke=0;function Me(e,t){void 0===t&&(t={});const{preventScroll:n=!1,cancelPrevious:r=!0,sync:o=!1}=t;r&&cancelAnimationFrame(ke);const i=()=>null==e?void 0:e.focus({preventScroll:n});o?i():ke=requestAnimationFrame(i)}var Ie="undefined"!=typeof document?n:r;function De(){return De=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},De.apply(this,arguments)}let Fe=!1,Pe=0;const We=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+Pe++;const je=Le.useId||function(){const[t,n]=e.useState((()=>Fe?We():void 0));return Ie((()=>{null==t&&n(We())}),[]),e.useEffect((()=>{Fe=!0}),[]),t};let Ve;"production"!==process.env.NODE_ENV&&(Ve=new Set);const Be=e.createContext(null),He=e.createContext(null),qe=()=>{var t;return(null==(t=e.useContext(Be))?void 0:t.id)||null},_e=()=>e.useContext(He);function Ue(e){return"data-floating-ui-"+e}function $e(e){const t=o(e);return Ie((()=>{t.current=e})),t}function ze(e,t){let n=e.filter((e=>{var n;return e.parentId===t&&(null==(n=e.context)?void 0:n.open)})),r=n;for(;r.length;)r=e.filter((e=>{var t;return null==(t=r)?void 0:t.some((t=>{var n;return e.parentId===t.id&&(null==(n=e.context)?void 0:n.open)}))})),n=n.concat(r);return n}let Xe=new WeakMap,Ye=new WeakSet,Ke={},Ge=0;const Je=e=>e&&(e.host||Je(e.parentNode)),Qe=(e,t)=>t.map((t=>{if(e.contains(t))return t;const n=Je(t);return e.contains(n)?n:null})).filter((e=>null!=e));function Ze(e,t,n){void 0===t&&(t=!1),void 0===n&&(n=!1);const r=A(e[0]).body;return function(e,t,n,r){const o="data-floating-ui-inert",i=r?"inert":n?"aria-hidden":null,u=Qe(t,e),c=new Set,s=new Set(u),a=[];Ke[o]||(Ke[o]=new WeakMap);const f=Ke[o];return u.forEach((function e(t){t&&!c.has(t)&&(c.add(t),t.parentNode&&e(t.parentNode))})),function e(t){t&&!s.has(t)&&[].forEach.call(t.children,(t=>{if("script"!==l(t))if(c.has(t))e(t);else{const e=i?t.getAttribute(i):null,n=null!==e&&"false"!==e,r=(Xe.get(t)||0)+1,l=(f.get(t)||0)+1;Xe.set(t,r),f.set(t,l),a.push(t),1===r&&n&&Ye.add(t),1===l&&t.setAttribute(o,""),!n&&i&&t.setAttribute(i,"true")}}))}(t),c.clear(),Ge++,()=>{a.forEach((e=>{const t=(Xe.get(e)||0)-1,n=(f.get(e)||0)-1;Xe.set(e,t),f.set(e,n),t||(!Ye.has(e)&&i&&e.removeAttribute(i),Ye.delete(e)),n||e.removeAttribute(o)})),Ge--,Ge||(Xe=new WeakMap,Xe=new WeakMap,Ye=new WeakSet,Ke={})}}(e.concat(Array.from(r.querySelectorAll("[aria-live]"))),r,t,n)}const et=()=>({getShadowRoot:!0,displayCheck:"function"==typeof ResizeObserver&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function tt(e,t){const n=ie(e,et());"prev"===t&&n.reverse();const r=n.indexOf(S(A(e)));return n.slice(r+1)[0]}function nt(){return tt(document.body,"next")}function rt(){return tt(document.body,"prev")}function ot(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!C(n,r)}function it(e){ie(e,et()).forEach((e=>{e.dataset.tabindex=e.getAttribute("tabindex")||"",e.setAttribute("tabindex","-1")}))}function lt(e){e.querySelectorAll("[data-tabindex]").forEach((e=>{const t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute("tabindex",t):e.removeAttribute("tabindex")}))}const ut={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0};function ct(e){"Tab"===e.key&&(e.target,clearTimeout(undefined))}const st=e.forwardRef((function(t,n){const[r,o]=e.useState();Ie((()=>(/apple/i.test(navigator.vendor)&&o("button"),document.addEventListener("keydown",ct),()=>{document.removeEventListener("keydown",ct)})),[]);const i={ref:n,tabIndex:0,role:r,"aria-hidden":!r||void 0,[Ue("focus-guard")]:"",style:ut};return e.createElement("span",De({},t,i))})),at=e.createContext(null),ft=Ue("portal");function dt(t){const{children:n,id:r,root:o=null,preserveTabOrder:l=!0}=t,u=function(t){void 0===t&&(t={});const{id:n,root:r}=t,o=je(),i=pt(),[l,u]=e.useState(null),c=e.useRef(null);return Ie((()=>()=>{null==l||l.remove(),queueMicrotask((()=>{c.current=null}))}),[l]),Ie((()=>{if(!o)return;if(c.current)return;const e=n?document.getElementById(n):null;if(!e)return;const t=document.createElement("div");t.id=o,t.setAttribute(ft,""),e.appendChild(t),c.current=t,u(t)}),[n,o]),Ie((()=>{if(!o)return;if(c.current)return;let e=r||(null==i?void 0:i.portalNode);e&&!a(e)&&(e=e.current),e=e||document.body;let t=null;n&&(t=document.createElement("div"),t.id=n,e.appendChild(t));const l=document.createElement("div");l.id=o,l.setAttribute(ft,""),e=t||e,e.appendChild(l),c.current=l,u(l)}),[n,r,o,i]),l}({id:r,root:o}),[c,s]=e.useState(null),f=e.useRef(null),d=e.useRef(null),p=e.useRef(null),m=e.useRef(null),h=!!c&&!c.modal&&c.open&&l&&!(!o&&!u);return e.useEffect((()=>{if(u&&l&&(null==c||!c.modal))return u.addEventListener("focusin",e,!0),u.addEventListener("focusout",e,!0),()=>{u.removeEventListener("focusin",e,!0),u.removeEventListener("focusout",e,!0)};function e(e){if(u&&ot(e)){("focusin"===e.type?lt:it)(u)}}}),[u,l,null==c?void 0:c.modal]),e.createElement(at.Provider,{value:e.useMemo((()=>({preserveTabOrder:l,beforeOutsideRef:f,afterOutsideRef:d,beforeInsideRef:p,afterInsideRef:m,portalNode:u,setFocusManagerState:s})),[l,u])},h&&u&&e.createElement(st,{"data-type":"outside",ref:f,onFocus:e=>{if(ot(e,u)){var t;null==(t=p.current)||t.focus()}else{const e=rt()||(null==c?void 0:c.refs.domReference.current);null==e||e.focus()}}}),h&&u&&e.createElement("span",{"aria-owns":u.id,style:ut}),u&&i.createPortal(n,u),h&&u&&e.createElement(st,{"data-type":"outside",ref:d,onFocus:e=>{if(ot(e,u)){var t;null==(t=m.current)||t.focus()}else{const t=nt()||(null==c?void 0:c.refs.domReference.current);null==t||t.focus(),(null==c?void 0:c.closeOnFocusOut)&&(null==c||c.onOpenChange(!1,e.nativeEvent))}}}))}const pt=()=>e.useContext(at),mt=20;let ht=[];function vt(e){ht=ht.filter((e=>e.isConnected));let t=e;if(t&&"body"!==l(t)){if(!le(t,et())){const e=ie(t,et())[0];e&&(t=e)}ht.push(t),ht.length>mt&&(ht=ht.slice(-mt))}}function gt(){return ht.slice().reverse().find((e=>e.isConnected))}const yt=e.forwardRef((function(t,n){return e.createElement("button",De({},t,{type:"button",ref:n,tabIndex:-1,style:ut}))}));function wt(t){const{context:n,children:r,disabled:o=!1,order:i=["content"],guards:l=!0,initialFocus:u=0,returnFocus:c=!0,restoreFocus:s=!1,modal:a=!0,visuallyHiddenDismiss:d=!1,closeOnFocusOut:p=!0}=t,{open:m,refs:h,nodeId:v,onOpenChange:g,events:y,dataRef:w,floatingId:b,elements:{domReference:x,floating:E}}=n,R="number"==typeof u&&u<0,T=D(x)&&R,N="undefined"==typeof HTMLElement||!("inert"in HTMLElement.prototype)||l,M=$e(i),F=$e(u),P=$e(c),W=_e(),j=pt(),V=e.useRef(null),B=e.useRef(null),H=e.useRef(!1),q=e.useRef(!1),_=e.useRef(-1),U=null!=j,$=null==E?void 0:E.firstElementChild,z=(null==$?void 0:$.id)===b?$:E,X=Ae((function(e){return void 0===e&&(e=z),e?ie(e,et()):[]})),Y=Ae((e=>{const t=X(e);return M.current.map((e=>x&&"reference"===e?x:z&&"floating"===e?z:t)).filter(Boolean).flat()}));function K(t){return!o&&d&&a?e.createElement(yt,{ref:"start"===t?V:B,onClick:e=>g(!1,e.nativeEvent)},"string"==typeof d?d:"Dismiss"):null}e.useEffect((()=>{if(o)return;if(!a)return;function e(e){if("Tab"===e.key){C(z,S(A(z)))&&0===X().length&&!T&&I(e);const t=Y(),n=k(e);"reference"===M.current[0]&&n===x&&(I(e),e.shiftKey?Me(t[t.length-1]):Me(t[1])),"floating"===M.current[1]&&n===z&&e.shiftKey&&(I(e),Me(t[0]))}}const t=A(z);return t.addEventListener("keydown",e),()=>{t.removeEventListener("keydown",e)}}),[o,x,z,a,M,T,X,Y]),e.useEffect((()=>{if(!o&&E)return E.addEventListener("focusin",e),()=>{E.removeEventListener("focusin",e)};function e(e){const t=k(e),n=X().indexOf(t);-1!==n&&(_.current=n)}}),[o,E,X]),e.useEffect((()=>{if(!o&&p)return E&&f(x)?(x.addEventListener("focusout",t),x.addEventListener("pointerdown",e),E.addEventListener("focusout",t),()=>{x.removeEventListener("focusout",t),x.removeEventListener("pointerdown",e),E.removeEventListener("focusout",t)}):void 0;function e(){q.current=!0,setTimeout((()=>{q.current=!1}))}function t(e){const t=e.relatedTarget;queueMicrotask((()=>{const n=!(C(x,t)||C(E,t)||C(t,E)||C(null==j?void 0:j.portalNode,t)||null!=t&&t.hasAttribute(Ue("focus-guard"))||W&&(ze(W.nodesRef.current,v).find((e=>{var n,r;return C(null==(n=e.context)?void 0:n.elements.floating,t)||C(null==(r=e.context)?void 0:r.elements.domReference,t)}))||function(e,t){var n;let r=[],o=null==(n=e.find((e=>e.id===t)))?void 0:n.parentId;for(;o;){const t=e.find((e=>e.id===o));o=null==t?void 0:t.parentId,t&&(r=r.concat(t))}return r}(W.nodesRef.current,v).find((e=>{var n,r;return(null==(n=e.context)?void 0:n.elements.floating)===t||(null==(r=e.context)?void 0:r.elements.domReference)===t}))));if(s&&n&&S(A(z))===A(z).body){f(z)&&(null==z||z.focus());const e=_.current,t=X(),n=t[e]||t[t.length-1]||z;f(n)&&n.focus()}!T&&a||!t||!n||q.current||t===gt()||(H.current=!0,g(!1,e))}))}}),[o,x,E,z,a,v,W,j,g,p,s,X,T]),e.useEffect((()=>{var e;if(o)return;const t=Array.from((null==j||null==(e=j.portalNode)?void 0:e.querySelectorAll("["+Ue("portal")+"]"))||[]);if(E){const e=[E,...t,V.current,B.current,M.current.includes("reference")||T?x:null].filter((e=>null!=e)),n=a||T?Ze(e,N,!N):Ze(e);return()=>{n()}}}),[o,x,E,a,M,j,T,N]),Ie((()=>{if(o||!f(z))return;const e=S(A(z));queueMicrotask((()=>{const t=Y(z),n=F.current,r=("number"==typeof n?t[n]:n.current)||z,o=C(z,e);R||o||!m||Me(r,{preventScroll:r===z})}))}),[o,m,z,R,Y,F]),Ie((()=>{if(o||!z)return;let e=!1;const t=A(z),n=S(t);let r=w.current.openEvent;function i(t){let{open:n,reason:o,event:i,nested:l}=t;n&&(r=i),"escape-key"===o&&h.domReference.current&&vt(h.domReference.current),"hover"===o&&"mouseleave"===i.type&&(H.current=!0),"outside-press"===o&&(l?(H.current=!1,e=!0):H.current=!(function(e){return!(0!==e.mozInputSource||!e.isTrusted)||(O()&&e.pointerType?"click"===e.type&&1===e.buttons:0===e.detail&&!e.pointerType)}(i)||L(i)))}return vt(n),y.on("openchange",i),()=>{y.off("openchange",i);const n=S(t),o=C(E,n)||W&&ze(W.nodesRef.current,v).some((e=>{var t;return C(null==(t=e.context)?void 0:t.elements.floating,n)}));(o||r&&["click","mousedown"].includes(r.type))&&h.domReference.current&&vt(h.domReference.current);const l=gt();P.current&&!H.current&&f(l)&&(l===n||n===t.body||o)&&Me(l,{cancelPrevious:!1,preventScroll:e})}}),[o,E,z,P,w,h,y,W,v]),Ie((()=>{if(!o&&j)return j.setFocusManagerState({modal:a,closeOnFocusOut:p,open:m,onOpenChange:g,refs:h}),()=>{j.setFocusManagerState(null)}}),[o,j,a,m,g,h,p]),Ie((()=>{if(o)return;if(!z)return;if("function"!=typeof MutationObserver)return;if(R)return;const e=()=>{const e=z.getAttribute("tabindex"),t=X(),n=S(A(E)),r=t.indexOf(n);-1!==r&&(_.current=r),M.current.includes("floating")||n!==h.domReference.current&&0===t.length?"0"!==e&&z.setAttribute("tabindex","0"):"-1"!==e&&z.setAttribute("tabindex","-1")};e();const t=new MutationObserver(e);return t.observe(z,{childList:!0,subtree:!0,attributes:!0}),()=>{t.disconnect()}}),[o,E,z,h,M,X,R]);const G=!o&&N&&(!a||!T)&&(U||a);return e.createElement(e.Fragment,null,G&&e.createElement(st,{"data-type":"inside",ref:null==j?void 0:j.beforeInsideRef,onFocus:e=>{if(a){const e=Y();Me("reference"===i[0]?e[0]:e[e.length-1])}else if(null!=j&&j.preserveTabOrder&&j.portalNode)if(H.current=!1,ot(e,j.portalNode)){const e=nt()||x;null==e||e.focus()}else{var t;null==(t=j.beforeOutsideRef.current)||t.focus()}}}),!T&&K("start"),r,K("end"),G&&e.createElement(st,{"data-type":"inside",ref:null==j?void 0:j.afterInsideRef,onFocus:e=>{if(a)Me(Y()[0]);else if(null!=j&&j.preserveTabOrder&&j.portalNode)if(p&&(H.current=!0),ot(e,j.portalNode)){const e=rt()||x;null==e||e.focus()}else{var t;null==(t=j.afterOutsideRef.current)||t.focus()}}}))}const bt=new Set,xt=e.forwardRef((function(t,n){const{lockScroll:r=!1,...o}=t,i=je();return Ie((()=>{if(!r)return;bt.add(i);const e=/iP(hone|ad|od)|iOS/.test(T()),t=document.body.style,n=Math.round(document.documentElement.getBoundingClientRect().left)+document.documentElement.scrollLeft?"paddingLeft":"paddingRight",o=window.innerWidth-document.documentElement.clientWidth,l=t.left?parseFloat(t.left):window.scrollX,u=t.top?parseFloat(t.top):window.scrollY;if(t.overflow="hidden",o&&(t[n]=o+"px"),e){var c,s;const e=(null==(c=window.visualViewport)?void 0:c.offsetLeft)||0,n=(null==(s=window.visualViewport)?void 0:s.offsetTop)||0;Object.assign(t,{position:"fixed",top:-(u-Math.floor(n))+"px",left:-(l-Math.floor(e))+"px",right:"0"})}return()=>{bt.delete(i),0===bt.size&&(Object.assign(t,{overflow:"",[n]:""}),e&&(Object.assign(t,{position:"",top:"",left:"",right:""}),window.scrollTo(l,u)))}}),[i,r]),e.createElement("div",De({ref:n},o,{style:{position:"fixed",overflow:"auto",top:0,right:0,bottom:0,left:0,...o.style}}))}));function Et(t){const{open:n=!1,onOpenChange:r,elements:o}=t,i=je(),l=e.useRef({}),[u]=e.useState((()=>function(){const e=new Map;return{emit(t,n){var r;null==(r=e.get(t))||r.forEach((e=>e(n)))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){var r;e.set(t,(null==(r=e.get(t))?void 0:r.filter((e=>e!==n)))||[])}}}())),c=null!=qe();if("production"!==process.env.NODE_ENV){const e=o.reference;e&&!a(e)&&function(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];const o="Floating UI: "+n.join(" ");var i;null!=(e=Ve)&&e.has(o)||(null==(i=Ve)||i.add(o),console.error(o))}("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `refs.setPositionReference()`","instead.")}const[s,f]=e.useState(o.reference),d=Ae(((e,t,n)=>{l.current.openEvent=e?t:void 0,u.emit("openchange",{open:e,event:t,reason:n,nested:c}),null==r||r(e,t,n)})),p=e.useMemo((()=>({setPositionReference:f})),[]),m=e.useMemo((()=>({reference:s||o.reference||null,floating:o.floating||null,domReference:o.reference})),[s,o.reference,o.floating]);return e.useMemo((()=>({dataRef:l,open:n,onOpenChange:d,elements:m,events:u,floatingId:i,refs:p})),[n,d,m,u,i,p])}function Rt(t){void 0===t&&(t={});const{nodeId:n}=t,r=Et({...t,elements:{reference:null,floating:null,...t.elements}}),o=t.rootContext||r,l=o.elements,[u,c]=e.useState(null),[s,f]=e.useState(null),d=(null==l?void 0:l.reference)||u,p=e.useRef(null),m=_e();Ie((()=>{d&&(p.current=d)}),[d]);const h=function(t){void 0===t&&(t={});const{placement:n="bottom",strategy:r="absolute",middleware:o=[],platform:l,elements:{reference:u,floating:c}={},transform:s=!0,whileElementsMounted:a,open:f}=t,[d,p]=e.useState({x:0,y:0,strategy:r,placement:n,middlewareData:{},isPositioned:!1}),[m,h]=e.useState(o);Se(m,o)||h(o);const[v,g]=e.useState(null),[y,w]=e.useState(null),b=e.useCallback((e=>{e!==S.current&&(S.current=e,g(e))}),[]),x=e.useCallback((e=>{e!==C.current&&(C.current=e,w(e))}),[]),E=u||v,R=c||y,S=e.useRef(null),C=e.useRef(null),T=e.useRef(d),N=null!=a,L=Ne(a),O=Ne(l),A=e.useCallback((()=>{if(!S.current||!C.current)return;const e={placement:n,strategy:r,middleware:m};O.current&&(e.platform=O.current),Ee(S.current,C.current,e).then((e=>{const t={...e,isPositioned:!0};k.current&&!Se(T.current,t)&&(T.current=t,i.flushSync((()=>{p(t)})))}))}),[m,n,r,O]);Re((()=>{!1===f&&T.current.isPositioned&&(T.current.isPositioned=!1,p((e=>({...e,isPositioned:!1}))))}),[f]);const k=e.useRef(!1);Re((()=>(k.current=!0,()=>{k.current=!1})),[]),Re((()=>{if(E&&(S.current=E),R&&(C.current=R),E&&R){if(L.current)return L.current(E,R,A);A()}}),[E,R,A,L,N]);const M=e.useMemo((()=>({reference:S,floating:C,setReference:b,setFloating:x})),[b,x]),I=e.useMemo((()=>({reference:E,floating:R})),[E,R]),D=e.useMemo((()=>{const e={position:r,left:0,top:0};if(!I.floating)return e;const t=Te(I.floating,d.x),n=Te(I.floating,d.y);return s?{...e,transform:"translate("+t+"px, "+n+"px)",...Ce(I.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:t,top:n}}),[r,s,I.floating,d.x,d.y]);return e.useMemo((()=>({...d,update:A,refs:M,elements:I,floatingStyles:D})),[d,A,M,I,D])}({...t,elements:{...l,...s&&{reference:s}}}),v=e.useCallback((e=>{const t=a(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:e}:e;f(t),h.refs.setReference(t)}),[h.refs]),g=e.useCallback((e=>{(a(e)||null===e)&&(p.current=e,c(e)),(a(h.refs.reference.current)||null===h.refs.reference.current||null!==e&&!a(e))&&h.refs.setReference(e)}),[h.refs]),y=e.useMemo((()=>({...h.refs,setReference:g,setPositionReference:v,domReference:p})),[h.refs,g,v]),w=e.useMemo((()=>({...h.elements,domReference:d})),[h.elements,d]),b=e.useMemo((()=>({...h,...o,refs:y,elements:w,nodeId:n})),[h,y,w,n,o]);return Ie((()=>{o.dataRef.current.floatingContext=b;const e=null==m?void 0:m.nodesRef.current.find((e=>e.id===n));e&&(e.context=b)})),e.useMemo((()=>({...h,context:b,refs:y,elements:w})),[h,y,w,b])}var St=function(e){var n=e.open,r=void 0===n||n,o=e.onClose,i=e.children,l=Rt().context;return t.createElement("div",{className:"modal"},t.createElement("div",{className:"modal__content"},t.createElement("div",null,i),t.createElement("div",null,r&&t.createElement(dt,null,t.createElement(xt,{className:"overlay",lockScroll:!0},t.createElement(wt,{context:l},t.createElement("div",{className:"fixed bg-black/80 overflow-auto w-screen h-screen grid place-items-center"},t.createElement("div",{className:"bg-white p-4 inline-block rounded-md shadow-lg"},t.createElement("button",{onClick:function(){o(!1)}},"Close"),t.createElement("div",null,"Modal Content",t.createElement("div",null,t.createElement("input",{type:"text",autoFocus:!0})))))))))))};export{St as Modal,St as default};
|
|
5
|
+
*/var q=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[href]:not([inert])","button:not([inert])","[tabindex]:not(slot):not([inert])","audio[controls]:not([inert])","video[controls]:not([inert])",'[contenteditable]:not([contenteditable="false"]):not([inert])',"details>summary:first-of-type:not([inert])","details:not([inert])"].join(","),_="undefined"==typeof Element,U=_?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,$=!_&&Element.prototype.getRootNode?function(e){var t;return null==e||null===(t=e.getRootNode)||void 0===t?void 0:t.call(e)}:function(e){return null==e?void 0:e.ownerDocument},z=function e(t,n){var r;void 0===n&&(n=!0);var o=null==t||null===(r=t.getAttribute)||void 0===r?void 0:r.call(t,"inert");return""===o||"true"===o||n&&t&&e(t.parentNode)},X=function e(t,n,r){for(var o=[],i=Array.from(t);i.length;){var l=i.shift();if(!z(l,!1))if("SLOT"===l.tagName){var u=l.assignedElements(),c=e(u.length?u:l.children,!0,r);r.flatten?o.push.apply(o,c):o.push({scopeParent:l,candidates:c})}else{U.call(l,q)&&r.filter(l)&&(n||!t.includes(l))&&o.push(l);var s=l.shadowRoot||"function"==typeof r.getShadowRoot&&r.getShadowRoot(l),a=!z(s,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(l));if(s&&a){var f=e(!0===s?l.children:s.children,!0,r);r.flatten?o.push.apply(o,f):o.push({scopeParent:l,candidates:f})}else i.unshift.apply(i,l.children)}}return o},Y=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},K=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||function(e){var t,n=null==e||null===(t=e.getAttribute)||void 0===t?void 0:t.call(e,"contenteditable");return""===n||"true"===n}(e))&&!Y(e)?0:e.tabIndex},G=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},J=function(e){return"INPUT"===e.tagName},Q=function(e){return function(e){return J(e)&&"radio"===e.type}(e)&&!function(e){if(!e.name)return!0;var t,n=e.form||$(e),r=function(e){return n.querySelectorAll('input[type="radio"][name="'+e+'"]')};if("undefined"!=typeof window&&void 0!==window.CSS&&"function"==typeof window.CSS.escape)t=r(window.CSS.escape(e.name));else try{t=r(e.name)}catch(e){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",e.message),!1}var o=function(e,t){for(var n=0;n<e.length;n++)if(e[n].checked&&e[n].form===t)return e[n]}(t,e.form);return!o||o===e}(e)},Z=function(e){var t=e.getBoundingClientRect(),n=t.width,r=t.height;return 0===n&&0===r},ee=function(e,t){var n=t.displayCheck,r=t.getShadowRoot;if("hidden"===getComputedStyle(e).visibility)return!0;var o=U.call(e,"details>summary:first-of-type")?e.parentElement:e;if(U.call(o,"details:not([open]) *"))return!0;if(n&&"full"!==n&&"legacy-full"!==n){if("non-zero-area"===n)return Z(e)}else{if("function"==typeof r){for(var i=e;e;){var l=e.parentElement,u=$(e);if(l&&!l.shadowRoot&&!0===r(l))return Z(e);e=e.assignedSlot?e.assignedSlot:l||u===e.ownerDocument?l:u.host}e=i}if(function(e){var t,n,r,o,i=e&&$(e),l=null===(t=i)||void 0===t?void 0:t.host,u=!1;if(i&&i!==e)for(u=!!(null!==(n=l)&&void 0!==n&&null!==(r=n.ownerDocument)&&void 0!==r&&r.contains(l)||null!=e&&null!==(o=e.ownerDocument)&&void 0!==o&&o.contains(e));!u&&l;){var c,s,a;u=!(null===(s=l=null===(c=i=$(l))||void 0===c?void 0:c.host)||void 0===s||null===(a=s.ownerDocument)||void 0===a||!a.contains(l))}return u}(e))return!e.getClientRects().length;if("legacy-full"!==n)return!0}return!1},te=function(e,t){return!(t.disabled||z(t)||function(e){return J(e)&&"hidden"===e.type}(t)||ee(t,e)||function(e){return"DETAILS"===e.tagName&&Array.prototype.slice.apply(e.children).some((function(e){return"SUMMARY"===e.tagName}))}(t)||function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var t=e.parentElement;t;){if("FIELDSET"===t.tagName&&t.disabled){for(var n=0;n<t.children.length;n++){var r=t.children.item(n);if("LEGEND"===r.tagName)return!!U.call(t,"fieldset[disabled] *")||!r.contains(e)}return!0}t=t.parentElement}return!1}(t))},ne=function(e,t){return!(Q(t)||K(t)<0||!te(e,t))},re=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},oe=function e(t){var n=[],r=[];return t.forEach((function(t,o){var i=!!t.scopeParent,l=i?t.scopeParent:t,u=function(e,t){var n=K(e);return n<0&&t&&!Y(e)?0:n}(l,i),c=i?e(t.candidates):l;0===u?i?n.push.apply(n,c):n.push(l):r.push({documentOrder:o,tabIndex:u,item:t,isScope:i,content:c})})),r.sort(G).reduce((function(e,t){return t.isScope?e.push.apply(e,t.content):e.push(t.content),e}),[]).concat(n)},ie=function(e,t){var n;return n=(t=t||{}).getShadowRoot?X([e],t.includeContainer,{filter:ne.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:re}):function(e,t,n){if(z(e))return[];var r=Array.prototype.slice.apply(e.querySelectorAll(q));return t&&U.call(e,q)&&r.unshift(e),r.filter(n)}(e,t.includeContainer,ne.bind(null,t)),oe(n)},le=function(e,t){if(t=t||{},!e)throw new Error("No node provided");return!1!==U.call(e,q)&&ne(t,e)};function ue(e,t,n){let{reference:r,floating:o}=e;const i=B(t),l=function(e){return"x"===B(e)?"y":"x"}(t),u="y"===l?"height":"width";const c=V(t),s="y"===i,a=r.x+r.width/2-o.width/2,f=r.y+r.height/2-o.height/2,d=r[u]/2-o[u]/2;let p;switch(c){case"top":p={x:a,y:r.y-o.height};break;case"bottom":p={x:a,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:f};break;case"left":p={x:r.x-o.width,y:f};break;default:p={x:r.x,y:r.y}}switch(function(e){return e.split("-")[1]}(t)){case"start":p[l]-=d*(n&&s?-1:1);break;case"end":p[l]+=d*(n&&s?-1:1)}return p}function ce(e){const t=w(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=f(e),i=o?e.offsetWidth:n,l=o?e.offsetHeight:r,u=W(n)!==i||W(r)!==l;return u&&(n=i,r=l),{width:n,height:r,$:u}}function se(e){return a(e)?e:e.contextElement}function ae(e){const t=se(e);if(!f(t))return j(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=ce(t);let l=(i?W(n.width):n.width)/r,u=(i?W(n.height):n.height)/o;return l&&Number.isFinite(l)||(l=1),u&&Number.isFinite(u)||(u=1),{x:l,y:u}}const fe=j(0);function de(e){const t=u(e);return g()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:fe}function pe(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);const o=e.getBoundingClientRect(),i=se(e);let l=j(1);t&&(r?a(r)&&(l=ae(r)):l=ae(e));const c=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==u(e))&&t}(i,n,r)?de(i):j(0);let s=(o.left+c.x)/l.x,f=(o.top+c.y)/l.y,d=o.width/l.x,p=o.height/l.y;if(i){const e=u(i),t=r&&a(r)?u(r):r;let n=e,o=n.frameElement;for(;o&&r&&t!==n;){const e=ae(o),t=o.getBoundingClientRect(),r=w(o),i=t.left+(o.clientLeft+parseFloat(r.paddingLeft))*e.x,l=t.top+(o.clientTop+parseFloat(r.paddingTop))*e.y;s*=e.x,f*=e.y,d*=e.x,p*=e.y,s+=i,f+=l,n=u(o),o=n.frameElement}}return H({width:d,height:p,x:s,y:f})}function me(e){return pe(c(e)).left+b(e).scrollLeft}function he(e,t,n){let r;if("viewport"===t)r=function(e,t){const n=u(e),r=c(e),o=n.visualViewport;let i=r.clientWidth,l=r.clientHeight,s=0,a=0;if(o){i=o.width,l=o.height;const e=g();(!e||e&&"fixed"===t)&&(s=o.offsetLeft,a=o.offsetTop)}return{width:i,height:l,x:s,y:a}}(e,n);else if("document"===t)r=function(e){const t=c(e),n=b(e),r=e.ownerDocument.body,o=P(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=P(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let l=-n.scrollLeft+me(e);const u=-n.scrollTop;return"rtl"===w(r).direction&&(l+=P(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:l,y:u}}(c(e));else if(a(t))r=function(e,t){const n=pe(e,!0,"fixed"===t),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=f(e)?ae(e):j(1);return{width:e.clientWidth*i.x,height:e.clientHeight*i.y,x:o*i.x,y:r*i.y}}(t,n);else{const n=de(e);r={...t,x:t.x-n.x,y:t.y-n.y}}return H(r)}function ve(e,t){const n=x(e);return!(n===t||!a(n)||y(n))&&("fixed"===w(n).position||ve(n,t))}function ge(e,t,n){const r=f(t),o=c(t),i="fixed"===n,u=pe(e,!0,i,t);let s={scrollLeft:0,scrollTop:0};const a=j(0);if(r||!r&&!i)if(("body"!==l(t)||p(o))&&(s=b(t)),r){const e=pe(t,!0,i,t);a.x=e.x+t.clientLeft,a.y=e.y+t.clientTop}else o&&(a.x=me(o));return{x:u.left+s.scrollLeft-a.x,y:u.top+s.scrollTop-a.y,width:u.width,height:u.height}}function ye(e){return"static"===w(e).position}function we(e,t){return f(e)&&"fixed"!==w(e).position?t?t(e):e.offsetParent:null}function be(e,t){const n=u(e);if(h(e))return n;if(!f(e)){let t=x(e);for(;t&&!y(t);){if(a(t)&&!ye(t))return t;t=x(t)}return n}let r=we(e,t);for(;r&&m(r)&&ye(r);)r=we(r,t);return r&&y(r)&&ye(r)&&!v(r)?n:r||function(e){let t=x(e);for(;f(t)&&!y(t);){if(v(t))return t;if(h(t))return null;t=x(t)}return null}(e)||n}const xe={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i="fixed"===o,u=c(r),s=!!t&&h(t.floating);if(r===u||s&&i)return n;let a={scrollLeft:0,scrollTop:0},d=j(1);const m=j(0),v=f(r);if((v||!v&&!i)&&(("body"!==l(r)||p(u))&&(a=b(r)),f(r))){const e=pe(r);d=ae(r),m.x=e.x+r.clientLeft,m.y=e.y+r.clientTop}return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-a.scrollLeft*d.x+m.x,y:n.y*d.y-a.scrollTop*d.y+m.y}},getDocumentElement:c,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[..."clippingAncestors"===n?h(t)?[]:function(e,t){const n=t.get(e);if(n)return n;let r=R(e,[],!1).filter((e=>a(e)&&"body"!==l(e))),o=null;const i="fixed"===w(e).position;let u=i?x(e):e;for(;a(u)&&!y(u);){const t=w(u),n=v(u);n||"fixed"!==t.position||(o=null),(i?!n&&!o:!n&&"static"===t.position&&o&&["absolute","fixed"].includes(o.position)||p(u)&&!n&&ve(e,u))?r=r.filter((e=>e!==u)):o=t,u=x(u)}return t.set(e,r),r}(t,this._c):[].concat(n),r],u=i[0],c=i.reduce(((e,n)=>{const r=he(t,n,o);return e.top=P(r.top,e.top),e.right=F(r.right,e.right),e.bottom=F(r.bottom,e.bottom),e.left=P(r.left,e.left),e}),he(t,u,o));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}},getOffsetParent:be,getElementRects:async function(e){const t=this.getOffsetParent||be,n=this.getDimensions,r=await n(e.floating);return{reference:ge(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){const{width:t,height:n}=ce(e);return{width:t,height:n}},getScale:ae,isElement:a,isRTL:function(e){return"rtl"===w(e).direction}},Ee=(e,t,n)=>{const r=new Map,o={platform:xe,...n},i={...o.platform,_c:r};return(async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:l}=n,u=i.filter(Boolean),c=await(null==l.isRTL?void 0:l.isRTL(t));let s=await l.getElementRects({reference:e,floating:t,strategy:o}),{x:a,y:f}=ue(s,r,c),d=r,p={},m=0;for(let n=0;n<u.length;n++){const{name:i,fn:h}=u[n],{x:v,y:g,data:y,reset:w}=await h({x:a,y:f,initialPlacement:r,placement:d,strategy:o,middlewareData:p,rects:s,platform:l,elements:{reference:e,floating:t}});a=null!=v?v:a,f=null!=g?g:f,p={...p,[i]:{...p[i],...y}},w&&m<=50&&(m++,"object"==typeof w&&(w.placement&&(d=w.placement),w.rects&&(s=!0===w.rects?await l.getElementRects({reference:e,floating:t,strategy:o}):w.rects),({x:a,y:f}=ue(s,d,c))),n=-1)}return{x:a,y:f,placement:d,strategy:o,middlewareData:p}})(e,t,{...o,platform:i})};var Re="undefined"!=typeof document?n:r;function Se(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;0!=r--;)if(!Se(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;0!=r--;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;0!=r--;){const n=o[r];if(("_owner"!==n||!e.$$typeof)&&!Se(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function Ce(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Oe(e,t){const n=Ce(e);return Math.round(t*n)/n}function Te(t){const n=e.useRef(t);return Re((()=>{n.current=t})),n}const Ne={...e},Le=Ne.useInsertionEffect||(e=>e());function Ae(t){const n=e.useRef((()=>{if("production"!==process.env.NODE_ENV)throw new Error("Cannot call an event handler while rendering.")}));return Le((()=>{n.current=t})),e.useCallback((function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return null==n.current?void 0:n.current(...t)}),[])}let ke=0;function Me(e,t){void 0===t&&(t={});const{preventScroll:n=!1,cancelPrevious:r=!0,sync:o=!1}=t;r&&cancelAnimationFrame(ke);const i=()=>null==e?void 0:e.focus({preventScroll:n});o?i():ke=requestAnimationFrame(i)}var Ie="undefined"!=typeof document?n:r;function De(){return De=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},De.apply(this,arguments)}let Fe=!1,Pe=0;const We=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+Pe++;const je=Ne.useId||function(){const[t,n]=e.useState((()=>Fe?We():void 0));return Ie((()=>{null==t&&n(We())}),[]),e.useEffect((()=>{Fe=!0}),[]),t};let Ve;"production"!==process.env.NODE_ENV&&(Ve=new Set);const Be=e.createContext(null),He=e.createContext(null),qe=()=>{var t;return(null==(t=e.useContext(Be))?void 0:t.id)||null},_e=()=>e.useContext(He);function Ue(e){return"data-floating-ui-"+e}function $e(e){const t=o(e);return Ie((()=>{t.current=e})),t}function ze(e,t){let n=e.filter((e=>{var n;return e.parentId===t&&(null==(n=e.context)?void 0:n.open)})),r=n;for(;r.length;)r=e.filter((e=>{var t;return null==(t=r)?void 0:t.some((t=>{var n;return e.parentId===t.id&&(null==(n=e.context)?void 0:n.open)}))})),n=n.concat(r);return n}let Xe=new WeakMap,Ye=new WeakSet,Ke={},Ge=0;const Je=e=>e&&(e.host||Je(e.parentNode)),Qe=(e,t)=>t.map((t=>{if(e.contains(t))return t;const n=Je(t);return e.contains(n)?n:null})).filter((e=>null!=e));function Ze(e,t,n){void 0===t&&(t=!1),void 0===n&&(n=!1);const r=A(e[0]).body;return function(e,t,n,r){const o="data-floating-ui-inert",i=r?"inert":n?"aria-hidden":null,u=Qe(t,e),c=new Set,s=new Set(u),a=[];Ke[o]||(Ke[o]=new WeakMap);const f=Ke[o];return u.forEach((function e(t){t&&!c.has(t)&&(c.add(t),t.parentNode&&e(t.parentNode))})),function e(t){t&&!s.has(t)&&[].forEach.call(t.children,(t=>{if("script"!==l(t))if(c.has(t))e(t);else{const e=i?t.getAttribute(i):null,n=null!==e&&"false"!==e,r=(Xe.get(t)||0)+1,l=(f.get(t)||0)+1;Xe.set(t,r),f.set(t,l),a.push(t),1===r&&n&&Ye.add(t),1===l&&t.setAttribute(o,""),!n&&i&&t.setAttribute(i,"true")}}))}(t),c.clear(),Ge++,()=>{a.forEach((e=>{const t=(Xe.get(e)||0)-1,n=(f.get(e)||0)-1;Xe.set(e,t),f.set(e,n),t||(!Ye.has(e)&&i&&e.removeAttribute(i),Ye.delete(e)),n||e.removeAttribute(o)})),Ge--,Ge||(Xe=new WeakMap,Xe=new WeakMap,Ye=new WeakSet,Ke={})}}(e.concat(Array.from(r.querySelectorAll("[aria-live]"))),r,t,n)}const et=()=>({getShadowRoot:!0,displayCheck:"function"==typeof ResizeObserver&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function tt(e,t){const n=ie(e,et());"prev"===t&&n.reverse();const r=n.indexOf(S(A(e)));return n.slice(r+1)[0]}function nt(){return tt(document.body,"next")}function rt(){return tt(document.body,"prev")}function ot(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!C(n,r)}function it(e){ie(e,et()).forEach((e=>{e.dataset.tabindex=e.getAttribute("tabindex")||"",e.setAttribute("tabindex","-1")}))}function lt(e){e.querySelectorAll("[data-tabindex]").forEach((e=>{const t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute("tabindex",t):e.removeAttribute("tabindex")}))}const ut={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0};function ct(e){"Tab"===e.key&&(e.target,clearTimeout(undefined))}const st=e.forwardRef((function(t,n){const[r,o]=e.useState();Ie((()=>(/apple/i.test(navigator.vendor)&&o("button"),document.addEventListener("keydown",ct),()=>{document.removeEventListener("keydown",ct)})),[]);const i={ref:n,tabIndex:0,role:r,"aria-hidden":!r||void 0,[Ue("focus-guard")]:"",style:ut};return e.createElement("span",De({},t,i))})),at=e.createContext(null),ft=Ue("portal");function dt(t){const{children:n,id:r,root:o=null,preserveTabOrder:l=!0}=t,u=function(t){void 0===t&&(t={});const{id:n,root:r}=t,o=je(),i=pt(),[l,u]=e.useState(null),c=e.useRef(null);return Ie((()=>()=>{null==l||l.remove(),queueMicrotask((()=>{c.current=null}))}),[l]),Ie((()=>{if(!o)return;if(c.current)return;const e=n?document.getElementById(n):null;if(!e)return;const t=document.createElement("div");t.id=o,t.setAttribute(ft,""),e.appendChild(t),c.current=t,u(t)}),[n,o]),Ie((()=>{if(!o)return;if(c.current)return;let e=r||(null==i?void 0:i.portalNode);e&&!a(e)&&(e=e.current),e=e||document.body;let t=null;n&&(t=document.createElement("div"),t.id=n,e.appendChild(t));const l=document.createElement("div");l.id=o,l.setAttribute(ft,""),e=t||e,e.appendChild(l),c.current=l,u(l)}),[n,r,o,i]),l}({id:r,root:o}),[c,s]=e.useState(null),f=e.useRef(null),d=e.useRef(null),p=e.useRef(null),m=e.useRef(null),h=!!c&&!c.modal&&c.open&&l&&!(!o&&!u);return e.useEffect((()=>{if(u&&l&&(null==c||!c.modal))return u.addEventListener("focusin",e,!0),u.addEventListener("focusout",e,!0),()=>{u.removeEventListener("focusin",e,!0),u.removeEventListener("focusout",e,!0)};function e(e){if(u&&ot(e)){("focusin"===e.type?lt:it)(u)}}}),[u,l,null==c?void 0:c.modal]),e.createElement(at.Provider,{value:e.useMemo((()=>({preserveTabOrder:l,beforeOutsideRef:f,afterOutsideRef:d,beforeInsideRef:p,afterInsideRef:m,portalNode:u,setFocusManagerState:s})),[l,u])},h&&u&&e.createElement(st,{"data-type":"outside",ref:f,onFocus:e=>{if(ot(e,u)){var t;null==(t=p.current)||t.focus()}else{const e=rt()||(null==c?void 0:c.refs.domReference.current);null==e||e.focus()}}}),h&&u&&e.createElement("span",{"aria-owns":u.id,style:ut}),u&&i.createPortal(n,u),h&&u&&e.createElement(st,{"data-type":"outside",ref:d,onFocus:e=>{if(ot(e,u)){var t;null==(t=m.current)||t.focus()}else{const t=nt()||(null==c?void 0:c.refs.domReference.current);null==t||t.focus(),(null==c?void 0:c.closeOnFocusOut)&&(null==c||c.onOpenChange(!1,e.nativeEvent))}}}))}const pt=()=>e.useContext(at),mt=20;let ht=[];function vt(e){ht=ht.filter((e=>e.isConnected));let t=e;if(t&&"body"!==l(t)){if(!le(t,et())){const e=ie(t,et())[0];e&&(t=e)}ht.push(t),ht.length>mt&&(ht=ht.slice(-mt))}}function gt(){return ht.slice().reverse().find((e=>e.isConnected))}const yt=e.forwardRef((function(t,n){return e.createElement("button",De({},t,{type:"button",ref:n,tabIndex:-1,style:ut}))}));function wt(t){const{context:n,children:r,disabled:o=!1,order:i=["content"],guards:l=!0,initialFocus:u=0,returnFocus:c=!0,restoreFocus:s=!1,modal:a=!0,visuallyHiddenDismiss:d=!1,closeOnFocusOut:p=!0}=t,{open:m,refs:h,nodeId:v,onOpenChange:g,events:y,dataRef:w,floatingId:b,elements:{domReference:x,floating:E}}=n,R="number"==typeof u&&u<0,O=D(x)&&R,T="undefined"==typeof HTMLElement||!("inert"in HTMLElement.prototype)||l,M=$e(i),F=$e(u),P=$e(c),W=_e(),j=pt(),V=e.useRef(null),B=e.useRef(null),H=e.useRef(!1),q=e.useRef(!1),_=e.useRef(-1),U=null!=j,$=null==E?void 0:E.firstElementChild,z=(null==$?void 0:$.id)===b?$:E,X=Ae((function(e){return void 0===e&&(e=z),e?ie(e,et()):[]})),Y=Ae((e=>{const t=X(e);return M.current.map((e=>x&&"reference"===e?x:z&&"floating"===e?z:t)).filter(Boolean).flat()}));function K(t){return!o&&d&&a?e.createElement(yt,{ref:"start"===t?V:B,onClick:e=>g(!1,e.nativeEvent)},"string"==typeof d?d:"Dismiss"):null}e.useEffect((()=>{if(o)return;if(!a)return;function e(e){if("Tab"===e.key){C(z,S(A(z)))&&0===X().length&&!O&&I(e);const t=Y(),n=k(e);"reference"===M.current[0]&&n===x&&(I(e),e.shiftKey?Me(t[t.length-1]):Me(t[1])),"floating"===M.current[1]&&n===z&&e.shiftKey&&(I(e),Me(t[0]))}}const t=A(z);return t.addEventListener("keydown",e),()=>{t.removeEventListener("keydown",e)}}),[o,x,z,a,M,O,X,Y]),e.useEffect((()=>{if(!o&&E)return E.addEventListener("focusin",e),()=>{E.removeEventListener("focusin",e)};function e(e){const t=k(e),n=X().indexOf(t);-1!==n&&(_.current=n)}}),[o,E,X]),e.useEffect((()=>{if(!o&&p)return E&&f(x)?(x.addEventListener("focusout",t),x.addEventListener("pointerdown",e),E.addEventListener("focusout",t),()=>{x.removeEventListener("focusout",t),x.removeEventListener("pointerdown",e),E.removeEventListener("focusout",t)}):void 0;function e(){q.current=!0,setTimeout((()=>{q.current=!1}))}function t(e){const t=e.relatedTarget;queueMicrotask((()=>{const n=!(C(x,t)||C(E,t)||C(t,E)||C(null==j?void 0:j.portalNode,t)||null!=t&&t.hasAttribute(Ue("focus-guard"))||W&&(ze(W.nodesRef.current,v).find((e=>{var n,r;return C(null==(n=e.context)?void 0:n.elements.floating,t)||C(null==(r=e.context)?void 0:r.elements.domReference,t)}))||function(e,t){var n;let r=[],o=null==(n=e.find((e=>e.id===t)))?void 0:n.parentId;for(;o;){const t=e.find((e=>e.id===o));o=null==t?void 0:t.parentId,t&&(r=r.concat(t))}return r}(W.nodesRef.current,v).find((e=>{var n,r;return(null==(n=e.context)?void 0:n.elements.floating)===t||(null==(r=e.context)?void 0:r.elements.domReference)===t}))));if(s&&n&&S(A(z))===A(z).body){f(z)&&(null==z||z.focus());const e=_.current,t=X(),n=t[e]||t[t.length-1]||z;f(n)&&n.focus()}!O&&a||!t||!n||q.current||t===gt()||(H.current=!0,g(!1,e))}))}}),[o,x,E,z,a,v,W,j,g,p,s,X,O]),e.useEffect((()=>{var e;if(o)return;const t=Array.from((null==j||null==(e=j.portalNode)?void 0:e.querySelectorAll("["+Ue("portal")+"]"))||[]);if(E){const e=[E,...t,V.current,B.current,M.current.includes("reference")||O?x:null].filter((e=>null!=e)),n=a||O?Ze(e,T,!T):Ze(e);return()=>{n()}}}),[o,x,E,a,M,j,O,T]),Ie((()=>{if(o||!f(z))return;const e=S(A(z));queueMicrotask((()=>{const t=Y(z),n=F.current,r=("number"==typeof n?t[n]:n.current)||z,o=C(z,e);R||o||!m||Me(r,{preventScroll:r===z})}))}),[o,m,z,R,Y,F]),Ie((()=>{if(o||!z)return;let e=!1;const t=A(z),n=S(t);let r=w.current.openEvent;const i=h.domReference.current;function l(t){let{open:n,reason:o,event:i,nested:l}=t;n&&(r=i),"escape-key"===o&&h.domReference.current&&vt(h.domReference.current),"hover"===o&&"mouseleave"===i.type&&(H.current=!0),"outside-press"===o&&(l?(H.current=!1,e=!0):H.current=!(function(e){return!(0!==e.mozInputSource||!e.isTrusted)||(L()&&e.pointerType?"click"===e.type&&1===e.buttons:0===e.detail&&!e.pointerType)}(i)||N(i)))}return vt(n),y.on("openchange",l),()=>{y.off("openchange",l);const o=S(t),u=C(E,o)||W&&ze(W.nodesRef.current,v).some((e=>{var t;return C(null==(t=e.context)?void 0:t.elements.floating,o)}));(u||r&&["click","mousedown"].includes(r.type))&&h.domReference.current&&vt(h.domReference.current);const c=i||n,s=ie(A(c).body,et());queueMicrotask((()=>{let n=gt();!n&&f(c)&&E&&(n=function(e,t,n){const r=e.indexOf(t);function o(t){const o=Ue("focus-guard");let i=r+(t?1:0),l=e[i];for(;l&&(!l.isConnected||l.hasAttribute(o)||C(n,l));)t?i++:i--,l=e[i];return l}return o(!0)||o(!1)}(s,c,E)),P.current&&!H.current&&f(n)&&(n===o||o===t.body||u)&&n.focus({preventScroll:e})}))}}),[o,E,z,P,w,h,y,W,v]),Ie((()=>{if(!o&&j)return j.setFocusManagerState({modal:a,closeOnFocusOut:p,open:m,onOpenChange:g,refs:h}),()=>{j.setFocusManagerState(null)}}),[o,j,a,m,g,h,p]),Ie((()=>{if(o)return;if(!z)return;if("function"!=typeof MutationObserver)return;if(R)return;const e=()=>{const e=z.getAttribute("tabindex"),t=X(),n=S(A(E)),r=t.indexOf(n);-1!==r&&(_.current=r),M.current.includes("floating")||n!==h.domReference.current&&0===t.length?"0"!==e&&z.setAttribute("tabindex","0"):"-1"!==e&&z.setAttribute("tabindex","-1")};e();const t=new MutationObserver(e);return t.observe(z,{childList:!0,subtree:!0,attributes:!0}),()=>{t.disconnect()}}),[o,E,z,h,M,X,R]);const G=!o&&T&&(!a||!O)&&(U||a);return e.createElement(e.Fragment,null,G&&e.createElement(st,{"data-type":"inside",ref:null==j?void 0:j.beforeInsideRef,onFocus:e=>{if(a){const e=Y();Me("reference"===i[0]?e[0]:e[e.length-1])}else if(null!=j&&j.preserveTabOrder&&j.portalNode)if(H.current=!1,ot(e,j.portalNode)){const e=nt()||x;null==e||e.focus()}else{var t;null==(t=j.beforeOutsideRef.current)||t.focus()}}}),!O&&K("start"),r,K("end"),G&&e.createElement(st,{"data-type":"inside",ref:null==j?void 0:j.afterInsideRef,onFocus:e=>{if(a)Me(Y()[0]);else if(null!=j&&j.preserveTabOrder&&j.portalNode)if(p&&(H.current=!0),ot(e,j.portalNode)){const e=rt()||x;null==e||e.focus()}else{var t;null==(t=j.afterOutsideRef.current)||t.focus()}}}))}const bt=new Set,xt=e.forwardRef((function(t,n){const{lockScroll:r=!1,...o}=t,i=je();return Ie((()=>{if(!r)return;bt.add(i);const e=/iP(hone|ad|od)|iOS/.test(O()),t=document.body.style,n=Math.round(document.documentElement.getBoundingClientRect().left)+document.documentElement.scrollLeft?"paddingLeft":"paddingRight",o=window.innerWidth-document.documentElement.clientWidth,l=t.left?parseFloat(t.left):window.scrollX,u=t.top?parseFloat(t.top):window.scrollY;if(t.overflow="hidden",o&&(t[n]=o+"px"),e){var c,s;const e=(null==(c=window.visualViewport)?void 0:c.offsetLeft)||0,n=(null==(s=window.visualViewport)?void 0:s.offsetTop)||0;Object.assign(t,{position:"fixed",top:-(u-Math.floor(n))+"px",left:-(l-Math.floor(e))+"px",right:"0"})}return()=>{bt.delete(i),0===bt.size&&(Object.assign(t,{overflow:"",[n]:""}),e&&(Object.assign(t,{position:"",top:"",left:"",right:""}),window.scrollTo(l,u)))}}),[i,r]),e.createElement("div",De({ref:n},o,{style:{position:"fixed",overflow:"auto",top:0,right:0,bottom:0,left:0,...o.style}}))}));function Et(t){const{open:n=!1,onOpenChange:r,elements:o}=t,i=je(),l=e.useRef({}),[u]=e.useState((()=>function(){const e=new Map;return{emit(t,n){var r;null==(r=e.get(t))||r.forEach((e=>e(n)))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){var r;e.set(t,(null==(r=e.get(t))?void 0:r.filter((e=>e!==n)))||[])}}}())),c=null!=qe();if("production"!==process.env.NODE_ENV){const e=o.reference;e&&!a(e)&&function(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];const o="Floating UI: "+n.join(" ");var i;null!=(e=Ve)&&e.has(o)||(null==(i=Ve)||i.add(o),console.error(o))}("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `refs.setPositionReference()`","instead.")}const[s,f]=e.useState(o.reference),d=Ae(((e,t,n)=>{l.current.openEvent=e?t:void 0,u.emit("openchange",{open:e,event:t,reason:n,nested:c}),null==r||r(e,t,n)})),p=e.useMemo((()=>({setPositionReference:f})),[]),m=e.useMemo((()=>({reference:s||o.reference||null,floating:o.floating||null,domReference:o.reference})),[s,o.reference,o.floating]);return e.useMemo((()=>({dataRef:l,open:n,onOpenChange:d,elements:m,events:u,floatingId:i,refs:p})),[n,d,m,u,i,p])}function Rt(t){void 0===t&&(t={});const{nodeId:n}=t,r=Et({...t,elements:{reference:null,floating:null,...t.elements}}),o=t.rootContext||r,l=o.elements,[u,c]=e.useState(null),[s,f]=e.useState(null),d=(null==l?void 0:l.reference)||u,p=e.useRef(null),m=_e();Ie((()=>{d&&(p.current=d)}),[d]);const h=function(t){void 0===t&&(t={});const{placement:n="bottom",strategy:r="absolute",middleware:o=[],platform:l,elements:{reference:u,floating:c}={},transform:s=!0,whileElementsMounted:a,open:f}=t,[d,p]=e.useState({x:0,y:0,strategy:r,placement:n,middlewareData:{},isPositioned:!1}),[m,h]=e.useState(o);Se(m,o)||h(o);const[v,g]=e.useState(null),[y,w]=e.useState(null),b=e.useCallback((e=>{e!==S.current&&(S.current=e,g(e))}),[]),x=e.useCallback((e=>{e!==C.current&&(C.current=e,w(e))}),[]),E=u||v,R=c||y,S=e.useRef(null),C=e.useRef(null),O=e.useRef(d),T=null!=a,N=Te(a),L=Te(l),A=e.useCallback((()=>{if(!S.current||!C.current)return;const e={placement:n,strategy:r,middleware:m};L.current&&(e.platform=L.current),Ee(S.current,C.current,e).then((e=>{const t={...e,isPositioned:!0};k.current&&!Se(O.current,t)&&(O.current=t,i.flushSync((()=>{p(t)})))}))}),[m,n,r,L]);Re((()=>{!1===f&&O.current.isPositioned&&(O.current.isPositioned=!1,p((e=>({...e,isPositioned:!1}))))}),[f]);const k=e.useRef(!1);Re((()=>(k.current=!0,()=>{k.current=!1})),[]),Re((()=>{if(E&&(S.current=E),R&&(C.current=R),E&&R){if(N.current)return N.current(E,R,A);A()}}),[E,R,A,N,T]);const M=e.useMemo((()=>({reference:S,floating:C,setReference:b,setFloating:x})),[b,x]),I=e.useMemo((()=>({reference:E,floating:R})),[E,R]),D=e.useMemo((()=>{const e={position:r,left:0,top:0};if(!I.floating)return e;const t=Oe(I.floating,d.x),n=Oe(I.floating,d.y);return s?{...e,transform:"translate("+t+"px, "+n+"px)",...Ce(I.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:t,top:n}}),[r,s,I.floating,d.x,d.y]);return e.useMemo((()=>({...d,update:A,refs:M,elements:I,floatingStyles:D})),[d,A,M,I,D])}({...t,elements:{...l,...s&&{reference:s}}}),v=e.useCallback((e=>{const t=a(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:e}:e;f(t),h.refs.setReference(t)}),[h.refs]),g=e.useCallback((e=>{(a(e)||null===e)&&(p.current=e,c(e)),(a(h.refs.reference.current)||null===h.refs.reference.current||null!==e&&!a(e))&&h.refs.setReference(e)}),[h.refs]),y=e.useMemo((()=>({...h.refs,setReference:g,setPositionReference:v,domReference:p})),[h.refs,g,v]),w=e.useMemo((()=>({...h.elements,domReference:d})),[h.elements,d]),b=e.useMemo((()=>({...h,...o,refs:y,elements:w,nodeId:n})),[h,y,w,n,o]);return Ie((()=>{o.dataRef.current.floatingContext=b;const e=null==m?void 0:m.nodesRef.current.find((e=>e.id===n));e&&(e.context=b)})),e.useMemo((()=>({...h,context:b,refs:y,elements:w})),[h,y,w,b])}var St=function(e){var n=e.open,r=void 0===n||n,o=e.onClose,i=e.children,l=Rt().context;return t.createElement("div",{className:"modal"},t.createElement("div",{className:"modal__content"},t.createElement("div",null,i),t.createElement("div",null,r&&t.createElement(dt,null,t.createElement(xt,{className:"overlay",lockScroll:!0},t.createElement(wt,{context:l},t.createElement("div",{className:"fixed bg-black/80 overflow-auto w-screen h-screen grid place-items-center"},t.createElement("div",{className:"bg-white p-4 inline-block rounded-md shadow-lg"},t.createElement("button",{onClick:function(){o(!1)}},"Close"),t.createElement("div",null,"Modal Content",t.createElement("div",null,t.createElement("input",{type:"text",autoFocus:!0})))))))))))};export{St as Modal,St as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use client';import e,{useState as r}from"react";var t=function(){return t=Object.assign||function(e){for(var r,t=1,
|
|
1
|
+
'use client';import e,{useState as r}from"react";var t=function(){return t=Object.assign||function(e){for(var r,t=1,a=arguments.length;t<a;t++)for(var o in r=arguments[t])Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o]);return e},t.apply(this,arguments)};function a(e,r){var t={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&r.indexOf(a)<0&&(t[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(a=Object.getOwnPropertySymbols(e);o<a.length;o++)r.indexOf(a[o])<0&&Object.prototype.propertyIsEnumerable.call(e,a[o])&&(t[a[o]]=e[a[o]])}return t}"function"==typeof SuppressedError&&SuppressedError;var o=function(r){var o=r.role,n=void 0===o?"button":o,i=r.label,s=void 0===i?"":i,l=r.description,d=void 0===l?"":l,c=r.disabled,p=void 0!==c&&c,u=r.children,f=a(r,["role","label","description","disabled","children"]);return s&&(f["aria-label"]=s),d&&(f["aria-description"]=d),p&&(f["aria-disabled"]="true",d||(f["aria-description"]="Disabled Button")),e.createElement("button",t({role:n,disabled:p},f),u)},n="Toggle",i=function(i){var s=i.defaultPressed,l=i.customRootClass,d=void 0===l?"":l,c=i.children;i.className;var p=i.pressed,u=i.onChange,f=a(i,["defaultPressed","customRootClass","children","className","pressed","onChange"]),b=function(e,r){void 0===e&&(e=""),void 0===r&&(r="");var t=r.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();return e||(r?"".concat("rad-ui","-").concat(t):"")}(d,n),v=r(p||s),y=v[0],m=v[1];return e.createElement(o,t({className:"".concat(b),onClick:function(){var e=!y;m(e),u(e)},"data-state":y?"on":"off",type:"button","data-disabled":f.disabled?"":void 0,"aria-pressed":p},f),c)};i.displayName=n;export{i as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use client';import e,{createContext as t,useState as
|
|
1
|
+
'use client';import e,{createContext as t,useState as r,useContext as o}from"react";var l=t({}),n=function(t){var o=t.type,n=void 0===o?"multiple":o,i=t.className,a=void 0===i?"":i,c=t.customRootClass,u=void 0===c?"":c,s=t.componentName,d=void 0===s?"":s,v=t.value,p=void 0===v?null:v,f=t.children,g=function(e,t){void 0===e&&(e=""),void 0===t&&(t="");var r=t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();return e||(t?"".concat("rad-ui","-").concat(r):"")}(u,d),m=r(p||[]),y=m[0],b=m[1];return e.createElement("div",{className:"".concat(g," ").concat(a),role:"group"},e.createElement(l.Provider,{value:{activeToggles:y,setActiveToggles:b,type:n}},f))},i=function(){return i=Object.assign||function(e){for(var t,r=1,o=arguments.length;r<o;r++)for(var l in t=arguments[r])Object.prototype.hasOwnProperty.call(t,l)&&(e[l]=t[l]);return e},i.apply(this,arguments)};function a(e,t){var r={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(r[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var l=0;for(o=Object.getOwnPropertySymbols(e);l<o.length;l++)t.indexOf(o[l])<0&&Object.prototype.propertyIsEnumerable.call(e,o[l])&&(r[o[l]]=e[o[l]])}return r}function c(e,t,r){if(r||2===arguments.length)for(var o,l=0,n=t.length;l<n;l++)!o&&l in t||(o||(o=Array.prototype.slice.call(t,0,l)),o[l]=t[l]);return e.concat(o||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var u=function(t){var r=t.role,o=void 0===r?"button":r,l=t.label,n=void 0===l?"":l,c=t.description,u=void 0===c?"":c,s=t.disabled,d=void 0!==s&&s,v=t.children,p=a(t,["role","label","description","disabled","children"]);return n&&(p["aria-label"]=n),u&&(p["aria-description"]=u),d&&(p["aria-disabled"]="true",u||(p["aria-description"]="Disabled Button")),e.createElement("button",i({role:o,disabled:d},p),v)},s=function(t){var r,n=t.children,s=t.value,d=void 0===s?null:s,v=a(t,["children","value"]),p=o(l),f=null==p?void 0:p.type,g=null===(r=null==p?void 0:p.activeToggles)||void 0===r?void 0:r.includes(d);return v["aria-pressed"]=g?"true":"false",e.createElement(u,i({className:"".concat(g?"bg-blue-600":""),onClick:function(){!function(){var e=(null==p?void 0:p.activeToggles)||[];if("single"===f)return g?void(null==p||p.setActiveToggles([])):void(null==p||p.setActiveToggles([d]));"multiple"===f&&(e=g?e.filter((function(e){return e!==d})):c(c([],e,!0),[d],!1)),null==p||p.setActiveToggles(e)}()}},v),n)},d="ToggleGroup",v=function(t){var r=t.type,o=void 0===r?"single":r,l=t.items,i=void 0===l?[]:l;return e.createElement(n,{type:o,componentName:d},i.map((function(t,r){return e.createElement(s,{key:r,value:t.value},t.label)})))};v.displayName=d,v.Root=n,v.Item=s;export{v as default};
|