UNPKG

@abhnvrmn99/react-input-phone-number

Version:

An opinionated and styled phone number input component for react.

34 lines 316 kB
"use strict";var e=require("react"),t=require("react-dom");function n(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var r=n(e),o=n(t);function a(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var i,d={exports:{}},s={};var l,u,c={}; /** * @license React * react-jsx-runtime.development.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */function f(){return l||(l=1,"production"!==process.env.NODE_ENV&&function(){var t=e,n=Symbol.for("react.element"),r=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),d=Symbol.for("react.provider"),s=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),f=Symbol.for("react.suspense_list"),p=Symbol.for("react.memo"),$=Symbol.for("react.lazy"),h=Symbol.for("react.offscreen"),m=Symbol.iterator;var g=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function y(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];!function(e,t,n){var r=g.ReactDebugCurrentFrame,o=r.getStackAddendum();""!==o&&(t+="%s",n=n.concat([o]));var a=n.map((function(e){return String(e)}));a.unshift("Warning: "+t),Function.prototype.apply.call(console[e],console,a)}("error",e,n)}var v;function b(e){return e.displayName||"Context"}function w(e){if(null==e)return null;if("number"==typeof e.tag&&y("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),"function"==typeof e)return e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case o:return"Fragment";case r:return"Portal";case i:return"Profiler";case a:return"StrictMode";case u:return"Suspense";case f:return"SuspenseList"}if("object"==typeof e)switch(e.$$typeof){case s:return b(e)+".Consumer";case d:return b(e._context)+".Provider";case l:return function(e,t,n){var r=e.displayName;if(r)return r;var o=t.displayName||t.name||"";return""!==o?n+"("+o+")":n}(e,e.render,"ForwardRef");case p:var t=e.displayName||null;return null!==t?t:w(e.type)||"Memo";case $:var n=e,c=n._payload,h=n._init;try{return w(h(c))}catch(e){return null}}return null}v=Symbol.for("react.module.reference");var x,C,N,S,E,O,P,k=Object.assign,A=0;function I(){}I.__reactDisabledLog=!0;var R,T=g.ReactCurrentDispatcher;function j(e,t,n){if(void 0===R)try{throw Error()}catch(e){var r=e.stack.trim().match(/\n( *(at )?)/);R=r&&r[1]||""}return"\n"+R+e}var M,F=!1,_="function"==typeof WeakMap?WeakMap:Map;function D(e,t){if(!e||F)return"";var n,r=M.get(e);if(void 0!==r)return r;F=!0;var o,a=Error.prepareStackTrace;Error.prepareStackTrace=void 0,o=T.current,T.current=null,function(){if(0===A){x=console.log,C=console.info,N=console.warn,S=console.error,E=console.group,O=console.groupCollapsed,P=console.groupEnd;var e={configurable:!0,enumerable:!0,value:I,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}A++}();try{if(t){var i=function(){throw Error()};if(Object.defineProperty(i.prototype,"props",{set:function(){throw Error()}}),"object"==typeof Reflect&&Reflect.construct){try{Reflect.construct(i,[])}catch(e){n=e}Reflect.construct(e,[],i)}else{try{i.call()}catch(e){n=e}e.call(i.prototype)}}else{try{throw Error()}catch(e){n=e}e()}}catch(t){if(t&&n&&"string"==typeof t.stack){for(var d=t.stack.split("\n"),s=n.stack.split("\n"),l=d.length-1,u=s.length-1;l>=1&&u>=0&&d[l]!==s[u];)u--;for(;l>=1&&u>=0;l--,u--)if(d[l]!==s[u]){if(1!==l||1!==u)do{if(l--,--u<0||d[l]!==s[u]){var c="\n"+d[l].replace(" at new "," at ");return e.displayName&&c.includes("<anonymous>")&&(c=c.replace("<anonymous>",e.displayName)),"function"==typeof e&&M.set(e,c),c}}while(l>=1&&u>=0);break}}}finally{F=!1,T.current=o,function(){if(0==--A){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:k({},e,{value:x}),info:k({},e,{value:C}),warn:k({},e,{value:N}),error:k({},e,{value:S}),group:k({},e,{value:E}),groupCollapsed:k({},e,{value:O}),groupEnd:k({},e,{value:P})})}A<0&&y("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}(),Error.prepareStackTrace=a}var f=e?e.displayName||e.name:"",p=f?j(f):"";return"function"==typeof e&&M.set(e,p),p}function L(e,t,n){if(null==e)return"";if("function"==typeof e)return D(e,!(!(r=e.prototype)||!r.isReactComponent));var r;if("string"==typeof e)return j(e);switch(e){case u:return j("Suspense");case f:return j("SuspenseList")}if("object"==typeof e)switch(e.$$typeof){case l:return D(e.render,!1);case p:return L(e.type,t,n);case $:var o=e,a=o._payload,i=o._init;try{return L(i(a),t,n)}catch(e){}}return""}M=new _;var B=Object.prototype.hasOwnProperty,G={},W=g.ReactDebugCurrentFrame;function z(e){if(e){var t=e._owner,n=L(e.type,e._source,t?t.type:null);W.setExtraStackFrame(n)}else W.setExtraStackFrame(null)}var U=Array.isArray;function K(e){return U(e)}function V(e){return""+e}function H(e){if(function(e){try{return V(e),!1}catch(e){return!0}}(e))return y("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",function(e){return"function"==typeof Symbol&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object"}(e)),V(e)}var Y,q,Z,J=g.ReactCurrentOwner,X={key:!0,ref:!0,__self:!0,__source:!0};Z={};function Q(e,t,r,o,a){var i,d={},s=null,l=null;for(i in void 0!==r&&(H(r),s=""+r),function(e){if(B.call(e,"key")){var t=Object.getOwnPropertyDescriptor(e,"key").get;if(t&&t.isReactWarning)return!1}return void 0!==e.key}(t)&&(H(t.key),s=""+t.key),function(e){if(B.call(e,"ref")){var t=Object.getOwnPropertyDescriptor(e,"ref").get;if(t&&t.isReactWarning)return!1}return void 0!==e.ref}(t)&&(l=t.ref,function(e,t){if("string"==typeof e.ref&&J.current&&t&&J.current.stateNode!==t){var n=w(J.current.type);Z[n]||(y('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',w(J.current.type),e.ref),Z[n]=!0)}}(t,a)),t)B.call(t,i)&&!X.hasOwnProperty(i)&&(d[i]=t[i]);if(e&&e.defaultProps){var u=e.defaultProps;for(i in u)void 0===d[i]&&(d[i]=u[i])}if(s||l){var c="function"==typeof e?e.displayName||e.name||"Unknown":e;s&&function(e,t){var n=function(){Y||(Y=!0,y("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",t))};n.isReactWarning=!0,Object.defineProperty(e,"key",{get:n,configurable:!0})}(d,c),l&&function(e,t){var n=function(){q||(q=!0,y("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",t))};n.isReactWarning=!0,Object.defineProperty(e,"ref",{get:n,configurable:!0})}(d,c)}return function(e,t,r,o,a,i,d){var s={$$typeof:n,type:e,key:t,ref:r,props:d,_owner:i,_store:{}};return Object.defineProperty(s._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(s,"_self",{configurable:!1,enumerable:!1,writable:!1,value:o}),Object.defineProperty(s,"_source",{configurable:!1,enumerable:!1,writable:!1,value:a}),Object.freeze&&(Object.freeze(s.props),Object.freeze(s)),s}(e,s,l,a,o,J.current,d)}var ee,te=g.ReactCurrentOwner,ne=g.ReactDebugCurrentFrame;function re(e){if(e){var t=e._owner,n=L(e.type,e._source,t?t.type:null);ne.setExtraStackFrame(n)}else ne.setExtraStackFrame(null)}function oe(e){return"object"==typeof e&&null!==e&&e.$$typeof===n}function ae(){if(te.current){var e=w(te.current.type);if(e)return"\n\nCheck the render method of `"+e+"`."}return""}ee=!1;var ie={};function de(e,t){if(e._store&&!e._store.validated&&null==e.key){e._store.validated=!0;var n=function(e){var t=ae();if(!t){var n="string"==typeof e?e:e.displayName||e.name;n&&(t="\n\nCheck the top-level render call using <"+n+">.")}return t}(t);if(!ie[n]){ie[n]=!0;var r="";e&&e._owner&&e._owner!==te.current&&(r=" It was passed a child from "+w(e._owner.type)+"."),re(e),y('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',n,r),re(null)}}}function se(e,t){if("object"==typeof e)if(K(e))for(var n=0;n<e.length;n++){var r=e[n];oe(r)&&de(r,t)}else if(oe(e))e._store&&(e._store.validated=!0);else if(e){var o=function(e){if(null===e||"object"!=typeof e)return null;var t=m&&e[m]||e["@@iterator"];return"function"==typeof t?t:null}(e);if("function"==typeof o&&o!==e.entries)for(var a,i=o.call(e);!(a=i.next()).done;)oe(a.value)&&de(a.value,t)}}function le(e){var t,n=e.type;if(null!=n&&"string"!=typeof n){if("function"==typeof n)t=n.propTypes;else{if("object"!=typeof n||n.$$typeof!==l&&n.$$typeof!==p)return;t=n.propTypes}if(t){var r=w(n);!function(e,t,n,r,o){var a=Function.call.bind(B);for(var i in e)if(a(e,i)){var d=void 0;try{if("function"!=typeof e[i]){var s=Error((r||"React class")+": "+n+" type `"+i+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[i]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw s.name="Invariant Violation",s}d=e[i](t,i,r,n,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(e){d=e}!d||d instanceof Error||(z(o),y("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",r||"React class",n,i,typeof d),z(null)),d instanceof Error&&!(d.message in G)&&(G[d.message]=!0,z(o),y("Failed %s type: %s",n,d.message),z(null))}}(t,e.props,"prop",r,e)}else if(void 0!==n.PropTypes&&!ee){ee=!0,y("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",w(n)||"Unknown")}"function"!=typeof n.getDefaultProps||n.getDefaultProps.isReactClassApproved||y("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}var ue={};function ce(e,t,r,c,m,g){var b=function(e){return"string"==typeof e||"function"==typeof e||e===o||e===i||e===a||e===u||e===f||e===h||"object"==typeof e&&null!==e&&(e.$$typeof===$||e.$$typeof===p||e.$$typeof===d||e.$$typeof===s||e.$$typeof===l||e.$$typeof===v||void 0!==e.getModuleId)}(e);if(!b){var x="";(void 0===e||"object"==typeof e&&null!==e&&0===Object.keys(e).length)&&(x+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var C;x+=ae(),null===e?C="null":K(e)?C="array":void 0!==e&&e.$$typeof===n?(C="<"+(w(e.type)||"Unknown")+" />",x=" Did you accidentally export a JSX literal instead of a component?"):C=typeof e,y("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",C,x)}var N=Q(e,t,r,m,g);if(null==N)return N;if(b){var S=t.children;if(void 0!==S)if(c)if(K(S)){for(var E=0;E<S.length;E++)se(S[E],e);Object.freeze&&Object.freeze(S)}else y("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else se(S,e)}if(B.call(t,"key")){var O=w(e),P=Object.keys(t).filter((function(e){return"key"!==e})),k=P.length>0?"{key: someKey, "+P.join(": ..., ")+": ...}":"{key: someKey}";if(!ue[O+k])y('A props object containing a "key" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />',k,O,P.length>0?"{"+P.join(": ..., ")+": ...}":"{}",O),ue[O+k]=!0}return e===o?function(e){for(var t=Object.keys(e.props),n=0;n<t.length;n++){var r=t[n];if("children"!==r&&"key"!==r){re(e),y("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",r),re(null);break}}null!==e.ref&&(re(e),y("Invalid attribute `ref` supplied to `React.Fragment`."),re(null))}(N):le(N),N}var fe=function(e,t,n){return ce(e,t,n,!1)},pe=function(e,t,n){return ce(e,t,n,!0)};c.Fragment=o,c.jsx=fe,c.jsxs=pe}()),c}var p=(u||(u=1,"production"===process.env.NODE_ENV?d.exports=function(){if(i)return s;i=1;var t=e,n=Symbol.for("react.element"),r=Symbol.for("react.fragment"),o=Object.prototype.hasOwnProperty,a=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,d={key:!0,ref:!0,__self:!0,__source:!0};function l(e,t,r){var i,s={},l=null,u=null;for(i in void 0!==r&&(l=""+r),void 0!==t.key&&(l=""+t.key),void 0!==t.ref&&(u=t.ref),t)o.call(t,i)&&!d.hasOwnProperty(i)&&(s[i]=t[i]);if(e&&e.defaultProps)for(i in t=e.defaultProps)void 0===s[i]&&(s[i]=t[i]);return{$$typeof:n,type:e,key:l,ref:u,props:s,_owner:a.current}}return s.Fragment=r,s.jsx=l,s.jsxs=l,s}():d.exports=f()),d.exports); /** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $=(...e)=>e.filter(((e,t,n)=>Boolean(e)&&""!==e.trim()&&n.indexOf(e)===t)).join(" ").trim() /** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */;var h={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}; /** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const m=e.forwardRef((({color:t="currentColor",size:n=24,strokeWidth:r=2,absoluteStrokeWidth:o,className:a="",children:i,iconNode:d,...s},l)=>e.createElement("svg",{ref:l,...h,width:n,height:n,stroke:t,strokeWidth:o?24*Number(r)/Number(n):r,className:$("lucide",a),...s},[...d.map((([t,n])=>e.createElement(t,n))),...Array.isArray(i)?i:[i]]))),g=(t,n)=>{const r=e.forwardRef((({className:r,...o},a)=>{return e.createElement(m,{ref:a,iconNode:n,className:$(`lucide-${i=t,i.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,r),...o});var i}));return r.displayName=`${t}`,r},y=g("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]),v=g("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]),b=g("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]),w=g("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]); /** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */var x=function(){return x=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},x.apply(this,arguments)};function C(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}function N(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),!1===n||!r.defaultPrevented)return t?.(r)}}function S(...e){return t=>e.forEach((e=>function(e,t){"function"==typeof e?e(t):null!=e&&(e.current=t)}(e,t)))}function E(...e){return r.useCallback(S(...e),e)}function O(e,t=[]){let n=[];const o=()=>{const t=n.map((e=>r.createContext(e)));return function(n){const o=n?.[e]||t;return r.useMemo((()=>({[`__scope${e}`]:{...n,[e]:o}})),[n,o])}};return o.scopeName=e,[function(t,o){const a=r.createContext(o),i=n.length;n=[...n,o];const d=t=>{const{scope:n,children:o,...d}=t,s=n?.[e]?.[i]||a,l=r.useMemo((()=>d),Object.values(d));return p.jsx(s.Provider,{value:l,children:o})};return d.displayName=t+"Provider",[d,function(n,d){const s=d?.[e]?.[i]||a,l=r.useContext(s);if(l)return l;if(void 0!==o)return o;throw new Error(`\`${n}\` must be used within \`${t}\``)}]},P(o,...t)]}function P(...e){const t=e[0];if(1===e.length)return t;const n=()=>{const n=e.map((e=>({useScope:e(),scopeName:e.scopeName})));return function(e){const o=n.reduce(((t,{useScope:n,scopeName:r})=>({...t,...n(e)[`__scope${r}`]})),{});return r.useMemo((()=>({[`__scope${t.scopeName}`]:o})),[o])}};return n.scopeName=t.scopeName,n}"function"==typeof SuppressedError&&SuppressedError;var k=r.forwardRef(((e,t)=>{const{children:n,...o}=e,a=r.Children.toArray(n),i=a.find(R);if(i){const e=i.props.children,n=a.map((t=>t===i?r.Children.count(e)>1?r.Children.only(null):r.isValidElement(e)?e.props.children:null:t));return p.jsx(A,{...o,ref:t,children:r.isValidElement(e)?r.cloneElement(e,void 0,n):null})}return p.jsx(A,{...o,ref:t,children:n})}));k.displayName="Slot";var A=r.forwardRef(((e,t)=>{const{children:n,...o}=e;if(r.isValidElement(n)){const e=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;if(n)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n)return e.props.ref;return e.props.ref||e.ref}(n);return r.cloneElement(n,{...T(o,n.props),ref:t?S(t,e):e})}return r.Children.count(n)>1?r.Children.only(null):null}));A.displayName="SlotClone";var I=({children:e})=>p.jsx(p.Fragment,{children:e});function R(e){return r.isValidElement(e)&&e.type===I}function T(e,t){const n={...t};for(const r in t){const o=e[r],a=t[r];/^on[A-Z]/.test(r)?o&&a?n[r]=(...e)=>{a(...e),o(...e)}:o&&(n[r]=o):"style"===r?n[r]={...o,...a}:"className"===r&&(n[r]=[o,a].filter(Boolean).join(" "))}return{...e,...n}}var j=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"].reduce(((e,t)=>{const n=r.forwardRef(((e,n)=>{const{asChild:r,...o}=e,a=r?k:t;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),p.jsx(a,{...o,ref:n})}));return n.displayName=`Primitive.${t}`,{...e,[t]:n}}),{});function M(e){const t=r.useRef(e);return r.useEffect((()=>{t.current=e})),r.useMemo((()=>(...e)=>t.current?.(...e)),[])}var F,_="dismissableLayer.update",D="dismissableLayer.pointerDownOutside",L="dismissableLayer.focusOutside",B=r.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),G=r.forwardRef(((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:o,onPointerDownOutside:a,onFocusOutside:i,onInteractOutside:d,onDismiss:s,...l}=e,u=r.useContext(B),[c,f]=r.useState(null),$=c?.ownerDocument??globalThis?.document,[,h]=r.useState({}),m=E(t,(e=>f(e))),g=Array.from(u.layers),[y]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),v=g.indexOf(y),b=c?g.indexOf(c):-1,w=u.layersWithOutsidePointerEventsDisabled.size>0,x=b>=v,C=function(e,t=globalThis?.document){const n=M(e),o=r.useRef(!1),a=r.useRef((()=>{}));return r.useEffect((()=>{const e=e=>{if(e.target&&!o.current){let r=function(){z(D,n,o,{discrete:!0})};const o={originalEvent:e};"touch"===e.pointerType?(t.removeEventListener("click",a.current),a.current=r,t.addEventListener("click",a.current,{once:!0})):r()}else t.removeEventListener("click",a.current);o.current=!1},r=window.setTimeout((()=>{t.addEventListener("pointerdown",e)}),0);return()=>{window.clearTimeout(r),t.removeEventListener("pointerdown",e),t.removeEventListener("click",a.current)}}),[t,n]),{onPointerDownCapture:()=>o.current=!0}}((e=>{const t=e.target,n=[...u.branches].some((e=>e.contains(t)));x&&!n&&(a?.(e),d?.(e),e.defaultPrevented||s?.())}),$),S=function(e,t=globalThis?.document){const n=M(e),o=r.useRef(!1);return r.useEffect((()=>{const e=e=>{if(e.target&&!o.current){z(L,n,{originalEvent:e},{discrete:!1})}};return t.addEventListener("focusin",e),()=>t.removeEventListener("focusin",e)}),[t,n]),{onFocusCapture:()=>o.current=!0,onBlurCapture:()=>o.current=!1}}((e=>{const t=e.target;[...u.branches].some((e=>e.contains(t)))||(i?.(e),d?.(e),e.defaultPrevented||s?.())}),$);return function(e,t=globalThis?.document){const n=M(e);r.useEffect((()=>{const e=e=>{"Escape"===e.key&&n(e)};return t.addEventListener("keydown",e,{capture:!0}),()=>t.removeEventListener("keydown",e,{capture:!0})}),[n,t])}((e=>{b===u.layers.size-1&&(o?.(e),!e.defaultPrevented&&s&&(e.preventDefault(),s()))}),$),r.useEffect((()=>{if(c)return n&&(0===u.layersWithOutsidePointerEventsDisabled.size&&(F=$.body.style.pointerEvents,$.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(c)),u.layers.add(c),W(),()=>{n&&1===u.layersWithOutsidePointerEventsDisabled.size&&($.body.style.pointerEvents=F)}}),[c,$,n,u]),r.useEffect((()=>()=>{c&&(u.layers.delete(c),u.layersWithOutsidePointerEventsDisabled.delete(c),W())}),[c,u]),r.useEffect((()=>{const e=()=>h({});return document.addEventListener(_,e),()=>document.removeEventListener(_,e)}),[]),p.jsx(j.div,{...l,ref:m,style:{pointerEvents:w?x?"auto":"none":void 0,...e.style},onFocusCapture:N(e.onFocusCapture,S.onFocusCapture),onBlurCapture:N(e.onBlurCapture,S.onBlurCapture),onPointerDownCapture:N(e.onPointerDownCapture,C.onPointerDownCapture)})}));G.displayName="DismissableLayer";function W(){const e=new CustomEvent(_);document.dispatchEvent(e)}function z(e,t,n,{discrete:r}){const a=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&a.addEventListener(e,t,{once:!0}),r?function(e,t){e&&o.flushSync((()=>e.dispatchEvent(t)))}(a,i):a.dispatchEvent(i)}r.forwardRef(((e,t)=>{const n=r.useContext(B),o=r.useRef(null),a=E(t,o);return r.useEffect((()=>{const e=o.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}}),[n.branches]),p.jsx(j.div,{...e,ref:a})})).displayName="DismissableLayerBranch";var U=0;function K(){r.useEffect((()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??V()),document.body.insertAdjacentElement("beforeend",e[1]??V()),U++,()=>{1===U&&document.querySelectorAll("[data-radix-focus-guard]").forEach((e=>e.remove())),U--}}),[])}function V(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var H="focusScope.autoFocusOnMount",Y="focusScope.autoFocusOnUnmount",q={bubbles:!1,cancelable:!0},Z=r.forwardRef(((e,t)=>{const{loop:n=!1,trapped:o=!1,onMountAutoFocus:a,onUnmountAutoFocus:i,...d}=e,[s,l]=r.useState(null),u=M(a),c=M(i),f=r.useRef(null),$=E(t,(e=>l(e))),h=r.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;r.useEffect((()=>{if(o){let e=function(e){if(h.paused||!s)return;const t=e.target;s.contains(t)?f.current=t:ee(f.current,{select:!0})},t=function(e){if(h.paused||!s)return;const t=e.relatedTarget;null!==t&&(s.contains(t)||ee(f.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(const t of e)t.removedNodes.length>0&&ee(s)};document.addEventListener("focusin",e),document.addEventListener("focusout",t);const r=new MutationObserver(n);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",e),document.removeEventListener("focusout",t),r.disconnect()}}}),[o,s,h.paused]),r.useEffect((()=>{if(s){te.add(h);const t=document.activeElement;if(!s.contains(t)){const n=new CustomEvent(H,q);s.addEventListener(H,u),s.dispatchEvent(n),n.defaultPrevented||(!function(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(ee(r,{select:t}),document.activeElement!==n)return}((e=J(s),e.filter((e=>"A"!==e.tagName))),{select:!0}),document.activeElement===t&&ee(s))}return()=>{s.removeEventListener(H,u),setTimeout((()=>{const e=new CustomEvent(Y,q);s.addEventListener(Y,c),s.dispatchEvent(e),e.defaultPrevented||ee(t??document.body,{select:!0}),s.removeEventListener(Y,c),te.remove(h)}),0)}}var e}),[s,u,c,h]);const m=r.useCallback((e=>{if(!n&&!o)return;if(h.paused)return;const t="Tab"===e.key&&!e.altKey&&!e.ctrlKey&&!e.metaKey,r=document.activeElement;if(t&&r){const t=e.currentTarget,[o,a]=function(e){const t=J(e),n=X(t,e),r=X(t.reverse(),e);return[n,r]}(t);o&&a?e.shiftKey||r!==a?e.shiftKey&&r===o&&(e.preventDefault(),n&&ee(a,{select:!0})):(e.preventDefault(),n&&ee(o,{select:!0})):r===t&&e.preventDefault()}}),[n,o,h.paused]);return p.jsx(j.div,{tabIndex:-1,...d,ref:$,onKeyDown:m})}));function J(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{const t="INPUT"===e.tagName&&"hidden"===e.type;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function X(e,t){for(const n of e)if(!Q(n,{upTo:t}))return n}function Q(e,{upTo:t}){if("hidden"===getComputedStyle(e).visibility)return!0;for(;e;){if(void 0!==t&&e===t)return!1;if("none"===getComputedStyle(e).display)return!0;e=e.parentElement}return!1}function ee(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&function(e){return e instanceof HTMLInputElement&&"select"in e}(e)&&t&&e.select()}}Z.displayName="FocusScope";var te=function(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=ne(e,t),e.unshift(t)},remove(t){e=ne(e,t),e[0]?.resume()}}}();function ne(e,t){const n=[...e],r=n.indexOf(t);return-1!==r&&n.splice(r,1),n}var re=Boolean(globalThis?.document)?r.useLayoutEffect:()=>{},oe=r["useId".toString()]||(()=>{}),ae=0;function ie(e){const[t,n]=r.useState(oe());return re((()=>{n((e=>e??String(ae++)))}),[e]),t?`radix-${t}`:""}const de=["top","right","bottom","left"],se=Math.min,le=Math.max,ue=Math.round,ce=Math.floor,fe=e=>({x:e,y:e}),pe={left:"right",right:"left",bottom:"top",top:"bottom"},$e={start:"end",end:"start"};function he(e,t,n){return le(e,se(t,n))}function me(e,t){return"function"==typeof e?e(t):e}function ge(e){return e.split("-")[0]}function ye(e){return e.split("-")[1]}function ve(e){return"x"===e?"y":"x"}function be(e){return"y"===e?"height":"width"}function we(e){return["top","bottom"].includes(ge(e))?"y":"x"}function xe(e){return ve(we(e))}function Ce(e){return e.replace(/start|end/g,(e=>$e[e]))}function Ne(e){return e.replace(/left|right|bottom|top/g,(e=>pe[e]))}function Se(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 Ee(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 Oe(e,t,n){let{reference:r,floating:o}=e;const a=we(t),i=xe(t),d=be(i),s=ge(t),l="y"===a,u=r.x+r.width/2-o.width/2,c=r.y+r.height/2-o.height/2,f=r[d]/2-o[d]/2;let p;switch(s){case"top":p={x:u,y:r.y-o.height};break;case"bottom":p={x:u,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:c};break;case"left":p={x:r.x-o.width,y:c};break;default:p={x:r.x,y:r.y}}switch(ye(t)){case"start":p[i]-=f*(n&&l?-1:1);break;case"end":p[i]+=f*(n&&l?-1:1)}return p}async function Pe(e,t){var n;void 0===t&&(t={});const{x:r,y:o,platform:a,rects:i,elements:d,strategy:s}=e,{boundary:l="clippingAncestors",rootBoundary:u="viewport",elementContext:c="floating",altBoundary:f=!1,padding:p=0}=me(t,e),$=Se(p),h=d[f?"floating"===c?"reference":"floating":c],m=Ee(await a.getClippingRect({element:null==(n=await(null==a.isElement?void 0:a.isElement(h)))||n?h:h.contextElement||await(null==a.getDocumentElement?void 0:a.getDocumentElement(d.floating)),boundary:l,rootBoundary:u,strategy:s})),g="floating"===c?{x:r,y:o,width:i.floating.width,height:i.floating.height}:i.reference,y=await(null==a.getOffsetParent?void 0:a.getOffsetParent(d.floating)),v=await(null==a.isElement?void 0:a.isElement(y))&&await(null==a.getScale?void 0:a.getScale(y))||{x:1,y:1},b=Ee(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:d,rect:g,offsetParent:y,strategy:s}):g);return{top:(m.top-b.top+$.top)/v.y,bottom:(b.bottom-m.bottom+$.bottom)/v.y,left:(m.left-b.left+$.left)/v.x,right:(b.right-m.right+$.right)/v.x}}function ke(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Ae(e){return de.some((t=>e[t]>=0))}function Ie(){return"undefined"!=typeof window}function Re(e){return Me(e)?(e.nodeName||"").toLowerCase():"#document"}function Te(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function je(e){var t;return null==(t=(Me(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function Me(e){return!!Ie()&&(e instanceof Node||e instanceof Te(e).Node)}function Fe(e){return!!Ie()&&(e instanceof Element||e instanceof Te(e).Element)}function _e(e){return!!Ie()&&(e instanceof HTMLElement||e instanceof Te(e).HTMLElement)}function De(e){return!(!Ie()||"undefined"==typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof Te(e).ShadowRoot)}function Le(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Ke(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function Be(e){return["table","td","th"].includes(Re(e))}function Ge(e){return[":popover-open",":modal"].some((t=>{try{return e.matches(t)}catch(e){return!1}}))}function We(e){const t=ze(),n=Fe(e)?Ke(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 ze(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function Ue(e){return["html","body","#document"].includes(Re(e))}function Ke(e){return Te(e).getComputedStyle(e)}function Ve(e){return Fe(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function He(e){if("html"===Re(e))return e;const t=e.assignedSlot||e.parentNode||De(e)&&e.host||je(e);return De(t)?t.host:t}function Ye(e){const t=He(e);return Ue(t)?e.ownerDocument?e.ownerDocument.body:e.body:_e(t)&&Le(t)?t:Ye(t)}function qe(e,t,n){var r;void 0===t&&(t=[]),void 0===n&&(n=!0);const o=Ye(e),a=o===(null==(r=e.ownerDocument)?void 0:r.body),i=Te(o);if(a){const e=Ze(i);return t.concat(i,i.visualViewport||[],Le(o)?o:[],e&&n?qe(e):[])}return t.concat(o,qe(o,[],n))}function Ze(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Je(e){const t=Ke(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=_e(e),a=o?e.offsetWidth:n,i=o?e.offsetHeight:r,d=ue(n)!==a||ue(r)!==i;return d&&(n=a,r=i),{width:n,height:r,$:d}}function Xe(e){return Fe(e)?e:e.contextElement}function Qe(e){const t=Xe(e);if(!_e(t))return fe(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:a}=Je(t);let i=(a?ue(n.width):n.width)/r,d=(a?ue(n.height):n.height)/o;return i&&Number.isFinite(i)||(i=1),d&&Number.isFinite(d)||(d=1),{x:i,y:d}}const et=fe(0);function tt(e){const t=Te(e);return ze()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:et}function nt(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);const o=e.getBoundingClientRect(),a=Xe(e);let i=fe(1);t&&(r?Fe(r)&&(i=Qe(r)):i=Qe(e));const d=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==Te(e))&&t}(a,n,r)?tt(a):fe(0);let s=(o.left+d.x)/i.x,l=(o.top+d.y)/i.y,u=o.width/i.x,c=o.height/i.y;if(a){const e=Te(a),t=r&&Fe(r)?Te(r):r;let n=e,o=Ze(n);for(;o&&r&&t!==n;){const e=Qe(o),t=o.getBoundingClientRect(),r=Ke(o),a=t.left+(o.clientLeft+parseFloat(r.paddingLeft))*e.x,i=t.top+(o.clientTop+parseFloat(r.paddingTop))*e.y;s*=e.x,l*=e.y,u*=e.x,c*=e.y,s+=a,l+=i,n=Te(o),o=Ze(n)}}return Ee({width:u,height:c,x:s,y:l})}function rt(e,t){const n=Ve(e).scrollLeft;return t?t.left+n:nt(je(e)).left+n}function ot(e,t,n){void 0===n&&(n=!1);const r=e.getBoundingClientRect();return{x:r.left+t.scrollLeft-(n?0:rt(e,r)),y:r.top+t.scrollTop}}function at(e,t,n){let r;if("viewport"===t)r=function(e,t){const n=Te(e),r=je(e),o=n.visualViewport;let a=r.clientWidth,i=r.clientHeight,d=0,s=0;if(o){a=o.width,i=o.height;const e=ze();(!e||e&&"fixed"===t)&&(d=o.offsetLeft,s=o.offsetTop)}return{width:a,height:i,x:d,y:s}}(e,n);else if("document"===t)r=function(e){const t=je(e),n=Ve(e),r=e.ownerDocument.body,o=le(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=le(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+rt(e);const d=-n.scrollTop;return"rtl"===Ke(r).direction&&(i+=le(t.clientWidth,r.clientWidth)-o),{width:o,height:a,x:i,y:d}}(je(e));else if(Fe(t))r=function(e,t){const n=nt(e,!0,"fixed"===t),r=n.top+e.clientTop,o=n.left+e.clientLeft,a=_e(e)?Qe(e):fe(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:o*a.x,y:r*a.y}}(t,n);else{const n=tt(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Ee(r)}function it(e,t){const n=He(e);return!(n===t||!Fe(n)||Ue(n))&&("fixed"===Ke(n).position||it(n,t))}function dt(e,t,n){const r=_e(t),o=je(t),a="fixed"===n,i=nt(e,!0,a,t);let d={scrollLeft:0,scrollTop:0};const s=fe(0);if(r||!r&&!a)if(("body"!==Re(t)||Le(o))&&(d=Ve(t)),r){const e=nt(t,!0,a,t);s.x=e.x+t.clientLeft,s.y=e.y+t.clientTop}else o&&(s.x=rt(o));const l=!o||r||a?fe(0):ot(o,d);return{x:i.left+d.scrollLeft-s.x-l.x,y:i.top+d.scrollTop-s.y-l.y,width:i.width,height:i.height}}function st(e){return"static"===Ke(e).position}function lt(e,t){if(!_e(e)||"fixed"===Ke(e).position)return null;if(t)return t(e);let n=e.offsetParent;return je(e)===n&&(n=n.ownerDocument.body),n}function ut(e,t){const n=Te(e);if(Ge(e))return n;if(!_e(e)){let t=He(e);for(;t&&!Ue(t);){if(Fe(t)&&!st(t))return t;t=He(t)}return n}let r=lt(e,t);for(;r&&Be(r)&&st(r);)r=lt(r,t);return r&&Ue(r)&&st(r)&&!We(r)?n:r||function(e){let t=He(e);for(;_e(t)&&!Ue(t);){if(We(t))return t;if(Ge(t))return null;t=He(t)}return null}(e)||n}const ct={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const a="fixed"===o,i=je(r),d=!!t&&Ge(t.floating);if(r===i||d&&a)return n;let s={scrollLeft:0,scrollTop:0},l=fe(1);const u=fe(0),c=_e(r);if((c||!c&&!a)&&(("body"!==Re(r)||Le(i))&&(s=Ve(r)),_e(r))){const e=nt(r);l=Qe(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}const f=!i||c||a?fe(0):ot(i,s,!0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-s.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-s.scrollTop*l.y+u.y+f.y}},getDocumentElement:je,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const a=[..."clippingAncestors"===n?Ge(t)?[]:function(e,t){const n=t.get(e);if(n)return n;let r=qe(e,[],!1).filter((e=>Fe(e)&&"body"!==Re(e))),o=null;const a="fixed"===Ke(e).position;let i=a?He(e):e;for(;Fe(i)&&!Ue(i);){const t=Ke(i),n=We(i);n||"fixed"!==t.position||(o=null),(a?!n&&!o:!n&&"static"===t.position&&o&&["absolute","fixed"].includes(o.position)||Le(i)&&!n&&it(e,i))?r=r.filter((e=>e!==i)):o=t,i=He(i)}return t.set(e,r),r}(t,this._c):[].concat(n),r],i=a[0],d=a.reduce(((e,n)=>{const r=at(t,n,o);return e.top=le(r.top,e.top),e.right=se(r.right,e.right),e.bottom=se(r.bottom,e.bottom),e.left=le(r.left,e.left),e}),at(t,i,o));return{width:d.right-d.left,height:d.bottom-d.top,x:d.left,y:d.top}},getOffsetParent:ut,getElementRects:async function(e){const t=this.getOffsetParent||ut,n=this.getDimensions,r=await n(e.floating);return{reference:dt(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}=Je(e);return{width:t,height:n}},getScale:Qe,isElement:Fe,isRTL:function(e){return"rtl"===Ke(e).direction}};function ft(e,t,n,r){void 0===r&&(r={});const{ancestorScroll:o=!0,ancestorResize:a=!0,elementResize:i="function"==typeof ResizeObserver,layoutShift:d="function"==typeof IntersectionObserver,animationFrame:s=!1}=r,l=Xe(e),u=o||a?[...l?qe(l):[],...qe(t)]:[];u.forEach((e=>{o&&e.addEventListener("scroll",n,{passive:!0}),a&&e.addEventListener("resize",n)}));const c=l&&d?function(e,t){let n,r=null;const o=je(e);function a(){var e;clearTimeout(n),null==(e=r)||e.disconnect(),r=null}return function i(d,s){void 0===d&&(d=!1),void 0===s&&(s=1),a();const{left:l,top:u,width:c,height:f}=e.getBoundingClientRect();if(d||t(),!c||!f)return;const p={rootMargin:-ce(u)+"px "+-ce(o.clientWidth-(l+c))+"px "+-ce(o.clientHeight-(u+f))+"px "+-ce(l)+"px",threshold:le(0,se(1,s))||1};let $=!0;function h(e){const t=e[0].intersectionRatio;if(t!==s){if(!$)return i();t?i(!1,t):n=setTimeout((()=>{i(!1,1e-7)}),1e3)}$=!1}try{r=new IntersectionObserver(h,{...p,root:o.ownerDocument})}catch(e){r=new IntersectionObserver(h,p)}r.observe(e)}(!0),a}(l,n):null;let f,p=-1,$=null;i&&($=new ResizeObserver((e=>{let[r]=e;r&&r.target===l&&$&&($.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame((()=>{var e;null==(e=$)||e.observe(t)}))),n()})),l&&!s&&$.observe(l),$.observe(t));let h=s?nt(e):null;return s&&function t(){const r=nt(e);!h||r.x===h.x&&r.y===h.y&&r.width===h.width&&r.height===h.height||n();h=r,f=requestAnimationFrame(t)}(),n(),()=>{var e;u.forEach((e=>{o&&e.removeEventListener("scroll",n),a&&e.removeEventListener("resize",n)})),null==c||c(),null==(e=$)||e.disconnect(),$=null,s&&cancelAnimationFrame(f)}}const pt=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:a,placement:i,middlewareData:d}=t,s=await async function(e,t){const{placement:n,platform:r,elements:o}=e,a=await(null==r.isRTL?void 0:r.isRTL(o.floating)),i=ge(n),d=ye(n),s="y"===we(n),l=["left","top"].includes(i)?-1:1,u=a&&s?-1:1,c=me(t,e);let{mainAxis:f,crossAxis:p,alignmentAxis:$}="number"==typeof c?{mainAxis:c,crossAxis:0,alignmentAxis:null}:{mainAxis:c.mainAxis||0,crossAxis:c.crossAxis||0,alignmentAxis:c.alignmentAxis};return d&&"number"==typeof $&&(p="end"===d?-1*$:$),s?{x:p*u,y:f*l}:{x:f*l,y:p*u}}(t,e);return i===(null==(n=d.offset)?void 0:n.placement)&&null!=(r=d.arrow)&&r.alignmentOffset?{}:{x:o+s.x,y:a+s.y,data:{...s,placement:i}}}}},$t=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:a=!0,crossAxis:i=!1,limiter:d={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...s}=me(e,t),l={x:n,y:r},u=await Pe(t,s),c=we(ge(o)),f=ve(c);let p=l[f],$=l[c];if(a){const e="y"===f?"bottom":"right";p=he(p+u["y"===f?"top":"left"],p,p-u[e])}if(i){const e="y"===c?"bottom":"right";$=he($+u["y"===c?"top":"left"],$,$-u[e])}const h=d.fn({...t,[f]:p,[c]:$});return{...h,data:{x:h.x-n,y:h.y-r,enabled:{[f]:a,[c]:i}}}}}},ht=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:a,rects:i,initialPlacement:d,platform:s,elements:l}=t,{mainAxis:u=!0,crossAxis:c=!0,fallbackPlacements:f,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:$="none",flipAlignment:h=!0,...m}=me(e,t);if(null!=(n=a.arrow)&&n.alignmentOffset)return{};const g=ge(o),y=we(d),v=ge(d)===d,b=await(null==s.isRTL?void 0:s.isRTL(l.floating)),w=f||(v||!h?[Ne(d)]:function(e){const t=Ne(e);return[Ce(e),t,Ce(t)]}(d)),x="none"!==$;!f&&x&&w.push(...function(e,t,n,r){const o=ye(e);let a=function(e,t,n){const r=["left","right"],o=["right","left"],a=["top","bottom"],i=["bottom","top"];switch(e){case"top":case"bottom":return n?t?o:r:t?r:o;case"left":case"right":return t?a:i;default:return[]}}(ge(e),"start"===n,r);return o&&(a=a.map((e=>e+"-"+o)),t&&(a=a.concat(a.map(Ce)))),a}(d,h,$,b));const C=[d,...w],N=await Pe(t,m),S=[];let E=(null==(r=a.flip)?void 0:r.overflows)||[];if(u&&S.push(N[g]),c){const e=function(e,t,n){void 0===n&&(n=!1);const r=ye(e),o=xe(e),a=be(o);let i="x"===o?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[a]>t.floating[a]&&(i=Ne(i)),[i,Ne(i)]}(o,i,b);S.push(N[e[0]],N[e[1]])}if(E=[...E,{placement:o,overflows:S}],!S.every((e=>e<=0))){var O,P;const e=((null==(O=a.flip)?void 0:O.index)||0)+1,t=C[e];if(t)return{data:{index:e,overflows:E},reset:{placement:t}};let n=null==(P=E.filter((e=>e.overflows[0]<=0)).sort(((e,t)=>e.overflows[1]-t.overflows[1]))[0])?void 0:P.placement;if(!n)switch(p){case"bestFit":{var k;const e=null==(k=E.filter((e=>{if(x){const t=we(e.placement);return t===y||"y"===t}return!0})).map((e=>[e.placement,e.overflows.filter((e=>e>0)).reduce(((e,t)=>e+t),0)])).sort(((e,t)=>e[1]-t[1]))[0])?void 0:k[0];e&&(n=e);break}case"initialPlacement":n=d}if(o!==n)return{reset:{placement:n}}}return{}}}},mt=function(e){return void 0===e&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:a,platform:i,elements:d}=t,{apply:s=()=>{},...l}=me(e,t),u=await Pe(t,l),c=ge(o),f=ye(o),p="y"===we(o),{width:$,height:h}=a.floating;let m,g;"top"===c||"bottom"===c?(m=c,g=f===(await(null==i.isRTL?void 0:i.isRTL(d.floating))?"start":"end")?"left":"right"):(g=c,m="end"===f?"top":"bottom");const y=h-u.top-u.bottom,v=$-u.left-u.right,b=se(h-u[m],y),w=se($-u[g],v),x=!t.middlewareData.shift;let C=b,N=w;if(null!=(n=t.middlewareData.shift)&&n.enabled.x&&(N=v),null!=(r=t.middlewareData.shift)&&r.enabled.y&&(C=y),x&&!f){const e=le(u.left,0),t=le(u.right,0),n=le(u.top,0),r=le(u.bottom,0);p?N=$-2*(0!==e||0!==t?e+t:le(u.left,u.right)):C=h-2*(0!==n||0!==r?n+r:le(u.top,u.bottom))}await s({...t,availableWidth:N,availableHeight:C});const S=await i.getDimensions(d.floating);return $!==S.width||h!==S.height?{reset:{rects:!0}}:{}}}},gt=function(e){return void 0===e&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...o}=me(e,t);switch(r){case"referenceHidden":{const e=ke(await Pe(t,{...o,elementContext:"reference"}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Ae(e)}}}case"escaped":{const e=ke(await Pe(t,{...o,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:Ae(e)}}}default:return{}}}}},yt=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:a,platform:i,elements:d,middlewareData:s}=t,{element:l,padding:u=0}=me(e,t)||{};if(null==l)return{};const c=Se(u),f={x:n,y:r},p=xe(o),$=be(p),h=await i.getDimensions(l),m="y"===p,g=m?"top":"left",y=m?"bottom":"right",v=m?"clientHeight":"clientWidth",b=a.reference[$]+a.reference[p]-f[p]-a.floating[$],w=f[p]-a.reference[p],x=await(null==i.getOffsetParent?void 0:i.getOffsetParent(l));let C=x?x[v]:0;C&&await(null==i.isElement?void 0:i.isElement(x))||(C=d.floating[v]||a.floating[$]);const N=b/2-w/2,S=C/2-h[$]/2-1,E=se(c[g],S),O=se(c[y],S),P=E,k=C-h[$]-O,A=C/2-h[$]/2+N,I=he(P,A,k),R=!s.arrow&&null!=ye(o)&&A!==I&&a.reference[$]/2-(A<P?E:O)-h[$]/2<0,T=R?A<P?A-P:A-k:0;return{[p]:f[p]+T,data:{[p]:I,centerOffset:A-I-T,...R&&{alignmentOffset:T}},reset:R}}}),vt=function(e){return void 0===e&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:a,middlewareData:i}=t,{offset:d=0,mainAxis:s=!0,crossAxis:l=!0}=me(e,t),u={x:n,y:r},c=we(o),f=ve(c);let p=u[f],$=u[c];const h=me(d,t),m="number"==typeof h?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(s){const e="y"===f?"height":"width",t=a.reference[f]-a.floating[e]+m.mainAxis,n=a.reference[f]+a.reference[e]-m.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){var g,y;const e="y"===f?"width":"height",t=["top","left"].includes(ge(o)),n=a.reference[c]-a.floating[e]+(t&&(null==(g=i.offset)?void 0:g[c])||0)+(t?0:m.crossAxis),r=a.reference[c]+a.reference[e]+(t?0:(null==(y=i.offset)?void 0:y[c])||0)-(t?m.crossAxis:0);$<n?$=n:$>r&&($=r)}return{[f]:p,[c]:$}}}},bt=(e,t,n)=>{const r=new Map,o={platform:ct,...n},a={...o.platform,_c:r};return(async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:a=[],platform:i}=n,d=a.filter(Boolean),s=await(null==i.isRTL?void 0:i.isRTL(t));let l=await i.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:c}=Oe(l,r,s),f=r,p={},$=0;for(let n=0;n<d.length;n++){const{name:a,fn:h}=d[n],{x:m,y:g,data:y,reset:v}=await h({x:u,y:c,initialPlacement:r,placement:f,strategy:o,middlewareData:p,rects:l,platform:i,elements:{reference:e,floating:t}});u=null!=m?m:u,c=null!=g?g:c,p={...p,[a]:{...p[a],...y}},v&&$<=50&&($++,"object"==typeof v&&(v.placement&&(f=v.placement),v.rects&&(l=!0===v.rects?await i.getElementRects({reference:e,floating:t,strategy:o}):v.rects),({x:u,y:c}=Oe(l,f,s))),n=-1)}return{x:u,y:c,placement:f,strategy:o,middlewareData:p}})(e,t,{...o,platform:a})};var wt="undefined"!=typeof document?e.useLayoutEffect:e.useEffect;function xt(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(!xt(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)&&!xt(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function Ct(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Nt(e,t){const n=Ct(e);return Math.round(t*n)/n}function St(e){const t=r.useRef(e);return wt((()=>{t.current=e})),t}const Et=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?yt({element:n.current,padding:r}).fn(t):{}:n?yt({element:n,padding:r}).fn(t):{};var o}}),Ot=(e,t)=>({...pt(e),options:[e,t]}),Pt=(e,t)=>({...$t(e),options:[e,t]}),kt=(e,t)=>({...vt(e),options:[e,t]}),At=(e,t)=>({...ht(e),options:[e,t]}),It=(e,t)=>({...mt(e),options:[e,t]}),Rt=(e,t)=>({...gt(e),options:[e,t]}),Tt=(e,t)=>({...Et(e),options:[e,t]});var jt=r.forwardRef(((e,t)=>{const{children:n,width:r=10,height:o=5,...a}=e;return p.jsx(j.svg,{...a,ref:t,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:p.jsx("polygon",{points:"0,0 30,0 15,10"})})}));jt.displayName="Arrow";var Mt=jt;function Ft(...e){const t=e[0];if(1===e.length)return t;const n=()=>{const n=e.map((e=>({useScope:e(),scopeName:e.scopeName})));return function(e){const o=n.reduce(((t,{useScope:n,scopeName:r})=>({...t,...n(e)[`__scope${r}`]})),{});return r.useMemo((()=>({[`__scope${t.scopeName}`]:o})),[o])}};return n.scopeName=t.scopeName,n}var _t="Popper",[Dt,Lt]=function(e,t=[]){let n=[];const o=()=>{const t=n.map((e=>r.createContext(e)));return function(n){const o=n?.[e]||t;return r.useMemo((()=>({[`__scope${e}`]:{...n,[e]:o}})),[n,o])}};return o.scopeName=e,[function(t,o){const a=r.createContext(o),i=n.length;function d(t){const{scope:n,children:o,...d}=t,s=n?.[e][i]||a,l=r.useMemo((()=>d),Object.values(d));return p.jsx(s.Provider,{value:l,children:o})}return n=[...n,o],d.displayName=t+"Provider",[d,function(n,d){const s=d?.[e][i]||a,l=r.useContext(s);if(l)return l;if(void 0!==o)return o;throw new Error(`\`${n}\` must be used within \`${t}\``)}]},Ft(o,...t)]}(_t),[Bt,Gt]=Dt(_t),Wt=e=>{const{__scopePopper:t,children:n}=e,[o,a]=r.useState(null);return p.jsx(Bt,{scope:t,anchor:o,onAnchorChange:a,children:n})};Wt.displayName=_t;var zt="PopperAnchor",Ut=r.forwardRef(((e,t)=>{const{__scopePopper:n,virtualRef:o,...a}=e,i=Gt(zt,n),d=r.useRef(null),s=E(t,d);return r.useEffect((()=>{i.onAnchorChange(o?.current||d.current)})),o?null:p.jsx(j.div,{...a,ref:s})}));Ut.displayName=zt;var Kt="PopperContent",[Vt,Ht]=Dt(Kt),Yt=r.forwardRef(((e,t)=>{const{__scopePopper:n,side:a="bottom",sideOffset:i=0,align:d="center",alignOffset:s=0,arrowPadding:l=0,avoidCollisions:u=!0,collisionBoundary:c=[],collisionPadding:f=0,sticky:$="partial",hideWhenDetached:h=!1,updatePositionStrategy:m="optimized",onPlaced:g,...y}=e,v=Gt(Kt,n),[b,w]=r.useState(null),x=E(t,(e=>w(e))),[C,N]=r.useState(null),S=function(e){const[t,n]=r.useState(void 0);return re((()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const t=new ResizeObserver((t=>{if(!Array.isArray(t))return;if(!t.length)return;const r=t[0];let o,a;if("borderBoxSize"in r){const e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;o=t.inlineSize,a=t.blockSize}else o=e.offsetWidth,a=e.offsetHeight;n({width:o,height:a})}));return t.observe(e,{box:"border-box"}),()=>t.unobserve(e)}n(void 0)}),[e]),t}(C),O=S?.width??0,P=S?.height??0,k=a+("center"!==d?"-"+d:""),A="number"==typeof f?f:{top:0,right:0,bottom:0,left:0,...f},I=Array.isArray(c)?c:[c],R=I.length>0,T={padding:A,boundary:I.filter(Xt),altBoundary:R},{refs:F,floatingStyles:_,placement:D,isPositioned:L,middlewareData:B}=function(e){void 0===e&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:a=[],platform:i,elements:{reference:d,floating:s}={},transform:l=!0,whileElementsMounted:u,open:c}=e,[f,p]=r.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[$,h]=r.useState(a);xt($,a)||h(a);const[m,g]=r.useState(null),[y,v]=r.useState(null),b=r.useCallback((e=>{e!==N.current&&(N.current=e,g(e))}),[]),w=r.useCallback((e=>{e!==S.current&&(S.current=e,v(e))}),[]),x=d||m,C=s||y,N=r.useRef(null),S=r.useRef(null),E=r.useRef(f),O=null!=u,P=St(u),k=St(i),A=St(c),I=r.useCallback((()=>{if(!N.current||!S.current)return;const e={placement:t,strategy:n,middleware:$};k.current&&(e.platform=k.current),