@gup-fe/js-sdk 2.1.1 → 2.1.2
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/index.d.ts +2 -1
- package/dist/js-sdk.js +28 -23
- package/dist/js-sdk.umd.js +2 -2
- package/package.json +4 -4
package/dist/js-sdk.umd.js
CHANGED
|
@@ -13,7 +13,7 @@ Ensure transformation logic is in the result function, and extraction logic is i
|
|
|
13
13
|
This means your output selector will likely run more frequently than intended.
|
|
14
14
|
Avoid returning a new reference inside your input selector, e.g.
|
|
15
15
|
\`createSelector([state => state.todos.map(todo => todo.id)], todoIds => todoIds.length)\``,{arguments:n,firstInputs:s,secondInputs:i,stack:c})}},tw={inputStabilityCheck:"once",identityFunctionCheck:"once"},fs=Symbol("NOT_FOUND");function nw(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function rw(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!="object")throw new TypeError(t)}function ow(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(n=>typeof n=="function")){const n=e.map(r=>typeof r=="function"?`function ${r.name||"unnamed"}()`:typeof r).join(", ");throw new TypeError(`${t}[${n}]`)}}var Zu=e=>Array.isArray(e)?e:[e];function sw(e){const t=Array.isArray(e[0])?e[0]:e;return ow(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function qu(e,t){const n=[],{length:r}=e;for(let o=0;o<r;o++)n.push(e[o].apply(null,t));return n}var iw=(e,t)=>{const{identityFunctionCheck:n,inputStabilityCheck:r}={...tw,...t};return{identityFunctionCheck:{shouldRun:n==="always"||n==="once"&&e,run:Q0},inputStabilityCheck:{shouldRun:r==="always"||r==="once"&&e,run:ew}}};function aw(e){let t;return{get(n){return t&&e(t.key,n)?t.value:fs},put(n,r){t={key:n,value:r}},getEntries(){return t?[t]:[]},clear(){t=void 0}}}function cw(e,t){let n=[];function r(a){const l=n.findIndex(c=>t(a,c.key));if(l>-1){const c=n[l];return l>0&&(n.splice(l,1),n.unshift(c)),c.value}return fs}function o(a,l){r(a)===fs&&(n.unshift({key:a,value:l}),n.length>e&&n.pop())}function s(){return n}function i(){n=[]}return{get:r,put:o,getEntries:s,clear:i}}var lw=(e,t)=>e===t;function uw(e){return function(n,r){if(n===null||r===null||n.length!==r.length)return!1;const{length:o}=n;for(let s=0;s<o;s++)if(!e(n[s],r[s]))return!1;return!0}}function dw(e,t){const n=typeof t=="object"?t:{equalityCheck:t},{equalityCheck:r=lw,maxSize:o=1,resultEqualityCheck:s}=n,i=uw(r);let a=0;const l=o<=1?aw(i):cw(o,i);function c(){let u=l.get(arguments);if(u===fs){if(u=e.apply(null,arguments),a++,s){const h=l.getEntries().find(p=>s(p.value,u));h&&(u=h.value,a!==0&&a--)}l.put(arguments,u)}return u}return c.clearCache=()=>{l.clear(),c.resetResultsCount()},c.resultsCount=()=>a,c.resetResultsCount=()=>{a=0},c}var fw=class{constructor(e){this.value=e}deref(){return this.value}},pw=typeof WeakRef<"u"?WeakRef:fw,hw=0,Xu=1;function ps(){return{s:hw,v:void 0,o:null,p:null}}function Ku(e,t={}){let n=ps();const{resultEqualityCheck:r}=t;let o,s=0;function i(){let a=n;const{length:l}=arguments;for(let d=0,h=l;d<h;d++){const p=arguments[d];if(typeof p=="function"||typeof p=="object"&&p!==null){let g=a.o;g===null&&(a.o=g=new WeakMap);const m=g.get(p);m===void 0?(a=ps(),g.set(p,a)):a=m}else{let g=a.p;g===null&&(a.p=g=new Map);const m=g.get(p);m===void 0?(a=ps(),g.set(p,a)):a=m}}const c=a;let u;if(a.s===Xu)u=a.v;else if(u=e.apply(null,arguments),s++,r){const d=o?.deref?.()??o;d!=null&&r(d,u)&&(u=d,s!==0&&s--),o=typeof u=="object"&&u!==null||typeof u=="function"?new pw(u):u}return c.s=Xu,c.v=u,u}return i.clearCache=()=>{n=ps(),i.resetResultsCount()},i.resultsCount=()=>s,i.resetResultsCount=()=>{s=0},i}function Ju(e,...t){const n=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,r=(...o)=>{let s=0,i=0,a,l={},c=o.pop();typeof c=="object"&&(l=c,c=o.pop()),nw(c,`createSelector expects an output function after the inputs, but received: [${typeof c}]`);const u={...n,...l},{memoize:d,memoizeOptions:h=[],argsMemoize:p=Ku,argsMemoizeOptions:g=[],devModeChecks:m={}}=u,v=Zu(h),y=Zu(g),b=sw(o),E=d(function(){return s++,c.apply(null,arguments)},...v);let x=!0;const w=p(function(){i++;const S=qu(b,arguments);if(a=E.apply(null,S),process.env.NODE_ENV!=="production"){const{identityFunctionCheck:I,inputStabilityCheck:A}=iw(x,m);if(I.shouldRun&&I.run(c,S,a),A.shouldRun){const L=qu(b,arguments);A.run({inputSelectorResults:S,inputSelectorResultsCopy:L},{memoize:d,memoizeOptions:v},arguments)}x&&(x=!1)}return a},...y);return Object.assign(w,{resultFunc:c,memoizedResultFunc:E,dependencies:b,dependencyRecomputations:()=>i,resetDependencyRecomputations:()=>{i=0},lastResult:()=>a,recomputations:()=>s,resetRecomputations:()=>{s=0},memoize:d,argsMemoize:p})};return Object.assign(r,{withTypes:()=>r}),r}var mw=Ju(Ku),gw=Object.assign((e,t=mw)=>{rw(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);const n=Object.keys(e),r=n.map(s=>e[s]);return t(r,(...s)=>s.reduce((i,a,l)=>(i[n[l]]=a,i),{}))},{withTypes:()=>gw});const vw=Ju({memoize:dw,memoizeOptions:{maxSize:1,equalityCheck:Object.is}}),he=(e,t,n,r,o,s,...i)=>{if(i.length>0)throw new Error(process.env.NODE_ENV!=="production"?"Unsupported number of selectors":it(1));let a;if(e&&t)a=(l,c,u,d)=>{const h=e(l,c,u,d);return t(h,c,u,d)};else if(e)a=e;else throw new Error("Missing arguments");return a},yw=(...e)=>{const t=new WeakMap;let n=1;const r=e[e.length-1],o=e.length-1||1,s=r.length-o;if(s>3)throw new Error(process.env.NODE_ENV!=="production"?"Unsupported number of arguments":it(2));return(a,l,c,u)=>{let d=a.__cacheKey__;d||(d={id:n},a.__cacheKey__=d,n+=1);let h=t.get(d);if(!h){let p=e;const g=[void 0,void 0,void 0];switch(s){case 0:break;case 1:{p=[...e.slice(0,-1),()=>g[0],r];break}case 2:{p=[...e.slice(0,-1),()=>g[0],()=>g[1],r];break}case 3:{p=[...e.slice(0,-1),()=>g[0],()=>g[1],()=>g[2],r];break}default:throw new Error(process.env.NODE_ENV!=="production"?"Unsupported number of arguments":it(2))}h=vw(...p),h.selectorArgs=g,t.set(d,h)}switch(h.selectorArgs[0]=l,h.selectorArgs[1]=c,h.selectorArgs[2]=u,s){case 0:return h(a);case 1:return h(a,l);case 2:return h(a,l,c);case 3:return h(a,l,c,u);default:throw new Error("unreachable")}}};var hs=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function bw(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ms={exports:{}},fa={};var Qu;function ww(){if(Qu)return fa;Qu=1;var e=W;function t(d,h){return d===h&&(d!==0||1/d===1/h)||d!==d&&h!==h}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,o=e.useEffect,s=e.useLayoutEffect,i=e.useDebugValue;function a(d,h){var p=h(),g=r({inst:{value:p,getSnapshot:h}}),m=g[0].inst,v=g[1];return s(function(){m.value=p,m.getSnapshot=h,l(m)&&v({inst:m})},[d,p,h]),o(function(){return l(m)&&v({inst:m}),d(function(){l(m)&&v({inst:m})})},[d]),i(p),p}function l(d){var h=d.getSnapshot;d=d.value;try{var p=h();return!n(d,p)}catch{return!0}}function c(d,h){return h()}var u=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c:a;return fa.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:u,fa}var pa={};var ed;function Ew(){return ed||(ed=1,process.env.NODE_ENV!=="production"&&(function(){function e(p,g){return p===g&&(p!==0||1/p===1/g)||p!==p&&g!==g}function t(p,g){u||o.startTransition===void 0||(u=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var m=g();if(!d){var v=g();s(m,v)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),d=!0)}v=i({inst:{value:m,getSnapshot:g}});var y=v[0].inst,b=v[1];return l(function(){y.value=m,y.getSnapshot=g,n(y)&&b({inst:y})},[p,m,g]),a(function(){return n(y)&&b({inst:y}),p(function(){n(y)&&b({inst:y})})},[p]),c(m),m}function n(p){var g=p.getSnapshot;p=p.value;try{var m=g();return!s(p,m)}catch{return!0}}function r(p,g){return g()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var o=W,s=typeof Object.is=="function"?Object.is:e,i=o.useState,a=o.useEffect,l=o.useLayoutEffect,c=o.useDebugValue,u=!1,d=!1,h=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?r:t;pa.useSyncExternalStore=o.useSyncExternalStore!==void 0?o.useSyncExternalStore:h,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),pa}var td;function ha(){return td||(td=1,process.env.NODE_ENV==="production"?ms.exports=ww():ms.exports=Ew()),ms.exports}var xw=ha(),gs={exports:{}},ma={};var nd;function Sw(){if(nd)return ma;nd=1;var e=W,t=ha();function n(c,u){return c===u&&(c!==0||1/c===1/u)||c!==c&&u!==u}var r=typeof Object.is=="function"?Object.is:n,o=t.useSyncExternalStore,s=e.useRef,i=e.useEffect,a=e.useMemo,l=e.useDebugValue;return ma.useSyncExternalStoreWithSelector=function(c,u,d,h,p){var g=s(null);if(g.current===null){var m={hasValue:!1,value:null};g.current=m}else m=g.current;g=a(function(){function y(T){if(!b){if(b=!0,E=T,T=h(T),p!==void 0&&m.hasValue){var S=m.value;if(p(S,T))return x=S}return x=T}if(S=x,r(E,T))return S;var I=h(T);return p!==void 0&&p(S,I)?(E=T,S):(E=T,x=I)}var b=!1,E,x,w=d===void 0?null:d;return[function(){return y(u())},w===null?void 0:function(){return y(w())}]},[u,d,h,p]);var v=o(c,g[0],g[1]);return i(function(){m.hasValue=!0,m.value=v},[v]),l(v),v},ma}var ga={};var rd;function Cw(){return rd||(rd=1,process.env.NODE_ENV!=="production"&&(function(){function e(c,u){return c===u&&(c!==0||1/c===1/u)||c!==c&&u!==u}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=W,n=ha(),r=typeof Object.is=="function"?Object.is:e,o=n.useSyncExternalStore,s=t.useRef,i=t.useEffect,a=t.useMemo,l=t.useDebugValue;ga.useSyncExternalStoreWithSelector=function(c,u,d,h,p){var g=s(null);if(g.current===null){var m={hasValue:!1,value:null};g.current=m}else m=g.current;g=a(function(){function y(T){if(!b){if(b=!0,E=T,T=h(T),p!==void 0&&m.hasValue){var S=m.value;if(p(S,T))return x=S}return x=T}if(S=x,r(E,T))return S;var I=h(T);return p!==void 0&&p(S,I)?(E=T,S):(E=T,x=I)}var b=!1,E,x,w=d===void 0?null:d;return[function(){return y(u())},w===null?void 0:function(){return y(w())}]},[u,d,h,p]);var v=o(c,g[0],g[1]);return i(function(){m.hasValue=!0,m.value=v},[v]),l(v),v},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),ga}var od;function Tw(){return od||(od=1,process.env.NODE_ENV==="production"?gs.exports=Sw():gs.exports=Cw()),gs.exports}var Ow=Tw();const kw=parseInt(f.version,10);function va(e){return kw>=e}const Rw=va(19)?Iw:Nw;function sd(e,t,n,r,o){return Rw(e,t,n,r,o)}function Pw(e,t,n,r,o){const s=f.useCallback(()=>t(e.getSnapshot(),n,r,o),[e,t,n,r,o]);return xw.useSyncExternalStore(e.subscribe,s,s)}function Iw(e,t,n,r,o){return Pw(e,t,n,r,o)}function Nw(e,t,n,r,o){return Ow.useSyncExternalStoreWithSelector(e.subscribe,e.getSnapshot,e.getSnapshot,s=>t(s,n,r,o))}class _w{constructor(t){this.state=t,this.listeners=new Set,this.updateTick=0}subscribe=t=>(this.listeners.add(t),()=>{this.listeners.delete(t)});getSnapshot=()=>this.state;setState(t){if(this.state===t)return;this.state=t,this.updateTick+=1;const n=this.updateTick;for(const r of this.listeners){if(n!==this.updateTick)return;r(t)}}update(t){for(const n in t)if(!Object.is(this.state[n],t[n])){this.setState({...this.state,...t});return}}set(t,n){Object.is(this.state[t],n)||this.setState({...this.state,[t]:n})}notifyAll(){const t={...this.state};this.setState(t)}use(t,n,r,o){return sd(this,t,n,r,o)}}const ya=f[`useInsertionEffect${Math.random().toFixed(1)}`.slice(0,-3)],Aw=ya&&ya!==f.useLayoutEffect?ya:e=>e();function me(e){const t=ht(Dw).current;return t.next=e,Aw(t.effect),t.trampoline}function Dw(){const e={next:void 0,callback:Mw,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function Mw(){if(process.env.NODE_ENV!=="production")throw new Error("Base UI: Cannot call an event handler while rendering.")}const ve=typeof document<"u"?f.useLayoutEffect:()=>{};function mt(){}const tt=Object.freeze({});class vs extends _w{constructor(t,n={},r){super(t),this.context=n,this.selectors=r}useSyncedValue(t,n){f.useDebugValue(t),ve(()=>{this.state[t]!==n&&this.set(t,n)},[t,n])}useSyncedValueWithCleanup(t,n){const r=this;ve(()=>(r.state[t]!==n&&r.set(t,n),()=>{r.set(t,void 0)}),[r,t,n])}useSyncedValues(t){const n=this;if(process.env.NODE_ENV!=="production"){f.useDebugValue(t,i=>Object.keys(i));const o=f.useRef(Object.keys(t)).current,s=Object.keys(t);(o.length!==s.length||o.some((i,a)=>i!==s[a]))&&console.error("ReactStore.useSyncedValues expects the same prop keys on every render. Keys should be stable.")}const r=Object.values(t);ve(()=>{n.update(t)},[n,...r])}useControlledProp(t,n){f.useDebugValue(t);const r=n!==void 0;if(ve(()=>{r&&!Object.is(this.state[t],n)&&super.setState({...this.state,[t]:n})},[t,n,r]),process.env.NODE_ENV!=="production"){const o=this.controlledValues??=new Map;o.has(t)||o.set(t,r);const s=o.get(t);s!==void 0&&s!==r&&console.error(`A component is changing the ${r?"":"un"}controlled state of ${t.toString()} to be ${r?"un":""}controlled. Elements should not switch from uncontrolled to controlled (or vice versa).`)}}select(t,n,r,o){const s=this.selectors[t];return s(this.state,n,r,o)}useState(t,n,r,o){return f.useDebugValue(t),sd(this,this.selectors[t],n,r,o)}useContextCallback(t,n){f.useDebugValue(t);const r=me(n??mt);this.context[t]=r}useStateSetter(t){const n=f.useRef(void 0);return n.current===void 0&&(n.current=r=>{this.set(t,r)}),n.current}observe(t,n){let r;typeof t=="function"?r=t:r=this.selectors[t];let o=r(this.state);return n(o,o,this),this.subscribe(s=>{const i=r(s);if(!Object.is(o,i)){const a=o;o=i,n(i,a,this)}})}}const ys=null;let id=globalThis.requestAnimationFrame,Lw=class{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=t=>{this.isScheduled=!1;const n=this.callbacks,r=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,r>0)for(let o=0;o<n.length;o+=1)n[o]?.(t)};request(t){const n=this.nextId;this.nextId+=1,this.callbacks.push(t),this.callbacksCount+=1;const r=process.env.NODE_ENV!=="production"&&id!==requestAnimationFrame&&(id=requestAnimationFrame,!0);return(!this.isScheduled||r)&&(requestAnimationFrame(this.tick),this.isScheduled=!0),n}cancel(t){const n=t-this.startId;n<0||n>=this.callbacks.length||(this.callbacks[n]=null,this.callbacksCount-=1)}};const bs=new Lw;let Nn=class Av{static create(){return new Av}static request(t){return bs.request(t)}static cancel(t){return bs.cancel(t)}currentId=ys;request(t){this.cancel(),this.currentId=bs.request(()=>{this.currentId=ys,t()})}cancel=()=>{this.currentId!==ys&&(bs.cancel(this.currentId),this.currentId=ys)};disposeEffect=()=>this.cancel};function ba(){const e=ht(Nn.create).current;return mo(e.disposeEffect),e}const go=0;let zt=class Dv{static create(){return new Dv}currentId=go;start(t,n){this.clear(),this.currentId=setTimeout(()=>{this.currentId=go,n()},t)}isStarted(){return this.currentId!==go}clear=()=>{this.currentId!==go&&(clearTimeout(this.currentId),this.currentId=go)};disposeEffect=()=>this.clear};function _n(){const e=ht(zt.create).current;return mo(e.disposeEffect),e}let ad=0;function $w(e){return ad+=1,`${e}-${Math.random().toString(36).slice(2,6)}-${ad}`}function ws(){return typeof window<"u"}function An(e){return wa(e)?(e.nodeName||"").toLowerCase():"#document"}function nt(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function en(e){var t;return(t=(wa(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function wa(e){return ws()?e instanceof Node||e instanceof nt(e).Node:!1}function $e(e){return ws()?e instanceof Element||e instanceof nt(e).Element:!1}function rt(e){return ws()?e instanceof HTMLElement||e instanceof nt(e).HTMLElement:!1}function vo(e){return!ws()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof nt(e).ShadowRoot}function Dn(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Rt(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&o!=="inline"&&o!=="contents"}function Fw(e){return/^(table|td|th)$/.test(An(e))}function Es(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const Vw=/transform|translate|scale|rotate|perspective|filter/,Bw=/paint|layout|strict|content/,er=e=>!!e&&e!=="none";let Ea;function xa(e){const t=$e(e)?Rt(e):e;return er(t.transform)||er(t.translate)||er(t.scale)||er(t.rotate)||er(t.perspective)||!xs()&&(er(t.backdropFilter)||er(t.filter))||Vw.test(t.willChange||"")||Bw.test(t.contain||"")}function Ww(e){let t=mn(e);for(;rt(t)&&!hn(t);){if(xa(t))return t;if(Es(t))return null;t=mn(t)}return null}function xs(){return Ea==null&&(Ea=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Ea}function hn(e){return/^(html|body|#document)$/.test(An(e))}function Rt(e){return nt(e).getComputedStyle(e)}function Ss(e){return $e(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function mn(e){if(An(e)==="html")return e;const t=e.assignedSlot||e.parentNode||vo(e)&&e.host||en(e);return vo(t)?t.host:t}function cd(e){const t=mn(e);return hn(t)?e.ownerDocument?e.ownerDocument.body:e.body:rt(t)&&Dn(t)?t:cd(t)}function yo(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=cd(e),s=o===((r=e.ownerDocument)==null?void 0:r.body),i=nt(o);if(s){const a=Sa(i);return t.concat(i,i.visualViewport||[],Dn(o)?o:[],a&&n?yo(a):[])}else return t.concat(o,yo(o,[],n))}function Sa(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Ae(e){return e?.ownerDocument||document}function Ca(e,t){if(typeof e=="string")return{description:e};if(typeof e=="function"){const n=e(t);return typeof n=="string"?{description:n}:n}return e}const kr=typeof navigator<"u",Ta=Hw(),ld=Gw(),ud=Uw(),dd=typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter:none"),fd=Ta.platform==="MacIntel"&&Ta.maxTouchPoints>1?!0:/iP(hone|ad|od)|iOS/.test(Ta.platform),jw=kr&&/apple/i.test(navigator.vendor),Oa=kr&&/android/i.test(ld)||/android/i.test(ud);kr&&ld.toLowerCase().startsWith("mac")&&navigator.maxTouchPoints;const pd=ud.includes("jsdom/");function Hw(){if(!kr)return{platform:"",maxTouchPoints:-1};const e=navigator.userAgentData;return e?.platform?{platform:e.platform,maxTouchPoints:navigator.maxTouchPoints}:{platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??-1}}function Uw(){if(!kr)return"";const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(({brand:t,version:n})=>`${t}/${n}`).join(" "):navigator.userAgent}function Gw(){if(!kr)return"";const e=navigator.userAgentData;return e?.platform?e.platform:navigator.platform??""}const ka="data-base-ui-focusable",hd="active",md="selected",gd="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function $t(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function ke(e,t){if(!e||!t)return!1;const n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&vo(n)){let r=t;for(;r;){if(e===r)return!0;r=r.parentNode||r.host}}return!1}function vd(e,t){if(!$e(e))return!1;const n=e;if(t.hasElement(n))return!n.hasAttribute("data-trigger-disabled");for(const[,r]of t.entries())if(ke(r,n))return!r.hasAttribute("data-trigger-disabled");return!1}function gt(e){return"composedPath"in e?e.composedPath()[0]:e.target}function Yt(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);const n=e;return n.target!=null&&t.contains(n.target)}function zw(e){return e.matches("html,body")}function Ra(e){return rt(e)&&e.matches(gd)}function yd(e){return e?e.getAttribute("role")==="combobox"&&Ra(e):!1}function Pa(e){if(!e||pd)return!0;try{return e.matches(":focus-visible")}catch{return!0}}function Ia(e){return e?e.hasAttribute(ka)?e:e.querySelector(`[${ka}]`)||e:null}function gn(e,t,n=!0){return e.filter(o=>o.parentId===t&&(!n||o.context?.open)).flatMap(o=>[o,...gn(e,o.id,n)])}function bd(e,t){let n=[],r=e.find(o=>o.id===t)?.parentId;for(;r;){const o=e.find(s=>s.id===r);r=o?.parentId,o&&(n=n.concat(o))}return n}function Yw(e){e.preventDefault(),e.stopPropagation()}function Zw(e){return"nativeEvent"in e}function qw(e){return e.pointerType===""&&e.isTrusted?!0:Oa&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function Xw(e){return pd?!1:!Oa&&e.width===0&&e.height===0||Oa&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType==="mouse"||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType==="touch"}function bo(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}function wd(e){const t=e.type;return t==="click"||t==="mousedown"||t==="keydown"||t==="keyup"}const Kw=["top","right","bottom","left"],Rr=Math.min,Pt=Math.max,Cs=Math.round,Ts=Math.floor,tn=e=>({x:e,y:e}),Jw={left:"right",right:"left",bottom:"top",top:"bottom"};function Na(e,t,n){return Pt(e,Rr(t,n))}function vn(e,t){return typeof e=="function"?e(t):e}function xt(e){return e.split("-")[0]}function Mn(e){return e.split("-")[1]}function _a(e){return e==="x"?"y":"x"}function Aa(e){return e==="y"?"height":"width"}function Ft(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Da(e){return _a(Ft(e))}function Qw(e,t,n){n===void 0&&(n=!1);const r=Mn(e),o=Da(e),s=Aa(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=Os(i)),[i,Os(i)]}function e1(e){const t=Os(e);return[Ma(e),t,Ma(t)]}function Ma(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Ed=["left","right"],xd=["right","left"],t1=["top","bottom"],n1=["bottom","top"];function r1(e,t,n){switch(e){case"top":case"bottom":return n?t?xd:Ed:t?Ed:xd;case"left":case"right":return t?t1:n1;default:return[]}}function o1(e,t,n,r){const o=Mn(e);let s=r1(xt(e),n==="start",r);return o&&(s=s.map(i=>i+"-"+o),t&&(s=s.concat(s.map(Ma)))),s}function Os(e){const t=xt(e);return Jw[t]+e.slice(t.length)}function s1(e){return{top:0,right:0,bottom:0,left:0,...e}}function Sd(e){return typeof e!="number"?s1(e):{top:e,right:e,bottom:e,left:e}}function ks(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 i1(e){return Rt(e).display!=="none"}var a1=["input:not([inert]):not([inert] *)","select:not([inert]):not([inert] *)","textarea:not([inert]):not([inert] *)","a[href]:not([inert]):not([inert] *)","button:not([inert]):not([inert] *)","[tabindex]:not(slot):not([inert]):not([inert] *)","audio[controls]:not([inert]):not([inert] *)","video[controls]:not([inert]):not([inert] *)",'[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)',"details>summary:first-of-type:not([inert]):not([inert] *)","details:not([inert]):not([inert] *)"],Rs=a1.join(","),Cd=typeof Element>"u",Pr=Cd?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Ps=!Cd&&Element.prototype.getRootNode?function(e){var t;return e==null||(t=e.getRootNode)===null||t===void 0?void 0:t.call(e)}:function(e){return e?.ownerDocument},Is=function(t,n){var r;n===void 0&&(n=!0);var o=t==null||(r=t.getAttribute)===null||r===void 0?void 0:r.call(t,"inert"),s=o===""||o==="true",i=s||n&&t&&(typeof t.closest=="function"?t.closest("[inert]"):Is(t.parentNode));return i},c1=function(t){var n,r=t==null||(n=t.getAttribute)===null||n===void 0?void 0:n.call(t,"contenteditable");return r===""||r==="true"},Td=function(t,n,r){if(Is(t))return[];var o=Array.prototype.slice.apply(t.querySelectorAll(Rs));return n&&Pr.call(t,Rs)&&o.unshift(t),o=o.filter(r),o},Ns=function(t,n,r){for(var o=[],s=Array.from(t);s.length;){var i=s.shift();if(!Is(i,!1))if(i.tagName==="SLOT"){var a=i.assignedElements(),l=a.length?a:i.children,c=Ns(l,!0,r);r.flatten?o.push.apply(o,c):o.push({scopeParent:i,candidates:c})}else{var u=Pr.call(i,Rs);u&&r.filter(i)&&(n||!t.includes(i))&&o.push(i);var d=i.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(i),h=!Is(d,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(i));if(d&&h){var p=Ns(d===!0?i.children:d.children,!0,r);r.flatten?o.push.apply(o,p):o.push({scopeParent:i,candidates:p})}else s.unshift.apply(s,i.children)}}return o},Od=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},kd=function(t){if(!t)throw new Error("No node provided");return t.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||c1(t))&&!Od(t)?0:t.tabIndex},l1=function(t,n){var r=kd(t);return r<0&&n&&!Od(t)?0:r},u1=function(t,n){return t.tabIndex===n.tabIndex?t.documentOrder-n.documentOrder:t.tabIndex-n.tabIndex},Rd=function(t){return t.tagName==="INPUT"},d1=function(t){return Rd(t)&&t.type==="hidden"},f1=function(t){var n=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(r){return r.tagName==="SUMMARY"});return n},p1=function(t,n){for(var r=0;r<t.length;r++)if(t[r].checked&&t[r].form===n)return t[r]},h1=function(t){if(!t.name)return!0;var n=t.form||Ps(t),r=function(a){return n.querySelectorAll('input[type="radio"][name="'+a+'"]')},o;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")o=r(window.CSS.escape(t.name));else try{o=r(t.name)}catch(i){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",i.message),!1}var s=p1(o,t.form);return!s||s===t},m1=function(t){return Rd(t)&&t.type==="radio"},g1=function(t){return m1(t)&&!h1(t)},v1=function(t){var n,r=t&&Ps(t),o=(n=r)===null||n===void 0?void 0:n.host,s=!1;if(r&&r!==t){var i,a,l;for(s=!!((i=o)!==null&&i!==void 0&&(a=i.ownerDocument)!==null&&a!==void 0&&a.contains(o)||t!=null&&(l=t.ownerDocument)!==null&&l!==void 0&&l.contains(t));!s&&o;){var c,u,d;r=Ps(o),o=(c=r)===null||c===void 0?void 0:c.host,s=!!((u=o)!==null&&u!==void 0&&(d=u.ownerDocument)!==null&&d!==void 0&&d.contains(o))}}return s},Pd=function(t){var n=t.getBoundingClientRect(),r=n.width,o=n.height;return r===0&&o===0},y1=function(t,n){var r=n.displayCheck,o=n.getShadowRoot;if(r==="full-native"&&"checkVisibility"in t){var s=t.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});return!s}if(getComputedStyle(t).visibility==="hidden")return!0;var i=Pr.call(t,"details>summary:first-of-type"),a=i?t.parentElement:t;if(Pr.call(a,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="full-native"||r==="legacy-full"){if(typeof o=="function"){for(var l=t;t;){var c=t.parentElement,u=Ps(t);if(c&&!c.shadowRoot&&o(c)===!0)return Pd(t);t.assignedSlot?t=t.assignedSlot:!c&&u!==t.ownerDocument?t=u.host:t=c}t=l}if(v1(t))return!t.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return Pd(t);return!1},b1=function(t){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(t.tagName))for(var n=t.parentElement;n;){if(n.tagName==="FIELDSET"&&n.disabled){for(var r=0;r<n.children.length;r++){var o=n.children.item(r);if(o.tagName==="LEGEND")return Pr.call(n,"fieldset[disabled] *")?!0:!o.contains(t)}return!0}n=n.parentElement}return!1},La=function(t,n){return!(n.disabled||d1(n)||y1(n,t)||f1(n)||b1(n))},$a=function(t,n){return!(g1(n)||kd(n)<0||!La(t,n))},w1=function(t){var n=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},Id=function(t){var n=[],r=[];return t.forEach(function(o,s){var i=!!o.scopeParent,a=i?o.scopeParent:o,l=l1(a,i),c=i?Id(o.candidates):a;l===0?i?n.push.apply(n,c):n.push(a):r.push({documentOrder:s,tabIndex:l,item:o,isScope:i,content:c})}),r.sort(u1).reduce(function(o,s){return s.isScope?o.push.apply(o,s.content):o.push(s.content),o},[]).concat(n)},wo=function(t,n){n=n||{};var r;return n.getShadowRoot?r=Ns([t],n.includeContainer,{filter:$a.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:w1}):r=Td(t,n.includeContainer,$a.bind(null,n)),Id(r)},E1=function(t,n){n=n||{};var r;return n.getShadowRoot?r=Ns([t],n.includeContainer,{filter:La.bind(null,n),flatten:!0,getShadowRoot:n.getShadowRoot}):r=Td(t,n.includeContainer,La.bind(null,n)),r},Nd=function(t,n){if(n=n||{},!t)throw new Error("No node provided");return Pr.call(t,Rs)===!1?!1:$a(n,t)};const Ir=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function _d(e,t){const n=wo(e,Ir()),r=n.length;if(r===0)return;const o=$t(Ae(e)),s=n.indexOf(o),i=s===-1?t===1?0:r-1:s+t;return n[i]}function Fa(e){return _d(Ae(e).body,1)||e}function Ad(e){return _d(Ae(e).body,-1)||e}function Dd(e,t){if(!e)return null;const n=wo(Ae(e).body,Ir()),r=n.length;if(r===0)return null;const o=n.indexOf(e);if(o===-1)return null;const s=(o+t+r)%r;return n[s]}function x1(e){return Dd(e,1)}function S1(e){return Dd(e,-1)}function Nr(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!ke(n,r)}function C1(e){wo(e,Ir()).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function Md(e){e.querySelectorAll("[data-tabindex]").forEach(n=>{const r=n.dataset.tabindex;delete n.dataset.tabindex,r?n.setAttribute("tabindex",r):n.removeAttribute("tabindex")})}const _s=yw(e=>e.toasts,e=>{const t=new Map;let n=0,r=0;return e.forEach((o,s)=>{const i=o.transitionStatus==="ending";t.set(o.id,{value:o,domIndex:s,visibleIndex:i?-1:n,offsetY:r}),r+=o.height||0,i||(n+=1)}),t}),yn={toasts:he(e=>e.toasts),isEmpty:he(e=>e.toasts.length===0),toast:he(_s,(e,t)=>e.get(t)?.value),toastIndex:he(_s,(e,t)=>e.get(t)?.domIndex??-1),toastOffsetY:he(_s,(e,t)=>e.get(t)?.offsetY??0),toastVisibleIndex:he(_s,(e,t)=>e.get(t)?.visibleIndex??-1),hovering:he(e=>e.hovering),focused:he(e=>e.focused),expanded:he(e=>e.hovering||e.focused),expandedOrOutOfFocus:he(e=>e.hovering||e.focused||!e.isWindowFocused),prevFocusElement:he(e=>e.prevFocusElement)};class T1 extends vs{timers=new Map;areTimersPaused=!1;constructor(t){super(t,{},yn)}setFocused(t){this.set("focused",t)}setHovering(t){this.set("hovering",t)}setIsWindowFocused(t){this.set("isWindowFocused",t)}setPrevFocusElement(t){this.set("prevFocusElement",t)}setViewport=t=>{this.set("viewport",t)};disposeEffect=()=>()=>{this.timers.forEach(t=>{t.timeout?.clear()}),this.timers.clear()};removeToast(t){const n=yn.toastIndex(this.state,t);if(n===-1)return;this.state.toasts[n]?.onRemove?.();const o=[...this.state.toasts];o.splice(n,1),this.setToasts(o)}addToast=t=>{const{toasts:n,timeout:r,limit:o}=this.state,s=t.id||$w("toast"),i={...t,id:s,transitionStatus:"starting"},a=[i,...n],l=a.filter(u=>u.transitionStatus!=="ending");if(l.length>o){const u=l.length-o,d=l.slice(-u),h=new Set(d.map(p=>p.id));this.setToasts(a.map(p=>{const g=h.has(p.id);return p.limited!==g?{...p,limited:g}:p}))}else this.setToasts(a.map(u=>u.limited?{...u,limited:!1}:u));const c=i.timeout??r;return i.type!=="loading"&&c>0&&this.scheduleTimer(s,c,()=>this.closeToast(s)),yn.expandedOrOutOfFocus(this.state)&&this.pauseTimers(),s};updateToast=(t,n)=>{this.updateToastInternal(t,n)};updateToastInternal=(t,n)=>{const{timeout:r,toasts:o}=this.state,s=yn.toast(this.state,t)??null;if(!s||s.transitionStatus==="ending")return;const i={...s,...n};this.setToasts(o.map(g=>g.id===t?{...g,...n}:g));const a=i.timeout??r,l=s?.timeout??r,c=Object.hasOwn(n,"timeout"),u=i.transitionStatus!=="ending"&&i.type!=="loading"&&a>0,d=this.timers.has(t),h=l!==a,p=s?.type==="loading";if(!u&&d){this.timers.get(t)?.timeout?.clear(),this.timers.delete(t);return}if(u&&(!d||h||c||p)){const g=this.timers.get(t);g&&(g.timeout?.clear(),this.timers.delete(t)),this.scheduleTimer(t,a,()=>this.closeToast(t)),yn.expandedOrOutOfFocus(this.state)&&this.pauseTimers()}};closeToast=t=>{const n=t===void 0,{limit:r,toasts:o}=this.state;let s;if(n)s=o,this.timers.forEach(c=>{c.timeout?.clear()}),this.timers.clear();else{const c=yn.toast(this.state,t);if(!c)return;s=[c];const u=this.timers.get(t);u?.timeout&&(u.timeout.clear(),this.timers.delete(t))}let i=0;const l={toasts:o.map(c=>{if(n||c.id===t)return{...c,transitionStatus:"ending",height:0};if(c.transitionStatus==="ending")return c;const u=i>=r;return i+=1,c.limited!==u?{...c,limited:u}:c})};(n||o.length===1)&&(l.hovering=!1,l.focused=!1),this.update(l),s.forEach(c=>{c.transitionStatus!=="ending"&&c.onClose?.()}),this.handleFocusManagement(t)};promiseToast=(t,n)=>{const r=Ca(n.loading),o=this.addToast({...r,type:"loading"}),s=t.then(i=>{const a=Ca(n.success,i);return this.updateToast(o,{...a,type:"success",timeout:a.timeout}),i}).catch(i=>{const a=Ca(n.error,i);return this.updateToast(o,{...a,type:"error",timeout:a.timeout}),Promise.reject(i)});return{}.hasOwnProperty.call(n,"setPromise")&&n.setPromise(s),s};pauseTimers(){this.areTimersPaused||(this.areTimersPaused=!0,this.timers.forEach(t=>{if(t.timeout){t.timeout.clear();const n=Date.now()-t.start,r=t.delay-n;t.remaining=r>0?r:0}}))}resumeTimers(){this.areTimersPaused&&(this.areTimersPaused=!1,this.timers.forEach((t,n)=>{t.remaining=t.remaining>0?t.remaining:t.delay,t.timeout??=zt.create(),t.timeout.start(t.remaining,()=>{this.timers.delete(n),t.callback()}),t.start=Date.now()}))}restoreFocusToPrevElement(){this.state.prevFocusElement?.focus({preventScroll:!0})}handleDocumentPointerDown=t=>{if(t.pointerType!=="touch")return;const n=gt(t);ke(this.state.viewport,n)||(this.resumeTimers(),this.update({hovering:!1,focused:!1}))};scheduleTimer(t,n,r){const o=Date.now(),s=!yn.expandedOrOutOfFocus(this.state),i=s?zt.create():void 0;i?.start(n,()=>{this.timers.delete(t),r()}),this.timers.set(t,{timeout:i,start:s?o:0,delay:n,remaining:n,callback:r})}setToasts(t){const n={toasts:t};t.length===0&&(n.hovering=!1,n.focused=!1),this.update(n)}handleFocusManagement(t){const n=$t(Ae(this.state.viewport));if(!this.state.viewport||!ke(this.state.viewport,n)||!Pa(n))return;if(t===void 0){this.restoreFocusToPrevElement();return}const r=yn.toasts(this.state),o=yn.toastIndex(this.state,t);let s=null,i=o+1;for(;i<r.length;){if(r[i].transitionStatus!=="ending"){s=r[i];break}i+=1}if(!s)for(i=o-1;i>=0;){if(r[i].transitionStatus!=="ending"){s=r[i];break}i-=1}s?s.ref?.current?.focus():this.restoreFocusToPrevElement()}}const Ld=function(t){const{children:n,timeout:r=5e3,limit:o=3,toastManager:s}=t,i=ht(()=>new T1({timeout:r,limit:o,viewport:null,toasts:[],hovering:!1,focused:!1,isWindowFocused:!0,prevFocusElement:null})).current;return mo(i.disposeEffect),f.useEffect(function(){return s?s[" subscribe"](({action:c,options:u})=>{const d=u.id;c==="promise"&&u.promise?i.promiseToast(u.promise,u):c==="update"&&d?i.updateToast(d,u):c==="close"?i.closeToast(d):i.addToast(u)}):void 0},[i,r,s]),i.useSyncedValues({timeout:r,limit:o}),O.jsx(ds.Provider,{value:i,children:n})};process.env.NODE_ENV!=="production"&&(Ld.displayName="ToastProvider");const $d={clipPath:"inset(50%)",overflow:"hidden",whiteSpace:"nowrap",border:0,padding:0,width:1,height:1,margin:-1},Va={...$d,position:"fixed",top:0,left:0},O1={...$d,position:"absolute"},nn=f.forwardRef(function(t,n){const[r,o]=f.useState();ve(()=>{jw&&o("button")},[]);const s={tabIndex:0,role:r};return O.jsx("span",{...t,ref:n,style:Va,"aria-hidden":r?void 0:!0,...s,"data-base-ui-focus-guard":""})});process.env.NODE_ENV!=="production"&&(nn.displayName="FocusGuard");function Eo(e,t,n,r){const o=ht(Fd).current;return R1(o,e,t,n,r)&&Vd(o,[e,t,n,r]),o.callback}function k1(e){const t=ht(Fd).current;return P1(t,e)&&Vd(t,e),t.callback}function Fd(){return{callback:null,cleanup:null,refs:[]}}function R1(e,t,n,r,o){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==r||e.refs[3]!==o}function P1(e,t){return e.refs.length!==t.length||e.refs.some((n,r)=>n!==t[r])}function Vd(e,t){if(e.refs=t,t.every(n=>n==null)){e.callback=null;return}e.callback=n=>{if(e.cleanup&&(e.cleanup(),e.cleanup=null),n!=null){const r=Array(t.length).fill(null);for(let o=0;o<t.length;o+=1){const s=t[o];if(s!=null)switch(typeof s){case"function":{const i=s(n);typeof i=="function"&&(r[o]=i);break}case"object":{s.current=n;break}}}e.cleanup=()=>{for(let o=0;o<t.length;o+=1){const s=t[o];if(s!=null)switch(typeof s){case"function":{const i=r[o];typeof i=="function"?i():s(null);break}case"object":{s.current=null;break}}}}}}}function Bd(e){if(!f.isValidElement(e))return null;const t=e,n=t.props;return(va(19)?n?.ref:t.ref)??null}function Ba(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}let Wa;process.env.NODE_ENV!=="production"&&(Wa=new Set);function I1(...e){if(process.env.NODE_ENV!=="production"){const t=e.join(" ");Wa.has(t)||(Wa.add(t),console.warn(`Base UI: ${t}`))}}function N1(e,t){const n={};for(const r in e){const o=e[r];if(t?.hasOwnProperty(r)){const s=t[r](o);s!=null&&Object.assign(n,s);continue}o===!0?n[`data-${r.toLowerCase()}`]="":o&&(n[`data-${r.toLowerCase()}`]=o.toString())}return n}function _1(e,t){return typeof e=="function"?e(t):e}function A1(e,t){return typeof e=="function"?e(t):e}const xo={};function _r(e,t,n,r,o){let s={...ja(e,xo)};return t&&(s=As(s,t)),n&&(s=As(s,n)),r&&(s=As(s,r)),s}function D1(e){if(e.length===0)return xo;if(e.length===1)return ja(e[0],xo);let t={...ja(e[0],xo)};for(let n=1;n<e.length;n+=1)t=As(t,e[n]);return t}function As(e,t){return Wd(t)?t(e):M1(e,t)}function M1(e,t){if(!t)return e;for(const n in t){const r=t[n];switch(n){case"style":{e[n]=Ba(e.style,r);break}case"className":{e[n]=jd(e.className,r);break}default:L1(n,r)?e[n]=$1(e[n],r):e[n]=r}}return e}function L1(e,t){const n=e.charCodeAt(0),r=e.charCodeAt(1),o=e.charCodeAt(2);return n===111&&r===110&&o>=65&&o<=90&&(typeof t=="function"||typeof t>"u")}function Wd(e){return typeof e=="function"}function ja(e,t){return Wd(e)?e(t):e??xo}function $1(e,t){return t?e?n=>{if(F1(n)){const o=n;Ha(o);const s=t(o);return o.baseUIHandlerPrevented||e?.(o),s}const r=t(n);return e?.(n),r}:t:e}function Ha(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function jd(e,t){return t?e?t+" "+e:t:e}function F1(e){return e!=null&&typeof e=="object"&&"nativeEvent"in e}const V1=500,B1={style:{transition:"none"}},Ua="data-base-ui-click-trigger",W1="data-base-ui-swipe-ignore",j1="data-swipe-ignore",H1=`[${W1}]`,U1=`[${j1}]`,G1={fallbackAxisSide:"end"},z1={clipPath:"inset(50%)",position:"fixed",top:0,left:0};function ze(e,t,n={}){const r=t.render,o=Y1(t,n);if(n.enabled===!1)return null;const s=n.state??tt;return q1(e,r,o,s)}function Y1(e,t={}){const{className:n,style:r,render:o}=e,{state:s=tt,ref:i,props:a,stateAttributesMapping:l,enabled:c=!0}=t,u=c?_1(n,s):void 0,d=c?A1(r,s):void 0,h=c?N1(s,l):tt,p=c?Ba(h,Array.isArray(a)?D1(a):a)??tt:tt;return typeof document<"u"&&(c?Array.isArray(i)?p.ref=k1([p.ref,Bd(o),...i]):p.ref=Eo(p.ref,Bd(o),i):Eo(null,null)),c?(u!==void 0&&(p.className=jd(p.className,u)),d!==void 0&&(p.style=Ba(p.style,d)),p):tt}const Z1=Symbol.for("react.lazy");function q1(e,t,n,r){if(t){if(typeof t=="function")return process.env.NODE_ENV!=="production"&&X1(t),t(n,r);const o=_r(n,t.props);o.ref=n.ref;let s=t;if(s?.$$typeof===Z1&&(s=f.Children.toArray(t)[0]),process.env.NODE_ENV!=="production"&&!f.isValidElement(s))throw new Error(["Base UI: The `render` prop was provided an invalid React element as `React.isValidElement(render)` is `false`.","A valid React element must be provided to the `render` prop because it is cloned with props to replace the default element.","https://base-ui.com/r/invalid-render-prop"].join(`
|
|
16
|
-
`));return f.cloneElement(s,o)}if(e&&typeof e=="string")return K1(e,n);throw new Error(process.env.NODE_ENV!=="production"?"Base UI: Render element or function are not defined.":it(8))}function X1(e){const t=e.name;if(t.length===0)return;const n=t.charCodeAt(0);n<65||n>90||I1(`The \`render\` prop received a function named \`${t}\` that starts with an uppercase letter.`,"This usually means a React component was passed directly as `render={Component}`.","Base UI calls `render` as a plain function, which can break the Rules of Hooks during reconciliation.","If this is an intentional render callback, rename it to start with a lowercase letter.","Use `render={<Component />}` or `render={(props) => <Component {...props} />}` instead.","https://base-ui.com/r/invalid-render-prop")}function K1(e,t){return e==="button"?W.createElement("button",{type:"button",...t,key:t.key}):e==="img"?W.createElement("img",{alt:"",...t,key:t.key}):f.createElement(e,t)}let J1=(function(e){return e.frontmostHeight="--toast-frontmost-height",e})({});const Hd=f.forwardRef(function(t,n){const{render:r,className:o,children:s,...i}=t,a=Yu(),l=_n(),c=f.useRef(!1),u=f.useRef(!1),d=a.useState("isEmpty"),h=a.useState("toasts"),p=a.useState("focused"),g=a.useState("expanded"),m=a.useState("prevFocusElement"),v=h[0]?.height??0,y=f.useMemo(()=>h.some(_=>_.transitionStatus==="ending"),[h]);f.useEffect(()=>{const _=a.state.viewport;if(!_)return;function R(C){d||C.key==="F6"&&C.target!==_&&(C.preventDefault(),a.setPrevFocusElement($t(Ae(_))),_?.focus({preventScroll:!0}),a.pauseTimers(),a.setFocused(!0))}const P=nt(_);return P.addEventListener("keydown",R),()=>{P.removeEventListener("keydown",R)}},[a,d]),f.useEffect(()=>{const _=a.state.viewport;if(!_||d)return;const R=nt(_);function P(N){N.target===R&&(a.setIsWindowFocused(!1),a.pauseTimers())}function C(N){if(N.relatedTarget||N.target===R)return;const D=gt(N),k=$t(Ae(_));(!ke(_,D)||!Pa(k))&&a.resumeTimers(),l.start(0,()=>a.setIsWindowFocused(!0))}return R.addEventListener("blur",P,!0),R.addEventListener("focus",C,!0),()=>{R.removeEventListener("blur",P,!0),R.removeEventListener("focus",C,!0)}},[a,l,d]),f.useEffect(()=>{const _=a.state.viewport;if(!_||d)return;const R=Ae(_);return R.addEventListener("pointerdown",a.handleDocumentPointerDown,!0),()=>{R.removeEventListener("pointerdown",a.handleDocumentPointerDown,!0)}},[d,a]);function b(_){const R=a.state.viewport;R&&(c.current=!0,_.relatedTarget===R?h[0]?.ref?.current?.focus():a.restoreFocusToPrevElement())}function E(_){_.key==="Tab"&&_.shiftKey&&_.target===a.state.viewport&&(_.preventDefault(),a.restoreFocusToPrevElement(),a.resumeTimers())}f.useEffect(()=>{!a.state.isWindowFocused||y||!u.current||(a.resumeTimers(),a.setHovering(!1),u.current=!1)},[y,a]);function x(){a.pauseTimers(),a.setHovering(!0),u.current=!1}function w(){y?u.current=!0:(a.resumeTimers(),a.setHovering(!1))}function T(){if(c.current){c.current=!1;return}p||Pa(Ae(a.state.viewport).activeElement)&&(a.setFocused(!0),a.pauseTimers())}function S(_){!p||ke(a.state.viewport,_.relatedTarget)||(a.setFocused(!1),a.resumeTimers())}const I={tabIndex:-1,role:"region","aria-live":"polite","aria-atomic":!1,"aria-relevant":"additions text","aria-label":"Notifications",onMouseEnter:x,onMouseMove:x,onMouseLeave:w,onFocus:T,onBlur:S,onKeyDown:E,onClick:T},A={expanded:g},L=ze("div",t,{ref:[n,a.setViewport],state:A,props:[I,{style:{[J1.frontmostHeight]:v?`${v}px`:void 0}},i,{children:O.jsxs(f.Fragment,{children:[!d&&m&&O.jsx(nn,{onFocus:b}),s,!d&&m&&O.jsx(nn,{onFocus:b})]})}]}),M=f.useMemo(()=>h.filter(_=>_.priority==="high"),[h]);return O.jsxs(f.Fragment,{children:[!d&&m&&O.jsx(nn,{onFocus:b}),L,!p&&M.length>0&&O.jsx("div",{style:Va,children:M.map(_=>O.jsxs("div",{role:"alert","aria-atomic":!0,children:[O.jsx("div",{children:_.title}),O.jsx("div",{children:_.description})]},_.id))})]})});process.env.NODE_ENV!=="production"&&(Hd.displayName="ToastViewport");function Ga(e){return va(19)?e:e?"true":void 0}const za=f.createContext(void 0);process.env.NODE_ENV!=="production"&&(za.displayName="ToastRootContext");function Q1(){const e=f.useContext(za);if(!e)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: ToastRootContext is missing. Toast parts must be used within <Toast.Root>.":it(66));return e}let So=(function(e){return e.startingStyle="data-starting-style",e.endingStyle="data-ending-style",e})({});const eE={[So.startingStyle]:""},tE={[So.endingStyle]:""},tr={transitionStatus(e){return e==="starting"?eE:e==="ending"?tE:null}};function bn(e){return e==null?e:"current"in e?e.current:e}function Ud(e,t=!1,n=!0){const r=ba();return me((o,s=null)=>{r.cancel();function i(){lt.flushSync(o)}const a=bn(e);if(a==null)return;const l=a;if(typeof l.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED)o();else{let c=function(){const d=So.startingStyle;if(!l.hasAttribute(d)){r.request(u);return}const h=new MutationObserver(()=>{l.hasAttribute(d)||(h.disconnect(),u())});h.observe(l,{attributes:!0,attributeFilter:[d]}),s?.addEventListener("abort",()=>h.disconnect(),{once:!0})},u=function(){Promise.all(l.getAnimations().map(d=>d.finished)).then(()=>{s?.aborted||i()}).catch(()=>{const d=l.getAnimations();if(n){if(s?.aborted)return;i()}else d.length>0&&d.some(h=>h.pending||h.playState!=="finished")&&u()})};if(t){c();return}r.request(u)}})}function Ar(e){const{enabled:t=!0,open:n,ref:r,onComplete:o}=e,s=me(o),i=Ud(r,n,!1);f.useEffect(()=>{if(!t)return;const a=new AbortController;return i(s,a.signal),()=>{a.abort()}},[t,n,s,i])}let nr=(function(e){return e.index="--toast-index",e.offsetY="--toast-offset-y",e.height="--toast-height",e.swipeMovementX="--toast-swipe-movement-x",e.swipeMovementY="--toast-swipe-movement-y",e})({});const nE={...tr,swipeDirection(e){return e?{"data-swipe-direction":e}:null}},Co=40,rE=10,Ln=.5,oE=1,sE=`${H1},${U1}`;function Gd(e,t,n){switch(e){case"up":return-n;case"down":return n;case"left":return-t;case"right":return t;default:return 0}}function iE(e){const n=window.getComputedStyle(e).transform;let r=0,o=0,s=1;if(n&&n!=="none"){const i=n.match(/matrix(?:3d)?\(([^)]+)\)/);if(i){const a=i[1].split(", ").map(parseFloat);a.length===6?(r=a[4],o=a[5],s=Math.sqrt(a[0]*a[0]+a[1]*a[1])):a.length===16&&(r=a[12],o=a[13],s=a[0])}}return{x:r,y:o,scale:s}}const zd=f.forwardRef(function(t,n){const{toast:r,render:o,className:s,swipeDirection:i=["down","right"],...a}=t,l=r.positionerProps?.anchor!==void 0;let c=[];l||(c=Array.isArray(i)?i:[i]);const u=c.length>0,d=Yu(),[h,p]=f.useState(void 0),[g,m]=f.useState(!1),[v,y]=f.useState(!1),[b,E]=f.useState(!1),[x,w]=f.useState({x:0,y:0}),[T,S]=f.useState({x:0,y:0,scale:1}),[I,A]=f.useState(),[L,M]=f.useState(),[_,R]=f.useState(null),P=f.useRef(null),C=f.useRef({x:0,y:0}),N=f.useRef({x:0,y:0,scale:1}),D=f.useRef(void 0),k=f.useRef(0),$=f.useRef(!1),F=f.useRef({x:0,y:0}),j=f.useRef(!1),V=d.useState("toastIndex",r.id),Y=d.useState("toastVisibleIndex",r.id),q=d.useState("toastOffsetY",r.id),X=d.useState("focused"),U=d.useState("expanded");Ar({open:r.transitionStatus!=="ending",ref:P,onComplete(){r.transitionStatus==="ending"&&d.removeToast(r.id)}});const H=me((te=!1)=>{const z=P.current;if(!z)return;const B=z.style.height;z.style.height="auto";const J=z.offsetHeight;z.style.height=B;function pe(){d.updateToastInternal(r.id,{ref:P,height:J,...r.transitionStatus==="starting"?{transitionStatus:void 0}:{}})}te?lt.flushSync(pe):pe()});ve(H,[H]);function Z(te,z){let B=te,J=z;return!c.includes("left")&&!c.includes("right")?B=te>0?te**Ln:-(Math.abs(te)**Ln):(!c.includes("right")&&te>0&&(B=te**Ln),!c.includes("left")&&te<0&&(B=-(Math.abs(te)**Ln))),!c.includes("up")&&!c.includes("down")?J=z>0?z**Ln:-(Math.abs(z)**Ln):(!c.includes("down")&&z>0&&(J=z**Ln),!c.includes("up")&&z<0&&(J=-(Math.abs(z)**Ln))),{x:B,y:J}}function re(te){if(te.button!==0)return;te.pointerType==="touch"&&d.pauseTimers();const z=gt(te.nativeEvent);if(!(z&&z.closest(`button,a,input,textarea,[role="button"],${sE}`))){if($.current=!1,D.current=void 0,k.current=0,C.current={x:te.clientX,y:te.clientY},F.current=C.current,P.current){const J=iE(P.current);N.current=J,S(J),w({x:J.x,y:J.y})}d.setHovering(!0),m(!0),y(!1),R(null),j.current=!0,P.current?.setPointerCapture(te.pointerId)}}function ne(te){if(!g)return;te.preventDefault(),j.current&&(C.current={x:te.clientX,y:te.clientY},j.current=!1);const{clientY:z,clientX:B,movementX:J,movementY:pe}=te;(pe<0&&z>F.current.y||pe>0&&z<F.current.y)&&(F.current={x:F.current.x,y:z}),(J<0&&B>F.current.x||J>0&&B<F.current.x)&&(F.current={x:B,y:F.current.y});const Se=B-C.current.x,Ne=z-C.current.y,Fe=z-F.current.y,Ie=B-F.current.x;if(!v&&Math.sqrt(Se*Se+Ne*Ne)>=oE&&(y(!0),_===null)){const ct=c.includes("left")||c.includes("right"),Ct=c.includes("up")||c.includes("down");if(ct&&Ct){const Dt=Math.abs(Se),jt=Math.abs(Ne);R(Dt>jt?"horizontal":"vertical")}}let be;if(!D.current)_==="vertical"?Ne>0?be="down":Ne<0&&(be="up"):_==="horizontal"?Se>0?be="right":Se<0&&(be="left"):Math.abs(Se)>=Math.abs(Ne)?be=Se>0?"right":"left":be=Ne>0?"down":"up",be&&c.includes(be)&&(D.current=be,k.current=Gd(be,Se,Ne),p(be));else{const Qe=D.current,ct=Gd(Qe,Ie,Fe);ct>Co?($.current=!1,p(Qe)):!(c.includes("left")&&c.includes("right"))&&!(c.includes("up")&&c.includes("down"))&&k.current-ct>=rE&&($.current=!0)}const Re=Z(Se,Ne);let Ce=N.current.x,Be=N.current.y;_==="horizontal"?(c.includes("left")||c.includes("right"))&&(Ce+=Re.x):(_==="vertical"||(c.includes("left")||c.includes("right"))&&(Ce+=Re.x),(c.includes("up")||c.includes("down"))&&(Be+=Re.y)),w({x:Ce,y:Be})}function ee(te){if(!g)return;if(m(!1),y(!1),R(null),P.current?.releasePointerCapture(te.pointerId),$.current){w({x:T.x,y:T.y}),p(void 0);return}let z=!1;const B=x.x-T.x,J=x.y-T.y;let pe;for(const Se of c){switch(Se){case"right":B>Co&&(z=!0,pe="right");break;case"left":B<-Co&&(z=!0,pe="left");break;case"down":J>Co&&(z=!0,pe="down");break;case"up":J<-Co&&(z=!0,pe="up");break}if(z)break}z?(p(pe),E(!0),d.closeToast(r.id)):(w({x:T.x,y:T.y}),p(void 0))}function le(te){if(te.key==="Escape"){if(!P.current||!ke(P.current,$t(Ae(P.current))))return;d.closeToast(r.id)}}f.useEffect(()=>{if(!u)return;const te=P.current;if(!te)return;function z(B){ke(te,B.target)&&B.preventDefault()}return te.addEventListener("touchmove",z,{passive:!1}),()=>{te.removeEventListener("touchmove",z)}},[u]);function K(){if(!g&&x.x===T.x&&x.y===T.y&&!b)return{[nr.swipeMovementX]:"0px",[nr.swipeMovementY]:"0px"};const te=x.x-T.x,z=x.y-T.y;return{transition:g?"none":void 0,transform:g?`translateX(${x.x}px) translateY(${x.y}px) scale(${T.scale})`:void 0,[nr.swipeMovementX]:`${te}px`,[nr.swipeMovementY]:`${z}px`}}const G=r.priority==="high",de={role:G?"alertdialog":"dialog",tabIndex:0,"aria-modal":!1,"aria-labelledby":I,"aria-describedby":L,"aria-hidden":G&&!X?!0:void 0,onPointerDown:u?re:void 0,onPointerMove:u?ne:void 0,onPointerUp:u?ee:void 0,onKeyDown:le,inert:Ga(r.limited),style:{...K(),[nr.index]:r.transitionStatus==="ending"?V:Y,[nr.offsetY]:`${q}px`,[nr.height]:r.height?`${r.height}px`:void 0}},fe=f.useMemo(()=>({rootRef:P,toast:r,titleId:I,setTitleId:A,descriptionId:L,setDescriptionId:M,swiping:g,swipeDirection:h,recalculateHeight:H,index:V,visibleIndex:Y,expanded:U}),[r,I,L,g,h,H,V,Y,U]),oe={transitionStatus:r.transitionStatus,expanded:U,limited:r.limited||!1,type:r.type,swiping:fe.swiping,swipeDirection:fe.swipeDirection},ue=ze("div",t,{ref:[n,fe.rootRef],state:oe,stateAttributesMapping:nE,props:[de,a]});return O.jsx(za.Provider,{value:fe,children:ue})});process.env.NODE_ENV!=="production"&&(zd.displayName="ToastRoot");const To={...f};let Yd=0;function aE(e,t="mui"){const[n,r]=f.useState(e),o=e||n;return f.useEffect(()=>{n==null&&(Yd+=1,r(`${t}-${Yd}`))},[n,t]),o}const Zd=To.useId;function rr(e,t){if(Zd!==void 0){const n=Zd();return e??(t?`${t}-${n}`:n)}return aE(e,t)}const qd=f.forwardRef(function(t,n){const{render:r,className:o,id:s,children:i,...a}=t,{toast:l,setDescriptionId:c}=Q1(),u=i??l.description,d=!!u,h=rr(s);ve(()=>{if(d)return c(h),()=>{c(void 0)}},[d,h,c]);const p={type:l.type},g=ze("p",t,{ref:n,state:p,props:{...a,id:h,children:u}});return d?g:null});process.env.NODE_ENV!=="production"&&(qd.displayName="ToastDescription");let Ya;process.env.NODE_ENV!=="production"&&(Ya=new Set);function Ds(...e){if(process.env.NODE_ENV!=="production"){const t=e.join(" ");Ya.has(t)||(Ya.add(t),console.error(`Base UI: ${t}`))}}const Xd=f.createContext(void 0);process.env.NODE_ENV!=="production"&&(Xd.displayName="CompositeRootContext");function cE(e=!1){const t=f.useContext(Xd);if(t===void 0&&!e)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: CompositeRootContext is missing. Composite parts must be placed within <Composite.Root>.":it(16));return t}function lE(e){const{focusableWhenDisabled:t,disabled:n,composite:r=!1,tabIndex:o=0,isNativeButton:s}=e,i=r&&t!==!1,a=r&&t===!1;return{props:f.useMemo(()=>{const c={onKeyDown(u){n&&t&&u.key!=="Tab"&&u.preventDefault()}};return r||(c.tabIndex=o,!s&&n&&(c.tabIndex=t?o:-1)),(s&&(t||i)||!s&&n)&&(c["aria-disabled"]=n),s&&(!t||a)&&(c.disabled=n),c},[r,n,t,i,a,s,o])}}function Ms(e={}){const{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:o=!0,composite:s}=e,i=f.useRef(null),a=cE(!0),l=s??a!==void 0,{props:c}=lE({focusableWhenDisabled:n,disabled:t,composite:l,tabIndex:r,isNativeButton:o});process.env.NODE_ENV!=="production"&&f.useEffect(()=>{if(!i.current)return;const p=Ls(i.current);if(o){if(!p){const g=To.captureOwnerStack?.()||"";Ds(`A component that acts as a button expected a native <button> because the \`nativeButton\` prop is true. Rendering a non-<button> removes native button semantics, which can impact forms and accessibility. Use a real <button> in the \`render\` prop, or set \`nativeButton\` to \`false\`.${g}`)}}else if(p){const g=To.captureOwnerStack?.()||"";Ds(`A component that acts as a button expected a non-<button> because the \`nativeButton\` prop is false. Rendering a <button> keeps native behavior while Base UI applies non-native attributes and handlers, which can add unintended extra attributes (such as \`role\` or \`aria-disabled\`). Use a non-<button> in the \`render\` prop, or set \`nativeButton\` to \`true\`.${g}`)}},[o]);const u=f.useCallback(()=>{const p=i.current;Ls(p)&&l&&t&&c.disabled===void 0&&p.disabled&&(p.disabled=!1)},[t,c.disabled,l]);ve(u,[u]);const d=f.useCallback((p={})=>{const{onClick:g,onMouseDown:m,onKeyUp:v,onKeyDown:y,onPointerDown:b,...E}=p;return _r({type:o?"button":void 0,onClick(w){if(t){w.preventDefault();return}g?.(w)},onMouseDown(w){t||m?.(w)},onKeyDown(w){if(t||(Ha(w),y?.(w),w.baseUIHandlerPrevented))return;const T=w.target===w.currentTarget,S=w.currentTarget,I=Ls(S),A=!o&&uE(S),L=T&&(o?I:!A),M=w.key==="Enter",_=w.key===" ",R=S.getAttribute("role"),P=R?.startsWith("menuitem")||R==="option"||R==="gridcell";if(T&&l&&_){if(w.defaultPrevented&&P)return;w.preventDefault(),A||o&&I?(S.click(),w.preventBaseUIHandler()):L&&(g?.(w),w.preventBaseUIHandler());return}L&&(!o&&(_||M)&&w.preventDefault(),!o&&M&&g?.(w))},onKeyUp(w){if(!t){if(Ha(w),v?.(w),w.target===w.currentTarget&&o&&l&&Ls(w.currentTarget)&&w.key===" "){w.preventDefault();return}w.baseUIHandlerPrevented||w.target===w.currentTarget&&!o&&!l&&w.key===" "&&g?.(w)}},onPointerDown(w){if(t){w.preventDefault();return}b?.(w)}},o?void 0:{role:"button"},c,E)},[t,c,l,o]),h=me(p=>{i.current=p,u()});return{getButtonProps:d,buttonRef:h}}function Ls(e){return rt(e)&&e.tagName==="BUTTON"}function uE(e){return!!(e?.tagName==="A"&&e?.href)}function dE(e,t){return t!=null&&!bo(t)?0:typeof e=="function"?e():e}function $s(e,t,n){const r=dE(e,n);return typeof r=="number"?r:r?.[t]}function Kd(e){return typeof e=="function"?e():e}function Jd(e,t){return t||e==="click"||e==="mousedown"}const Za="none",Dr="trigger-press",St="trigger-hover",Qd="outside-press",fE="close-press",Oo="focus-out",ef="escape-key",tf="imperative-action";function Ye(e,t,n,r){let o=!1,s=!1;const i=tt;return{reason:e,event:t??new Event("base-ui"),cancel(){o=!0},allowPropagation(){s=!0},get isCanceled(){return o},get isPropagationAllowed(){return s},trigger:n,...i}}function pE(e,t,n){const r=tt;return{reason:e,event:t??new Event("base-ui"),...r}}function rn(e){const t=ht(hE,e).current;return t.next=e,ve(t.effect),t}function hE(e){const t={current:e,next:e,effect:()=>{t.current=t.next}};return t}function Fs(e){return`data-base-ui-${e}`}let nf=0;function qa(e,t={}){const{preventScroll:n=!1,cancelPrevious:r=!0,sync:o=!1}=t;r&&cancelAnimationFrame(nf);const s=()=>e?.focus({preventScroll:n});o?s():nf=requestAnimationFrame(s)}const Xa={inert:new WeakMap,"aria-hidden":new WeakMap},rf="data-base-ui-inert",Ka={inert:new WeakSet,"aria-hidden":new WeakSet};let ko=new WeakMap,Ja=0;function mE(e){return Ka[e]}function of(e){return e?vo(e)?e.host:of(e.parentNode):null}const Qa=(e,t)=>t.map(n=>{if(e.contains(n))return n;const r=of(n);return e.contains(r)?r:null}).filter(n=>n!=null),sf=e=>{const t=new Set;return e.forEach(n=>{let r=n;for(;r&&!t.has(r);)t.add(r),r=r.parentNode}),t},af=(e,t,n)=>{const r=[],o=s=>{!s||n.has(s)||Array.from(s.children).forEach(i=>{An(i)!=="script"&&(t.has(i)?o(i):r.push(i))})};return o(e),r};function gE(e,t,n,r,{mark:o=!0,markerIgnoreElements:s=[]}){const i=r?"inert":n?"aria-hidden":null;let a=null,l=null;const c=Qa(t,e),u=o?Qa(t,s):[],d=new Set(u),h=o?af(t,sf(c),new Set(c)).filter(m=>!d.has(m)):[],p=[],g=[];if(i){const m=Xa[i],v=mE(i);l=v,a=m;const y=Qa(t,Array.from(t.querySelectorAll("[aria-live]"))),b=c.concat(y);af(t,sf(b),new Set(b)).forEach(x=>{const w=x.getAttribute(i),T=w!==null&&w!=="false",S=(m.get(x)||0)+1;m.set(x,S),p.push(x),S===1&&T&&v.add(x),T||x.setAttribute(i,i==="inert"?"":"true")})}return o&&h.forEach(m=>{const v=(ko.get(m)||0)+1;ko.set(m,v),g.push(m),v===1&&m.setAttribute(rf,"")}),Ja+=1,()=>{a&&p.forEach(m=>{const y=(a.get(m)||0)-1;a.set(m,y),y||(!l?.has(m)&&i&&m.removeAttribute(i),l?.delete(m))}),o&&g.forEach(m=>{const v=(ko.get(m)||0)-1;ko.set(m,v),v||m.removeAttribute(rf)}),Ja-=1,Ja||(Xa.inert=new WeakMap,Xa["aria-hidden"]=new WeakMap,Ka.inert=new WeakSet,Ka["aria-hidden"]=new WeakSet,ko=new WeakMap)}}function cf(e,t={}){const{ariaHidden:n=!1,inert:r=!1,mark:o=!0,markerIgnoreElements:s=[]}=t,i=Ae(e[0]).body;return gE(e,i,n,r,{mark:o,markerIgnoreElements:s})}const ec=f.createContext(null);process.env.NODE_ENV!=="production"&&(ec.displayName="PortalContext");const lf=()=>f.useContext(ec),vE=Fs("portal");function uf(e={}){const{ref:t,container:n,componentProps:r=tt,elementProps:o}=e,s=rr(),a=lf()?.portalNode,[l,c]=f.useState(null),[u,d]=f.useState(null),h=me(v=>{v!==null&&d(v)}),p=f.useRef(null);ve(()=>{if(n===null){p.current&&(p.current=null,d(null),c(null));return}if(s==null)return;const v=(n&&(wa(n)?n:n.current))??a??document.body;if(v==null){p.current&&(p.current=null,d(null),c(null));return}p.current!==v&&(p.current=v,d(null),c(v))},[n,a,s]);const g=ze("div",r,{ref:[t,h],props:[{id:s,[vE]:""},o]});return{portalNode:u,portalSubtree:l&&g?lt.createPortal(g,l):null}}const tc=f.forwardRef(function(t,n){const{children:r,container:o,className:s,render:i,renderGuards:a,...l}=t,{portalNode:c,portalSubtree:u}=uf({container:o,ref:n,componentProps:t,elementProps:l}),d=f.useRef(null),h=f.useRef(null),p=f.useRef(null),g=f.useRef(null),[m,v]=f.useState(null),y=m?.modal,b=m?.open,E=typeof a=="boolean"?a:!!m&&!m.modal&&m.open&&!!c;f.useEffect(()=>{if(!c||y)return;function w(T){c&&T.relatedTarget&&Nr(T)&&(T.type==="focusin"?Md:C1)(c)}return c.addEventListener("focusin",w,!0),c.addEventListener("focusout",w,!0),()=>{c.removeEventListener("focusin",w,!0),c.removeEventListener("focusout",w,!0)}},[c,y]),f.useEffect(()=>{!c||b||Md(c)},[b,c]);const x=f.useMemo(()=>({beforeOutsideRef:d,afterOutsideRef:h,beforeInsideRef:p,afterInsideRef:g,portalNode:c,setFocusManagerState:v}),[c]);return O.jsxs(f.Fragment,{children:[u,O.jsxs(ec.Provider,{value:x,children:[E&&c&&O.jsx(nn,{"data-type":"outside",ref:d,onFocus:w=>{if(Nr(w,c))p.current?.focus();else{const T=m?m.domReference:null;Ad(T)?.focus()}}}),E&&c&&O.jsx("span",{"aria-owns":c.id,style:z1}),c&<.createPortal(r,c),E&&c&&O.jsx(nn,{"data-type":"outside",ref:h,onFocus:w=>{if(Nr(w,c))g.current?.focus();else{const T=m?m.domReference:null;Fa(T)?.focus(),m?.closeOnFocusOut&&m?.onOpenChange(!1,Ye(Oo,w.nativeEvent))}}})]})]})});process.env.NODE_ENV!=="production"&&(tc.displayName="FloatingPortal");function df(){const e=new Map;return{emit(t,n){e.get(t)?.forEach(r=>r(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){e.get(t)?.delete(n)}}}class yE{nodesRef={current:[]};events=df();addNode(t){this.nodesRef.current.push(t)}removeNode(t){const n=this.nodesRef.current.findIndex(r=>r===t);n!==-1&&this.nodesRef.current.splice(n,1)}}const nc=f.createContext(null);process.env.NODE_ENV!=="production"&&(nc.displayName="FloatingNodeContext");const rc=f.createContext(null);process.env.NODE_ENV!=="production"&&(rc.displayName="FloatingTreeContext");const or=()=>f.useContext(nc)?.id||null,Mr=e=>{const t=f.useContext(rc);return e??t};function bE(e){const t=rr(),n=Mr(e),r=or();return ve(()=>{if(!t)return;const o={id:t,parentId:r};return n?.addNode(o),()=>{n?.removeNode(o)}},[n,t,r]),t}function wE(e){const{children:t,id:n}=e,r=or();return O.jsx(nc.Provider,{value:f.useMemo(()=>({id:n,parentId:r}),[n,r]),children:t})}function EE(e){const{children:t,externalTree:n}=e,r=ht(()=>n??new yE).current;return O.jsx(rc.Provider,{value:r,children:t})}function xE(e,t){const n=nt(e.target);return e instanceof n.KeyboardEvent?"keyboard":e instanceof n.FocusEvent?t||"keyboard":"pointerType"in e?e.pointerType||"keyboard":"touches"in e?"touch":e instanceof n.MouseEvent?t||(e.detail===0?"keyboard":"mouse"):""}const ff=20;let $n=[];function oc(){$n=$n.filter(e=>e.deref()?.isConnected)}function SE(e){oc(),e&&An(e)!=="body"&&($n.push(new WeakRef(e)),$n.length>ff&&($n=$n.slice(-ff)))}function sc(){return oc(),$n[$n.length-1]?.deref()}function CE(e){if(!e)return null;const t=Ir();return Nd(e,t)?e:wo(e,t)[0]||e}function TE(e){return!e||!e.isConnected?!1:typeof e.checkVisibility=="function"?e.checkVisibility():i1(e)}function pf(e,t){if(!t.current.includes("floating")&&!e.getAttribute("role")?.includes("dialog"))return;const n=Ir(),o=E1(e,n).filter(i=>{const a=i.getAttribute("data-tabindex")||"";return Nd(i,n)||i.hasAttribute("data-tabindex")&&!a.startsWith("-")}),s=e.getAttribute("tabindex");t.current.includes("floating")||o.length===0?s!=="0"&&e.setAttribute("tabindex","0"):(s!=="-1"||e.hasAttribute("data-tabindex")&&e.getAttribute("data-tabindex")!=="-1")&&(e.setAttribute("tabindex","-1"),e.setAttribute("data-tabindex","-1"))}function hf(e){const{context:t,children:n,disabled:r=!1,initialFocus:o=!0,returnFocus:s=!0,restoreFocus:i=!1,modal:a=!0,closeOnFocusOut:l=!0,openInteractionType:c="",nextFocusableElement:u,previousFocusableElement:d,beforeContentFocusGuardRef:h,externalTree:p,getInsideElements:g}=e,m="rootStore"in t?t.rootStore:t,v=m.useState("open"),y=m.useState("domReferenceElement"),b=m.useState("floatingElement"),{events:E,dataRef:x}=m.context,w=me(()=>x.current.floatingContext?.nodeId),T=o===!1,S=yd(y)&&T,I=f.useRef(["content"]),A=rn(o),L=rn(s),M=rn(c),_=Mr(p),R=lf(),P=f.useRef(!1),C=f.useRef(!1),N=f.useRef(!1),D=f.useRef(-1),k=f.useRef(""),$=f.useRef(""),F=f.useRef(null),j=f.useRef(null),V=Eo(F,h,R?.beforeInsideRef),Y=Eo(j,R?.afterInsideRef),q=_n(),X=_n(),U=ba(),H=R!=null,Z=Ia(b),re=me((K=Z)=>K?wo(K,Ir()):[]),ne=me(()=>g?.().filter(K=>K!=null)??[]),ee=me(K=>{const G=re(K);return I.current.map(()=>G).filter(Boolean).flat()});f.useEffect(()=>{if(r||!a)return;function K(de){de.key==="Tab"&&ke(Z,$t(Ae(Z)))&&re().length===0&&!S&&Yw(de)}const G=Ae(Z);return G.addEventListener("keydown",K),()=>{G.removeEventListener("keydown",K)}},[r,y,Z,a,I,S,re,ee]),f.useEffect(()=>{if(r||!v)return;const K=Ae(Z);function G(){N.current=!1}function de(oe){const ue=gt(oe),te=ne(),z=ke(b,ue)||ke(y,ue)||ke(R?.portalNode,ue)||te.some(B=>B===ue||ke(B,ue));N.current=!z,$.current=oe.pointerType||"keyboard",ue?.closest(`[${Ua}]`)&&(C.current=!0)}function fe(){$.current="keyboard"}return K.addEventListener("pointerdown",de,!0),K.addEventListener("pointerup",G,!0),K.addEventListener("pointercancel",G,!0),K.addEventListener("keydown",fe,!0),()=>{K.removeEventListener("pointerdown",de,!0),K.removeEventListener("pointerup",G,!0),K.removeEventListener("pointercancel",G,!0),K.removeEventListener("keydown",fe,!0)}},[r,b,y,Z,v,R,ne]),f.useEffect(()=>{if(r||!l)return;const K=Ae(Z);function G(){C.current=!0,X.start(0,()=>{C.current=!1})}function de(z){const B=gt(z),pe=re().indexOf(B);pe!==-1&&(D.current=pe)}function fe(z){const B=z.relatedTarget,J=z.currentTarget,pe=gt(z);queueMicrotask(()=>{const Se=w(),Ne=m.context.triggerElements,Fe=ne(),Ie=B?.hasAttribute(Fs("focus-guard"))&&[F.current,j.current,R?.beforeInsideRef.current,R?.afterInsideRef.current,R?.beforeOutsideRef.current,R?.afterOutsideRef.current,bn(d),bn(u)].includes(B),be=!(ke(y,B)||ke(b,B)||ke(B,b)||ke(R?.portalNode,B)||Fe.some(Re=>Re===B||ke(Re,B))||B!=null&&Ne.hasElement(B)||Ne.hasMatchingElement(Re=>ke(Re,B))||Ie||_&&(gn(_.nodesRef.current,Se).find(Re=>ke(Re.context?.elements.floating,B)||ke(Re.context?.elements.domReference,B))||bd(_.nodesRef.current,Se).find(Re=>[Re.context?.elements.floating,Ia(Re.context?.elements.floating)].includes(B)||Re.context?.elements.domReference===B)));if(J===y&&Z&&pf(Z,I),i&&J!==y&&!TE(pe)&&$t(K)===K.body){if(rt(Z)&&(Z.focus(),i==="popup")){U.request(()=>{Z.focus()});return}const Re=D.current,Ce=re(),Be=Ce[Re]||Ce[Ce.length-1]||Z;rt(Be)&&Be.focus()}if(x.current.insideReactTree){x.current.insideReactTree=!1;return}(S||!a)&&B&&be&&!C.current&&(S||B!==sc())&&(P.current=!0,m.setOpen(!1,Ye(Oo,z)))})}function oe(){N.current||(x.current.insideReactTree=!0,q.start(0,()=>{x.current.insideReactTree=!1}))}const ue=rt(y)?y:null,te=[];if(!(!b&&!ue))return ue&&(ue.addEventListener("focusout",fe),ue.addEventListener("pointerdown",G),te.push(()=>{ue.removeEventListener("focusout",fe),ue.removeEventListener("pointerdown",G)})),b&&(b.addEventListener("focusin",de),b.addEventListener("focusout",fe),R&&(b.addEventListener("focusout",oe,!0),te.push(()=>{b.removeEventListener("focusout",oe,!0)})),te.push(()=>{b.removeEventListener("focusin",de),b.removeEventListener("focusout",fe)})),()=>{te.forEach(z=>{z()})}},[r,y,b,Z,a,_,R,m,l,i,re,S,w,I,x,q,X,U,u,d,ne]),f.useEffect(()=>{if(r||!b||!v)return;const K=Array.from(R?.portalNode?.querySelectorAll(`[${Fs("portal")}]`)||[]),de=(_?bd(_.nodesRef.current,w()):[]).find(B=>yd(B.context?.elements.domReference||null))?.context?.elements.domReference,oe=[...[b,...K,F.current,j.current,R?.beforeOutsideRef.current,R?.afterOutsideRef.current,...ne()],de,bn(d),bn(u),S?y:null].filter(B=>B!=null),ue=cf(oe,{ariaHidden:a||S,mark:!1}),te=[b,...K].filter(B=>B!=null),z=cf(te);return()=>{z(),ue()}},[v,r,y,b,a,I,R,S,_,w,u,d,ne]),ve(()=>{if(!v||r||!rt(Z))return;const K=Ae(Z),G=$t(K);queueMicrotask(()=>{const de=ee(Z),fe=A.current,oe=typeof fe=="function"?fe(M.current||""):fe;if(oe===void 0||oe===!1)return;let ue;oe===!0||oe===null?ue=de[0]||Z:ue=bn(oe),ue=ue||de[0]||Z,!ke(Z,G)&&qa(ue,{preventScroll:ue===Z})})},[r,v,Z,T,ee,A,M]),ve(()=>{if(r||!Z)return;const K=Ae(Z),G=$t(K);SE(G);function de(oe){if(oe.open||(k.current=xE(oe.nativeEvent,$.current)),oe.reason===St&&oe.nativeEvent.type==="mouseleave"&&(P.current=!0),oe.reason===Qd)if(oe.nested)P.current=!1;else if(qw(oe.nativeEvent)||Xw(oe.nativeEvent))P.current=!1;else{let ue=!1;document.createElement("div").focus({get preventScroll(){return ue=!0,!1}}),ue?P.current=!1:P.current=!0}}E.on("openchange",de);function fe(){const oe=L.current;let ue=typeof oe=="function"?oe(k.current):oe;if(ue===void 0||ue===!1)return null;if(ue===null&&(ue=!0),typeof ue=="boolean"){const z=y||sc();return z&&z.isConnected?z:null}const te=y||sc();return bn(ue)||te||null}return()=>{E.off("openchange",de);const oe=$t(K),ue=ne(),te=ke(b,oe)||ue.some(B=>B===oe||ke(B,oe))||_&&gn(_.nodesRef.current,w(),!1).some(B=>ke(B.context?.elements.floating,oe)),z=fe();queueMicrotask(()=>{const B=CE(z),J=typeof L.current!="boolean";L.current&&!P.current&&rt(B)&&(!(!J&&B!==oe&&oe!==K.body)||te)&&B.focus({preventScroll:!0}),P.current=!1})}},[r,b,Z,L,x,E,_,y,w,ne]),ve(()=>{if(!dd||v||!b)return;const K=$t(Ae(b));!rt(K)||!Ra(K)||ke(b,K)&&K.blur()},[v,b]),ve(()=>{if(!(r||!R))return R.setFocusManagerState({modal:a,closeOnFocusOut:l,open:v,onOpenChange:m.setOpen,domReference:y}),()=>{R.setFocusManagerState(null)}},[r,R,a,v,m,l,y]),ve(()=>{if(!(r||!Z))return pf(Z,I),()=>{queueMicrotask(oc)}},[r,Z,I]);const le=!r&&(a?!S:!0)&&(H||a);return O.jsxs(f.Fragment,{children:[le&&O.jsx(nn,{"data-type":"inside",ref:V,onFocus:K=>{if(a){const G=ee();qa(G[G.length-1])}else R?.portalNode&&(P.current=!1,Nr(K,R.portalNode)?Fa(y)?.focus():bn(d??R.beforeOutsideRef)?.focus())}}),n,le&&O.jsx(nn,{"data-type":"inside",ref:Y,onFocus:K=>{a?qa(ee()[0]):R?.portalNode&&(l&&(P.current=!0),Nr(K,R.portalNode)?Ad(y)?.focus():bn(u??R.afterOutsideRef)?.focus())}})]})}function mf(e,t={}){const n="rootStore"in e?e.rootStore:e,r=n.context.dataRef,{enabled:o=!0,event:s="click",toggle:i=!0,ignoreMouse:a=!1,stickIfOpen:l=!0,touchOpenDelay:c=0,reason:u=Dr}=t,d=f.useRef(void 0),h=ba(),p=_n(),g=f.useMemo(()=>({onPointerDown(m){d.current=m.pointerType},onMouseDown(m){const v=d.current,y=m.nativeEvent,b=n.select("open");if(m.button!==0||s==="click"||bo(v,!0)&&a)return;const E=r.current.openEvent,x=E?.type,w=n.select("domReferenceElement")!==m.currentTarget,T=b&&w||!(b&&i&&(!(E&&l)||x==="click"||x==="mousedown"));if(Ra(y.target)){const I=Ye(u,y,y.target);T&&v==="touch"&&c>0?p.start(c,()=>{n.setOpen(!0,I)}):n.setOpen(T,I);return}const S=m.currentTarget;h.request(()=>{const I=Ye(u,y,S);T&&v==="touch"&&c>0?p.start(c,()=>{n.setOpen(!0,I)}):n.setOpen(T,I)})},onClick(m){if(s==="mousedown-only")return;const v=d.current;if(s==="mousedown"&&v){d.current=void 0;return}if(bo(v,!0)&&a)return;const y=n.select("open"),b=r.current.openEvent,E=n.select("domReferenceElement")!==m.currentTarget,x=y&&E||!(y&&i&&(!(b&&l)||wd(b))),w=Ye(u,m.nativeEvent,m.currentTarget);x&&v==="touch"&&c>0?p.start(c,()=>{n.setOpen(!0,w)}):n.setOpen(x,w)},onKeyDown(){d.current=void 0}}),[r,s,a,n,l,i,h,p,c,u]);return f.useMemo(()=>o?{reference:g}:tt,[o,g])}const OE={intentional:"onClick",sloppy:"onPointerDown"};function kE(){return!1}function RE(e){return{escapeKey:typeof e=="boolean"?e:e?.escapeKey??!1,outsidePress:typeof e=="boolean"?e:e?.outsidePress??!0}}function gf(e,t={}){const n="rootStore"in e?e.rootStore:e,r=n.useState("open"),o=n.useState("floatingElement"),{dataRef:s}=n.context,{enabled:i=!0,escapeKey:a=!0,outsidePress:l=!0,outsidePressEvent:c="sloppy",referencePress:u=kE,referencePressEvent:d="sloppy",bubbles:h,externalTree:p}=t,g=Mr(p),m=me(typeof l=="function"?l:()=>!1),v=typeof l=="function"?m:l,y=v!==!1,b=me(()=>c),E=f.useRef(!1),x=f.useRef(!1),w=f.useRef(!1),{escapeKey:T,outsidePress:S}=RE(h),I=f.useRef(null),A=_n(),L=_n(),M=me(()=>{L.clear(),s.current.insideReactTree=!1}),_=f.useRef(!1),R=f.useRef(""),P=me(u),C=me(j=>{if(!r||!i||!a||j.key!=="Escape"||_.current)return;const V=s.current.floatingContext?.nodeId,Y=g?gn(g.nodesRef.current,V):[];if(!T&&Y.length>0){let U=!0;if(Y.forEach(H=>{H.context?.open&&!H.context.dataRef.current.__escapeKeyBubbles&&(U=!1)}),!U)return}const q=Zw(j)?j.nativeEvent:j,X=Ye(ef,q);n.setOpen(!1,X),!T&&!X.isPropagationAllowed&&j.stopPropagation()}),N=me(()=>{s.current.insideReactTree=!0,L.start(0,M)});f.useEffect(()=>{if(!r||!i)return;s.current.__escapeKeyBubbles=T,s.current.__outsidePressBubbles=S;const j=new zt,V=new zt;function Y(){j.clear(),_.current=!0}function q(){j.start(xs()?5:0,()=>{_.current=!1})}function X(){w.current=!0,V.start(0,()=>{w.current=!1})}function U(){E.current=!1,x.current=!1}function H(){const B=R.current,J=B==="pen"||!B?"mouse":B,pe=b(),Se=typeof pe=="function"?pe():pe;return typeof Se=="string"?Se:Se[J]}function Z(B){const J=H();return J==="intentional"&&B.type!=="click"||J==="sloppy"&&B.type==="click"}function re(B){const J=s.current.floatingContext?.nodeId,pe=g&&gn(g.nodesRef.current,J).some(Se=>Yt(B,Se.context?.elements.floating));return Yt(B,n.select("floatingElement"))||Yt(B,n.select("domReferenceElement"))||pe}function ne(B){if(Z(B)){M();return}if(s.current.insideReactTree){M();return}const J=gt(B),pe=`[${Fs("inert")}]`;let Se=Array.from(Ae(n.select("floatingElement")).querySelectorAll(pe));const Ne=$e(J)?J.getRootNode():null;vo(Ne)&&(Se=Se.concat(Array.from(Ne.querySelectorAll(pe))));const Fe=n.context.triggerElements;if(J&&(Fe.hasElement(J)||Fe.hasMatchingElement(Ce=>ke(Ce,J))))return;let Ie=$e(J)?J:null;for(;Ie&&!hn(Ie);){const Ce=mn(Ie);if(hn(Ce)||!$e(Ce))break;Ie=Ce}if(Se.length&&$e(J)&&!zw(J)&&!ke(J,n.select("floatingElement"))&&Se.every(Ce=>!ke(Ie,Ce)))return;if(rt(J)&&!("touches"in B)){const Ce=hn(J),Be=Rt(J),Qe=/auto|scroll/,ct=Ce||Qe.test(Be.overflowX),Ct=Ce||Qe.test(Be.overflowY),Dt=ct&&J.clientWidth>0&&J.scrollWidth>J.clientWidth,jt=Ct&&J.clientHeight>0&&J.scrollHeight>J.clientHeight,ye=Be.direction==="rtl",Ze=jt&&(ye?B.offsetX<=J.offsetWidth-J.clientWidth:B.offsetX>J.clientWidth),ie=Dt&&B.offsetY>J.clientHeight;if(Ze||ie)return}if(re(B))return;if(H()==="intentional"&&w.current){V.clear(),w.current=!1;return}if(typeof v=="function"&&!v(B))return;const be=s.current.floatingContext?.nodeId,Re=g?gn(g.nodesRef.current,be):[];if(Re.length>0){let Ce=!0;if(Re.forEach(Be=>{Be.context?.open&&!Be.context.dataRef.current.__outsidePressBubbles&&(Ce=!1)}),!Ce)return}n.setOpen(!1,Ye(Qd,B)),M()}function ee(B){H()!=="sloppy"||B.pointerType==="touch"||!n.select("open")||!i||Yt(B,n.select("floatingElement"))||Yt(B,n.select("domReferenceElement"))||ne(B)}function le(B){if(H()!=="sloppy"||!n.select("open")||!i||Yt(B,n.select("floatingElement"))||Yt(B,n.select("domReferenceElement")))return;const J=B.touches[0];J&&(I.current={startTime:Date.now(),startX:J.clientX,startY:J.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},A.start(1e3,()=>{I.current&&(I.current.dismissOnTouchEnd=!1,I.current.dismissOnMouseDown=!1)}))}function K(B){R.current="touch";const J=gt(B);function pe(){le(B),J?.removeEventListener(B.type,pe)}J?.addEventListener(B.type,pe)}function G(B){if(A.clear(),B.type==="pointerdown"&&(R.current=B.pointerType),B.type==="mousedown"&&I.current&&!I.current.dismissOnMouseDown)return;const J=gt(B);function pe(){B.type==="pointerdown"?ee(B):ne(B),J?.removeEventListener(B.type,pe)}J?.addEventListener(B.type,pe)}function de(B){if(!E.current)return;const J=x.current;if(U(),H()==="intentional"){if(B.type==="pointercancel"){J&&X();return}if(!re(B)){if(J){X();return}typeof v=="function"&&!v(B)||(V.clear(),w.current=!0,M())}}}function fe(B){if(H()!=="sloppy"||!I.current||Yt(B,n.select("floatingElement"))||Yt(B,n.select("domReferenceElement")))return;const J=B.touches[0];if(!J)return;const pe=Math.abs(J.clientX-I.current.startX),Se=Math.abs(J.clientY-I.current.startY),Ne=Math.sqrt(pe*pe+Se*Se);Ne>5&&(I.current.dismissOnTouchEnd=!0),Ne>10&&(ne(B),A.clear(),I.current=null)}function oe(B){const J=gt(B);function pe(){fe(B),J?.removeEventListener(B.type,pe)}J?.addEventListener(B.type,pe)}function ue(B){H()!=="sloppy"||!I.current||Yt(B,n.select("floatingElement"))||Yt(B,n.select("domReferenceElement"))||(I.current.dismissOnTouchEnd&&ne(B),A.clear(),I.current=null)}function te(B){const J=gt(B);function pe(){ue(B),J?.removeEventListener(B.type,pe)}J?.addEventListener(B.type,pe)}const z=Ae(o);return a&&(z.addEventListener("keydown",C),z.addEventListener("compositionstart",Y),z.addEventListener("compositionend",q)),y&&(z.addEventListener("click",G,!0),z.addEventListener("pointerdown",G,!0),z.addEventListener("pointerup",de,!0),z.addEventListener("pointercancel",de,!0),z.addEventListener("mousedown",G,!0),z.addEventListener("mouseup",de,!0),z.addEventListener("touchstart",K,!0),z.addEventListener("touchmove",oe,!0),z.addEventListener("touchend",te,!0)),()=>{a&&(z.removeEventListener("keydown",C),z.removeEventListener("compositionstart",Y),z.removeEventListener("compositionend",q)),y&&(z.removeEventListener("click",G,!0),z.removeEventListener("pointerdown",G,!0),z.removeEventListener("pointerup",de,!0),z.removeEventListener("pointercancel",de,!0),z.removeEventListener("mousedown",G,!0),z.removeEventListener("mouseup",de,!0),z.removeEventListener("touchstart",K,!0),z.removeEventListener("touchmove",oe,!0),z.removeEventListener("touchend",te,!0)),j.clear(),V.clear(),U(),w.current=!1}},[s,o,a,y,v,r,i,T,S,C,M,b,g,n,A]),f.useEffect(M,[v,M]);const D=f.useMemo(()=>({onKeyDown:C,[OE[d]]:j=>{P()&&n.setOpen(!1,Ye(Dr,j.nativeEvent))},...d!=="intentional"&&{onClick(j){P()&&n.setOpen(!1,Ye(Dr,j.nativeEvent))}}}),[C,n,d,P]),k=me(j=>{if(!r||!i||j.button!==0)return;const V=gt(j.nativeEvent);ke(n.select("floatingElement"),V)&&(E.current||(E.current=!0,x.current=!1))}),$=me(j=>{!r||!i||(j.defaultPrevented||j.nativeEvent.defaultPrevented)&&E.current&&(x.current=!0)}),F=f.useMemo(()=>({onKeyDown:C,onPointerDown:$,onMouseDown:$,onClickCapture:N,onMouseDownCapture(j){N(),k(j)},onPointerDownCapture(j){N(),k(j)},onMouseUpCapture:N,onTouchEndCapture:N,onTouchMoveCapture:N}),[C,N,k,$]);return f.useMemo(()=>i?{reference:D,floating:F,trigger:D}:{},[i,D,F])}function vf(e,t,n){let{reference:r,floating:o}=e;const s=Ft(t),i=Da(t),a=Aa(i),l=xt(t),c=s==="y",u=r.x+r.width/2-o.width/2,d=r.y+r.height/2-o.height/2,h=r[a]/2-o[a]/2;let p;switch(l){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:d};break;case"left":p={x:r.x-o.width,y:d};break;default:p={x:r.x,y:r.y}}switch(Mn(t)){case"start":p[i]-=h*(n&&c?-1:1);break;case"end":p[i]+=h*(n&&c?-1:1);break}return p}async function PE(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:s,rects:i,elements:a,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:h=!1,padding:p=0}=vn(t,e),g=Sd(p),v=a[h?d==="floating"?"reference":"floating":d],y=ks(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(v)))==null||n?v:v.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:l})),b=d==="floating"?{x:r,y:o,width:i.floating.width,height:i.floating.height}:i.reference,E=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),x=await(s.isElement==null?void 0:s.isElement(E))?await(s.getScale==null?void 0:s.getScale(E))||{x:1,y:1}:{x:1,y:1},w=ks(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:b,offsetParent:E,strategy:l}):b);return{top:(y.top-w.top+g.top)/x.y,bottom:(w.bottom-y.bottom+g.bottom)/x.y,left:(y.left-w.left+g.left)/x.x,right:(w.right-y.right+g.right)/x.x}}const IE=50,NE=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:i}=n,a=i.detectOverflow?i:{...i,detectOverflow:PE},l=await(i.isRTL==null?void 0:i.isRTL(t));let c=await i.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:d}=vf(c,r,l),h=r,p=0;const g={};for(let m=0;m<s.length;m++){const v=s[m];if(!v)continue;const{name:y,fn:b}=v,{x:E,y:x,data:w,reset:T}=await b({x:u,y:d,initialPlacement:r,placement:h,strategy:o,middlewareData:g,rects:c,platform:a,elements:{reference:e,floating:t}});u=E??u,d=x??d,g[y]={...g[y],...w},T&&p<IE&&(p++,typeof T=="object"&&(T.placement&&(h=T.placement),T.rects&&(c=T.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:o}):T.rects),{x:u,y:d}=vf(c,h,l)),m=-1)}return{x:u,y:d,placement:h,strategy:o,middlewareData:g}},_E=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:s,rects:i,initialPlacement:a,platform:l,elements:c}=t,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:h,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:m=!0,...v}=vn(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const y=xt(o),b=Ft(a),E=xt(a)===a,x=await(l.isRTL==null?void 0:l.isRTL(c.floating)),w=h||(E||!m?[Os(a)]:e1(a)),T=g!=="none";!h&&T&&w.push(...o1(a,m,g,x));const S=[a,...w],I=await l.detectOverflow(t,v),A=[];let L=((r=s.flip)==null?void 0:r.overflows)||[];if(u&&A.push(I[y]),d){const P=Qw(o,i,x);A.push(I[P[0]],I[P[1]])}if(L=[...L,{placement:o,overflows:A}],!A.every(P=>P<=0)){var M,_;const P=(((M=s.flip)==null?void 0:M.index)||0)+1,C=S[P];if(C&&(!(d==="alignment"?b!==Ft(C):!1)||L.every(k=>Ft(k.placement)===b?k.overflows[0]>0:!0)))return{data:{index:P,overflows:L},reset:{placement:C}};let N=(_=L.filter(D=>D.overflows[0]<=0).sort((D,k)=>D.overflows[1]-k.overflows[1])[0])==null?void 0:_.placement;if(!N)switch(p){case"bestFit":{var R;const D=(R=L.filter(k=>{if(T){const $=Ft(k.placement);return $===b||$==="y"}return!0}).map(k=>[k.placement,k.overflows.filter($=>$>0).reduce(($,F)=>$+F,0)]).sort((k,$)=>k[1]-$[1])[0])==null?void 0:R[0];D&&(N=D);break}case"initialPlacement":N=a;break}if(o!==N)return{reset:{placement:N}}}return{}}}};function yf(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function bf(e){return Kw.some(t=>e[t]>=0)}const AE=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:o="referenceHidden",...s}=vn(e,t);switch(o){case"referenceHidden":{const i=await r.detectOverflow(t,{...s,elementContext:"reference"}),a=yf(i,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:bf(a)}}}case"escaped":{const i=await r.detectOverflow(t,{...s,altBoundary:!0}),a=yf(i,n.floating);return{data:{escapedOffsets:a,escaped:bf(a)}}}default:return{}}}}},wf=new Set(["left","top"]);async function DE(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),i=xt(n),a=Mn(n),l=Ft(n)==="y",c=wf.has(i)?-1:1,u=s&&l?-1:1,d=vn(t,e);let{mainAxis:h,crossAxis:p,alignmentAxis:g}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return a&&typeof g=="number"&&(p=a==="end"?g*-1:g),l?{x:p*u,y:h*c}:{x:h*c,y:p*u}}const ME=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:s,placement:i,middlewareData:a}=t,l=await DE(t,e);return i===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:o+l.x,y:s+l.y,data:{...l,placement:i}}}}},LE=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o,platform:s}=t,{mainAxis:i=!0,crossAxis:a=!1,limiter:l={fn:y=>{let{x:b,y:E}=y;return{x:b,y:E}}},...c}=vn(e,t),u={x:n,y:r},d=await s.detectOverflow(t,c),h=Ft(xt(o)),p=_a(h);let g=u[p],m=u[h];if(i){const y=p==="y"?"top":"left",b=p==="y"?"bottom":"right",E=g+d[y],x=g-d[b];g=Na(E,g,x)}if(a){const y=h==="y"?"top":"left",b=h==="y"?"bottom":"right",E=m+d[y],x=m-d[b];m=Na(E,m,x)}const v=l.fn({...t,[p]:g,[h]:m});return{...v,data:{x:v.x-n,y:v.y-r,enabled:{[p]:i,[h]:a}}}}}},$E=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:s,middlewareData:i}=t,{offset:a=0,mainAxis:l=!0,crossAxis:c=!0}=vn(e,t),u={x:n,y:r},d=Ft(o),h=_a(d);let p=u[h],g=u[d];const m=vn(a,t),v=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(l){const E=h==="y"?"height":"width",x=s.reference[h]-s.floating[E]+v.mainAxis,w=s.reference[h]+s.reference[E]-v.mainAxis;p<x?p=x:p>w&&(p=w)}if(c){var y,b;const E=h==="y"?"width":"height",x=wf.has(xt(o)),w=s.reference[d]-s.floating[E]+(x&&((y=i.offset)==null?void 0:y[d])||0)+(x?0:v.crossAxis),T=s.reference[d]+s.reference[E]+(x?0:((b=i.offset)==null?void 0:b[d])||0)-(x?v.crossAxis:0);g<w?g=w:g>T&&(g=T)}return{[h]:p,[d]:g}}}},FE=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:s,platform:i,elements:a}=t,{apply:l=()=>{},...c}=vn(e,t),u=await i.detectOverflow(t,c),d=xt(o),h=Mn(o),p=Ft(o)==="y",{width:g,height:m}=s.floating;let v,y;d==="top"||d==="bottom"?(v=d,y=h===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?"start":"end")?"left":"right"):(y=d,v=h==="end"?"top":"bottom");const b=m-u.top-u.bottom,E=g-u.left-u.right,x=Rr(m-u[v],b),w=Rr(g-u[y],E),T=!t.middlewareData.shift;let S=x,I=w;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(I=E),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(S=b),T&&!h){const L=Pt(u.left,0),M=Pt(u.right,0),_=Pt(u.top,0),R=Pt(u.bottom,0);p?I=g-2*(L!==0||M!==0?L+M:Pt(u.left,u.right)):S=m-2*(_!==0||R!==0?_+R:Pt(u.top,u.bottom))}await l({...t,availableWidth:I,availableHeight:S});const A=await i.getDimensions(a.floating);return g!==A.width||m!==A.height?{reset:{rects:!0}}:{}}}};function Ef(e){const t=Rt(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=rt(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r,a=Cs(n)!==s||Cs(r)!==i;return a&&(n=s,r=i),{width:n,height:r,$:a}}function ic(e){return $e(e)?e:e.contextElement}function Lr(e){const t=ic(e);if(!rt(t))return tn(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=Ef(t);let i=(s?Cs(n.width):n.width)/r,a=(s?Cs(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!a||!Number.isFinite(a))&&(a=1),{x:i,y:a}}const VE=tn(0);function xf(e){const t=nt(e);return!xs()||!t.visualViewport?VE:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function BE(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==nt(e)?!1:t}function sr(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=ic(e);let i=tn(1);t&&(r?$e(r)&&(i=Lr(r)):i=Lr(e));const a=BE(s,n,r)?xf(s):tn(0);let l=(o.left+a.x)/i.x,c=(o.top+a.y)/i.y,u=o.width/i.x,d=o.height/i.y;if(s){const h=nt(s),p=r&&$e(r)?nt(r):r;let g=h,m=Sa(g);for(;m&&r&&p!==g;){const v=Lr(m),y=m.getBoundingClientRect(),b=Rt(m),E=y.left+(m.clientLeft+parseFloat(b.paddingLeft))*v.x,x=y.top+(m.clientTop+parseFloat(b.paddingTop))*v.y;l*=v.x,c*=v.y,u*=v.x,d*=v.y,l+=E,c+=x,g=nt(m),m=Sa(g)}}return ks({width:u,height:d,x:l,y:c})}function Vs(e,t){const n=Ss(e).scrollLeft;return t?t.left+n:sr(en(e)).left+n}function Sf(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Vs(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function WE(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",i=en(r),a=t?Es(t.floating):!1;if(r===i||a&&s)return n;let l={scrollLeft:0,scrollTop:0},c=tn(1);const u=tn(0),d=rt(r);if((d||!d&&!s)&&((An(r)!=="body"||Dn(i))&&(l=Ss(r)),d)){const p=sr(r);c=Lr(r),u.x=p.x+r.clientLeft,u.y=p.y+r.clientTop}const h=i&&!d&&!s?Sf(i,l):tn(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+u.x+h.x,y:n.y*c.y-l.scrollTop*c.y+u.y+h.y}}function jE(e){return Array.from(e.getClientRects())}function HE(e){const t=en(e),n=Ss(e),r=e.ownerDocument.body,o=Pt(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=Pt(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+Vs(e);const a=-n.scrollTop;return Rt(r).direction==="rtl"&&(i+=Pt(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:i,y:a}}const Cf=25;function UE(e,t){const n=nt(e),r=en(e),o=n.visualViewport;let s=r.clientWidth,i=r.clientHeight,a=0,l=0;if(o){s=o.width,i=o.height;const u=xs();(!u||u&&t==="fixed")&&(a=o.offsetLeft,l=o.offsetTop)}const c=Vs(r);if(c<=0){const u=r.ownerDocument,d=u.body,h=getComputedStyle(d),p=u.compatMode==="CSS1Compat"&&parseFloat(h.marginLeft)+parseFloat(h.marginRight)||0,g=Math.abs(r.clientWidth-d.clientWidth-p);g<=Cf&&(s-=g)}else c<=Cf&&(s+=c);return{width:s,height:i,x:a,y:l}}function GE(e,t){const n=sr(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=rt(e)?Lr(e):tn(1),i=e.clientWidth*s.x,a=e.clientHeight*s.y,l=o*s.x,c=r*s.y;return{width:i,height:a,x:l,y:c}}function Tf(e,t,n){let r;if(t==="viewport")r=UE(e,n);else if(t==="document")r=HE(en(e));else if($e(t))r=GE(t,n);else{const o=xf(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return ks(r)}function Of(e,t){const n=mn(e);return n===t||!$e(n)||hn(n)?!1:Rt(n).position==="fixed"||Of(n,t)}function zE(e,t){const n=t.get(e);if(n)return n;let r=yo(e,[],!1).filter(a=>$e(a)&&An(a)!=="body"),o=null;const s=Rt(e).position==="fixed";let i=s?mn(e):e;for(;$e(i)&&!hn(i);){const a=Rt(i),l=xa(i);!l&&a.position==="fixed"&&(o=null),(s?!l&&!o:!l&&a.position==="static"&&!!o&&(o.position==="absolute"||o.position==="fixed")||Dn(i)&&!l&&Of(e,i))?r=r.filter(u=>u!==i):o=a,i=mn(i)}return t.set(e,r),r}function YE(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[...n==="clippingAncestors"?Es(t)?[]:zE(t,this._c):[].concat(n),r],a=Tf(t,i[0],o);let l=a.top,c=a.right,u=a.bottom,d=a.left;for(let h=1;h<i.length;h++){const p=Tf(t,i[h],o);l=Pt(p.top,l),c=Rr(p.right,c),u=Rr(p.bottom,u),d=Pt(p.left,d)}return{width:c-d,height:u-l,x:d,y:l}}function ZE(e){const{width:t,height:n}=Ef(e);return{width:t,height:n}}function qE(e,t,n){const r=rt(t),o=en(t),s=n==="fixed",i=sr(e,!0,s,t);let a={scrollLeft:0,scrollTop:0};const l=tn(0);function c(){l.x=Vs(o)}if(r||!r&&!s)if((An(t)!=="body"||Dn(o))&&(a=Ss(t)),r){const p=sr(t,!0,s,t);l.x=p.x+t.clientLeft,l.y=p.y+t.clientTop}else o&&c();s&&!r&&o&&c();const u=o&&!r&&!s?Sf(o,a):tn(0),d=i.left+a.scrollLeft-l.x-u.x,h=i.top+a.scrollTop-l.y-u.y;return{x:d,y:h,width:i.width,height:i.height}}function ac(e){return Rt(e).position==="static"}function kf(e,t){if(!rt(e)||Rt(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return en(e)===n&&(n=n.ownerDocument.body),n}function Rf(e,t){const n=nt(e);if(Es(e))return n;if(!rt(e)){let o=mn(e);for(;o&&!hn(o);){if($e(o)&&!ac(o))return o;o=mn(o)}return n}let r=kf(e,t);for(;r&&Fw(r)&&ac(r);)r=kf(r,t);return r&&hn(r)&&ac(r)&&!xa(r)?n:r||Ww(e)||n}const XE=async function(e){const t=this.getOffsetParent||Rf,n=this.getDimensions,r=await n(e.floating);return{reference:qE(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function KE(e){return Rt(e).direction==="rtl"}const JE={convertOffsetParentRelativeRectToViewportRelativeRect:WE,getDocumentElement:en,getClippingRect:YE,getOffsetParent:Rf,getElementRects:XE,getClientRects:jE,getDimensions:ZE,getScale:Lr,isElement:$e,isRTL:KE};function Pf(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function QE(e,t){let n=null,r;const o=en(e);function s(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function i(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),s();const c=e.getBoundingClientRect(),{left:u,top:d,width:h,height:p}=c;if(a||t(),!h||!p)return;const g=Ts(d),m=Ts(o.clientWidth-(u+h)),v=Ts(o.clientHeight-(d+p)),y=Ts(u),E={rootMargin:-g+"px "+-m+"px "+-v+"px "+-y+"px",threshold:Pt(0,Rr(1,l))||1};let x=!0;function w(T){const S=T[0].intersectionRatio;if(S!==l){if(!x)return i();S?i(!1,S):r=setTimeout(()=>{i(!1,1e-7)},1e3)}S===1&&!Pf(c,e.getBoundingClientRect())&&i(),x=!1}try{n=new IntersectionObserver(w,{...E,root:o.ownerDocument})}catch{n=new IntersectionObserver(w,E)}n.observe(e)}return i(!0),s}function If(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=ic(e),u=o||s?[...c?yo(c):[],...t?yo(t):[]]:[];u.forEach(y=>{o&&y.addEventListener("scroll",n,{passive:!0}),s&&y.addEventListener("resize",n)});const d=c&&a?QE(c,n):null;let h=-1,p=null;i&&(p=new ResizeObserver(y=>{let[b]=y;b&&b.target===c&&p&&t&&(p.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var E;(E=p)==null||E.observe(t)})),n()}),c&&!l&&p.observe(c),t&&p.observe(t));let g,m=l?sr(e):null;l&&v();function v(){const y=sr(e);m&&!Pf(m,y)&&n(),m=y,g=requestAnimationFrame(v)}return n(),()=>{var y;u.forEach(b=>{o&&b.removeEventListener("scroll",n),s&&b.removeEventListener("resize",n)}),d?.(),(y=p)==null||y.disconnect(),p=null,l&&cancelAnimationFrame(g)}}const ex=ME,tx=LE,nx=_E,rx=FE,ox=AE,sx=$E,ix=(e,t,n)=>{const r=new Map,o={platform:JE,...n},s={...o.platform,_c:r};return NE(e,t,{...o,platform:s})};var ax=typeof document<"u",cx=function(){},Bs=ax?W.useLayoutEffect:cx;function Ws(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Ws(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;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const s=o[r];if(!(s==="_owner"&&e.$$typeof)&&!Ws(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function Nf(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function _f(e,t){const n=Nf(e);return Math.round(t*n)/n}function cc(e){const t=f.useRef(e);return Bs(()=>{t.current=e}),t}function lx(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:s,floating:i}={},transform:a=!0,whileElementsMounted:l,open:c}=e,[u,d]=f.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[h,p]=f.useState(r);Ws(h,r)||p(r);const[g,m]=f.useState(null),[v,y]=f.useState(null),b=f.useCallback(k=>{k!==T.current&&(T.current=k,m(k))},[]),E=f.useCallback(k=>{k!==S.current&&(S.current=k,y(k))},[]),x=s||g,w=i||v,T=f.useRef(null),S=f.useRef(null),I=f.useRef(u),A=l!=null,L=cc(l),M=cc(o),_=cc(c),R=f.useCallback(()=>{if(!T.current||!S.current)return;const k={placement:t,strategy:n,middleware:h};M.current&&(k.platform=M.current),ix(T.current,S.current,k).then($=>{const F={...$,isPositioned:_.current!==!1};P.current&&!Ws(I.current,F)&&(I.current=F,lt.flushSync(()=>{d(F)}))})},[h,t,n,M,_]);Bs(()=>{c===!1&&I.current.isPositioned&&(I.current.isPositioned=!1,d(k=>({...k,isPositioned:!1})))},[c]);const P=f.useRef(!1);Bs(()=>(P.current=!0,()=>{P.current=!1}),[]),Bs(()=>{if(x&&(T.current=x),w&&(S.current=w),x&&w){if(L.current)return L.current(x,w,R);R()}},[x,w,R,L,A]);const C=f.useMemo(()=>({reference:T,floating:S,setReference:b,setFloating:E}),[b,E]),N=f.useMemo(()=>({reference:x,floating:w}),[x,w]),D=f.useMemo(()=>{const k={position:n,left:0,top:0};if(!N.floating)return k;const $=_f(N.floating,u.x),F=_f(N.floating,u.y);return a?{...k,transform:"translate("+$+"px, "+F+"px)",...Nf(N.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:$,top:F}},[n,a,N.floating,u.x,u.y]);return f.useMemo(()=>({...u,update:R,refs:C,elements:N,floatingStyles:D}),[u,R,C,N,D])}const ux=(e,t)=>{const n=ex(e);return{name:n.name,fn:n.fn,options:[e,t]}},dx=(e,t)=>{const n=tx(e);return{name:n.name,fn:n.fn,options:[e,t]}},fx=(e,t)=>({fn:sx(e).fn,options:[e,t]}),px=(e,t)=>{const n=nx(e);return{name:n.name,fn:n.fn,options:[e,t]}},hx=(e,t)=>{const n=rx(e);return{name:n.name,fn:n.fn,options:[e,t]}},mx=(e,t)=>{const n=ox(e);return{name:n.name,fn:n.fn,options:[e,t]}},gx={open:he(e=>e.open),domReferenceElement:he(e=>e.domReferenceElement),referenceElement:he(e=>e.positionReference??e.referenceElement),floatingElement:he(e=>e.floatingElement),floatingId:he(e=>e.floatingId)};class lc extends vs{constructor(t){const{nested:n,noEmit:r,onOpenChange:o,triggerElements:s,...i}=t;super({...i,positionReference:i.referenceElement,domReferenceElement:i.referenceElement},{onOpenChange:o,dataRef:{current:{}},events:df(),nested:n,noEmit:r,triggerElements:s},gx)}setOpen=(t,n)=>{if((!t||!this.state.open||wd(n.event))&&(this.context.dataRef.current.openEvent=t?n.event:void 0),!this.context.noEmit){const r={open:t,reason:n.reason,nativeEvent:n.event,nested:this.context.nested,triggerElement:n.trigger};this.context.events.emit("openchange",r)}this.context.onOpenChange?.(t,n)}}function uc(e,t=!1,n=!1){const[r,o]=f.useState(e&&t?"idle":void 0),[s,i]=f.useState(e);return e&&!s&&(i(!0),o("starting")),!e&&s&&r!=="ending"&&!n&&o("ending"),!e&&!s&&r==="ending"&&o(void 0),ve(()=>{if(!e&&s&&r!=="ending"&&n){const a=Nn.request(()=>{o("ending")});return()=>{Nn.cancel(a)}}},[e,s,r,n]),ve(()=>{if(!e||t)return;const a=Nn.request(()=>{o(void 0)});return()=>{Nn.cancel(a)}},[t,e]),ve(()=>{if(!e||!t)return;e&&s&&r!=="idle"&&o("starting");const a=Nn.request(()=>{o("idle")});return()=>{Nn.cancel(a)}},[t,e,s,o,r]),f.useMemo(()=>({mounted:s,setMounted:i,transitionStatus:r}),[s,r])}function vx(e,t){const n=f.useRef(null),r=f.useRef(null);return f.useCallback(o=>{if(e!==void 0){if(n.current!==null){const s=n.current,i=r.current,a=t.context.triggerElements.getById(s);i&&a===i&&t.context.triggerElements.delete(s),n.current=null,r.current=null}o!==null&&(n.current=e,r.current=o,t.context.triggerElements.add(e,o))}},[t,e])}function Af(e,t,n,r){const o=n.useState("isMountedByTrigger",e),s=vx(e,n),i=me(a=>{if(s(a),!a||!n.select("open"))return;const l=n.select("activeTriggerId");if(l===e){n.update({activeTriggerElement:a,...r});return}l==null&&n.update({activeTriggerId:e,activeTriggerElement:a,...r})});return ve(()=>{o&&n.update({activeTriggerElement:t.current,...r})},[o,n,t,...Object.values(r)]),{registerTrigger:i,isMountedByThisTrigger:o}}function Df(e){const t=e.useState("open");ve(()=>{if(t&&!e.select("activeTriggerId")&&e.context.triggerElements.size===1){const n=e.context.triggerElements.entries().next();if(!n.done){const[r,o]=n.value;e.update({activeTriggerId:r,activeTriggerElement:o})}}},[t,e])}function Mf(e,t,n){const{mounted:r,setMounted:o,transitionStatus:s}=uc(e);t.useSyncedValues({mounted:r,transitionStatus:s});const i=me(()=>{o(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)}),a=t.useState("preventUnmountingOnClose");return Ar({enabled:!a,open:e,ref:t.context.popupRef,onComplete(){e||i()}}),{forceUnmount:i,transitionStatus:s}}class js{constructor(){this.elementsSet=new Set,this.idMap=new Map}add(t,n){const r=this.idMap.get(t);if(r!==n&&(r!==void 0&&this.elementsSet.delete(r),this.elementsSet.add(n),this.idMap.set(t,n),process.env.NODE_ENV!=="production"&&this.elementsSet.size!==this.idMap.size))throw new Error("Base UI: A trigger element cannot be registered under multiple IDs in PopupTriggerMap.")}delete(t){const n=this.idMap.get(t);n&&(this.elementsSet.delete(n),this.idMap.delete(t))}hasElement(t){return this.elementsSet.has(t)}hasMatchingElement(t){for(const n of this.elementsSet)if(t(n))return!0;return!1}getById(t){return this.idMap.get(t)}entries(){return this.idMap.entries()}elements(){return this.elementsSet.values()}get size(){return this.idMap.size}}function yx(){return new lc({open:!1,floatingElement:null,referenceElement:null,triggerElements:new js,floatingId:"",nested:!1,noEmit:!1,onOpenChange:void 0})}function Lf(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:"idle",floatingRootContext:yx(),preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:tt,inactiveTriggerProps:tt,popupProps:tt}}const Hs=he(e=>e.triggerIdProp??e.activeTriggerId),$f={open:he(e=>e.openProp??e.open),mounted:he(e=>e.mounted),transitionStatus:he(e=>e.transitionStatus),floatingRootContext:he(e=>e.floatingRootContext),preventUnmountingOnClose:he(e=>e.preventUnmountingOnClose),payload:he(e=>e.payload),activeTriggerId:Hs,activeTriggerElement:he(e=>e.mounted?e.activeTriggerElement:null),isTriggerActive:he((e,t)=>t!==void 0&&Hs(e)===t),isOpenedByTrigger:he((e,t)=>t!==void 0&&Hs(e)===t&&e.open),isMountedByTrigger:he((e,t)=>t!==void 0&&Hs(e)===t&&e.mounted),triggerProps:he((e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps),popupProps:he(e=>e.popupProps),popupElement:he(e=>e.popupElement),positionerElement:he(e=>e.positionerElement)};function bx(e){const{open:t=!1,onOpenChange:n,elements:r={}}=e,o=rr(),s=or()!=null;if(process.env.NODE_ENV!=="production"){const a=r.reference;a&&!$e(a)&&console.error("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `context.setPositionReference()`","instead.")}const i=ht(()=>new lc({open:t,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new js,floatingId:o,nested:s,noEmit:!1})).current;return ve(()=>{const a={open:t,floatingId:o};r.reference!==void 0&&(a.referenceElement=r.reference,a.domReferenceElement=$e(r.reference)?r.reference:null),r.floating!==void 0&&(a.floatingElement=r.floating),i.update(a)},[t,o,r.reference,r.floating,i]),i.context.onOpenChange=n,i.context.nested=s,i.context.noEmit=!1,i}function wx(e={}){const{nodeId:t,externalTree:n}=e,r=bx(e),o=e.rootContext||r,s={reference:o.useState("referenceElement"),floating:o.useState("floatingElement"),domReference:o.useState("domReferenceElement")},[i,a]=f.useState(null),l=f.useRef(null),c=Mr(n);ve(()=>{s.domReference&&(l.current=s.domReference)},[s.domReference]);const u=lx({...e,elements:{...s,...i&&{reference:i}}}),d=f.useCallback(S=>{const I=$e(S)?{getBoundingClientRect:()=>S.getBoundingClientRect(),getClientRects:()=>S.getClientRects(),contextElement:S}:S;a(I),u.refs.setReference(I)},[u.refs]),[h,p]=f.useState(null),[g,m]=f.useState(null);o.useSyncedValue("referenceElement",h),o.useSyncedValue("domReferenceElement",$e(h)?h:null),o.useSyncedValue("floatingElement",g);const v=f.useCallback(S=>{($e(S)||S===null)&&(l.current=S,p(S)),($e(u.refs.reference.current)||u.refs.reference.current===null||S!==null&&!$e(S))&&u.refs.setReference(S)},[u.refs,p]),y=f.useCallback(S=>{m(S),u.refs.setFloating(S)},[u.refs]),b=f.useMemo(()=>({...u.refs,setReference:v,setFloating:y,setPositionReference:d,domReference:l}),[u.refs,v,y,d]),E=f.useMemo(()=>({...u.elements,domReference:s.domReference}),[u.elements,s.domReference]),x=o.useState("open"),w=o.useState("floatingId"),T=f.useMemo(()=>({...u,dataRef:o.context.dataRef,open:x,onOpenChange:o.setOpen,events:o.context.events,floatingId:w,refs:b,elements:E,nodeId:t,rootStore:o}),[u,b,E,t,o,x,w]);return ve(()=>{o.context.dataRef.current.floatingContext=T;const S=c?.nodesRef.current.find(I=>I.id===t);S&&(S.context=T)}),f.useMemo(()=>({...u,context:T,refs:b,elements:E,rootStore:o}),[u,b,E,T,o])}function Ff(e){const{popupStore:t,noEmit:n=!1,treatPopupAsFloatingElement:r=!1,onOpenChange:o}=e,s=rr(),i=or()!=null,a=t.useState("open"),l=t.useState("activeTriggerElement"),c=t.useState(r?"popupElement":"positionerElement"),u=t.context.triggerElements,d=ht(()=>new lc({open:a,referenceElement:l,floatingElement:c,triggerElements:u,onOpenChange:o,floatingId:s,nested:i,noEmit:n})).current;return ve(()=>{const h={open:a,floatingId:s,referenceElement:l,floatingElement:c};$e(l)&&(h.domReferenceElement=l),d.state.positionReference===d.state.referenceElement&&(h.positionReference=l),d.update(h)},[a,s,l,c,d]),d.context.onOpenChange=o,d.context.nested=i,d.context.noEmit=n,d}const Ex=`button,a,[role="button"],select,[tabindex]:not([tabindex="-1"]),${gd}`;function xx(e){return e?!!e.closest(Ex):!1}class dc{constructor(){this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new zt,this.restTimeout=new zt,this.handleCloseOptions=void 0}static create(){return new dc}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose}function fc(e){e.performedPointerEventsMutation&&(e.pointerEventsScopeElement?.style.removeProperty("pointer-events"),e.pointerEventsReferenceElement?.style.removeProperty("pointer-events"),e.pointerEventsFloatingElement?.style.removeProperty("pointer-events"),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null)}function Sx(e,t){const{scopeElement:n,referenceElement:r,floatingElement:o}=t;fc(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=n,e.pointerEventsReferenceElement=r,e.pointerEventsFloatingElement=o,n.style.pointerEvents="none",r.style.pointerEvents="auto",o.style.pointerEvents="auto"}function Vf(e){const t=ht(dc.create).current,n=e.context.dataRef.current;return n.hoverInteractionState||(n.hoverInteractionState=t),mo(n.hoverInteractionState.disposeEffect),n.hoverInteractionState}function Cx(e,t={}){const n="rootStore"in e?e.rootStore:e,r=n.useState("open"),o=n.useState("floatingElement"),s=n.useState("domReferenceElement"),{dataRef:i}=n.context,{enabled:a=!0,closeDelay:l=0}=t,c=Vf(n),u=Mr(),d=or(),h=me(()=>Jd(i.current.openEvent?.type,c.interactedInside)),p=me(()=>{const E=i.current.openEvent?.type;return E?.includes("mouse")&&E!=="mousedown"}),g=me(E=>vd(E,n.context.triggerElements)),m=f.useCallback(E=>{const x=$s(l,"close",c.pointerType),w=()=>{n.setOpen(!1,Ye(St,E)),u?.events.emit("floating.closed",E)};x?c.openChangeTimeout.start(x,w):(c.openChangeTimeout.clear(),w())},[l,n,c,u]),v=me(()=>{fc(c)}),y=me(E=>{const x=gt(E);if(!xx(x)){c.interactedInside=!1;return}c.interactedInside=x?.closest("[aria-haspopup]")!=null});ve(()=>{r||(c.pointerType=void 0,c.restTimeoutPending=!1,c.interactedInside=!1,v())},[r,c,v]),f.useEffect(()=>v,[v]),ve(()=>{if(a&&r&&c.handleCloseOptions?.blockPointerEvents&&p()&&$e(s)&&o){const E=s,x=o,w=Ae(o),T=u?.nodesRef.current.find(I=>I.id===d)?.context?.elements.floating;T&&(T.style.pointerEvents="");const S=c.handleCloseOptions?.getScope?.()??c.pointerEventsScopeElement??T??E.closest("[data-rootownerid]")??w.body;return Sx(c,{scopeElement:S,referenceElement:E,floatingElement:x}),()=>{v()}}},[a,r,s,o,c,p,u,d,v]);const b=_n();f.useEffect(()=>{if(!a)return;function E(){c.openChangeTimeout.clear(),b.clear(),u?.events.off("floating.closed",w),v()}function x(S){if(u&&d&&gn(u.nodesRef.current,d).length>0){u.events.on("floating.closed",w);return}if(!g(S.relatedTarget)){if(c.handler){c.handler(S);return}v(),h()||m(S)}}function w(S){!u||!d||gn(u.nodesRef.current,d).length>0||b.start(0,()=>{u.events.off("floating.closed",w),n.setOpen(!1,Ye(St,S)),u.events.emit("floating.closed",S)})}const T=o;return T&&(T.addEventListener("mouseenter",E),T.addEventListener("mouseleave",x),T.addEventListener("pointerdown",y,!0)),()=>{T&&(T.removeEventListener("mouseenter",E),T.removeEventListener("mouseleave",x),T.removeEventListener("pointerdown",y,!0)),u?.events.off("floating.closed",w)}},[a,o,n,i,h,g,m,v,y,c,u,d,b])}const Tx={current:null};function Ox(e,t={}){const n="rootStore"in e?e.rootStore:e,{dataRef:r,events:o}=n.context,{enabled:s=!0,delay:i=0,handleClose:a=null,mouseOnly:l=!1,restMs:c=0,move:u=!0,triggerElementRef:d=Tx,externalTree:h,isActiveTrigger:p=!0,getHandleCloseContext:g}=t,m=Mr(h),v=Vf(n),y=rn(a),b=rn(i),E=rn(c),x=rn(s);p&&(v.handleCloseOptions=y.current?.__options);const w=me(()=>Jd(r.current.openEvent?.type,v.interactedInside)),T=me(M=>vd(M,n.context.triggerElements)),S=me((M,_,R)=>{const P=n.context.triggerElements;if(P.hasElement(_))return!M||!ke(M,_);if(!$e(R))return!1;const C=R;return P.hasMatchingElement(N=>ke(N,C))&&(!M||!ke(M,C))}),I=f.useCallback((M,_=!0)=>{const R=$s(b.current,"close",v.pointerType);R?v.openChangeTimeout.start(R,()=>{n.setOpen(!1,Ye(St,M)),m?.events.emit("floating.closed",M)}):_&&(v.openChangeTimeout.clear(),n.setOpen(!1,Ye(St,M)),m?.events.emit("floating.closed",M))},[b,n,v,m]),A=me(()=>{if(!v.handler)return;Ae(n.select("domReferenceElement")).removeEventListener("mousemove",v.handler),v.handler=void 0});f.useEffect(()=>A,[A]);const L=me(()=>{fc(v)});return f.useEffect(()=>{if(!s)return;function M(_){_.open||(A(),v.openChangeTimeout.clear(),v.restTimeout.clear(),v.blockMouseMove=!0,v.restTimeoutPending=!1)}return o.on("openchange",M),()=>{o.off("openchange",M)}},[s,o,v,A]),f.useEffect(()=>{if(!s)return;const M=d.current??(p?n.select("domReferenceElement"):null);if(!$e(M))return;function _(P){if(v.openChangeTimeout.clear(),v.blockMouseMove=!1,l&&!bo(v.pointerType)||Kd(E.current)>0&&!$s(b.current,"open"))return;const N=$s(b.current,"open",v.pointerType),D=P.currentTarget??null,k=n.select("domReferenceElement"),$=D==null?!1:S(k,D,P.target),F=n.select("open"),j=!F||$;$&&F?n.setOpen(!0,Ye(St,P,D)):N?v.openChangeTimeout.start(N,()=>{j&&n.setOpen(!0,Ye(St,P,D))}):j&&n.setOpen(!0,Ye(St,P,D))}function R(P){if(w()){L();return}A();const C=n.select("domReferenceElement"),N=Ae(C);v.restTimeout.clear(),v.restTimeoutPending=!1;const D=r.current.floatingContext??g?.();if(T(P.relatedTarget))return;if(y.current&&D){n.select("open")||v.openChangeTimeout.clear();const F=d.current;v.handler=y.current({...D,tree:m,x:P.clientX,y:P.clientY,onClose(){L(),A(),x.current&&!w()&&F===n.select("domReferenceElement")&&I(P,!0)}}),N.addEventListener("mousemove",v.handler),v.handler(P);return}(v.pointerType!=="touch"||!ke(n.select("floatingElement"),P.relatedTarget))&&I(P)}return u&&M.addEventListener("mousemove",_,{once:!0}),M.addEventListener("mouseenter",_),M.addEventListener("mouseleave",R),()=>{u&&M.removeEventListener("mousemove",_),M.removeEventListener("mouseenter",_),M.removeEventListener("mouseleave",R)}},[A,L,r,b,I,n,s,y,v,p,S,w,T,l,u,E,d,m,x,g]),f.useMemo(()=>{if(!s)return;function M(_){v.pointerType=_.pointerType}return{onPointerDown:M,onPointerEnter:M,onMouseMove(_){const{nativeEvent:R}=_,P=_.currentTarget,C=n.select("domReferenceElement"),N=n.select("open"),D=S(C,P,_.target);if(l&&!bo(v.pointerType))return;const k=Kd(E.current);if(N&&!D||k===0||!D&&v.restTimeoutPending&&_.movementX**2+_.movementY**2<2)return;v.restTimeout.clear();function $(){if(v.restTimeoutPending=!1,w())return;const F=n.select("open");!v.blockMouseMove&&(!F||D)&&n.setOpen(!0,Ye(St,R,P))}v.pointerType==="touch"?lt.flushSync(()=>{$()}):D&&N?$():(v.restTimeoutPending=!0,v.restTimeout.start(k,$))}}},[s,v,w,S,l,n,E])}function Us(e=[]){const t=e.map(c=>c?.reference),n=e.map(c=>c?.floating),r=e.map(c=>c?.item),o=e.map(c=>c?.trigger),s=f.useCallback(c=>Gs(c,e,"reference"),t),i=f.useCallback(c=>Gs(c,e,"floating"),n),a=f.useCallback(c=>Gs(c,e,"item"),r),l=f.useCallback(c=>Gs(c,e,"trigger"),o);return f.useMemo(()=>({getReferenceProps:s,getFloatingProps:i,getItemProps:a,getTriggerProps:l}),[s,i,a,l])}function Gs(e,t,n){const r=new Map,o=n==="item",s={};n==="floating"&&(s.tabIndex=-1,s[ka]="");for(const i in e)o&&e&&(i===hd||i===md)||(s[i]=e[i]);for(let i=0;i<t.length;i+=1){let a;const l=t[i]?.[n];typeof l=="function"?a=e?l(e):null:a=l,a&&Bf(s,a,o,r)}return Bf(s,e,o,r),s}function Bf(e,t,n,r){for(const o in t){const s=t[o];n&&(o===hd||o===md)||(o.startsWith("on")?(r.has(o)||r.set(o,[]),typeof s=="function"&&(r.get(o)?.push(s),e[o]=(...i)=>r.get(o)?.map(a=>a(...i)).find(a=>a!==void 0))):e[o]=s)}}const kx=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function Wf(e,t={}){const n="rootStore"in e?e.rootStore:e,r=n.useState("open"),o=n.useState("floatingId"),s=n.useState("domReferenceElement"),i=n.useState("floatingElement"),{role:a="dialog"}=t,l=rr(),c=s?.id||l,u=f.useMemo(()=>Ia(i)?.id||o,[i,o]),d=kx.get(a)??a,p=or()!=null,g=f.useMemo(()=>d==="tooltip"||a==="label"?tt:{"aria-haspopup":d==="alertdialog"?"dialog":d,"aria-expanded":"false",...d==="listbox"&&{role:"combobox"},...d==="menu"&&p&&{role:"menuitem"},...a==="select"&&{"aria-autocomplete":"none"},...a==="combobox"&&{"aria-autocomplete":"list"}},[d,p,a]),m=f.useMemo(()=>d==="tooltip"||a==="label"?{[`aria-${a==="label"?"labelledby":"describedby"}`]:r?u:void 0}:{...g,"aria-expanded":r?"true":"false","aria-controls":r?u:void 0,...d==="menu"&&{id:c}},[d,u,r,c,a,g]),v=f.useMemo(()=>{const b={id:u,...d&&{role:d}};return d==="tooltip"||a==="label"?b:{...b,...d==="menu"&&{"aria-labelledby":c}}},[d,u,c,a]),y=f.useCallback(({active:b,selected:E})=>{const x={role:"option",...b&&{id:`${u}-fui-option`}};switch(a){case"select":case"combobox":return{...x,"aria-selected":E}}return{}},[u,a]);return f.useMemo(()=>({reference:m,floating:v,item:y,trigger:g}),[m,v,g,y])}const jf=.1,Rx=jf*jf,Ve=.5;function zs(e,t,n,r,o,s){return r>=t!=s>=t&&e<=(o-n)*(t-r)/(s-r)+n}function Ys(e,t,n,r,o,s,i,a,l,c){let u=!1;return zs(e,t,n,r,o,s)&&(u=!u),zs(e,t,o,s,i,a)&&(u=!u),zs(e,t,i,a,l,c)&&(u=!u),zs(e,t,l,c,n,r)&&(u=!u),u}function Px(e,t,n){return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function Zs(e,t,n,r,o,s){const i=Math.min(n,o),a=Math.max(n,o),l=Math.min(r,s),c=Math.max(r,s);return e>=i&&e<=a&&t>=l&&t<=c}function Ix(e={}){const{blockPointerEvents:t=!1}=e,n=new zt,r=({x:o,y:s,placement:i,elements:a,onClose:l,nodeId:c,tree:u})=>{const d=i?.split("-")[0];let h=!1,p=null,g=null,m=typeof performance<"u"?performance.now():0;function v(b,E){const x=performance.now(),w=x-m;if(p===null||g===null||w===0)return p=b,g=E,m=x,!1;const T=b-p,S=E-g,I=T*T+S*S,A=w*w*Rx;return p=b,g=E,m=x,I<A}function y(){n.clear(),l()}return function(E){n.clear();const x=a.domReference,w=a.floating;if(!x||!w||d==null||o==null||s==null)return;const{clientX:T,clientY:S}=E,I=gt(E),A=E.type==="mouseleave",L=ke(w,I),M=ke(x,I);if(L&&(h=!0,!A))return;if(M&&(h=!1,!A)){h=!0;return}if(A&&$e(E.relatedTarget)&&ke(w,E.relatedTarget))return;function _(){return!!(u&&gn(u.nodesRef.current,c).length>0)}function R(){_()||y()}if(_())return;const P=x.getBoundingClientRect(),C=w.getBoundingClientRect(),N=o>C.right-C.width/2,D=s>C.bottom-C.height/2,k=C.width>P.width,$=C.height>P.height,F=(k?P:C).left,j=(k?P:C).right,V=($?P:C).top,Y=($?P:C).bottom;if(d==="top"&&s>=P.bottom-1||d==="bottom"&&s<=P.top+1||d==="left"&&o>=P.right-1||d==="right"&&o<=P.left+1){R();return}let q=!1;switch(d){case"top":q=Zs(T,S,F,P.top+1,j,C.bottom-1);break;case"bottom":q=Zs(T,S,F,C.top+1,j,P.bottom-1);break;case"left":q=Zs(T,S,C.right-1,Y,P.left+1,V);break;case"right":q=Zs(T,S,P.right-1,Y,C.left+1,V);break}if(q)return;if(h&&!Px(T,S,P)){R();return}if(!A&&v(T,S)){R();return}let X=!1;switch(d){case"top":{const U=k?Ve/2:Ve*4,H=k||N?o+U:o-U,Z=k?o-U:N?o+U:o-U,re=s+Ve+1,ne=N||k?C.bottom-Ve:C.top,ee=N?k?C.bottom-Ve:C.top:C.bottom-Ve;X=Ys(T,S,H,re,Z,re,C.left,ne,C.right,ee);break}case"bottom":{const U=k?Ve/2:Ve*4,H=k||N?o+U:o-U,Z=k?o-U:N?o+U:o-U,re=s-Ve,ne=N||k?C.top+Ve:C.bottom,ee=N?k?C.top+Ve:C.bottom:C.top+Ve;X=Ys(T,S,H,re,Z,re,C.left,ne,C.right,ee);break}case"left":{const U=$?Ve/2:Ve*4,H=$||D?s+U:s-U,Z=$?s-U:D?s+U:s-U,re=o+Ve+1,ne=D||$?C.right-Ve:C.left,ee=D?$?C.right-Ve:C.left:C.right-Ve;X=Ys(T,S,ne,C.top,ee,C.bottom,re,H,re,Z);break}case"right":{const U=$?Ve/2:Ve*4,H=$||D?s+U:s-U,Z=$?s-U:D?s+U:s-U,re=o-Ve,ne=D||$?C.left+Ve:C.right,ee=D?$?C.left+Ve:C.right:C.left+Ve;X=Ys(T,S,re,H,re,Z,ne,C.top,ee,C.bottom);break}}X?h||n.start(40,R):R()}};return r.__options={blockPointerEvents:t},r}const Hf=f.forwardRef(function(t,n){const{children:r,container:o,className:s,render:i,...a}=t,{portalNode:l,portalSubtree:c}=uf({container:o,ref:n,componentProps:t,elementProps:a});return!c&&!l?null:O.jsxs(f.Fragment,{children:[c,l&<.createPortal(r,l)]})});process.env.NODE_ENV!=="production"&&(Hf.displayName="FloatingPortalLite");const Nx=Hf,Uf=f.createContext(void 0);process.env.NODE_ENV!=="production"&&(Uf.displayName="DirectionContext");function _x(){return f.useContext(Uf)?.direction??"ltr"}const Ax=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:i,elements:a,middlewareData:l}=t,{element:c,padding:u=0,offsetParent:d="real"}=vn(e,t)||{};if(c==null)return{};const h=Sd(u),p={x:n,y:r},g=Da(o),m=Aa(g),v=await i.getDimensions(c),y=g==="y",b=y?"top":"left",E=y?"bottom":"right",x=y?"clientHeight":"clientWidth",w=s.reference[m]+s.reference[g]-p[g]-s.floating[m],T=p[g]-s.reference[g],S=d==="real"?await i.getOffsetParent?.(c):a.floating;let I=a.floating[x]||s.floating[m];(!I||!await i.isElement?.(S))&&(I=a.floating[x]||s.floating[m]);const A=w/2-T/2,L=I/2-v[m]/2-1,M=Math.min(h[b],L),_=Math.min(h[E],L),R=M,P=I-v[m]-_,C=I/2-v[m]/2+A,N=Na(R,C,P),D=!l.arrow&&Mn(o)!=null&&C!==N&&s.reference[m]/2-(C<R?M:_)-v[m]/2<0,k=D?C<R?C-R:C-P:0;return{[g]:p[g]+k,data:{[g]:N,centerOffset:C-N-k,...D&&{alignmentOffset:k}},reset:D}}}),Dx=(e,t)=>({...Ax(e),options:[e,t]}),Mx={name:"hide",async fn(e){const{width:t,height:n,x:r,y:o}=e.rects.reference,s=t===0&&n===0&&r===0&&o===0;return{data:{referenceHidden:(await mx().fn(e)).data?.referenceHidden||s}}}},qs={sideX:"left",sideY:"top"},Lx={name:"adaptiveOrigin",async fn(e){const{x:t,y:n,rects:{floating:r},elements:{floating:o},platform:s,strategy:i,placement:a}=e,l=nt(o),c=l.getComputedStyle(o);if(!(c.transitionDuration!=="0s"&&c.transitionDuration!==""))return{x:t,y:n,data:qs};const d=await s.getOffsetParent?.(o);let h={width:0,height:0};if(i==="fixed"&&l?.visualViewport)h={width:l.visualViewport.width,height:l.visualViewport.height};else if(d===l){const b=Ae(o);h={width:b.documentElement.clientWidth,height:b.documentElement.clientHeight}}else await s.isElement?.(d)&&(h=await s.getDimensions(d));const p=xt(a);let g=t,m=n;p==="left"&&(g=h.width-(t+r.width)),p==="top"&&(m=h.height-(n+r.height));const v=p==="left"?"right":qs.sideX,y=p==="top"?"bottom":qs.sideY;return{x:g,y:m,data:{sideX:v,sideY:y}}}};function Gf(e,t,n){const r=e==="inline-start"||e==="inline-end";return{top:"top",right:r?n?"inline-start":"inline-end":"right",bottom:"bottom",left:r?n?"inline-end":"inline-start":"left"}[t]}function zf(e,t,n){const{rects:r,placement:o}=e;return{side:Gf(t,xt(o),n),align:Mn(o)||"center",anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function $x(e){const{anchor:t,positionMethod:n="absolute",side:r="bottom",sideOffset:o=0,align:s="center",alignOffset:i=0,collisionBoundary:a,collisionPadding:l=5,sticky:c=!1,arrowPadding:u=5,disableAnchorTracking:d=!1,keepMounted:h=!1,floatingRootContext:p,mounted:g,collisionAvoidance:m,shiftCrossAxis:v=!1,nodeId:y,adaptiveOrigin:b,lazyFlip:E=!1,externalTree:x}=e,[w,T]=f.useState(null);!g&&w!==null&&T(null);const S=m.side||"flip",I=m.align||"flip",A=m.fallbackAxisSide||"end",L=typeof t=="function"?t:void 0,M=me(L),_=L?M:t,R=rn(t),C=_x()==="rtl",N=w||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":C?"left":"right","inline-start":C?"right":"left"}[r],D=s==="center"?N:`${N}-${s}`;let k=l;const $=1,F=r==="bottom"?$:0,j=r==="top"?$:0,V=r==="right"?$:0,Y=r==="left"?$:0;typeof k=="number"?k={top:k+F,right:k+Y,bottom:k+j,left:k+V}:k&&(k={top:(k.top||0)+F,right:(k.right||0)+Y,bottom:(k.bottom||0)+j,left:(k.left||0)+V});const q={boundary:a==="clipping-ancestors"?"clippingAncestors":a,padding:k},X=f.useRef(null),U=rn(o),H=rn(i),ne=[ux(ye=>{const Ze=zf(ye,r,C),ie=typeof U.current=="function"?U.current(Ze):U.current,ge=typeof H.current=="function"?H.current(Ze):H.current;return{mainAxis:ie,crossAxis:ge,alignmentAxis:ge}},[typeof o!="function"?o:0,typeof i!="function"?i:0,C,r])],ee=I==="none"&&S!=="shift",le=!ee&&(c||v||S==="shift"),K=S==="none"?null:px({...q,padding:{top:k.top+$,right:k.right+$,bottom:k.bottom+$,left:k.left+$},mainAxis:!v&&S==="flip",crossAxis:I==="flip"?"alignment":!1,fallbackAxisSideDirection:A}),G=ee?null:dx(ye=>{const Ze=Ae(ye.elements.floating).documentElement;return{...q,rootBoundary:v?{x:0,y:0,width:Ze.clientWidth,height:Ze.clientHeight}:void 0,mainAxis:I!=="none",crossAxis:le,limiter:c||v?void 0:fx(ie=>{if(!X.current)return{};const{width:ge,height:Oe}=X.current.getBoundingClientRect(),we=Ft(xt(ie.placement)),Me=we==="y"?ge:Oe,Ke=we==="y"?k.left+k.right:k.top+k.bottom;return{offset:Me/2+Ke/2}})}},[q,c,v,k,I]);S==="shift"||I==="shift"||s==="center"?ne.push(G,K):ne.push(K,G),ne.push(hx({...q,apply({elements:{floating:ye},availableWidth:Ze,availableHeight:ie,rects:ge}){const Oe=ye.style;Oe.setProperty("--available-width",`${Ze}px`),Oe.setProperty("--available-height",`${ie}px`);const we=window.devicePixelRatio||1,{x:Me,y:Ke,width:et,height:Tt}=ge.reference,Et=(Math.round((Me+et)*we)-Math.round(Me*we))/we,Kt=(Math.round((Ke+Tt)*we)-Math.round(Ke*we))/we;Oe.setProperty("--anchor-width",`${Et}px`),Oe.setProperty("--anchor-height",`${Kt}px`)}}),Dx(()=>({element:X.current||document.createElement("div"),padding:u,offsetParent:"floating"}),[u]),{name:"transformOrigin",fn(ye){const{elements:Ze,middlewareData:ie,placement:ge,rects:Oe,y:we}=ye,Me=xt(ge),Ke=Ft(Me),et=X.current,Tt=ie.arrow?.x||0,Et=ie.arrow?.y||0,Kt=et?.clientWidth||0,dn=et?.clientHeight||0,Ot=Tt+Kt/2,Er=Et+dn/2,Yi=Math.abs(ie.shift?.y||0),I2=Oe.reference.height/2,ns=typeof o=="function"?o(zf(ye,r,C)):o,N2=Yi>ns,_2={top:`${Ot}px calc(100% + ${ns}px)`,bottom:`${Ot}px ${-ns}px`,left:`calc(100% + ${ns}px) ${Er}px`,right:`${-ns}px ${Er}px`}[Me],A2=`${Ot}px ${Oe.reference.y+I2-we}px`;return Ze.floating.style.setProperty("--transform-origin",le&&Ke==="y"&&N2?A2:_2),{}}},Mx,b),ve(()=>{!g&&p&&p.update({referenceElement:null,floatingElement:null,domReferenceElement:null})},[g,p]);const de=f.useMemo(()=>({elementResize:!d&&typeof ResizeObserver<"u",layoutShift:!d&&typeof IntersectionObserver<"u"}),[d]),{refs:fe,elements:oe,x:ue,y:te,middlewareData:z,update:B,placement:J,context:pe,isPositioned:Se,floatingStyles:Ne}=wx({rootContext:p,placement:D,middleware:ne,strategy:n,whileElementsMounted:h?void 0:(...ye)=>If(...ye,de),nodeId:y,externalTree:x}),{sideX:Fe,sideY:Ie}=z.adaptiveOrigin||qs,be=Se?n:"fixed",Re=f.useMemo(()=>{const ye=b?{position:be,[Fe]:ue,[Ie]:te}:{position:be,...Ne};return Se||(ye.opacity=0),ye},[b,be,Fe,ue,Ie,te,Ne,Se]),Ce=f.useRef(null);ve(()=>{if(!g)return;const ye=R.current,Ze=typeof ye=="function"?ye():ye,ge=(Yf(Ze)?Ze.current:Ze)||null||null;ge!==Ce.current&&(fe.setPositionReference(ge),Ce.current=ge)},[g,fe,_,R]),f.useEffect(()=>{if(!g)return;const ye=R.current;typeof ye!="function"&&Yf(ye)&&ye.current!==Ce.current&&(fe.setPositionReference(ye.current),Ce.current=ye.current)},[g,fe,_,R]),f.useEffect(()=>{if(h&&g&&oe.domReference&&oe.floating)return If(oe.domReference,oe.floating,B,de)},[h,g,oe,B,de]);const Be=xt(J),Qe=Gf(r,Be,C),ct=Mn(J)||"center",Ct=!!z.hide?.referenceHidden;ve(()=>{E&&g&&Se&&T(Be)},[E,g,Se,Be]);const Dt=f.useMemo(()=>({position:"absolute",top:z.arrow?.y,left:z.arrow?.x}),[z.arrow]),jt=z.arrow?.centerOffset!==0;return f.useMemo(()=>({positionerStyles:Re,arrowStyles:Dt,arrowRef:X,arrowUncentered:jt,side:Qe,align:ct,physicalSide:Be,anchorHidden:Ct,refs:fe,context:pe,isPositioned:Se,update:B}),[Re,Dt,X,jt,Qe,ct,Be,Ct,fe,pe,Se,B])}function Yf(e){return e!=null&&"current"in e}let ir=(function(e){return e.open="data-open",e.closed="data-closed",e[e.startingStyle=So.startingStyle]="startingStyle",e[e.endingStyle=So.endingStyle]="endingStyle",e.anchorHidden="data-anchor-hidden",e.side="data-side",e.align="data-align",e})({}),pc=(function(e){return e.popupOpen="data-popup-open",e.pressed="data-pressed",e})({});const Fx={[pc.popupOpen]:""},Vx={[pc.popupOpen]:"",[pc.pressed]:""},Bx={[ir.open]:""},Wx={[ir.closed]:""},jx={[ir.anchorHidden]:""},Zf={open(e){return e?Fx:null}},Hx={open(e){return e?Vx:null}},$r={open(e){return e?Bx:Wx},anchorHidden(e){return e?jx:null}};function qf(e){return e==="starting"?B1:tt}function Xf(){const e=f.useContext(ds);if(!e)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: useToastManager must be used within <Toast.Provider>.":it(73));const t=e.useState("toasts");return f.useMemo(()=>({toasts:t,add:e.addToast,close:e.closeToast,update:e.updateToast,promise:e.promiseToast}),[t,e])}function on(...e){return da(Fu(e))}const Kf={Viewport:"_Viewport_ai81v_1",Toast:"_Toast_ai81v_14"};let Fr=null,Ro=3e3;function Ux({timeout:e}){const t=Xf();return f.useEffect(()=>(Fr=t,Ro=e,()=>{Fr=null}),[t,e]),null}const ar={success:(e,t)=>Fr?.add({description:e,timeout:t?.timeout||Ro}),error:(e,t)=>Fr?.add({description:e,timeout:t?.timeout||Ro}),info:(e,t)=>Fr?.add({description:e,timeout:t?.timeout||Ro}),warning:(e,t)=>Fr?.add({description:e,timeout:t?.timeout||Ro})};function Gx({toastConfigs:e}){const t=e?.timeout??3e3;return O.jsxs(Ld,{timeout:t,children:[O.jsx(Ux,{timeout:t}),O.jsx(zx,{configs:e})]})}function zx({configs:e}){const{toasts:t}=Xf();return O.jsx(Nx,{children:O.jsx(Hd,{className:on(Kf.Viewport,e?.viewportClassName),children:t.map(n=>O.jsx(zd,{toast:n,className:on("pointer-events-none flex items-center justify-center px-6 py-3 min-w-[200px] max-w-[80vw]","text-white text-base rounded-md bg-black/80",Kf.Toast,e?.className),style:e?.style,children:O.jsx(qd,{className:"text-xs",children:n.description})},n.id))})})}class Yx{baseUrl;credentials;interceptors;timeout;onError;headers;constructor({baseUrl:t,timeout:n=1/0,responseInterceptor:r=l=>l.data,requestInterceptor:o=l=>l,onError:s=()=>{},headers:i,credentials:a="include"}){this.baseUrl=t,this.timeout=n,this.credentials=a,this.interceptors={request:o,response:r},this.headers=new Headers({"Content-Type":"application/json",...i}),this.onError=s}async request(t){const n=new AbortController;t.url=`${this.baseUrl}${t.url}`,t=this.interceptors.request(t);const r=new Headers(this.headers);Object.entries(t.headers||{}).forEach(([a,l])=>{r.set(a,l)});const o=this.headers.get("content-type");let s=null;if(t.data instanceof FormData)s=t.data,r.delete("Content-Type");else if(t.data!==void 0&&t.method!=="GET")if(o==="application/x-www-form-urlencoded"){const a=new URLSearchParams;for(const l in t.data)t.data[l]!==void 0&&a.append(l,t.data[l]);s=a.toString()}else s=JSON.stringify(t.data);else if(t.method==="GET"){const a=new URLSearchParams;for(const c in t.data)t.data[c]!==void 0&&a.append(c,t.data[c]);const l=a.toString();t.url+=l?`?${l}`:""}const i=fetch(t.url,{method:t.method,headers:r,body:s,signal:t.signal||n.signal,credentials:this.credentials});try{const a=t.timeout||this.timeout,{timeoutId:l,timeoutPromise:c}=this._setTimeout(a,n),u=await Promise.race([i,c].filter(Boolean));if(l&&clearTimeout(l),u.ok){const d=await u.json();return this.interceptors.response(d,u).catch(h=>(this.onError({data:h,response:u}),Promise.reject(d)))}else{const d=await u.json();return this.onError({data:d,response:u}),Promise.reject(d)}}catch(a){return a.name!=="AbortError"&&this.onError({}),Promise.reject(a)}}_setTimeout(t,n){let r=null,o=null;return t!==1/0&&(o=new Promise((s,i)=>{r=setTimeout(()=>{i(new Error("请求超时")),n.abort()},t)})),{timeoutPromise:o,timeoutId:r}}get(t,n,r){return this.request({...r,url:t,method:"GET",data:n})}post(t,n,r){return this.request({...r,url:t,method:"POST",data:n})}put(t,n,r){return this.request({...r,url:t,method:"PUT",data:n})}delete(t,n){return this.request({...n,url:t,method:"DELETE"})}patch(t,n,r){return this.request({...r,url:t,method:"PATCH",data:n})}}const Fn=new Yx({baseUrl:"https://apis.sdk.mobileztgame.com",credentials:"omit",headers:{"Content-Type":"application/x-www-form-urlencoded"},async responseInterceptor(e,t){if(["/passport-api/v2/ztgame/auth/login"].some(r=>t.url.includes(r)))return e;if(e?.code!==0)throw new Error(e.error);return e},onError({response:e,data:t}){if(e&&e?.status!==401){const n=`${t?.message||t?.detail||"未知错误"}`;ar.error(n)}}}),He={ROLE_ID:"roleid",GIANT:"giant",MOBILE:"mobile",WECHAT:"wx",QQ:"qq",APPLE:"apple"},Xs={default:{types:[He.GIANT,He.MOBILE],default:He.GIANT},5273:{types:[He.ROLE_ID],default:He.ROLE_ID},5199:{types:[He.ROLE_ID],default:He.ROLE_ID},5012:{types:[He.ROLE_ID],default:He.ROLE_ID},5242:{types:[He.GIANT,He.MOBILE],default:He.MOBILE}};function wt(...e){return da(Fu(e))}function Zx(e){return e==="5199"||e==="5012"}function Ks(e,t){return t||Xs[e]?.types||Xs.default?.types||[]}function qx(e,t){return t||Xs[e]?.default||Xs.default?.default}function Jf({loginTypes:e,gameId:t}){return Ks(t,e).includes(He.GIANT)}function Qf({loginTypes:e,gameId:t}){return Ks(t,e).includes(He.ROLE_ID)}function ep({loginTypes:e,gameId:t}){return Ks(t,e).includes(He.MOBILE)}async function Xx({gameId:e}){let t=localStorage.getItem("UNIQUE_ID");t||(t=(await(await w0.load()).get()).visitorId,localStorage.setItem("UNIQUE_ID",t)),Fn.headers.set("X-GAME-ID",e),Fn.headers.set("X-Login-H5","1"),Fn.headers.set("X-Client-Info",JSON.stringify({sdk_version:"3.0.0",device_udid:t,appunid:t}))}const Kx=[{code:"86",name:"中国大陆"},{code:"886",name:"台湾地区"},{code:"852",name:"香港特别行政区"},{code:"853",name:"澳门特别行政区"},{code:"1",name:"美国"},{code:"81",name:"日本"},{code:"376",name:"安道尔"},{code:"971",name:"阿拉伯联合酋长国"},{code:"93",name:"阿富汗"},{code:"1268",name:"安提瓜和巴布达"},{code:"1264",name:"安圭拉"},{code:"355",name:"阿尔巴尼亚"},{code:"374",name:"亚美尼亚"},{code:"244",name:"安哥拉"},{code:"54",name:"阿根廷"},{code:"1684",name:"美属萨摩亚"},{code:"43",name:"奥地利"},{code:"61",name:"澳大利亚"},{code:"297",name:"阿鲁巴"},{code:"994",name:"阿塞拜疆"},{code:"387",name:"波斯尼亚和黑塞哥维那"},{code:"1246",name:"巴巴多斯"},{code:"880",name:"孟加拉国"},{code:"32",name:"比利时"},{code:"226",name:"布基纳法索"},{code:"359",name:"保加利亚"},{code:"973",name:"巴林"},{code:"257",name:"布隆迪"},{code:"229",name:"贝宁"},{code:"1441",name:"百慕大群岛"},{code:"673",name:"文莱"},{code:"591",name:"玻利维亚"},{code:"599",name:"荷兰加勒比"},{code:"55",name:"巴西"},{code:"1242",name:"巴哈马"},{code:"975",name:"不丹"},{code:"267",name:"博茨瓦纳"},{code:"375",name:"白俄罗斯"},{code:"501",name:"伯利兹"},{code:"1",name:"加拿大"},{code:"243",name:"刚果民主共和国"},{code:"236",name:"中非共和国"},{code:"242",name:"刚果共和国"},{code:"41",name:"瑞士"},{code:"225",name:"象牙海岸"},{code:"682",name:"库克群岛"},{code:"56",name:"智利"},{code:"237",name:"喀麦隆"},{code:"57",name:"哥伦比亚"},{code:"506",name:"哥斯达黎加"},{code:"53",name:"古巴"},{code:"238",name:"开普"},{code:"599",name:"库拉索"},{code:"357",name:"塞浦路斯"},{code:"420",name:"捷克"},{code:"49",name:"德国"},{code:"253",name:"吉布提"},{code:"45",name:"丹麦"},{code:"1767",name:"多米尼加"},{code:"1809",name:"多米尼加共和国"},{code:"213",name:"阿尔及利亚"},{code:"593",name:"厄瓜多尔"},{code:"372",name:"爱沙尼亚"},{code:"20",name:"埃及"},{code:"291",name:"厄立特里亚"},{code:"34",name:"西班牙"},{code:"251",name:"埃塞俄比亚"},{code:"358",name:"芬兰"},{code:"679",name:"斐济"},{code:"691",name:"密克罗尼西亚"},{code:"298",name:"法罗群岛"},{code:"33",name:"法国"},{code:"241",name:"加蓬"},{code:"44",name:"英国"},{code:"1473",name:"格林纳达"},{code:"995",name:"格鲁吉亚"},{code:"594",name:"法属圭亚那"},{code:"233",name:"加纳"},{code:"350",name:"直布罗陀"},{code:"299",name:"格陵兰岛"},{code:"220",name:"冈比亚"},{code:"224",name:"几内亚"},{code:"590",name:"瓜德罗普岛"},{code:"240",name:"赤道几内亚"},{code:"30",name:"希腊"},{code:"502",name:"瓜地马拉"},{code:"1671",name:"关岛"},{code:"245",name:"几内亚比绍共和国"},{code:"592",name:"圭亚那"},{code:"504",name:"洪都拉斯"},{code:"385",name:"克罗地亚"},{code:"509",name:"海地"},{code:"36",name:"匈牙利"},{code:"62",name:"印度尼西亚"},{code:"353",name:"爱尔兰"},{code:"972",name:"以色列"},{code:"91",name:"印度"},{code:"964",name:"伊拉克"},{code:"98",name:"伊朗"},{code:"354",name:"冰岛"},{code:"39",name:"意大利"},{code:"1876",name:"牙买加"},{code:"962",name:"约旦"},{code:"254",name:"肯尼亚"},{code:"996",name:"吉尔吉斯斯坦"},{code:"855",name:"柬埔寨"},{code:"686",name:"基里巴斯"},{code:"269",name:"科摩罗"},{code:"1869",name:"圣基茨和尼维斯"},{code:"850",name:"朝鲜"},{code:"82",name:"韩国"},{code:"965",name:"科威特"},{code:"1345",name:"开曼群岛"},{code:"7",name:"哈萨克斯坦"},{code:"856",name:"老挝"},{code:"961",name:"黎巴嫩"},{code:"1758",name:"圣露西亚"},{code:"423",name:"列支敦士登"},{code:"94",name:"斯里兰卡"},{code:"231",name:"利比里亚"},{code:"266",name:"莱索托"},{code:"370",name:"立陶宛"},{code:"352",name:"卢森堡"},{code:"371",name:"拉脱维亚"},{code:"218",name:"利比亚"},{code:"212",name:"摩洛哥"},{code:"377",name:"摩纳哥"},{code:"373",name:"摩尔多瓦"},{code:"382",name:"黑山"},{code:"261",name:"马达加斯加"},{code:"692",name:"马绍尔群岛"},{code:"389",name:"马其顿"},{code:"223",name:"马里"},{code:"95",name:"缅甸"},{code:"976",name:"蒙古"},{code:"222",name:"毛里塔尼亚"},{code:"1664",name:"蒙特塞拉特岛"},{code:"356",name:"马耳他"},{code:"230",name:"毛里求斯"},{code:"960",name:"马尔代夫"},{code:"265",name:"马拉维"},{code:"52",name:"墨西哥"},{code:"60",name:"马来西亚"},{code:"258",name:"莫桑比克"},{code:"264",name:"纳米比亚"},{code:"687",name:"新喀里多尼亚"},{code:"227",name:"尼日尔"},{code:"234",name:"尼日利亚"},{code:"505",name:"尼加拉瓜"},{code:"31",name:"荷兰"},{code:"47",name:"挪威"},{code:"977",name:"尼泊尔"},{code:"674",name:"拿鲁岛"},{code:"64",name:"新西兰"},{code:"968",name:"阿曼"},{code:"507",name:"巴拿马"},{code:"51",name:"秘鲁"},{code:"689",name:"法属波利尼西亚"},{code:"675",name:"巴布亚新几内亚"},{code:"63",name:"菲律宾"},{code:"92",name:"巴基斯坦"},{code:"48",name:"波兰"},{code:"508",name:"圣彼埃尔和密克隆岛"},{code:"1787",name:"波多黎各"},{code:"351",name:"葡萄牙"},{code:"680",name:"帕劳"},{code:"595",name:"巴拉圭"},{code:"974",name:"卡塔尔"},{code:"262",name:"留尼汪"},{code:"40",name:"罗马尼亚"},{code:"381",name:"塞尔维亚"},{code:"7",name:"俄罗斯"},{code:"250",name:"卢旺达"},{code:"966",name:"沙特阿拉伯"},{code:"677",name:"所罗门群岛"},{code:"248",name:"塞舌尔"},{code:"249",name:"苏丹"},{code:"46",name:"瑞典"},{code:"65",name:"新加坡"},{code:"386",name:"斯洛文尼亚"},{code:"421",name:"斯洛伐克"},{code:"232",name:"塞拉利昂"},{code:"378",name:"圣马力诺"},{code:"221",name:"塞内加尔"},{code:"252",name:"索马里"},{code:"597",name:"苏里南"},{code:"239",name:"圣多美和普林西比"},{code:"503",name:"萨尔瓦多"},{code:"963",name:"叙利亚"},{code:"268",name:"斯威士兰"},{code:"1649",name:"特克斯和凯科斯群岛"},{code:"235",name:"乍得"},{code:"228",name:"多哥"},{code:"66",name:"泰国"},{code:"992",name:"塔吉克斯坦"},{code:"670",name:"东帝汶"},{code:"993",name:"土库曼斯坦"},{code:"216",name:"突尼斯"},{code:"676",name:"汤加"},{code:"90",name:"土耳其"},{code:"1868",name:"特立尼达和多巴哥"},{code:"255",name:"坦桑尼亚"},{code:"380",name:"乌克兰"},{code:"256",name:"乌干达"},{code:"598",name:"乌拉圭"},{code:"998",name:"乌兹别克斯坦"},{code:"1784",name:"圣文森特和格林纳丁斯"},{code:"58",name:"委内瑞拉"},{code:"1284",name:"英属处女群岛"},{code:"84",name:"越南"},{code:"678",name:"瓦努阿图"},{code:"685",name:"萨摩亚"},{code:"967",name:"也门"},{code:"269",name:"马约特"},{code:"27",name:"南非"},{code:"260",name:"赞比亚"},{code:"263",name:"津巴布韦"}].map(e=>({label:e.name,value:e.code})),tp=W.createContext(void 0),Jx={enabled:!0,days:7},np={"--primary-color":"#787bf4","--icon-color":"#a9aad1","--input-border-color":"#cad0e0","--input-label-color":"var(--jssdk-primary-color)","--input-bg-color":"#fff"};function Po(){const e=W.use(tp);if(!e)throw new Error("useConfig 必须在 ConfigProvider 中使用");return e}function rp({children:e,value:t}){const n=Ks(t.gameId,t.loginTypes),r=qx(t.gameId,t.defaultLoginType),o=W.useRef(null),[s,i]=W.useState(r),[a,l]=W.useState(!0);W.useEffect(()=>{Xx({gameId:t.gameId})},[t.gameId]);const c={...t,loginTypes:n,defaultLoginType:r,autoLoginConfig:{...Jx,...t.autoLoginConfig}};W.useEffect(()=>{t.gameId&&document.body.classList.add(`game-${t.gameId}`)},[t.gameId]);function u(d){Object.entries(d).forEach(([h,p])=>{const g=`--jssdk-${h.replace(/^--/,"")}`;document.documentElement.style.setProperty(g,p)})}return W.useEffect(()=>{const d=o.current;if(d){const h={...np,...t.styleVars};u(h)}return()=>{d&&u(np)}},[t.styleVars]),O.jsx("div",{ref:o,children:O.jsx(tp,{value:{...c,currentLoginType:s,setCurrentLoginType:i,isShowGiantLogo:a,setIsShowGiantLogo:l},children:e})})}function op({controlled:e,default:t,name:n,state:r="value"}){const{current:o}=f.useRef(e!==void 0),[s,i]=f.useState(t),a=o?e:s;if(process.env.NODE_ENV!=="production"){f.useEffect(()=>{o!==(e!==void 0)&&console.error([`Base UI: A component is changing the ${o?"":"un"}controlled ${r} state of ${n} to be ${o?"un":""}controlled.`,"Elements should not switch from uncontrolled to controlled (or vice versa).",`Decide between using a controlled or uncontrolled ${n} element for the lifetime of the component.`,"The nature of the state is determined during the first render. It's considered controlled if the value is not `undefined`.","More info: https://fb.me/react-controlled-components"].join(`
|
|
16
|
+
`));return f.cloneElement(s,o)}if(e&&typeof e=="string")return K1(e,n);throw new Error(process.env.NODE_ENV!=="production"?"Base UI: Render element or function are not defined.":it(8))}function X1(e){const t=e.name;if(t.length===0)return;const n=t.charCodeAt(0);n<65||n>90||I1(`The \`render\` prop received a function named \`${t}\` that starts with an uppercase letter.`,"This usually means a React component was passed directly as `render={Component}`.","Base UI calls `render` as a plain function, which can break the Rules of Hooks during reconciliation.","If this is an intentional render callback, rename it to start with a lowercase letter.","Use `render={<Component />}` or `render={(props) => <Component {...props} />}` instead.","https://base-ui.com/r/invalid-render-prop")}function K1(e,t){return e==="button"?W.createElement("button",{type:"button",...t,key:t.key}):e==="img"?W.createElement("img",{alt:"",...t,key:t.key}):f.createElement(e,t)}let J1=(function(e){return e.frontmostHeight="--toast-frontmost-height",e})({});const Hd=f.forwardRef(function(t,n){const{render:r,className:o,children:s,...i}=t,a=Yu(),l=_n(),c=f.useRef(!1),u=f.useRef(!1),d=a.useState("isEmpty"),h=a.useState("toasts"),p=a.useState("focused"),g=a.useState("expanded"),m=a.useState("prevFocusElement"),v=h[0]?.height??0,y=f.useMemo(()=>h.some(_=>_.transitionStatus==="ending"),[h]);f.useEffect(()=>{const _=a.state.viewport;if(!_)return;function R(C){d||C.key==="F6"&&C.target!==_&&(C.preventDefault(),a.setPrevFocusElement($t(Ae(_))),_?.focus({preventScroll:!0}),a.pauseTimers(),a.setFocused(!0))}const P=nt(_);return P.addEventListener("keydown",R),()=>{P.removeEventListener("keydown",R)}},[a,d]),f.useEffect(()=>{const _=a.state.viewport;if(!_||d)return;const R=nt(_);function P(N){N.target===R&&(a.setIsWindowFocused(!1),a.pauseTimers())}function C(N){if(N.relatedTarget||N.target===R)return;const D=gt(N),k=$t(Ae(_));(!ke(_,D)||!Pa(k))&&a.resumeTimers(),l.start(0,()=>a.setIsWindowFocused(!0))}return R.addEventListener("blur",P,!0),R.addEventListener("focus",C,!0),()=>{R.removeEventListener("blur",P,!0),R.removeEventListener("focus",C,!0)}},[a,l,d]),f.useEffect(()=>{const _=a.state.viewport;if(!_||d)return;const R=Ae(_);return R.addEventListener("pointerdown",a.handleDocumentPointerDown,!0),()=>{R.removeEventListener("pointerdown",a.handleDocumentPointerDown,!0)}},[d,a]);function b(_){const R=a.state.viewport;R&&(c.current=!0,_.relatedTarget===R?h[0]?.ref?.current?.focus():a.restoreFocusToPrevElement())}function E(_){_.key==="Tab"&&_.shiftKey&&_.target===a.state.viewport&&(_.preventDefault(),a.restoreFocusToPrevElement(),a.resumeTimers())}f.useEffect(()=>{!a.state.isWindowFocused||y||!u.current||(a.resumeTimers(),a.setHovering(!1),u.current=!1)},[y,a]);function x(){a.pauseTimers(),a.setHovering(!0),u.current=!1}function w(){y?u.current=!0:(a.resumeTimers(),a.setHovering(!1))}function T(){if(c.current){c.current=!1;return}p||Pa(Ae(a.state.viewport).activeElement)&&(a.setFocused(!0),a.pauseTimers())}function S(_){!p||ke(a.state.viewport,_.relatedTarget)||(a.setFocused(!1),a.resumeTimers())}const I={tabIndex:-1,role:"region","aria-live":"polite","aria-atomic":!1,"aria-relevant":"additions text","aria-label":"Notifications",onMouseEnter:x,onMouseMove:x,onMouseLeave:w,onFocus:T,onBlur:S,onKeyDown:E,onClick:T},A={expanded:g},L=ze("div",t,{ref:[n,a.setViewport],state:A,props:[I,{style:{[J1.frontmostHeight]:v?`${v}px`:void 0}},i,{children:O.jsxs(f.Fragment,{children:[!d&&m&&O.jsx(nn,{onFocus:b}),s,!d&&m&&O.jsx(nn,{onFocus:b})]})}]}),M=f.useMemo(()=>h.filter(_=>_.priority==="high"),[h]);return O.jsxs(f.Fragment,{children:[!d&&m&&O.jsx(nn,{onFocus:b}),L,!p&&M.length>0&&O.jsx("div",{style:Va,children:M.map(_=>O.jsxs("div",{role:"alert","aria-atomic":!0,children:[O.jsx("div",{children:_.title}),O.jsx("div",{children:_.description})]},_.id))})]})});process.env.NODE_ENV!=="production"&&(Hd.displayName="ToastViewport");function Ga(e){return va(19)?e:e?"true":void 0}const za=f.createContext(void 0);process.env.NODE_ENV!=="production"&&(za.displayName="ToastRootContext");function Q1(){const e=f.useContext(za);if(!e)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: ToastRootContext is missing. Toast parts must be used within <Toast.Root>.":it(66));return e}let So=(function(e){return e.startingStyle="data-starting-style",e.endingStyle="data-ending-style",e})({});const eE={[So.startingStyle]:""},tE={[So.endingStyle]:""},tr={transitionStatus(e){return e==="starting"?eE:e==="ending"?tE:null}};function bn(e){return e==null?e:"current"in e?e.current:e}function Ud(e,t=!1,n=!0){const r=ba();return me((o,s=null)=>{r.cancel();function i(){lt.flushSync(o)}const a=bn(e);if(a==null)return;const l=a;if(typeof l.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED)o();else{let c=function(){const d=So.startingStyle;if(!l.hasAttribute(d)){r.request(u);return}const h=new MutationObserver(()=>{l.hasAttribute(d)||(h.disconnect(),u())});h.observe(l,{attributes:!0,attributeFilter:[d]}),s?.addEventListener("abort",()=>h.disconnect(),{once:!0})},u=function(){Promise.all(l.getAnimations().map(d=>d.finished)).then(()=>{s?.aborted||i()}).catch(()=>{const d=l.getAnimations();if(n){if(s?.aborted)return;i()}else d.length>0&&d.some(h=>h.pending||h.playState!=="finished")&&u()})};if(t){c();return}r.request(u)}})}function Ar(e){const{enabled:t=!0,open:n,ref:r,onComplete:o}=e,s=me(o),i=Ud(r,n,!1);f.useEffect(()=>{if(!t)return;const a=new AbortController;return i(s,a.signal),()=>{a.abort()}},[t,n,s,i])}let nr=(function(e){return e.index="--toast-index",e.offsetY="--toast-offset-y",e.height="--toast-height",e.swipeMovementX="--toast-swipe-movement-x",e.swipeMovementY="--toast-swipe-movement-y",e})({});const nE={...tr,swipeDirection(e){return e?{"data-swipe-direction":e}:null}},Co=40,rE=10,Ln=.5,oE=1,sE=`${H1},${U1}`;function Gd(e,t,n){switch(e){case"up":return-n;case"down":return n;case"left":return-t;case"right":return t;default:return 0}}function iE(e){const n=window.getComputedStyle(e).transform;let r=0,o=0,s=1;if(n&&n!=="none"){const i=n.match(/matrix(?:3d)?\(([^)]+)\)/);if(i){const a=i[1].split(", ").map(parseFloat);a.length===6?(r=a[4],o=a[5],s=Math.sqrt(a[0]*a[0]+a[1]*a[1])):a.length===16&&(r=a[12],o=a[13],s=a[0])}}return{x:r,y:o,scale:s}}const zd=f.forwardRef(function(t,n){const{toast:r,render:o,className:s,swipeDirection:i=["down","right"],...a}=t,l=r.positionerProps?.anchor!==void 0;let c=[];l||(c=Array.isArray(i)?i:[i]);const u=c.length>0,d=Yu(),[h,p]=f.useState(void 0),[g,m]=f.useState(!1),[v,y]=f.useState(!1),[b,E]=f.useState(!1),[x,w]=f.useState({x:0,y:0}),[T,S]=f.useState({x:0,y:0,scale:1}),[I,A]=f.useState(),[L,M]=f.useState(),[_,R]=f.useState(null),P=f.useRef(null),C=f.useRef({x:0,y:0}),N=f.useRef({x:0,y:0,scale:1}),D=f.useRef(void 0),k=f.useRef(0),$=f.useRef(!1),F=f.useRef({x:0,y:0}),j=f.useRef(!1),V=d.useState("toastIndex",r.id),Y=d.useState("toastVisibleIndex",r.id),q=d.useState("toastOffsetY",r.id),X=d.useState("focused"),U=d.useState("expanded");Ar({open:r.transitionStatus!=="ending",ref:P,onComplete(){r.transitionStatus==="ending"&&d.removeToast(r.id)}});const H=me((te=!1)=>{const z=P.current;if(!z)return;const B=z.style.height;z.style.height="auto";const J=z.offsetHeight;z.style.height=B;function pe(){d.updateToastInternal(r.id,{ref:P,height:J,...r.transitionStatus==="starting"?{transitionStatus:void 0}:{}})}te?lt.flushSync(pe):pe()});ve(H,[H]);function Z(te,z){let B=te,J=z;return!c.includes("left")&&!c.includes("right")?B=te>0?te**Ln:-(Math.abs(te)**Ln):(!c.includes("right")&&te>0&&(B=te**Ln),!c.includes("left")&&te<0&&(B=-(Math.abs(te)**Ln))),!c.includes("up")&&!c.includes("down")?J=z>0?z**Ln:-(Math.abs(z)**Ln):(!c.includes("down")&&z>0&&(J=z**Ln),!c.includes("up")&&z<0&&(J=-(Math.abs(z)**Ln))),{x:B,y:J}}function re(te){if(te.button!==0)return;te.pointerType==="touch"&&d.pauseTimers();const z=gt(te.nativeEvent);if(!(z&&z.closest(`button,a,input,textarea,[role="button"],${sE}`))){if($.current=!1,D.current=void 0,k.current=0,C.current={x:te.clientX,y:te.clientY},F.current=C.current,P.current){const J=iE(P.current);N.current=J,S(J),w({x:J.x,y:J.y})}d.setHovering(!0),m(!0),y(!1),R(null),j.current=!0,P.current?.setPointerCapture(te.pointerId)}}function ne(te){if(!g)return;te.preventDefault(),j.current&&(C.current={x:te.clientX,y:te.clientY},j.current=!1);const{clientY:z,clientX:B,movementX:J,movementY:pe}=te;(pe<0&&z>F.current.y||pe>0&&z<F.current.y)&&(F.current={x:F.current.x,y:z}),(J<0&&B>F.current.x||J>0&&B<F.current.x)&&(F.current={x:B,y:F.current.y});const Se=B-C.current.x,Ne=z-C.current.y,Fe=z-F.current.y,Ie=B-F.current.x;if(!v&&Math.sqrt(Se*Se+Ne*Ne)>=oE&&(y(!0),_===null)){const ct=c.includes("left")||c.includes("right"),Ct=c.includes("up")||c.includes("down");if(ct&&Ct){const Dt=Math.abs(Se),jt=Math.abs(Ne);R(Dt>jt?"horizontal":"vertical")}}let be;if(!D.current)_==="vertical"?Ne>0?be="down":Ne<0&&(be="up"):_==="horizontal"?Se>0?be="right":Se<0&&(be="left"):Math.abs(Se)>=Math.abs(Ne)?be=Se>0?"right":"left":be=Ne>0?"down":"up",be&&c.includes(be)&&(D.current=be,k.current=Gd(be,Se,Ne),p(be));else{const Qe=D.current,ct=Gd(Qe,Ie,Fe);ct>Co?($.current=!1,p(Qe)):!(c.includes("left")&&c.includes("right"))&&!(c.includes("up")&&c.includes("down"))&&k.current-ct>=rE&&($.current=!0)}const Re=Z(Se,Ne);let Ce=N.current.x,Be=N.current.y;_==="horizontal"?(c.includes("left")||c.includes("right"))&&(Ce+=Re.x):(_==="vertical"||(c.includes("left")||c.includes("right"))&&(Ce+=Re.x),(c.includes("up")||c.includes("down"))&&(Be+=Re.y)),w({x:Ce,y:Be})}function ee(te){if(!g)return;if(m(!1),y(!1),R(null),P.current?.releasePointerCapture(te.pointerId),$.current){w({x:T.x,y:T.y}),p(void 0);return}let z=!1;const B=x.x-T.x,J=x.y-T.y;let pe;for(const Se of c){switch(Se){case"right":B>Co&&(z=!0,pe="right");break;case"left":B<-Co&&(z=!0,pe="left");break;case"down":J>Co&&(z=!0,pe="down");break;case"up":J<-Co&&(z=!0,pe="up");break}if(z)break}z?(p(pe),E(!0),d.closeToast(r.id)):(w({x:T.x,y:T.y}),p(void 0))}function le(te){if(te.key==="Escape"){if(!P.current||!ke(P.current,$t(Ae(P.current))))return;d.closeToast(r.id)}}f.useEffect(()=>{if(!u)return;const te=P.current;if(!te)return;function z(B){ke(te,B.target)&&B.preventDefault()}return te.addEventListener("touchmove",z,{passive:!1}),()=>{te.removeEventListener("touchmove",z)}},[u]);function K(){if(!g&&x.x===T.x&&x.y===T.y&&!b)return{[nr.swipeMovementX]:"0px",[nr.swipeMovementY]:"0px"};const te=x.x-T.x,z=x.y-T.y;return{transition:g?"none":void 0,transform:g?`translateX(${x.x}px) translateY(${x.y}px) scale(${T.scale})`:void 0,[nr.swipeMovementX]:`${te}px`,[nr.swipeMovementY]:`${z}px`}}const G=r.priority==="high",de={role:G?"alertdialog":"dialog",tabIndex:0,"aria-modal":!1,"aria-labelledby":I,"aria-describedby":L,"aria-hidden":G&&!X?!0:void 0,onPointerDown:u?re:void 0,onPointerMove:u?ne:void 0,onPointerUp:u?ee:void 0,onKeyDown:le,inert:Ga(r.limited),style:{...K(),[nr.index]:r.transitionStatus==="ending"?V:Y,[nr.offsetY]:`${q}px`,[nr.height]:r.height?`${r.height}px`:void 0}},fe=f.useMemo(()=>({rootRef:P,toast:r,titleId:I,setTitleId:A,descriptionId:L,setDescriptionId:M,swiping:g,swipeDirection:h,recalculateHeight:H,index:V,visibleIndex:Y,expanded:U}),[r,I,L,g,h,H,V,Y,U]),oe={transitionStatus:r.transitionStatus,expanded:U,limited:r.limited||!1,type:r.type,swiping:fe.swiping,swipeDirection:fe.swipeDirection},ue=ze("div",t,{ref:[n,fe.rootRef],state:oe,stateAttributesMapping:nE,props:[de,a]});return O.jsx(za.Provider,{value:fe,children:ue})});process.env.NODE_ENV!=="production"&&(zd.displayName="ToastRoot");const To={...f};let Yd=0;function aE(e,t="mui"){const[n,r]=f.useState(e),o=e||n;return f.useEffect(()=>{n==null&&(Yd+=1,r(`${t}-${Yd}`))},[n,t]),o}const Zd=To.useId;function rr(e,t){if(Zd!==void 0){const n=Zd();return e??(t?`${t}-${n}`:n)}return aE(e,t)}const qd=f.forwardRef(function(t,n){const{render:r,className:o,id:s,children:i,...a}=t,{toast:l,setDescriptionId:c}=Q1(),u=i??l.description,d=!!u,h=rr(s);ve(()=>{if(d)return c(h),()=>{c(void 0)}},[d,h,c]);const p={type:l.type},g=ze("p",t,{ref:n,state:p,props:{...a,id:h,children:u}});return d?g:null});process.env.NODE_ENV!=="production"&&(qd.displayName="ToastDescription");let Ya;process.env.NODE_ENV!=="production"&&(Ya=new Set);function Ds(...e){if(process.env.NODE_ENV!=="production"){const t=e.join(" ");Ya.has(t)||(Ya.add(t),console.error(`Base UI: ${t}`))}}const Xd=f.createContext(void 0);process.env.NODE_ENV!=="production"&&(Xd.displayName="CompositeRootContext");function cE(e=!1){const t=f.useContext(Xd);if(t===void 0&&!e)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: CompositeRootContext is missing. Composite parts must be placed within <Composite.Root>.":it(16));return t}function lE(e){const{focusableWhenDisabled:t,disabled:n,composite:r=!1,tabIndex:o=0,isNativeButton:s}=e,i=r&&t!==!1,a=r&&t===!1;return{props:f.useMemo(()=>{const c={onKeyDown(u){n&&t&&u.key!=="Tab"&&u.preventDefault()}};return r||(c.tabIndex=o,!s&&n&&(c.tabIndex=t?o:-1)),(s&&(t||i)||!s&&n)&&(c["aria-disabled"]=n),s&&(!t||a)&&(c.disabled=n),c},[r,n,t,i,a,s,o])}}function Ms(e={}){const{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:o=!0,composite:s}=e,i=f.useRef(null),a=cE(!0),l=s??a!==void 0,{props:c}=lE({focusableWhenDisabled:n,disabled:t,composite:l,tabIndex:r,isNativeButton:o});process.env.NODE_ENV!=="production"&&f.useEffect(()=>{if(!i.current)return;const p=Ls(i.current);if(o){if(!p){const g=To.captureOwnerStack?.()||"";Ds(`A component that acts as a button expected a native <button> because the \`nativeButton\` prop is true. Rendering a non-<button> removes native button semantics, which can impact forms and accessibility. Use a real <button> in the \`render\` prop, or set \`nativeButton\` to \`false\`.${g}`)}}else if(p){const g=To.captureOwnerStack?.()||"";Ds(`A component that acts as a button expected a non-<button> because the \`nativeButton\` prop is false. Rendering a <button> keeps native behavior while Base UI applies non-native attributes and handlers, which can add unintended extra attributes (such as \`role\` or \`aria-disabled\`). Use a non-<button> in the \`render\` prop, or set \`nativeButton\` to \`true\`.${g}`)}},[o]);const u=f.useCallback(()=>{const p=i.current;Ls(p)&&l&&t&&c.disabled===void 0&&p.disabled&&(p.disabled=!1)},[t,c.disabled,l]);ve(u,[u]);const d=f.useCallback((p={})=>{const{onClick:g,onMouseDown:m,onKeyUp:v,onKeyDown:y,onPointerDown:b,...E}=p;return _r({type:o?"button":void 0,onClick(w){if(t){w.preventDefault();return}g?.(w)},onMouseDown(w){t||m?.(w)},onKeyDown(w){if(t||(Ha(w),y?.(w),w.baseUIHandlerPrevented))return;const T=w.target===w.currentTarget,S=w.currentTarget,I=Ls(S),A=!o&&uE(S),L=T&&(o?I:!A),M=w.key==="Enter",_=w.key===" ",R=S.getAttribute("role"),P=R?.startsWith("menuitem")||R==="option"||R==="gridcell";if(T&&l&&_){if(w.defaultPrevented&&P)return;w.preventDefault(),A||o&&I?(S.click(),w.preventBaseUIHandler()):L&&(g?.(w),w.preventBaseUIHandler());return}L&&(!o&&(_||M)&&w.preventDefault(),!o&&M&&g?.(w))},onKeyUp(w){if(!t){if(Ha(w),v?.(w),w.target===w.currentTarget&&o&&l&&Ls(w.currentTarget)&&w.key===" "){w.preventDefault();return}w.baseUIHandlerPrevented||w.target===w.currentTarget&&!o&&!l&&w.key===" "&&g?.(w)}},onPointerDown(w){if(t){w.preventDefault();return}b?.(w)}},o?void 0:{role:"button"},c,E)},[t,c,l,o]),h=me(p=>{i.current=p,u()});return{getButtonProps:d,buttonRef:h}}function Ls(e){return rt(e)&&e.tagName==="BUTTON"}function uE(e){return!!(e?.tagName==="A"&&e?.href)}function dE(e,t){return t!=null&&!bo(t)?0:typeof e=="function"?e():e}function $s(e,t,n){const r=dE(e,n);return typeof r=="number"?r:r?.[t]}function Kd(e){return typeof e=="function"?e():e}function Jd(e,t){return t||e==="click"||e==="mousedown"}const Za="none",Dr="trigger-press",St="trigger-hover",Qd="outside-press",fE="close-press",Oo="focus-out",ef="escape-key",tf="imperative-action";function Ye(e,t,n,r){let o=!1,s=!1;const i=tt;return{reason:e,event:t??new Event("base-ui"),cancel(){o=!0},allowPropagation(){s=!0},get isCanceled(){return o},get isPropagationAllowed(){return s},trigger:n,...i}}function pE(e,t,n){const r=tt;return{reason:e,event:t??new Event("base-ui"),...r}}function rn(e){const t=ht(hE,e).current;return t.next=e,ve(t.effect),t}function hE(e){const t={current:e,next:e,effect:()=>{t.current=t.next}};return t}function Fs(e){return`data-base-ui-${e}`}let nf=0;function qa(e,t={}){const{preventScroll:n=!1,cancelPrevious:r=!0,sync:o=!1}=t;r&&cancelAnimationFrame(nf);const s=()=>e?.focus({preventScroll:n});o?s():nf=requestAnimationFrame(s)}const Xa={inert:new WeakMap,"aria-hidden":new WeakMap},rf="data-base-ui-inert",Ka={inert:new WeakSet,"aria-hidden":new WeakSet};let ko=new WeakMap,Ja=0;function mE(e){return Ka[e]}function of(e){return e?vo(e)?e.host:of(e.parentNode):null}const Qa=(e,t)=>t.map(n=>{if(e.contains(n))return n;const r=of(n);return e.contains(r)?r:null}).filter(n=>n!=null),sf=e=>{const t=new Set;return e.forEach(n=>{let r=n;for(;r&&!t.has(r);)t.add(r),r=r.parentNode}),t},af=(e,t,n)=>{const r=[],o=s=>{!s||n.has(s)||Array.from(s.children).forEach(i=>{An(i)!=="script"&&(t.has(i)?o(i):r.push(i))})};return o(e),r};function gE(e,t,n,r,{mark:o=!0,markerIgnoreElements:s=[]}){const i=r?"inert":n?"aria-hidden":null;let a=null,l=null;const c=Qa(t,e),u=o?Qa(t,s):[],d=new Set(u),h=o?af(t,sf(c),new Set(c)).filter(m=>!d.has(m)):[],p=[],g=[];if(i){const m=Xa[i],v=mE(i);l=v,a=m;const y=Qa(t,Array.from(t.querySelectorAll("[aria-live]"))),b=c.concat(y);af(t,sf(b),new Set(b)).forEach(x=>{const w=x.getAttribute(i),T=w!==null&&w!=="false",S=(m.get(x)||0)+1;m.set(x,S),p.push(x),S===1&&T&&v.add(x),T||x.setAttribute(i,i==="inert"?"":"true")})}return o&&h.forEach(m=>{const v=(ko.get(m)||0)+1;ko.set(m,v),g.push(m),v===1&&m.setAttribute(rf,"")}),Ja+=1,()=>{a&&p.forEach(m=>{const y=(a.get(m)||0)-1;a.set(m,y),y||(!l?.has(m)&&i&&m.removeAttribute(i),l?.delete(m))}),o&&g.forEach(m=>{const v=(ko.get(m)||0)-1;ko.set(m,v),v||m.removeAttribute(rf)}),Ja-=1,Ja||(Xa.inert=new WeakMap,Xa["aria-hidden"]=new WeakMap,Ka.inert=new WeakSet,Ka["aria-hidden"]=new WeakSet,ko=new WeakMap)}}function cf(e,t={}){const{ariaHidden:n=!1,inert:r=!1,mark:o=!0,markerIgnoreElements:s=[]}=t,i=Ae(e[0]).body;return gE(e,i,n,r,{mark:o,markerIgnoreElements:s})}const ec=f.createContext(null);process.env.NODE_ENV!=="production"&&(ec.displayName="PortalContext");const lf=()=>f.useContext(ec),vE=Fs("portal");function uf(e={}){const{ref:t,container:n,componentProps:r=tt,elementProps:o}=e,s=rr(),a=lf()?.portalNode,[l,c]=f.useState(null),[u,d]=f.useState(null),h=me(v=>{v!==null&&d(v)}),p=f.useRef(null);ve(()=>{if(n===null){p.current&&(p.current=null,d(null),c(null));return}if(s==null)return;const v=(n&&(wa(n)?n:n.current))??a??document.body;if(v==null){p.current&&(p.current=null,d(null),c(null));return}p.current!==v&&(p.current=v,d(null),c(v))},[n,a,s]);const g=ze("div",r,{ref:[t,h],props:[{id:s,[vE]:""},o]});return{portalNode:u,portalSubtree:l&&g?lt.createPortal(g,l):null}}const tc=f.forwardRef(function(t,n){const{children:r,container:o,className:s,render:i,renderGuards:a,...l}=t,{portalNode:c,portalSubtree:u}=uf({container:o,ref:n,componentProps:t,elementProps:l}),d=f.useRef(null),h=f.useRef(null),p=f.useRef(null),g=f.useRef(null),[m,v]=f.useState(null),y=m?.modal,b=m?.open,E=typeof a=="boolean"?a:!!m&&!m.modal&&m.open&&!!c;f.useEffect(()=>{if(!c||y)return;function w(T){c&&T.relatedTarget&&Nr(T)&&(T.type==="focusin"?Md:C1)(c)}return c.addEventListener("focusin",w,!0),c.addEventListener("focusout",w,!0),()=>{c.removeEventListener("focusin",w,!0),c.removeEventListener("focusout",w,!0)}},[c,y]),f.useEffect(()=>{!c||b||Md(c)},[b,c]);const x=f.useMemo(()=>({beforeOutsideRef:d,afterOutsideRef:h,beforeInsideRef:p,afterInsideRef:g,portalNode:c,setFocusManagerState:v}),[c]);return O.jsxs(f.Fragment,{children:[u,O.jsxs(ec.Provider,{value:x,children:[E&&c&&O.jsx(nn,{"data-type":"outside",ref:d,onFocus:w=>{if(Nr(w,c))p.current?.focus();else{const T=m?m.domReference:null;Ad(T)?.focus()}}}),E&&c&&O.jsx("span",{"aria-owns":c.id,style:z1}),c&<.createPortal(r,c),E&&c&&O.jsx(nn,{"data-type":"outside",ref:h,onFocus:w=>{if(Nr(w,c))g.current?.focus();else{const T=m?m.domReference:null;Fa(T)?.focus(),m?.closeOnFocusOut&&m?.onOpenChange(!1,Ye(Oo,w.nativeEvent))}}})]})]})});process.env.NODE_ENV!=="production"&&(tc.displayName="FloatingPortal");function df(){const e=new Map;return{emit(t,n){e.get(t)?.forEach(r=>r(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){e.get(t)?.delete(n)}}}class yE{nodesRef={current:[]};events=df();addNode(t){this.nodesRef.current.push(t)}removeNode(t){const n=this.nodesRef.current.findIndex(r=>r===t);n!==-1&&this.nodesRef.current.splice(n,1)}}const nc=f.createContext(null);process.env.NODE_ENV!=="production"&&(nc.displayName="FloatingNodeContext");const rc=f.createContext(null);process.env.NODE_ENV!=="production"&&(rc.displayName="FloatingTreeContext");const or=()=>f.useContext(nc)?.id||null,Mr=e=>{const t=f.useContext(rc);return e??t};function bE(e){const t=rr(),n=Mr(e),r=or();return ve(()=>{if(!t)return;const o={id:t,parentId:r};return n?.addNode(o),()=>{n?.removeNode(o)}},[n,t,r]),t}function wE(e){const{children:t,id:n}=e,r=or();return O.jsx(nc.Provider,{value:f.useMemo(()=>({id:n,parentId:r}),[n,r]),children:t})}function EE(e){const{children:t,externalTree:n}=e,r=ht(()=>n??new yE).current;return O.jsx(rc.Provider,{value:r,children:t})}function xE(e,t){const n=nt(e.target);return e instanceof n.KeyboardEvent?"keyboard":e instanceof n.FocusEvent?t||"keyboard":"pointerType"in e?e.pointerType||"keyboard":"touches"in e?"touch":e instanceof n.MouseEvent?t||(e.detail===0?"keyboard":"mouse"):""}const ff=20;let $n=[];function oc(){$n=$n.filter(e=>e.deref()?.isConnected)}function SE(e){oc(),e&&An(e)!=="body"&&($n.push(new WeakRef(e)),$n.length>ff&&($n=$n.slice(-ff)))}function sc(){return oc(),$n[$n.length-1]?.deref()}function CE(e){if(!e)return null;const t=Ir();return Nd(e,t)?e:wo(e,t)[0]||e}function TE(e){return!e||!e.isConnected?!1:typeof e.checkVisibility=="function"?e.checkVisibility():i1(e)}function pf(e,t){if(!t.current.includes("floating")&&!e.getAttribute("role")?.includes("dialog"))return;const n=Ir(),o=E1(e,n).filter(i=>{const a=i.getAttribute("data-tabindex")||"";return Nd(i,n)||i.hasAttribute("data-tabindex")&&!a.startsWith("-")}),s=e.getAttribute("tabindex");t.current.includes("floating")||o.length===0?s!=="0"&&e.setAttribute("tabindex","0"):(s!=="-1"||e.hasAttribute("data-tabindex")&&e.getAttribute("data-tabindex")!=="-1")&&(e.setAttribute("tabindex","-1"),e.setAttribute("data-tabindex","-1"))}function hf(e){const{context:t,children:n,disabled:r=!1,initialFocus:o=!0,returnFocus:s=!0,restoreFocus:i=!1,modal:a=!0,closeOnFocusOut:l=!0,openInteractionType:c="",nextFocusableElement:u,previousFocusableElement:d,beforeContentFocusGuardRef:h,externalTree:p,getInsideElements:g}=e,m="rootStore"in t?t.rootStore:t,v=m.useState("open"),y=m.useState("domReferenceElement"),b=m.useState("floatingElement"),{events:E,dataRef:x}=m.context,w=me(()=>x.current.floatingContext?.nodeId),T=o===!1,S=yd(y)&&T,I=f.useRef(["content"]),A=rn(o),L=rn(s),M=rn(c),_=Mr(p),R=lf(),P=f.useRef(!1),C=f.useRef(!1),N=f.useRef(!1),D=f.useRef(-1),k=f.useRef(""),$=f.useRef(""),F=f.useRef(null),j=f.useRef(null),V=Eo(F,h,R?.beforeInsideRef),Y=Eo(j,R?.afterInsideRef),q=_n(),X=_n(),U=ba(),H=R!=null,Z=Ia(b),re=me((K=Z)=>K?wo(K,Ir()):[]),ne=me(()=>g?.().filter(K=>K!=null)??[]),ee=me(K=>{const G=re(K);return I.current.map(()=>G).filter(Boolean).flat()});f.useEffect(()=>{if(r||!a)return;function K(de){de.key==="Tab"&&ke(Z,$t(Ae(Z)))&&re().length===0&&!S&&Yw(de)}const G=Ae(Z);return G.addEventListener("keydown",K),()=>{G.removeEventListener("keydown",K)}},[r,y,Z,a,I,S,re,ee]),f.useEffect(()=>{if(r||!v)return;const K=Ae(Z);function G(){N.current=!1}function de(oe){const ue=gt(oe),te=ne(),z=ke(b,ue)||ke(y,ue)||ke(R?.portalNode,ue)||te.some(B=>B===ue||ke(B,ue));N.current=!z,$.current=oe.pointerType||"keyboard",ue?.closest(`[${Ua}]`)&&(C.current=!0)}function fe(){$.current="keyboard"}return K.addEventListener("pointerdown",de,!0),K.addEventListener("pointerup",G,!0),K.addEventListener("pointercancel",G,!0),K.addEventListener("keydown",fe,!0),()=>{K.removeEventListener("pointerdown",de,!0),K.removeEventListener("pointerup",G,!0),K.removeEventListener("pointercancel",G,!0),K.removeEventListener("keydown",fe,!0)}},[r,b,y,Z,v,R,ne]),f.useEffect(()=>{if(r||!l)return;const K=Ae(Z);function G(){C.current=!0,X.start(0,()=>{C.current=!1})}function de(z){const B=gt(z),pe=re().indexOf(B);pe!==-1&&(D.current=pe)}function fe(z){const B=z.relatedTarget,J=z.currentTarget,pe=gt(z);queueMicrotask(()=>{const Se=w(),Ne=m.context.triggerElements,Fe=ne(),Ie=B?.hasAttribute(Fs("focus-guard"))&&[F.current,j.current,R?.beforeInsideRef.current,R?.afterInsideRef.current,R?.beforeOutsideRef.current,R?.afterOutsideRef.current,bn(d),bn(u)].includes(B),be=!(ke(y,B)||ke(b,B)||ke(B,b)||ke(R?.portalNode,B)||Fe.some(Re=>Re===B||ke(Re,B))||B!=null&&Ne.hasElement(B)||Ne.hasMatchingElement(Re=>ke(Re,B))||Ie||_&&(gn(_.nodesRef.current,Se).find(Re=>ke(Re.context?.elements.floating,B)||ke(Re.context?.elements.domReference,B))||bd(_.nodesRef.current,Se).find(Re=>[Re.context?.elements.floating,Ia(Re.context?.elements.floating)].includes(B)||Re.context?.elements.domReference===B)));if(J===y&&Z&&pf(Z,I),i&&J!==y&&!TE(pe)&&$t(K)===K.body){if(rt(Z)&&(Z.focus(),i==="popup")){U.request(()=>{Z.focus()});return}const Re=D.current,Ce=re(),Be=Ce[Re]||Ce[Ce.length-1]||Z;rt(Be)&&Be.focus()}if(x.current.insideReactTree){x.current.insideReactTree=!1;return}(S||!a)&&B&&be&&!C.current&&(S||B!==sc())&&(P.current=!0,m.setOpen(!1,Ye(Oo,z)))})}function oe(){N.current||(x.current.insideReactTree=!0,q.start(0,()=>{x.current.insideReactTree=!1}))}const ue=rt(y)?y:null,te=[];if(!(!b&&!ue))return ue&&(ue.addEventListener("focusout",fe),ue.addEventListener("pointerdown",G),te.push(()=>{ue.removeEventListener("focusout",fe),ue.removeEventListener("pointerdown",G)})),b&&(b.addEventListener("focusin",de),b.addEventListener("focusout",fe),R&&(b.addEventListener("focusout",oe,!0),te.push(()=>{b.removeEventListener("focusout",oe,!0)})),te.push(()=>{b.removeEventListener("focusin",de),b.removeEventListener("focusout",fe)})),()=>{te.forEach(z=>{z()})}},[r,y,b,Z,a,_,R,m,l,i,re,S,w,I,x,q,X,U,u,d,ne]),f.useEffect(()=>{if(r||!b||!v)return;const K=Array.from(R?.portalNode?.querySelectorAll(`[${Fs("portal")}]`)||[]),de=(_?bd(_.nodesRef.current,w()):[]).find(B=>yd(B.context?.elements.domReference||null))?.context?.elements.domReference,oe=[...[b,...K,F.current,j.current,R?.beforeOutsideRef.current,R?.afterOutsideRef.current,...ne()],de,bn(d),bn(u),S?y:null].filter(B=>B!=null),ue=cf(oe,{ariaHidden:a||S,mark:!1}),te=[b,...K].filter(B=>B!=null),z=cf(te);return()=>{z(),ue()}},[v,r,y,b,a,I,R,S,_,w,u,d,ne]),ve(()=>{if(!v||r||!rt(Z))return;const K=Ae(Z),G=$t(K);queueMicrotask(()=>{const de=ee(Z),fe=A.current,oe=typeof fe=="function"?fe(M.current||""):fe;if(oe===void 0||oe===!1)return;let ue;oe===!0||oe===null?ue=de[0]||Z:ue=bn(oe),ue=ue||de[0]||Z,!ke(Z,G)&&qa(ue,{preventScroll:ue===Z})})},[r,v,Z,T,ee,A,M]),ve(()=>{if(r||!Z)return;const K=Ae(Z),G=$t(K);SE(G);function de(oe){if(oe.open||(k.current=xE(oe.nativeEvent,$.current)),oe.reason===St&&oe.nativeEvent.type==="mouseleave"&&(P.current=!0),oe.reason===Qd)if(oe.nested)P.current=!1;else if(qw(oe.nativeEvent)||Xw(oe.nativeEvent))P.current=!1;else{let ue=!1;document.createElement("div").focus({get preventScroll(){return ue=!0,!1}}),ue?P.current=!1:P.current=!0}}E.on("openchange",de);function fe(){const oe=L.current;let ue=typeof oe=="function"?oe(k.current):oe;if(ue===void 0||ue===!1)return null;if(ue===null&&(ue=!0),typeof ue=="boolean"){const z=y||sc();return z&&z.isConnected?z:null}const te=y||sc();return bn(ue)||te||null}return()=>{E.off("openchange",de);const oe=$t(K),ue=ne(),te=ke(b,oe)||ue.some(B=>B===oe||ke(B,oe))||_&&gn(_.nodesRef.current,w(),!1).some(B=>ke(B.context?.elements.floating,oe)),z=fe();queueMicrotask(()=>{const B=CE(z),J=typeof L.current!="boolean";L.current&&!P.current&&rt(B)&&(!(!J&&B!==oe&&oe!==K.body)||te)&&B.focus({preventScroll:!0}),P.current=!1})}},[r,b,Z,L,x,E,_,y,w,ne]),ve(()=>{if(!dd||v||!b)return;const K=$t(Ae(b));!rt(K)||!Ra(K)||ke(b,K)&&K.blur()},[v,b]),ve(()=>{if(!(r||!R))return R.setFocusManagerState({modal:a,closeOnFocusOut:l,open:v,onOpenChange:m.setOpen,domReference:y}),()=>{R.setFocusManagerState(null)}},[r,R,a,v,m,l,y]),ve(()=>{if(!(r||!Z))return pf(Z,I),()=>{queueMicrotask(oc)}},[r,Z,I]);const le=!r&&(a?!S:!0)&&(H||a);return O.jsxs(f.Fragment,{children:[le&&O.jsx(nn,{"data-type":"inside",ref:V,onFocus:K=>{if(a){const G=ee();qa(G[G.length-1])}else R?.portalNode&&(P.current=!1,Nr(K,R.portalNode)?Fa(y)?.focus():bn(d??R.beforeOutsideRef)?.focus())}}),n,le&&O.jsx(nn,{"data-type":"inside",ref:Y,onFocus:K=>{a?qa(ee()[0]):R?.portalNode&&(l&&(P.current=!0),Nr(K,R.portalNode)?Ad(y)?.focus():bn(u??R.afterOutsideRef)?.focus())}})]})}function mf(e,t={}){const n="rootStore"in e?e.rootStore:e,r=n.context.dataRef,{enabled:o=!0,event:s="click",toggle:i=!0,ignoreMouse:a=!1,stickIfOpen:l=!0,touchOpenDelay:c=0,reason:u=Dr}=t,d=f.useRef(void 0),h=ba(),p=_n(),g=f.useMemo(()=>({onPointerDown(m){d.current=m.pointerType},onMouseDown(m){const v=d.current,y=m.nativeEvent,b=n.select("open");if(m.button!==0||s==="click"||bo(v,!0)&&a)return;const E=r.current.openEvent,x=E?.type,w=n.select("domReferenceElement")!==m.currentTarget,T=b&&w||!(b&&i&&(!(E&&l)||x==="click"||x==="mousedown"));if(Ra(y.target)){const I=Ye(u,y,y.target);T&&v==="touch"&&c>0?p.start(c,()=>{n.setOpen(!0,I)}):n.setOpen(T,I);return}const S=m.currentTarget;h.request(()=>{const I=Ye(u,y,S);T&&v==="touch"&&c>0?p.start(c,()=>{n.setOpen(!0,I)}):n.setOpen(T,I)})},onClick(m){if(s==="mousedown-only")return;const v=d.current;if(s==="mousedown"&&v){d.current=void 0;return}if(bo(v,!0)&&a)return;const y=n.select("open"),b=r.current.openEvent,E=n.select("domReferenceElement")!==m.currentTarget,x=y&&E||!(y&&i&&(!(b&&l)||wd(b))),w=Ye(u,m.nativeEvent,m.currentTarget);x&&v==="touch"&&c>0?p.start(c,()=>{n.setOpen(!0,w)}):n.setOpen(x,w)},onKeyDown(){d.current=void 0}}),[r,s,a,n,l,i,h,p,c,u]);return f.useMemo(()=>o?{reference:g}:tt,[o,g])}const OE={intentional:"onClick",sloppy:"onPointerDown"};function kE(){return!1}function RE(e){return{escapeKey:typeof e=="boolean"?e:e?.escapeKey??!1,outsidePress:typeof e=="boolean"?e:e?.outsidePress??!0}}function gf(e,t={}){const n="rootStore"in e?e.rootStore:e,r=n.useState("open"),o=n.useState("floatingElement"),{dataRef:s}=n.context,{enabled:i=!0,escapeKey:a=!0,outsidePress:l=!0,outsidePressEvent:c="sloppy",referencePress:u=kE,referencePressEvent:d="sloppy",bubbles:h,externalTree:p}=t,g=Mr(p),m=me(typeof l=="function"?l:()=>!1),v=typeof l=="function"?m:l,y=v!==!1,b=me(()=>c),E=f.useRef(!1),x=f.useRef(!1),w=f.useRef(!1),{escapeKey:T,outsidePress:S}=RE(h),I=f.useRef(null),A=_n(),L=_n(),M=me(()=>{L.clear(),s.current.insideReactTree=!1}),_=f.useRef(!1),R=f.useRef(""),P=me(u),C=me(j=>{if(!r||!i||!a||j.key!=="Escape"||_.current)return;const V=s.current.floatingContext?.nodeId,Y=g?gn(g.nodesRef.current,V):[];if(!T&&Y.length>0){let U=!0;if(Y.forEach(H=>{H.context?.open&&!H.context.dataRef.current.__escapeKeyBubbles&&(U=!1)}),!U)return}const q=Zw(j)?j.nativeEvent:j,X=Ye(ef,q);n.setOpen(!1,X),!T&&!X.isPropagationAllowed&&j.stopPropagation()}),N=me(()=>{s.current.insideReactTree=!0,L.start(0,M)});f.useEffect(()=>{if(!r||!i)return;s.current.__escapeKeyBubbles=T,s.current.__outsidePressBubbles=S;const j=new zt,V=new zt;function Y(){j.clear(),_.current=!0}function q(){j.start(xs()?5:0,()=>{_.current=!1})}function X(){w.current=!0,V.start(0,()=>{w.current=!1})}function U(){E.current=!1,x.current=!1}function H(){const B=R.current,J=B==="pen"||!B?"mouse":B,pe=b(),Se=typeof pe=="function"?pe():pe;return typeof Se=="string"?Se:Se[J]}function Z(B){const J=H();return J==="intentional"&&B.type!=="click"||J==="sloppy"&&B.type==="click"}function re(B){const J=s.current.floatingContext?.nodeId,pe=g&&gn(g.nodesRef.current,J).some(Se=>Yt(B,Se.context?.elements.floating));return Yt(B,n.select("floatingElement"))||Yt(B,n.select("domReferenceElement"))||pe}function ne(B){if(Z(B)){M();return}if(s.current.insideReactTree){M();return}const J=gt(B),pe=`[${Fs("inert")}]`;let Se=Array.from(Ae(n.select("floatingElement")).querySelectorAll(pe));const Ne=$e(J)?J.getRootNode():null;vo(Ne)&&(Se=Se.concat(Array.from(Ne.querySelectorAll(pe))));const Fe=n.context.triggerElements;if(J&&(Fe.hasElement(J)||Fe.hasMatchingElement(Ce=>ke(Ce,J))))return;let Ie=$e(J)?J:null;for(;Ie&&!hn(Ie);){const Ce=mn(Ie);if(hn(Ce)||!$e(Ce))break;Ie=Ce}if(Se.length&&$e(J)&&!zw(J)&&!ke(J,n.select("floatingElement"))&&Se.every(Ce=>!ke(Ie,Ce)))return;if(rt(J)&&!("touches"in B)){const Ce=hn(J),Be=Rt(J),Qe=/auto|scroll/,ct=Ce||Qe.test(Be.overflowX),Ct=Ce||Qe.test(Be.overflowY),Dt=ct&&J.clientWidth>0&&J.scrollWidth>J.clientWidth,jt=Ct&&J.clientHeight>0&&J.scrollHeight>J.clientHeight,ye=Be.direction==="rtl",Ze=jt&&(ye?B.offsetX<=J.offsetWidth-J.clientWidth:B.offsetX>J.clientWidth),ie=Dt&&B.offsetY>J.clientHeight;if(Ze||ie)return}if(re(B))return;if(H()==="intentional"&&w.current){V.clear(),w.current=!1;return}if(typeof v=="function"&&!v(B))return;const be=s.current.floatingContext?.nodeId,Re=g?gn(g.nodesRef.current,be):[];if(Re.length>0){let Ce=!0;if(Re.forEach(Be=>{Be.context?.open&&!Be.context.dataRef.current.__outsidePressBubbles&&(Ce=!1)}),!Ce)return}n.setOpen(!1,Ye(Qd,B)),M()}function ee(B){H()!=="sloppy"||B.pointerType==="touch"||!n.select("open")||!i||Yt(B,n.select("floatingElement"))||Yt(B,n.select("domReferenceElement"))||ne(B)}function le(B){if(H()!=="sloppy"||!n.select("open")||!i||Yt(B,n.select("floatingElement"))||Yt(B,n.select("domReferenceElement")))return;const J=B.touches[0];J&&(I.current={startTime:Date.now(),startX:J.clientX,startY:J.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},A.start(1e3,()=>{I.current&&(I.current.dismissOnTouchEnd=!1,I.current.dismissOnMouseDown=!1)}))}function K(B){R.current="touch";const J=gt(B);function pe(){le(B),J?.removeEventListener(B.type,pe)}J?.addEventListener(B.type,pe)}function G(B){if(A.clear(),B.type==="pointerdown"&&(R.current=B.pointerType),B.type==="mousedown"&&I.current&&!I.current.dismissOnMouseDown)return;const J=gt(B);function pe(){B.type==="pointerdown"?ee(B):ne(B),J?.removeEventListener(B.type,pe)}J?.addEventListener(B.type,pe)}function de(B){if(!E.current)return;const J=x.current;if(U(),H()==="intentional"){if(B.type==="pointercancel"){J&&X();return}if(!re(B)){if(J){X();return}typeof v=="function"&&!v(B)||(V.clear(),w.current=!0,M())}}}function fe(B){if(H()!=="sloppy"||!I.current||Yt(B,n.select("floatingElement"))||Yt(B,n.select("domReferenceElement")))return;const J=B.touches[0];if(!J)return;const pe=Math.abs(J.clientX-I.current.startX),Se=Math.abs(J.clientY-I.current.startY),Ne=Math.sqrt(pe*pe+Se*Se);Ne>5&&(I.current.dismissOnTouchEnd=!0),Ne>10&&(ne(B),A.clear(),I.current=null)}function oe(B){const J=gt(B);function pe(){fe(B),J?.removeEventListener(B.type,pe)}J?.addEventListener(B.type,pe)}function ue(B){H()!=="sloppy"||!I.current||Yt(B,n.select("floatingElement"))||Yt(B,n.select("domReferenceElement"))||(I.current.dismissOnTouchEnd&&ne(B),A.clear(),I.current=null)}function te(B){const J=gt(B);function pe(){ue(B),J?.removeEventListener(B.type,pe)}J?.addEventListener(B.type,pe)}const z=Ae(o);return a&&(z.addEventListener("keydown",C),z.addEventListener("compositionstart",Y),z.addEventListener("compositionend",q)),y&&(z.addEventListener("click",G,!0),z.addEventListener("pointerdown",G,!0),z.addEventListener("pointerup",de,!0),z.addEventListener("pointercancel",de,!0),z.addEventListener("mousedown",G,!0),z.addEventListener("mouseup",de,!0),z.addEventListener("touchstart",K,!0),z.addEventListener("touchmove",oe,!0),z.addEventListener("touchend",te,!0)),()=>{a&&(z.removeEventListener("keydown",C),z.removeEventListener("compositionstart",Y),z.removeEventListener("compositionend",q)),y&&(z.removeEventListener("click",G,!0),z.removeEventListener("pointerdown",G,!0),z.removeEventListener("pointerup",de,!0),z.removeEventListener("pointercancel",de,!0),z.removeEventListener("mousedown",G,!0),z.removeEventListener("mouseup",de,!0),z.removeEventListener("touchstart",K,!0),z.removeEventListener("touchmove",oe,!0),z.removeEventListener("touchend",te,!0)),j.clear(),V.clear(),U(),w.current=!1}},[s,o,a,y,v,r,i,T,S,C,M,b,g,n,A]),f.useEffect(M,[v,M]);const D=f.useMemo(()=>({onKeyDown:C,[OE[d]]:j=>{P()&&n.setOpen(!1,Ye(Dr,j.nativeEvent))},...d!=="intentional"&&{onClick(j){P()&&n.setOpen(!1,Ye(Dr,j.nativeEvent))}}}),[C,n,d,P]),k=me(j=>{if(!r||!i||j.button!==0)return;const V=gt(j.nativeEvent);ke(n.select("floatingElement"),V)&&(E.current||(E.current=!0,x.current=!1))}),$=me(j=>{!r||!i||(j.defaultPrevented||j.nativeEvent.defaultPrevented)&&E.current&&(x.current=!0)}),F=f.useMemo(()=>({onKeyDown:C,onPointerDown:$,onMouseDown:$,onClickCapture:N,onMouseDownCapture(j){N(),k(j)},onPointerDownCapture(j){N(),k(j)},onMouseUpCapture:N,onTouchEndCapture:N,onTouchMoveCapture:N}),[C,N,k,$]);return f.useMemo(()=>i?{reference:D,floating:F,trigger:D}:{},[i,D,F])}function vf(e,t,n){let{reference:r,floating:o}=e;const s=Ft(t),i=Da(t),a=Aa(i),l=xt(t),c=s==="y",u=r.x+r.width/2-o.width/2,d=r.y+r.height/2-o.height/2,h=r[a]/2-o[a]/2;let p;switch(l){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:d};break;case"left":p={x:r.x-o.width,y:d};break;default:p={x:r.x,y:r.y}}switch(Mn(t)){case"start":p[i]-=h*(n&&c?-1:1);break;case"end":p[i]+=h*(n&&c?-1:1);break}return p}async function PE(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:s,rects:i,elements:a,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:h=!1,padding:p=0}=vn(t,e),g=Sd(p),v=a[h?d==="floating"?"reference":"floating":d],y=ks(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(v)))==null||n?v:v.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:l})),b=d==="floating"?{x:r,y:o,width:i.floating.width,height:i.floating.height}:i.reference,E=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),x=await(s.isElement==null?void 0:s.isElement(E))?await(s.getScale==null?void 0:s.getScale(E))||{x:1,y:1}:{x:1,y:1},w=ks(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:b,offsetParent:E,strategy:l}):b);return{top:(y.top-w.top+g.top)/x.y,bottom:(w.bottom-y.bottom+g.bottom)/x.y,left:(y.left-w.left+g.left)/x.x,right:(w.right-y.right+g.right)/x.x}}const IE=50,NE=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:i}=n,a=i.detectOverflow?i:{...i,detectOverflow:PE},l=await(i.isRTL==null?void 0:i.isRTL(t));let c=await i.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:d}=vf(c,r,l),h=r,p=0;const g={};for(let m=0;m<s.length;m++){const v=s[m];if(!v)continue;const{name:y,fn:b}=v,{x:E,y:x,data:w,reset:T}=await b({x:u,y:d,initialPlacement:r,placement:h,strategy:o,middlewareData:g,rects:c,platform:a,elements:{reference:e,floating:t}});u=E??u,d=x??d,g[y]={...g[y],...w},T&&p<IE&&(p++,typeof T=="object"&&(T.placement&&(h=T.placement),T.rects&&(c=T.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:o}):T.rects),{x:u,y:d}=vf(c,h,l)),m=-1)}return{x:u,y:d,placement:h,strategy:o,middlewareData:g}},_E=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:s,rects:i,initialPlacement:a,platform:l,elements:c}=t,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:h,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:m=!0,...v}=vn(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const y=xt(o),b=Ft(a),E=xt(a)===a,x=await(l.isRTL==null?void 0:l.isRTL(c.floating)),w=h||(E||!m?[Os(a)]:e1(a)),T=g!=="none";!h&&T&&w.push(...o1(a,m,g,x));const S=[a,...w],I=await l.detectOverflow(t,v),A=[];let L=((r=s.flip)==null?void 0:r.overflows)||[];if(u&&A.push(I[y]),d){const P=Qw(o,i,x);A.push(I[P[0]],I[P[1]])}if(L=[...L,{placement:o,overflows:A}],!A.every(P=>P<=0)){var M,_;const P=(((M=s.flip)==null?void 0:M.index)||0)+1,C=S[P];if(C&&(!(d==="alignment"?b!==Ft(C):!1)||L.every(k=>Ft(k.placement)===b?k.overflows[0]>0:!0)))return{data:{index:P,overflows:L},reset:{placement:C}};let N=(_=L.filter(D=>D.overflows[0]<=0).sort((D,k)=>D.overflows[1]-k.overflows[1])[0])==null?void 0:_.placement;if(!N)switch(p){case"bestFit":{var R;const D=(R=L.filter(k=>{if(T){const $=Ft(k.placement);return $===b||$==="y"}return!0}).map(k=>[k.placement,k.overflows.filter($=>$>0).reduce(($,F)=>$+F,0)]).sort((k,$)=>k[1]-$[1])[0])==null?void 0:R[0];D&&(N=D);break}case"initialPlacement":N=a;break}if(o!==N)return{reset:{placement:N}}}return{}}}};function yf(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function bf(e){return Kw.some(t=>e[t]>=0)}const AE=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:o="referenceHidden",...s}=vn(e,t);switch(o){case"referenceHidden":{const i=await r.detectOverflow(t,{...s,elementContext:"reference"}),a=yf(i,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:bf(a)}}}case"escaped":{const i=await r.detectOverflow(t,{...s,altBoundary:!0}),a=yf(i,n.floating);return{data:{escapedOffsets:a,escaped:bf(a)}}}default:return{}}}}},wf=new Set(["left","top"]);async function DE(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),i=xt(n),a=Mn(n),l=Ft(n)==="y",c=wf.has(i)?-1:1,u=s&&l?-1:1,d=vn(t,e);let{mainAxis:h,crossAxis:p,alignmentAxis:g}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return a&&typeof g=="number"&&(p=a==="end"?g*-1:g),l?{x:p*u,y:h*c}:{x:h*c,y:p*u}}const ME=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:s,placement:i,middlewareData:a}=t,l=await DE(t,e);return i===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:o+l.x,y:s+l.y,data:{...l,placement:i}}}}},LE=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o,platform:s}=t,{mainAxis:i=!0,crossAxis:a=!1,limiter:l={fn:y=>{let{x:b,y:E}=y;return{x:b,y:E}}},...c}=vn(e,t),u={x:n,y:r},d=await s.detectOverflow(t,c),h=Ft(xt(o)),p=_a(h);let g=u[p],m=u[h];if(i){const y=p==="y"?"top":"left",b=p==="y"?"bottom":"right",E=g+d[y],x=g-d[b];g=Na(E,g,x)}if(a){const y=h==="y"?"top":"left",b=h==="y"?"bottom":"right",E=m+d[y],x=m-d[b];m=Na(E,m,x)}const v=l.fn({...t,[p]:g,[h]:m});return{...v,data:{x:v.x-n,y:v.y-r,enabled:{[p]:i,[h]:a}}}}}},$E=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:s,middlewareData:i}=t,{offset:a=0,mainAxis:l=!0,crossAxis:c=!0}=vn(e,t),u={x:n,y:r},d=Ft(o),h=_a(d);let p=u[h],g=u[d];const m=vn(a,t),v=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(l){const E=h==="y"?"height":"width",x=s.reference[h]-s.floating[E]+v.mainAxis,w=s.reference[h]+s.reference[E]-v.mainAxis;p<x?p=x:p>w&&(p=w)}if(c){var y,b;const E=h==="y"?"width":"height",x=wf.has(xt(o)),w=s.reference[d]-s.floating[E]+(x&&((y=i.offset)==null?void 0:y[d])||0)+(x?0:v.crossAxis),T=s.reference[d]+s.reference[E]+(x?0:((b=i.offset)==null?void 0:b[d])||0)-(x?v.crossAxis:0);g<w?g=w:g>T&&(g=T)}return{[h]:p,[d]:g}}}},FE=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:s,platform:i,elements:a}=t,{apply:l=()=>{},...c}=vn(e,t),u=await i.detectOverflow(t,c),d=xt(o),h=Mn(o),p=Ft(o)==="y",{width:g,height:m}=s.floating;let v,y;d==="top"||d==="bottom"?(v=d,y=h===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?"start":"end")?"left":"right"):(y=d,v=h==="end"?"top":"bottom");const b=m-u.top-u.bottom,E=g-u.left-u.right,x=Rr(m-u[v],b),w=Rr(g-u[y],E),T=!t.middlewareData.shift;let S=x,I=w;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(I=E),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(S=b),T&&!h){const L=Pt(u.left,0),M=Pt(u.right,0),_=Pt(u.top,0),R=Pt(u.bottom,0);p?I=g-2*(L!==0||M!==0?L+M:Pt(u.left,u.right)):S=m-2*(_!==0||R!==0?_+R:Pt(u.top,u.bottom))}await l({...t,availableWidth:I,availableHeight:S});const A=await i.getDimensions(a.floating);return g!==A.width||m!==A.height?{reset:{rects:!0}}:{}}}};function Ef(e){const t=Rt(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=rt(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r,a=Cs(n)!==s||Cs(r)!==i;return a&&(n=s,r=i),{width:n,height:r,$:a}}function ic(e){return $e(e)?e:e.contextElement}function Lr(e){const t=ic(e);if(!rt(t))return tn(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=Ef(t);let i=(s?Cs(n.width):n.width)/r,a=(s?Cs(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!a||!Number.isFinite(a))&&(a=1),{x:i,y:a}}const VE=tn(0);function xf(e){const t=nt(e);return!xs()||!t.visualViewport?VE:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function BE(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==nt(e)?!1:t}function sr(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=ic(e);let i=tn(1);t&&(r?$e(r)&&(i=Lr(r)):i=Lr(e));const a=BE(s,n,r)?xf(s):tn(0);let l=(o.left+a.x)/i.x,c=(o.top+a.y)/i.y,u=o.width/i.x,d=o.height/i.y;if(s){const h=nt(s),p=r&&$e(r)?nt(r):r;let g=h,m=Sa(g);for(;m&&r&&p!==g;){const v=Lr(m),y=m.getBoundingClientRect(),b=Rt(m),E=y.left+(m.clientLeft+parseFloat(b.paddingLeft))*v.x,x=y.top+(m.clientTop+parseFloat(b.paddingTop))*v.y;l*=v.x,c*=v.y,u*=v.x,d*=v.y,l+=E,c+=x,g=nt(m),m=Sa(g)}}return ks({width:u,height:d,x:l,y:c})}function Vs(e,t){const n=Ss(e).scrollLeft;return t?t.left+n:sr(en(e)).left+n}function Sf(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Vs(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function WE(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",i=en(r),a=t?Es(t.floating):!1;if(r===i||a&&s)return n;let l={scrollLeft:0,scrollTop:0},c=tn(1);const u=tn(0),d=rt(r);if((d||!d&&!s)&&((An(r)!=="body"||Dn(i))&&(l=Ss(r)),d)){const p=sr(r);c=Lr(r),u.x=p.x+r.clientLeft,u.y=p.y+r.clientTop}const h=i&&!d&&!s?Sf(i,l):tn(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+u.x+h.x,y:n.y*c.y-l.scrollTop*c.y+u.y+h.y}}function jE(e){return Array.from(e.getClientRects())}function HE(e){const t=en(e),n=Ss(e),r=e.ownerDocument.body,o=Pt(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=Pt(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+Vs(e);const a=-n.scrollTop;return Rt(r).direction==="rtl"&&(i+=Pt(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:i,y:a}}const Cf=25;function UE(e,t){const n=nt(e),r=en(e),o=n.visualViewport;let s=r.clientWidth,i=r.clientHeight,a=0,l=0;if(o){s=o.width,i=o.height;const u=xs();(!u||u&&t==="fixed")&&(a=o.offsetLeft,l=o.offsetTop)}const c=Vs(r);if(c<=0){const u=r.ownerDocument,d=u.body,h=getComputedStyle(d),p=u.compatMode==="CSS1Compat"&&parseFloat(h.marginLeft)+parseFloat(h.marginRight)||0,g=Math.abs(r.clientWidth-d.clientWidth-p);g<=Cf&&(s-=g)}else c<=Cf&&(s+=c);return{width:s,height:i,x:a,y:l}}function GE(e,t){const n=sr(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=rt(e)?Lr(e):tn(1),i=e.clientWidth*s.x,a=e.clientHeight*s.y,l=o*s.x,c=r*s.y;return{width:i,height:a,x:l,y:c}}function Tf(e,t,n){let r;if(t==="viewport")r=UE(e,n);else if(t==="document")r=HE(en(e));else if($e(t))r=GE(t,n);else{const o=xf(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return ks(r)}function Of(e,t){const n=mn(e);return n===t||!$e(n)||hn(n)?!1:Rt(n).position==="fixed"||Of(n,t)}function zE(e,t){const n=t.get(e);if(n)return n;let r=yo(e,[],!1).filter(a=>$e(a)&&An(a)!=="body"),o=null;const s=Rt(e).position==="fixed";let i=s?mn(e):e;for(;$e(i)&&!hn(i);){const a=Rt(i),l=xa(i);!l&&a.position==="fixed"&&(o=null),(s?!l&&!o:!l&&a.position==="static"&&!!o&&(o.position==="absolute"||o.position==="fixed")||Dn(i)&&!l&&Of(e,i))?r=r.filter(u=>u!==i):o=a,i=mn(i)}return t.set(e,r),r}function YE(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[...n==="clippingAncestors"?Es(t)?[]:zE(t,this._c):[].concat(n),r],a=Tf(t,i[0],o);let l=a.top,c=a.right,u=a.bottom,d=a.left;for(let h=1;h<i.length;h++){const p=Tf(t,i[h],o);l=Pt(p.top,l),c=Rr(p.right,c),u=Rr(p.bottom,u),d=Pt(p.left,d)}return{width:c-d,height:u-l,x:d,y:l}}function ZE(e){const{width:t,height:n}=Ef(e);return{width:t,height:n}}function qE(e,t,n){const r=rt(t),o=en(t),s=n==="fixed",i=sr(e,!0,s,t);let a={scrollLeft:0,scrollTop:0};const l=tn(0);function c(){l.x=Vs(o)}if(r||!r&&!s)if((An(t)!=="body"||Dn(o))&&(a=Ss(t)),r){const p=sr(t,!0,s,t);l.x=p.x+t.clientLeft,l.y=p.y+t.clientTop}else o&&c();s&&!r&&o&&c();const u=o&&!r&&!s?Sf(o,a):tn(0),d=i.left+a.scrollLeft-l.x-u.x,h=i.top+a.scrollTop-l.y-u.y;return{x:d,y:h,width:i.width,height:i.height}}function ac(e){return Rt(e).position==="static"}function kf(e,t){if(!rt(e)||Rt(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return en(e)===n&&(n=n.ownerDocument.body),n}function Rf(e,t){const n=nt(e);if(Es(e))return n;if(!rt(e)){let o=mn(e);for(;o&&!hn(o);){if($e(o)&&!ac(o))return o;o=mn(o)}return n}let r=kf(e,t);for(;r&&Fw(r)&&ac(r);)r=kf(r,t);return r&&hn(r)&&ac(r)&&!xa(r)?n:r||Ww(e)||n}const XE=async function(e){const t=this.getOffsetParent||Rf,n=this.getDimensions,r=await n(e.floating);return{reference:qE(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function KE(e){return Rt(e).direction==="rtl"}const JE={convertOffsetParentRelativeRectToViewportRelativeRect:WE,getDocumentElement:en,getClippingRect:YE,getOffsetParent:Rf,getElementRects:XE,getClientRects:jE,getDimensions:ZE,getScale:Lr,isElement:$e,isRTL:KE};function Pf(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function QE(e,t){let n=null,r;const o=en(e);function s(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function i(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),s();const c=e.getBoundingClientRect(),{left:u,top:d,width:h,height:p}=c;if(a||t(),!h||!p)return;const g=Ts(d),m=Ts(o.clientWidth-(u+h)),v=Ts(o.clientHeight-(d+p)),y=Ts(u),E={rootMargin:-g+"px "+-m+"px "+-v+"px "+-y+"px",threshold:Pt(0,Rr(1,l))||1};let x=!0;function w(T){const S=T[0].intersectionRatio;if(S!==l){if(!x)return i();S?i(!1,S):r=setTimeout(()=>{i(!1,1e-7)},1e3)}S===1&&!Pf(c,e.getBoundingClientRect())&&i(),x=!1}try{n=new IntersectionObserver(w,{...E,root:o.ownerDocument})}catch{n=new IntersectionObserver(w,E)}n.observe(e)}return i(!0),s}function If(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=ic(e),u=o||s?[...c?yo(c):[],...t?yo(t):[]]:[];u.forEach(y=>{o&&y.addEventListener("scroll",n,{passive:!0}),s&&y.addEventListener("resize",n)});const d=c&&a?QE(c,n):null;let h=-1,p=null;i&&(p=new ResizeObserver(y=>{let[b]=y;b&&b.target===c&&p&&t&&(p.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var E;(E=p)==null||E.observe(t)})),n()}),c&&!l&&p.observe(c),t&&p.observe(t));let g,m=l?sr(e):null;l&&v();function v(){const y=sr(e);m&&!Pf(m,y)&&n(),m=y,g=requestAnimationFrame(v)}return n(),()=>{var y;u.forEach(b=>{o&&b.removeEventListener("scroll",n),s&&b.removeEventListener("resize",n)}),d?.(),(y=p)==null||y.disconnect(),p=null,l&&cancelAnimationFrame(g)}}const ex=ME,tx=LE,nx=_E,rx=FE,ox=AE,sx=$E,ix=(e,t,n)=>{const r=new Map,o={platform:JE,...n},s={...o.platform,_c:r};return NE(e,t,{...o,platform:s})};var ax=typeof document<"u",cx=function(){},Bs=ax?W.useLayoutEffect:cx;function Ws(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Ws(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;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const s=o[r];if(!(s==="_owner"&&e.$$typeof)&&!Ws(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function Nf(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function _f(e,t){const n=Nf(e);return Math.round(t*n)/n}function cc(e){const t=f.useRef(e);return Bs(()=>{t.current=e}),t}function lx(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:s,floating:i}={},transform:a=!0,whileElementsMounted:l,open:c}=e,[u,d]=f.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[h,p]=f.useState(r);Ws(h,r)||p(r);const[g,m]=f.useState(null),[v,y]=f.useState(null),b=f.useCallback(k=>{k!==T.current&&(T.current=k,m(k))},[]),E=f.useCallback(k=>{k!==S.current&&(S.current=k,y(k))},[]),x=s||g,w=i||v,T=f.useRef(null),S=f.useRef(null),I=f.useRef(u),A=l!=null,L=cc(l),M=cc(o),_=cc(c),R=f.useCallback(()=>{if(!T.current||!S.current)return;const k={placement:t,strategy:n,middleware:h};M.current&&(k.platform=M.current),ix(T.current,S.current,k).then($=>{const F={...$,isPositioned:_.current!==!1};P.current&&!Ws(I.current,F)&&(I.current=F,lt.flushSync(()=>{d(F)}))})},[h,t,n,M,_]);Bs(()=>{c===!1&&I.current.isPositioned&&(I.current.isPositioned=!1,d(k=>({...k,isPositioned:!1})))},[c]);const P=f.useRef(!1);Bs(()=>(P.current=!0,()=>{P.current=!1}),[]),Bs(()=>{if(x&&(T.current=x),w&&(S.current=w),x&&w){if(L.current)return L.current(x,w,R);R()}},[x,w,R,L,A]);const C=f.useMemo(()=>({reference:T,floating:S,setReference:b,setFloating:E}),[b,E]),N=f.useMemo(()=>({reference:x,floating:w}),[x,w]),D=f.useMemo(()=>{const k={position:n,left:0,top:0};if(!N.floating)return k;const $=_f(N.floating,u.x),F=_f(N.floating,u.y);return a?{...k,transform:"translate("+$+"px, "+F+"px)",...Nf(N.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:$,top:F}},[n,a,N.floating,u.x,u.y]);return f.useMemo(()=>({...u,update:R,refs:C,elements:N,floatingStyles:D}),[u,R,C,N,D])}const ux=(e,t)=>{const n=ex(e);return{name:n.name,fn:n.fn,options:[e,t]}},dx=(e,t)=>{const n=tx(e);return{name:n.name,fn:n.fn,options:[e,t]}},fx=(e,t)=>({fn:sx(e).fn,options:[e,t]}),px=(e,t)=>{const n=nx(e);return{name:n.name,fn:n.fn,options:[e,t]}},hx=(e,t)=>{const n=rx(e);return{name:n.name,fn:n.fn,options:[e,t]}},mx=(e,t)=>{const n=ox(e);return{name:n.name,fn:n.fn,options:[e,t]}},gx={open:he(e=>e.open),domReferenceElement:he(e=>e.domReferenceElement),referenceElement:he(e=>e.positionReference??e.referenceElement),floatingElement:he(e=>e.floatingElement),floatingId:he(e=>e.floatingId)};class lc extends vs{constructor(t){const{nested:n,noEmit:r,onOpenChange:o,triggerElements:s,...i}=t;super({...i,positionReference:i.referenceElement,domReferenceElement:i.referenceElement},{onOpenChange:o,dataRef:{current:{}},events:df(),nested:n,noEmit:r,triggerElements:s},gx)}setOpen=(t,n)=>{if((!t||!this.state.open||wd(n.event))&&(this.context.dataRef.current.openEvent=t?n.event:void 0),!this.context.noEmit){const r={open:t,reason:n.reason,nativeEvent:n.event,nested:this.context.nested,triggerElement:n.trigger};this.context.events.emit("openchange",r)}this.context.onOpenChange?.(t,n)}}function uc(e,t=!1,n=!1){const[r,o]=f.useState(e&&t?"idle":void 0),[s,i]=f.useState(e);return e&&!s&&(i(!0),o("starting")),!e&&s&&r!=="ending"&&!n&&o("ending"),!e&&!s&&r==="ending"&&o(void 0),ve(()=>{if(!e&&s&&r!=="ending"&&n){const a=Nn.request(()=>{o("ending")});return()=>{Nn.cancel(a)}}},[e,s,r,n]),ve(()=>{if(!e||t)return;const a=Nn.request(()=>{o(void 0)});return()=>{Nn.cancel(a)}},[t,e]),ve(()=>{if(!e||!t)return;e&&s&&r!=="idle"&&o("starting");const a=Nn.request(()=>{o("idle")});return()=>{Nn.cancel(a)}},[t,e,s,o,r]),f.useMemo(()=>({mounted:s,setMounted:i,transitionStatus:r}),[s,r])}function vx(e,t){const n=f.useRef(null),r=f.useRef(null);return f.useCallback(o=>{if(e!==void 0){if(n.current!==null){const s=n.current,i=r.current,a=t.context.triggerElements.getById(s);i&&a===i&&t.context.triggerElements.delete(s),n.current=null,r.current=null}o!==null&&(n.current=e,r.current=o,t.context.triggerElements.add(e,o))}},[t,e])}function Af(e,t,n,r){const o=n.useState("isMountedByTrigger",e),s=vx(e,n),i=me(a=>{if(s(a),!a||!n.select("open"))return;const l=n.select("activeTriggerId");if(l===e){n.update({activeTriggerElement:a,...r});return}l==null&&n.update({activeTriggerId:e,activeTriggerElement:a,...r})});return ve(()=>{o&&n.update({activeTriggerElement:t.current,...r})},[o,n,t,...Object.values(r)]),{registerTrigger:i,isMountedByThisTrigger:o}}function Df(e){const t=e.useState("open");ve(()=>{if(t&&!e.select("activeTriggerId")&&e.context.triggerElements.size===1){const n=e.context.triggerElements.entries().next();if(!n.done){const[r,o]=n.value;e.update({activeTriggerId:r,activeTriggerElement:o})}}},[t,e])}function Mf(e,t,n){const{mounted:r,setMounted:o,transitionStatus:s}=uc(e);t.useSyncedValues({mounted:r,transitionStatus:s});const i=me(()=>{o(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)}),a=t.useState("preventUnmountingOnClose");return Ar({enabled:!a,open:e,ref:t.context.popupRef,onComplete(){e||i()}}),{forceUnmount:i,transitionStatus:s}}class js{constructor(){this.elementsSet=new Set,this.idMap=new Map}add(t,n){const r=this.idMap.get(t);if(r!==n&&(r!==void 0&&this.elementsSet.delete(r),this.elementsSet.add(n),this.idMap.set(t,n),process.env.NODE_ENV!=="production"&&this.elementsSet.size!==this.idMap.size))throw new Error("Base UI: A trigger element cannot be registered under multiple IDs in PopupTriggerMap.")}delete(t){const n=this.idMap.get(t);n&&(this.elementsSet.delete(n),this.idMap.delete(t))}hasElement(t){return this.elementsSet.has(t)}hasMatchingElement(t){for(const n of this.elementsSet)if(t(n))return!0;return!1}getById(t){return this.idMap.get(t)}entries(){return this.idMap.entries()}elements(){return this.elementsSet.values()}get size(){return this.idMap.size}}function yx(){return new lc({open:!1,floatingElement:null,referenceElement:null,triggerElements:new js,floatingId:"",nested:!1,noEmit:!1,onOpenChange:void 0})}function Lf(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:"idle",floatingRootContext:yx(),preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:tt,inactiveTriggerProps:tt,popupProps:tt}}const Hs=he(e=>e.triggerIdProp??e.activeTriggerId),$f={open:he(e=>e.openProp??e.open),mounted:he(e=>e.mounted),transitionStatus:he(e=>e.transitionStatus),floatingRootContext:he(e=>e.floatingRootContext),preventUnmountingOnClose:he(e=>e.preventUnmountingOnClose),payload:he(e=>e.payload),activeTriggerId:Hs,activeTriggerElement:he(e=>e.mounted?e.activeTriggerElement:null),isTriggerActive:he((e,t)=>t!==void 0&&Hs(e)===t),isOpenedByTrigger:he((e,t)=>t!==void 0&&Hs(e)===t&&e.open),isMountedByTrigger:he((e,t)=>t!==void 0&&Hs(e)===t&&e.mounted),triggerProps:he((e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps),popupProps:he(e=>e.popupProps),popupElement:he(e=>e.popupElement),positionerElement:he(e=>e.positionerElement)};function bx(e){const{open:t=!1,onOpenChange:n,elements:r={}}=e,o=rr(),s=or()!=null;if(process.env.NODE_ENV!=="production"){const a=r.reference;a&&!$e(a)&&console.error("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `context.setPositionReference()`","instead.")}const i=ht(()=>new lc({open:t,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new js,floatingId:o,nested:s,noEmit:!1})).current;return ve(()=>{const a={open:t,floatingId:o};r.reference!==void 0&&(a.referenceElement=r.reference,a.domReferenceElement=$e(r.reference)?r.reference:null),r.floating!==void 0&&(a.floatingElement=r.floating),i.update(a)},[t,o,r.reference,r.floating,i]),i.context.onOpenChange=n,i.context.nested=s,i.context.noEmit=!1,i}function wx(e={}){const{nodeId:t,externalTree:n}=e,r=bx(e),o=e.rootContext||r,s={reference:o.useState("referenceElement"),floating:o.useState("floatingElement"),domReference:o.useState("domReferenceElement")},[i,a]=f.useState(null),l=f.useRef(null),c=Mr(n);ve(()=>{s.domReference&&(l.current=s.domReference)},[s.domReference]);const u=lx({...e,elements:{...s,...i&&{reference:i}}}),d=f.useCallback(S=>{const I=$e(S)?{getBoundingClientRect:()=>S.getBoundingClientRect(),getClientRects:()=>S.getClientRects(),contextElement:S}:S;a(I),u.refs.setReference(I)},[u.refs]),[h,p]=f.useState(null),[g,m]=f.useState(null);o.useSyncedValue("referenceElement",h),o.useSyncedValue("domReferenceElement",$e(h)?h:null),o.useSyncedValue("floatingElement",g);const v=f.useCallback(S=>{($e(S)||S===null)&&(l.current=S,p(S)),($e(u.refs.reference.current)||u.refs.reference.current===null||S!==null&&!$e(S))&&u.refs.setReference(S)},[u.refs,p]),y=f.useCallback(S=>{m(S),u.refs.setFloating(S)},[u.refs]),b=f.useMemo(()=>({...u.refs,setReference:v,setFloating:y,setPositionReference:d,domReference:l}),[u.refs,v,y,d]),E=f.useMemo(()=>({...u.elements,domReference:s.domReference}),[u.elements,s.domReference]),x=o.useState("open"),w=o.useState("floatingId"),T=f.useMemo(()=>({...u,dataRef:o.context.dataRef,open:x,onOpenChange:o.setOpen,events:o.context.events,floatingId:w,refs:b,elements:E,nodeId:t,rootStore:o}),[u,b,E,t,o,x,w]);return ve(()=>{o.context.dataRef.current.floatingContext=T;const S=c?.nodesRef.current.find(I=>I.id===t);S&&(S.context=T)}),f.useMemo(()=>({...u,context:T,refs:b,elements:E,rootStore:o}),[u,b,E,T,o])}function Ff(e){const{popupStore:t,noEmit:n=!1,treatPopupAsFloatingElement:r=!1,onOpenChange:o}=e,s=rr(),i=or()!=null,a=t.useState("open"),l=t.useState("activeTriggerElement"),c=t.useState(r?"popupElement":"positionerElement"),u=t.context.triggerElements,d=ht(()=>new lc({open:a,referenceElement:l,floatingElement:c,triggerElements:u,onOpenChange:o,floatingId:s,nested:i,noEmit:n})).current;return ve(()=>{const h={open:a,floatingId:s,referenceElement:l,floatingElement:c};$e(l)&&(h.domReferenceElement=l),d.state.positionReference===d.state.referenceElement&&(h.positionReference=l),d.update(h)},[a,s,l,c,d]),d.context.onOpenChange=o,d.context.nested=i,d.context.noEmit=n,d}const Ex=`button,a,[role="button"],select,[tabindex]:not([tabindex="-1"]),${gd}`;function xx(e){return e?!!e.closest(Ex):!1}class dc{constructor(){this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new zt,this.restTimeout=new zt,this.handleCloseOptions=void 0}static create(){return new dc}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose}function fc(e){e.performedPointerEventsMutation&&(e.pointerEventsScopeElement?.style.removeProperty("pointer-events"),e.pointerEventsReferenceElement?.style.removeProperty("pointer-events"),e.pointerEventsFloatingElement?.style.removeProperty("pointer-events"),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null)}function Sx(e,t){const{scopeElement:n,referenceElement:r,floatingElement:o}=t;fc(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=n,e.pointerEventsReferenceElement=r,e.pointerEventsFloatingElement=o,n.style.pointerEvents="none",r.style.pointerEvents="auto",o.style.pointerEvents="auto"}function Vf(e){const t=ht(dc.create).current,n=e.context.dataRef.current;return n.hoverInteractionState||(n.hoverInteractionState=t),mo(n.hoverInteractionState.disposeEffect),n.hoverInteractionState}function Cx(e,t={}){const n="rootStore"in e?e.rootStore:e,r=n.useState("open"),o=n.useState("floatingElement"),s=n.useState("domReferenceElement"),{dataRef:i}=n.context,{enabled:a=!0,closeDelay:l=0}=t,c=Vf(n),u=Mr(),d=or(),h=me(()=>Jd(i.current.openEvent?.type,c.interactedInside)),p=me(()=>{const E=i.current.openEvent?.type;return E?.includes("mouse")&&E!=="mousedown"}),g=me(E=>vd(E,n.context.triggerElements)),m=f.useCallback(E=>{const x=$s(l,"close",c.pointerType),w=()=>{n.setOpen(!1,Ye(St,E)),u?.events.emit("floating.closed",E)};x?c.openChangeTimeout.start(x,w):(c.openChangeTimeout.clear(),w())},[l,n,c,u]),v=me(()=>{fc(c)}),y=me(E=>{const x=gt(E);if(!xx(x)){c.interactedInside=!1;return}c.interactedInside=x?.closest("[aria-haspopup]")!=null});ve(()=>{r||(c.pointerType=void 0,c.restTimeoutPending=!1,c.interactedInside=!1,v())},[r,c,v]),f.useEffect(()=>v,[v]),ve(()=>{if(a&&r&&c.handleCloseOptions?.blockPointerEvents&&p()&&$e(s)&&o){const E=s,x=o,w=Ae(o),T=u?.nodesRef.current.find(I=>I.id===d)?.context?.elements.floating;T&&(T.style.pointerEvents="");const S=c.handleCloseOptions?.getScope?.()??c.pointerEventsScopeElement??T??E.closest("[data-rootownerid]")??w.body;return Sx(c,{scopeElement:S,referenceElement:E,floatingElement:x}),()=>{v()}}},[a,r,s,o,c,p,u,d,v]);const b=_n();f.useEffect(()=>{if(!a)return;function E(){c.openChangeTimeout.clear(),b.clear(),u?.events.off("floating.closed",w),v()}function x(S){if(u&&d&&gn(u.nodesRef.current,d).length>0){u.events.on("floating.closed",w);return}if(!g(S.relatedTarget)){if(c.handler){c.handler(S);return}v(),h()||m(S)}}function w(S){!u||!d||gn(u.nodesRef.current,d).length>0||b.start(0,()=>{u.events.off("floating.closed",w),n.setOpen(!1,Ye(St,S)),u.events.emit("floating.closed",S)})}const T=o;return T&&(T.addEventListener("mouseenter",E),T.addEventListener("mouseleave",x),T.addEventListener("pointerdown",y,!0)),()=>{T&&(T.removeEventListener("mouseenter",E),T.removeEventListener("mouseleave",x),T.removeEventListener("pointerdown",y,!0)),u?.events.off("floating.closed",w)}},[a,o,n,i,h,g,m,v,y,c,u,d,b])}const Tx={current:null};function Ox(e,t={}){const n="rootStore"in e?e.rootStore:e,{dataRef:r,events:o}=n.context,{enabled:s=!0,delay:i=0,handleClose:a=null,mouseOnly:l=!1,restMs:c=0,move:u=!0,triggerElementRef:d=Tx,externalTree:h,isActiveTrigger:p=!0,getHandleCloseContext:g}=t,m=Mr(h),v=Vf(n),y=rn(a),b=rn(i),E=rn(c),x=rn(s);p&&(v.handleCloseOptions=y.current?.__options);const w=me(()=>Jd(r.current.openEvent?.type,v.interactedInside)),T=me(M=>vd(M,n.context.triggerElements)),S=me((M,_,R)=>{const P=n.context.triggerElements;if(P.hasElement(_))return!M||!ke(M,_);if(!$e(R))return!1;const C=R;return P.hasMatchingElement(N=>ke(N,C))&&(!M||!ke(M,C))}),I=f.useCallback((M,_=!0)=>{const R=$s(b.current,"close",v.pointerType);R?v.openChangeTimeout.start(R,()=>{n.setOpen(!1,Ye(St,M)),m?.events.emit("floating.closed",M)}):_&&(v.openChangeTimeout.clear(),n.setOpen(!1,Ye(St,M)),m?.events.emit("floating.closed",M))},[b,n,v,m]),A=me(()=>{if(!v.handler)return;Ae(n.select("domReferenceElement")).removeEventListener("mousemove",v.handler),v.handler=void 0});f.useEffect(()=>A,[A]);const L=me(()=>{fc(v)});return f.useEffect(()=>{if(!s)return;function M(_){_.open||(A(),v.openChangeTimeout.clear(),v.restTimeout.clear(),v.blockMouseMove=!0,v.restTimeoutPending=!1)}return o.on("openchange",M),()=>{o.off("openchange",M)}},[s,o,v,A]),f.useEffect(()=>{if(!s)return;const M=d.current??(p?n.select("domReferenceElement"):null);if(!$e(M))return;function _(P){if(v.openChangeTimeout.clear(),v.blockMouseMove=!1,l&&!bo(v.pointerType)||Kd(E.current)>0&&!$s(b.current,"open"))return;const N=$s(b.current,"open",v.pointerType),D=P.currentTarget??null,k=n.select("domReferenceElement"),$=D==null?!1:S(k,D,P.target),F=n.select("open"),j=!F||$;$&&F?n.setOpen(!0,Ye(St,P,D)):N?v.openChangeTimeout.start(N,()=>{j&&n.setOpen(!0,Ye(St,P,D))}):j&&n.setOpen(!0,Ye(St,P,D))}function R(P){if(w()){L();return}A();const C=n.select("domReferenceElement"),N=Ae(C);v.restTimeout.clear(),v.restTimeoutPending=!1;const D=r.current.floatingContext??g?.();if(T(P.relatedTarget))return;if(y.current&&D){n.select("open")||v.openChangeTimeout.clear();const F=d.current;v.handler=y.current({...D,tree:m,x:P.clientX,y:P.clientY,onClose(){L(),A(),x.current&&!w()&&F===n.select("domReferenceElement")&&I(P,!0)}}),N.addEventListener("mousemove",v.handler),v.handler(P);return}(v.pointerType!=="touch"||!ke(n.select("floatingElement"),P.relatedTarget))&&I(P)}return u&&M.addEventListener("mousemove",_,{once:!0}),M.addEventListener("mouseenter",_),M.addEventListener("mouseleave",R),()=>{u&&M.removeEventListener("mousemove",_),M.removeEventListener("mouseenter",_),M.removeEventListener("mouseleave",R)}},[A,L,r,b,I,n,s,y,v,p,S,w,T,l,u,E,d,m,x,g]),f.useMemo(()=>{if(!s)return;function M(_){v.pointerType=_.pointerType}return{onPointerDown:M,onPointerEnter:M,onMouseMove(_){const{nativeEvent:R}=_,P=_.currentTarget,C=n.select("domReferenceElement"),N=n.select("open"),D=S(C,P,_.target);if(l&&!bo(v.pointerType))return;const k=Kd(E.current);if(N&&!D||k===0||!D&&v.restTimeoutPending&&_.movementX**2+_.movementY**2<2)return;v.restTimeout.clear();function $(){if(v.restTimeoutPending=!1,w())return;const F=n.select("open");!v.blockMouseMove&&(!F||D)&&n.setOpen(!0,Ye(St,R,P))}v.pointerType==="touch"?lt.flushSync(()=>{$()}):D&&N?$():(v.restTimeoutPending=!0,v.restTimeout.start(k,$))}}},[s,v,w,S,l,n,E])}function Us(e=[]){const t=e.map(c=>c?.reference),n=e.map(c=>c?.floating),r=e.map(c=>c?.item),o=e.map(c=>c?.trigger),s=f.useCallback(c=>Gs(c,e,"reference"),t),i=f.useCallback(c=>Gs(c,e,"floating"),n),a=f.useCallback(c=>Gs(c,e,"item"),r),l=f.useCallback(c=>Gs(c,e,"trigger"),o);return f.useMemo(()=>({getReferenceProps:s,getFloatingProps:i,getItemProps:a,getTriggerProps:l}),[s,i,a,l])}function Gs(e,t,n){const r=new Map,o=n==="item",s={};n==="floating"&&(s.tabIndex=-1,s[ka]="");for(const i in e)o&&e&&(i===hd||i===md)||(s[i]=e[i]);for(let i=0;i<t.length;i+=1){let a;const l=t[i]?.[n];typeof l=="function"?a=e?l(e):null:a=l,a&&Bf(s,a,o,r)}return Bf(s,e,o,r),s}function Bf(e,t,n,r){for(const o in t){const s=t[o];n&&(o===hd||o===md)||(o.startsWith("on")?(r.has(o)||r.set(o,[]),typeof s=="function"&&(r.get(o)?.push(s),e[o]=(...i)=>r.get(o)?.map(a=>a(...i)).find(a=>a!==void 0))):e[o]=s)}}const kx=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function Wf(e,t={}){const n="rootStore"in e?e.rootStore:e,r=n.useState("open"),o=n.useState("floatingId"),s=n.useState("domReferenceElement"),i=n.useState("floatingElement"),{role:a="dialog"}=t,l=rr(),c=s?.id||l,u=f.useMemo(()=>Ia(i)?.id||o,[i,o]),d=kx.get(a)??a,p=or()!=null,g=f.useMemo(()=>d==="tooltip"||a==="label"?tt:{"aria-haspopup":d==="alertdialog"?"dialog":d,"aria-expanded":"false",...d==="listbox"&&{role:"combobox"},...d==="menu"&&p&&{role:"menuitem"},...a==="select"&&{"aria-autocomplete":"none"},...a==="combobox"&&{"aria-autocomplete":"list"}},[d,p,a]),m=f.useMemo(()=>d==="tooltip"||a==="label"?{[`aria-${a==="label"?"labelledby":"describedby"}`]:r?u:void 0}:{...g,"aria-expanded":r?"true":"false","aria-controls":r?u:void 0,...d==="menu"&&{id:c}},[d,u,r,c,a,g]),v=f.useMemo(()=>{const b={id:u,...d&&{role:d}};return d==="tooltip"||a==="label"?b:{...b,...d==="menu"&&{"aria-labelledby":c}}},[d,u,c,a]),y=f.useCallback(({active:b,selected:E})=>{const x={role:"option",...b&&{id:`${u}-fui-option`}};switch(a){case"select":case"combobox":return{...x,"aria-selected":E}}return{}},[u,a]);return f.useMemo(()=>({reference:m,floating:v,item:y,trigger:g}),[m,v,g,y])}const jf=.1,Rx=jf*jf,Ve=.5;function zs(e,t,n,r,o,s){return r>=t!=s>=t&&e<=(o-n)*(t-r)/(s-r)+n}function Ys(e,t,n,r,o,s,i,a,l,c){let u=!1;return zs(e,t,n,r,o,s)&&(u=!u),zs(e,t,o,s,i,a)&&(u=!u),zs(e,t,i,a,l,c)&&(u=!u),zs(e,t,l,c,n,r)&&(u=!u),u}function Px(e,t,n){return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function Zs(e,t,n,r,o,s){const i=Math.min(n,o),a=Math.max(n,o),l=Math.min(r,s),c=Math.max(r,s);return e>=i&&e<=a&&t>=l&&t<=c}function Ix(e={}){const{blockPointerEvents:t=!1}=e,n=new zt,r=({x:o,y:s,placement:i,elements:a,onClose:l,nodeId:c,tree:u})=>{const d=i?.split("-")[0];let h=!1,p=null,g=null,m=typeof performance<"u"?performance.now():0;function v(b,E){const x=performance.now(),w=x-m;if(p===null||g===null||w===0)return p=b,g=E,m=x,!1;const T=b-p,S=E-g,I=T*T+S*S,A=w*w*Rx;return p=b,g=E,m=x,I<A}function y(){n.clear(),l()}return function(E){n.clear();const x=a.domReference,w=a.floating;if(!x||!w||d==null||o==null||s==null)return;const{clientX:T,clientY:S}=E,I=gt(E),A=E.type==="mouseleave",L=ke(w,I),M=ke(x,I);if(L&&(h=!0,!A))return;if(M&&(h=!1,!A)){h=!0;return}if(A&&$e(E.relatedTarget)&&ke(w,E.relatedTarget))return;function _(){return!!(u&&gn(u.nodesRef.current,c).length>0)}function R(){_()||y()}if(_())return;const P=x.getBoundingClientRect(),C=w.getBoundingClientRect(),N=o>C.right-C.width/2,D=s>C.bottom-C.height/2,k=C.width>P.width,$=C.height>P.height,F=(k?P:C).left,j=(k?P:C).right,V=($?P:C).top,Y=($?P:C).bottom;if(d==="top"&&s>=P.bottom-1||d==="bottom"&&s<=P.top+1||d==="left"&&o>=P.right-1||d==="right"&&o<=P.left+1){R();return}let q=!1;switch(d){case"top":q=Zs(T,S,F,P.top+1,j,C.bottom-1);break;case"bottom":q=Zs(T,S,F,C.top+1,j,P.bottom-1);break;case"left":q=Zs(T,S,C.right-1,Y,P.left+1,V);break;case"right":q=Zs(T,S,P.right-1,Y,C.left+1,V);break}if(q)return;if(h&&!Px(T,S,P)){R();return}if(!A&&v(T,S)){R();return}let X=!1;switch(d){case"top":{const U=k?Ve/2:Ve*4,H=k||N?o+U:o-U,Z=k?o-U:N?o+U:o-U,re=s+Ve+1,ne=N||k?C.bottom-Ve:C.top,ee=N?k?C.bottom-Ve:C.top:C.bottom-Ve;X=Ys(T,S,H,re,Z,re,C.left,ne,C.right,ee);break}case"bottom":{const U=k?Ve/2:Ve*4,H=k||N?o+U:o-U,Z=k?o-U:N?o+U:o-U,re=s-Ve,ne=N||k?C.top+Ve:C.bottom,ee=N?k?C.top+Ve:C.bottom:C.top+Ve;X=Ys(T,S,H,re,Z,re,C.left,ne,C.right,ee);break}case"left":{const U=$?Ve/2:Ve*4,H=$||D?s+U:s-U,Z=$?s-U:D?s+U:s-U,re=o+Ve+1,ne=D||$?C.right-Ve:C.left,ee=D?$?C.right-Ve:C.left:C.right-Ve;X=Ys(T,S,ne,C.top,ee,C.bottom,re,H,re,Z);break}case"right":{const U=$?Ve/2:Ve*4,H=$||D?s+U:s-U,Z=$?s-U:D?s+U:s-U,re=o-Ve,ne=D||$?C.left+Ve:C.right,ee=D?$?C.left+Ve:C.right:C.left+Ve;X=Ys(T,S,re,H,re,Z,ne,C.top,ee,C.bottom);break}}X?h||n.start(40,R):R()}};return r.__options={blockPointerEvents:t},r}const Hf=f.forwardRef(function(t,n){const{children:r,container:o,className:s,render:i,...a}=t,{portalNode:l,portalSubtree:c}=uf({container:o,ref:n,componentProps:t,elementProps:a});return!c&&!l?null:O.jsxs(f.Fragment,{children:[c,l&<.createPortal(r,l)]})});process.env.NODE_ENV!=="production"&&(Hf.displayName="FloatingPortalLite");const Nx=Hf,Uf=f.createContext(void 0);process.env.NODE_ENV!=="production"&&(Uf.displayName="DirectionContext");function _x(){return f.useContext(Uf)?.direction??"ltr"}const Ax=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:i,elements:a,middlewareData:l}=t,{element:c,padding:u=0,offsetParent:d="real"}=vn(e,t)||{};if(c==null)return{};const h=Sd(u),p={x:n,y:r},g=Da(o),m=Aa(g),v=await i.getDimensions(c),y=g==="y",b=y?"top":"left",E=y?"bottom":"right",x=y?"clientHeight":"clientWidth",w=s.reference[m]+s.reference[g]-p[g]-s.floating[m],T=p[g]-s.reference[g],S=d==="real"?await i.getOffsetParent?.(c):a.floating;let I=a.floating[x]||s.floating[m];(!I||!await i.isElement?.(S))&&(I=a.floating[x]||s.floating[m]);const A=w/2-T/2,L=I/2-v[m]/2-1,M=Math.min(h[b],L),_=Math.min(h[E],L),R=M,P=I-v[m]-_,C=I/2-v[m]/2+A,N=Na(R,C,P),D=!l.arrow&&Mn(o)!=null&&C!==N&&s.reference[m]/2-(C<R?M:_)-v[m]/2<0,k=D?C<R?C-R:C-P:0;return{[g]:p[g]+k,data:{[g]:N,centerOffset:C-N-k,...D&&{alignmentOffset:k}},reset:D}}}),Dx=(e,t)=>({...Ax(e),options:[e,t]}),Mx={name:"hide",async fn(e){const{width:t,height:n,x:r,y:o}=e.rects.reference,s=t===0&&n===0&&r===0&&o===0;return{data:{referenceHidden:(await mx().fn(e)).data?.referenceHidden||s}}}},qs={sideX:"left",sideY:"top"},Lx={name:"adaptiveOrigin",async fn(e){const{x:t,y:n,rects:{floating:r},elements:{floating:o},platform:s,strategy:i,placement:a}=e,l=nt(o),c=l.getComputedStyle(o);if(!(c.transitionDuration!=="0s"&&c.transitionDuration!==""))return{x:t,y:n,data:qs};const d=await s.getOffsetParent?.(o);let h={width:0,height:0};if(i==="fixed"&&l?.visualViewport)h={width:l.visualViewport.width,height:l.visualViewport.height};else if(d===l){const b=Ae(o);h={width:b.documentElement.clientWidth,height:b.documentElement.clientHeight}}else await s.isElement?.(d)&&(h=await s.getDimensions(d));const p=xt(a);let g=t,m=n;p==="left"&&(g=h.width-(t+r.width)),p==="top"&&(m=h.height-(n+r.height));const v=p==="left"?"right":qs.sideX,y=p==="top"?"bottom":qs.sideY;return{x:g,y:m,data:{sideX:v,sideY:y}}}};function Gf(e,t,n){const r=e==="inline-start"||e==="inline-end";return{top:"top",right:r?n?"inline-start":"inline-end":"right",bottom:"bottom",left:r?n?"inline-end":"inline-start":"left"}[t]}function zf(e,t,n){const{rects:r,placement:o}=e;return{side:Gf(t,xt(o),n),align:Mn(o)||"center",anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function $x(e){const{anchor:t,positionMethod:n="absolute",side:r="bottom",sideOffset:o=0,align:s="center",alignOffset:i=0,collisionBoundary:a,collisionPadding:l=5,sticky:c=!1,arrowPadding:u=5,disableAnchorTracking:d=!1,keepMounted:h=!1,floatingRootContext:p,mounted:g,collisionAvoidance:m,shiftCrossAxis:v=!1,nodeId:y,adaptiveOrigin:b,lazyFlip:E=!1,externalTree:x}=e,[w,T]=f.useState(null);!g&&w!==null&&T(null);const S=m.side||"flip",I=m.align||"flip",A=m.fallbackAxisSide||"end",L=typeof t=="function"?t:void 0,M=me(L),_=L?M:t,R=rn(t),C=_x()==="rtl",N=w||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":C?"left":"right","inline-start":C?"right":"left"}[r],D=s==="center"?N:`${N}-${s}`;let k=l;const $=1,F=r==="bottom"?$:0,j=r==="top"?$:0,V=r==="right"?$:0,Y=r==="left"?$:0;typeof k=="number"?k={top:k+F,right:k+Y,bottom:k+j,left:k+V}:k&&(k={top:(k.top||0)+F,right:(k.right||0)+Y,bottom:(k.bottom||0)+j,left:(k.left||0)+V});const q={boundary:a==="clipping-ancestors"?"clippingAncestors":a,padding:k},X=f.useRef(null),U=rn(o),H=rn(i),ne=[ux(ye=>{const Ze=zf(ye,r,C),ie=typeof U.current=="function"?U.current(Ze):U.current,ge=typeof H.current=="function"?H.current(Ze):H.current;return{mainAxis:ie,crossAxis:ge,alignmentAxis:ge}},[typeof o!="function"?o:0,typeof i!="function"?i:0,C,r])],ee=I==="none"&&S!=="shift",le=!ee&&(c||v||S==="shift"),K=S==="none"?null:px({...q,padding:{top:k.top+$,right:k.right+$,bottom:k.bottom+$,left:k.left+$},mainAxis:!v&&S==="flip",crossAxis:I==="flip"?"alignment":!1,fallbackAxisSideDirection:A}),G=ee?null:dx(ye=>{const Ze=Ae(ye.elements.floating).documentElement;return{...q,rootBoundary:v?{x:0,y:0,width:Ze.clientWidth,height:Ze.clientHeight}:void 0,mainAxis:I!=="none",crossAxis:le,limiter:c||v?void 0:fx(ie=>{if(!X.current)return{};const{width:ge,height:Oe}=X.current.getBoundingClientRect(),we=Ft(xt(ie.placement)),Me=we==="y"?ge:Oe,Ke=we==="y"?k.left+k.right:k.top+k.bottom;return{offset:Me/2+Ke/2}})}},[q,c,v,k,I]);S==="shift"||I==="shift"||s==="center"?ne.push(G,K):ne.push(K,G),ne.push(hx({...q,apply({elements:{floating:ye},availableWidth:Ze,availableHeight:ie,rects:ge}){const Oe=ye.style;Oe.setProperty("--available-width",`${Ze}px`),Oe.setProperty("--available-height",`${ie}px`);const we=window.devicePixelRatio||1,{x:Me,y:Ke,width:et,height:Tt}=ge.reference,Et=(Math.round((Me+et)*we)-Math.round(Me*we))/we,Kt=(Math.round((Ke+Tt)*we)-Math.round(Ke*we))/we;Oe.setProperty("--anchor-width",`${Et}px`),Oe.setProperty("--anchor-height",`${Kt}px`)}}),Dx(()=>({element:X.current||document.createElement("div"),padding:u,offsetParent:"floating"}),[u]),{name:"transformOrigin",fn(ye){const{elements:Ze,middlewareData:ie,placement:ge,rects:Oe,y:we}=ye,Me=xt(ge),Ke=Ft(Me),et=X.current,Tt=ie.arrow?.x||0,Et=ie.arrow?.y||0,Kt=et?.clientWidth||0,dn=et?.clientHeight||0,Ot=Tt+Kt/2,Er=Et+dn/2,Yi=Math.abs(ie.shift?.y||0),I2=Oe.reference.height/2,ns=typeof o=="function"?o(zf(ye,r,C)):o,N2=Yi>ns,_2={top:`${Ot}px calc(100% + ${ns}px)`,bottom:`${Ot}px ${-ns}px`,left:`calc(100% + ${ns}px) ${Er}px`,right:`${-ns}px ${Er}px`}[Me],A2=`${Ot}px ${Oe.reference.y+I2-we}px`;return Ze.floating.style.setProperty("--transform-origin",le&&Ke==="y"&&N2?A2:_2),{}}},Mx,b),ve(()=>{!g&&p&&p.update({referenceElement:null,floatingElement:null,domReferenceElement:null})},[g,p]);const de=f.useMemo(()=>({elementResize:!d&&typeof ResizeObserver<"u",layoutShift:!d&&typeof IntersectionObserver<"u"}),[d]),{refs:fe,elements:oe,x:ue,y:te,middlewareData:z,update:B,placement:J,context:pe,isPositioned:Se,floatingStyles:Ne}=wx({rootContext:p,placement:D,middleware:ne,strategy:n,whileElementsMounted:h?void 0:(...ye)=>If(...ye,de),nodeId:y,externalTree:x}),{sideX:Fe,sideY:Ie}=z.adaptiveOrigin||qs,be=Se?n:"fixed",Re=f.useMemo(()=>{const ye=b?{position:be,[Fe]:ue,[Ie]:te}:{position:be,...Ne};return Se||(ye.opacity=0),ye},[b,be,Fe,ue,Ie,te,Ne,Se]),Ce=f.useRef(null);ve(()=>{if(!g)return;const ye=R.current,Ze=typeof ye=="function"?ye():ye,ge=(Yf(Ze)?Ze.current:Ze)||null||null;ge!==Ce.current&&(fe.setPositionReference(ge),Ce.current=ge)},[g,fe,_,R]),f.useEffect(()=>{if(!g)return;const ye=R.current;typeof ye!="function"&&Yf(ye)&&ye.current!==Ce.current&&(fe.setPositionReference(ye.current),Ce.current=ye.current)},[g,fe,_,R]),f.useEffect(()=>{if(h&&g&&oe.domReference&&oe.floating)return If(oe.domReference,oe.floating,B,de)},[h,g,oe,B,de]);const Be=xt(J),Qe=Gf(r,Be,C),ct=Mn(J)||"center",Ct=!!z.hide?.referenceHidden;ve(()=>{E&&g&&Se&&T(Be)},[E,g,Se,Be]);const Dt=f.useMemo(()=>({position:"absolute",top:z.arrow?.y,left:z.arrow?.x}),[z.arrow]),jt=z.arrow?.centerOffset!==0;return f.useMemo(()=>({positionerStyles:Re,arrowStyles:Dt,arrowRef:X,arrowUncentered:jt,side:Qe,align:ct,physicalSide:Be,anchorHidden:Ct,refs:fe,context:pe,isPositioned:Se,update:B}),[Re,Dt,X,jt,Qe,ct,Be,Ct,fe,pe,Se,B])}function Yf(e){return e!=null&&"current"in e}let ir=(function(e){return e.open="data-open",e.closed="data-closed",e[e.startingStyle=So.startingStyle]="startingStyle",e[e.endingStyle=So.endingStyle]="endingStyle",e.anchorHidden="data-anchor-hidden",e.side="data-side",e.align="data-align",e})({}),pc=(function(e){return e.popupOpen="data-popup-open",e.pressed="data-pressed",e})({});const Fx={[pc.popupOpen]:""},Vx={[pc.popupOpen]:"",[pc.pressed]:""},Bx={[ir.open]:""},Wx={[ir.closed]:""},jx={[ir.anchorHidden]:""},Zf={open(e){return e?Fx:null}},Hx={open(e){return e?Vx:null}},$r={open(e){return e?Bx:Wx},anchorHidden(e){return e?jx:null}};function qf(e){return e==="starting"?B1:tt}function Xf(){const e=f.useContext(ds);if(!e)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: useToastManager must be used within <Toast.Provider>.":it(73));const t=e.useState("toasts");return f.useMemo(()=>({toasts:t,add:e.addToast,close:e.closeToast,update:e.updateToast,promise:e.promiseToast}),[t,e])}function on(...e){return da(Fu(e))}const Kf={Viewport:"_Viewport_ai81v_1",Toast:"_Toast_ai81v_14"};let Fr=null,Ro=3e3;function Ux({timeout:e}){const t=Xf();return f.useEffect(()=>(Fr=t,Ro=e,()=>{Fr=null}),[t,e]),null}const ar={success:(e,t)=>Fr?.add({description:e,timeout:t?.timeout||Ro}),error:(e,t)=>Fr?.add({description:e,timeout:t?.timeout||Ro}),info:(e,t)=>Fr?.add({description:e,timeout:t?.timeout||Ro}),warning:(e,t)=>Fr?.add({description:e,timeout:t?.timeout||Ro})};function Gx({toastConfigs:e}){const t=e?.timeout??3e3;return O.jsxs(Ld,{timeout:t,children:[O.jsx(Ux,{timeout:t}),O.jsx(zx,{configs:e})]})}function zx({configs:e}){const{toasts:t}=Xf();return O.jsx(Nx,{children:O.jsx(Hd,{className:on(Kf.Viewport,e?.viewportClassName),children:t.map(n=>O.jsx(zd,{toast:n,className:on("pointer-events-none flex items-center justify-center px-6 py-3 min-w-[200px] max-w-[80vw]","text-white text-base rounded-md bg-black/80",Kf.Toast,e?.className),style:e?.style,children:O.jsx(qd,{className:"text-xs",children:n.description})},n.id))})})}class Yx{baseUrl;credentials;interceptors;timeout;onError;headers;constructor({baseUrl:t,timeout:n=1/0,responseInterceptor:r=l=>l.data,requestInterceptor:o=l=>l,onError:s=()=>{},headers:i,credentials:a="include"}){this.baseUrl=t,this.timeout=n,this.credentials=a,this.interceptors={request:o,response:r},this.headers=new Headers({"Content-Type":"application/json",...i}),this.onError=s}async request(t){const n=new AbortController;t.url=`${this.baseUrl}${t.url}`,t=this.interceptors.request(t);const r=new Headers(this.headers);Object.entries(t.headers||{}).forEach(([a,l])=>{r.set(a,l)});const o=this.headers.get("content-type");let s=null;if(t.data instanceof FormData)s=t.data,r.delete("Content-Type");else if(t.data!==void 0&&t.method!=="GET")if(o==="application/x-www-form-urlencoded"){const a=new URLSearchParams;for(const l in t.data)t.data[l]!==void 0&&a.append(l,t.data[l]);s=a.toString()}else s=JSON.stringify(t.data);else if(t.method==="GET"){const a=new URLSearchParams;for(const c in t.data)t.data[c]!==void 0&&a.append(c,t.data[c]);const l=a.toString();t.url+=l?`?${l}`:""}const i=fetch(t.url,{method:t.method,headers:r,body:s,signal:t.signal||n.signal,credentials:this.credentials});try{const a=t.timeout||this.timeout,{timeoutId:l,timeoutPromise:c}=this._setTimeout(a,n),u=await Promise.race([i,c].filter(Boolean));if(l&&clearTimeout(l),u.ok){const d=await u.json();return this.interceptors.response(d,u).catch(h=>(this.onError({data:h,response:u}),Promise.reject(d)))}else{const d=await u.json();return this.onError({data:d,response:u}),Promise.reject(d)}}catch(a){return a.name!=="AbortError"&&this.onError({}),Promise.reject(a)}}_setTimeout(t,n){let r=null,o=null;return t!==1/0&&(o=new Promise((s,i)=>{r=setTimeout(()=>{i(new Error("请求超时")),n.abort()},t)})),{timeoutPromise:o,timeoutId:r}}get(t,n,r){return this.request({...r,url:t,method:"GET",data:n})}post(t,n,r){return this.request({...r,url:t,method:"POST",data:n})}put(t,n,r){return this.request({...r,url:t,method:"PUT",data:n})}delete(t,n){return this.request({...n,url:t,method:"DELETE"})}patch(t,n,r){return this.request({...r,url:t,method:"PATCH",data:n})}}const Fn=new Yx({baseUrl:"https://apis.sdk.mobileztgame.com",credentials:"omit",headers:{"Content-Type":"application/x-www-form-urlencoded"},async responseInterceptor(e,t){if(["/passport-api/v2/ztgame/auth/login","/passport-api/v2/sms-captchas","/passport-api/v2/ztgame/auth/mobile-register"].some(r=>t.url.includes(r)))return e;if(e?.code!==0)throw new Error(e.error);return e},onError({response:e,data:t}){if(e&&e?.status!==401){const n=`${t?.message||t?.detail||"未知错误"}`;ar.error(n)}}}),He={ROLE_ID:"roleid",GIANT:"giant",MOBILE:"mobile",WECHAT:"wx",QQ:"qq",APPLE:"apple"},Xs={default:{types:[He.GIANT,He.MOBILE],default:He.GIANT},5273:{types:[He.ROLE_ID],default:He.ROLE_ID},5199:{types:[He.ROLE_ID],default:He.ROLE_ID},5012:{types:[He.ROLE_ID],default:He.ROLE_ID},5242:{types:[He.GIANT,He.MOBILE],default:He.MOBILE}};function wt(...e){return da(Fu(e))}function Zx(e){return e==="5199"||e==="5012"}function Ks(e,t){return t||Xs[e]?.types||Xs.default?.types||[]}function qx(e,t){return t||Xs[e]?.default||Xs.default?.default}function Jf({loginTypes:e,gameId:t}){return Ks(t,e).includes(He.GIANT)}function Qf({loginTypes:e,gameId:t}){return Ks(t,e).includes(He.ROLE_ID)}function ep({loginTypes:e,gameId:t}){return Ks(t,e).includes(He.MOBILE)}async function Xx({gameId:e}){let t=localStorage.getItem("UNIQUE_ID");t||(t=(await(await w0.load()).get()).visitorId,localStorage.setItem("UNIQUE_ID",t)),Fn.headers.set("X-GAME-ID",e),Fn.headers.set("X-Login-H5","1"),Fn.headers.set("X-Client-Info",JSON.stringify({sdk_version:"3.0.0",device_udid:t,appunid:t}))}const Kx=[{code:"86",name:"中国大陆"},{code:"886",name:"台湾地区"},{code:"852",name:"香港特别行政区"},{code:"853",name:"澳门特别行政区"},{code:"1",name:"美国"},{code:"81",name:"日本"},{code:"376",name:"安道尔"},{code:"971",name:"阿拉伯联合酋长国"},{code:"93",name:"阿富汗"},{code:"1268",name:"安提瓜和巴布达"},{code:"1264",name:"安圭拉"},{code:"355",name:"阿尔巴尼亚"},{code:"374",name:"亚美尼亚"},{code:"244",name:"安哥拉"},{code:"54",name:"阿根廷"},{code:"1684",name:"美属萨摩亚"},{code:"43",name:"奥地利"},{code:"61",name:"澳大利亚"},{code:"297",name:"阿鲁巴"},{code:"994",name:"阿塞拜疆"},{code:"387",name:"波斯尼亚和黑塞哥维那"},{code:"1246",name:"巴巴多斯"},{code:"880",name:"孟加拉国"},{code:"32",name:"比利时"},{code:"226",name:"布基纳法索"},{code:"359",name:"保加利亚"},{code:"973",name:"巴林"},{code:"257",name:"布隆迪"},{code:"229",name:"贝宁"},{code:"1441",name:"百慕大群岛"},{code:"673",name:"文莱"},{code:"591",name:"玻利维亚"},{code:"599",name:"荷兰加勒比"},{code:"55",name:"巴西"},{code:"1242",name:"巴哈马"},{code:"975",name:"不丹"},{code:"267",name:"博茨瓦纳"},{code:"375",name:"白俄罗斯"},{code:"501",name:"伯利兹"},{code:"1",name:"加拿大"},{code:"243",name:"刚果民主共和国"},{code:"236",name:"中非共和国"},{code:"242",name:"刚果共和国"},{code:"41",name:"瑞士"},{code:"225",name:"象牙海岸"},{code:"682",name:"库克群岛"},{code:"56",name:"智利"},{code:"237",name:"喀麦隆"},{code:"57",name:"哥伦比亚"},{code:"506",name:"哥斯达黎加"},{code:"53",name:"古巴"},{code:"238",name:"开普"},{code:"599",name:"库拉索"},{code:"357",name:"塞浦路斯"},{code:"420",name:"捷克"},{code:"49",name:"德国"},{code:"253",name:"吉布提"},{code:"45",name:"丹麦"},{code:"1767",name:"多米尼加"},{code:"1809",name:"多米尼加共和国"},{code:"213",name:"阿尔及利亚"},{code:"593",name:"厄瓜多尔"},{code:"372",name:"爱沙尼亚"},{code:"20",name:"埃及"},{code:"291",name:"厄立特里亚"},{code:"34",name:"西班牙"},{code:"251",name:"埃塞俄比亚"},{code:"358",name:"芬兰"},{code:"679",name:"斐济"},{code:"691",name:"密克罗尼西亚"},{code:"298",name:"法罗群岛"},{code:"33",name:"法国"},{code:"241",name:"加蓬"},{code:"44",name:"英国"},{code:"1473",name:"格林纳达"},{code:"995",name:"格鲁吉亚"},{code:"594",name:"法属圭亚那"},{code:"233",name:"加纳"},{code:"350",name:"直布罗陀"},{code:"299",name:"格陵兰岛"},{code:"220",name:"冈比亚"},{code:"224",name:"几内亚"},{code:"590",name:"瓜德罗普岛"},{code:"240",name:"赤道几内亚"},{code:"30",name:"希腊"},{code:"502",name:"瓜地马拉"},{code:"1671",name:"关岛"},{code:"245",name:"几内亚比绍共和国"},{code:"592",name:"圭亚那"},{code:"504",name:"洪都拉斯"},{code:"385",name:"克罗地亚"},{code:"509",name:"海地"},{code:"36",name:"匈牙利"},{code:"62",name:"印度尼西亚"},{code:"353",name:"爱尔兰"},{code:"972",name:"以色列"},{code:"91",name:"印度"},{code:"964",name:"伊拉克"},{code:"98",name:"伊朗"},{code:"354",name:"冰岛"},{code:"39",name:"意大利"},{code:"1876",name:"牙买加"},{code:"962",name:"约旦"},{code:"254",name:"肯尼亚"},{code:"996",name:"吉尔吉斯斯坦"},{code:"855",name:"柬埔寨"},{code:"686",name:"基里巴斯"},{code:"269",name:"科摩罗"},{code:"1869",name:"圣基茨和尼维斯"},{code:"850",name:"朝鲜"},{code:"82",name:"韩国"},{code:"965",name:"科威特"},{code:"1345",name:"开曼群岛"},{code:"7",name:"哈萨克斯坦"},{code:"856",name:"老挝"},{code:"961",name:"黎巴嫩"},{code:"1758",name:"圣露西亚"},{code:"423",name:"列支敦士登"},{code:"94",name:"斯里兰卡"},{code:"231",name:"利比里亚"},{code:"266",name:"莱索托"},{code:"370",name:"立陶宛"},{code:"352",name:"卢森堡"},{code:"371",name:"拉脱维亚"},{code:"218",name:"利比亚"},{code:"212",name:"摩洛哥"},{code:"377",name:"摩纳哥"},{code:"373",name:"摩尔多瓦"},{code:"382",name:"黑山"},{code:"261",name:"马达加斯加"},{code:"692",name:"马绍尔群岛"},{code:"389",name:"马其顿"},{code:"223",name:"马里"},{code:"95",name:"缅甸"},{code:"976",name:"蒙古"},{code:"222",name:"毛里塔尼亚"},{code:"1664",name:"蒙特塞拉特岛"},{code:"356",name:"马耳他"},{code:"230",name:"毛里求斯"},{code:"960",name:"马尔代夫"},{code:"265",name:"马拉维"},{code:"52",name:"墨西哥"},{code:"60",name:"马来西亚"},{code:"258",name:"莫桑比克"},{code:"264",name:"纳米比亚"},{code:"687",name:"新喀里多尼亚"},{code:"227",name:"尼日尔"},{code:"234",name:"尼日利亚"},{code:"505",name:"尼加拉瓜"},{code:"31",name:"荷兰"},{code:"47",name:"挪威"},{code:"977",name:"尼泊尔"},{code:"674",name:"拿鲁岛"},{code:"64",name:"新西兰"},{code:"968",name:"阿曼"},{code:"507",name:"巴拿马"},{code:"51",name:"秘鲁"},{code:"689",name:"法属波利尼西亚"},{code:"675",name:"巴布亚新几内亚"},{code:"63",name:"菲律宾"},{code:"92",name:"巴基斯坦"},{code:"48",name:"波兰"},{code:"508",name:"圣彼埃尔和密克隆岛"},{code:"1787",name:"波多黎各"},{code:"351",name:"葡萄牙"},{code:"680",name:"帕劳"},{code:"595",name:"巴拉圭"},{code:"974",name:"卡塔尔"},{code:"262",name:"留尼汪"},{code:"40",name:"罗马尼亚"},{code:"381",name:"塞尔维亚"},{code:"7",name:"俄罗斯"},{code:"250",name:"卢旺达"},{code:"966",name:"沙特阿拉伯"},{code:"677",name:"所罗门群岛"},{code:"248",name:"塞舌尔"},{code:"249",name:"苏丹"},{code:"46",name:"瑞典"},{code:"65",name:"新加坡"},{code:"386",name:"斯洛文尼亚"},{code:"421",name:"斯洛伐克"},{code:"232",name:"塞拉利昂"},{code:"378",name:"圣马力诺"},{code:"221",name:"塞内加尔"},{code:"252",name:"索马里"},{code:"597",name:"苏里南"},{code:"239",name:"圣多美和普林西比"},{code:"503",name:"萨尔瓦多"},{code:"963",name:"叙利亚"},{code:"268",name:"斯威士兰"},{code:"1649",name:"特克斯和凯科斯群岛"},{code:"235",name:"乍得"},{code:"228",name:"多哥"},{code:"66",name:"泰国"},{code:"992",name:"塔吉克斯坦"},{code:"670",name:"东帝汶"},{code:"993",name:"土库曼斯坦"},{code:"216",name:"突尼斯"},{code:"676",name:"汤加"},{code:"90",name:"土耳其"},{code:"1868",name:"特立尼达和多巴哥"},{code:"255",name:"坦桑尼亚"},{code:"380",name:"乌克兰"},{code:"256",name:"乌干达"},{code:"598",name:"乌拉圭"},{code:"998",name:"乌兹别克斯坦"},{code:"1784",name:"圣文森特和格林纳丁斯"},{code:"58",name:"委内瑞拉"},{code:"1284",name:"英属处女群岛"},{code:"84",name:"越南"},{code:"678",name:"瓦努阿图"},{code:"685",name:"萨摩亚"},{code:"967",name:"也门"},{code:"269",name:"马约特"},{code:"27",name:"南非"},{code:"260",name:"赞比亚"},{code:"263",name:"津巴布韦"}].map(e=>({label:e.name,value:e.code})),tp=W.createContext(void 0),Jx={enabled:!0,days:7},np={"--primary-color":"#787bf4","--icon-color":"#a9aad1","--input-border-color":"#cad0e0","--input-label-color":"var(--jssdk-primary-color)","--input-bg-color":"#fff"};function Po(){const e=W.use(tp);if(!e)throw new Error("useConfig 必须在 ConfigProvider 中使用");return e}function rp({children:e,value:t}){const n=Ks(t.gameId,t.loginTypes),r=qx(t.gameId,t.defaultLoginType),o=W.useRef(null),[s,i]=W.useState(r),[a,l]=W.useState(!0);W.useEffect(()=>{Xx({gameId:t.gameId})},[t.gameId]);const c={...t,loginTypes:n,defaultLoginType:r,autoLoginConfig:{...Jx,...t.autoLoginConfig}};W.useEffect(()=>{t.gameId&&document.body.classList.add(`game-${t.gameId}`)},[t.gameId]);function u(d){Object.entries(d).forEach(([h,p])=>{const g=`--jssdk-${h.replace(/^--/,"")}`;document.documentElement.style.setProperty(g,p)})}return W.useEffect(()=>{const d=o.current;if(d){const h={...np,...t.styleVars};u(h)}return()=>{d&&u(np)}},[t.styleVars]),O.jsx("div",{ref:o,children:O.jsx(tp,{value:{...c,currentLoginType:s,setCurrentLoginType:i,isShowGiantLogo:a,setIsShowGiantLogo:l},children:e})})}function op({controlled:e,default:t,name:n,state:r="value"}){const{current:o}=f.useRef(e!==void 0),[s,i]=f.useState(t),a=o?e:s;if(process.env.NODE_ENV!=="production"){f.useEffect(()=>{o!==(e!==void 0)&&console.error([`Base UI: A component is changing the ${o?"":"un"}controlled ${r} state of ${n} to be ${o?"un":""}controlled.`,"Elements should not switch from uncontrolled to controlled (or vice versa).",`Decide between using a controlled or uncontrolled ${n} element for the lifetime of the component.`,"The nature of the state is determined during the first render. It's considered controlled if the value is not `undefined`.","More info: https://fb.me/react-controlled-components"].join(`
|
|
17
17
|
`))},[r,n,e]);const{current:c}=f.useRef(t);f.useEffect(()=>{!o&&JSON.stringify(c)!==JSON.stringify(t)&&console.error([`Base UI: A component is changing the default ${r} state of an uncontrolled ${n} after being initialized. To suppress this warning opt to use a controlled ${n}.`].join(`
|
|
18
18
|
`))},[JSON.stringify(t)])}const l=f.useCallback(c=>{o||i(c)},[]);return[a,l]}function It(e){return rr(e,"base-ui")}const sp="ArrowUp",ip="ArrowDown",ap="ArrowLeft",cp="ArrowRight",lp="Home",up="End",Qx=new Set([ap,cp]),eS=new Set([sp,ip]),tS=new Set([...Qx,...eS]);[...tS];const dp=new Set([sp,ip,ap,cp,lp,up]);let fp={},pp={},hp="";function nS(e){if(typeof document>"u")return!1;const t=Ae(e);return nt(t).innerWidth-t.documentElement.clientWidth>0}function rS(e){if(!(typeof CSS<"u"&&CSS.supports&&CSS.supports("scrollbar-gutter","stable"))||typeof document>"u")return!1;const n=Ae(e),r=n.documentElement,o=n.body,s=Dn(r)?r:o,i=s.style.overflowY,a=r.style.scrollbarGutter;r.style.scrollbarGutter="stable",s.style.overflowY="scroll";const l=s.offsetWidth;s.style.overflowY="hidden";const c=s.offsetWidth;return s.style.overflowY=i,r.style.scrollbarGutter=a,l===c}function oS(e){const t=Ae(e),n=t.documentElement,r=t.body,o=Dn(n)?n:r,s={overflowY:o.style.overflowY,overflowX:o.style.overflowX};return Object.assign(o.style,{overflowY:"hidden",overflowX:"hidden"}),()=>{Object.assign(o.style,s)}}function sS(e){const t=Ae(e),n=t.documentElement,r=t.body,o=nt(n);let s=0,i=0,a=!1;const l=Nn.create();if(dd&&(o.visualViewport?.scale??1)!==1)return()=>{};function c(){const h=o.getComputedStyle(n),p=o.getComputedStyle(r),v=(h.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";s=n.scrollTop,i=n.scrollLeft,fp={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},hp=n.style.scrollBehavior,pp={position:r.style.position,height:r.style.height,width:r.style.width,boxSizing:r.style.boxSizing,overflowY:r.style.overflowY,overflowX:r.style.overflowX,scrollBehavior:r.style.scrollBehavior};const y=n.scrollHeight>n.clientHeight,b=n.scrollWidth>n.clientWidth,E=h.overflowY==="scroll"||p.overflowY==="scroll",x=h.overflowX==="scroll"||p.overflowX==="scroll",w=Math.max(0,o.innerWidth-r.clientWidth),T=Math.max(0,o.innerHeight-r.clientHeight),S=parseFloat(p.marginTop)+parseFloat(p.marginBottom),I=parseFloat(p.marginLeft)+parseFloat(p.marginRight),A=Dn(n)?n:r;if(a=rS(e),a){n.style.scrollbarGutter=v,A.style.overflowY="hidden",A.style.overflowX="hidden";return}Object.assign(n.style,{scrollbarGutter:v,overflowY:"hidden",overflowX:"hidden"}),(y||E)&&(n.style.overflowY="scroll"),(b||x)&&(n.style.overflowX="scroll"),Object.assign(r.style,{position:"relative",height:S||T?`calc(100dvh - ${S+T}px)`:"100dvh",width:I||w?`calc(100vw - ${I+w}px)`:"100vw",boxSizing:"border-box",overflow:"hidden",scrollBehavior:"unset"}),r.scrollTop=s,r.scrollLeft=i,n.setAttribute("data-base-ui-scroll-locked",""),n.style.scrollBehavior="unset"}function u(){Object.assign(n.style,fp),Object.assign(r.style,pp),a||(n.scrollTop=s,n.scrollLeft=i,n.removeAttribute("data-base-ui-scroll-locked"),n.style.scrollBehavior=hp)}function d(){u(),l.request(c)}return c(),o.addEventListener("resize",d),()=>{l.cancel(),u(),typeof o.removeEventListener=="function"&&o.removeEventListener("resize",d)}}let iS=class{lockCount=0;restore=null;timeoutLock=zt.create();timeoutUnlock=zt.create();acquire(t){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(t)),this.release}release=()=>{this.lockCount-=1,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(t){if(this.lockCount===0||this.restore!==null)return;const r=Ae(t).documentElement,o=nt(r).getComputedStyle(r).overflowY;if(o==="hidden"||o==="clip"){this.restore=mt;return}const s=fd||!nS(t);this.restore=s?oS(t):sS(t)}};const aS=new iS;function mp(e=!0,t=null){ve(()=>{if(e)return aS.acquire(t)},[e,t])}function cS(e){const t=f.useRef(""),n=f.useCallback(o=>{o.defaultPrevented||(t.current=o.pointerType,e(o,o.pointerType))},[e]);return{onClick:f.useCallback(o=>{if(o.detail===0){e(o,"keyboard");return}"pointerType"in o?e(o,o.pointerType):e(o,t.current),t.current=""},[e]),onPointerDown:n}}function hc(e,t){const n=f.useRef(e),r=me(t);ve(()=>{n.current!==e&&r(n.current)},[e,r]),ve(()=>{n.current=e},[e])}function gp(e){const[t,n]=f.useState(null),r=me((i,a)=>{e||n(a||(fd?"touch":""))});hc(e,i=>{i&&!e&&n(null)});const{onClick:o,onPointerDown:s}=cS(r);return f.useMemo(()=>({openMethod:t,triggerProps:{onClick:o,onPointerDown:s}}),[t,o,s])}function lS(e){const{store:t,parentContext:n,actionsRef:r}=e,o=t.useState("open"),s=t.useState("disablePointerDismissal"),i=t.useState("modal"),a=t.useState("popupElement"),{openMethod:l,triggerProps:c}=gp(o);Df(t);const{forceUnmount:u}=Mf(o,t),d=me(A=>{const L=Ye(A);return L.preventUnmountOnClose=()=>{t.set("preventUnmountingOnClose",!0)},L}),h=f.useCallback(()=>{t.setOpen(!1,d(tf))},[t,d]);f.useImperativeHandle(r,()=>({unmount:u,close:h}),[u,h]);const p=Ff({popupStore:t,onOpenChange:t.setOpen,treatPopupAsFloatingElement:!0,noEmit:!0}),[g,m]=f.useState(0),v=g===0,y=Wf(p),b=gf(p,{outsidePressEvent(){return t.context.internalBackdropRef.current||t.context.backdropRef.current?"intentional":{mouse:i==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress(A){if(!t.context.outsidePressEnabledRef.current||"button"in A&&A.button!==0||"touches"in A&&A.touches.length!==1)return!1;const L=gt(A);if(v&&!s){const M=L;return i&&(t.context.internalBackdropRef.current||t.context.backdropRef.current)?t.context.internalBackdropRef.current===M||t.context.backdropRef.current===M||ke(M,a)&&!M?.hasAttribute("data-base-ui-portal"):!0}return!1},escapeKey:v});mp(o&&i===!0,a);const{getReferenceProps:E,getFloatingProps:x,getTriggerProps:w}=Us([y,b]);t.useContextCallback("onNestedDialogOpen",A=>{m(A+1)}),t.useContextCallback("onNestedDialogClose",()=>{m(0)}),f.useEffect(()=>(n?.onNestedDialogOpen&&o&&n.onNestedDialogOpen(g),n?.onNestedDialogClose&&!o&&n.onNestedDialogClose(),()=>{n?.onNestedDialogClose&&o&&n.onNestedDialogClose()}),[o,n,g]);const T=f.useMemo(()=>E(c),[E,c]),S=f.useMemo(()=>w(c),[w,c]),I=f.useMemo(()=>x(),[x]);t.useSyncedValues({openMethod:l,activeTriggerProps:T,inactiveTriggerProps:S,popupProps:I,floatingRootContext:p,nestedOpenDialogCount:g})}const mc=f.createContext(void 0);process.env.NODE_ENV!=="production"&&(mc.displayName="DialogRootContext");function Vn(e){const t=f.useContext(mc);if(e===!1&&t===void 0)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: DialogRootContext is missing. Dialog parts must be placed within <Dialog.Root>.":it(27));return t}const uS={...$f,modal:he(e=>e.modal),nested:he(e=>e.nested),nestedOpenDialogCount:he(e=>e.nestedOpenDialogCount),disablePointerDismissal:he(e=>e.disablePointerDismissal),openMethod:he(e=>e.openMethod),descriptionElementId:he(e=>e.descriptionElementId),titleElementId:he(e=>e.titleElementId),viewportElement:he(e=>e.viewportElement),role:he(e=>e.role)};class dS extends vs{constructor(t){super(fS(t),{popupRef:f.createRef(),backdropRef:f.createRef(),internalBackdropRef:f.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:new js,onOpenChange:void 0,onOpenChangeComplete:void 0},uS)}setOpen=(t,n)=>{if(n.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},!t&&n.trigger==null&&this.state.activeTriggerId!=null&&(n.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(t,n),n.isCanceled)return;const r={open:t,nativeEvent:n.event,reason:n.reason,nested:this.state.nested};this.state.floatingRootContext.context.events?.emit("openchange",r);const o={open:t},s=n.trigger?.id??null;(s||t)&&(o.activeTriggerId=s,o.activeTriggerElement=n.trigger??null),this.update(o)}}function fS(e={}){return{...Lf(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,role:"dialog",...e}}const pS={...$r,...tr},vp=f.forwardRef(function(t,n){const{render:r,className:o,forceRender:s=!1,...i}=t,{store:a}=Vn(),l=a.useState("open"),c=a.useState("nested"),u=a.useState("mounted"),d=a.useState("transitionStatus");return ze("div",t,{state:{open:l,transitionStatus:d},ref:[a.context.backdropRef,n],stateAttributesMapping:pS,props:[{role:"presentation",hidden:!u,style:{userSelect:"none",WebkitUserSelect:"none"}},i],enabled:s||!c})});process.env.NODE_ENV!=="production"&&(vp.displayName="DialogBackdrop");const yp=f.forwardRef(function(t,n){const{render:r,className:o,disabled:s=!1,nativeButton:i=!0,...a}=t,{store:l}=Vn(),c=l.useState("open");function u(g){c&&l.setOpen(!1,Ye(fE,g.nativeEvent))}const{getButtonProps:d,buttonRef:h}=Ms({disabled:s,native:i});return ze("button",t,{state:{disabled:s},ref:[n,h],props:[{onClick:u},a,d]})});process.env.NODE_ENV!=="production"&&(yp.displayName="DialogClose");const bp=f.forwardRef(function(t,n){const{render:r,className:o,id:s,...i}=t,{store:a}=Vn(),l=It(s);return a.useSyncedValueWithCleanup("descriptionElementId",l),ze("p",t,{ref:n,props:[{id:l},i]})});process.env.NODE_ENV!=="production"&&(bp.displayName="DialogDescription");let hS=(function(e){return e.nestedDialogs="--nested-dialogs",e})({}),mS=(function(e){return e[e.open=ir.open]="open",e[e.closed=ir.closed]="closed",e[e.startingStyle=ir.startingStyle]="startingStyle",e[e.endingStyle=ir.endingStyle]="endingStyle",e.nested="data-nested",e.nestedDialogOpen="data-nested-dialog-open",e})({});const gc=f.createContext(void 0);process.env.NODE_ENV!=="production"&&(gc.displayName="DialogPortalContext");function gS(){const e=f.useContext(gc);if(e===void 0)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: <Dialog.Portal> is missing.":it(26));return e}const vS={...$r,...tr,nestedDialogOpen(e){return e?{[mS.nestedDialogOpen]:""}:null}},wp=f.forwardRef(function(t,n){const{className:r,finalFocus:o,initialFocus:s,render:i,...a}=t,{store:l}=Vn(),c=l.useState("descriptionElementId"),u=l.useState("disablePointerDismissal"),d=l.useState("floatingRootContext"),h=l.useState("popupProps"),p=l.useState("modal"),g=l.useState("mounted"),m=l.useState("nested"),v=l.useState("nestedOpenDialogCount"),y=l.useState("open"),b=l.useState("openMethod"),E=l.useState("titleElementId"),x=l.useState("transitionStatus"),w=l.useState("role");gS(),Ar({open:y,ref:l.context.popupRef,onComplete(){y&&l.context.onOpenChangeComplete?.(!0)}});function T(M){return M==="touch"?l.context.popupRef.current:!0}const S=s===void 0?T:s,I=v>0,L=ze("div",t,{state:{open:y,nested:m,transitionStatus:x,nestedDialogOpen:I},props:[h,{"aria-labelledby":E??void 0,"aria-describedby":c??void 0,role:w,tabIndex:-1,hidden:!g,onKeyDown(M){dp.has(M.key)&&M.stopPropagation()},style:{[hS.nestedDialogs]:v}},a],ref:[n,l.context.popupRef,l.useStateSetter("popupElement")],stateAttributesMapping:vS});return O.jsx(hf,{context:d,openInteractionType:b,disabled:!g,closeOnFocusOut:!u,initialFocus:S,returnFocus:o,modal:p!==!1,restoreFocus:"popup",children:L})});process.env.NODE_ENV!=="production"&&(wp.displayName="DialogPopup");const vc=f.forwardRef(function(t,n){const{cutout:r,...o}=t;let s;if(r){const i=r?.getBoundingClientRect();s=`polygon(
|
|
19
19
|
0% 0%,
|
|
@@ -86,4 +86,4 @@ If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHid
|
|
|
86
86
|
|
|
87
87
|
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return f.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},sP="DialogDescriptionWarning",iP=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${jg(sP).contentName}}.`;return f.useEffect(()=>{const o=e.current?.getAttribute("aria-describedby");t&&o&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},aP=Ig,cP=_g,lP=Dg,uP=Mg,dP=Lg,fP=Fg;function pP(e){if(typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}const Hg=W.createContext({drawerRef:{current:null},overlayRef:{current:null},onPress:()=>{},onRelease:()=>{},onDrag:()=>{},onNestedDrag:()=>{},onNestedOpenChange:()=>{},onNestedRelease:()=>{},openProp:void 0,dismissible:!1,isOpen:!1,isDragging:!1,keyboardIsOpen:{current:!1},snapPointsOffset:null,snapPoints:null,handleOnly:!1,modal:!1,shouldFade:!1,activeSnapPoint:null,onOpenChange:()=>{},setActiveSnapPoint:()=>{},closeDrawer:()=>{},direction:"bottom",shouldAnimate:{current:!0},shouldScaleBackground:!1,setBackgroundColorOnScale:!0,noBodyStyles:!1,container:null,autoFocus:!1}),qo=()=>{const e=W.useContext(Hg);if(!e)throw new Error("useDrawerContext must be used within a Drawer.Root");return e};pP(`[data-vaul-drawer]{touch-action:none;will-change:transform;transition:transform .5s cubic-bezier(.32, .72, 0, 1);animation-duration:.5s;animation-timing-function:cubic-bezier(0.32,0.72,0,1)}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=bottom][data-state=open]{animation-name:slideFromBottom}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=bottom][data-state=closed]{animation-name:slideToBottom}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=top][data-state=open]{animation-name:slideFromTop}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=top][data-state=closed]{animation-name:slideToTop}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=left][data-state=open]{animation-name:slideFromLeft}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=left][data-state=closed]{animation-name:slideToLeft}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=right][data-state=open]{animation-name:slideFromRight}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=right][data-state=closed]{animation-name:slideToRight}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=bottom]{transform:translate3d(0,var(--initial-transform,100%),0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=top]{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=left]{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=right]{transform:translate3d(var(--initial-transform,100%),0,0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=top]{transform:translate3d(0,var(--snap-point-height,0),0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=bottom]{transform:translate3d(0,var(--snap-point-height,0),0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=left]{transform:translate3d(var(--snap-point-height,0),0,0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=right]{transform:translate3d(var(--snap-point-height,0),0,0)}[data-vaul-overlay][data-vaul-snap-points=false]{animation-duration:.5s;animation-timing-function:cubic-bezier(0.32,0.72,0,1)}[data-vaul-overlay][data-vaul-snap-points=false][data-state=open]{animation-name:fadeIn}[data-vaul-overlay][data-state=closed]{animation-name:fadeOut}[data-vaul-animate=false]{animation:none!important}[data-vaul-overlay][data-vaul-snap-points=true]{opacity:0;transition:opacity .5s cubic-bezier(.32, .72, 0, 1)}[data-vaul-overlay][data-vaul-snap-points=true]{opacity:1}[data-vaul-drawer]:not([data-vaul-custom-container=true])::after{content:'';position:absolute;background:inherit;background-color:inherit}[data-vaul-drawer][data-vaul-drawer-direction=top]::after{top:initial;bottom:100%;left:0;right:0;height:200%}[data-vaul-drawer][data-vaul-drawer-direction=bottom]::after{top:100%;bottom:initial;left:0;right:0;height:200%}[data-vaul-drawer][data-vaul-drawer-direction=left]::after{left:initial;right:100%;top:0;bottom:0;width:200%}[data-vaul-drawer][data-vaul-drawer-direction=right]::after{left:100%;right:initial;top:0;bottom:0;width:200%}[data-vaul-overlay][data-vaul-snap-points=true]:not([data-vaul-snap-points-overlay=true]):not(
|
|
88
88
|
[data-state=closed]
|
|
89
|
-
){opacity:0}[data-vaul-overlay][data-vaul-snap-points-overlay=true]{opacity:1}[data-vaul-handle]{display:block;position:relative;opacity:.7;background:#e2e2e4;margin-left:auto;margin-right:auto;height:5px;width:32px;border-radius:1rem;touch-action:pan-y}[data-vaul-handle]:active,[data-vaul-handle]:hover{opacity:1}[data-vaul-handle-hitarea]{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:max(100%,2.75rem);height:max(100%,2.75rem);touch-action:inherit}@media (hover:hover) and (pointer:fine){[data-vaul-drawer]{user-select:none}}@media (pointer:fine){[data-vaul-handle-hitarea]:{width:100%;height:100%}}@keyframes fadeIn{from{opacity:0}to{opacity:1}}@keyframes fadeOut{to{opacity:0}}@keyframes slideFromBottom{from{transform:translate3d(0,var(--initial-transform,100%),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToBottom{to{transform:translate3d(0,var(--initial-transform,100%),0)}}@keyframes slideFromTop{from{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToTop{to{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}}@keyframes slideFromLeft{from{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToLeft{to{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}}@keyframes slideFromRight{from{transform:translate3d(var(--initial-transform,100%),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToRight{to{transform:translate3d(var(--initial-transform,100%),0,0)}}`);function hP(){const e=navigator.userAgent;return typeof window<"u"&&(/Firefox/.test(e)&&/Mobile/.test(e)||/FxiOS/.test(e))}function mP(){return Nl(/^Mac/)}function gP(){return Nl(/^iPhone/)}function Ug(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function vP(){return Nl(/^iPad/)||mP()&&navigator.maxTouchPoints>1}function Gg(){return gP()||vP()}function Nl(e){return typeof window<"u"&&window.navigator!=null?e.test(window.navigator.platform):void 0}const yP=24,bP=typeof window<"u"?W.useLayoutEffect:W.useEffect;function zg(...e){return(...t)=>{for(let n of e)typeof n=="function"&&n(...t)}}const _l=typeof document<"u"&&window.visualViewport;function Yg(e){let t=window.getComputedStyle(e);return/(auto|scroll)/.test(t.overflow+t.overflowX+t.overflowY)}function Zg(e){for(Yg(e)&&(e=e.parentElement);e&&!Yg(e);)e=e.parentElement;return e||document.scrollingElement||document.documentElement}const wP=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);let Vi=0,Al;function EP(e={}){let{isDisabled:t}=e;bP(()=>{if(!t)return Vi++,Vi===1&&Gg()&&(Al=xP()),()=>{Vi--,Vi===0&&Al?.()}},[t])}function xP(){let e,t=0,n=d=>{e=Zg(d.target),!(e===document.documentElement&&e===document.body)&&(t=d.changedTouches[0].pageY)},r=d=>{if(!e||e===document.documentElement||e===document.body){d.preventDefault();return}let h=d.changedTouches[0].pageY,p=e.scrollTop,g=e.scrollHeight-e.clientHeight;g!==0&&((p<=0&&h>t||p>=g&&h<t)&&d.preventDefault(),t=h)},o=d=>{let h=d.target;Dl(h)&&h!==document.activeElement&&(d.preventDefault(),h.style.transform="translateY(-2000px)",h.focus(),requestAnimationFrame(()=>{h.style.transform=""}))},s=d=>{let h=d.target;Dl(h)&&(h.style.transform="translateY(-2000px)",requestAnimationFrame(()=>{h.style.transform="",_l&&(_l.height<window.innerHeight?requestAnimationFrame(()=>{qg(h)}):_l.addEventListener("resize",()=>qg(h),{once:!0}))}))},i=()=>{window.scrollTo(0,0)},a=window.pageXOffset,l=window.pageYOffset,c=zg(SP(document.documentElement,"paddingRight",`${window.innerWidth-document.documentElement.clientWidth}px`));window.scrollTo(0,0);let u=zg(Xo(document,"touchstart",n,{passive:!1,capture:!0}),Xo(document,"touchmove",r,{passive:!1,capture:!0}),Xo(document,"touchend",o,{passive:!1,capture:!0}),Xo(document,"focus",s,!0),Xo(window,"scroll",i));return()=>{c(),u(),window.scrollTo(a,l)}}function SP(e,t,n){let r=e.style[t];return e.style[t]=n,()=>{e.style[t]=r}}function Xo(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function qg(e){let t=document.scrollingElement||document.documentElement;for(;e&&e!==t;){let n=Zg(e);if(n!==document.documentElement&&n!==document.body&&n!==e){let r=n.getBoundingClientRect().top,o=e.getBoundingClientRect().top,s=e.getBoundingClientRect().bottom;const i=n.getBoundingClientRect().bottom+yP;s>i&&(n.scrollTop+=o-r)}e=n.parentElement}}function Dl(e){return e instanceof HTMLInputElement&&!wP.has(e.type)||e instanceof HTMLTextAreaElement||e instanceof HTMLElement&&e.isContentEditable}function CP(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function TP(...e){return t=>e.forEach(n=>CP(n,t))}function Xg(...e){return f.useCallback(TP(...e),e)}const Kg=new WeakMap;function at(e,t,n=!1){if(!e||!(e instanceof HTMLElement))return;let r={};Object.entries(t).forEach(([o,s])=>{if(o.startsWith("--")){e.style.setProperty(o,s);return}r[o]=e.style[o],e.style[o]=s}),!n&&Kg.set(e,r)}function OP(e,t){if(!e||!(e instanceof HTMLElement))return;let n=Kg.get(e);n&&(e.style[t]=n[t])}const ot=e=>{switch(e){case"top":case"bottom":return!0;case"left":case"right":return!1;default:return e}};function Bi(e,t){if(!e)return null;const n=window.getComputedStyle(e),r=n.transform||n.webkitTransform||n.mozTransform;let o=r.match(/^matrix3d\((.+)\)$/);return o?parseFloat(o[1].split(", ")[ot(t)?13:12]):(o=r.match(/^matrix\((.+)\)$/),o?parseFloat(o[1].split(", ")[ot(t)?5:4]):null)}function kP(e){return 8*(Math.log(e+1)-2)}function Ml(e,t){if(!e)return()=>{};const n=e.style.cssText;return Object.assign(e.style,t),()=>{e.style.cssText=n}}function RP(...e){return(...t)=>{for(const n of e)typeof n=="function"&&n(...t)}}const Xe={DURATION:.5,EASE:[.32,.72,0,1]},Jg=.4,PP=.25,IP=100,Qg=8,yr=16,Ll=26,$l="vaul-dragging";function ev(e){const t=W.useRef(e);return W.useEffect(()=>{t.current=e}),W.useMemo(()=>(...n)=>t.current==null?void 0:t.current.call(t,...n),[])}function NP({defaultProp:e,onChange:t}){const n=W.useState(e),[r]=n,o=W.useRef(r),s=ev(t);return W.useEffect(()=>{o.current!==r&&(s(r),o.current=r)},[r,o,s]),n}function tv({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,o]=NP({defaultProp:t,onChange:n}),s=e!==void 0,i=s?e:r,a=ev(n),l=W.useCallback(c=>{if(s){const d=typeof c=="function"?c(e):c;d!==e&&a(d)}else o(c)},[s,e,o,a]);return[i,l]}function _P({activeSnapPointProp:e,setActiveSnapPointProp:t,snapPoints:n,drawerRef:r,overlayRef:o,fadeFromIndex:s,onSnapPointChange:i,direction:a="bottom",container:l,snapToSequentialPoint:c}){const[u,d]=tv({prop:e,defaultProp:n?.[0],onChange:t}),[h,p]=W.useState(typeof window<"u"?{innerWidth:window.innerWidth,innerHeight:window.innerHeight}:void 0);W.useEffect(()=>{function S(){p({innerWidth:window.innerWidth,innerHeight:window.innerHeight})}return window.addEventListener("resize",S),()=>window.removeEventListener("resize",S)},[]);const g=W.useMemo(()=>u===n?.[n.length-1]||null,[n,u]),m=W.useMemo(()=>{var S;return(S=n?.findIndex(I=>I===u))!=null?S:null},[n,u]),v=n&&n.length>0&&(s||s===0)&&!Number.isNaN(s)&&n[s]===u||!n,y=W.useMemo(()=>{const S=l?{width:l.getBoundingClientRect().width,height:l.getBoundingClientRect().height}:typeof window<"u"?{width:window.innerWidth,height:window.innerHeight}:{width:0,height:0};var I;return(I=n?.map(A=>{const L=typeof A=="string";let M=0;if(L&&(M=parseInt(A,10)),ot(a)){const R=L?M:h?A*S.height:0;return h?a==="bottom"?S.height-R:-S.height+R:R}const _=L?M:h?A*S.width:0;return h?a==="right"?S.width-_:-S.width+_:_}))!=null?I:[]},[n,h,l]),b=W.useMemo(()=>m!==null?y?.[m]:null,[y,m]),E=W.useCallback(S=>{var I;const A=(I=y?.findIndex(L=>L===S))!=null?I:null;i(A),at(r.current,{transition:`transform ${Xe.DURATION}s cubic-bezier(${Xe.EASE.join(",")})`,transform:ot(a)?`translate3d(0, ${S}px, 0)`:`translate3d(${S}px, 0, 0)`}),y&&A!==y.length-1&&s!==void 0&&A!==s&&A<s?at(o.current,{transition:`opacity ${Xe.DURATION}s cubic-bezier(${Xe.EASE.join(",")})`,opacity:"0"}):at(o.current,{transition:`opacity ${Xe.DURATION}s cubic-bezier(${Xe.EASE.join(",")})`,opacity:"1"}),d(n?.[Math.max(A,0)])},[r.current,n,y,s,o,d]);W.useEffect(()=>{if(u||e){var S;const I=(S=n?.findIndex(A=>A===e||A===u))!=null?S:-1;y&&I!==-1&&typeof y[I]=="number"&&E(y[I])}},[u,e,n,y,E]);function x({draggedDistance:S,closeDrawer:I,velocity:A,dismissible:L}){if(s===void 0)return;const M=a==="bottom"||a==="right"?(b??0)-S:(b??0)+S,_=m===s-1,R=m===0,P=S>0;if(_&&at(o.current,{transition:`opacity ${Xe.DURATION}s cubic-bezier(${Xe.EASE.join(",")})`}),!c&&A>2&&!P){L?I():E(y[0]);return}if(!c&&A>2&&P&&y&&n){E(y[n.length-1]);return}const C=y?.reduce((D,k)=>typeof D!="number"||typeof k!="number"?D:Math.abs(k-M)<Math.abs(D-M)?k:D),N=ot(a)?window.innerHeight:window.innerWidth;if(A>Jg&&Math.abs(S)<N*.4){const D=P?1:-1;if(D>0&&g&&n){E(y[n.length-1]);return}if(R&&D<0&&L&&I(),m===null)return;E(y[m+D]);return}E(C)}function w({draggedDistance:S}){if(b===null)return;const I=a==="bottom"||a==="right"?b-S:b+S;(a==="bottom"||a==="right")&&I<y[y.length-1]||(a==="top"||a==="left")&&I>y[y.length-1]||at(r.current,{transform:ot(a)?`translate3d(0, ${I}px, 0)`:`translate3d(${I}px, 0, 0)`})}function T(S,I){if(!n||typeof m!="number"||!y||s===void 0)return null;const A=m===s-1;if(m>=s&&I)return 0;if(A&&!I)return 1;if(!v&&!A)return null;const M=A?m+1:m-1,_=A?y[M]-y[M-1]:y[M+1]-y[M],R=S/Math.abs(_);return A?1-R:R}return{isLastSnapPoint:g,activeSnapPoint:u,shouldFade:v,getPercentageDragged:T,setActiveSnapPoint:d,activeSnapPointIndex:m,onRelease:x,onDrag:w,snapPointsOffset:y}}const AP=()=>()=>{};function DP(){const{direction:e,isOpen:t,shouldScaleBackground:n,setBackgroundColorOnScale:r,noBodyStyles:o}=qo(),s=W.useRef(null),i=W.useMemo(()=>document.body.style.backgroundColor,[]);function a(){return(window.innerWidth-Ll)/window.innerWidth}W.useEffect(()=>{if(t&&n){s.current&&clearTimeout(s.current);const l=document.querySelector("[data-vaul-drawer-wrapper]")||document.querySelector("[vaul-drawer-wrapper]");if(!l)return;RP(r&&!o?Ml(document.body,{background:"black"}):AP,Ml(l,{transformOrigin:ot(e)?"top":"left",transitionProperty:"transform, border-radius",transitionDuration:`${Xe.DURATION}s`,transitionTimingFunction:`cubic-bezier(${Xe.EASE.join(",")})`}));const c=Ml(l,{borderRadius:`${Qg}px`,overflow:"hidden",...ot(e)?{transform:`scale(${a()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`}:{transform:`scale(${a()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`}});return()=>{c(),s.current=window.setTimeout(()=>{i?document.body.style.background=i:document.body.style.removeProperty("background")},Xe.DURATION*1e3)}}},[t,n,i])}let Ko=null;function MP({isOpen:e,modal:t,nested:n,hasBeenOpened:r,preventScrollRestoration:o,noBodyStyles:s}){const[i,a]=W.useState(()=>typeof window<"u"?window.location.href:""),l=W.useRef(0),c=W.useCallback(()=>{if(Ug()&&Ko===null&&e&&!s){Ko={position:document.body.style.position,top:document.body.style.top,left:document.body.style.left,height:document.body.style.height,right:"unset"};const{scrollX:d,innerHeight:h}=window;document.body.style.setProperty("position","fixed","important"),Object.assign(document.body.style,{top:`${-l.current}px`,left:`${-d}px`,right:"0px",height:"auto"}),window.setTimeout(()=>window.requestAnimationFrame(()=>{const p=h-window.innerHeight;p&&l.current>=h&&(document.body.style.top=`${-(l.current+p)}px`)}),300)}},[e]),u=W.useCallback(()=>{if(Ug()&&Ko!==null&&!s){const d=-parseInt(document.body.style.top,10),h=-parseInt(document.body.style.left,10);Object.assign(document.body.style,Ko),window.requestAnimationFrame(()=>{if(o&&i!==window.location.href){a(window.location.href);return}window.scrollTo(h,d)}),Ko=null}},[i]);return W.useEffect(()=>{function d(){l.current=window.scrollY}return d(),window.addEventListener("scroll",d),()=>{window.removeEventListener("scroll",d)}},[]),W.useEffect(()=>{if(t)return()=>{typeof document>"u"||document.querySelector("[data-vaul-drawer]")||u()}},[t,u]),W.useEffect(()=>{n||!r||(e?(!window.matchMedia("(display-mode: standalone)").matches&&c(),t||window.setTimeout(()=>{u()},500)):u())},[e,r,i,t,n,c,u]),{restorePositionSetting:u}}function LP({open:e,onOpenChange:t,children:n,onDrag:r,onRelease:o,snapPoints:s,shouldScaleBackground:i=!1,setBackgroundColorOnScale:a=!0,closeThreshold:l=PP,scrollLockTimeout:c=IP,dismissible:u=!0,handleOnly:d=!1,fadeFromIndex:h=s&&s.length-1,activeSnapPoint:p,setActiveSnapPoint:g,fixed:m,modal:v=!0,onClose:y,nested:b,noBodyStyles:E=!1,direction:x="bottom",defaultOpen:w=!1,disablePreventScroll:T=!0,snapToSequentialPoint:S=!1,preventScrollRestoration:I=!1,repositionInputs:A=!0,onAnimationEnd:L,container:M,autoFocus:_=!1}){var R,P;const[C=!1,N]=tv({defaultProp:w,prop:e,onChange:ie=>{t?.(ie),!ie&&!b&&Ie(),setTimeout(()=>{L?.(ie)},Xe.DURATION*1e3),ie&&!v&&typeof window<"u"&&window.requestAnimationFrame(()=>{document.body.style.pointerEvents="auto"}),ie||(document.body.style.pointerEvents="auto")}}),[D,k]=W.useState(!1),[$,F]=W.useState(!1),[j,V]=W.useState(!1),Y=W.useRef(null),q=W.useRef(null),X=W.useRef(null),U=W.useRef(null),H=W.useRef(null),Z=W.useRef(!1),re=W.useRef(null),ne=W.useRef(0),ee=W.useRef(!1),le=W.useRef(!w),K=W.useRef(0),G=W.useRef(null),de=W.useRef(((R=G.current)==null?void 0:R.getBoundingClientRect().height)||0),fe=W.useRef(((P=G.current)==null?void 0:P.getBoundingClientRect().width)||0),oe=W.useRef(0),ue=W.useCallback(ie=>{s&&ie===pe.length-1&&(q.current=new Date)},[]),{activeSnapPoint:te,activeSnapPointIndex:z,setActiveSnapPoint:B,onRelease:J,snapPointsOffset:pe,onDrag:Se,shouldFade:Ne,getPercentageDragged:Fe}=_P({snapPoints:s,activeSnapPointProp:p,setActiveSnapPointProp:g,drawerRef:G,fadeFromIndex:h,overlayRef:Y,onSnapPointChange:ue,direction:x,container:M,snapToSequentialPoint:S});EP({isDisabled:!C||$||!v||j||!D||!A||!T});const{restorePositionSetting:Ie}=MP({isOpen:C,modal:v,nested:b??!1,hasBeenOpened:D,preventScrollRestoration:I,noBodyStyles:E});function be(){return(window.innerWidth-Ll)/window.innerWidth}function Re(ie){var ge,Oe;!u&&!s||G.current&&!G.current.contains(ie.target)||(de.current=((ge=G.current)==null?void 0:ge.getBoundingClientRect().height)||0,fe.current=((Oe=G.current)==null?void 0:Oe.getBoundingClientRect().width)||0,F(!0),X.current=new Date,Gg()&&window.addEventListener("touchend",()=>Z.current=!1,{once:!0}),ie.target.setPointerCapture(ie.pointerId),ne.current=ot(x)?ie.pageY:ie.pageX)}function Ce(ie,ge){var Oe;let we=ie;const Me=(Oe=window.getSelection())==null?void 0:Oe.toString(),Ke=G.current?Bi(G.current,x):null,et=new Date;if(we.tagName==="SELECT"||we.hasAttribute("data-vaul-no-drag")||we.closest("[data-vaul-no-drag]"))return!1;if(x==="right"||x==="left")return!0;if(q.current&&et.getTime()-q.current.getTime()<500)return!1;if(Ke!==null&&(x==="bottom"?Ke>0:Ke<0))return!0;if(Me&&Me.length>0)return!1;if(H.current&&et.getTime()-H.current.getTime()<c&&Ke===0||ge)return H.current=et,!1;for(;we;){if(we.scrollHeight>we.clientHeight){if(we.scrollTop!==0)return H.current=new Date,!1;if(we.getAttribute("role")==="dialog")return!0}we=we.parentNode}return!0}function Be(ie){if(G.current&&$){const ge=x==="bottom"||x==="right"?1:-1,Oe=(ne.current-(ot(x)?ie.pageY:ie.pageX))*ge,we=Oe>0,Me=s&&!u&&!we;if(Me&&z===0)return;const Ke=Math.abs(Oe),et=document.querySelector("[data-vaul-drawer-wrapper]"),Tt=x==="bottom"||x==="top"?de.current:fe.current;let Et=Ke/Tt;const Kt=Fe(Ke,we);if(Kt!==null&&(Et=Kt),Me&&Et>=1||!Z.current&&!Ce(ie.target,we))return;if(G.current.classList.add($l),Z.current=!0,at(G.current,{transition:"none"}),at(Y.current,{transition:"none"}),s&&Se({draggedDistance:Oe}),we&&!s){const Ot=kP(Oe),Er=Math.min(Ot*-1,0)*ge;at(G.current,{transform:ot(x)?`translate3d(0, ${Er}px, 0)`:`translate3d(${Er}px, 0, 0)`});return}const dn=1-Et;if((Ne||h&&z===h-1)&&(r?.(ie,Et),at(Y.current,{opacity:`${dn}`,transition:"none"},!0)),et&&Y.current&&i){const Ot=Math.min(be()+Et*(1-be()),1),Er=8-Et*8,Yi=Math.max(0,14-Et*14);at(et,{borderRadius:`${Er}px`,transform:ot(x)?`scale(${Ot}) translate3d(0, ${Yi}px, 0)`:`scale(${Ot}) translate3d(${Yi}px, 0, 0)`,transition:"none"},!0)}if(!s){const Ot=Ke*ge;at(G.current,{transform:ot(x)?`translate3d(0, ${Ot}px, 0)`:`translate3d(${Ot}px, 0, 0)`})}}}W.useEffect(()=>{window.requestAnimationFrame(()=>{le.current=!0})},[]),W.useEffect(()=>{var ie;function ge(){if(!G.current||!A)return;const Oe=document.activeElement;if(Dl(Oe)||ee.current){var we;const Me=((we=window.visualViewport)==null?void 0:we.height)||0,Ke=window.innerHeight;let et=Ke-Me;const Tt=G.current.getBoundingClientRect().height||0,Et=Tt>Ke*.8;oe.current||(oe.current=Tt);const Kt=G.current.getBoundingClientRect().top;if(Math.abs(K.current-et)>60&&(ee.current=!ee.current),s&&s.length>0&&pe&&z){const dn=pe[z]||0;et+=dn}if(K.current=et,Tt>Me||ee.current){const dn=G.current.getBoundingClientRect().height;let Ot=dn;dn>Me&&(Ot=Me-(Et?Kt:Ll)),m?G.current.style.height=`${dn-Math.max(et,0)}px`:G.current.style.height=`${Math.max(Ot,Me-Kt)}px`}else hP()||(G.current.style.height=`${oe.current}px`);s&&s.length>0&&!ee.current?G.current.style.bottom="0px":G.current.style.bottom=`${Math.max(et,0)}px`}}return(ie=window.visualViewport)==null||ie.addEventListener("resize",ge),()=>{var Oe;return(Oe=window.visualViewport)==null?void 0:Oe.removeEventListener("resize",ge)}},[z,s,pe]);function Qe(ie){Ct(),y?.(),ie||N(!1),setTimeout(()=>{s&&B(s[0])},Xe.DURATION*1e3)}function ct(){if(!G.current)return;const ie=document.querySelector("[data-vaul-drawer-wrapper]"),ge=Bi(G.current,x);at(G.current,{transform:"translate3d(0, 0, 0)",transition:`transform ${Xe.DURATION}s cubic-bezier(${Xe.EASE.join(",")})`}),at(Y.current,{transition:`opacity ${Xe.DURATION}s cubic-bezier(${Xe.EASE.join(",")})`,opacity:"1"}),i&&ge&&ge>0&&C&&at(ie,{borderRadius:`${Qg}px`,overflow:"hidden",...ot(x)?{transform:`scale(${be()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,transformOrigin:"top"}:{transform:`scale(${be()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`,transformOrigin:"left"},transitionProperty:"transform, border-radius",transitionDuration:`${Xe.DURATION}s`,transitionTimingFunction:`cubic-bezier(${Xe.EASE.join(",")})`},!0)}function Ct(){!$||!G.current||(G.current.classList.remove($l),Z.current=!1,F(!1),U.current=new Date)}function Dt(ie){if(!$||!G.current)return;G.current.classList.remove($l),Z.current=!1,F(!1),U.current=new Date;const ge=Bi(G.current,x);if(!ie||!Ce(ie.target,!1)||!ge||Number.isNaN(ge)||X.current===null)return;const Oe=U.current.getTime()-X.current.getTime(),we=ne.current-(ot(x)?ie.pageY:ie.pageX),Me=Math.abs(we)/Oe;if(Me>.05&&(V(!0),setTimeout(()=>{V(!1)},200)),s){J({draggedDistance:we*(x==="bottom"||x==="right"?1:-1),closeDrawer:Qe,velocity:Me,dismissible:u}),o?.(ie,!0);return}if(x==="bottom"||x==="right"?we>0:we<0){ct(),o?.(ie,!0);return}if(Me>Jg){Qe(),o?.(ie,!1);return}var Ke;const et=Math.min((Ke=G.current.getBoundingClientRect().height)!=null?Ke:0,window.innerHeight);var Tt;const Et=Math.min((Tt=G.current.getBoundingClientRect().width)!=null?Tt:0,window.innerWidth),Kt=x==="left"||x==="right";if(Math.abs(ge)>=(Kt?Et:et)*l){Qe(),o?.(ie,!1);return}o?.(ie,!0),ct()}W.useEffect(()=>(C&&(at(document.documentElement,{scrollBehavior:"auto"}),q.current=new Date),()=>{OP(document.documentElement,"scrollBehavior")}),[C]);function jt(ie){const ge=ie?(window.innerWidth-yr)/window.innerWidth:1,Oe=ie?-yr:0;re.current&&window.clearTimeout(re.current),at(G.current,{transition:`transform ${Xe.DURATION}s cubic-bezier(${Xe.EASE.join(",")})`,transform:ot(x)?`scale(${ge}) translate3d(0, ${Oe}px, 0)`:`scale(${ge}) translate3d(${Oe}px, 0, 0)`}),!ie&&G.current&&(re.current=setTimeout(()=>{const we=Bi(G.current,x);at(G.current,{transition:"none",transform:ot(x)?`translate3d(0, ${we}px, 0)`:`translate3d(${we}px, 0, 0)`})},500))}function ye(ie,ge){if(ge<0)return;const Oe=(window.innerWidth-yr)/window.innerWidth,we=Oe+ge*(1-Oe),Me=-yr+ge*yr;at(G.current,{transform:ot(x)?`scale(${we}) translate3d(0, ${Me}px, 0)`:`scale(${we}) translate3d(${Me}px, 0, 0)`,transition:"none"})}function Ze(ie,ge){const Oe=ot(x)?window.innerHeight:window.innerWidth,we=ge?(Oe-yr)/Oe:1,Me=ge?-yr:0;ge&&at(G.current,{transition:`transform ${Xe.DURATION}s cubic-bezier(${Xe.EASE.join(",")})`,transform:ot(x)?`scale(${we}) translate3d(0, ${Me}px, 0)`:`scale(${we}) translate3d(${Me}px, 0, 0)`})}return W.useEffect(()=>{v||window.requestAnimationFrame(()=>{document.body.style.pointerEvents="auto"})},[v]),W.createElement(aP,{defaultOpen:w,onOpenChange:ie=>{!u&&!ie||(ie?k(!0):Qe(!0),N(ie))},open:C},W.createElement(Hg.Provider,{value:{activeSnapPoint:te,snapPoints:s,setActiveSnapPoint:B,drawerRef:G,overlayRef:Y,onOpenChange:t,onPress:Re,onRelease:Dt,onDrag:Be,dismissible:u,shouldAnimate:le,handleOnly:d,isOpen:C,isDragging:$,shouldFade:Ne,closeDrawer:Qe,onNestedDrag:ye,onNestedOpenChange:jt,onNestedRelease:Ze,keyboardIsOpen:ee,modal:v,snapPointsOffset:pe,activeSnapPointIndex:z,direction:x,shouldScaleBackground:i,setBackgroundColorOnScale:a,noBodyStyles:E,container:M,autoFocus:_}},n))}const nv=W.forwardRef(function({...e},t){const{overlayRef:n,snapPoints:r,onRelease:o,shouldFade:s,isOpen:i,modal:a,shouldAnimate:l}=qo(),c=Xg(t,n),u=r&&r.length>0;if(!a)return null;const d=W.useCallback(h=>o(h),[o]);return W.createElement(uP,{onMouseUp:d,ref:c,"data-vaul-overlay":"","data-vaul-snap-points":i&&u?"true":"false","data-vaul-snap-points-overlay":i&&s?"true":"false","data-vaul-animate":l?.current?"true":"false",...e})});nv.displayName="Drawer.Overlay";const rv=W.forwardRef(function({onPointerDownOutside:e,style:t,onOpenAutoFocus:n,...r},o){const{drawerRef:s,onPress:i,onRelease:a,onDrag:l,keyboardIsOpen:c,snapPointsOffset:u,activeSnapPointIndex:d,modal:h,isOpen:p,direction:g,snapPoints:m,container:v,handleOnly:y,shouldAnimate:b,autoFocus:E}=qo(),[x,w]=W.useState(!1),T=Xg(o,s),S=W.useRef(null),I=W.useRef(null),A=W.useRef(!1),L=m&&m.length>0;DP();const M=(R,P,C=0)=>{if(A.current)return!0;const N=Math.abs(R.y),D=Math.abs(R.x),k=D>N,$=["bottom","right"].includes(P)?1:-1;if(P==="left"||P==="right"){if(!(R.x*$<0)&&D>=0&&D<=C)return k}else if(!(R.y*$<0)&&N>=0&&N<=C)return!k;return A.current=!0,!0};W.useEffect(()=>{L&&window.requestAnimationFrame(()=>{w(!0)})},[]);function _(R){S.current=null,A.current=!1,a(R)}return W.createElement(dP,{"data-vaul-drawer-direction":g,"data-vaul-drawer":"","data-vaul-delayed-snap-points":x?"true":"false","data-vaul-snap-points":p&&L?"true":"false","data-vaul-custom-container":v?"true":"false","data-vaul-animate":b?.current?"true":"false",...r,ref:T,style:u&&u.length>0?{"--snap-point-height":`${u[d??0]}px`,...t}:t,onPointerDown:R=>{y||(r.onPointerDown==null||r.onPointerDown.call(r,R),S.current={x:R.pageX,y:R.pageY},i(R))},onOpenAutoFocus:R=>{n?.(R),E||R.preventDefault()},onPointerDownOutside:R=>{if(e?.(R),!h||R.defaultPrevented){R.preventDefault();return}c.current&&(c.current=!1)},onFocusOutside:R=>{if(!h){R.preventDefault();return}},onPointerMove:R=>{if(I.current=R,y||(r.onPointerMove==null||r.onPointerMove.call(r,R),!S.current))return;const P=R.pageY-S.current.y,C=R.pageX-S.current.x,N=R.pointerType==="touch"?10:2;M({x:C,y:P},g,N)?l(R):(Math.abs(C)>N||Math.abs(P)>N)&&(S.current=null)},onPointerUp:R=>{r.onPointerUp==null||r.onPointerUp.call(r,R),S.current=null,A.current=!1,a(R)},onPointerOut:R=>{r.onPointerOut==null||r.onPointerOut.call(r,R),_(I.current)},onContextMenu:R=>{r.onContextMenu==null||r.onContextMenu.call(r,R),I.current&&_(I.current)}})});rv.displayName="Drawer.Content";const $P=250,FP=120,VP=W.forwardRef(function({preventCycle:e=!1,children:t,...n},r){const{closeDrawer:o,isDragging:s,snapPoints:i,activeSnapPoint:a,setActiveSnapPoint:l,dismissible:c,handleOnly:u,isOpen:d,onPress:h,onDrag:p}=qo(),g=W.useRef(null),m=W.useRef(!1);function v(){if(m.current){E();return}window.setTimeout(()=>{y()},FP)}function y(){if(s||e||m.current){E();return}if(E(),!i||i.length===0){c||o();return}if(a===i[i.length-1]&&c){o();return}const w=i.findIndex(S=>S===a);if(w===-1)return;const T=i[w+1];l(T)}function b(){g.current=window.setTimeout(()=>{m.current=!0},$P)}function E(){g.current&&window.clearTimeout(g.current),m.current=!1}return W.createElement("div",{onClick:v,onPointerCancel:E,onPointerDown:x=>{u&&h(x),b()},onPointerMove:x=>{u&&p(x)},ref:r,"data-vaul-drawer-visible":d?"true":"false","data-vaul-handle":"","aria-hidden":"true",...n},W.createElement("span",{"data-vaul-handle-hitarea":"","aria-hidden":"true"},t))});VP.displayName="Drawer.Handle";function BP(e){const t=qo(),{container:n=t.container,...r}=e;return W.createElement(lP,{container:n,...r})}const Qr={Root:LP,Content:rv,Overlay:nv,Trigger:cP,Portal:BP,Title:fP};function ov({trigger:e,title:t,description:n,children:r,open:o,showCloseIcon:s=!0,onOpenChange:i,zIndex:a,classNames:l}){return Rk("(min-width: 1024px)")?O.jsxs(Bm,{open:o,onOpenChange:i,dismissible:!1,children:[e&&O.jsx(jm,{className:l?.trigger,children:e}),O.jsxs(pk,{children:[O.jsx(Lm,{style:{zIndex:a},className:"fixed inset-0 bg-black/70 transition-all duration-150 data-[ending-style]:opacity-0 data-[starting-style]:opacity-0 dark:opacity-70 z-[990] backdrop-blur-sm"}),O.jsxs(Vm,{style:{zIndex:a},className:on("fixed top-1/2 left-1/2 w-96 max-w-[calc(100vw-3rem)] -translate-x-1/2 -translate-y-1/2 rounded-lg bg-gray-50 p-4 text-gray-900 transition-all duration-150 data-[ending-style]:scale-90 data-[ending-style]:opacity-0 data-[starting-style]:scale-90 data-[starting-style]:opacity-0 z-[991]",l?.desktopPopup),children:[t&&O.jsx(Wm,{className:on("-mt-1.5 mb-1 text-lg font-medium",l?.title),children:t}),n&&O.jsx(Fm,{className:on("mb-6 text-base text-gray-600",l?.description),children:n}),s&&O.jsx($m,{className:"absolute right-4 top-4 text-gray-700 hover:bg-gray-200 rounded p-0.5",children:O.jsx(Zp,{})}),O.jsx("div",{children:r})]})]})]}):O.jsxs(Qr.Root,{open:o,onOpenChange:i,children:[e&&O.jsx(Qr.Trigger,{className:l?.trigger,children:e}),O.jsxs(Qr.Portal,{children:[O.jsx(Qr.Overlay,{style:{zIndex:a},className:on("fixed inset-0 bg-black/70 transition-all duration-150 data-[ending-style]:opacity-0 data-[starting-style]:opacity-0 dark:opacity-70 z-[990] backdrop-blur-sm",l?.backdrop)}),O.jsxs(Qr.Content,{style:{zIndex:a},className:on("h-fit fixed bottom-0 left-0 right-0 outline-none z-[991]",l?.mobilePopup),children:[O.jsx(Qr.Title,{className:"hidden"}),O.jsxs("div",{className:"p-4 bg-white rounded-t-xl",children:[O.jsx("div",{"aria-hidden":!0,className:"mx-auto w-12 h-1.5 flex-shrink-0 rounded-full bg-gray-300 mb-4"}),O.jsx("div",{children:r})]})]})]})]})}function sv({checked:e,onChange:t}){const[n,r]=W.useState(!1),[o,s]=W.useState(!1);return O.jsxs("div",{children:[O.jsx(ov,{title:"用户协议",open:n,onOpenChange:r,zIndex:993,classNames:{desktopPopup:"w-[90vw] lg:w-[60vw]"},children:O.jsx("iframe",{src:"https://help.gamm.ztgame.com/license-light.html",className:"w-full h-[70vh]"})}),O.jsx(ov,{title:"隐私政策",open:o,onOpenChange:s,zIndex:993,classNames:{desktopPopup:"w-[90vw] lg:w-[60vw]"},children:O.jsx("iframe",{src:"https://help.gamm.ztgame.com/privacy-light.html",className:"w-full h-[70vh]"})}),O.jsx(wn,{name:"rememberLogin",children:O.jsxs(Tc,{className:"flex items-center justify-center text-gray-500 text-xs md:text-sm",children:[O.jsx(Sc,{checked:e,className:"size-4 md:size-5 flex items-center justify-center rounded-full border-2 data-[checked]:border-[var(--jssdk-primary-color)] data-[unchecked]:border-[var(--jssdk-input-border-color)]",onCheckedChange:i=>t(!!i),children:O.jsx(Cc,{children:O.jsx(Nc,{className:"size-3 text-[var(--jssdk-primary-color)]",strokeWidth:4})})}),O.jsx("span",{className:"ml-2",children:"我已详细阅读并同意"}),O.jsx(lr,{className:"text-[var(--jssdk-primary-color)]",onClick:()=>r(!0),type:"button",children:"《用户协议》"}),O.jsx("span",{children:"及"}),O.jsx(lr,{className:"text-[var(--jssdk-primary-color)]",onClick:()=>s(!0),type:"button",children:"《隐私政策》"})]})})]})}function WP(){const{gameId:e,onAccountLoginSuccess:t,onLoginSuccess:n,onLoginError:r}=Po(),o=W.useRef(null),[s,i]=W.useState(""),[a,l]=W.useState(""),[c,u]=W.useState(!1),[d,h]=W.useState(!0),{mutate:p,isPending:g}=ao({mutationFn:()=>nC({account:s,password:a}),onSuccess:v=>{t?.(v),n?.(v)},onError:v=>{r?.(v)}});async function m(v){if(v.preventDefault(),!d){ar.warning("请先阅读并同意用户协议和隐私政策");return}if(!s||!a){ar.warning("请输入账号和密码");return}p()}return O.jsxs(ei,{ref:o,onSubmit:m,className:"space-y-5",children:[O.jsxs(wn,{name:"account",className:"flex items-center border border-[var(--jssdk-input-border-color)] rounded-full bg-white px-3 gap-2 h-12",children:[O.jsx(aC,{className:"size-5 text-gray-400"}),O.jsx(cr,{className:"flex-1 outline-none rounded-full h-full pl-1",placeholder:"请输入巨人通行证账号",autoFocus:!0,onChange:v=>i(v.currentTarget.value)})]}),O.jsxs(wn,{name:"password",className:"flex items-center border border-[var(--jssdk-input-border-color)] rounded-full bg-white px-3 gap-2 h-12",children:[O.jsx(cC,{className:"size-5 text-gray-400"}),O.jsx(cr,{type:c?"text":"password",autoComplete:"off",className:"flex-1 w-0 outline-none rounded-full h-full pl-1",placeholder:"请输入密码",value:a,onValueChange:v=>l(v)}),O.jsx(lr,{onClick:()=>u(!c),type:"button",children:c?O.jsx(JS,{className:"size-5 text-gray-400"}):O.jsx(KS,{className:"size-5 text-gray-400"})})]}),O.jsxs("section",{children:[O.jsx("div",{className:"flex justify-end mb-1",children:O.jsx(lr,{className:"text-[var(--jssdk-primary-color)]",as:"a",href:"https://my.ztgame.com/plugin/pwd",children:"忘记密码"})}),O.jsx(lr,{className:"h-10 w-full text-white bg-gradient-to-r from-[#497efe] to-[#947afa] rounded-full shadow-lg",type:"submit",disabled:g,children:"登录"})]}),O.jsx(_c,{}),O.jsx(sv,{checked:d,onChange:h})]})}var jP=function(e){return typeof e=="number"};function HP(e){var t=W.useRef(e);return t.current=e,t}var Wi={exports:{}},UP=Wi.exports,iv;function GP(){return iv||(iv=1,(function(e,t){(function(n,r){e.exports=r()})(UP,(function(){var n=1e3,r=6e4,o=36e5,s="millisecond",i="second",a="minute",l="hour",c="day",u="week",d="month",h="quarter",p="year",g="date",m="Invalid Date",v=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,b={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(P){var C=["th","st","nd","rd"],N=P%100;return"["+P+(C[(N-20)%10]||C[N]||C[0])+"]"}},E=function(P,C,N){var D=String(P);return!D||D.length>=C?P:""+Array(C+1-D.length).join(N)+P},x={s:E,z:function(P){var C=-P.utcOffset(),N=Math.abs(C),D=Math.floor(N/60),k=N%60;return(C<=0?"+":"-")+E(D,2,"0")+":"+E(k,2,"0")},m:function P(C,N){if(C.date()<N.date())return-P(N,C);var D=12*(N.year()-C.year())+(N.month()-C.month()),k=C.clone().add(D,d),$=N-k<0,F=C.clone().add(D+($?-1:1),d);return+(-(D+(N-k)/($?k-F:F-k))||0)},a:function(P){return P<0?Math.ceil(P)||0:Math.floor(P)},p:function(P){return{M:d,y:p,w:u,d:c,D:g,h:l,m:a,s:i,ms:s,Q:h}[P]||String(P||"").toLowerCase().replace(/s$/,"")},u:function(P){return P===void 0}},w="en",T={};T[w]=b;var S="$isDayjsObject",I=function(P){return P instanceof _||!(!P||!P[S])},A=function P(C,N,D){var k;if(!C)return w;if(typeof C=="string"){var $=C.toLowerCase();T[$]&&(k=$),N&&(T[$]=N,k=$);var F=C.split("-");if(!k&&F.length>1)return P(F[0])}else{var j=C.name;T[j]=C,k=j}return!D&&k&&(w=k),k||!D&&w},L=function(P,C){if(I(P))return P.clone();var N=typeof C=="object"?C:{};return N.date=P,N.args=arguments,new _(N)},M=x;M.l=A,M.i=I,M.w=function(P,C){return L(P,{locale:C.$L,utc:C.$u,x:C.$x,$offset:C.$offset})};var _=(function(){function P(N){this.$L=A(N.locale,null,!0),this.parse(N),this.$x=this.$x||N.x||{},this[S]=!0}var C=P.prototype;return C.parse=function(N){this.$d=(function(D){var k=D.date,$=D.utc;if(k===null)return new Date(NaN);if(M.u(k))return new Date;if(k instanceof Date)return new Date(k);if(typeof k=="string"&&!/Z$/i.test(k)){var F=k.match(v);if(F){var j=F[2]-1||0,V=(F[7]||"0").substring(0,3);return $?new Date(Date.UTC(F[1],j,F[3]||1,F[4]||0,F[5]||0,F[6]||0,V)):new Date(F[1],j,F[3]||1,F[4]||0,F[5]||0,F[6]||0,V)}}return new Date(k)})(N),this.init()},C.init=function(){var N=this.$d;this.$y=N.getFullYear(),this.$M=N.getMonth(),this.$D=N.getDate(),this.$W=N.getDay(),this.$H=N.getHours(),this.$m=N.getMinutes(),this.$s=N.getSeconds(),this.$ms=N.getMilliseconds()},C.$utils=function(){return M},C.isValid=function(){return this.$d.toString()!==m},C.isSame=function(N,D){var k=L(N);return this.startOf(D)<=k&&k<=this.endOf(D)},C.isAfter=function(N,D){return L(N)<this.startOf(D)},C.isBefore=function(N,D){return this.endOf(D)<L(N)},C.$g=function(N,D,k){return M.u(N)?this[D]:this.set(k,N)},C.unix=function(){return Math.floor(this.valueOf()/1e3)},C.valueOf=function(){return this.$d.getTime()},C.startOf=function(N,D){var k=this,$=!!M.u(D)||D,F=M.p(N),j=function(re,ne){var ee=M.w(k.$u?Date.UTC(k.$y,ne,re):new Date(k.$y,ne,re),k);return $?ee:ee.endOf(c)},V=function(re,ne){return M.w(k.toDate()[re].apply(k.toDate("s"),($?[0,0,0,0]:[23,59,59,999]).slice(ne)),k)},Y=this.$W,q=this.$M,X=this.$D,U="set"+(this.$u?"UTC":"");switch(F){case p:return $?j(1,0):j(31,11);case d:return $?j(1,q):j(0,q+1);case u:var H=this.$locale().weekStart||0,Z=(Y<H?Y+7:Y)-H;return j($?X-Z:X+(6-Z),q);case c:case g:return V(U+"Hours",0);case l:return V(U+"Minutes",1);case a:return V(U+"Seconds",2);case i:return V(U+"Milliseconds",3);default:return this.clone()}},C.endOf=function(N){return this.startOf(N,!1)},C.$set=function(N,D){var k,$=M.p(N),F="set"+(this.$u?"UTC":""),j=(k={},k[c]=F+"Date",k[g]=F+"Date",k[d]=F+"Month",k[p]=F+"FullYear",k[l]=F+"Hours",k[a]=F+"Minutes",k[i]=F+"Seconds",k[s]=F+"Milliseconds",k)[$],V=$===c?this.$D+(D-this.$W):D;if($===d||$===p){var Y=this.clone().set(g,1);Y.$d[j](V),Y.init(),this.$d=Y.set(g,Math.min(this.$D,Y.daysInMonth())).$d}else j&&this.$d[j](V);return this.init(),this},C.set=function(N,D){return this.clone().$set(N,D)},C.get=function(N){return this[M.p(N)]()},C.add=function(N,D){var k,$=this;N=Number(N);var F=M.p(D),j=function(q){var X=L($);return M.w(X.date(X.date()+Math.round(q*N)),$)};if(F===d)return this.set(d,this.$M+N);if(F===p)return this.set(p,this.$y+N);if(F===c)return j(1);if(F===u)return j(7);var V=(k={},k[a]=r,k[l]=o,k[i]=n,k)[F]||1,Y=this.$d.getTime()+N*V;return M.w(Y,this)},C.subtract=function(N,D){return this.add(-1*N,D)},C.format=function(N){var D=this,k=this.$locale();if(!this.isValid())return k.invalidDate||m;var $=N||"YYYY-MM-DDTHH:mm:ssZ",F=M.z(this),j=this.$H,V=this.$m,Y=this.$M,q=k.weekdays,X=k.months,U=k.meridiem,H=function(ne,ee,le,K){return ne&&(ne[ee]||ne(D,$))||le[ee].slice(0,K)},Z=function(ne){return M.s(j%12||12,ne,"0")},re=U||function(ne,ee,le){var K=ne<12?"AM":"PM";return le?K.toLowerCase():K};return $.replace(y,(function(ne,ee){return ee||(function(le){switch(le){case"YY":return String(D.$y).slice(-2);case"YYYY":return M.s(D.$y,4,"0");case"M":return Y+1;case"MM":return M.s(Y+1,2,"0");case"MMM":return H(k.monthsShort,Y,X,3);case"MMMM":return H(X,Y);case"D":return D.$D;case"DD":return M.s(D.$D,2,"0");case"d":return String(D.$W);case"dd":return H(k.weekdaysMin,D.$W,q,2);case"ddd":return H(k.weekdaysShort,D.$W,q,3);case"dddd":return q[D.$W];case"H":return String(j);case"HH":return M.s(j,2,"0");case"h":return Z(1);case"hh":return Z(2);case"a":return re(j,V,!0);case"A":return re(j,V,!1);case"m":return String(V);case"mm":return M.s(V,2,"0");case"s":return String(D.$s);case"ss":return M.s(D.$s,2,"0");case"SSS":return M.s(D.$ms,3,"0");case"Z":return F}return null})(ne)||F.replace(":","")}))},C.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},C.diff=function(N,D,k){var $,F=this,j=M.p(D),V=L(N),Y=(V.utcOffset()-this.utcOffset())*r,q=this-V,X=function(){return M.m(F,V)};switch(j){case p:$=X()/12;break;case d:$=X();break;case h:$=X()/3;break;case u:$=(q-Y)/6048e5;break;case c:$=(q-Y)/864e5;break;case l:$=q/o;break;case a:$=q/r;break;case i:$=q/n;break;default:$=q}return k?$:M.a($)},C.daysInMonth=function(){return this.endOf(d).$D},C.$locale=function(){return T[this.$L]},C.locale=function(N,D){if(!N)return this.$L;var k=this.clone(),$=A(N,D,!0);return $&&(k.$L=$),k},C.clone=function(){return M.w(this.$d,this)},C.toDate=function(){return new Date(this.valueOf())},C.toJSON=function(){return this.isValid()?this.toISOString():null},C.toISOString=function(){return this.$d.toISOString()},C.toString=function(){return this.$d.toUTCString()},P})(),R=_.prototype;return L.prototype=R,[["$ms",s],["$s",i],["$m",a],["$H",l],["$W",c],["$M",d],["$y",p],["$D",g]].forEach((function(P){R[P[1]]=function(C){return this.$g(C,P[0],P[1])}})),L.extend=function(P,C){return P.$i||(P(C,_,L),P.$i=!0),L},L.locale=A,L.isDayjs=I,L.unix=function(P){return L(1e3*P)},L.en=T[w],L.Ls=T,L.p={},L}))})(Wi)),Wi.exports}var zP=GP();const YP=bw(zP);var Fl=function(e){if(!e)return 0;var t=YP(e).valueOf()-Date.now();return t<0?0:t},ZP=function(e){return{days:Math.floor(e/864e5),hours:Math.floor(e/36e5)%24,minutes:Math.floor(e/6e4)%60,seconds:Math.floor(e/1e3)%60,milliseconds:Math.floor(e)%1e3}},qP=function(e){e===void 0&&(e={});var t=e||{},n=t.leftTime,r=t.targetDate,o=t.interval,s=o===void 0?1e3:o,i=t.onEnd,a=W.useMemo(function(){return jP(n)&&n>0?Date.now()+n:void 0},[n]),l="leftTime"in e?a:r,c=ly(W.useState(function(){return Fl(l)}),2),u=c[0],d=c[1],h=HP(i);W.useEffect(function(){if(!l){d(0);return}d(Fl(l));var g=setInterval(function(){var m,v=Fl(l);d(v),v===0&&(clearInterval(g),(m=h.current)===null||m===void 0||m.call(h))},s);return function(){return clearInterval(g)}},[l,s]);var p=W.useMemo(function(){return ZP(u)},[u]);return[u,p]},De;(function(e){e.assertEqual=o=>{};function t(o){}e.assertIs=t;function n(o){throw new Error}e.assertNever=n,e.arrayToEnum=o=>{const s={};for(const i of o)s[i]=i;return s},e.getValidEnumValues=o=>{const s=e.objectKeys(o).filter(a=>typeof o[o[a]]!="number"),i={};for(const a of s)i[a]=o[a];return e.objectValues(i)},e.objectValues=o=>e.objectKeys(o).map(function(s){return o[s]}),e.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{const s=[];for(const i in o)Object.prototype.hasOwnProperty.call(o,i)&&s.push(i);return s},e.find=(o,s)=>{for(const i of o)if(s(i))return i},e.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function r(o,s=" | "){return o.map(i=>typeof i=="string"?`'${i}'`:i).join(s)}e.joinValues=r,e.jsonStringifyReplacer=(o,s)=>typeof s=="bigint"?s.toString():s})(De||(De={}));var av;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(av||(av={}));const ae=De.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Zn=e=>{switch(typeof e){case"undefined":return ae.undefined;case"string":return ae.string;case"number":return Number.isNaN(e)?ae.nan:ae.number;case"boolean":return ae.boolean;case"function":return ae.function;case"bigint":return ae.bigint;case"symbol":return ae.symbol;case"object":return Array.isArray(e)?ae.array:e===null?ae.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?ae.promise:typeof Map<"u"&&e instanceof Map?ae.map:typeof Set<"u"&&e instanceof Set?ae.set:typeof Date<"u"&&e instanceof Date?ae.date:ae.object;default:return ae.unknown}},Q=De.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class kn extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}format(t){const n=t||function(s){return s.message},r={_errors:[]},o=s=>{for(const i of s.issues)if(i.code==="invalid_union")i.unionErrors.map(o);else if(i.code==="invalid_return_type")o(i.returnTypeError);else if(i.code==="invalid_arguments")o(i.argumentsError);else if(i.path.length===0)r._errors.push(n(i));else{let a=r,l=0;for(;l<i.path.length;){const c=i.path[l];l===i.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(n(i))):a[c]=a[c]||{_errors:[]},a=a[c],l++}}};return o(this),r}static assert(t){if(!(t instanceof kn))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,De.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=n=>n.message){const n={},r=[];for(const o of this.issues)if(o.path.length>0){const s=o.path[0];n[s]=n[s]||[],n[s].push(t(o))}else r.push(t(o));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}kn.create=e=>new kn(e);const Vl=(e,t)=>{let n;switch(e.code){case Q.invalid_type:e.received===ae.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case Q.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,De.jsonStringifyReplacer)}`;break;case Q.unrecognized_keys:n=`Unrecognized key(s) in object: ${De.joinValues(e.keys,", ")}`;break;case Q.invalid_union:n="Invalid input";break;case Q.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${De.joinValues(e.options)}`;break;case Q.invalid_enum_value:n=`Invalid enum value. Expected ${De.joinValues(e.options)}, received '${e.received}'`;break;case Q.invalid_arguments:n="Invalid function arguments";break;case Q.invalid_return_type:n="Invalid function return type";break;case Q.invalid_date:n="Invalid date";break;case Q.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:De.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case Q.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case Q.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case Q.custom:n="Invalid input";break;case Q.invalid_intersection_types:n="Intersection results could not be merged";break;case Q.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case Q.not_finite:n="Number must be finite";break;default:n=t.defaultError,De.assertNever(e)}return{message:n}};let XP=Vl;function KP(){return XP}const JP=e=>{const{data:t,path:n,errorMaps:r,issueData:o}=e,s=[...n,...o.path||[]],i={...o,path:s};if(o.message!==void 0)return{...o,path:s,message:o.message};let a="";const l=r.filter(c=>!!c).slice().reverse();for(const c of l)a=c(i,{data:t,defaultError:a}).message;return{...o,path:s,message:a}};function se(e,t){const n=KP(),r=JP({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===Vl?void 0:Vl].filter(o=>!!o)});e.common.issues.push(r)}class At{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){const r=[];for(const o of n){if(o.status==="aborted")return Ee;o.status==="dirty"&&t.dirty(),r.push(o.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,n){const r=[];for(const o of n){const s=await o.key,i=await o.value;r.push({key:s,value:i})}return At.mergeObjectSync(t,r)}static mergeObjectSync(t,n){const r={};for(const o of n){const{key:s,value:i}=o;if(s.status==="aborted"||i.status==="aborted")return Ee;s.status==="dirty"&&t.dirty(),i.status==="dirty"&&t.dirty(),s.value!=="__proto__"&&(typeof i.value<"u"||o.alwaysSet)&&(r[s.value]=i.value)}return{status:t.value,value:r}}}const Ee=Object.freeze({status:"aborted"}),Jo=e=>({status:"dirty",value:e}),Wt=e=>({status:"valid",value:e}),cv=e=>e.status==="aborted",lv=e=>e.status==="dirty",eo=e=>e.status==="valid",ji=e=>typeof Promise<"u"&&e instanceof Promise;var ce;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(ce||(ce={}));class qn{constructor(t,n,r,o){this._cachedPath=[],this.parent=t,this.data=n,this._path=r,this._key=o}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const uv=(e,t)=>{if(eo(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new kn(e.common.issues);return this._error=n,this._error}}};function Pe(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:o}=e;if(t&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:o}:{errorMap:(i,a)=>{const{message:l}=e;return i.code==="invalid_enum_value"?{message:l??a.defaultError}:typeof a.data>"u"?{message:l??r??a.defaultError}:i.code!=="invalid_type"?{message:a.defaultError}:{message:l??n??a.defaultError}},description:o}}class _e{get description(){return this._def.description}_getType(t){return Zn(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:Zn(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new At,ctx:{common:t.parent.common,data:t.data,parsedType:Zn(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(ji(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){const n=this._parse(t);return Promise.resolve(n)}parse(t,n){const r=this.safeParse(t,n);if(r.success)return r.data;throw r.error}safeParse(t,n){const r={common:{issues:[],async:n?.async??!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Zn(t)},o=this._parseSync({data:t,path:r.path,parent:r});return uv(r,o)}"~validate"(t){const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Zn(t)};if(!this["~standard"].async)try{const r=this._parseSync({data:t,path:[],parent:n});return eo(r)?{value:r.value}:{issues:n.common.issues}}catch(r){r?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:n}).then(r=>eo(r)?{value:r.value}:{issues:n.common.issues})}async parseAsync(t,n){const r=await this.safeParseAsync(t,n);if(r.success)return r.data;throw r.error}async safeParseAsync(t,n){const r={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Zn(t)},o=this._parse({data:t,path:r.path,parent:r}),s=await(ji(o)?o:Promise.resolve(o));return uv(r,s)}refine(t,n){const r=o=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(o):n;return this._refinement((o,s)=>{const i=t(o),a=()=>s.addIssue({code:Q.custom,...r(o)});return typeof Promise<"u"&&i instanceof Promise?i.then(l=>l?!0:(a(),!1)):i?!0:(a(),!1)})}refinement(t,n){return this._refinement((r,o)=>t(r)?!0:(o.addIssue(typeof n=="function"?n(r,o):n),!1))}_refinement(t){return new ro({schema:this,typeName:xe.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return Jn.create(this,this._def)}nullable(){return oo.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return un.create(this)}promise(){return zi.create(this,this._def)}or(t){return Ui.create([this,t],this._def)}and(t){return Gi.create(this,t,this._def)}transform(t){return new ro({...Pe(this._def),schema:this,typeName:xe.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new jl({...Pe(this._def),innerType:this,defaultValue:n,typeName:xe.ZodDefault})}brand(){return new E2({typeName:xe.ZodBranded,type:this,...Pe(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new Hl({...Pe(this._def),innerType:this,catchValue:n,typeName:xe.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return Ul.create(this,t)}readonly(){return Gl.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const QP=/^c[^\s-]{8,}$/i,e2=/^[0-9a-z]+$/,t2=/^[0-9A-HJKMNP-TV-Z]{26}$/i,n2=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,r2=/^[a-z0-9_-]{21}$/i,o2=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,s2=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,i2=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,a2="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Bl;const c2=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,l2=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,u2=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,d2=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,f2=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,p2=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,dv="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",h2=new RegExp(`^${dv}$`);function fv(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);const n=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function m2(e){return new RegExp(`^${fv(e)}$`)}function g2(e){let t=`${dv}T${fv(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function v2(e,t){return!!((t==="v4"||!t)&&c2.test(e)||(t==="v6"||!t)&&u2.test(e))}function y2(e,t){if(!o2.test(e))return!1;try{const[n]=e.split(".");if(!n)return!1;const r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),o=JSON.parse(atob(r));return!(typeof o!="object"||o===null||"typ"in o&&o?.typ!=="JWT"||!o.alg||t&&o.alg!==t)}catch{return!1}}function b2(e,t){return!!((t==="v4"||!t)&&l2.test(e)||(t==="v6"||!t)&&d2.test(e))}class Xn extends _e{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==ae.string){const s=this._getOrReturnCtx(t);return se(s,{code:Q.invalid_type,expected:ae.string,received:s.parsedType}),Ee}const r=new At;let o;for(const s of this._def.checks)if(s.kind==="min")t.data.length<s.value&&(o=this._getOrReturnCtx(t,o),se(o,{code:Q.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="max")t.data.length>s.value&&(o=this._getOrReturnCtx(t,o),se(o,{code:Q.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="length"){const i=t.data.length>s.value,a=t.data.length<s.value;(i||a)&&(o=this._getOrReturnCtx(t,o),i?se(o,{code:Q.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):a&&se(o,{code:Q.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),r.dirty())}else if(s.kind==="email")i2.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"email",code:Q.invalid_string,message:s.message}),r.dirty());else if(s.kind==="emoji")Bl||(Bl=new RegExp(a2,"u")),Bl.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"emoji",code:Q.invalid_string,message:s.message}),r.dirty());else if(s.kind==="uuid")n2.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"uuid",code:Q.invalid_string,message:s.message}),r.dirty());else if(s.kind==="nanoid")r2.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"nanoid",code:Q.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid")QP.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"cuid",code:Q.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid2")e2.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"cuid2",code:Q.invalid_string,message:s.message}),r.dirty());else if(s.kind==="ulid")t2.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"ulid",code:Q.invalid_string,message:s.message}),r.dirty());else if(s.kind==="url")try{new URL(t.data)}catch{o=this._getOrReturnCtx(t,o),se(o,{validation:"url",code:Q.invalid_string,message:s.message}),r.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"regex",code:Q.invalid_string,message:s.message}),r.dirty())):s.kind==="trim"?t.data=t.data.trim():s.kind==="includes"?t.data.includes(s.value,s.position)||(o=this._getOrReturnCtx(t,o),se(o,{code:Q.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),r.dirty()):s.kind==="toLowerCase"?t.data=t.data.toLowerCase():s.kind==="toUpperCase"?t.data=t.data.toUpperCase():s.kind==="startsWith"?t.data.startsWith(s.value)||(o=this._getOrReturnCtx(t,o),se(o,{code:Q.invalid_string,validation:{startsWith:s.value},message:s.message}),r.dirty()):s.kind==="endsWith"?t.data.endsWith(s.value)||(o=this._getOrReturnCtx(t,o),se(o,{code:Q.invalid_string,validation:{endsWith:s.value},message:s.message}),r.dirty()):s.kind==="datetime"?g2(s).test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{code:Q.invalid_string,validation:"datetime",message:s.message}),r.dirty()):s.kind==="date"?h2.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{code:Q.invalid_string,validation:"date",message:s.message}),r.dirty()):s.kind==="time"?m2(s).test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{code:Q.invalid_string,validation:"time",message:s.message}),r.dirty()):s.kind==="duration"?s2.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"duration",code:Q.invalid_string,message:s.message}),r.dirty()):s.kind==="ip"?v2(t.data,s.version)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"ip",code:Q.invalid_string,message:s.message}),r.dirty()):s.kind==="jwt"?y2(t.data,s.alg)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"jwt",code:Q.invalid_string,message:s.message}),r.dirty()):s.kind==="cidr"?b2(t.data,s.version)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"cidr",code:Q.invalid_string,message:s.message}),r.dirty()):s.kind==="base64"?f2.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"base64",code:Q.invalid_string,message:s.message}),r.dirty()):s.kind==="base64url"?p2.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"base64url",code:Q.invalid_string,message:s.message}),r.dirty()):De.assertNever(s);return{status:r.value,value:t.data}}_regex(t,n,r){return this.refinement(o=>t.test(o),{validation:n,code:Q.invalid_string,...ce.errToObj(r)})}_addCheck(t){return new Xn({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...ce.errToObj(t)})}url(t){return this._addCheck({kind:"url",...ce.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...ce.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...ce.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...ce.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...ce.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...ce.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...ce.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...ce.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...ce.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...ce.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...ce.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...ce.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...ce.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...ce.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...ce.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...ce.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n?.position,...ce.errToObj(n?.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...ce.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...ce.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...ce.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...ce.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...ce.errToObj(n)})}nonempty(t){return this.min(1,ce.errToObj(t))}trim(){return new Xn({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Xn({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Xn({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}Xn.create=e=>new Xn({checks:[],typeName:xe.ZodString,coerce:e?.coerce??!1,...Pe(e)});function w2(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,o=n>r?n:r,s=Number.parseInt(e.toFixed(o).replace(".","")),i=Number.parseInt(t.toFixed(o).replace(".",""));return s%i/10**o}class Qo extends _e{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==ae.number){const s=this._getOrReturnCtx(t);return se(s,{code:Q.invalid_type,expected:ae.number,received:s.parsedType}),Ee}let r;const o=new At;for(const s of this._def.checks)s.kind==="int"?De.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),se(r,{code:Q.invalid_type,expected:"integer",received:"float",message:s.message}),o.dirty()):s.kind==="min"?(s.inclusive?t.data<s.value:t.data<=s.value)&&(r=this._getOrReturnCtx(t,r),se(r,{code:Q.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),o.dirty()):s.kind==="max"?(s.inclusive?t.data>s.value:t.data>=s.value)&&(r=this._getOrReturnCtx(t,r),se(r,{code:Q.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),o.dirty()):s.kind==="multipleOf"?w2(t.data,s.value)!==0&&(r=this._getOrReturnCtx(t,r),se(r,{code:Q.not_multiple_of,multipleOf:s.value,message:s.message}),o.dirty()):s.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),se(r,{code:Q.not_finite,message:s.message}),o.dirty()):De.assertNever(s);return{status:o.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,ce.toString(n))}gt(t,n){return this.setLimit("min",t,!1,ce.toString(n))}lte(t,n){return this.setLimit("max",t,!0,ce.toString(n))}lt(t,n){return this.setLimit("max",t,!1,ce.toString(n))}setLimit(t,n,r,o){return new Qo({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:ce.toString(o)}]})}_addCheck(t){return new Qo({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:ce.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ce.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ce.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ce.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ce.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:ce.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:ce.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ce.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ce.toString(t)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&De.isInteger(t.value))}get isFinite(){let t=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(t===null||r.value<t)&&(t=r.value)}return Number.isFinite(n)&&Number.isFinite(t)}}Qo.create=e=>new Qo({checks:[],typeName:xe.ZodNumber,coerce:e?.coerce||!1,...Pe(e)});class es extends _e{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==ae.bigint)return this._getInvalidInput(t);let r;const o=new At;for(const s of this._def.checks)s.kind==="min"?(s.inclusive?t.data<s.value:t.data<=s.value)&&(r=this._getOrReturnCtx(t,r),se(r,{code:Q.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),o.dirty()):s.kind==="max"?(s.inclusive?t.data>s.value:t.data>=s.value)&&(r=this._getOrReturnCtx(t,r),se(r,{code:Q.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),o.dirty()):s.kind==="multipleOf"?t.data%s.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),se(r,{code:Q.not_multiple_of,multipleOf:s.value,message:s.message}),o.dirty()):De.assertNever(s);return{status:o.value,value:t.data}}_getInvalidInput(t){const n=this._getOrReturnCtx(t);return se(n,{code:Q.invalid_type,expected:ae.bigint,received:n.parsedType}),Ee}gte(t,n){return this.setLimit("min",t,!0,ce.toString(n))}gt(t,n){return this.setLimit("min",t,!1,ce.toString(n))}lte(t,n){return this.setLimit("max",t,!0,ce.toString(n))}lt(t,n){return this.setLimit("max",t,!1,ce.toString(n))}setLimit(t,n,r,o){return new es({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:ce.toString(o)}]})}_addCheck(t){return new es({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:ce.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ce.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ce.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ce.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:ce.toString(n)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}es.create=e=>new es({checks:[],typeName:xe.ZodBigInt,coerce:e?.coerce??!1,...Pe(e)});class pv extends _e{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==ae.boolean){const r=this._getOrReturnCtx(t);return se(r,{code:Q.invalid_type,expected:ae.boolean,received:r.parsedType}),Ee}return Wt(t.data)}}pv.create=e=>new pv({typeName:xe.ZodBoolean,coerce:e?.coerce||!1,...Pe(e)});class Hi extends _e{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==ae.date){const s=this._getOrReturnCtx(t);return se(s,{code:Q.invalid_type,expected:ae.date,received:s.parsedType}),Ee}if(Number.isNaN(t.data.getTime())){const s=this._getOrReturnCtx(t);return se(s,{code:Q.invalid_date}),Ee}const r=new At;let o;for(const s of this._def.checks)s.kind==="min"?t.data.getTime()<s.value&&(o=this._getOrReturnCtx(t,o),se(o,{code:Q.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),r.dirty()):s.kind==="max"?t.data.getTime()>s.value&&(o=this._getOrReturnCtx(t,o),se(o,{code:Q.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),r.dirty()):De.assertNever(s);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new Hi({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:ce.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:ce.toString(n)})}get minDate(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t!=null?new Date(t):null}}Hi.create=e=>new Hi({checks:[],coerce:e?.coerce||!1,typeName:xe.ZodDate,...Pe(e)});class hv extends _e{_parse(t){if(this._getType(t)!==ae.symbol){const r=this._getOrReturnCtx(t);return se(r,{code:Q.invalid_type,expected:ae.symbol,received:r.parsedType}),Ee}return Wt(t.data)}}hv.create=e=>new hv({typeName:xe.ZodSymbol,...Pe(e)});class mv extends _e{_parse(t){if(this._getType(t)!==ae.undefined){const r=this._getOrReturnCtx(t);return se(r,{code:Q.invalid_type,expected:ae.undefined,received:r.parsedType}),Ee}return Wt(t.data)}}mv.create=e=>new mv({typeName:xe.ZodUndefined,...Pe(e)});class gv extends _e{_parse(t){if(this._getType(t)!==ae.null){const r=this._getOrReturnCtx(t);return se(r,{code:Q.invalid_type,expected:ae.null,received:r.parsedType}),Ee}return Wt(t.data)}}gv.create=e=>new gv({typeName:xe.ZodNull,...Pe(e)});class vv extends _e{constructor(){super(...arguments),this._any=!0}_parse(t){return Wt(t.data)}}vv.create=e=>new vv({typeName:xe.ZodAny,...Pe(e)});class yv extends _e{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Wt(t.data)}}yv.create=e=>new yv({typeName:xe.ZodUnknown,...Pe(e)});class Kn extends _e{_parse(t){const n=this._getOrReturnCtx(t);return se(n,{code:Q.invalid_type,expected:ae.never,received:n.parsedType}),Ee}}Kn.create=e=>new Kn({typeName:xe.ZodNever,...Pe(e)});class bv extends _e{_parse(t){if(this._getType(t)!==ae.undefined){const r=this._getOrReturnCtx(t);return se(r,{code:Q.invalid_type,expected:ae.void,received:r.parsedType}),Ee}return Wt(t.data)}}bv.create=e=>new bv({typeName:xe.ZodVoid,...Pe(e)});class un extends _e{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),o=this._def;if(n.parsedType!==ae.array)return se(n,{code:Q.invalid_type,expected:ae.array,received:n.parsedType}),Ee;if(o.exactLength!==null){const i=n.data.length>o.exactLength.value,a=n.data.length<o.exactLength.value;(i||a)&&(se(n,{code:i?Q.too_big:Q.too_small,minimum:a?o.exactLength.value:void 0,maximum:i?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),r.dirty())}if(o.minLength!==null&&n.data.length<o.minLength.value&&(se(n,{code:Q.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),r.dirty()),o.maxLength!==null&&n.data.length>o.maxLength.value&&(se(n,{code:Q.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((i,a)=>o.type._parseAsync(new qn(n,i,n.path,a)))).then(i=>At.mergeArray(r,i));const s=[...n.data].map((i,a)=>o.type._parseSync(new qn(n,i,n.path,a)));return At.mergeArray(r,s)}get element(){return this._def.type}min(t,n){return new un({...this._def,minLength:{value:t,message:ce.toString(n)}})}max(t,n){return new un({...this._def,maxLength:{value:t,message:ce.toString(n)}})}length(t,n){return new un({...this._def,exactLength:{value:t,message:ce.toString(n)}})}nonempty(t){return this.min(1,t)}}un.create=(e,t)=>new un({type:e,minLength:null,maxLength:null,exactLength:null,typeName:xe.ZodArray,...Pe(t)});function to(e){if(e instanceof st){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=Jn.create(to(r))}return new st({...e._def,shape:()=>t})}else return e instanceof un?new un({...e._def,type:to(e.element)}):e instanceof Jn?Jn.create(to(e.unwrap())):e instanceof oo?oo.create(to(e.unwrap())):e instanceof br?br.create(e.items.map(t=>to(t))):e}class st extends _e{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),n=De.objectKeys(t);return this._cached={shape:t,keys:n},this._cached}_parse(t){if(this._getType(t)!==ae.object){const c=this._getOrReturnCtx(t);return se(c,{code:Q.invalid_type,expected:ae.object,received:c.parsedType}),Ee}const{status:r,ctx:o}=this._processInputParams(t),{shape:s,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof Kn&&this._def.unknownKeys==="strip"))for(const c in o.data)i.includes(c)||a.push(c);const l=[];for(const c of i){const u=s[c],d=o.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new qn(o,d,o.path,c)),alwaysSet:c in o.data})}if(this._def.catchall instanceof Kn){const c=this._def.unknownKeys;if(c==="passthrough")for(const u of a)l.push({key:{status:"valid",value:u},value:{status:"valid",value:o.data[u]}});else if(c==="strict")a.length>0&&(se(o,{code:Q.unrecognized_keys,keys:a}),r.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const u of a){const d=o.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new qn(o,d,o.path,u)),alwaysSet:u in o.data})}}return o.common.async?Promise.resolve().then(async()=>{const c=[];for(const u of l){const d=await u.key,h=await u.value;c.push({key:d,value:h,alwaysSet:u.alwaysSet})}return c}).then(c=>At.mergeObjectSync(r,c)):At.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(t){return ce.errToObj,new st({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,r)=>{const o=this._def.errorMap?.(n,r).message??r.defaultError;return n.code==="unrecognized_keys"?{message:ce.errToObj(t).message??o}:{message:o}}}:{}})}strip(){return new st({...this._def,unknownKeys:"strip"})}passthrough(){return new st({...this._def,unknownKeys:"passthrough"})}extend(t){return new st({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new st({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:xe.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new st({...this._def,catchall:t})}pick(t){const n={};for(const r of De.objectKeys(t))t[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new st({...this._def,shape:()=>n})}omit(t){const n={};for(const r of De.objectKeys(this.shape))t[r]||(n[r]=this.shape[r]);return new st({...this._def,shape:()=>n})}deepPartial(){return to(this)}partial(t){const n={};for(const r of De.objectKeys(this.shape)){const o=this.shape[r];t&&!t[r]?n[r]=o:n[r]=o.optional()}return new st({...this._def,shape:()=>n})}required(t){const n={};for(const r of De.objectKeys(this.shape))if(t&&!t[r])n[r]=this.shape[r];else{let s=this.shape[r];for(;s instanceof Jn;)s=s._def.innerType;n[r]=s}return new st({...this._def,shape:()=>n})}keyof(){return Sv(De.objectKeys(this.shape))}}st.create=(e,t)=>new st({shape:()=>e,unknownKeys:"strip",catchall:Kn.create(),typeName:xe.ZodObject,...Pe(t)}),st.strictCreate=(e,t)=>new st({shape:()=>e,unknownKeys:"strict",catchall:Kn.create(),typeName:xe.ZodObject,...Pe(t)}),st.lazycreate=(e,t)=>new st({shape:e,unknownKeys:"strip",catchall:Kn.create(),typeName:xe.ZodObject,...Pe(t)});class Ui extends _e{_parse(t){const{ctx:n}=this._processInputParams(t),r=this._def.options;function o(s){for(const a of s)if(a.result.status==="valid")return a.result;for(const a of s)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;const i=s.map(a=>new kn(a.ctx.common.issues));return se(n,{code:Q.invalid_union,unionErrors:i}),Ee}if(n.common.async)return Promise.all(r.map(async s=>{const i={...n,common:{...n.common,issues:[]},parent:null};return{result:await s._parseAsync({data:n.data,path:n.path,parent:i}),ctx:i}})).then(o);{let s;const i=[];for(const l of r){const c={...n,common:{...n.common,issues:[]},parent:null},u=l._parseSync({data:n.data,path:n.path,parent:c});if(u.status==="valid")return u;u.status==="dirty"&&!s&&(s={result:u,ctx:c}),c.common.issues.length&&i.push(c.common.issues)}if(s)return n.common.issues.push(...s.ctx.common.issues),s.result;const a=i.map(l=>new kn(l));return se(n,{code:Q.invalid_union,unionErrors:a}),Ee}}get options(){return this._def.options}}Ui.create=(e,t)=>new Ui({options:e,typeName:xe.ZodUnion,...Pe(t)});function Wl(e,t){const n=Zn(e),r=Zn(t);if(e===t)return{valid:!0,data:e};if(n===ae.object&&r===ae.object){const o=De.objectKeys(t),s=De.objectKeys(e).filter(a=>o.indexOf(a)!==-1),i={...e,...t};for(const a of s){const l=Wl(e[a],t[a]);if(!l.valid)return{valid:!1};i[a]=l.data}return{valid:!0,data:i}}else if(n===ae.array&&r===ae.array){if(e.length!==t.length)return{valid:!1};const o=[];for(let s=0;s<e.length;s++){const i=e[s],a=t[s],l=Wl(i,a);if(!l.valid)return{valid:!1};o.push(l.data)}return{valid:!0,data:o}}else return n===ae.date&&r===ae.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class Gi extends _e{_parse(t){const{status:n,ctx:r}=this._processInputParams(t),o=(s,i)=>{if(cv(s)||cv(i))return Ee;const a=Wl(s.value,i.value);return a.valid?((lv(s)||lv(i))&&n.dirty(),{status:n.value,value:a.data}):(se(r,{code:Q.invalid_intersection_types}),Ee)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([s,i])=>o(s,i)):o(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}Gi.create=(e,t,n)=>new Gi({left:e,right:t,typeName:xe.ZodIntersection,...Pe(n)});class br extends _e{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==ae.array)return se(r,{code:Q.invalid_type,expected:ae.array,received:r.parsedType}),Ee;if(r.data.length<this._def.items.length)return se(r,{code:Q.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Ee;!this._def.rest&&r.data.length>this._def.items.length&&(se(r,{code:Q.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const s=[...r.data].map((i,a)=>{const l=this._def.items[a]||this._def.rest;return l?l._parse(new qn(r,i,r.path,a)):null}).filter(i=>!!i);return r.common.async?Promise.all(s).then(i=>At.mergeArray(n,i)):At.mergeArray(n,s)}get items(){return this._def.items}rest(t){return new br({...this._def,rest:t})}}br.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new br({items:e,typeName:xe.ZodTuple,rest:null,...Pe(t)})};class wv extends _e{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==ae.map)return se(r,{code:Q.invalid_type,expected:ae.map,received:r.parsedType}),Ee;const o=this._def.keyType,s=this._def.valueType,i=[...r.data.entries()].map(([a,l],c)=>({key:o._parse(new qn(r,a,r.path,[c,"key"])),value:s._parse(new qn(r,l,r.path,[c,"value"]))}));if(r.common.async){const a=new Map;return Promise.resolve().then(async()=>{for(const l of i){const c=await l.key,u=await l.value;if(c.status==="aborted"||u.status==="aborted")return Ee;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(c.value,u.value)}return{status:n.value,value:a}})}else{const a=new Map;for(const l of i){const c=l.key,u=l.value;if(c.status==="aborted"||u.status==="aborted")return Ee;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(c.value,u.value)}return{status:n.value,value:a}}}}wv.create=(e,t,n)=>new wv({valueType:t,keyType:e,typeName:xe.ZodMap,...Pe(n)});class ts extends _e{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==ae.set)return se(r,{code:Q.invalid_type,expected:ae.set,received:r.parsedType}),Ee;const o=this._def;o.minSize!==null&&r.data.size<o.minSize.value&&(se(r,{code:Q.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),n.dirty()),o.maxSize!==null&&r.data.size>o.maxSize.value&&(se(r,{code:Q.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),n.dirty());const s=this._def.valueType;function i(l){const c=new Set;for(const u of l){if(u.status==="aborted")return Ee;u.status==="dirty"&&n.dirty(),c.add(u.value)}return{status:n.value,value:c}}const a=[...r.data.values()].map((l,c)=>s._parse(new qn(r,l,r.path,c)));return r.common.async?Promise.all(a).then(l=>i(l)):i(a)}min(t,n){return new ts({...this._def,minSize:{value:t,message:ce.toString(n)}})}max(t,n){return new ts({...this._def,maxSize:{value:t,message:ce.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}ts.create=(e,t)=>new ts({valueType:e,minSize:null,maxSize:null,typeName:xe.ZodSet,...Pe(t)});class Ev extends _e{get schema(){return this._def.getter()}_parse(t){const{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}Ev.create=(e,t)=>new Ev({getter:e,typeName:xe.ZodLazy,...Pe(t)});class xv extends _e{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return se(n,{received:n.data,code:Q.invalid_literal,expected:this._def.value}),Ee}return{status:"valid",value:t.data}}get value(){return this._def.value}}xv.create=(e,t)=>new xv({value:e,typeName:xe.ZodLiteral,...Pe(t)});function Sv(e,t){return new no({values:e,typeName:xe.ZodEnum,...Pe(t)})}class no extends _e{_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return se(n,{expected:De.joinValues(r),received:n.parsedType,code:Q.invalid_type}),Ee}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){const n=this._getOrReturnCtx(t),r=this._def.values;return se(n,{received:n.data,code:Q.invalid_enum_value,options:r}),Ee}return Wt(t.data)}get options(){return this._def.values}get enum(){const t={};for(const n of this._def.values)t[n]=n;return t}get Values(){const t={};for(const n of this._def.values)t[n]=n;return t}get Enum(){const t={};for(const n of this._def.values)t[n]=n;return t}extract(t,n=this._def){return no.create(t,{...this._def,...n})}exclude(t,n=this._def){return no.create(this.options.filter(r=>!t.includes(r)),{...this._def,...n})}}no.create=Sv;class Cv extends _e{_parse(t){const n=De.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==ae.string&&r.parsedType!==ae.number){const o=De.objectValues(n);return se(r,{expected:De.joinValues(o),received:r.parsedType,code:Q.invalid_type}),Ee}if(this._cache||(this._cache=new Set(De.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){const o=De.objectValues(n);return se(r,{received:r.data,code:Q.invalid_enum_value,options:o}),Ee}return Wt(t.data)}get enum(){return this._def.values}}Cv.create=(e,t)=>new Cv({values:e,typeName:xe.ZodNativeEnum,...Pe(t)});class zi extends _e{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==ae.promise&&n.common.async===!1)return se(n,{code:Q.invalid_type,expected:ae.promise,received:n.parsedType}),Ee;const r=n.parsedType===ae.promise?n.data:Promise.resolve(n.data);return Wt(r.then(o=>this._def.type.parseAsync(o,{path:n.path,errorMap:n.common.contextualErrorMap})))}}zi.create=(e,t)=>new zi({type:e,typeName:xe.ZodPromise,...Pe(t)});class ro extends _e{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===xe.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:r}=this._processInputParams(t),o=this._def.effect||null,s={addIssue:i=>{se(r,i),i.fatal?n.abort():n.dirty()},get path(){return r.path}};if(s.addIssue=s.addIssue.bind(s),o.type==="preprocess"){const i=o.transform(r.data,s);if(r.common.async)return Promise.resolve(i).then(async a=>{if(n.value==="aborted")return Ee;const l=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return l.status==="aborted"?Ee:l.status==="dirty"||n.value==="dirty"?Jo(l.value):l});{if(n.value==="aborted")return Ee;const a=this._def.schema._parseSync({data:i,path:r.path,parent:r});return a.status==="aborted"?Ee:a.status==="dirty"||n.value==="dirty"?Jo(a.value):a}}if(o.type==="refinement"){const i=a=>{const l=o.refinement(a,s);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(r.common.async===!1){const a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?Ee:(a.status==="dirty"&&n.dirty(),i(a.value),{status:n.value,value:a.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>a.status==="aborted"?Ee:(a.status==="dirty"&&n.dirty(),i(a.value).then(()=>({status:n.value,value:a.value}))))}if(o.type==="transform")if(r.common.async===!1){const i=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!eo(i))return Ee;const a=o.transform(i.value,s);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:a}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(i=>eo(i)?Promise.resolve(o.transform(i.value,s)).then(a=>({status:n.value,value:a})):Ee);De.assertNever(o)}}ro.create=(e,t,n)=>new ro({schema:e,typeName:xe.ZodEffects,effect:t,...Pe(n)}),ro.createWithPreprocess=(e,t,n)=>new ro({schema:t,effect:{type:"preprocess",transform:e},typeName:xe.ZodEffects,...Pe(n)});class Jn extends _e{_parse(t){return this._getType(t)===ae.undefined?Wt(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Jn.create=(e,t)=>new Jn({innerType:e,typeName:xe.ZodOptional,...Pe(t)});class oo extends _e{_parse(t){return this._getType(t)===ae.null?Wt(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}oo.create=(e,t)=>new oo({innerType:e,typeName:xe.ZodNullable,...Pe(t)});class jl extends _e{_parse(t){const{ctx:n}=this._processInputParams(t);let r=n.data;return n.parsedType===ae.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}jl.create=(e,t)=>new jl({innerType:e,typeName:xe.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Pe(t)});class Hl extends _e{_parse(t){const{ctx:n}=this._processInputParams(t),r={...n,common:{...n.common,issues:[]}},o=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return ji(o)?o.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new kn(r.common.issues)},input:r.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new kn(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}Hl.create=(e,t)=>new Hl({innerType:e,typeName:xe.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...Pe(t)});class Tv extends _e{_parse(t){if(this._getType(t)!==ae.nan){const r=this._getOrReturnCtx(t);return se(r,{code:Q.invalid_type,expected:ae.nan,received:r.parsedType}),Ee}return{status:"valid",value:t.data}}}Tv.create=e=>new Tv({typeName:xe.ZodNaN,...Pe(e)});class E2 extends _e{_parse(t){const{ctx:n}=this._processInputParams(t),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class Ul extends _e{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{const s=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?Ee:s.status==="dirty"?(n.dirty(),Jo(s.value)):this._def.out._parseAsync({data:s.value,path:r.path,parent:r})})();{const o=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?Ee:o.status==="dirty"?(n.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:r.path,parent:r})}}static create(t,n){return new Ul({in:t,out:n,typeName:xe.ZodPipeline})}}class Gl extends _e{_parse(t){const n=this._def.innerType._parse(t),r=o=>(eo(o)&&(o.value=Object.freeze(o.value)),o);return ji(n)?n.then(o=>r(o)):r(n)}unwrap(){return this._def.innerType}}Gl.create=(e,t)=>new Gl({innerType:e,typeName:xe.ZodReadonly,...Pe(t)});var xe;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(xe||(xe={}));const Ov=Xn.create;Kn.create,un.create;const x2=st.create;Ui.create,Gi.create,br.create,no.create,zi.create,Jn.create,oo.create;const S2={item:"_item_1ddxp_1"};function C2({value:e,onValueChange:t}){const[n,r]=W.useState(!1);return O.jsx(Ek,{rootProps:{open:n,onOpenChange:r},zIndex:999,classNames:{popup:"w-80 text-gray-500 border border-gray-300 bg-white rounded-2xl"},content:O.jsx("ul",{className:"max-h-[60vh] overflow-y-auto ",children:Kx.map(({label:o,value:s})=>O.jsxs("li",{...s===e?{"data-selected":!0}:{},className:on(S2.item),onClick:()=>{t?.(s),r(!1)},children:[s===e&&O.jsx(Nc,{className:"size-3"}),O.jsxs("div",{className:"col-start-2 flex justify-between",children:[O.jsx("span",{children:s}),O.jsx("span",{children:o})]})]},s+o))}),children:O.jsxs("div",{className:"flex items-center justify-center w-16 border-r border-gray-300 cursor-pointer",children:[O.jsx("span",{children:e}),O.jsx(XS,{className:"size-4"})]})})}const kv=x2({phoneNumber:Ov().regex(/^[1-9]\d{10}$/,"请输入正确的手机号"),verificationCode:Ov().length(4,"请输入 6 位验证码")});function Rv(){const{mobileLoginConfig:e={},gameId:t,onPhoneLoginSuccess:n,onLoginSuccess:r,onLoginError:o}=Po(),[s,i]=W.useState("86"),[a,l]=W.useState(""),c=W.useRef(null),[u,d]=W.useState(""),[h,p]=W.useState(),[g,m]=W.useState(!0),[v,y]=W.useState({}),[b]=qP({leftTime:h?h*1e3:void 0,interval:1e3,onEnd(){p(void 0)}}),{mutate:E,isPending:x}=ao({mutationFn:()=>rC({mobile:a,countryCode:s,type:e.smsType}),onSuccess:A=>{p(A.lock_time),ar.success("验证码已发送,请注意查收")}}),{mutate:w,isPending:T}=ao({mutationFn:async()=>{const A=await oC({mobile:a,countryCode:s,captcha:u});return p(void 0),n&&await n(A),r?.(A),A},onError:A=>{o?.(A)}});function S(){if(!g){ar.warning("请先阅读并同意用户协议和隐私政策");return}const A=new FormData(c.current),L=kv.pick({phoneNumber:!0}).safeParse(Object.fromEntries(A));if(!L.success){y(L.error.flatten().fieldErrors);return}E()}async function I(A){if(A.preventDefault(),!g)return ar.warning("请先阅读并同意用户协议和隐私政策"),{errors:{}};const L=new FormData(A.currentTarget),M=kv.safeParse(Object.fromEntries(L));return M.success?(w(),{errors:{}}):{errors:M.error.flatten().fieldErrors}}return O.jsxs(ei,{ref:c,errors:v,onSubmit:async A=>{const L=await I(A);y(L.errors)},className:"space-y-5",children:[O.jsxs(wn,{name:"phoneNumber",children:[O.jsxs("div",{className:"flex items-center border border-[var(--jssdk-input-border-color)] data-[focused]:border-[var(--jssdk-primary-color)] rounded-full bg-white px-3 gap-2 h-12",children:[O.jsx(C2,{value:s,onValueChange:i}),O.jsx(cr,{className:"flex-1 outline-none rounded-full h-full pl-1",placeholder:"请输入手机号码",autoFocus:!0,type:"tel",onChange:A=>l(A.currentTarget.value)})]}),O.jsx(Oc,{className:"mt-1 text-sm text-red-800"})]}),O.jsxs(wn,{name:"verificationCode",children:[O.jsxs("div",{className:"flex items-center border border-[var(--jssdk-input-border-color)] data-[focused]:border-[var(--jssdk-primary-color)] rounded-full bg-white px-3 gap-2 h-12",children:[O.jsx(cr,{className:"flex-1 w-0 outline-none rounded-full h-full pl-1",placeholder:"请输入验证码",value:u,type:"number",onValueChange:A=>d(A)}),O.jsx("button",{type:"button",className:"enabled:text-[var(--jssdk-primary-color)] text-sm rounded-full h-4/6 px-2 enabled:hover:bg-[var(--jssdk-primary-color)] enabled:hover:text-white inline-flex items-center disabled:cursor-not-allowed disabled:text-gray-500",onClick:()=>S(),disabled:!!h||x,children:x?"发送中...":h?`${Math.round(b/1e3)}s 后重新获取`:"获取验证码"})]}),O.jsx(Oc,{className:"mt-1 text-sm text-red-800"})]}),O.jsx(lr,{className:wt("my-5 h-10 w-full text-white bg-gradient-to-r from-[#497efe] to-[#947afa] rounded-full shadow-lg",e.buttonClassName),disabled:T,type:"submit",children:T?"登录中...":e.buttonText||"登录"}),O.jsx(_c,{}),O.jsx(sv,{checked:g,onChange:m})]})}function Pv({trigger:e,title:t,description:n,children:r,open:o,showCloseIcon:s=!0,onOpenChange:i,classNames:a}){return O.jsxs(NS,{open:o,onOpenChange:i,disablePointerDismissal:!1,children:[e&&O.jsx(Sp,{className:a?.trigger,children:e}),O.jsxs(Ep,{children:[O.jsx(vp,{className:"fixed inset-0 bg-black/70 transition-all duration-150 data-[ending-style]:opacity-0 data-[starting-style]:opacity-0 dark:opacity-70 z-[990] backdrop-blur-sm"}),O.jsxs(wp,{className:wt("fixed top-1/2 left-1/2 w-96 max-w-[calc(100vw-3rem)] -translate-x-1/2 -translate-y-1/2 rounded-lg bg-gray-50 p-4 text-gray-900 transition-all duration-150 data-[ending-style]:scale-90 data-[ending-style]:opacity-0 data-[starting-style]:scale-90 data-[starting-style]:opacity-0 z-[991]",a?.popup),children:[t&&O.jsx(xp,{className:wt("-mt-1.5 mb-1 text-lg font-medium",a?.title),children:t}),n&&O.jsx(bp,{className:wt("mb-6 text-base text-gray-600",a?.description),children:n}),s&&O.jsx(yp,{className:wt("absolute right-4 top-4 text-gray-700 hover:bg-gray-200 rounded p-0.5",a?.close),children:O.jsx(Zp,{})}),O.jsx("div",{children:r})]})]})]})}function T2(e){return O.jsxs("svg",{width:"20",height:"10",viewBox:"0 0 20 10",fill:"none",...e,children:[O.jsx("path",{d:"M9.66437 2.60207L4.80758 6.97318C4.07308 7.63423 3.11989 8 2.13172 8H0V10H20V8H18.5349C17.5468 8 16.5936 7.63423 15.8591 6.97318L11.0023 2.60207C10.622 2.2598 10.0447 2.25979 9.66437 2.60207Z",className:"fill-current"}),O.jsx("path",{d:"M8.99542 1.85876C9.75604 1.17425 10.9106 1.17422 11.6713 1.85878L16.5281 6.22989C17.0789 6.72568 17.7938 7.00001 18.5349 7.00001L15.89 7L11.0023 2.60207C10.622 2.2598 10.0447 2.2598 9.66436 2.60207L4.77734 7L2.13171 7.00001C2.87284 7.00001 3.58774 6.72568 4.13861 6.22989L8.99542 1.85876Z",className:"fill-current"})]})}function O2({children:e,title:t,description:n,content:r,classNames:o={}}){return O.jsxs(FS,{children:[O.jsx(Lp,{className:o.trigger,delay:0,children:e}),O.jsxs($p,{children:[O.jsx(Hp,{className:wt("fixed inset-0 bg-black/20 transition-all duration-150 data-[ending-style]:opacity-0 data-[starting-style]:opacity-0",o.backdrop)}),O.jsx(Vp,{sideOffset:8,className:o.positioner,children:O.jsxs(Wp,{className:wt("origin-[var(--transform-origin)] bg-white p-1 rounded shadow-sm text-gray-900 transition-[transform,scale,opacity] data-[ending-style]:scale-90 data-[ending-style]:opacity-0 data-[starting-style]:scale-90 data-[starting-style]:opacity-0 dark:shadow-none dark:-outline-offset-1 dark:outline-gray-300",o.popup),children:[O.jsx(jp,{className:wt("data-[side=bottom]:top-[-8px] data-[side=left]:right-[-13px] data-[side=left]:rotate-90 data-[side=right]:left-[-13px] data-[side=right]:-rotate-90 data-[side=top]:bottom-[-8px] data-[side=top]:rotate-180",o.arrow),children:O.jsx(T2,{})}),t&&O.jsx(Up,{className:"text-base font-medium",children:t}),n&&O.jsx(Gp,{className:"text-base text-gray-600",children:n}),r]})})]})]})}const wr={uidGet:"_uidGet_os9yc_1",mailCodeGet:"_mailCodeGet_os9yc_5",uidGetPopup:"_uidGetPopup_os9yc_79",uidGetArrow:"_uidGetArrow_os9yc_83",inputControl:"_inputControl_os9yc_86",form:"_form_os9yc_89"};function Iv({onUidLoginSuccess:e,customSendUidMailCaptcha:t,customValidateUidMailCaptcha:n}={}){const{gameId:r,autoLoginConfig:o,sceneId:s,onUidLoginSuccess:i,onLoginSuccess:a,onLoginError:l,uidLoginConfig:c={}}=Po(),u=W.useRef(null),[d,h]=W.useState(""),[p,g]=W.useState(""),[m,v]=W.useState(!0),[y,b]=W.useState(!1),[E,{startCountdown:x,resetCountdown:w}]=Ok({countStart:120,intervalMs:1e3}),{mutate:T}=ao({mutationFn:()=>{const L=o.enabled?o.days:void 0;return n?n({gameId:r,captcha:p,expireInDays:m?L:void 0,accountId:d,sceneId:s}):tC({game_id:r,charid:d,captcha_type:"login",captcha:p,expires_day:m?L:void 0,scene_id:s,...c.uidMailExtraParams})},onSuccess:L=>{i?.(L),e?.(L),a?.(L)},onError:L=>{l?.(L)}}),{mutate:S,isPending:I}=ao({mutationFn:()=>t?t({gameId:r,accountId:d}):eC({game_id:r,captcha_type:"login",charid:d,scene_id:s,...c.uidMailExtraParams}),onSuccess:L=>{x(),ar.success(L.error)}});async function A(L){L.preventDefault(),T()}return W.useEffect(()=>{p.length===6&&d&&setTimeout(()=>{u.current?.requestSubmit()},0)},[p,d]),W.useEffect(()=>{E===0&&w(),b(E!==120)},[E,w]),O.jsxs(ei,{ref:u,onSubmit:A,className:wt("space-y-6",wr.form),autoComplete:"off",children:[["5199","5012"].includes(r)?O.jsx("p",{className:"text-center text-xs text-white/80",children:"请点击游戏右上角“设置”查看账号ID"}):null,O.jsxs(wn,{name:"accountId",className:wt("flex items-center border border-[var(--jssdk-input-border-color)] rounded-full bg-[var(--jssdk-input-bg-color)] px-3 gap-2 h-12",wr.inputControl),children:[O.jsx(O2,{content:O.jsx("div",{className:wt(wr.uidGet,c.uidGetterImageClassName)}),classNames:{backdrop:"z-[992]",positioner:"z-[992]",popup:wt("rounded-2xl shadow-lg",wr.uidGetPopup),arrow:wr.uidGetArrow,trigger:"size-5 lg:size-6 lg:text-2xl rounded-full bg-[var(--jssdk-icon-color)] inline-flex items-center justify-center text-white focus:outline focus:outline-2"},children:O.jsx("span",{children:"!"})}),O.jsx(cr,{className:"flex-1 outline-none rounded-full h-full pl-1 bg-inherit",placeholder:"请输入账号 ID",autoFocus:!0,type:"tel",onChange:L=>h(L.currentTarget.value)})]}),O.jsxs(wn,{name:"verificationCode",className:wt("flex items-center border border-[var(--jssdk-input-border-color)] rounded-full bg-[var(--jssdk-input-bg-color)] px-3 gap-2 h-12",wr.inputControl),children:[O.jsx(Pv,{trigger:O.jsx("span",{children:"!"}),classNames:{trigger:"size-5 lg:size-6 lg:text-2xl rounded-full bg-[var(--jssdk-icon-color)] inline-flex items-center justify-center text-white focus:outline focus:outline-2",popup:"w-full lg:w-4/5 lg:max-w-5xl p-0 bg-transparent"},children:O.jsx("div",{className:wt(wr.mailCodeGet,c.mailCodeGetterImageClassName)})}),O.jsx(cr,{className:"flex-1 w-0 outline-none rounded-full h-full pl-1 bg-inherit",placeholder:"请输入口令码",value:p,type:"tel",onValueChange:L=>g(L)}),O.jsx("button",{type:"button",className:"enabled:text-[var(--jssdk-primary-color)] text-sm rounded-full h-4/6 px-2 enabled:hover:bg-[var(--jssdk-primary-color)] enabled:hover:text-[var(--jssdk-primary-foregroud-color)] inline-flex items-center disabled:cursor-not-allowed disabled:text-gray-500",onMouseDown:L=>{L.preventDefault()},onClick:()=>S(),disabled:y||I||!d,children:y?`${E}s`:I?"发送中...":"发送口令码"})]}),o.enabled?O.jsx(wn,{name:"rememberLogin",children:O.jsxs(Tc,{className:"flex items-center gap-2 text-gray-500",onMouseDown:L=>{L.preventDefault()},children:[O.jsx(Sc,{checked:m,className:"size-5 flex items-center justify-center rounded-full border-2 data-[checked]:border-[var(--jssdk-primary-color)] data-[unchecked]:border-gray-300",onCheckedChange:L=>v(!!L),children:O.jsx(Cc,{children:O.jsx(Nc,{className:"size-3 text-[var(--jssdk-primary-color)]",strokeWidth:4})})}),O.jsxs("div",{children:[O.jsx("span",{className:"mr-0.5",children:o.days}),O.jsx("span",{children:"天内自动登录"})]})]})}):null,["5199","5012"].includes(r)?O.jsx("div",{className:"text-[#f59e9e] text-center text-[11px]",children:"请点击游戏内“邮件”查收口令码,未收到请重启游戏再次查看"}):null,O.jsx(_c,{})]})}const Nv={modal:"_modal_1pbx2_2",close:"_close_1pbx2_8"};function k2({open:e,onOpenChange:t}){const{gameId:n,loginTypes:r,currentLoginType:o,closeable:s,isShowGiantLogo:i}=Po(),a=Qf({loginTypes:r,gameId:n}),l=ep({loginTypes:r,gameId:n}),c=Jf({loginTypes:r,gameId:n});return O.jsxs(Pv,{open:e,onOpenChange:t,classNames:{popup:wt("w-[400px] p-5",Nv.modal),close:Nv.close},showCloseIcon:s,children:[i&&!Zx(n)&&O.jsx("section",{className:"flex items-center justify-center mb-6",children:O.jsx("img",{src:"https://h5.sdk.mobileztgame.com/dist/bg_logo.png",className:"aspect-[240/85] w-32"})}),O.jsxs("section",{children:[o===He.MOBILE&&l&&O.jsx(Rv,{}),o===He.ROLE_ID&&a&&O.jsx(Iv,{}),o===He.GIANT&&c&&O.jsx(WP,{})]})]})}const R2=new sy;function zl({open:e,onOpenChange:t,sceneId:n,onPhoneLoginSuccess:r,onAccountLoginSuccess:o,onUidLoginSuccess:s,onLoginSuccess:i,onLoginError:a,closeable:l=!0,mountToaster:c=!0,toastConfigs:u,...d}){return O.jsxs(W.StrictMode,{children:[O.jsx(cy,{client:R2,children:O.jsx(rp,{value:{sceneId:n,onPhoneLoginSuccess:r,onAccountLoginSuccess:o,onUidLoginSuccess:s,onLoginSuccess:i,onLoginError:a,closeable:l,...d},children:O.jsx(k2,{open:e,onOpenChange:t})})}),c&&O.jsx(Gx,{toastConfigs:u})]})}function _v({loginTypes:e,gameId:t,onLoginSuccess:n,onLoginError:r}){if(document.querySelector(".login-sdk-container"))return console.warn("Login component is already active. Multiple instances are not allowed."),{close:()=>{}};const o=document.createElement("div");o.className="login-sdk-container",document.body.appendChild(o);const s=Mv.createRoot(o),i=()=>{setTimeout(()=>{s.unmount(),o.remove()},200)},a=()=>{s.render(O.jsx(zl,{gameId:t,loginTypes:e,open:!1,onOpenChange:l,onLoginSuccess:n,onLoginError:r})),i()},l=c=>{c||a()};return s.render(O.jsx(zl,{gameId:t,loginTypes:e,open:!0,onOpenChange:l,onLoginSuccess:n,onLoginError:r})),{close:a}}const P2={login:_v};pt.ConfigProvider=rp,pt.LOGIN_TYPES=He,pt.Login=zl,pt.MobileLogin=Rv,pt.SDK=P2,pt.UidLogin=Iv,pt.login=_v,Object.defineProperty(pt,Symbol.toStringTag,{value:"Module"})}));
|
|
89
|
+
){opacity:0}[data-vaul-overlay][data-vaul-snap-points-overlay=true]{opacity:1}[data-vaul-handle]{display:block;position:relative;opacity:.7;background:#e2e2e4;margin-left:auto;margin-right:auto;height:5px;width:32px;border-radius:1rem;touch-action:pan-y}[data-vaul-handle]:active,[data-vaul-handle]:hover{opacity:1}[data-vaul-handle-hitarea]{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:max(100%,2.75rem);height:max(100%,2.75rem);touch-action:inherit}@media (hover:hover) and (pointer:fine){[data-vaul-drawer]{user-select:none}}@media (pointer:fine){[data-vaul-handle-hitarea]:{width:100%;height:100%}}@keyframes fadeIn{from{opacity:0}to{opacity:1}}@keyframes fadeOut{to{opacity:0}}@keyframes slideFromBottom{from{transform:translate3d(0,var(--initial-transform,100%),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToBottom{to{transform:translate3d(0,var(--initial-transform,100%),0)}}@keyframes slideFromTop{from{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToTop{to{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}}@keyframes slideFromLeft{from{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToLeft{to{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}}@keyframes slideFromRight{from{transform:translate3d(var(--initial-transform,100%),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToRight{to{transform:translate3d(var(--initial-transform,100%),0,0)}}`);function hP(){const e=navigator.userAgent;return typeof window<"u"&&(/Firefox/.test(e)&&/Mobile/.test(e)||/FxiOS/.test(e))}function mP(){return Nl(/^Mac/)}function gP(){return Nl(/^iPhone/)}function Ug(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function vP(){return Nl(/^iPad/)||mP()&&navigator.maxTouchPoints>1}function Gg(){return gP()||vP()}function Nl(e){return typeof window<"u"&&window.navigator!=null?e.test(window.navigator.platform):void 0}const yP=24,bP=typeof window<"u"?W.useLayoutEffect:W.useEffect;function zg(...e){return(...t)=>{for(let n of e)typeof n=="function"&&n(...t)}}const _l=typeof document<"u"&&window.visualViewport;function Yg(e){let t=window.getComputedStyle(e);return/(auto|scroll)/.test(t.overflow+t.overflowX+t.overflowY)}function Zg(e){for(Yg(e)&&(e=e.parentElement);e&&!Yg(e);)e=e.parentElement;return e||document.scrollingElement||document.documentElement}const wP=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);let Vi=0,Al;function EP(e={}){let{isDisabled:t}=e;bP(()=>{if(!t)return Vi++,Vi===1&&Gg()&&(Al=xP()),()=>{Vi--,Vi===0&&Al?.()}},[t])}function xP(){let e,t=0,n=d=>{e=Zg(d.target),!(e===document.documentElement&&e===document.body)&&(t=d.changedTouches[0].pageY)},r=d=>{if(!e||e===document.documentElement||e===document.body){d.preventDefault();return}let h=d.changedTouches[0].pageY,p=e.scrollTop,g=e.scrollHeight-e.clientHeight;g!==0&&((p<=0&&h>t||p>=g&&h<t)&&d.preventDefault(),t=h)},o=d=>{let h=d.target;Dl(h)&&h!==document.activeElement&&(d.preventDefault(),h.style.transform="translateY(-2000px)",h.focus(),requestAnimationFrame(()=>{h.style.transform=""}))},s=d=>{let h=d.target;Dl(h)&&(h.style.transform="translateY(-2000px)",requestAnimationFrame(()=>{h.style.transform="",_l&&(_l.height<window.innerHeight?requestAnimationFrame(()=>{qg(h)}):_l.addEventListener("resize",()=>qg(h),{once:!0}))}))},i=()=>{window.scrollTo(0,0)},a=window.pageXOffset,l=window.pageYOffset,c=zg(SP(document.documentElement,"paddingRight",`${window.innerWidth-document.documentElement.clientWidth}px`));window.scrollTo(0,0);let u=zg(Xo(document,"touchstart",n,{passive:!1,capture:!0}),Xo(document,"touchmove",r,{passive:!1,capture:!0}),Xo(document,"touchend",o,{passive:!1,capture:!0}),Xo(document,"focus",s,!0),Xo(window,"scroll",i));return()=>{c(),u(),window.scrollTo(a,l)}}function SP(e,t,n){let r=e.style[t];return e.style[t]=n,()=>{e.style[t]=r}}function Xo(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function qg(e){let t=document.scrollingElement||document.documentElement;for(;e&&e!==t;){let n=Zg(e);if(n!==document.documentElement&&n!==document.body&&n!==e){let r=n.getBoundingClientRect().top,o=e.getBoundingClientRect().top,s=e.getBoundingClientRect().bottom;const i=n.getBoundingClientRect().bottom+yP;s>i&&(n.scrollTop+=o-r)}e=n.parentElement}}function Dl(e){return e instanceof HTMLInputElement&&!wP.has(e.type)||e instanceof HTMLTextAreaElement||e instanceof HTMLElement&&e.isContentEditable}function CP(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function TP(...e){return t=>e.forEach(n=>CP(n,t))}function Xg(...e){return f.useCallback(TP(...e),e)}const Kg=new WeakMap;function at(e,t,n=!1){if(!e||!(e instanceof HTMLElement))return;let r={};Object.entries(t).forEach(([o,s])=>{if(o.startsWith("--")){e.style.setProperty(o,s);return}r[o]=e.style[o],e.style[o]=s}),!n&&Kg.set(e,r)}function OP(e,t){if(!e||!(e instanceof HTMLElement))return;let n=Kg.get(e);n&&(e.style[t]=n[t])}const ot=e=>{switch(e){case"top":case"bottom":return!0;case"left":case"right":return!1;default:return e}};function Bi(e,t){if(!e)return null;const n=window.getComputedStyle(e),r=n.transform||n.webkitTransform||n.mozTransform;let o=r.match(/^matrix3d\((.+)\)$/);return o?parseFloat(o[1].split(", ")[ot(t)?13:12]):(o=r.match(/^matrix\((.+)\)$/),o?parseFloat(o[1].split(", ")[ot(t)?5:4]):null)}function kP(e){return 8*(Math.log(e+1)-2)}function Ml(e,t){if(!e)return()=>{};const n=e.style.cssText;return Object.assign(e.style,t),()=>{e.style.cssText=n}}function RP(...e){return(...t)=>{for(const n of e)typeof n=="function"&&n(...t)}}const Xe={DURATION:.5,EASE:[.32,.72,0,1]},Jg=.4,PP=.25,IP=100,Qg=8,yr=16,Ll=26,$l="vaul-dragging";function ev(e){const t=W.useRef(e);return W.useEffect(()=>{t.current=e}),W.useMemo(()=>(...n)=>t.current==null?void 0:t.current.call(t,...n),[])}function NP({defaultProp:e,onChange:t}){const n=W.useState(e),[r]=n,o=W.useRef(r),s=ev(t);return W.useEffect(()=>{o.current!==r&&(s(r),o.current=r)},[r,o,s]),n}function tv({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,o]=NP({defaultProp:t,onChange:n}),s=e!==void 0,i=s?e:r,a=ev(n),l=W.useCallback(c=>{if(s){const d=typeof c=="function"?c(e):c;d!==e&&a(d)}else o(c)},[s,e,o,a]);return[i,l]}function _P({activeSnapPointProp:e,setActiveSnapPointProp:t,snapPoints:n,drawerRef:r,overlayRef:o,fadeFromIndex:s,onSnapPointChange:i,direction:a="bottom",container:l,snapToSequentialPoint:c}){const[u,d]=tv({prop:e,defaultProp:n?.[0],onChange:t}),[h,p]=W.useState(typeof window<"u"?{innerWidth:window.innerWidth,innerHeight:window.innerHeight}:void 0);W.useEffect(()=>{function S(){p({innerWidth:window.innerWidth,innerHeight:window.innerHeight})}return window.addEventListener("resize",S),()=>window.removeEventListener("resize",S)},[]);const g=W.useMemo(()=>u===n?.[n.length-1]||null,[n,u]),m=W.useMemo(()=>{var S;return(S=n?.findIndex(I=>I===u))!=null?S:null},[n,u]),v=n&&n.length>0&&(s||s===0)&&!Number.isNaN(s)&&n[s]===u||!n,y=W.useMemo(()=>{const S=l?{width:l.getBoundingClientRect().width,height:l.getBoundingClientRect().height}:typeof window<"u"?{width:window.innerWidth,height:window.innerHeight}:{width:0,height:0};var I;return(I=n?.map(A=>{const L=typeof A=="string";let M=0;if(L&&(M=parseInt(A,10)),ot(a)){const R=L?M:h?A*S.height:0;return h?a==="bottom"?S.height-R:-S.height+R:R}const _=L?M:h?A*S.width:0;return h?a==="right"?S.width-_:-S.width+_:_}))!=null?I:[]},[n,h,l]),b=W.useMemo(()=>m!==null?y?.[m]:null,[y,m]),E=W.useCallback(S=>{var I;const A=(I=y?.findIndex(L=>L===S))!=null?I:null;i(A),at(r.current,{transition:`transform ${Xe.DURATION}s cubic-bezier(${Xe.EASE.join(",")})`,transform:ot(a)?`translate3d(0, ${S}px, 0)`:`translate3d(${S}px, 0, 0)`}),y&&A!==y.length-1&&s!==void 0&&A!==s&&A<s?at(o.current,{transition:`opacity ${Xe.DURATION}s cubic-bezier(${Xe.EASE.join(",")})`,opacity:"0"}):at(o.current,{transition:`opacity ${Xe.DURATION}s cubic-bezier(${Xe.EASE.join(",")})`,opacity:"1"}),d(n?.[Math.max(A,0)])},[r.current,n,y,s,o,d]);W.useEffect(()=>{if(u||e){var S;const I=(S=n?.findIndex(A=>A===e||A===u))!=null?S:-1;y&&I!==-1&&typeof y[I]=="number"&&E(y[I])}},[u,e,n,y,E]);function x({draggedDistance:S,closeDrawer:I,velocity:A,dismissible:L}){if(s===void 0)return;const M=a==="bottom"||a==="right"?(b??0)-S:(b??0)+S,_=m===s-1,R=m===0,P=S>0;if(_&&at(o.current,{transition:`opacity ${Xe.DURATION}s cubic-bezier(${Xe.EASE.join(",")})`}),!c&&A>2&&!P){L?I():E(y[0]);return}if(!c&&A>2&&P&&y&&n){E(y[n.length-1]);return}const C=y?.reduce((D,k)=>typeof D!="number"||typeof k!="number"?D:Math.abs(k-M)<Math.abs(D-M)?k:D),N=ot(a)?window.innerHeight:window.innerWidth;if(A>Jg&&Math.abs(S)<N*.4){const D=P?1:-1;if(D>0&&g&&n){E(y[n.length-1]);return}if(R&&D<0&&L&&I(),m===null)return;E(y[m+D]);return}E(C)}function w({draggedDistance:S}){if(b===null)return;const I=a==="bottom"||a==="right"?b-S:b+S;(a==="bottom"||a==="right")&&I<y[y.length-1]||(a==="top"||a==="left")&&I>y[y.length-1]||at(r.current,{transform:ot(a)?`translate3d(0, ${I}px, 0)`:`translate3d(${I}px, 0, 0)`})}function T(S,I){if(!n||typeof m!="number"||!y||s===void 0)return null;const A=m===s-1;if(m>=s&&I)return 0;if(A&&!I)return 1;if(!v&&!A)return null;const M=A?m+1:m-1,_=A?y[M]-y[M-1]:y[M+1]-y[M],R=S/Math.abs(_);return A?1-R:R}return{isLastSnapPoint:g,activeSnapPoint:u,shouldFade:v,getPercentageDragged:T,setActiveSnapPoint:d,activeSnapPointIndex:m,onRelease:x,onDrag:w,snapPointsOffset:y}}const AP=()=>()=>{};function DP(){const{direction:e,isOpen:t,shouldScaleBackground:n,setBackgroundColorOnScale:r,noBodyStyles:o}=qo(),s=W.useRef(null),i=W.useMemo(()=>document.body.style.backgroundColor,[]);function a(){return(window.innerWidth-Ll)/window.innerWidth}W.useEffect(()=>{if(t&&n){s.current&&clearTimeout(s.current);const l=document.querySelector("[data-vaul-drawer-wrapper]")||document.querySelector("[vaul-drawer-wrapper]");if(!l)return;RP(r&&!o?Ml(document.body,{background:"black"}):AP,Ml(l,{transformOrigin:ot(e)?"top":"left",transitionProperty:"transform, border-radius",transitionDuration:`${Xe.DURATION}s`,transitionTimingFunction:`cubic-bezier(${Xe.EASE.join(",")})`}));const c=Ml(l,{borderRadius:`${Qg}px`,overflow:"hidden",...ot(e)?{transform:`scale(${a()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`}:{transform:`scale(${a()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`}});return()=>{c(),s.current=window.setTimeout(()=>{i?document.body.style.background=i:document.body.style.removeProperty("background")},Xe.DURATION*1e3)}}},[t,n,i])}let Ko=null;function MP({isOpen:e,modal:t,nested:n,hasBeenOpened:r,preventScrollRestoration:o,noBodyStyles:s}){const[i,a]=W.useState(()=>typeof window<"u"?window.location.href:""),l=W.useRef(0),c=W.useCallback(()=>{if(Ug()&&Ko===null&&e&&!s){Ko={position:document.body.style.position,top:document.body.style.top,left:document.body.style.left,height:document.body.style.height,right:"unset"};const{scrollX:d,innerHeight:h}=window;document.body.style.setProperty("position","fixed","important"),Object.assign(document.body.style,{top:`${-l.current}px`,left:`${-d}px`,right:"0px",height:"auto"}),window.setTimeout(()=>window.requestAnimationFrame(()=>{const p=h-window.innerHeight;p&&l.current>=h&&(document.body.style.top=`${-(l.current+p)}px`)}),300)}},[e]),u=W.useCallback(()=>{if(Ug()&&Ko!==null&&!s){const d=-parseInt(document.body.style.top,10),h=-parseInt(document.body.style.left,10);Object.assign(document.body.style,Ko),window.requestAnimationFrame(()=>{if(o&&i!==window.location.href){a(window.location.href);return}window.scrollTo(h,d)}),Ko=null}},[i]);return W.useEffect(()=>{function d(){l.current=window.scrollY}return d(),window.addEventListener("scroll",d),()=>{window.removeEventListener("scroll",d)}},[]),W.useEffect(()=>{if(t)return()=>{typeof document>"u"||document.querySelector("[data-vaul-drawer]")||u()}},[t,u]),W.useEffect(()=>{n||!r||(e?(!window.matchMedia("(display-mode: standalone)").matches&&c(),t||window.setTimeout(()=>{u()},500)):u())},[e,r,i,t,n,c,u]),{restorePositionSetting:u}}function LP({open:e,onOpenChange:t,children:n,onDrag:r,onRelease:o,snapPoints:s,shouldScaleBackground:i=!1,setBackgroundColorOnScale:a=!0,closeThreshold:l=PP,scrollLockTimeout:c=IP,dismissible:u=!0,handleOnly:d=!1,fadeFromIndex:h=s&&s.length-1,activeSnapPoint:p,setActiveSnapPoint:g,fixed:m,modal:v=!0,onClose:y,nested:b,noBodyStyles:E=!1,direction:x="bottom",defaultOpen:w=!1,disablePreventScroll:T=!0,snapToSequentialPoint:S=!1,preventScrollRestoration:I=!1,repositionInputs:A=!0,onAnimationEnd:L,container:M,autoFocus:_=!1}){var R,P;const[C=!1,N]=tv({defaultProp:w,prop:e,onChange:ie=>{t?.(ie),!ie&&!b&&Ie(),setTimeout(()=>{L?.(ie)},Xe.DURATION*1e3),ie&&!v&&typeof window<"u"&&window.requestAnimationFrame(()=>{document.body.style.pointerEvents="auto"}),ie||(document.body.style.pointerEvents="auto")}}),[D,k]=W.useState(!1),[$,F]=W.useState(!1),[j,V]=W.useState(!1),Y=W.useRef(null),q=W.useRef(null),X=W.useRef(null),U=W.useRef(null),H=W.useRef(null),Z=W.useRef(!1),re=W.useRef(null),ne=W.useRef(0),ee=W.useRef(!1),le=W.useRef(!w),K=W.useRef(0),G=W.useRef(null),de=W.useRef(((R=G.current)==null?void 0:R.getBoundingClientRect().height)||0),fe=W.useRef(((P=G.current)==null?void 0:P.getBoundingClientRect().width)||0),oe=W.useRef(0),ue=W.useCallback(ie=>{s&&ie===pe.length-1&&(q.current=new Date)},[]),{activeSnapPoint:te,activeSnapPointIndex:z,setActiveSnapPoint:B,onRelease:J,snapPointsOffset:pe,onDrag:Se,shouldFade:Ne,getPercentageDragged:Fe}=_P({snapPoints:s,activeSnapPointProp:p,setActiveSnapPointProp:g,drawerRef:G,fadeFromIndex:h,overlayRef:Y,onSnapPointChange:ue,direction:x,container:M,snapToSequentialPoint:S});EP({isDisabled:!C||$||!v||j||!D||!A||!T});const{restorePositionSetting:Ie}=MP({isOpen:C,modal:v,nested:b??!1,hasBeenOpened:D,preventScrollRestoration:I,noBodyStyles:E});function be(){return(window.innerWidth-Ll)/window.innerWidth}function Re(ie){var ge,Oe;!u&&!s||G.current&&!G.current.contains(ie.target)||(de.current=((ge=G.current)==null?void 0:ge.getBoundingClientRect().height)||0,fe.current=((Oe=G.current)==null?void 0:Oe.getBoundingClientRect().width)||0,F(!0),X.current=new Date,Gg()&&window.addEventListener("touchend",()=>Z.current=!1,{once:!0}),ie.target.setPointerCapture(ie.pointerId),ne.current=ot(x)?ie.pageY:ie.pageX)}function Ce(ie,ge){var Oe;let we=ie;const Me=(Oe=window.getSelection())==null?void 0:Oe.toString(),Ke=G.current?Bi(G.current,x):null,et=new Date;if(we.tagName==="SELECT"||we.hasAttribute("data-vaul-no-drag")||we.closest("[data-vaul-no-drag]"))return!1;if(x==="right"||x==="left")return!0;if(q.current&&et.getTime()-q.current.getTime()<500)return!1;if(Ke!==null&&(x==="bottom"?Ke>0:Ke<0))return!0;if(Me&&Me.length>0)return!1;if(H.current&&et.getTime()-H.current.getTime()<c&&Ke===0||ge)return H.current=et,!1;for(;we;){if(we.scrollHeight>we.clientHeight){if(we.scrollTop!==0)return H.current=new Date,!1;if(we.getAttribute("role")==="dialog")return!0}we=we.parentNode}return!0}function Be(ie){if(G.current&&$){const ge=x==="bottom"||x==="right"?1:-1,Oe=(ne.current-(ot(x)?ie.pageY:ie.pageX))*ge,we=Oe>0,Me=s&&!u&&!we;if(Me&&z===0)return;const Ke=Math.abs(Oe),et=document.querySelector("[data-vaul-drawer-wrapper]"),Tt=x==="bottom"||x==="top"?de.current:fe.current;let Et=Ke/Tt;const Kt=Fe(Ke,we);if(Kt!==null&&(Et=Kt),Me&&Et>=1||!Z.current&&!Ce(ie.target,we))return;if(G.current.classList.add($l),Z.current=!0,at(G.current,{transition:"none"}),at(Y.current,{transition:"none"}),s&&Se({draggedDistance:Oe}),we&&!s){const Ot=kP(Oe),Er=Math.min(Ot*-1,0)*ge;at(G.current,{transform:ot(x)?`translate3d(0, ${Er}px, 0)`:`translate3d(${Er}px, 0, 0)`});return}const dn=1-Et;if((Ne||h&&z===h-1)&&(r?.(ie,Et),at(Y.current,{opacity:`${dn}`,transition:"none"},!0)),et&&Y.current&&i){const Ot=Math.min(be()+Et*(1-be()),1),Er=8-Et*8,Yi=Math.max(0,14-Et*14);at(et,{borderRadius:`${Er}px`,transform:ot(x)?`scale(${Ot}) translate3d(0, ${Yi}px, 0)`:`scale(${Ot}) translate3d(${Yi}px, 0, 0)`,transition:"none"},!0)}if(!s){const Ot=Ke*ge;at(G.current,{transform:ot(x)?`translate3d(0, ${Ot}px, 0)`:`translate3d(${Ot}px, 0, 0)`})}}}W.useEffect(()=>{window.requestAnimationFrame(()=>{le.current=!0})},[]),W.useEffect(()=>{var ie;function ge(){if(!G.current||!A)return;const Oe=document.activeElement;if(Dl(Oe)||ee.current){var we;const Me=((we=window.visualViewport)==null?void 0:we.height)||0,Ke=window.innerHeight;let et=Ke-Me;const Tt=G.current.getBoundingClientRect().height||0,Et=Tt>Ke*.8;oe.current||(oe.current=Tt);const Kt=G.current.getBoundingClientRect().top;if(Math.abs(K.current-et)>60&&(ee.current=!ee.current),s&&s.length>0&&pe&&z){const dn=pe[z]||0;et+=dn}if(K.current=et,Tt>Me||ee.current){const dn=G.current.getBoundingClientRect().height;let Ot=dn;dn>Me&&(Ot=Me-(Et?Kt:Ll)),m?G.current.style.height=`${dn-Math.max(et,0)}px`:G.current.style.height=`${Math.max(Ot,Me-Kt)}px`}else hP()||(G.current.style.height=`${oe.current}px`);s&&s.length>0&&!ee.current?G.current.style.bottom="0px":G.current.style.bottom=`${Math.max(et,0)}px`}}return(ie=window.visualViewport)==null||ie.addEventListener("resize",ge),()=>{var Oe;return(Oe=window.visualViewport)==null?void 0:Oe.removeEventListener("resize",ge)}},[z,s,pe]);function Qe(ie){Ct(),y?.(),ie||N(!1),setTimeout(()=>{s&&B(s[0])},Xe.DURATION*1e3)}function ct(){if(!G.current)return;const ie=document.querySelector("[data-vaul-drawer-wrapper]"),ge=Bi(G.current,x);at(G.current,{transform:"translate3d(0, 0, 0)",transition:`transform ${Xe.DURATION}s cubic-bezier(${Xe.EASE.join(",")})`}),at(Y.current,{transition:`opacity ${Xe.DURATION}s cubic-bezier(${Xe.EASE.join(",")})`,opacity:"1"}),i&&ge&&ge>0&&C&&at(ie,{borderRadius:`${Qg}px`,overflow:"hidden",...ot(x)?{transform:`scale(${be()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,transformOrigin:"top"}:{transform:`scale(${be()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`,transformOrigin:"left"},transitionProperty:"transform, border-radius",transitionDuration:`${Xe.DURATION}s`,transitionTimingFunction:`cubic-bezier(${Xe.EASE.join(",")})`},!0)}function Ct(){!$||!G.current||(G.current.classList.remove($l),Z.current=!1,F(!1),U.current=new Date)}function Dt(ie){if(!$||!G.current)return;G.current.classList.remove($l),Z.current=!1,F(!1),U.current=new Date;const ge=Bi(G.current,x);if(!ie||!Ce(ie.target,!1)||!ge||Number.isNaN(ge)||X.current===null)return;const Oe=U.current.getTime()-X.current.getTime(),we=ne.current-(ot(x)?ie.pageY:ie.pageX),Me=Math.abs(we)/Oe;if(Me>.05&&(V(!0),setTimeout(()=>{V(!1)},200)),s){J({draggedDistance:we*(x==="bottom"||x==="right"?1:-1),closeDrawer:Qe,velocity:Me,dismissible:u}),o?.(ie,!0);return}if(x==="bottom"||x==="right"?we>0:we<0){ct(),o?.(ie,!0);return}if(Me>Jg){Qe(),o?.(ie,!1);return}var Ke;const et=Math.min((Ke=G.current.getBoundingClientRect().height)!=null?Ke:0,window.innerHeight);var Tt;const Et=Math.min((Tt=G.current.getBoundingClientRect().width)!=null?Tt:0,window.innerWidth),Kt=x==="left"||x==="right";if(Math.abs(ge)>=(Kt?Et:et)*l){Qe(),o?.(ie,!1);return}o?.(ie,!0),ct()}W.useEffect(()=>(C&&(at(document.documentElement,{scrollBehavior:"auto"}),q.current=new Date),()=>{OP(document.documentElement,"scrollBehavior")}),[C]);function jt(ie){const ge=ie?(window.innerWidth-yr)/window.innerWidth:1,Oe=ie?-yr:0;re.current&&window.clearTimeout(re.current),at(G.current,{transition:`transform ${Xe.DURATION}s cubic-bezier(${Xe.EASE.join(",")})`,transform:ot(x)?`scale(${ge}) translate3d(0, ${Oe}px, 0)`:`scale(${ge}) translate3d(${Oe}px, 0, 0)`}),!ie&&G.current&&(re.current=setTimeout(()=>{const we=Bi(G.current,x);at(G.current,{transition:"none",transform:ot(x)?`translate3d(0, ${we}px, 0)`:`translate3d(${we}px, 0, 0)`})},500))}function ye(ie,ge){if(ge<0)return;const Oe=(window.innerWidth-yr)/window.innerWidth,we=Oe+ge*(1-Oe),Me=-yr+ge*yr;at(G.current,{transform:ot(x)?`scale(${we}) translate3d(0, ${Me}px, 0)`:`scale(${we}) translate3d(${Me}px, 0, 0)`,transition:"none"})}function Ze(ie,ge){const Oe=ot(x)?window.innerHeight:window.innerWidth,we=ge?(Oe-yr)/Oe:1,Me=ge?-yr:0;ge&&at(G.current,{transition:`transform ${Xe.DURATION}s cubic-bezier(${Xe.EASE.join(",")})`,transform:ot(x)?`scale(${we}) translate3d(0, ${Me}px, 0)`:`scale(${we}) translate3d(${Me}px, 0, 0)`})}return W.useEffect(()=>{v||window.requestAnimationFrame(()=>{document.body.style.pointerEvents="auto"})},[v]),W.createElement(aP,{defaultOpen:w,onOpenChange:ie=>{!u&&!ie||(ie?k(!0):Qe(!0),N(ie))},open:C},W.createElement(Hg.Provider,{value:{activeSnapPoint:te,snapPoints:s,setActiveSnapPoint:B,drawerRef:G,overlayRef:Y,onOpenChange:t,onPress:Re,onRelease:Dt,onDrag:Be,dismissible:u,shouldAnimate:le,handleOnly:d,isOpen:C,isDragging:$,shouldFade:Ne,closeDrawer:Qe,onNestedDrag:ye,onNestedOpenChange:jt,onNestedRelease:Ze,keyboardIsOpen:ee,modal:v,snapPointsOffset:pe,activeSnapPointIndex:z,direction:x,shouldScaleBackground:i,setBackgroundColorOnScale:a,noBodyStyles:E,container:M,autoFocus:_}},n))}const nv=W.forwardRef(function({...e},t){const{overlayRef:n,snapPoints:r,onRelease:o,shouldFade:s,isOpen:i,modal:a,shouldAnimate:l}=qo(),c=Xg(t,n),u=r&&r.length>0;if(!a)return null;const d=W.useCallback(h=>o(h),[o]);return W.createElement(uP,{onMouseUp:d,ref:c,"data-vaul-overlay":"","data-vaul-snap-points":i&&u?"true":"false","data-vaul-snap-points-overlay":i&&s?"true":"false","data-vaul-animate":l?.current?"true":"false",...e})});nv.displayName="Drawer.Overlay";const rv=W.forwardRef(function({onPointerDownOutside:e,style:t,onOpenAutoFocus:n,...r},o){const{drawerRef:s,onPress:i,onRelease:a,onDrag:l,keyboardIsOpen:c,snapPointsOffset:u,activeSnapPointIndex:d,modal:h,isOpen:p,direction:g,snapPoints:m,container:v,handleOnly:y,shouldAnimate:b,autoFocus:E}=qo(),[x,w]=W.useState(!1),T=Xg(o,s),S=W.useRef(null),I=W.useRef(null),A=W.useRef(!1),L=m&&m.length>0;DP();const M=(R,P,C=0)=>{if(A.current)return!0;const N=Math.abs(R.y),D=Math.abs(R.x),k=D>N,$=["bottom","right"].includes(P)?1:-1;if(P==="left"||P==="right"){if(!(R.x*$<0)&&D>=0&&D<=C)return k}else if(!(R.y*$<0)&&N>=0&&N<=C)return!k;return A.current=!0,!0};W.useEffect(()=>{L&&window.requestAnimationFrame(()=>{w(!0)})},[]);function _(R){S.current=null,A.current=!1,a(R)}return W.createElement(dP,{"data-vaul-drawer-direction":g,"data-vaul-drawer":"","data-vaul-delayed-snap-points":x?"true":"false","data-vaul-snap-points":p&&L?"true":"false","data-vaul-custom-container":v?"true":"false","data-vaul-animate":b?.current?"true":"false",...r,ref:T,style:u&&u.length>0?{"--snap-point-height":`${u[d??0]}px`,...t}:t,onPointerDown:R=>{y||(r.onPointerDown==null||r.onPointerDown.call(r,R),S.current={x:R.pageX,y:R.pageY},i(R))},onOpenAutoFocus:R=>{n?.(R),E||R.preventDefault()},onPointerDownOutside:R=>{if(e?.(R),!h||R.defaultPrevented){R.preventDefault();return}c.current&&(c.current=!1)},onFocusOutside:R=>{if(!h){R.preventDefault();return}},onPointerMove:R=>{if(I.current=R,y||(r.onPointerMove==null||r.onPointerMove.call(r,R),!S.current))return;const P=R.pageY-S.current.y,C=R.pageX-S.current.x,N=R.pointerType==="touch"?10:2;M({x:C,y:P},g,N)?l(R):(Math.abs(C)>N||Math.abs(P)>N)&&(S.current=null)},onPointerUp:R=>{r.onPointerUp==null||r.onPointerUp.call(r,R),S.current=null,A.current=!1,a(R)},onPointerOut:R=>{r.onPointerOut==null||r.onPointerOut.call(r,R),_(I.current)},onContextMenu:R=>{r.onContextMenu==null||r.onContextMenu.call(r,R),I.current&&_(I.current)}})});rv.displayName="Drawer.Content";const $P=250,FP=120,VP=W.forwardRef(function({preventCycle:e=!1,children:t,...n},r){const{closeDrawer:o,isDragging:s,snapPoints:i,activeSnapPoint:a,setActiveSnapPoint:l,dismissible:c,handleOnly:u,isOpen:d,onPress:h,onDrag:p}=qo(),g=W.useRef(null),m=W.useRef(!1);function v(){if(m.current){E();return}window.setTimeout(()=>{y()},FP)}function y(){if(s||e||m.current){E();return}if(E(),!i||i.length===0){c||o();return}if(a===i[i.length-1]&&c){o();return}const w=i.findIndex(S=>S===a);if(w===-1)return;const T=i[w+1];l(T)}function b(){g.current=window.setTimeout(()=>{m.current=!0},$P)}function E(){g.current&&window.clearTimeout(g.current),m.current=!1}return W.createElement("div",{onClick:v,onPointerCancel:E,onPointerDown:x=>{u&&h(x),b()},onPointerMove:x=>{u&&p(x)},ref:r,"data-vaul-drawer-visible":d?"true":"false","data-vaul-handle":"","aria-hidden":"true",...n},W.createElement("span",{"data-vaul-handle-hitarea":"","aria-hidden":"true"},t))});VP.displayName="Drawer.Handle";function BP(e){const t=qo(),{container:n=t.container,...r}=e;return W.createElement(lP,{container:n,...r})}const Qr={Root:LP,Content:rv,Overlay:nv,Trigger:cP,Portal:BP,Title:fP};function ov({trigger:e,title:t,description:n,children:r,open:o,showCloseIcon:s=!0,onOpenChange:i,zIndex:a,classNames:l}){return Rk("(min-width: 1024px)")?O.jsxs(Bm,{open:o,onOpenChange:i,dismissible:!1,children:[e&&O.jsx(jm,{className:l?.trigger,children:e}),O.jsxs(pk,{children:[O.jsx(Lm,{style:{zIndex:a},className:"fixed inset-0 bg-black/70 transition-all duration-150 data-[ending-style]:opacity-0 data-[starting-style]:opacity-0 dark:opacity-70 z-[990] backdrop-blur-sm"}),O.jsxs(Vm,{style:{zIndex:a},className:on("fixed top-1/2 left-1/2 w-96 max-w-[calc(100vw-3rem)] -translate-x-1/2 -translate-y-1/2 rounded-lg bg-gray-50 p-4 text-gray-900 transition-all duration-150 data-[ending-style]:scale-90 data-[ending-style]:opacity-0 data-[starting-style]:scale-90 data-[starting-style]:opacity-0 z-[991]",l?.desktopPopup),children:[t&&O.jsx(Wm,{className:on("-mt-1.5 mb-1 text-lg font-medium",l?.title),children:t}),n&&O.jsx(Fm,{className:on("mb-6 text-base text-gray-600",l?.description),children:n}),s&&O.jsx($m,{className:"absolute right-4 top-4 text-gray-700 hover:bg-gray-200 rounded p-0.5",children:O.jsx(Zp,{})}),O.jsx("div",{children:r})]})]})]}):O.jsxs(Qr.Root,{open:o,onOpenChange:i,children:[e&&O.jsx(Qr.Trigger,{className:l?.trigger,children:e}),O.jsxs(Qr.Portal,{children:[O.jsx(Qr.Overlay,{style:{zIndex:a},className:on("fixed inset-0 bg-black/70 transition-all duration-150 data-[ending-style]:opacity-0 data-[starting-style]:opacity-0 dark:opacity-70 z-[990] backdrop-blur-sm",l?.backdrop)}),O.jsxs(Qr.Content,{style:{zIndex:a},className:on("h-fit fixed bottom-0 left-0 right-0 outline-none z-[991]",l?.mobilePopup),children:[O.jsx(Qr.Title,{className:"hidden"}),O.jsxs("div",{className:"p-4 bg-white rounded-t-xl",children:[O.jsx("div",{"aria-hidden":!0,className:"mx-auto w-12 h-1.5 flex-shrink-0 rounded-full bg-gray-300 mb-4"}),O.jsx("div",{children:r})]})]})]})]})}function sv({checked:e,onChange:t}){const[n,r]=W.useState(!1),[o,s]=W.useState(!1);return O.jsxs("div",{children:[O.jsx(ov,{title:"用户协议",open:n,onOpenChange:r,zIndex:993,classNames:{desktopPopup:"w-[90vw] lg:w-[60vw]"},children:O.jsx("iframe",{src:"https://help.gamm.ztgame.com/license-light.html",className:"w-full h-[70vh]"})}),O.jsx(ov,{title:"隐私政策",open:o,onOpenChange:s,zIndex:993,classNames:{desktopPopup:"w-[90vw] lg:w-[60vw]"},children:O.jsx("iframe",{src:"https://help.gamm.ztgame.com/privacy-light.html",className:"w-full h-[70vh]"})}),O.jsx(wn,{name:"rememberLogin",children:O.jsxs(Tc,{className:"flex items-center justify-center text-gray-500 text-xs md:text-sm",children:[O.jsx(Sc,{checked:e,className:"size-4 md:size-5 flex items-center justify-center rounded-full border-2 data-[checked]:border-[var(--jssdk-primary-color)] data-[unchecked]:border-[var(--jssdk-input-border-color)]",onCheckedChange:i=>t(!!i),children:O.jsx(Cc,{children:O.jsx(Nc,{className:"size-3 text-[var(--jssdk-primary-color)]",strokeWidth:4})})}),O.jsx("span",{className:"ml-2",children:"我已详细阅读并同意"}),O.jsx(lr,{className:"text-[var(--jssdk-primary-color)]",onClick:()=>r(!0),type:"button",children:"《用户协议》"}),O.jsx("span",{children:"及"}),O.jsx(lr,{className:"text-[var(--jssdk-primary-color)]",onClick:()=>s(!0),type:"button",children:"《隐私政策》"})]})})]})}function WP(){const{gameId:e,onAccountLoginSuccess:t,onLoginSuccess:n,onLoginError:r}=Po(),o=W.useRef(null),[s,i]=W.useState(""),[a,l]=W.useState(""),[c,u]=W.useState(!1),[d,h]=W.useState(!0),{mutate:p,isPending:g}=ao({mutationFn:()=>nC({account:s,password:a}),onSuccess:v=>{t?.(v),n?.(v)},onError:v=>{r?.(v)}});async function m(v){if(v.preventDefault(),!d){ar.warning("请先阅读并同意用户协议和隐私政策");return}if(!s||!a){ar.warning("请输入账号和密码");return}p()}return O.jsxs(ei,{ref:o,onSubmit:m,className:"space-y-5",children:[O.jsxs(wn,{name:"account",className:"flex items-center border border-[var(--jssdk-input-border-color)] rounded-full bg-white px-3 gap-2 h-12",children:[O.jsx(aC,{className:"size-5 text-gray-400"}),O.jsx(cr,{className:"flex-1 outline-none rounded-full h-full pl-1",placeholder:"请输入巨人通行证账号",autoFocus:!0,onChange:v=>i(v.currentTarget.value)})]}),O.jsxs(wn,{name:"password",className:"flex items-center border border-[var(--jssdk-input-border-color)] rounded-full bg-white px-3 gap-2 h-12",children:[O.jsx(cC,{className:"size-5 text-gray-400"}),O.jsx(cr,{type:c?"text":"password",autoComplete:"off",className:"flex-1 w-0 outline-none rounded-full h-full pl-1",placeholder:"请输入密码",value:a,onValueChange:v=>l(v)}),O.jsx(lr,{onClick:()=>u(!c),type:"button",children:c?O.jsx(JS,{className:"size-5 text-gray-400"}):O.jsx(KS,{className:"size-5 text-gray-400"})})]}),O.jsxs("section",{children:[O.jsx("div",{className:"flex justify-end mb-1",children:O.jsx(lr,{className:"text-[var(--jssdk-primary-color)]",as:"a",href:"https://my.ztgame.com/plugin/pwd",children:"忘记密码"})}),O.jsx(lr,{className:"h-10 w-full text-white bg-gradient-to-r from-[#497efe] to-[#947afa] rounded-full shadow-lg",type:"submit",disabled:g,children:"登录"})]}),O.jsx(_c,{}),O.jsx(sv,{checked:d,onChange:h})]})}var jP=function(e){return typeof e=="number"};function HP(e){var t=W.useRef(e);return t.current=e,t}var Wi={exports:{}},UP=Wi.exports,iv;function GP(){return iv||(iv=1,(function(e,t){(function(n,r){e.exports=r()})(UP,(function(){var n=1e3,r=6e4,o=36e5,s="millisecond",i="second",a="minute",l="hour",c="day",u="week",d="month",h="quarter",p="year",g="date",m="Invalid Date",v=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,b={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(P){var C=["th","st","nd","rd"],N=P%100;return"["+P+(C[(N-20)%10]||C[N]||C[0])+"]"}},E=function(P,C,N){var D=String(P);return!D||D.length>=C?P:""+Array(C+1-D.length).join(N)+P},x={s:E,z:function(P){var C=-P.utcOffset(),N=Math.abs(C),D=Math.floor(N/60),k=N%60;return(C<=0?"+":"-")+E(D,2,"0")+":"+E(k,2,"0")},m:function P(C,N){if(C.date()<N.date())return-P(N,C);var D=12*(N.year()-C.year())+(N.month()-C.month()),k=C.clone().add(D,d),$=N-k<0,F=C.clone().add(D+($?-1:1),d);return+(-(D+(N-k)/($?k-F:F-k))||0)},a:function(P){return P<0?Math.ceil(P)||0:Math.floor(P)},p:function(P){return{M:d,y:p,w:u,d:c,D:g,h:l,m:a,s:i,ms:s,Q:h}[P]||String(P||"").toLowerCase().replace(/s$/,"")},u:function(P){return P===void 0}},w="en",T={};T[w]=b;var S="$isDayjsObject",I=function(P){return P instanceof _||!(!P||!P[S])},A=function P(C,N,D){var k;if(!C)return w;if(typeof C=="string"){var $=C.toLowerCase();T[$]&&(k=$),N&&(T[$]=N,k=$);var F=C.split("-");if(!k&&F.length>1)return P(F[0])}else{var j=C.name;T[j]=C,k=j}return!D&&k&&(w=k),k||!D&&w},L=function(P,C){if(I(P))return P.clone();var N=typeof C=="object"?C:{};return N.date=P,N.args=arguments,new _(N)},M=x;M.l=A,M.i=I,M.w=function(P,C){return L(P,{locale:C.$L,utc:C.$u,x:C.$x,$offset:C.$offset})};var _=(function(){function P(N){this.$L=A(N.locale,null,!0),this.parse(N),this.$x=this.$x||N.x||{},this[S]=!0}var C=P.prototype;return C.parse=function(N){this.$d=(function(D){var k=D.date,$=D.utc;if(k===null)return new Date(NaN);if(M.u(k))return new Date;if(k instanceof Date)return new Date(k);if(typeof k=="string"&&!/Z$/i.test(k)){var F=k.match(v);if(F){var j=F[2]-1||0,V=(F[7]||"0").substring(0,3);return $?new Date(Date.UTC(F[1],j,F[3]||1,F[4]||0,F[5]||0,F[6]||0,V)):new Date(F[1],j,F[3]||1,F[4]||0,F[5]||0,F[6]||0,V)}}return new Date(k)})(N),this.init()},C.init=function(){var N=this.$d;this.$y=N.getFullYear(),this.$M=N.getMonth(),this.$D=N.getDate(),this.$W=N.getDay(),this.$H=N.getHours(),this.$m=N.getMinutes(),this.$s=N.getSeconds(),this.$ms=N.getMilliseconds()},C.$utils=function(){return M},C.isValid=function(){return this.$d.toString()!==m},C.isSame=function(N,D){var k=L(N);return this.startOf(D)<=k&&k<=this.endOf(D)},C.isAfter=function(N,D){return L(N)<this.startOf(D)},C.isBefore=function(N,D){return this.endOf(D)<L(N)},C.$g=function(N,D,k){return M.u(N)?this[D]:this.set(k,N)},C.unix=function(){return Math.floor(this.valueOf()/1e3)},C.valueOf=function(){return this.$d.getTime()},C.startOf=function(N,D){var k=this,$=!!M.u(D)||D,F=M.p(N),j=function(re,ne){var ee=M.w(k.$u?Date.UTC(k.$y,ne,re):new Date(k.$y,ne,re),k);return $?ee:ee.endOf(c)},V=function(re,ne){return M.w(k.toDate()[re].apply(k.toDate("s"),($?[0,0,0,0]:[23,59,59,999]).slice(ne)),k)},Y=this.$W,q=this.$M,X=this.$D,U="set"+(this.$u?"UTC":"");switch(F){case p:return $?j(1,0):j(31,11);case d:return $?j(1,q):j(0,q+1);case u:var H=this.$locale().weekStart||0,Z=(Y<H?Y+7:Y)-H;return j($?X-Z:X+(6-Z),q);case c:case g:return V(U+"Hours",0);case l:return V(U+"Minutes",1);case a:return V(U+"Seconds",2);case i:return V(U+"Milliseconds",3);default:return this.clone()}},C.endOf=function(N){return this.startOf(N,!1)},C.$set=function(N,D){var k,$=M.p(N),F="set"+(this.$u?"UTC":""),j=(k={},k[c]=F+"Date",k[g]=F+"Date",k[d]=F+"Month",k[p]=F+"FullYear",k[l]=F+"Hours",k[a]=F+"Minutes",k[i]=F+"Seconds",k[s]=F+"Milliseconds",k)[$],V=$===c?this.$D+(D-this.$W):D;if($===d||$===p){var Y=this.clone().set(g,1);Y.$d[j](V),Y.init(),this.$d=Y.set(g,Math.min(this.$D,Y.daysInMonth())).$d}else j&&this.$d[j](V);return this.init(),this},C.set=function(N,D){return this.clone().$set(N,D)},C.get=function(N){return this[M.p(N)]()},C.add=function(N,D){var k,$=this;N=Number(N);var F=M.p(D),j=function(q){var X=L($);return M.w(X.date(X.date()+Math.round(q*N)),$)};if(F===d)return this.set(d,this.$M+N);if(F===p)return this.set(p,this.$y+N);if(F===c)return j(1);if(F===u)return j(7);var V=(k={},k[a]=r,k[l]=o,k[i]=n,k)[F]||1,Y=this.$d.getTime()+N*V;return M.w(Y,this)},C.subtract=function(N,D){return this.add(-1*N,D)},C.format=function(N){var D=this,k=this.$locale();if(!this.isValid())return k.invalidDate||m;var $=N||"YYYY-MM-DDTHH:mm:ssZ",F=M.z(this),j=this.$H,V=this.$m,Y=this.$M,q=k.weekdays,X=k.months,U=k.meridiem,H=function(ne,ee,le,K){return ne&&(ne[ee]||ne(D,$))||le[ee].slice(0,K)},Z=function(ne){return M.s(j%12||12,ne,"0")},re=U||function(ne,ee,le){var K=ne<12?"AM":"PM";return le?K.toLowerCase():K};return $.replace(y,(function(ne,ee){return ee||(function(le){switch(le){case"YY":return String(D.$y).slice(-2);case"YYYY":return M.s(D.$y,4,"0");case"M":return Y+1;case"MM":return M.s(Y+1,2,"0");case"MMM":return H(k.monthsShort,Y,X,3);case"MMMM":return H(X,Y);case"D":return D.$D;case"DD":return M.s(D.$D,2,"0");case"d":return String(D.$W);case"dd":return H(k.weekdaysMin,D.$W,q,2);case"ddd":return H(k.weekdaysShort,D.$W,q,3);case"dddd":return q[D.$W];case"H":return String(j);case"HH":return M.s(j,2,"0");case"h":return Z(1);case"hh":return Z(2);case"a":return re(j,V,!0);case"A":return re(j,V,!1);case"m":return String(V);case"mm":return M.s(V,2,"0");case"s":return String(D.$s);case"ss":return M.s(D.$s,2,"0");case"SSS":return M.s(D.$ms,3,"0");case"Z":return F}return null})(ne)||F.replace(":","")}))},C.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},C.diff=function(N,D,k){var $,F=this,j=M.p(D),V=L(N),Y=(V.utcOffset()-this.utcOffset())*r,q=this-V,X=function(){return M.m(F,V)};switch(j){case p:$=X()/12;break;case d:$=X();break;case h:$=X()/3;break;case u:$=(q-Y)/6048e5;break;case c:$=(q-Y)/864e5;break;case l:$=q/o;break;case a:$=q/r;break;case i:$=q/n;break;default:$=q}return k?$:M.a($)},C.daysInMonth=function(){return this.endOf(d).$D},C.$locale=function(){return T[this.$L]},C.locale=function(N,D){if(!N)return this.$L;var k=this.clone(),$=A(N,D,!0);return $&&(k.$L=$),k},C.clone=function(){return M.w(this.$d,this)},C.toDate=function(){return new Date(this.valueOf())},C.toJSON=function(){return this.isValid()?this.toISOString():null},C.toISOString=function(){return this.$d.toISOString()},C.toString=function(){return this.$d.toUTCString()},P})(),R=_.prototype;return L.prototype=R,[["$ms",s],["$s",i],["$m",a],["$H",l],["$W",c],["$M",d],["$y",p],["$D",g]].forEach((function(P){R[P[1]]=function(C){return this.$g(C,P[0],P[1])}})),L.extend=function(P,C){return P.$i||(P(C,_,L),P.$i=!0),L},L.locale=A,L.isDayjs=I,L.unix=function(P){return L(1e3*P)},L.en=T[w],L.Ls=T,L.p={},L}))})(Wi)),Wi.exports}var zP=GP();const YP=bw(zP);var Fl=function(e){if(!e)return 0;var t=YP(e).valueOf()-Date.now();return t<0?0:t},ZP=function(e){return{days:Math.floor(e/864e5),hours:Math.floor(e/36e5)%24,minutes:Math.floor(e/6e4)%60,seconds:Math.floor(e/1e3)%60,milliseconds:Math.floor(e)%1e3}},qP=function(e){e===void 0&&(e={});var t=e||{},n=t.leftTime,r=t.targetDate,o=t.interval,s=o===void 0?1e3:o,i=t.onEnd,a=W.useMemo(function(){return jP(n)&&n>0?Date.now()+n:void 0},[n]),l="leftTime"in e?a:r,c=ly(W.useState(function(){return Fl(l)}),2),u=c[0],d=c[1],h=HP(i);W.useEffect(function(){if(!l){d(0);return}d(Fl(l));var g=setInterval(function(){var m,v=Fl(l);d(v),v===0&&(clearInterval(g),(m=h.current)===null||m===void 0||m.call(h))},s);return function(){return clearInterval(g)}},[l,s]);var p=W.useMemo(function(){return ZP(u)},[u]);return[u,p]},De;(function(e){e.assertEqual=o=>{};function t(o){}e.assertIs=t;function n(o){throw new Error}e.assertNever=n,e.arrayToEnum=o=>{const s={};for(const i of o)s[i]=i;return s},e.getValidEnumValues=o=>{const s=e.objectKeys(o).filter(a=>typeof o[o[a]]!="number"),i={};for(const a of s)i[a]=o[a];return e.objectValues(i)},e.objectValues=o=>e.objectKeys(o).map(function(s){return o[s]}),e.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{const s=[];for(const i in o)Object.prototype.hasOwnProperty.call(o,i)&&s.push(i);return s},e.find=(o,s)=>{for(const i of o)if(s(i))return i},e.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function r(o,s=" | "){return o.map(i=>typeof i=="string"?`'${i}'`:i).join(s)}e.joinValues=r,e.jsonStringifyReplacer=(o,s)=>typeof s=="bigint"?s.toString():s})(De||(De={}));var av;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(av||(av={}));const ae=De.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Zn=e=>{switch(typeof e){case"undefined":return ae.undefined;case"string":return ae.string;case"number":return Number.isNaN(e)?ae.nan:ae.number;case"boolean":return ae.boolean;case"function":return ae.function;case"bigint":return ae.bigint;case"symbol":return ae.symbol;case"object":return Array.isArray(e)?ae.array:e===null?ae.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?ae.promise:typeof Map<"u"&&e instanceof Map?ae.map:typeof Set<"u"&&e instanceof Set?ae.set:typeof Date<"u"&&e instanceof Date?ae.date:ae.object;default:return ae.unknown}},Q=De.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class kn extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}format(t){const n=t||function(s){return s.message},r={_errors:[]},o=s=>{for(const i of s.issues)if(i.code==="invalid_union")i.unionErrors.map(o);else if(i.code==="invalid_return_type")o(i.returnTypeError);else if(i.code==="invalid_arguments")o(i.argumentsError);else if(i.path.length===0)r._errors.push(n(i));else{let a=r,l=0;for(;l<i.path.length;){const c=i.path[l];l===i.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(n(i))):a[c]=a[c]||{_errors:[]},a=a[c],l++}}};return o(this),r}static assert(t){if(!(t instanceof kn))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,De.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=n=>n.message){const n={},r=[];for(const o of this.issues)if(o.path.length>0){const s=o.path[0];n[s]=n[s]||[],n[s].push(t(o))}else r.push(t(o));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}kn.create=e=>new kn(e);const Vl=(e,t)=>{let n;switch(e.code){case Q.invalid_type:e.received===ae.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case Q.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,De.jsonStringifyReplacer)}`;break;case Q.unrecognized_keys:n=`Unrecognized key(s) in object: ${De.joinValues(e.keys,", ")}`;break;case Q.invalid_union:n="Invalid input";break;case Q.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${De.joinValues(e.options)}`;break;case Q.invalid_enum_value:n=`Invalid enum value. Expected ${De.joinValues(e.options)}, received '${e.received}'`;break;case Q.invalid_arguments:n="Invalid function arguments";break;case Q.invalid_return_type:n="Invalid function return type";break;case Q.invalid_date:n="Invalid date";break;case Q.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:De.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case Q.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case Q.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case Q.custom:n="Invalid input";break;case Q.invalid_intersection_types:n="Intersection results could not be merged";break;case Q.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case Q.not_finite:n="Number must be finite";break;default:n=t.defaultError,De.assertNever(e)}return{message:n}};let XP=Vl;function KP(){return XP}const JP=e=>{const{data:t,path:n,errorMaps:r,issueData:o}=e,s=[...n,...o.path||[]],i={...o,path:s};if(o.message!==void 0)return{...o,path:s,message:o.message};let a="";const l=r.filter(c=>!!c).slice().reverse();for(const c of l)a=c(i,{data:t,defaultError:a}).message;return{...o,path:s,message:a}};function se(e,t){const n=KP(),r=JP({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===Vl?void 0:Vl].filter(o=>!!o)});e.common.issues.push(r)}class At{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){const r=[];for(const o of n){if(o.status==="aborted")return Ee;o.status==="dirty"&&t.dirty(),r.push(o.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,n){const r=[];for(const o of n){const s=await o.key,i=await o.value;r.push({key:s,value:i})}return At.mergeObjectSync(t,r)}static mergeObjectSync(t,n){const r={};for(const o of n){const{key:s,value:i}=o;if(s.status==="aborted"||i.status==="aborted")return Ee;s.status==="dirty"&&t.dirty(),i.status==="dirty"&&t.dirty(),s.value!=="__proto__"&&(typeof i.value<"u"||o.alwaysSet)&&(r[s.value]=i.value)}return{status:t.value,value:r}}}const Ee=Object.freeze({status:"aborted"}),Jo=e=>({status:"dirty",value:e}),Wt=e=>({status:"valid",value:e}),cv=e=>e.status==="aborted",lv=e=>e.status==="dirty",eo=e=>e.status==="valid",ji=e=>typeof Promise<"u"&&e instanceof Promise;var ce;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(ce||(ce={}));class qn{constructor(t,n,r,o){this._cachedPath=[],this.parent=t,this.data=n,this._path=r,this._key=o}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const uv=(e,t)=>{if(eo(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new kn(e.common.issues);return this._error=n,this._error}}};function Pe(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:o}=e;if(t&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:o}:{errorMap:(i,a)=>{const{message:l}=e;return i.code==="invalid_enum_value"?{message:l??a.defaultError}:typeof a.data>"u"?{message:l??r??a.defaultError}:i.code!=="invalid_type"?{message:a.defaultError}:{message:l??n??a.defaultError}},description:o}}class _e{get description(){return this._def.description}_getType(t){return Zn(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:Zn(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new At,ctx:{common:t.parent.common,data:t.data,parsedType:Zn(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(ji(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){const n=this._parse(t);return Promise.resolve(n)}parse(t,n){const r=this.safeParse(t,n);if(r.success)return r.data;throw r.error}safeParse(t,n){const r={common:{issues:[],async:n?.async??!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Zn(t)},o=this._parseSync({data:t,path:r.path,parent:r});return uv(r,o)}"~validate"(t){const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Zn(t)};if(!this["~standard"].async)try{const r=this._parseSync({data:t,path:[],parent:n});return eo(r)?{value:r.value}:{issues:n.common.issues}}catch(r){r?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:n}).then(r=>eo(r)?{value:r.value}:{issues:n.common.issues})}async parseAsync(t,n){const r=await this.safeParseAsync(t,n);if(r.success)return r.data;throw r.error}async safeParseAsync(t,n){const r={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Zn(t)},o=this._parse({data:t,path:r.path,parent:r}),s=await(ji(o)?o:Promise.resolve(o));return uv(r,s)}refine(t,n){const r=o=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(o):n;return this._refinement((o,s)=>{const i=t(o),a=()=>s.addIssue({code:Q.custom,...r(o)});return typeof Promise<"u"&&i instanceof Promise?i.then(l=>l?!0:(a(),!1)):i?!0:(a(),!1)})}refinement(t,n){return this._refinement((r,o)=>t(r)?!0:(o.addIssue(typeof n=="function"?n(r,o):n),!1))}_refinement(t){return new ro({schema:this,typeName:xe.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return Jn.create(this,this._def)}nullable(){return oo.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return un.create(this)}promise(){return zi.create(this,this._def)}or(t){return Ui.create([this,t],this._def)}and(t){return Gi.create(this,t,this._def)}transform(t){return new ro({...Pe(this._def),schema:this,typeName:xe.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new jl({...Pe(this._def),innerType:this,defaultValue:n,typeName:xe.ZodDefault})}brand(){return new E2({typeName:xe.ZodBranded,type:this,...Pe(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new Hl({...Pe(this._def),innerType:this,catchValue:n,typeName:xe.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return Ul.create(this,t)}readonly(){return Gl.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const QP=/^c[^\s-]{8,}$/i,e2=/^[0-9a-z]+$/,t2=/^[0-9A-HJKMNP-TV-Z]{26}$/i,n2=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,r2=/^[a-z0-9_-]{21}$/i,o2=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,s2=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,i2=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,a2="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Bl;const c2=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,l2=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,u2=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,d2=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,f2=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,p2=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,dv="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",h2=new RegExp(`^${dv}$`);function fv(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);const n=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function m2(e){return new RegExp(`^${fv(e)}$`)}function g2(e){let t=`${dv}T${fv(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function v2(e,t){return!!((t==="v4"||!t)&&c2.test(e)||(t==="v6"||!t)&&u2.test(e))}function y2(e,t){if(!o2.test(e))return!1;try{const[n]=e.split(".");if(!n)return!1;const r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),o=JSON.parse(atob(r));return!(typeof o!="object"||o===null||"typ"in o&&o?.typ!=="JWT"||!o.alg||t&&o.alg!==t)}catch{return!1}}function b2(e,t){return!!((t==="v4"||!t)&&l2.test(e)||(t==="v6"||!t)&&d2.test(e))}class Xn extends _e{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==ae.string){const s=this._getOrReturnCtx(t);return se(s,{code:Q.invalid_type,expected:ae.string,received:s.parsedType}),Ee}const r=new At;let o;for(const s of this._def.checks)if(s.kind==="min")t.data.length<s.value&&(o=this._getOrReturnCtx(t,o),se(o,{code:Q.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="max")t.data.length>s.value&&(o=this._getOrReturnCtx(t,o),se(o,{code:Q.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="length"){const i=t.data.length>s.value,a=t.data.length<s.value;(i||a)&&(o=this._getOrReturnCtx(t,o),i?se(o,{code:Q.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):a&&se(o,{code:Q.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),r.dirty())}else if(s.kind==="email")i2.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"email",code:Q.invalid_string,message:s.message}),r.dirty());else if(s.kind==="emoji")Bl||(Bl=new RegExp(a2,"u")),Bl.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"emoji",code:Q.invalid_string,message:s.message}),r.dirty());else if(s.kind==="uuid")n2.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"uuid",code:Q.invalid_string,message:s.message}),r.dirty());else if(s.kind==="nanoid")r2.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"nanoid",code:Q.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid")QP.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"cuid",code:Q.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid2")e2.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"cuid2",code:Q.invalid_string,message:s.message}),r.dirty());else if(s.kind==="ulid")t2.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"ulid",code:Q.invalid_string,message:s.message}),r.dirty());else if(s.kind==="url")try{new URL(t.data)}catch{o=this._getOrReturnCtx(t,o),se(o,{validation:"url",code:Q.invalid_string,message:s.message}),r.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"regex",code:Q.invalid_string,message:s.message}),r.dirty())):s.kind==="trim"?t.data=t.data.trim():s.kind==="includes"?t.data.includes(s.value,s.position)||(o=this._getOrReturnCtx(t,o),se(o,{code:Q.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),r.dirty()):s.kind==="toLowerCase"?t.data=t.data.toLowerCase():s.kind==="toUpperCase"?t.data=t.data.toUpperCase():s.kind==="startsWith"?t.data.startsWith(s.value)||(o=this._getOrReturnCtx(t,o),se(o,{code:Q.invalid_string,validation:{startsWith:s.value},message:s.message}),r.dirty()):s.kind==="endsWith"?t.data.endsWith(s.value)||(o=this._getOrReturnCtx(t,o),se(o,{code:Q.invalid_string,validation:{endsWith:s.value},message:s.message}),r.dirty()):s.kind==="datetime"?g2(s).test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{code:Q.invalid_string,validation:"datetime",message:s.message}),r.dirty()):s.kind==="date"?h2.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{code:Q.invalid_string,validation:"date",message:s.message}),r.dirty()):s.kind==="time"?m2(s).test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{code:Q.invalid_string,validation:"time",message:s.message}),r.dirty()):s.kind==="duration"?s2.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"duration",code:Q.invalid_string,message:s.message}),r.dirty()):s.kind==="ip"?v2(t.data,s.version)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"ip",code:Q.invalid_string,message:s.message}),r.dirty()):s.kind==="jwt"?y2(t.data,s.alg)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"jwt",code:Q.invalid_string,message:s.message}),r.dirty()):s.kind==="cidr"?b2(t.data,s.version)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"cidr",code:Q.invalid_string,message:s.message}),r.dirty()):s.kind==="base64"?f2.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"base64",code:Q.invalid_string,message:s.message}),r.dirty()):s.kind==="base64url"?p2.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"base64url",code:Q.invalid_string,message:s.message}),r.dirty()):De.assertNever(s);return{status:r.value,value:t.data}}_regex(t,n,r){return this.refinement(o=>t.test(o),{validation:n,code:Q.invalid_string,...ce.errToObj(r)})}_addCheck(t){return new Xn({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...ce.errToObj(t)})}url(t){return this._addCheck({kind:"url",...ce.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...ce.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...ce.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...ce.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...ce.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...ce.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...ce.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...ce.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...ce.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...ce.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...ce.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...ce.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...ce.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...ce.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...ce.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...ce.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n?.position,...ce.errToObj(n?.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...ce.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...ce.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...ce.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...ce.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...ce.errToObj(n)})}nonempty(t){return this.min(1,ce.errToObj(t))}trim(){return new Xn({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Xn({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Xn({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}Xn.create=e=>new Xn({checks:[],typeName:xe.ZodString,coerce:e?.coerce??!1,...Pe(e)});function w2(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,o=n>r?n:r,s=Number.parseInt(e.toFixed(o).replace(".","")),i=Number.parseInt(t.toFixed(o).replace(".",""));return s%i/10**o}class Qo extends _e{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==ae.number){const s=this._getOrReturnCtx(t);return se(s,{code:Q.invalid_type,expected:ae.number,received:s.parsedType}),Ee}let r;const o=new At;for(const s of this._def.checks)s.kind==="int"?De.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),se(r,{code:Q.invalid_type,expected:"integer",received:"float",message:s.message}),o.dirty()):s.kind==="min"?(s.inclusive?t.data<s.value:t.data<=s.value)&&(r=this._getOrReturnCtx(t,r),se(r,{code:Q.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),o.dirty()):s.kind==="max"?(s.inclusive?t.data>s.value:t.data>=s.value)&&(r=this._getOrReturnCtx(t,r),se(r,{code:Q.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),o.dirty()):s.kind==="multipleOf"?w2(t.data,s.value)!==0&&(r=this._getOrReturnCtx(t,r),se(r,{code:Q.not_multiple_of,multipleOf:s.value,message:s.message}),o.dirty()):s.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),se(r,{code:Q.not_finite,message:s.message}),o.dirty()):De.assertNever(s);return{status:o.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,ce.toString(n))}gt(t,n){return this.setLimit("min",t,!1,ce.toString(n))}lte(t,n){return this.setLimit("max",t,!0,ce.toString(n))}lt(t,n){return this.setLimit("max",t,!1,ce.toString(n))}setLimit(t,n,r,o){return new Qo({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:ce.toString(o)}]})}_addCheck(t){return new Qo({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:ce.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ce.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ce.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ce.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ce.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:ce.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:ce.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ce.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ce.toString(t)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&De.isInteger(t.value))}get isFinite(){let t=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(t===null||r.value<t)&&(t=r.value)}return Number.isFinite(n)&&Number.isFinite(t)}}Qo.create=e=>new Qo({checks:[],typeName:xe.ZodNumber,coerce:e?.coerce||!1,...Pe(e)});class es extends _e{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==ae.bigint)return this._getInvalidInput(t);let r;const o=new At;for(const s of this._def.checks)s.kind==="min"?(s.inclusive?t.data<s.value:t.data<=s.value)&&(r=this._getOrReturnCtx(t,r),se(r,{code:Q.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),o.dirty()):s.kind==="max"?(s.inclusive?t.data>s.value:t.data>=s.value)&&(r=this._getOrReturnCtx(t,r),se(r,{code:Q.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),o.dirty()):s.kind==="multipleOf"?t.data%s.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),se(r,{code:Q.not_multiple_of,multipleOf:s.value,message:s.message}),o.dirty()):De.assertNever(s);return{status:o.value,value:t.data}}_getInvalidInput(t){const n=this._getOrReturnCtx(t);return se(n,{code:Q.invalid_type,expected:ae.bigint,received:n.parsedType}),Ee}gte(t,n){return this.setLimit("min",t,!0,ce.toString(n))}gt(t,n){return this.setLimit("min",t,!1,ce.toString(n))}lte(t,n){return this.setLimit("max",t,!0,ce.toString(n))}lt(t,n){return this.setLimit("max",t,!1,ce.toString(n))}setLimit(t,n,r,o){return new es({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:ce.toString(o)}]})}_addCheck(t){return new es({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:ce.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ce.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ce.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ce.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:ce.toString(n)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}es.create=e=>new es({checks:[],typeName:xe.ZodBigInt,coerce:e?.coerce??!1,...Pe(e)});class pv extends _e{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==ae.boolean){const r=this._getOrReturnCtx(t);return se(r,{code:Q.invalid_type,expected:ae.boolean,received:r.parsedType}),Ee}return Wt(t.data)}}pv.create=e=>new pv({typeName:xe.ZodBoolean,coerce:e?.coerce||!1,...Pe(e)});class Hi extends _e{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==ae.date){const s=this._getOrReturnCtx(t);return se(s,{code:Q.invalid_type,expected:ae.date,received:s.parsedType}),Ee}if(Number.isNaN(t.data.getTime())){const s=this._getOrReturnCtx(t);return se(s,{code:Q.invalid_date}),Ee}const r=new At;let o;for(const s of this._def.checks)s.kind==="min"?t.data.getTime()<s.value&&(o=this._getOrReturnCtx(t,o),se(o,{code:Q.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),r.dirty()):s.kind==="max"?t.data.getTime()>s.value&&(o=this._getOrReturnCtx(t,o),se(o,{code:Q.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),r.dirty()):De.assertNever(s);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new Hi({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:ce.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:ce.toString(n)})}get minDate(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t!=null?new Date(t):null}}Hi.create=e=>new Hi({checks:[],coerce:e?.coerce||!1,typeName:xe.ZodDate,...Pe(e)});class hv extends _e{_parse(t){if(this._getType(t)!==ae.symbol){const r=this._getOrReturnCtx(t);return se(r,{code:Q.invalid_type,expected:ae.symbol,received:r.parsedType}),Ee}return Wt(t.data)}}hv.create=e=>new hv({typeName:xe.ZodSymbol,...Pe(e)});class mv extends _e{_parse(t){if(this._getType(t)!==ae.undefined){const r=this._getOrReturnCtx(t);return se(r,{code:Q.invalid_type,expected:ae.undefined,received:r.parsedType}),Ee}return Wt(t.data)}}mv.create=e=>new mv({typeName:xe.ZodUndefined,...Pe(e)});class gv extends _e{_parse(t){if(this._getType(t)!==ae.null){const r=this._getOrReturnCtx(t);return se(r,{code:Q.invalid_type,expected:ae.null,received:r.parsedType}),Ee}return Wt(t.data)}}gv.create=e=>new gv({typeName:xe.ZodNull,...Pe(e)});class vv extends _e{constructor(){super(...arguments),this._any=!0}_parse(t){return Wt(t.data)}}vv.create=e=>new vv({typeName:xe.ZodAny,...Pe(e)});class yv extends _e{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Wt(t.data)}}yv.create=e=>new yv({typeName:xe.ZodUnknown,...Pe(e)});class Kn extends _e{_parse(t){const n=this._getOrReturnCtx(t);return se(n,{code:Q.invalid_type,expected:ae.never,received:n.parsedType}),Ee}}Kn.create=e=>new Kn({typeName:xe.ZodNever,...Pe(e)});class bv extends _e{_parse(t){if(this._getType(t)!==ae.undefined){const r=this._getOrReturnCtx(t);return se(r,{code:Q.invalid_type,expected:ae.void,received:r.parsedType}),Ee}return Wt(t.data)}}bv.create=e=>new bv({typeName:xe.ZodVoid,...Pe(e)});class un extends _e{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),o=this._def;if(n.parsedType!==ae.array)return se(n,{code:Q.invalid_type,expected:ae.array,received:n.parsedType}),Ee;if(o.exactLength!==null){const i=n.data.length>o.exactLength.value,a=n.data.length<o.exactLength.value;(i||a)&&(se(n,{code:i?Q.too_big:Q.too_small,minimum:a?o.exactLength.value:void 0,maximum:i?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),r.dirty())}if(o.minLength!==null&&n.data.length<o.minLength.value&&(se(n,{code:Q.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),r.dirty()),o.maxLength!==null&&n.data.length>o.maxLength.value&&(se(n,{code:Q.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((i,a)=>o.type._parseAsync(new qn(n,i,n.path,a)))).then(i=>At.mergeArray(r,i));const s=[...n.data].map((i,a)=>o.type._parseSync(new qn(n,i,n.path,a)));return At.mergeArray(r,s)}get element(){return this._def.type}min(t,n){return new un({...this._def,minLength:{value:t,message:ce.toString(n)}})}max(t,n){return new un({...this._def,maxLength:{value:t,message:ce.toString(n)}})}length(t,n){return new un({...this._def,exactLength:{value:t,message:ce.toString(n)}})}nonempty(t){return this.min(1,t)}}un.create=(e,t)=>new un({type:e,minLength:null,maxLength:null,exactLength:null,typeName:xe.ZodArray,...Pe(t)});function to(e){if(e instanceof st){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=Jn.create(to(r))}return new st({...e._def,shape:()=>t})}else return e instanceof un?new un({...e._def,type:to(e.element)}):e instanceof Jn?Jn.create(to(e.unwrap())):e instanceof oo?oo.create(to(e.unwrap())):e instanceof br?br.create(e.items.map(t=>to(t))):e}class st extends _e{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),n=De.objectKeys(t);return this._cached={shape:t,keys:n},this._cached}_parse(t){if(this._getType(t)!==ae.object){const c=this._getOrReturnCtx(t);return se(c,{code:Q.invalid_type,expected:ae.object,received:c.parsedType}),Ee}const{status:r,ctx:o}=this._processInputParams(t),{shape:s,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof Kn&&this._def.unknownKeys==="strip"))for(const c in o.data)i.includes(c)||a.push(c);const l=[];for(const c of i){const u=s[c],d=o.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new qn(o,d,o.path,c)),alwaysSet:c in o.data})}if(this._def.catchall instanceof Kn){const c=this._def.unknownKeys;if(c==="passthrough")for(const u of a)l.push({key:{status:"valid",value:u},value:{status:"valid",value:o.data[u]}});else if(c==="strict")a.length>0&&(se(o,{code:Q.unrecognized_keys,keys:a}),r.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const u of a){const d=o.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new qn(o,d,o.path,u)),alwaysSet:u in o.data})}}return o.common.async?Promise.resolve().then(async()=>{const c=[];for(const u of l){const d=await u.key,h=await u.value;c.push({key:d,value:h,alwaysSet:u.alwaysSet})}return c}).then(c=>At.mergeObjectSync(r,c)):At.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(t){return ce.errToObj,new st({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,r)=>{const o=this._def.errorMap?.(n,r).message??r.defaultError;return n.code==="unrecognized_keys"?{message:ce.errToObj(t).message??o}:{message:o}}}:{}})}strip(){return new st({...this._def,unknownKeys:"strip"})}passthrough(){return new st({...this._def,unknownKeys:"passthrough"})}extend(t){return new st({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new st({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:xe.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new st({...this._def,catchall:t})}pick(t){const n={};for(const r of De.objectKeys(t))t[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new st({...this._def,shape:()=>n})}omit(t){const n={};for(const r of De.objectKeys(this.shape))t[r]||(n[r]=this.shape[r]);return new st({...this._def,shape:()=>n})}deepPartial(){return to(this)}partial(t){const n={};for(const r of De.objectKeys(this.shape)){const o=this.shape[r];t&&!t[r]?n[r]=o:n[r]=o.optional()}return new st({...this._def,shape:()=>n})}required(t){const n={};for(const r of De.objectKeys(this.shape))if(t&&!t[r])n[r]=this.shape[r];else{let s=this.shape[r];for(;s instanceof Jn;)s=s._def.innerType;n[r]=s}return new st({...this._def,shape:()=>n})}keyof(){return Sv(De.objectKeys(this.shape))}}st.create=(e,t)=>new st({shape:()=>e,unknownKeys:"strip",catchall:Kn.create(),typeName:xe.ZodObject,...Pe(t)}),st.strictCreate=(e,t)=>new st({shape:()=>e,unknownKeys:"strict",catchall:Kn.create(),typeName:xe.ZodObject,...Pe(t)}),st.lazycreate=(e,t)=>new st({shape:e,unknownKeys:"strip",catchall:Kn.create(),typeName:xe.ZodObject,...Pe(t)});class Ui extends _e{_parse(t){const{ctx:n}=this._processInputParams(t),r=this._def.options;function o(s){for(const a of s)if(a.result.status==="valid")return a.result;for(const a of s)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;const i=s.map(a=>new kn(a.ctx.common.issues));return se(n,{code:Q.invalid_union,unionErrors:i}),Ee}if(n.common.async)return Promise.all(r.map(async s=>{const i={...n,common:{...n.common,issues:[]},parent:null};return{result:await s._parseAsync({data:n.data,path:n.path,parent:i}),ctx:i}})).then(o);{let s;const i=[];for(const l of r){const c={...n,common:{...n.common,issues:[]},parent:null},u=l._parseSync({data:n.data,path:n.path,parent:c});if(u.status==="valid")return u;u.status==="dirty"&&!s&&(s={result:u,ctx:c}),c.common.issues.length&&i.push(c.common.issues)}if(s)return n.common.issues.push(...s.ctx.common.issues),s.result;const a=i.map(l=>new kn(l));return se(n,{code:Q.invalid_union,unionErrors:a}),Ee}}get options(){return this._def.options}}Ui.create=(e,t)=>new Ui({options:e,typeName:xe.ZodUnion,...Pe(t)});function Wl(e,t){const n=Zn(e),r=Zn(t);if(e===t)return{valid:!0,data:e};if(n===ae.object&&r===ae.object){const o=De.objectKeys(t),s=De.objectKeys(e).filter(a=>o.indexOf(a)!==-1),i={...e,...t};for(const a of s){const l=Wl(e[a],t[a]);if(!l.valid)return{valid:!1};i[a]=l.data}return{valid:!0,data:i}}else if(n===ae.array&&r===ae.array){if(e.length!==t.length)return{valid:!1};const o=[];for(let s=0;s<e.length;s++){const i=e[s],a=t[s],l=Wl(i,a);if(!l.valid)return{valid:!1};o.push(l.data)}return{valid:!0,data:o}}else return n===ae.date&&r===ae.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class Gi extends _e{_parse(t){const{status:n,ctx:r}=this._processInputParams(t),o=(s,i)=>{if(cv(s)||cv(i))return Ee;const a=Wl(s.value,i.value);return a.valid?((lv(s)||lv(i))&&n.dirty(),{status:n.value,value:a.data}):(se(r,{code:Q.invalid_intersection_types}),Ee)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([s,i])=>o(s,i)):o(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}Gi.create=(e,t,n)=>new Gi({left:e,right:t,typeName:xe.ZodIntersection,...Pe(n)});class br extends _e{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==ae.array)return se(r,{code:Q.invalid_type,expected:ae.array,received:r.parsedType}),Ee;if(r.data.length<this._def.items.length)return se(r,{code:Q.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Ee;!this._def.rest&&r.data.length>this._def.items.length&&(se(r,{code:Q.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const s=[...r.data].map((i,a)=>{const l=this._def.items[a]||this._def.rest;return l?l._parse(new qn(r,i,r.path,a)):null}).filter(i=>!!i);return r.common.async?Promise.all(s).then(i=>At.mergeArray(n,i)):At.mergeArray(n,s)}get items(){return this._def.items}rest(t){return new br({...this._def,rest:t})}}br.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new br({items:e,typeName:xe.ZodTuple,rest:null,...Pe(t)})};class wv extends _e{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==ae.map)return se(r,{code:Q.invalid_type,expected:ae.map,received:r.parsedType}),Ee;const o=this._def.keyType,s=this._def.valueType,i=[...r.data.entries()].map(([a,l],c)=>({key:o._parse(new qn(r,a,r.path,[c,"key"])),value:s._parse(new qn(r,l,r.path,[c,"value"]))}));if(r.common.async){const a=new Map;return Promise.resolve().then(async()=>{for(const l of i){const c=await l.key,u=await l.value;if(c.status==="aborted"||u.status==="aborted")return Ee;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(c.value,u.value)}return{status:n.value,value:a}})}else{const a=new Map;for(const l of i){const c=l.key,u=l.value;if(c.status==="aborted"||u.status==="aborted")return Ee;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(c.value,u.value)}return{status:n.value,value:a}}}}wv.create=(e,t,n)=>new wv({valueType:t,keyType:e,typeName:xe.ZodMap,...Pe(n)});class ts extends _e{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==ae.set)return se(r,{code:Q.invalid_type,expected:ae.set,received:r.parsedType}),Ee;const o=this._def;o.minSize!==null&&r.data.size<o.minSize.value&&(se(r,{code:Q.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),n.dirty()),o.maxSize!==null&&r.data.size>o.maxSize.value&&(se(r,{code:Q.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),n.dirty());const s=this._def.valueType;function i(l){const c=new Set;for(const u of l){if(u.status==="aborted")return Ee;u.status==="dirty"&&n.dirty(),c.add(u.value)}return{status:n.value,value:c}}const a=[...r.data.values()].map((l,c)=>s._parse(new qn(r,l,r.path,c)));return r.common.async?Promise.all(a).then(l=>i(l)):i(a)}min(t,n){return new ts({...this._def,minSize:{value:t,message:ce.toString(n)}})}max(t,n){return new ts({...this._def,maxSize:{value:t,message:ce.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}ts.create=(e,t)=>new ts({valueType:e,minSize:null,maxSize:null,typeName:xe.ZodSet,...Pe(t)});class Ev extends _e{get schema(){return this._def.getter()}_parse(t){const{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}Ev.create=(e,t)=>new Ev({getter:e,typeName:xe.ZodLazy,...Pe(t)});class xv extends _e{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return se(n,{received:n.data,code:Q.invalid_literal,expected:this._def.value}),Ee}return{status:"valid",value:t.data}}get value(){return this._def.value}}xv.create=(e,t)=>new xv({value:e,typeName:xe.ZodLiteral,...Pe(t)});function Sv(e,t){return new no({values:e,typeName:xe.ZodEnum,...Pe(t)})}class no extends _e{_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return se(n,{expected:De.joinValues(r),received:n.parsedType,code:Q.invalid_type}),Ee}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){const n=this._getOrReturnCtx(t),r=this._def.values;return se(n,{received:n.data,code:Q.invalid_enum_value,options:r}),Ee}return Wt(t.data)}get options(){return this._def.values}get enum(){const t={};for(const n of this._def.values)t[n]=n;return t}get Values(){const t={};for(const n of this._def.values)t[n]=n;return t}get Enum(){const t={};for(const n of this._def.values)t[n]=n;return t}extract(t,n=this._def){return no.create(t,{...this._def,...n})}exclude(t,n=this._def){return no.create(this.options.filter(r=>!t.includes(r)),{...this._def,...n})}}no.create=Sv;class Cv extends _e{_parse(t){const n=De.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==ae.string&&r.parsedType!==ae.number){const o=De.objectValues(n);return se(r,{expected:De.joinValues(o),received:r.parsedType,code:Q.invalid_type}),Ee}if(this._cache||(this._cache=new Set(De.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){const o=De.objectValues(n);return se(r,{received:r.data,code:Q.invalid_enum_value,options:o}),Ee}return Wt(t.data)}get enum(){return this._def.values}}Cv.create=(e,t)=>new Cv({values:e,typeName:xe.ZodNativeEnum,...Pe(t)});class zi extends _e{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==ae.promise&&n.common.async===!1)return se(n,{code:Q.invalid_type,expected:ae.promise,received:n.parsedType}),Ee;const r=n.parsedType===ae.promise?n.data:Promise.resolve(n.data);return Wt(r.then(o=>this._def.type.parseAsync(o,{path:n.path,errorMap:n.common.contextualErrorMap})))}}zi.create=(e,t)=>new zi({type:e,typeName:xe.ZodPromise,...Pe(t)});class ro extends _e{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===xe.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:r}=this._processInputParams(t),o=this._def.effect||null,s={addIssue:i=>{se(r,i),i.fatal?n.abort():n.dirty()},get path(){return r.path}};if(s.addIssue=s.addIssue.bind(s),o.type==="preprocess"){const i=o.transform(r.data,s);if(r.common.async)return Promise.resolve(i).then(async a=>{if(n.value==="aborted")return Ee;const l=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return l.status==="aborted"?Ee:l.status==="dirty"||n.value==="dirty"?Jo(l.value):l});{if(n.value==="aborted")return Ee;const a=this._def.schema._parseSync({data:i,path:r.path,parent:r});return a.status==="aborted"?Ee:a.status==="dirty"||n.value==="dirty"?Jo(a.value):a}}if(o.type==="refinement"){const i=a=>{const l=o.refinement(a,s);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(r.common.async===!1){const a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?Ee:(a.status==="dirty"&&n.dirty(),i(a.value),{status:n.value,value:a.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>a.status==="aborted"?Ee:(a.status==="dirty"&&n.dirty(),i(a.value).then(()=>({status:n.value,value:a.value}))))}if(o.type==="transform")if(r.common.async===!1){const i=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!eo(i))return Ee;const a=o.transform(i.value,s);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:a}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(i=>eo(i)?Promise.resolve(o.transform(i.value,s)).then(a=>({status:n.value,value:a})):Ee);De.assertNever(o)}}ro.create=(e,t,n)=>new ro({schema:e,typeName:xe.ZodEffects,effect:t,...Pe(n)}),ro.createWithPreprocess=(e,t,n)=>new ro({schema:t,effect:{type:"preprocess",transform:e},typeName:xe.ZodEffects,...Pe(n)});class Jn extends _e{_parse(t){return this._getType(t)===ae.undefined?Wt(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Jn.create=(e,t)=>new Jn({innerType:e,typeName:xe.ZodOptional,...Pe(t)});class oo extends _e{_parse(t){return this._getType(t)===ae.null?Wt(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}oo.create=(e,t)=>new oo({innerType:e,typeName:xe.ZodNullable,...Pe(t)});class jl extends _e{_parse(t){const{ctx:n}=this._processInputParams(t);let r=n.data;return n.parsedType===ae.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}jl.create=(e,t)=>new jl({innerType:e,typeName:xe.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Pe(t)});class Hl extends _e{_parse(t){const{ctx:n}=this._processInputParams(t),r={...n,common:{...n.common,issues:[]}},o=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return ji(o)?o.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new kn(r.common.issues)},input:r.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new kn(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}Hl.create=(e,t)=>new Hl({innerType:e,typeName:xe.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...Pe(t)});class Tv extends _e{_parse(t){if(this._getType(t)!==ae.nan){const r=this._getOrReturnCtx(t);return se(r,{code:Q.invalid_type,expected:ae.nan,received:r.parsedType}),Ee}return{status:"valid",value:t.data}}}Tv.create=e=>new Tv({typeName:xe.ZodNaN,...Pe(e)});class E2 extends _e{_parse(t){const{ctx:n}=this._processInputParams(t),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class Ul extends _e{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{const s=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?Ee:s.status==="dirty"?(n.dirty(),Jo(s.value)):this._def.out._parseAsync({data:s.value,path:r.path,parent:r})})();{const o=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?Ee:o.status==="dirty"?(n.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:r.path,parent:r})}}static create(t,n){return new Ul({in:t,out:n,typeName:xe.ZodPipeline})}}class Gl extends _e{_parse(t){const n=this._def.innerType._parse(t),r=o=>(eo(o)&&(o.value=Object.freeze(o.value)),o);return ji(n)?n.then(o=>r(o)):r(n)}unwrap(){return this._def.innerType}}Gl.create=(e,t)=>new Gl({innerType:e,typeName:xe.ZodReadonly,...Pe(t)});var xe;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(xe||(xe={}));const Ov=Xn.create;Kn.create,un.create;const x2=st.create;Ui.create,Gi.create,br.create,no.create,zi.create,Jn.create,oo.create;const S2={item:"_item_1ddxp_1"};function C2({value:e,onValueChange:t}){const[n,r]=W.useState(!1);return O.jsx(Ek,{rootProps:{open:n,onOpenChange:r},zIndex:999,classNames:{popup:"w-80 text-gray-500 border border-gray-300 bg-white rounded-2xl"},content:O.jsx("ul",{className:"max-h-[60vh] overflow-y-auto ",children:Kx.map(({label:o,value:s})=>O.jsxs("li",{...s===e?{"data-selected":!0}:{},className:on(S2.item),onClick:()=>{t?.(s),r(!1)},children:[s===e&&O.jsx(Nc,{className:"size-3"}),O.jsxs("div",{className:"col-start-2 flex justify-between",children:[O.jsx("span",{children:s}),O.jsx("span",{children:o})]})]},s+o))}),children:O.jsxs("div",{className:"flex items-center justify-center w-16 border-r border-gray-300 cursor-pointer",children:[O.jsx("span",{children:e}),O.jsx(XS,{className:"size-4"})]})})}const kv=x2({phoneNumber:Ov().regex(/^[1-9]\d{10}$/,"请输入正确的手机号"),verificationCode:Ov().length(4,"请输入 6 位验证码")});function Rv(){const{mobileLoginConfig:e={},gameId:t,onPhoneLoginSuccess:n,onLoginSuccess:r,onLoginError:o}=Po(),[s,i]=W.useState("86"),[a,l]=W.useState(""),c=W.useRef(null),[u,d]=W.useState(""),[h,p]=W.useState(),[g,m]=W.useState(!0),[v,y]=W.useState({}),[b]=qP({leftTime:h?h*1e3:void 0,interval:1e3,onEnd(){p(void 0)}}),{mutate:E,isPending:x}=ao({mutationFn:()=>rC({mobile:a,countryCode:s,type:e.smsType}),onSuccess:A=>{p(A.lock_time),ar.success("验证码已发送,请注意查收")}}),{mutate:w,isPending:T}=ao({mutationFn:async()=>{const A=await oC({mobile:a,countryCode:s,captcha:u});return p(void 0),n&&await n(A),r?.(A),A},onError:A=>{o?.(A)}});function S(){if(!g){ar.warning("请先阅读并同意用户协议和隐私政策");return}const A=new FormData(c.current),L=kv.pick({phoneNumber:!0}).safeParse(Object.fromEntries(A));if(!L.success){y(L.error.flatten().fieldErrors);return}E()}async function I(A){if(A.preventDefault(),!g)return ar.warning("请先阅读并同意用户协议和隐私政策"),{errors:{}};const L=new FormData(A.currentTarget),M=kv.safeParse(Object.fromEntries(L));return M.success?(w(),{errors:{}}):{errors:M.error.flatten().fieldErrors}}return O.jsxs(ei,{ref:c,errors:v,onSubmit:async A=>{const L=await I(A);y(L.errors)},className:"space-y-5",children:[O.jsxs(wn,{name:"phoneNumber",children:[O.jsxs("div",{className:"flex items-center border border-[var(--jssdk-input-border-color)] data-[focused]:border-[var(--jssdk-primary-color)] rounded-full bg-white px-3 gap-2 h-12",children:[O.jsx(C2,{value:s,onValueChange:i}),O.jsx(cr,{className:"flex-1 outline-none rounded-full h-full pl-1",placeholder:"请输入手机号码",autoFocus:!0,type:"tel",onChange:A=>l(A.currentTarget.value)})]}),O.jsx(Oc,{className:"mt-1 text-sm text-red-800"})]}),O.jsxs(wn,{name:"verificationCode",children:[O.jsxs("div",{className:"flex items-center border border-[var(--jssdk-input-border-color)] data-[focused]:border-[var(--jssdk-primary-color)] rounded-full bg-white px-3 gap-2 h-12",children:[O.jsx(cr,{className:"flex-1 w-0 outline-none rounded-full h-full pl-1",placeholder:"请输入验证码",value:u,type:"number",onValueChange:A=>d(A)}),O.jsx("button",{type:"button",className:"enabled:text-[var(--jssdk-primary-color)] text-sm rounded-full h-4/6 px-2 enabled:hover:bg-[var(--jssdk-primary-color)] enabled:hover:text-white inline-flex items-center disabled:cursor-not-allowed disabled:text-gray-500",onClick:()=>S(),disabled:!!h||x,children:x?"发送中...":h?`${Math.round(b/1e3)}s 后重新获取`:"获取验证码"})]}),O.jsx(Oc,{className:"mt-1 text-sm text-red-800"})]}),O.jsx(lr,{className:wt("my-5 h-10 w-full text-white bg-gradient-to-r from-[#497efe] to-[#947afa] rounded-full shadow-lg",e.buttonClassName),disabled:T,type:"submit",children:T?"登录中...":e.buttonText||"登录"}),O.jsx(_c,{}),O.jsx(sv,{checked:g,onChange:m})]})}function Pv({trigger:e,title:t,description:n,children:r,open:o,showCloseIcon:s=!0,onOpenChange:i,classNames:a}){return O.jsxs(NS,{open:o,onOpenChange:i,disablePointerDismissal:!1,children:[e&&O.jsx(Sp,{className:a?.trigger,children:e}),O.jsxs(Ep,{children:[O.jsx(vp,{className:"fixed inset-0 bg-black/70 transition-all duration-150 data-[ending-style]:opacity-0 data-[starting-style]:opacity-0 dark:opacity-70 z-[990] backdrop-blur-sm"}),O.jsxs(wp,{className:wt("fixed top-1/2 left-1/2 w-96 max-w-[calc(100vw-3rem)] -translate-x-1/2 -translate-y-1/2 rounded-lg bg-gray-50 p-4 text-gray-900 transition-all duration-150 data-[ending-style]:scale-90 data-[ending-style]:opacity-0 data-[starting-style]:scale-90 data-[starting-style]:opacity-0 z-[991]",a?.popup),children:[t&&O.jsx(xp,{className:wt("-mt-1.5 mb-1 text-lg font-medium",a?.title),children:t}),n&&O.jsx(bp,{className:wt("mb-6 text-base text-gray-600",a?.description),children:n}),s&&O.jsx(yp,{className:wt("absolute right-4 top-4 text-gray-700 hover:bg-gray-200 rounded p-0.5",a?.close),children:O.jsx(Zp,{})}),O.jsx("div",{children:r})]})]})]})}function T2(e){return O.jsxs("svg",{width:"20",height:"10",viewBox:"0 0 20 10",fill:"none",...e,children:[O.jsx("path",{d:"M9.66437 2.60207L4.80758 6.97318C4.07308 7.63423 3.11989 8 2.13172 8H0V10H20V8H18.5349C17.5468 8 16.5936 7.63423 15.8591 6.97318L11.0023 2.60207C10.622 2.2598 10.0447 2.25979 9.66437 2.60207Z",className:"fill-current"}),O.jsx("path",{d:"M8.99542 1.85876C9.75604 1.17425 10.9106 1.17422 11.6713 1.85878L16.5281 6.22989C17.0789 6.72568 17.7938 7.00001 18.5349 7.00001L15.89 7L11.0023 2.60207C10.622 2.2598 10.0447 2.2598 9.66436 2.60207L4.77734 7L2.13171 7.00001C2.87284 7.00001 3.58774 6.72568 4.13861 6.22989L8.99542 1.85876Z",className:"fill-current"})]})}function O2({children:e,title:t,description:n,content:r,classNames:o={}}){return O.jsxs(FS,{children:[O.jsx(Lp,{className:o.trigger,delay:0,children:e}),O.jsxs($p,{children:[O.jsx(Hp,{className:wt("fixed inset-0 bg-black/20 transition-all duration-150 data-[ending-style]:opacity-0 data-[starting-style]:opacity-0",o.backdrop)}),O.jsx(Vp,{sideOffset:8,className:o.positioner,children:O.jsxs(Wp,{className:wt("origin-[var(--transform-origin)] bg-white p-1 rounded shadow-sm text-gray-900 transition-[transform,scale,opacity] data-[ending-style]:scale-90 data-[ending-style]:opacity-0 data-[starting-style]:scale-90 data-[starting-style]:opacity-0 dark:shadow-none dark:-outline-offset-1 dark:outline-gray-300",o.popup),children:[O.jsx(jp,{className:wt("data-[side=bottom]:top-[-8px] data-[side=left]:right-[-13px] data-[side=left]:rotate-90 data-[side=right]:left-[-13px] data-[side=right]:-rotate-90 data-[side=top]:bottom-[-8px] data-[side=top]:rotate-180",o.arrow),children:O.jsx(T2,{})}),t&&O.jsx(Up,{className:"text-base font-medium",children:t}),n&&O.jsx(Gp,{className:"text-base text-gray-600",children:n}),r]})})]})]})}const wr={uidGet:"_uidGet_os9yc_1",mailCodeGet:"_mailCodeGet_os9yc_5",uidGetPopup:"_uidGetPopup_os9yc_79",uidGetArrow:"_uidGetArrow_os9yc_83",inputControl:"_inputControl_os9yc_86",form:"_form_os9yc_89"};function Iv({onUidLoginSuccess:e,customSendUidMailCaptcha:t,customValidateUidMailCaptcha:n}={}){const{gameId:r,autoLoginConfig:o,sceneId:s,onUidLoginSuccess:i,onLoginSuccess:a,onLoginError:l,uidLoginConfig:c={}}=Po(),u=W.useRef(null),[d,h]=W.useState(""),[p,g]=W.useState(""),[m,v]=W.useState(!0),[y,b]=W.useState(!1),[E,{startCountdown:x,resetCountdown:w}]=Ok({countStart:120,intervalMs:1e3}),{mutate:T}=ao({mutationFn:()=>{const L=o.enabled?o.days:void 0;return n?n({gameId:r,captcha:p,expireInDays:m?L:void 0,accountId:d,sceneId:s}):tC({game_id:r,charid:d,captcha_type:"login",captcha:p,expires_day:m?L:void 0,scene_id:s,...c.uidMailExtraParams})},onSuccess:L=>{i?.(L),e?.(L),a?.(L)},onError:L=>{l?.(L)}}),{mutate:S,isPending:I}=ao({mutationFn:()=>t?t({gameId:r,accountId:d}):eC({game_id:r,captcha_type:"login",charid:d,scene_id:s,...c.uidMailExtraParams}),onSuccess:L=>{x(),ar.success(L.error)}});async function A(L){L.preventDefault(),T()}return W.useEffect(()=>{p.length===6&&d&&setTimeout(()=>{u.current?.requestSubmit()},0)},[p,d]),W.useEffect(()=>{E===0&&w(),b(E!==120)},[E,w]),O.jsxs(ei,{ref:u,onSubmit:A,className:wt("space-y-6",wr.form),autoComplete:"off",children:[["5199","5012"].includes(r)?O.jsx("p",{className:"text-center text-xs text-white/80",children:"请点击游戏右上角“设置”查看账号ID"}):null,O.jsxs(wn,{name:"accountId",className:wt("flex items-center border border-[var(--jssdk-input-border-color)] rounded-full bg-[var(--jssdk-input-bg-color)] px-3 gap-2 h-12",wr.inputControl),children:[O.jsx(O2,{content:O.jsx("div",{className:wt(wr.uidGet,c.uidGetterImageClassName)}),classNames:{backdrop:"z-[992]",positioner:"z-[992]",popup:wt("rounded-2xl shadow-lg",wr.uidGetPopup),arrow:wr.uidGetArrow,trigger:"size-5 lg:size-6 lg:text-2xl rounded-full bg-[var(--jssdk-icon-color)] inline-flex items-center justify-center text-white focus:outline focus:outline-2"},children:O.jsx("span",{children:"!"})}),O.jsx(cr,{className:"flex-1 outline-none rounded-full h-full pl-1 bg-inherit",placeholder:"请输入账号 ID",autoFocus:!0,type:"tel",onChange:L=>h(L.currentTarget.value)})]}),O.jsxs(wn,{name:"verificationCode",className:wt("flex items-center border border-[var(--jssdk-input-border-color)] rounded-full bg-[var(--jssdk-input-bg-color)] px-3 gap-2 h-12",wr.inputControl),children:[O.jsx(Pv,{trigger:O.jsx("span",{children:"!"}),classNames:{trigger:"size-5 lg:size-6 lg:text-2xl rounded-full bg-[var(--jssdk-icon-color)] inline-flex items-center justify-center text-white focus:outline focus:outline-2",popup:"w-full lg:w-4/5 lg:max-w-5xl p-0 bg-transparent"},children:O.jsx("div",{className:wt(wr.mailCodeGet,c.mailCodeGetterImageClassName)})}),O.jsx(cr,{className:"flex-1 w-0 outline-none rounded-full h-full pl-1 bg-inherit",placeholder:"请输入口令码",value:p,type:"tel",onValueChange:L=>g(L)}),O.jsx("button",{type:"button",className:"enabled:text-[var(--jssdk-primary-color)] text-sm rounded-full h-4/6 px-2 enabled:hover:bg-[var(--jssdk-primary-color)] enabled:hover:text-[var(--jssdk-primary-foregroud-color)] inline-flex items-center disabled:cursor-not-allowed disabled:text-gray-500",onMouseDown:L=>{L.preventDefault()},onClick:()=>S(),disabled:y||I||!d,children:y?`${E}s`:I?"发送中...":"发送口令码"})]}),o.enabled?O.jsx(wn,{name:"rememberLogin",children:O.jsxs(Tc,{className:"flex items-center gap-2 text-gray-500",onMouseDown:L=>{L.preventDefault()},children:[O.jsx(Sc,{checked:m,className:"size-5 flex items-center justify-center rounded-full border-2 data-[checked]:border-[var(--jssdk-primary-color)] data-[unchecked]:border-gray-300",onCheckedChange:L=>v(!!L),children:O.jsx(Cc,{children:O.jsx(Nc,{className:"size-3 text-[var(--jssdk-primary-color)]",strokeWidth:4})})}),O.jsxs("div",{children:[O.jsx("span",{className:"mr-0.5",children:o.days}),O.jsx("span",{children:"天内自动登录"})]})]})}):null,["5199","5012"].includes(r)?O.jsx("div",{className:"text-[#f59e9e] text-center text-[11px]",children:"请点击游戏内“邮件”查收口令码,未收到请重启游戏再次查看"}):null,O.jsx(_c,{})]})}const Nv={modal:"_modal_1pbx2_2",close:"_close_1pbx2_8"};function k2({open:e,onOpenChange:t}){const{gameId:n,loginTypes:r,currentLoginType:o,closeable:s,isShowGiantLogo:i}=Po(),a=Qf({loginTypes:r,gameId:n}),l=ep({loginTypes:r,gameId:n}),c=Jf({loginTypes:r,gameId:n});return O.jsxs(Pv,{open:e,onOpenChange:t,classNames:{popup:wt("w-[400px] p-5",Nv.modal),close:Nv.close},showCloseIcon:s,children:[i&&!Zx(n)&&O.jsx("section",{className:"flex items-center justify-center mb-6",children:O.jsx("img",{src:"https://h5.sdk.mobileztgame.com/dist/bg_logo.png",className:"aspect-[240/85] w-32"})}),O.jsxs("section",{children:[o===He.MOBILE&&l&&O.jsx(Rv,{}),o===He.ROLE_ID&&a&&O.jsx(Iv,{}),o===He.GIANT&&c&&O.jsx(WP,{})]})]})}const R2=new sy;function zl({open:e,onOpenChange:t,sceneId:n,onPhoneLoginSuccess:r,onAccountLoginSuccess:o,onUidLoginSuccess:s,onLoginSuccess:i,onLoginError:a,closeable:l=!0,mountToaster:c=!0,toastConfigs:u,...d}){return O.jsxs(W.StrictMode,{children:[O.jsx(cy,{client:R2,children:O.jsx(rp,{value:{sceneId:n,onPhoneLoginSuccess:r,onAccountLoginSuccess:o,onUidLoginSuccess:s,onLoginSuccess:i,onLoginError:a,closeable:l,...d},children:O.jsx(k2,{open:e,onOpenChange:t})})}),c&&O.jsx(Gx,{toastConfigs:u})]})}function _v({loginTypes:e,defaultLoginType:t,gameId:n,onLoginSuccess:r,onLoginError:o}){if(document.querySelector(".login-sdk-container"))return console.warn("Login component is already active. Multiple instances are not allowed."),{close:()=>{}};const s=document.createElement("div");s.className="login-sdk-container",document.body.appendChild(s);const i=Mv.createRoot(s),a=()=>{setTimeout(()=>{i.unmount(),s.remove()},200)},l=()=>{i.render(O.jsx(zl,{gameId:n,loginTypes:e,defaultLoginType:t,open:!1,onOpenChange:c,onLoginSuccess:r,onLoginError:o})),a()},c=u=>{u||l()};return i.render(O.jsx(zl,{gameId:n,loginTypes:e,defaultLoginType:t,open:!0,onOpenChange:c,onLoginSuccess:r,onLoginError:o})),{close:l}}const P2={login:_v};pt.ConfigProvider=rp,pt.LOGIN_TYPES=He,pt.Login=zl,pt.MobileLogin=Rv,pt.SDK=P2,pt.UidLogin=Iv,pt.login=_v,Object.defineProperty(pt,Symbol.toStringTag,{value:"Module"})}));
|