tempest.games 0.2.5 โ 0.2.7
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/CHANGELOG.md +13 -0
- package/app/assets/index-D-81-7hL.js +109 -0
- package/app/index.html +1 -1
- package/bin/backend.bun.js +231 -231
- package/bin/backend.worker.game.bun.js +3 -3
- package/bin/backend.worker.tribunal.bun.js +64 -64
- package/bin/frontend.bun.js +40 -40
- package/package.json +6 -6
- package/app/assets/index-cl2K8UxB.js +0 -109
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
var WM=Object.defineProperty;var eC=(e,t,n)=>t in e?WM(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var w=(e,t,n)=>eC(e,typeof t!="symbol"?t+"":t,n);function tC(e,t){for(var n=0;n<t.length;n++){const s=t[n];if(typeof s!="string"&&!Array.isArray(s)){for(const a in s)if(a!=="default"&&!(a in e)){const u=Object.getOwnPropertyDescriptor(s,a);u&&Object.defineProperty(e,a,u.get?u:{enumerable:!0,get:()=>s[a]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))s(a);new MutationObserver(a=>{for(const u of a)if(u.type==="childList")for(const c of u.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&s(c)}).observe(document,{childList:!0,subtree:!0});function n(a){const u={};return a.integrity&&(u.integrity=a.integrity),a.referrerPolicy&&(u.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?u.credentials="include":a.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function s(a){if(a.ep)return;a.ep=!0;const u=n(a);fetch(a.href,u)}})();function nC(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var yh={exports:{}},Co={};/**
|
|
2
|
-
* @license React
|
|
3
|
-
* react-jsx-runtime.production.js
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
6
|
-
*
|
|
7
|
-
* This source code is licensed under the MIT license found in the
|
|
8
|
-
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var S0;function iC(){if(S0)return Co;S0=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(s,a,u){var c=null;if(u!==void 0&&(c=""+u),a.key!==void 0&&(c=""+a.key),"key"in a){u={};for(var d in a)d!=="key"&&(u[d]=a[d])}else u=a;return a=u.ref,{$$typeof:e,type:s,key:c,ref:a!==void 0?a:null,props:u}}return Co.Fragment=t,Co.jsx=n,Co.jsxs=n,Co}var x0;function sC(){return x0||(x0=1,yh.exports=iC()),yh.exports}var K=sC(),gh={exports:{}},ye={};/**
|
|
10
|
-
* @license React
|
|
11
|
-
* react.production.js
|
|
12
|
-
*
|
|
13
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
14
|
-
*
|
|
15
|
-
* This source code is licensed under the MIT license found in the
|
|
16
|
-
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var w0;function rC(){if(w0)return ye;w0=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),u=Symbol.for("react.consumer"),c=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),g=Symbol.iterator;function v(A){return A===null||typeof A!="object"?null:(A=g&&A[g]||A["@@iterator"],typeof A=="function"?A:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},T=Object.assign,R={};function M(A,U,F){this.props=A,this.context=U,this.refs=R,this.updater=F||S}M.prototype.isReactComponent={},M.prototype.setState=function(A,U){if(typeof A!="object"&&typeof A!="function"&&A!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,A,U,"setState")},M.prototype.forceUpdate=function(A){this.updater.enqueueForceUpdate(this,A,"forceUpdate")};function D(){}D.prototype=M.prototype;function $(A,U,F){this.props=A,this.context=U,this.refs=R,this.updater=F||S}var k=$.prototype=new D;k.constructor=$,T(k,M.prototype),k.isPureReactComponent=!0;var Y=Array.isArray,z={H:null,A:null,T:null,S:null,V:null},ne=Object.prototype.hasOwnProperty;function ie(A,U,F,Q,ae,Se){return F=Se.ref,{$$typeof:e,type:A,key:U,ref:F!==void 0?F:null,props:Se}}function te(A,U){return ie(A.type,U,void 0,void 0,void 0,A.props)}function ee(A){return typeof A=="object"&&A!==null&&A.$$typeof===e}function me(A){var U={"=":"=0",":":"=2"};return"$"+A.replace(/[=:]/g,function(F){return U[F]})}var be=/\/+/g;function De(A,U){return typeof A=="object"&&A!==null&&A.key!=null?me(""+A.key):U.toString(36)}function Ge(){}function ke(A){switch(A.status){case"fulfilled":return A.value;case"rejected":throw A.reason;default:switch(typeof A.status=="string"?A.then(Ge,Ge):(A.status="pending",A.then(function(U){A.status==="pending"&&(A.status="fulfilled",A.value=U)},function(U){A.status==="pending"&&(A.status="rejected",A.reason=U)})),A.status){case"fulfilled":return A.value;case"rejected":throw A.reason}}throw A}function X(A,U,F,Q,ae){var Se=typeof A;(Se==="undefined"||Se==="boolean")&&(A=null);var re=!1;if(A===null)re=!0;else switch(Se){case"bigint":case"string":case"number":re=!0;break;case"object":switch(A.$$typeof){case e:case t:re=!0;break;case y:return re=A._init,X(re(A._payload),U,F,Q,ae)}}if(re)return ae=ae(A),re=Q===""?"."+De(A,0):Q,Y(ae)?(F="",re!=null&&(F=re.replace(be,"$&/")+"/"),X(ae,U,F,"",function(rn){return rn})):ae!=null&&(ee(ae)&&(ae=te(ae,F+(ae.key==null||A&&A.key===ae.key?"":(""+ae.key).replace(be,"$&/")+"/")+re)),U.push(ae)),1;re=0;var Xe=Q===""?".":Q+":";if(Y(A))for(var Ne=0;Ne<A.length;Ne++)Q=A[Ne],Se=Xe+De(Q,Ne),re+=X(Q,U,F,Se,ae);else if(Ne=v(A),typeof Ne=="function")for(A=Ne.call(A),Ne=0;!(Q=A.next()).done;)Q=Q.value,Se=Xe+De(Q,Ne++),re+=X(Q,U,F,Se,ae);else if(Se==="object"){if(typeof A.then=="function")return X(ke(A),U,F,Q,ae);throw U=String(A),Error("Objects are not valid as a React child (found: "+(U==="[object Object]"?"object with keys {"+Object.keys(A).join(", ")+"}":U)+"). If you meant to render a collection of children, use an array instead.")}return re}function L(A,U,F){if(A==null)return A;var Q=[],ae=0;return X(A,Q,"","",function(Se){return U.call(F,Se,ae++)}),Q}function I(A){if(A._status===-1){var U=A._result;U=U(),U.then(function(F){(A._status===0||A._status===-1)&&(A._status=1,A._result=F)},function(F){(A._status===0||A._status===-1)&&(A._status=2,A._result=F)}),A._status===-1&&(A._status=0,A._result=U)}if(A._status===1)return A._result.default;throw A._result}var G=typeof reportError=="function"?reportError:function(A){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var U=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof A=="object"&&A!==null&&typeof A.message=="string"?String(A.message):String(A),error:A});if(!window.dispatchEvent(U))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",A);return}console.error(A)};function J(){}return ye.Children={map:L,forEach:function(A,U,F){L(A,function(){U.apply(this,arguments)},F)},count:function(A){var U=0;return L(A,function(){U++}),U},toArray:function(A){return L(A,function(U){return U})||[]},only:function(A){if(!ee(A))throw Error("React.Children.only expected to receive a single React element child.");return A}},ye.Component=M,ye.Fragment=n,ye.Profiler=a,ye.PureComponent=$,ye.StrictMode=s,ye.Suspense=h,ye.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=z,ye.__COMPILER_RUNTIME={__proto__:null,c:function(A){return z.H.useMemoCache(A)}},ye.cache=function(A){return function(){return A.apply(null,arguments)}},ye.cloneElement=function(A,U,F){if(A==null)throw Error("The argument must be a React element, but you passed "+A+".");var Q=T({},A.props),ae=A.key,Se=void 0;if(U!=null)for(re in U.ref!==void 0&&(Se=void 0),U.key!==void 0&&(ae=""+U.key),U)!ne.call(U,re)||re==="key"||re==="__self"||re==="__source"||re==="ref"&&U.ref===void 0||(Q[re]=U[re]);var re=arguments.length-2;if(re===1)Q.children=F;else if(1<re){for(var Xe=Array(re),Ne=0;Ne<re;Ne++)Xe[Ne]=arguments[Ne+2];Q.children=Xe}return ie(A.type,ae,void 0,void 0,Se,Q)},ye.createContext=function(A){return A={$$typeof:c,_currentValue:A,_currentValue2:A,_threadCount:0,Provider:null,Consumer:null},A.Provider=A,A.Consumer={$$typeof:u,_context:A},A},ye.createElement=function(A,U,F){var Q,ae={},Se=null;if(U!=null)for(Q in U.key!==void 0&&(Se=""+U.key),U)ne.call(U,Q)&&Q!=="key"&&Q!=="__self"&&Q!=="__source"&&(ae[Q]=U[Q]);var re=arguments.length-2;if(re===1)ae.children=F;else if(1<re){for(var Xe=Array(re),Ne=0;Ne<re;Ne++)Xe[Ne]=arguments[Ne+2];ae.children=Xe}if(A&&A.defaultProps)for(Q in re=A.defaultProps,re)ae[Q]===void 0&&(ae[Q]=re[Q]);return ie(A,Se,void 0,void 0,null,ae)},ye.createRef=function(){return{current:null}},ye.forwardRef=function(A){return{$$typeof:d,render:A}},ye.isValidElement=ee,ye.lazy=function(A){return{$$typeof:y,_payload:{_status:-1,_result:A},_init:I}},ye.memo=function(A,U){return{$$typeof:p,type:A,compare:U===void 0?null:U}},ye.startTransition=function(A){var U=z.T,F={};z.T=F;try{var Q=A(),ae=z.S;ae!==null&&ae(F,Q),typeof Q=="object"&&Q!==null&&typeof Q.then=="function"&&Q.then(J,G)}catch(Se){G(Se)}finally{z.T=U}},ye.unstable_useCacheRefresh=function(){return z.H.useCacheRefresh()},ye.use=function(A){return z.H.use(A)},ye.useActionState=function(A,U,F){return z.H.useActionState(A,U,F)},ye.useCallback=function(A,U){return z.H.useCallback(A,U)},ye.useContext=function(A){return z.H.useContext(A)},ye.useDebugValue=function(){},ye.useDeferredValue=function(A,U){return z.H.useDeferredValue(A,U)},ye.useEffect=function(A,U,F){var Q=z.H;if(typeof F=="function")throw Error("useEffect CRUD overload is not enabled in this build of React.");return Q.useEffect(A,U)},ye.useId=function(){return z.H.useId()},ye.useImperativeHandle=function(A,U,F){return z.H.useImperativeHandle(A,U,F)},ye.useInsertionEffect=function(A,U){return z.H.useInsertionEffect(A,U)},ye.useLayoutEffect=function(A,U){return z.H.useLayoutEffect(A,U)},ye.useMemo=function(A,U){return z.H.useMemo(A,U)},ye.useOptimistic=function(A,U){return z.H.useOptimistic(A,U)},ye.useReducer=function(A,U,F){return z.H.useReducer(A,U,F)},ye.useRef=function(A){return z.H.useRef(A)},ye.useState=function(A){return z.H.useState(A)},ye.useSyncExternalStore=function(A,U,F){return z.H.useSyncExternalStore(A,U,F)},ye.useTransition=function(){return z.H.useTransition()},ye.version="19.1.0",ye}var A0;function um(){return A0||(A0=1,gh.exports=rC()),gh.exports}var j=um();const zn=nC(j),Kx=tC({__proto__:null,default:zn},[j]),{NODE_ENV:aC}=globalThis.env??{},oC=aC==="development";function _u(){}function lC(e,t){if(oC){const n=j.useRef(_u);j.useEffect(()=>{let s=n.current;if(s===_u)s=e()??_u,n.current=s;else return()=>{s(),n.current=_u}},t)}else j.useEffect(e,t)}function ac(e){lC(e,[])}function Nc(e=Math.random){return e().toString(36).slice(2)}class rp extends Promise{constructor(n){let s,a;super((u,c)=>{s=u,a=c});w(this,"fate");w(this,"resolve");w(this,"reject");w(this,"done",!1);this.resolve=s,this.reject=a,this.use(n instanceof Promise?n:new Promise(n))}pass(n,s){n===this.fate&&(this.resolve(s),this.done=!0)}fail(n,s){n===this.fate&&(this.reject(s),this.done=!0)}use(n){if(n instanceof Promise){const s=n;this.fate=s,s.then(a=>{this.pass(s,a)},a=>{this.fail(s,a)})}else this.resolve(n),this.fate=void 0}}function uC(e){return Object.entries(e)}const cC=(e,t,n=vn.STORE)=>Xx(n,{key:`${e.key}:JSON`,get:({get:s})=>t.toJson(s(e)),set:({set:s},a)=>{s(e,t.fromJson(a))}}),sl=e=>JSON.parse(e),Kn=e=>JSON.stringify(e);function Re(e){for(;e.child!==null;)e=e.child;return e}class cm{constructor(t){w(this,"_buffer");w(this,"_index",0);let n;typeof t=="number"?n=t:n=t.length,this._buffer=Array.from({length:n})}get buffer(){return this._buffer}get index(){return this._index}add(t){this._buffer[this._index]=t,this._index=(this._index+1)%this._buffer.length}copy(){const t=new cm([...this._buffer]);return t._index=this._index,t}}const fC={atom_family:"atom",mutable_atom_family:"mutable_atom",selector_family:"selector",readonly_selector_family:"readonly_selector",molecule_family:"molecule"};function dC(e,t){const n=Kn(t),s=`${e.key}(${n})`,a=fC[e.type],u={key:s,type:a};return Object.assign(u,{family:{key:e.key,subKey:n}}),Object.assign(u,{counterfeit:!0}),u}function ha(e){const t={key:e.key,type:e.type};return"family"in e&&(t.family=e.family),t}function It(e){return nk(vn.STORE,e)}function Ei(...e){return e.length===2?ki(vn.STORE,...e):ki(vn.STORE,...e)}const bh=e=>(t,n,s,a,...u)=>{console[e](`${t} ${n} "${s}" ${a}`,...u)},hC={error:bh("error"),info:bh("info"),warn:bh("warn")};class pC{constructor(t,n,s=hC){w(this,"logLevel");w(this,"filter");w(this,"logger");w(this,"error",(...t)=>{var n;(((n=this.filter)==null?void 0:n.call(this,...t))??!0)&&this.logLevel!==null&&this.logger.error(...t)});w(this,"info",(...t)=>{var n;(((n=this.filter)==null?void 0:n.call(this,...t))??!0)&&this.logLevel==="info"&&this.logger.info(...t)});w(this,"warn",(...t)=>{var n;(((n=this.filter)==null?void 0:n.call(this,...t))??!0)&&this.logLevel!=="error"&&this.logLevel!==null&&this.logger.warn(...t)});this.logLevel=t,this.filter=n,this.logger=s}}function ws(e){return Xx(vn.STORE,e)}function Qn(...e){e.length===2?At(vn.STORE,...e):At(vn.STORE,...e)}function mC(e,t,n=Nc()){return ZC(vn.STORE,e,t,n)}function yC(e){return tw(vn.STORE,e)}function gC(e,t=Nc()){return dm(vn.STORE,e,t)}class nn{constructor(t,n){w(this,"a");w(this,"b");w(this,"cardinality");w(this,"relations",new Map);w(this,"contents",new Map);w(this,"isAType");w(this,"isBType");w(this,"isContent");w(this,"makeContentKey",(t,n)=>`${t}:${n}`);w(this,"warn");var s,a;if(this.a=t.between[0],this.b=t.between[1],this.cardinality=t.cardinality,n!=null&&n.externalStore||(this.relations=new Map((s=t.relations)==null?void 0:s.map(([u,c])=>[u,new Set(c)])),this.contents=new Map(t.contents)),this.isAType=(n==null?void 0:n.isAType)??null,this.isBType=(n==null?void 0:n.isBType)??null,this.isContent=(n==null?void 0:n.isContent)??null,n!=null&&n.makeContentKey&&(this.makeContentKey=n.makeContentKey),n!=null&&n.externalStore){const u=n.externalStore;this.has=(c,d)=>u.has(c,d),this.addRelation=(c,d)=>{u.addRelation(c,d)},this.deleteRelation=(c,d)=>{u.deleteRelation(c,d)},this.replaceRelationsSafely=(c,d)=>{u.replaceRelationsSafely(c,d)},this.replaceRelationsUnsafely=(c,d)=>{u.replaceRelationsUnsafely(c,d)},this.getRelatedKeys=c=>u.getRelatedKeys(c),u.getContent&&(this.getContentInternal=c=>u.getContent(c),this.setContent=(c,d)=>{u.setContent(c,d)},this.deleteContent=c=>{u.deleteContent(c)});for(const[c,d]of t.relations??[]){let h=(a=this.isAType)!=null&&a.call(this,c)?c:void 0,p=h===void 0?c:void 0;for(const y of d)h??(h=y),p??(p=y),this.addRelation(h,p)}for(const[c,d]of t.contents??[])this.setContent(c,d)}n!=null&&n.warn&&(this.warn=n.warn)}getRelatedKeys(t){return this.relations.get(t)}addRelation(t,n){let s=this.relations.get(t),a=this.relations.get(n);s?s.add(n):(s=new Set([n]),this.relations.set(t,s)),a?a.add(t):(a=new Set([t]),this.relations.set(n,a))}deleteRelation(t,n){const s=this.relations.get(t);if(s){s.delete(n),s.size===0&&this.relations.delete(t);const a=this.relations.get(n);a&&(a.delete(t),a.size===0&&this.relations.delete(n))}}replaceRelationsUnsafely(t,n){this.relations.set(t,new Set(n));for(const s of n){const a=new Set().add(t);this.relations.set(s,a)}}replaceRelationsSafely(t,n){var c;const s=this.relations.get(t);let a=(c=this.isAType)!=null&&c.call(this,t)?t:void 0,u=a===void 0?t:void 0;if(s)for(const d of s){a??(a=d),u??(u=d);const h=this.relations.get(d);h&&(h.size===1?this.relations.delete(d):h.delete(t),this.contents.delete(this.makeContentKey(a,u)))}this.relations.set(t,new Set(n));for(const d of n){let h=this.relations.get(d);h?h.add(t):(h=new Set().add(t),this.relations.set(d,h))}}getContentInternal(t){return this.contents.get(t)}setContent(t,n){this.contents.set(t,n)}deleteContent(t){this.contents.delete(t)}toJSON(){return{between:[this.a,this.b],cardinality:this.cardinality,relations:[...this.relations.entries()].map(([t,n])=>[t,[...n]]),contents:[...this.contents.entries()]}}set(...t){let n,s,a;switch(t.length){case 1:{const u=t[0];n=u[this.a],s=u[this.b],a=void 0;break}case 2:{const u=t[0];typeof u=="string"?[n,s]=t:(n=u[this.a],s=u[this.b],a=t[1]);break}default:{n=t[0],s=t[1],a=t[2];break}}switch(this.cardinality){case"1:1":{const u=this.getRelatedKey(n);u&&u!==s&&this.delete(n,u)}case"1:n":{const u=this.getRelatedKey(s);u&&u!==n&&this.delete(u,s)}break}if(a){const u=this.makeContentKey(n,s);this.setContent(u,a)}return this.addRelation(n,s),this}delete(t,n){n=typeof n=="string"?n:t[this.b];const s=typeof t=="string"?t:t[this.a];if(s===void 0&&typeof n=="string"){const a=this.getRelatedKeys(n);if(a)for(const u of a)this.delete(u,n)}if(typeof s=="string"&&n===void 0){const a=this.getRelatedKeys(s);if(a)for(const u of a)this.delete(s,u)}if(typeof s=="string"&&typeof n=="string"){this.deleteRelation(s,n);const a=this.makeContentKey(s,n);this.deleteContent(a)}return this}getRelatedKey(t){var s;const n=this.getRelatedKeys(t);if(n){n.size>1&&((s=this.warn)==null||s.call(this,`${n.size} related keys were found for key "${t}": (${[...n].map(u=>`"${u}"`).join(", ")}). Only one related key was expected.`));let a;for(const u of n){a=u;break}return a}}replaceRelations(t,n,s){const a=!Array.isArray(n),u=a?Object.keys(n):n;if(s!=null&&s.reckless?this.replaceRelationsUnsafely(t,u):this.replaceRelationsSafely(t,u),a)for(const c of u){const d=this.makeContentKey(t,c),h=n[c];this.setContent(d,h)}return this}getContent(t,n){const s=this.makeContentKey(t,n);return this.getContentInternal(s)}getRelationEntries(t){const n=t[this.a],s=t[this.b];if(n!==void 0&&s===void 0){const a=this.getRelatedKeys(n);if(a)return[...a].map(u=>[u,this.getContent(n,u)])}if(n===void 0&&s!==void 0){const a=this.getRelatedKeys(s);if(a)return[...a].map(u=>[u,this.getContent(u,s)])}return[]}has(t,n){if(n){const s=this.getRelatedKeys(t);return(s==null?void 0:s.has(n))??!1}return this.relations.has(t)}}class Gt{constructor(){w(this,"Subscriber");w(this,"subscribers",new Map)}subscribe(t,n){return this.subscribers.set(t,n),()=>{this.unsubscribe(t)}}unsubscribe(t){this.subscribers.delete(t)}next(t){const n=this.subscribers.values();for(const s of n)s(t)}}class bC extends Gt{constructor(n){super();w(this,"state");this.state=n}next(n){this.state=n,super.next(n)}}function ji(e){return"epoch"in e.transactionMeta}function Kt(e){return"phase"in e.transactionMeta}const vC=e=>{const t=Re(e);if(!Kt(t)){e.logger.warn("๐","transaction","???","abortTransaction called outside of a transaction. This is probably a bug in AtomIO.");return}e.logger.info("๐ช","transaction",t.transactionMeta.update.key,"Aborting transaction"),t.parent.child=null};function SC(e){return e[0].toUpperCase()+e.slice(1)}function xC(e){return e.type.split("_").map(SC).join(" ")}class fm extends Error{constructor(t,n){super(`${xC(t)} ${Kn(t.key)} not found in store "${n.config.name}".`)}}function dm(e,t,n){return(...s)=>{const a=Lt(e,t);if(a)return a.run(s,n);throw new fm(t,e)}}const Px=e=>t=>e instanceof Function?e(t):e,_c=(e,t)=>{if(e.valueMap.has(t.key))return e.logger.info("๐",t.type,t.key,"reading cached value"),QC(t,e);switch(t.type){case"selector":case"readonly_selector":return e.logger.info("๐งฎ",t.type,t.key,"computing value"),t.get();case"atom":case"mutable_atom":{const n=t.default;let s;return n instanceof Function?s=n():s=n,e.logger.info("๐","atom",t.key,"could not find cached value; using default",s),s}}},wC=(e,t)=>{if(e.operation.open){const n=performance.now();return e.logger.info("โ",t.type,t.key,`deferring setState at T-${n} until setState for "${e.operation.token.key}" is done`),n}e.operation={open:!0,done:new Set,prev:new Map,time:Date.now(),token:t},e.logger.info("โญ",t.type,t.key,`operation start in store "${e.config.name}"${Kt(e)?` ${e.transactionMeta.phase} "${e.transactionMeta.update.key}"`:""}`)},AC=e=>{e.operation.open&&e.logger.info("๐ด",e.operation.token.type,e.operation.token.key,`operation done in store "${e.config.name}"`),e.operation={open:!1},e.on.operationClose.next(e.operation)},TC=(e,t)=>e.operation.open?e.operation.done.has(t):(e.logger.error("๐","unknown",t,"isDone called outside of an operation. This is probably a bug in AtomIO."),!0),hm=(e,t)=>{if(!e.operation.open){e.logger.error("๐","unknown",t,"markDone called outside of an operation. This is probably a bug in AtomIO.");return}e.operation.done.add(t)},EC=(e,t,n)=>{switch(t.type){case"mutable_atom":e.logger.info("๐ข",t.type,t.key,"is now (",n.newValue,") subscribers:",t.subject.subscribers);break;case"atom":case"selector":case"readonly_selector":e.logger.info("๐ข",t.type,t.key,"went (",n.oldValue,"->",n.newValue,") subscribers:",t.subject.subscribers)}t.subject.next(n)},T0=(e,t)=>{const n=Re(e),s=n.selectorAtoms.getRelatedKeys(t.key);if(n.logger.info("๐งน",t.type,t.key,s?`evicting ${s.size} states downstream:`:"no downstream states",s??"to evict"),s){n.operation.open&&n.logger.info("๐งน",t.type,t.key,`[ ${[...n.operation.done].join(", ")} ] already done`);for(const a of s)TC(n,a)||(WC(a,n),hm(n,a))}},RC=(e,t,n)=>{const s=_c(e,t);let a=s;if(t.type==="mutable_atom"&&Kt(e)){const{parent:c}=e;a=op(e,t,c)}a=Px(n)(a),e.logger.info("๐","atom",t.key,"set to",a),a=sr(e,t.key,a,t.subject),ek(e,t.key)&&tk(e,t.key),hm(e,t.key),T0(e,t);const u={oldValue:s,newValue:a};if(!Kt(e)){EC(e,t,u);return}if(e.on.transactionApplying.state===null){const{key:c}=t;if(JC(u.newValue))return;const d={type:"atom_update",key:c,...u};t.family&&(d.family=t.family),e.transactionMeta.update.updates.push(d),e.logger.info("๐","atom",c,"stowed (",u.oldValue,"->",u.newValue,")")}else if(t.key.startsWith("*")){const c=t.key.slice(1),d=e.atoms.get(c);let h=e.valueMap.get(c);if(d.type==="mutable_atom"&&Kt(e)){const{parent:y}=e;h=op(e,d,y)}h.do(u.newValue)===null&&T0(e,d)}},Ix=(e,t,n)=>{switch(t.type){case"atom":case"mutable_atom":RC(e,t,n);break;case"selector":t.set(n);break}},pm=(e,t)=>Re(e).atoms.has(t),OC=(e,t)=>Re(e).selectors.has(t),MC=(e,t)=>Re(e).readonlySelectors.has(t),CC=(e,t)=>pm(e,t)||OC(e,t)||MC(e,t),ap=(e,t)=>Re(t).selectorGraph.getRelationEntries({downstreamSelectorKey:e}).filter(([s,{source:a}])=>a!==e).map(([s,{source:a}])=>a).filter(s=>CC(t,s)),Hx=(e,t,n)=>{const s=[],a=ap(e,n);for(;a.length>0;){const u=a.shift();t.has(u)||(t.add(u),pm(n,u)?s.includes(u)||s.push(u):a.push(...ap(u,n)))}return s},kC=(e,t)=>{const n=e.key,s=ap(n,t),a=new Set;return s.flatMap(u=>pm(t,u)?u:Hx(u,a,t))},DC=(e,t,n,s)=>{const a=Re(s);if(t.type==="atom"||t.type==="mutable_atom")a.selectorAtoms.set({selectorKey:e,atomKey:t.key}),s.logger.info("๐","selector",e,`discovers root atom "${t.key}"`);else{const u=Hx(t.key,n,s);s.logger.info("๐","selector",e,`discovers root atoms: [ ${u.map(c=>`"${c}"`).join(", ")} ]`);for(const c of u)a.selectorAtoms=a.selectorAtoms.set({selectorKey:e,atomKey:c})}n.add(t.key)},Gx=(e,t,n)=>({get:(...s)=>{const a=Re(n);let u;if(s.length===2){const[h,p]=s;u=gn(n,h,p)}else[u]=s;const c=Lt(n,u),d=_c(n,c);return n.logger.info("๐","selector",e,`registers dependency ( "${u.key}" =`,d,")"),a.selectorGraph.set({upstreamSelectorKey:u.key,downstreamSelectorKey:e},{source:u.key}),DC(e,u,t,n),d},set:(...s)=>{let a,u;if(s.length===2)a=s[0],u=s[1];else{const h=s[0],p=s[1];u=s[2],a=gn(n,h,p)}const c=Re(n),d=Lt(c,a);Ix(c,d,u)},find:(...s)=>gn(n,...s),json:s=>Bc(n,s)}),Fx=(e,t,n)=>{const s=Re(e),a=new Gt,u=new Set,{get:c,find:d,json:h}=Gx(t.key,u,s),p=()=>{const S=t.get({get:c,find:d,json:h});return sr(Re(e),t.key,S,a),u.clear(),S},y={...t,subject:a,install:S=>Fx(S,t,n),get:p,type:"readonly_selector",...n};s.readonlySelectors.set(t.key,y);const g=p();return e.logger.info("โจ",y.type,y.key,"=",g),{key:t.key,type:"readonly_selector"}},Yx=(e,t,n)=>{const s=Re(e),a=new Gt,u=new Set,c=Gx(t.key,u,s),{find:d,get:h,json:p}=c,y={find:d,get:h,json:p},g=(M=t.get,D=Re(e))=>{const $=M(y);return sr(D,t.key,$,a),u.clear(),$},S={...t,subject:a,install:M=>Yx(M,t,n),get:g,set:M=>{const D=Re(e),$=g(t.get,D),k=Px(M)($);e.logger.info("๐","selector",t.key,"set (",$,"->",k,")"),sr(D,t.key,k,a),hm(D,t.key),ji(D)&&a.next({newValue:k,oldValue:$}),t.set(c,k)},type:"selector",...n};s.selectors.set(t.key,S);const T=g();return e.logger.info("โจ",S.type,S.key,"=",T),{key:t.key,type:"selector"}};function Xx(e,t){if("set"in t){const a=Yx(e,t,void 0);return e.on.selectorCreation.next(a),a}const s=Fx(e,t,void 0);return e.on.selectorCreation.next(s),s}function NC(e,t){const n=Re(e),{key:s}=t,a=Lt(n,t);if(!a.family)e.logger.error("โ","selector",s,"Standalone selectors cannot be disposed.");else{n.molecules.get(a.family.subKey)&&n.moleculeData.delete(a.family.subKey,a.family.key);let c;switch(t.type){case"selector":n.selectors.delete(s),c={key:a.family.key,type:"selector_family"},Lt(e,c).subject.next({type:"state_disposal",subType:"selector",token:t});break;case"readonly_selector":n.readonlySelectors.delete(s),c={key:a.family.key,type:"readonly_selector_family"},Lt(e,c).subject.next({type:"state_disposal",subType:"selector",token:t});break}n.valueMap.delete(s),n.selectorAtoms.delete(s),n.selectorGraph.delete(s),e.logger.info("๐ฅ",t.type,s,"deleted"),Kt(n)&&n.transactionMeta.phase==="building"?n.transactionMeta.update.updates.push({type:"state_disposal",subType:"selector",token:t}):e.on.selectorDisposal.next(t)}}function _C(e,t,n){const s=e.families.get(t.key);if(s===void 0)throw new fm(t,e);const a=s(n),u=Re(e);if(a.family)if(ji(u))switch(a.type){case"atom":case"mutable_atom":e.on.atomCreation.next(a);break;case"selector":case"readonly_selector":e.on.selectorCreation.next(a);break}else Kt(u)&&u.on.transactionApplying.state===null&&u.transactionMeta.update.updates.push({type:"state_creation",token:a});return a}function $C(e,t,n){const s=Kn(n),a=`${t.key}(${s})`,u=Re(e);let c;switch(t.type){case"atom_family":case"mutable_atom_family":c=u.atoms.get(a);break;case"selector_family":c=u.selectors.get(a);break;case"readonly_selector_family":c=u.readonlySelectors.get(a);break}return c&&ha(c)}function gn(e,t,n){let s=$C(e,t,n);if(s)return s;const a=Kn(n),u=e.molecules.get(a);if(!u&&e.config.lifespan==="immortal"){const c=dC(t,n);return e.logger.error("โ",c.type,c.key,`was not found in store "${e.config.name}"; returned a counterfeit token.`),c}return s=_C(e,t,n),u&&Re(e).moleculeData.set(a,t.key),s}function $c(e,...t){let n;if(t.length===1)n=t[0];else{const s=t[0],a=t[1];n=gn(e,s,a)}try{Lt(e,n)}catch{e.logger.error("โ",n.type,n.key,`could not be disposed because it was not found in the store "${e.config.name}".`);return}switch(n.type){case"atom":case"mutable_atom":bm(e,n);break;case"selector":case"readonly_selector":NC(e,n);break}}function BC(e,t){if(t.family){const n=e.families.get(t.family.key);if(n)return n}}function At(e,...t){let n,s,a,u;if(t.length===2?(n=t[0],u=t[1],s=BC(e,n)??null,s&&(a=n.family?sl(n.family.subKey):null,n=gn(e,s,a))):(s=t[0],a=t[1],u=t[2],n=gn(e,s,a)),"counterfeit"in n&&"family"in n){const h=n.family.subKey,p=e.disposalTraces.buffer.find(y=>(y==null?void 0:y.key)===h);e.logger.error("โ",n.type,n.key,`could not be set because it was not found in the store "${e.config.name}".`,p?`This state was previously disposed:
|
|
18
|
-
${p.trace}`:"No previous disposal trace was found.");return}const c=wC(e,n);if(c){const h=e.on.operationClose.subscribe(`waiting to set "${n.key}" at T-${c}`,()=>{h(),e.logger.info("๐ข",n.type,n.key,`resuming deferred setState from T-${c}`),At(e,n,u)});return}const d=Lt(e,n);Ix(e,d,u),AC(e)}function LC(e,t,n){const{key:s,newValue:a,oldValue:u}=t,c=e==="newValue"?a:u,d={key:s,type:"atom"};t.family&&Object.assign(d,{family:t.family}),At(n,d,c)}function VC(e){var n,s;const{stack:t}=e;return t?`
|
|
19
|
-
`+((s=(n=t.split(`
|
|
20
|
-
`))==null?void 0:n.slice(1))==null?void 0:s.join(`
|
|
21
|
-
`)):""}function Zx(e,t,n,s="any"){const a=t,u=Kn(n),c=[],d=Re(e);if(Array.isArray(a))for(const y of a){const g=Kn(y);d.molecules.get(g)?e.moleculeGraph.set(g,u,{source:g}):c.push(g)}else{const y=Kn(a);d.molecules.get(y)?e.moleculeGraph.set(y,u,{source:y}):c.push(y)}c.length===0&&d.molecules.set(u,{key:n,stringKey:u,dependsOn:s});const h={type:"molecule_creation",key:n,provenance:a};Kt(d)&&d.transactionMeta.phase==="building"?d.transactionMeta.update.updates.push(h):d.on.moleculeCreation.next(h);for(const y of c){const g=e.disposalTraces.buffer.find(v=>(v==null?void 0:v.key)===y);e.logger.error("โ","molecule",n,"allocation failed:",`Could not allocate to ${y} in store "${e.config.name}".`,g?`
|
|
22
|
-
${y} was most recently disposed
|
|
23
|
-
${g.trace}`:`No previous disposal trace for ${y} was found.`)}return n}function mm(e,t){const n=Kn(t),s=e.molecules.get(n);if(!s){const S=e.disposalTraces.buffer.find(T=>(T==null?void 0:T.key)===n);e.logger.error("โ","molecule",t,"deallocation failed:",`Could not find allocation for ${n} in store "${e.config.name}".`,S?`
|
|
24
|
-
This state was most recently deallocated
|
|
25
|
-
${S.trace}`:`No previous disposal trace for ${n} was found.`);return}const a=e.moleculeJoins.getRelatedKeys(s.key);if(a)for(const S of a){const T=e.joins.get(S);T&&(T.relations.delete(s.key),T.molecules.delete(s.stringKey))}e.moleculeJoins.delete(s.stringKey);const u=[],c=[],d={type:"molecule_disposal",key:s.key,values:c,provenance:u},h=Re(e);h.molecules.delete(n);const p=Kt(h)&&h.transactionMeta.phase==="building";p&&h.transactionMeta.update.updates.push(d);const y=e.moleculeGraph.getRelationEntries({downstreamMoleculeKey:s.stringKey});if(y)for(const[S,{source:T}]of y)if(T===s.stringKey){const R=sl(S);mm(e,R)}else u.push(T);const g=h.moleculeData.getRelatedKeys(s.stringKey);if(g)for(const S of g){const T=h.families.get(S),R=gn(e,T,s.key);c.push([T.key,R]),$c(e,R)}h.moleculeGraph.delete(s.stringKey),h.moleculeJoins.delete(s.stringKey),h.moleculeData.delete(s.stringKey),p||h.on.moleculeDisposal.next(d),h.molecules.delete(s.stringKey);const v=VC(new Error);e.disposalTraces.add({key:n,trace:v})}function E0(e,t,n,s){const a=Kn(n),u=Re(e),c=u.molecules.get(a);if(!c){const v=e.disposalTraces.buffer.find(S=>(S==null?void 0:S.key)===a);return e.logger.error("โ","molecule",n,"claim failed:",`Could not allocate to ${a} in store "${e.config.name}".`,v?`
|
|
26
|
-
${a} was most recently disposed
|
|
27
|
-
${v.trace}`:`No previous disposal trace for ${a} was found.`),n}const d=Kn(t),h=u.molecules.get(d);if(!h){const v=e.disposalTraces.buffer.find(S=>(S==null?void 0:S.key)===d);return e.logger.error("โ","molecule",n,"claim failed:",`Could not allocate to ${d} in store "${e.config.name}".`,v?`
|
|
28
|
-
${d} was most recently disposed
|
|
29
|
-
${v.trace}`:`No previous disposal trace for ${d} was found.`),n}const p=e.moleculeGraph.getRelationEntries({downstreamMoleculeKey:c.stringKey}).filter(([,{source:v}])=>v!==a).map(([v])=>sl(v));u.moleculeGraph.delete(a),u.moleculeGraph.set({upstreamMoleculeKey:h.stringKey,downstreamMoleculeKey:c.stringKey},{source:h.stringKey});const y={type:"molecule_transfer",key:c.key,from:p,to:[h.key]};return Kt(u)&&u.transactionMeta.phase==="building"&&u.transactionMeta.update.updates.push(y),n}function jC(e,t,n){switch(t){case"newValue":{Jx(e,n);break}case"oldValue":{$c(n,e.token);break}}}function zC(e,t,n){switch(t){case"newValue":{$c(n,e.token);break}case"oldValue":{Jx(e,n),e.subType==="atom"&&n.valueMap.set(e.token.key,e.value);break}}}function Jx(e,t){const{family:n}=e.token;if(n){const s=t.families.get(n.key);s&&gn(t,s,sl(n.subKey))}}function UC(e,t,n){switch(t){case"newValue":Zx(n,e.provenance,e.key);break;case"oldValue":mm(n,e.key);break}}function qC(e,t,n){switch(t){case"newValue":mm(n,e.key);break;case"oldValue":{const s=e.provenance.map(sl);Zx(n,s,e.key);for(const[a,u]of e.values){const c=n.families.get(a);if(c){gn(n,c,e.key);const d=`${a}(${Kn(e.key)})`;n.valueMap.set(d,u)}}}break}}function KC(e,t,n){switch(t){case"newValue":{const s=e.to.length===1?e.to[0]:e.to;E0(n,s,e.key)}break;case"oldValue":{const s=e.from.length===1?e.from[0]:e.from;E0(n,s,e.key)}break}}function ea(e,t,n){const s=e==="newValue"?t.updates:[...t.updates].reverse();for(const a of s)switch(a.type){case"atom_update":case"selector_update":LC(e,a,n);break;case"state_creation":jC(a,e,n);break;case"state_disposal":zC(a,e,n);break;case"molecule_creation":UC(a,e,n);break;case"molecule_disposal":qC(a,e,n);break;case"molecule_transfer":KC(a,e,n);break;case"transaction_update":ea(e,a,n);break}}function Qx(e,t){return e.transactionMeta.actionContinuities.getRelatedKey(t)}function Wx(e,t){return e.transactionMeta.epoch.get(t)}function PC(e,t){if(!ji(e))return;const s=Qx(e,t);if(s!==void 0)return Wx(e,s)}function ym(e,t,n){ji(e)&&t&&e.transactionMeta.epoch.set(t,n)}function IC(e,t,n){if(!ji(e))return;const a=Qx(e,t);a!==void 0&&e.transactionMeta.epoch.set(a,n)}const HC=(e,t)=>{var u;const n=Re(t),{parent:s}=n;if(s===null||!Kt(n)||((u=n.transactionMeta)==null?void 0:u.phase)!=="building"){t.logger.warn("๐","transaction","???","applyTransaction called outside of a transaction. This is probably a bug in AtomIO.");return}n.transactionMeta.phase="applying",n.transactionMeta.update.output=e,s.child=null,s.on.transactionApplying.next(n.transactionMeta);const{updates:a}=n.transactionMeta.update;if(t.logger.info("๐","transaction",n.transactionMeta.update.key,`Applying transaction with ${a.length} updates:`,a),ea("newValue",n.transactionMeta.update,s),ji(s)){IC(s,n.transactionMeta.update.key,n.transactionMeta.update.epoch);const c=Lt(t,{key:n.transactionMeta.update.key,type:"transaction"});c==null||c.subject.next(n.transactionMeta.update),t.logger.info("๐ฌ","transaction",n.transactionMeta.update.key,"Finished applying transaction.")}else Kt(s)&&s.transactionMeta.update.updates.push(n.transactionMeta.update);s.on.transactionApplying.next(null)};function ew(e,t,n){if(!ji(e))return;const{epoch:a,actionContinuities:u}=e.transactionMeta;u.set(t,n),a.has(t)||a.set(t,-1)}function GC(e){return{store:e}}function ki(e,...t){let n,s,a;if(t.length===1?n=t[0]:(s=t[0],a=t[1],n=gn(e,s,a)),"counterfeit"in n&&"family"in n){s=e.families.get(n.family.key);const u=n.family.subKey,c=e.disposalTraces.buffer.find(d=>(d==null?void 0:d.key)===u);switch(e.logger.error("โ",n.type,n.key,`could not be retrieved because it was not found in the store "${e.config.name}".`,c?`This state was previously disposed:
|
|
30
|
-
${c.trace}`:"No previous disposal trace was found."),s.type){case"atom_family":case"mutable_atom_family":return e.defaults.get(s.key);case"selector_family":case"readonly_selector_family":{if(e.defaults.has(s.key))return e.defaults.get(n.family.key);const d=Lt(e,s).default(u);return e.defaults.set(s.key,d),d}}}return _c(e,Lt(e,n))}class Zn extends Map{constructor(n){super();w(this,"deleted",new Set);w(this,"source");this.source=n}get(n){if(super.has(n))return super.get(n);if(!this.deleted.has(n)&&this.source.has(n))return this.source.get(n)}set(n,s){return this.deleted.delete(n),super.set(n,s)}hasOwn(n){return super.has(n)}has(n){return!this.deleted.has(n)&&(super.has(n)||this.source.has(n))}delete(n){return this.deleted.add(n),super.delete(n)}}const FC=(e,t,n,s)=>{const a=Re(e),u={parent:a,child:null,on:a.on,loggers:a.loggers,logger:a.logger,config:a.config,atoms:new Zn(a.atoms),atomsThatAreDefault:new Set(a.atomsThatAreDefault),families:new Zn(a.families),joins:new Zn(a.joins),operation:{open:!1},readonlySelectors:new Zn(a.readonlySelectors),timelines:new Zn(a.timelines),timelineTopics:new nn(a.timelineTopics.toJSON()),trackers:new Map,transactions:new Zn(a.transactions),selectorAtoms:new nn(a.selectorAtoms.toJSON()),selectorGraph:new nn(a.selectorGraph.toJSON(),{makeContentKey:(...p)=>p.sort().join(":")}),selectors:new Zn(a.selectors),valueMap:new Zn(a.valueMap),defaults:a.defaults,disposalTraces:e.disposalTraces.copy(),molecules:new Zn(a.molecules),moleculeGraph:new nn(a.moleculeGraph.toJSON(),{makeContentKey:a.moleculeGraph.makeContentKey}),moleculeData:new nn(a.moleculeData.toJSON(),{makeContentKey:a.moleculeData.makeContentKey}),moleculeJoins:new nn(a.moleculeJoins.toJSON(),{makeContentKey:a.moleculeJoins.makeContentKey}),miscResources:new Zn(a.miscResources)},c=PC(e,t),d={phase:"building",update:{type:"transaction_update",key:t,id:s,epoch:c===void 0?Number.NaN:c+1,updates:[],params:n,output:void 0},toolkit:{get:(...p)=>ki(h,...p),set:(...p)=>{At(h,...p)},run:(p,y=Nc())=>dm(h,p,y),find:(...p)=>gn(e,...p),json:p=>Bc(h,p),dispose:(...p)=>{$c(h,...p)},env:()=>GC(h)}},h=Object.assign(u,{transactionMeta:d});return a.child=h,e.logger.info("๐ซ","transaction",t,"Building transaction with params:",n),h};function tw(e,t){const n={key:t.key,type:"transaction",run:(u,c)=>{const d=FC(e,t.key,u,c);try{const h=Re(e),{toolkit:p}=d.transactionMeta,y=t.do(p,...u);return HC(y,h),y}catch(h){throw vC(s),e.logger.warn("๐ฅ","transaction",t.key,"caught:",h),h}},install:u=>tw(u,t),subject:new Gt},s=Re(e);s.transactions.set(n.key,n);const a=ha(n);return e.on.transactionCreation.next(a),a}class YC{constructor(t,n=null){w(this,"parent",null);w(this,"child",null);w(this,"valueMap",new Map);w(this,"defaults",new Map);w(this,"atoms",new Map);w(this,"selectors",new Map);w(this,"readonlySelectors",new Map);w(this,"atomsThatAreDefault",new Set);w(this,"selectorAtoms",new nn({between:["selectorKey","atomKey"],cardinality:"n:n"}));w(this,"selectorGraph",new nn({between:["upstreamSelectorKey","downstreamSelectorKey"],cardinality:"n:n"},{makeContentKey:(...t)=>t.sort().join(":")}));w(this,"trackers",new Map);w(this,"families",new Map);w(this,"joins",new Map);w(this,"transactions",new Map);w(this,"transactionMeta",{epoch:new Map,actionContinuities:new nn({between:["continuity","action"],cardinality:"1:n"})});w(this,"timelines",new Map);w(this,"timelineTopics",new nn({between:["timelineKey","topicKey"],cardinality:"1:n"}));w(this,"disposalTraces",new cm(100));w(this,"molecules",new Map);w(this,"moleculeJoins",new nn({between:["moleculeKey","joinKey"],cardinality:"n:n"},{makeContentKey:(...t)=>t.sort().join(":")}));w(this,"moleculeGraph",new nn({between:["upstreamMoleculeKey","downstreamMoleculeKey"],cardinality:"n:n"},{makeContentKey:(...t)=>t.sort().join(":")}));w(this,"moleculeData",new nn({between:["moleculeKey","stateFamilyKey"],cardinality:"n:n"},{makeContentKey:(...t)=>t.sort().join(":")}));w(this,"miscResources",new Map);w(this,"on",{atomCreation:new Gt,atomDisposal:new Gt,selectorCreation:new Gt,selectorDisposal:new Gt,timelineCreation:new Gt,transactionCreation:new Gt,transactionApplying:new bC(null),operationClose:new Gt,moleculeCreation:new Gt,moleculeDisposal:new Gt});w(this,"operation",{open:!1});w(this,"config",{name:"IMPLICIT_STORE",lifespan:"ephemeral"});w(this,"loggers",[new pC("warn",(t,n,s)=>!ik(s))]);w(this,"logger",{error:(...t)=>{for(const n of this.loggers)n.error(...t)},info:(...t)=>{for(const n of this.loggers)n.info(...t)},warn:(...t)=>{for(const n of this.loggers)n.warn(...t)}});var s,a;if(this.config={...n==null?void 0:n.config,...t},n!==null){this.valueMap=new Map(n==null?void 0:n.valueMap),this.operation={...n==null?void 0:n.operation},ji(n)&&(this.transactionMeta={epoch:new Map(n==null?void 0:n.transactionMeta.epoch),actionContinuities:new nn(n==null?void 0:n.transactionMeta.actionContinuities.toJSON())});for(const[,c]of n.families)(s=c.internalRoles)!=null&&s.includes("mutable")||(a=c.internalRoles)!=null&&a.includes("join")||c.install(this);const u=new Set;for(const[,c]of n.atoms)if(!u.has(c.key)&&(c.install(this),c.type==="mutable_atom")){const d=Bc(n,c),h=aw(c);u.add(d.key),u.add(h.key)}for(const[,c]of n.readonlySelectors)c.install(this);for(const[,c]of n.selectors)u.has(c.key)||c.install(this);for(const[,c]of n.transactions)c.install(this);for(const[,c]of n.timelines)c.install(this)}}}const vn={get STORE(){return globalThis.ATOM_IO_IMPLICIT_STORE??(globalThis.ATOM_IO_IMPLICIT_STORE=new YC({name:"IMPLICIT_STORE",lifespan:"ephemeral"})),globalThis.ATOM_IO_IMPLICIT_STORE}};function Lt(e,t){let n,s=e;for(;s!==null;){switch(t.type){case"atom":case"mutable_atom":n=s.atoms.get(t.key);break;case"selector":n=s.selectors.get(t.key);break;case"readonly_selector":n=s.readonlySelectors.get(t.key);break;case"atom_family":case"mutable_atom_family":case"selector_family":case"readonly_selector_family":n=s.families.get(t.key);break;case"timeline":n=s.timelines.get(t.key);break;case"transaction":n=s.transactions.get(t.key);break}if(n)return n;s=s.child}throw new fm(t,e)}const XC=(e,t)=>{const n=Re(e);return n.operation.open?n.operation.prev.get(t.key):n.valueMap.get(t.key)};function ZC(e,t,n,s=Nc()){switch(t.type){case"atom":case"mutable_atom":case"readonly_selector":case"selector":return pa(e,t,s,n);case"transaction":return iw(e,t,s,n);case"timeline":return nw(e,t,s,n)}}const R0=(e,t)=>{const n=Re(e);return kC(t,e).map(a=>{const u=n.atoms.get(a);if(u===void 0)throw new Error(`Atom "${a}", a dependency of selector "${t.key}", not found in store "${e.config.name}".`);return u.subject.subscribe(`${t.type}:${t.key}`,c=>{e.logger.info("๐ข",t.type,t.key,"root",a,"went",c.oldValue,"->",c.newValue);const d=XC(n,t),h=_c(n,t);e.logger.info("โจ",t.type,t.key,"went",d,"->",h),t.subject.next({newValue:h,oldValue:d})})})};function pa(e,t,n,s){function a(g){if(e.operation.open){const v=e.on.operationClose.subscribe(`state subscription ${n}`,()=>{v(),s(g)})}else s(g)}const u=Lt(e,t);e.logger.info("๐",u.type,u.key,`Adding subscription "${n}"`);const c=u.type==="selector"||u.type==="readonly_selector";let d=null,h=a;c&&(d=R0(e,u),h=g=>{d&&(d.length=0,d.push(...R0(e,u))),a(g)});const p=u.subject.subscribe(n,h);return()=>{if(e.logger.info("๐",u.type,u.key,`Removing subscription "${n}"`),p(),d)for(const g of d)g()}}const nw=(e,t,n,s)=>{const a=Lt(e,t);e.logger.info("๐","timeline",t.key,`Adding subscription "${n}"`);const u=a.subject.subscribe(n,s);return()=>{e.logger.info("๐","timeline",t.key,`Removing subscription "${n}" from timeline`),u()}},iw=(e,t,n,s)=>{const a=Lt(e,t);e.logger.info("๐","transaction",t.key,`Adding subscription "${n}"`);const u=a.subject.subscribe(n,s);return()=>{e.logger.info("๐","transaction",t.key,`Removing subscription "${n}"`),u()}};var wx;wx=Symbol.dispose;class sw{constructor(t,n){w(this,"unsubscribeFromInnerValue");w(this,"unsubscribeFromState");w(this,"mutableState");w(this,"latestUpdateState");w(this,wx);this.mutableState=t;const s=Re(n);this.latestUpdateState=this.initializeState(t,s),this.observeCore(t,this.latestUpdateState,s),this.updateCore(t,this.latestUpdateState,s),s.trackers.set(t.key,this),this[Symbol.dispose]=()=>{this.unsubscribeFromInnerValue(),this.unsubscribeFromState(),s.trackers.delete(t.key)}}initializeState(t,n){var c;const s=`*${t.key}`;n.atoms.delete(s),n.valueMap.delete(s);const a=t.family?{key:`*${t.family.key}`,subKey:t.family.subKey}:void 0,u=gm(n,{key:s,default:null},a);if((c=n.parent)!=null&&c.valueMap.has(s)){const d=n.parent.valueMap.get(s);n.valueMap.set(s,d)}return u}observeCore(t,n,s){const a=`tracker:${s.config.name}:${Kt(s)?s.transactionMeta.update.key:"main"}:${t.key}`,u=ki(s,t);this.unsubscribeFromInnerValue=u.subscribe(a,c=>{At(s,n,c)}),this.unsubscribeFromState=pa(s,t,a,c=>{c.newValue!==c.oldValue&&(this.unsubscribeFromInnerValue(),this.unsubscribeFromInnerValue=c.newValue.subscribe(a,d=>{At(s,n,d)}))})}updateCore(t,n,s){const a=`tracker:${s.config.name}:${Kt(s)?s.transactionMeta.update.key:"main"}:${t.key}`;pa(s,n,a,({newValue:u,oldValue:c})=>{const d=s.timelineTopics.getRelatedKey(n.key);if(d){const p=s.timelines.get(d);if(p!=null&&p.timeTraveling){const y=nw(s,{key:d,type:"timeline"},a,g=>{y(),At(s,t,v=>(g==="redo"&&u?v.do(u):g==="undo"&&c&&v.undo(c),v))});return}}const h=s.on.operationClose.subscribe(a,()=>{h();const p=ki(s,t),y=u===null?-1:p.getUpdateNumber(u),g=y-p.cacheUpdateNumber;u&&g===1?At(s,t,v=>(v.do(u),v)):s.logger.info("โ","mutable_atom",t.key,`could not be updated. Expected update number ${p.cacheUpdateNumber+1}, but got ${y}`)})})}}function rw(e,t,n){e.logger.info("๐จ","atom",t.key,`creating in store "${e.config.name}"`);const s=Re(e),a=s.atoms.get(t.key);if(a&&a.type==="mutable_atom")return e.logger.error("โ","atom",t.key,"Tried to create atom, but it already exists in the store."),ha(a);const u=new Gt,c={...t,type:"mutable_atom",install:p=>(p.logger.info("๐ ๏ธ","atom",t.key,`installing in store "${p.config.name}"`),rw(p,t)),subject:u},d=t.default();s.atoms.set(c.key,c),ow(e,t.key),sr(s,t.key,d,u);const h=ha(c);if(t.effects){let p=0;const y=[];for(const g of t.effects){const v=g({setSelf:S=>{At(e,h,S)},onSet:S=>pa(e,h,`effect[${p}]`,S)});v&&y.push(v),++p}c.cleanup=()=>{for(const g of y)g()}}return new sw(h,e),cC(h,t,e),h}const Bc=(e,t)=>{if(t.family){const s=Re(e),u={key:`${t.family.key}:JSON`,type:"selector_family"},c=Lt(s,u),d=JSON.parse(t.family.subKey);return gn(e,c,d)}return{type:"selector",key:`${t.key}:JSON`}},aw=e=>{const n={type:"atom",key:`*${e.key}`};return e.family&&(n.family={key:`*${e.family.key}`,subKey:e.family.subKey}),n};function JC(e){return typeof e=="object"&&e!==null&&"do"in e&&"undo"in e&&"subscribe"in e}function op(e,t,n){const s=n.valueMap.get(t.key),a=e.valueMap.get(t.key);if(s!==a)return a;if(s===void 0)return t.default();n.logger.info("๐","atom",t.key,"copying");const u=t.toJson(s),c=t.fromJson(u);return e.valueMap.set(t.key,c),new sw(t,n),c}function sr(e,t,n,s){const a=e.valueMap.get(t);if(a instanceof rp&&a.use(n),n instanceof Promise){const u=new rp(n);return e.valueMap.set(t,u),u.then(c=>{sr(e,t,c,s),s.next({newValue:c,oldValue:u})}).catch(c=>{e.logger.error("๐ฅ","state",t,"rejected:",c)}),u}return e.valueMap.set(t,n),n}const QC=(e,t)=>{let n=t.valueMap.get(e.key);if(e.type==="mutable_atom"&&Kt(t)){const{parent:s}=t;n=op(t,e,s)}return n},WC=(e,t)=>{const n=t.valueMap.get(e);if(n instanceof rp){const s=n,a=t.selectors.get(e)??t.readonlySelectors.get(e);a&&s.use(a.get());return}t.operation.open&&t.operation.prev.set(e,n),t.valueMap.delete(e),t.logger.info("๐","state",e,"evicted")},ek=(e,t)=>Re(e).atomsThatAreDefault.has(t),ow=(e,t)=>{const n=Re(e);n.atomsThatAreDefault=new Set(n.atomsThatAreDefault).add(t)},tk=(e,t)=>{const n=Re(e);n.atomsThatAreDefault=new Set(Re(e).atomsThatAreDefault),n.atomsThatAreDefault.delete(t)};function gm(e,t,n){e.logger.info("๐จ","atom",t.key,`creating in store "${e.config.name}"`);const s=Re(e),a=s.atoms.get(t.key);if(a&&a.type==="atom")return e.logger.error("โ","atom",t.key,"Tried to create atom, but it already exists in the store."),ha(a);const u=new Gt,c={...t,type:"atom",install:p=>(p.logger.info("๐ ๏ธ","atom",t.key,`installing in store "${p.config.name}"`),gm(p,t,n)),subject:u};n&&(c.family=n);let d=t.default;t.default instanceof Function&&(d=t.default()),s.atoms.set(c.key,c),ow(e,t.key),sr(s,t.key,d,u);const h=ha(c);if(t.effects){let p=0;const y=[];for(const g of t.effects){const v=g({setSelf:S=>{At(e,h,S)},onSet:S=>pa(e,h,`effect[${p}]`,S)});v&&y.push(v),++p}c.cleanup=()=>{for(const g of y)g()}}return h}function nk(e,t){if("mutable"in t){const a=rw(e,t);return e.on.atomCreation.next(a),a}const s=gm(e,t,void 0);return e.on.atomCreation.next(s),s}function bm(e,t){var c;const n=Re(e),{key:s,family:a}=t,u=Lt(n,t);if(!a)e.logger.error("โ","atom",s,"Standalone atoms cannot be disposed.");else{(c=u.cleanup)==null||c.call(u);const d=e.valueMap.get(u.key),h=Lt(e,{key:a.key,type:"atom_family"}),p={type:"state_disposal",subType:"atom",token:t,value:d};h.subject.next(p);const y=Kt(n);if(n.atoms.delete(s),n.valueMap.delete(s),n.selectorAtoms.delete(s),n.atomsThatAreDefault.delete(s),e.timelineTopics.delete(s),t.type==="mutable_atom"){const g=aw(t);bm(e,g),e.trackers.delete(s)}if(e.logger.info("๐ฅ","atom",s,"deleted"),y&&n.transactionMeta.phase==="building"){const g=n.transactionMeta.update.updates.at(-1);(g==null?void 0:g.type)==="molecule_disposal"&&g.values.some(([T])=>{var R;return T===((R=u.family)==null?void 0:R.key)})||n.transactionMeta.update.updates.push(p)}else e.on.atomDisposal.next(t)}}function ik(e){return e.startsWith("๐ ")}const vm=j.createContext(vn.STORE);function lw(e,...t){let n;if(t.length===2){const s=t[0],a=t[1];n=gn(e,s,a)}else n=t[0];return n}function Ri(...e){const t=j.useContext(vm),n=lw(t,...e),s=j.useRef(null);return s.current??(s.current=a=>{At(t,n,a)}),s.current}function mt(...e){const t=j.useContext(vm),n=lw(t,...e),s=j.useId();return j.useSyncExternalStore(a=>pa(t,n,`use-o:${s}`,a),()=>ki(t,n),()=>ki(t,n))}const sk=(e,t,n,s,a)=>u=>{function c(h,p){if(e.logger.info("๐งโโ๏ธ","continuity",t,"reconciling updates"),At(e,Fu,g=>(g.shift(),g)),h.id===p.id){const g=JSON.stringify(h.updates),v=JSON.stringify(p.updates);if(g===v){e.logger.info("โ
","continuity",t,`results for ${h.id} match between client and server`),n.emit(`ack:${t}`,p.epoch);return}}else e.logger.info("โ","continuity",t,`thought update #${p.epoch} was ${h.key}:${h.id}, but it was actually ${p.key}:${p.id}`);e.logger.info("๐งโโ๏ธ","continuity",t,"updates do not match",h,p);const y=s.toReversed();for(const g of y)ea("oldValue",g,e);e.logger.info("โช","continuity",t,"undid optimistic updates:",y),ea("oldValue",h,e),e.logger.info("โช","continuity",t,"undid zeroth optimistic update",h),ea("newValue",p,e),e.logger.info("โฉ","continuity",t,"applied confirmed update",p),n.emit(`ack:${t}`,p.epoch);for(const g of s){const v={type:"transaction",key:g.key},{id:S,params:T}=g;dm(e,v,S)(...T)}e.logger.info("โฉ","continuity",t,"reapplied subsequent optimistic updates:",s)}e.logger.info("๐งโโ๏ธ","continuity",t,"integrating confirmed update",{confirmedUpdate:u,confirmedUpdates:a,optimisticUpdates:s});const d=s[0];if(d)if(e.logger.info("๐งโโ๏ธ","continuity",t,"has optimistic updates to reconcile"),u.epoch===d.epoch){e.logger.info("๐งโโ๏ธ","continuity",t,`epoch of confirmed update #${u.epoch} matches zeroth optimistic update`),c(d,u);for(const h of a){const p=s[0];if(h.epoch===(p==null?void 0:p.epoch))c(p,h);else break}}else e.logger.info("๐งโโ๏ธ","continuity",t,`epoch of confirmed update #${u.epoch} does not match zeroth optimistic update #${d.epoch}`),a.some(p=>p.epoch===u.epoch)||(e.logger.info("๐","continuity",t,"pushing confirmed update to queue",u),At(e,lp,p=>(p.push(u),p.sort((y,g)=>y.epoch-g.epoch),p)));else{e.logger.info("๐งโโ๏ธ","continuity",t,"has no optimistic updates to deal with");const h=ji(e);let p;h&&(p=Wx(e,t)),p===u.epoch-1?(e.logger.info("โ
","continuity",t,`integrating update #${u.epoch} (${u.key} ${u.id})`),ea("newValue",u,e),n.emit(`ack:${t}`,u.epoch),ym(e,t,u.epoch)):h&&p!==void 0&&(e.logger.info("๐งโโ๏ธ","continuity",t,`received update #${u.epoch} but still waiting for update #${p+1}`,{clientEpoch:p,serverEpoch:u.epoch}),a.some(g=>g.epoch===u.epoch)?e.logger.info("๐","continuity",t,`confirmed update #${u.epoch} is already enqueued`):(e.logger.info("๐","continuity",t,`pushing confirmed update #${u.epoch} to queue`),At(e,lp,g=>(g.push(u),g.sort((v,S)=>v.epoch-S.epoch),g))))}};function rk(e){return t=>{for(const n of t)bm(e,n)}}function ak(e){return t=>{let n=0,s,a;for(const u of t)n%2===0?s=u:(a=u,At(e,s,a)),n++}}const uw=(e,{stringify:t,parse:n},s)=>({setSelf:a,onSet:u})=>{const c=e.getItem(s);c!=null&&a(n(c)),u(({newValue:d})=>{if(d==null){e.removeItem(s);return}e.setItem(s,t(d))})},cw=It({key:"mySocketId__INTERNAL",default:void 0});ws({key:"mySocketId",get:({get:e})=>e(cw)});It({key:"myName",default:null,effects:typeof window>"u"?[]:[uw(window.localStorage,JSON,"myUsername")]});const Fu=It({key:"updateQueue",default:[]}),lp=It({key:"serverConfirmedUpdateQueue",default:[]});function ok(e,t,n){const s=n.key,a=ki(e,Fu),u=ki(e,lp),c=(g,v)=>{t.off(`continuity-init:${s}`,c);let S=0,T,R;for(const M of v)S%2===0?T=M:(R=M,"type"in T&&T.type==="mutable_atom"&&(T=Bc(e,T)),At(e,T,R)),S++;ym(e,s,g)};t.off(`continuity-init:${s}`),t.on(`continuity-init:${s}`,c);const d=sk(e,s,t,a,u);t.off(`tx-new:${s}`),t.on(`tx-new:${s}`,d);const h=n.actions.map(g=>(ew(e,s,g.key),iw(e,g,`tx-run:${s}`,S=>{e.logger.info("๐ค","continuity",s,"enqueuing optimistic update");const T=a.findIndex(R=>R.id===S.id);T===-1?(e.logger.info("๐ค","continuity",s,"enqueuing new optimistic update"),At(e,Fu,R=>(R.push(S),R.sort((M,D)=>M.epoch-D.epoch),R))):(e.logger.info("๐ค","continuity",s,`replacing existing optimistic update at index ${T}`),At(e,Fu,R=>(R[T]=S,R))),t.emit(`tx-run:${s}`,{id:S.id,key:g.key,params:S.params})}))),p=ak(e),y=rk(e);return t.on(`reveal:${s}`,p),t.on(`conceal:${s}`,y),t.emit(`get:${s}`),()=>{t.off(`continuity-init:${s}`),t.off(`tx-new:${s}`);for(const g of h)g()}}const fw=j.createContext({socket:null,services:null}),lk=({children:e,socket:t})=>{const n=j.useRef(new Map).current,s=Ri(cw);return j.useEffect(()=>{s(t==null?void 0:t.id),t==null||t.on("connect",()=>{s(t.id)}),t==null||t.on("disconnect",()=>{s(void 0)})},[t,s]),K.jsx(fw.Provider,{value:{socket:t,services:n},children:e})};function uk(e,t){const{socket:n,services:s}=j.useContext(fw);ac(()=>{let a=s==null?void 0:s.get(e);return a?a[0]++:(a=[1,n?t(n):void 0],s==null||s.set(e,a)),()=>{var u;a&&(a[0]--,a[0]===0&&((u=a[1])==null||u.call(a),s==null||s.delete(e)))}})}function ck(e){const t=j.useContext(vm);uk(`tx-sync:${e.key}`,n=>ok(t,n,e))}var vh={exports:{}},ko={},Sh={exports:{}},xh={};/**
|
|
31
|
-
* @license React
|
|
32
|
-
* scheduler.production.js
|
|
33
|
-
*
|
|
34
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
35
|
-
*
|
|
36
|
-
* This source code is licensed under the MIT license found in the
|
|
37
|
-
* LICENSE file in the root directory of this source tree.
|
|
38
|
-
*/var O0;function fk(){return O0||(O0=1,function(e){function t(L,I){var G=L.length;L.push(I);e:for(;0<G;){var J=G-1>>>1,A=L[J];if(0<a(A,I))L[J]=I,L[G]=A,G=J;else break e}}function n(L){return L.length===0?null:L[0]}function s(L){if(L.length===0)return null;var I=L[0],G=L.pop();if(G!==I){L[0]=G;e:for(var J=0,A=L.length,U=A>>>1;J<U;){var F=2*(J+1)-1,Q=L[F],ae=F+1,Se=L[ae];if(0>a(Q,G))ae<A&&0>a(Se,Q)?(L[J]=Se,L[ae]=G,J=ae):(L[J]=Q,L[F]=G,J=F);else if(ae<A&&0>a(Se,G))L[J]=Se,L[ae]=G,J=ae;else break e}}return I}function a(L,I){var G=L.sortIndex-I.sortIndex;return G!==0?G:L.id-I.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var u=performance;e.unstable_now=function(){return u.now()}}else{var c=Date,d=c.now();e.unstable_now=function(){return c.now()-d}}var h=[],p=[],y=1,g=null,v=3,S=!1,T=!1,R=!1,M=!1,D=typeof setTimeout=="function"?setTimeout:null,$=typeof clearTimeout=="function"?clearTimeout:null,k=typeof setImmediate<"u"?setImmediate:null;function Y(L){for(var I=n(p);I!==null;){if(I.callback===null)s(p);else if(I.startTime<=L)s(p),I.sortIndex=I.expirationTime,t(h,I);else break;I=n(p)}}function z(L){if(R=!1,Y(L),!T)if(n(h)!==null)T=!0,ne||(ne=!0,De());else{var I=n(p);I!==null&&X(z,I.startTime-L)}}var ne=!1,ie=-1,te=5,ee=-1;function me(){return M?!0:!(e.unstable_now()-ee<te)}function be(){if(M=!1,ne){var L=e.unstable_now();ee=L;var I=!0;try{e:{T=!1,R&&(R=!1,$(ie),ie=-1),S=!0;var G=v;try{t:{for(Y(L),g=n(h);g!==null&&!(g.expirationTime>L&&me());){var J=g.callback;if(typeof J=="function"){g.callback=null,v=g.priorityLevel;var A=J(g.expirationTime<=L);if(L=e.unstable_now(),typeof A=="function"){g.callback=A,Y(L),I=!0;break t}g===n(h)&&s(h),Y(L)}else s(h);g=n(h)}if(g!==null)I=!0;else{var U=n(p);U!==null&&X(z,U.startTime-L),I=!1}}break e}finally{g=null,v=G,S=!1}I=void 0}}finally{I?De():ne=!1}}}var De;if(typeof k=="function")De=function(){k(be)};else if(typeof MessageChannel<"u"){var Ge=new MessageChannel,ke=Ge.port2;Ge.port1.onmessage=be,De=function(){ke.postMessage(null)}}else De=function(){D(be,0)};function X(L,I){ie=D(function(){L(e.unstable_now())},I)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(L){L.callback=null},e.unstable_forceFrameRate=function(L){0>L||125<L?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):te=0<L?Math.floor(1e3/L):5},e.unstable_getCurrentPriorityLevel=function(){return v},e.unstable_next=function(L){switch(v){case 1:case 2:case 3:var I=3;break;default:I=v}var G=v;v=I;try{return L()}finally{v=G}},e.unstable_requestPaint=function(){M=!0},e.unstable_runWithPriority=function(L,I){switch(L){case 1:case 2:case 3:case 4:case 5:break;default:L=3}var G=v;v=L;try{return I()}finally{v=G}},e.unstable_scheduleCallback=function(L,I,G){var J=e.unstable_now();switch(typeof G=="object"&&G!==null?(G=G.delay,G=typeof G=="number"&&0<G?J+G:J):G=J,L){case 1:var A=-1;break;case 2:A=250;break;case 5:A=1073741823;break;case 4:A=1e4;break;default:A=5e3}return A=G+A,L={id:y++,callback:I,priorityLevel:L,startTime:G,expirationTime:A,sortIndex:-1},G>J?(L.sortIndex=G,t(p,L),n(h)===null&&L===n(p)&&(R?($(ie),ie=-1):R=!0,X(z,G-J))):(L.sortIndex=A,t(h,L),T||S||(T=!0,ne||(ne=!0,De()))),L},e.unstable_shouldYield=me,e.unstable_wrapCallback=function(L){var I=v;return function(){var G=v;v=I;try{return L.apply(this,arguments)}finally{v=G}}}}(xh)),xh}var M0;function dk(){return M0||(M0=1,Sh.exports=fk()),Sh.exports}var wh={exports:{}},zt={};/**
|
|
39
|
-
* @license React
|
|
40
|
-
* react-dom.production.js
|
|
41
|
-
*
|
|
42
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
43
|
-
*
|
|
44
|
-
* This source code is licensed under the MIT license found in the
|
|
45
|
-
* LICENSE file in the root directory of this source tree.
|
|
46
|
-
*/var C0;function hk(){if(C0)return zt;C0=1;var e=um();function t(h){var p="https://react.dev/errors/"+h;if(1<arguments.length){p+="?args[]="+encodeURIComponent(arguments[1]);for(var y=2;y<arguments.length;y++)p+="&args[]="+encodeURIComponent(arguments[y])}return"Minified React error #"+h+"; visit "+p+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var s={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},a=Symbol.for("react.portal");function u(h,p,y){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:g==null?null:""+g,children:h,containerInfo:p,implementation:y}}var c=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function d(h,p){if(h==="font")return"";if(typeof p=="string")return p==="use-credentials"?p:""}return zt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=s,zt.createPortal=function(h,p){var y=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!p||p.nodeType!==1&&p.nodeType!==9&&p.nodeType!==11)throw Error(t(299));return u(h,p,null,y)},zt.flushSync=function(h){var p=c.T,y=s.p;try{if(c.T=null,s.p=2,h)return h()}finally{c.T=p,s.p=y,s.d.f()}},zt.preconnect=function(h,p){typeof h=="string"&&(p?(p=p.crossOrigin,p=typeof p=="string"?p==="use-credentials"?p:"":void 0):p=null,s.d.C(h,p))},zt.prefetchDNS=function(h){typeof h=="string"&&s.d.D(h)},zt.preinit=function(h,p){if(typeof h=="string"&&p&&typeof p.as=="string"){var y=p.as,g=d(y,p.crossOrigin),v=typeof p.integrity=="string"?p.integrity:void 0,S=typeof p.fetchPriority=="string"?p.fetchPriority:void 0;y==="style"?s.d.S(h,typeof p.precedence=="string"?p.precedence:void 0,{crossOrigin:g,integrity:v,fetchPriority:S}):y==="script"&&s.d.X(h,{crossOrigin:g,integrity:v,fetchPriority:S,nonce:typeof p.nonce=="string"?p.nonce:void 0})}},zt.preinitModule=function(h,p){if(typeof h=="string")if(typeof p=="object"&&p!==null){if(p.as==null||p.as==="script"){var y=d(p.as,p.crossOrigin);s.d.M(h,{crossOrigin:y,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0})}}else p==null&&s.d.M(h)},zt.preload=function(h,p){if(typeof h=="string"&&typeof p=="object"&&p!==null&&typeof p.as=="string"){var y=p.as,g=d(y,p.crossOrigin);s.d.L(h,y,{crossOrigin:g,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0,type:typeof p.type=="string"?p.type:void 0,fetchPriority:typeof p.fetchPriority=="string"?p.fetchPriority:void 0,referrerPolicy:typeof p.referrerPolicy=="string"?p.referrerPolicy:void 0,imageSrcSet:typeof p.imageSrcSet=="string"?p.imageSrcSet:void 0,imageSizes:typeof p.imageSizes=="string"?p.imageSizes:void 0,media:typeof p.media=="string"?p.media:void 0})}},zt.preloadModule=function(h,p){if(typeof h=="string")if(p){var y=d(p.as,p.crossOrigin);s.d.m(h,{as:typeof p.as=="string"&&p.as!=="script"?p.as:void 0,crossOrigin:y,integrity:typeof p.integrity=="string"?p.integrity:void 0})}else s.d.m(h)},zt.requestFormReset=function(h){s.d.r(h)},zt.unstable_batchedUpdates=function(h,p){return h(p)},zt.useFormState=function(h,p,y){return c.H.useFormState(h,p,y)},zt.useFormStatus=function(){return c.H.useHostTransitionStatus()},zt.version="19.1.0",zt}var k0;function dw(){if(k0)return wh.exports;k0=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),wh.exports=hk(),wh.exports}/**
|
|
47
|
-
* @license React
|
|
48
|
-
* react-dom-client.production.js
|
|
49
|
-
*
|
|
50
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
51
|
-
*
|
|
52
|
-
* This source code is licensed under the MIT license found in the
|
|
53
|
-
* LICENSE file in the root directory of this source tree.
|
|
54
|
-
*/var D0;function pk(){if(D0)return ko;D0=1;var e=dk(),t=um(),n=dw();function s(i){var r="https://react.dev/errors/"+i;if(1<arguments.length){r+="?args[]="+encodeURIComponent(arguments[1]);for(var o=2;o<arguments.length;o++)r+="&args[]="+encodeURIComponent(arguments[o])}return"Minified React error #"+i+"; visit "+r+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function a(i){return!(!i||i.nodeType!==1&&i.nodeType!==9&&i.nodeType!==11)}function u(i){var r=i,o=i;if(i.alternate)for(;r.return;)r=r.return;else{i=r;do r=i,(r.flags&4098)!==0&&(o=r.return),i=r.return;while(i)}return r.tag===3?o:null}function c(i){if(i.tag===13){var r=i.memoizedState;if(r===null&&(i=i.alternate,i!==null&&(r=i.memoizedState)),r!==null)return r.dehydrated}return null}function d(i){if(u(i)!==i)throw Error(s(188))}function h(i){var r=i.alternate;if(!r){if(r=u(i),r===null)throw Error(s(188));return r!==i?null:i}for(var o=i,l=r;;){var f=o.return;if(f===null)break;var m=f.alternate;if(m===null){if(l=f.return,l!==null){o=l;continue}break}if(f.child===m.child){for(m=f.child;m;){if(m===o)return d(f),i;if(m===l)return d(f),r;m=m.sibling}throw Error(s(188))}if(o.return!==l.return)o=f,l=m;else{for(var b=!1,x=f.child;x;){if(x===o){b=!0,o=f,l=m;break}if(x===l){b=!0,l=f,o=m;break}x=x.sibling}if(!b){for(x=m.child;x;){if(x===o){b=!0,o=m,l=f;break}if(x===l){b=!0,l=m,o=f;break}x=x.sibling}if(!b)throw Error(s(189))}}if(o.alternate!==l)throw Error(s(190))}if(o.tag!==3)throw Error(s(188));return o.stateNode.current===o?i:r}function p(i){var r=i.tag;if(r===5||r===26||r===27||r===6)return i;for(i=i.child;i!==null;){if(r=p(i),r!==null)return r;i=i.sibling}return null}var y=Object.assign,g=Symbol.for("react.element"),v=Symbol.for("react.transitional.element"),S=Symbol.for("react.portal"),T=Symbol.for("react.fragment"),R=Symbol.for("react.strict_mode"),M=Symbol.for("react.profiler"),D=Symbol.for("react.provider"),$=Symbol.for("react.consumer"),k=Symbol.for("react.context"),Y=Symbol.for("react.forward_ref"),z=Symbol.for("react.suspense"),ne=Symbol.for("react.suspense_list"),ie=Symbol.for("react.memo"),te=Symbol.for("react.lazy"),ee=Symbol.for("react.activity"),me=Symbol.for("react.memo_cache_sentinel"),be=Symbol.iterator;function De(i){return i===null||typeof i!="object"?null:(i=be&&i[be]||i["@@iterator"],typeof i=="function"?i:null)}var Ge=Symbol.for("react.client.reference");function ke(i){if(i==null)return null;if(typeof i=="function")return i.$$typeof===Ge?null:i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case T:return"Fragment";case M:return"Profiler";case R:return"StrictMode";case z:return"Suspense";case ne:return"SuspenseList";case ee:return"Activity"}if(typeof i=="object")switch(i.$$typeof){case S:return"Portal";case k:return(i.displayName||"Context")+".Provider";case $:return(i._context.displayName||"Context")+".Consumer";case Y:var r=i.render;return i=i.displayName,i||(i=r.displayName||r.name||"",i=i!==""?"ForwardRef("+i+")":"ForwardRef"),i;case ie:return r=i.displayName||null,r!==null?r:ke(i.type)||"Memo";case te:r=i._payload,i=i._init;try{return ke(i(r))}catch{}}return null}var X=Array.isArray,L=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,I=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,G={pending:!1,data:null,method:null,action:null},J=[],A=-1;function U(i){return{current:i}}function F(i){0>A||(i.current=J[A],J[A]=null,A--)}function Q(i,r){A++,J[A]=i.current,i.current=r}var ae=U(null),Se=U(null),re=U(null),Xe=U(null);function Ne(i,r){switch(Q(re,r),Q(Se,i),Q(ae,null),r.nodeType){case 9:case 11:i=(i=r.documentElement)&&(i=i.namespaceURI)?Yv(i):0;break;default:if(i=r.tagName,r=r.namespaceURI)r=Yv(r),i=Xv(r,i);else switch(i){case"svg":i=1;break;case"math":i=2;break;default:i=0}}F(ae),Q(ae,i)}function rn(){F(ae),F(Se),F(re)}function Ui(i){i.memoizedState!==null&&Q(Xe,i);var r=ae.current,o=Xv(r,i.type);r!==o&&(Q(Se,i),Q(ae,o))}function ge(i){Se.current===i&&(F(ae),F(Se)),Xe.current===i&&(F(Xe),To._currentValue=G)}var Ae=Object.prototype.hasOwnProperty,xe=e.unstable_scheduleCallback,Me=e.unstable_cancelCallback,Qe=e.unstable_shouldYield,In=e.unstable_requestPaint,Ke=e.unstable_now,kt=e.unstable_getCurrentPriorityLevel,We=e.unstable_ImmediatePriority,Ze=e.unstable_UserBlockingPriority,an=e.unstable_NormalPriority,$R=e.unstable_LowPriority,ky=e.unstable_IdlePriority,BR=e.log,LR=e.unstable_setDisableYieldValue,Da=null,on=null;function qi(i){if(typeof BR=="function"&&LR(i),on&&typeof on.setStrictMode=="function")try{on.setStrictMode(Da,i)}catch{}}var ln=Math.clz32?Math.clz32:zR,VR=Math.log,jR=Math.LN2;function zR(i){return i>>>=0,i===0?32:31-(VR(i)/jR|0)|0}var Sl=256,xl=4194304;function Es(i){var r=i&42;if(r!==0)return r;switch(i&-i){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return i&4194048;case 4194304:case 8388608:case 16777216:case 33554432:return i&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return i}}function wl(i,r,o){var l=i.pendingLanes;if(l===0)return 0;var f=0,m=i.suspendedLanes,b=i.pingedLanes;i=i.warmLanes;var x=l&134217727;return x!==0?(l=x&~m,l!==0?f=Es(l):(b&=x,b!==0?f=Es(b):o||(o=x&~i,o!==0&&(f=Es(o))))):(x=l&~m,x!==0?f=Es(x):b!==0?f=Es(b):o||(o=l&~i,o!==0&&(f=Es(o)))),f===0?0:r!==0&&r!==f&&(r&m)===0&&(m=f&-f,o=r&-r,m>=o||m===32&&(o&4194048)!==0)?r:f}function Na(i,r){return(i.pendingLanes&~(i.suspendedLanes&~i.pingedLanes)&r)===0}function UR(i,r){switch(i){case 1:case 2:case 4:case 8:case 64:return r+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return r+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Dy(){var i=Sl;return Sl<<=1,(Sl&4194048)===0&&(Sl=256),i}function Ny(){var i=xl;return xl<<=1,(xl&62914560)===0&&(xl=4194304),i}function rf(i){for(var r=[],o=0;31>o;o++)r.push(i);return r}function _a(i,r){i.pendingLanes|=r,r!==268435456&&(i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0)}function qR(i,r,o,l,f,m){var b=i.pendingLanes;i.pendingLanes=o,i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0,i.expiredLanes&=o,i.entangledLanes&=o,i.errorRecoveryDisabledLanes&=o,i.shellSuspendCounter=0;var x=i.entanglements,E=i.expirationTimes,_=i.hiddenUpdates;for(o=b&~o;0<o;){var q=31-ln(o),H=1<<q;x[q]=0,E[q]=-1;var B=_[q];if(B!==null)for(_[q]=null,q=0;q<B.length;q++){var V=B[q];V!==null&&(V.lane&=-536870913)}o&=~H}l!==0&&_y(i,l,0),m!==0&&f===0&&i.tag!==0&&(i.suspendedLanes|=m&~(b&~r))}function _y(i,r,o){i.pendingLanes|=r,i.suspendedLanes&=~r;var l=31-ln(r);i.entangledLanes|=r,i.entanglements[l]=i.entanglements[l]|1073741824|o&4194090}function $y(i,r){var o=i.entangledLanes|=r;for(i=i.entanglements;o;){var l=31-ln(o),f=1<<l;f&r|i[l]&r&&(i[l]|=r),o&=~f}}function af(i){switch(i){case 2:i=1;break;case 8:i=4;break;case 32:i=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:i=128;break;case 268435456:i=134217728;break;default:i=0}return i}function of(i){return i&=-i,2<i?8<i?(i&134217727)!==0?32:268435456:8:2}function By(){var i=I.p;return i!==0?i:(i=window.event,i===void 0?32:p0(i.type))}function KR(i,r){var o=I.p;try{return I.p=i,r()}finally{I.p=o}}var Ki=Math.random().toString(36).slice(2),Vt="__reactFiber$"+Ki,Zt="__reactProps$"+Ki,cr="__reactContainer$"+Ki,lf="__reactEvents$"+Ki,PR="__reactListeners$"+Ki,IR="__reactHandles$"+Ki,Ly="__reactResources$"+Ki,$a="__reactMarker$"+Ki;function uf(i){delete i[Vt],delete i[Zt],delete i[lf],delete i[PR],delete i[IR]}function fr(i){var r=i[Vt];if(r)return r;for(var o=i.parentNode;o;){if(r=o[cr]||o[Vt]){if(o=r.alternate,r.child!==null||o!==null&&o.child!==null)for(i=Wv(i);i!==null;){if(o=i[Vt])return o;i=Wv(i)}return r}i=o,o=i.parentNode}return null}function dr(i){if(i=i[Vt]||i[cr]){var r=i.tag;if(r===5||r===6||r===13||r===26||r===27||r===3)return i}return null}function Ba(i){var r=i.tag;if(r===5||r===26||r===27||r===6)return i.stateNode;throw Error(s(33))}function hr(i){var r=i[Ly];return r||(r=i[Ly]={hoistableStyles:new Map,hoistableScripts:new Map}),r}function Tt(i){i[$a]=!0}var Vy=new Set,jy={};function Rs(i,r){pr(i,r),pr(i+"Capture",r)}function pr(i,r){for(jy[i]=r,i=0;i<r.length;i++)Vy.add(r[i])}var HR=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),zy={},Uy={};function GR(i){return Ae.call(Uy,i)?!0:Ae.call(zy,i)?!1:HR.test(i)?Uy[i]=!0:(zy[i]=!0,!1)}function Al(i,r,o){if(GR(r))if(o===null)i.removeAttribute(r);else{switch(typeof o){case"undefined":case"function":case"symbol":i.removeAttribute(r);return;case"boolean":var l=r.toLowerCase().slice(0,5);if(l!=="data-"&&l!=="aria-"){i.removeAttribute(r);return}}i.setAttribute(r,""+o)}}function Tl(i,r,o){if(o===null)i.removeAttribute(r);else{switch(typeof o){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(r);return}i.setAttribute(r,""+o)}}function li(i,r,o,l){if(l===null)i.removeAttribute(o);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(o);return}i.setAttributeNS(r,o,""+l)}}var cf,qy;function mr(i){if(cf===void 0)try{throw Error()}catch(o){var r=o.stack.trim().match(/\n( *(at )?)/);cf=r&&r[1]||"",qy=-1<o.stack.indexOf(`
|
|
55
|
-
at`)?" (<anonymous>)":-1<o.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
56
|
-
`+cf+i+qy}var ff=!1;function df(i,r){if(!i||ff)return"";ff=!0;var o=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var l={DetermineComponentFrameRoot:function(){try{if(r){var H=function(){throw Error()};if(Object.defineProperty(H.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(H,[])}catch(V){var B=V}Reflect.construct(i,[],H)}else{try{H.call()}catch(V){B=V}i.call(H.prototype)}}else{try{throw Error()}catch(V){B=V}(H=i())&&typeof H.catch=="function"&&H.catch(function(){})}}catch(V){if(V&&B&&typeof V.stack=="string")return[V.stack,B.stack]}return[null,null]}};l.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var f=Object.getOwnPropertyDescriptor(l.DetermineComponentFrameRoot,"name");f&&f.configurable&&Object.defineProperty(l.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var m=l.DetermineComponentFrameRoot(),b=m[0],x=m[1];if(b&&x){var E=b.split(`
|
|
57
|
-
`),_=x.split(`
|
|
58
|
-
`);for(f=l=0;l<E.length&&!E[l].includes("DetermineComponentFrameRoot");)l++;for(;f<_.length&&!_[f].includes("DetermineComponentFrameRoot");)f++;if(l===E.length||f===_.length)for(l=E.length-1,f=_.length-1;1<=l&&0<=f&&E[l]!==_[f];)f--;for(;1<=l&&0<=f;l--,f--)if(E[l]!==_[f]){if(l!==1||f!==1)do if(l--,f--,0>f||E[l]!==_[f]){var q=`
|
|
59
|
-
`+E[l].replace(" at new "," at ");return i.displayName&&q.includes("<anonymous>")&&(q=q.replace("<anonymous>",i.displayName)),q}while(1<=l&&0<=f);break}}}finally{ff=!1,Error.prepareStackTrace=o}return(o=i?i.displayName||i.name:"")?mr(o):""}function FR(i){switch(i.tag){case 26:case 27:case 5:return mr(i.type);case 16:return mr("Lazy");case 13:return mr("Suspense");case 19:return mr("SuspenseList");case 0:case 15:return df(i.type,!1);case 11:return df(i.type.render,!1);case 1:return df(i.type,!0);case 31:return mr("Activity");default:return""}}function Ky(i){try{var r="";do r+=FR(i),i=i.return;while(i);return r}catch(o){return`
|
|
60
|
-
Error generating stack: `+o.message+`
|
|
61
|
-
`+o.stack}}function Sn(i){switch(typeof i){case"bigint":case"boolean":case"number":case"string":case"undefined":return i;case"object":return i;default:return""}}function Py(i){var r=i.type;return(i=i.nodeName)&&i.toLowerCase()==="input"&&(r==="checkbox"||r==="radio")}function YR(i){var r=Py(i)?"checked":"value",o=Object.getOwnPropertyDescriptor(i.constructor.prototype,r),l=""+i[r];if(!i.hasOwnProperty(r)&&typeof o<"u"&&typeof o.get=="function"&&typeof o.set=="function"){var f=o.get,m=o.set;return Object.defineProperty(i,r,{configurable:!0,get:function(){return f.call(this)},set:function(b){l=""+b,m.call(this,b)}}),Object.defineProperty(i,r,{enumerable:o.enumerable}),{getValue:function(){return l},setValue:function(b){l=""+b},stopTracking:function(){i._valueTracker=null,delete i[r]}}}}function El(i){i._valueTracker||(i._valueTracker=YR(i))}function Iy(i){if(!i)return!1;var r=i._valueTracker;if(!r)return!0;var o=r.getValue(),l="";return i&&(l=Py(i)?i.checked?"true":"false":i.value),i=l,i!==o?(r.setValue(i),!0):!1}function Rl(i){if(i=i||(typeof document<"u"?document:void 0),typeof i>"u")return null;try{return i.activeElement||i.body}catch{return i.body}}var XR=/[\n"\\]/g;function xn(i){return i.replace(XR,function(r){return"\\"+r.charCodeAt(0).toString(16)+" "})}function hf(i,r,o,l,f,m,b,x){i.name="",b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"?i.type=b:i.removeAttribute("type"),r!=null?b==="number"?(r===0&&i.value===""||i.value!=r)&&(i.value=""+Sn(r)):i.value!==""+Sn(r)&&(i.value=""+Sn(r)):b!=="submit"&&b!=="reset"||i.removeAttribute("value"),r!=null?pf(i,b,Sn(r)):o!=null?pf(i,b,Sn(o)):l!=null&&i.removeAttribute("value"),f==null&&m!=null&&(i.defaultChecked=!!m),f!=null&&(i.checked=f&&typeof f!="function"&&typeof f!="symbol"),x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"?i.name=""+Sn(x):i.removeAttribute("name")}function Hy(i,r,o,l,f,m,b,x){if(m!=null&&typeof m!="function"&&typeof m!="symbol"&&typeof m!="boolean"&&(i.type=m),r!=null||o!=null){if(!(m!=="submit"&&m!=="reset"||r!=null))return;o=o!=null?""+Sn(o):"",r=r!=null?""+Sn(r):o,x||r===i.value||(i.value=r),i.defaultValue=r}l=l??f,l=typeof l!="function"&&typeof l!="symbol"&&!!l,i.checked=x?i.checked:!!l,i.defaultChecked=!!l,b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"&&(i.name=b)}function pf(i,r,o){r==="number"&&Rl(i.ownerDocument)===i||i.defaultValue===""+o||(i.defaultValue=""+o)}function yr(i,r,o,l){if(i=i.options,r){r={};for(var f=0;f<o.length;f++)r["$"+o[f]]=!0;for(o=0;o<i.length;o++)f=r.hasOwnProperty("$"+i[o].value),i[o].selected!==f&&(i[o].selected=f),f&&l&&(i[o].defaultSelected=!0)}else{for(o=""+Sn(o),r=null,f=0;f<i.length;f++){if(i[f].value===o){i[f].selected=!0,l&&(i[f].defaultSelected=!0);return}r!==null||i[f].disabled||(r=i[f])}r!==null&&(r.selected=!0)}}function Gy(i,r,o){if(r!=null&&(r=""+Sn(r),r!==i.value&&(i.value=r),o==null)){i.defaultValue!==r&&(i.defaultValue=r);return}i.defaultValue=o!=null?""+Sn(o):""}function Fy(i,r,o,l){if(r==null){if(l!=null){if(o!=null)throw Error(s(92));if(X(l)){if(1<l.length)throw Error(s(93));l=l[0]}o=l}o==null&&(o=""),r=o}o=Sn(r),i.defaultValue=o,l=i.textContent,l===o&&l!==""&&l!==null&&(i.value=l)}function gr(i,r){if(r){var o=i.firstChild;if(o&&o===i.lastChild&&o.nodeType===3){o.nodeValue=r;return}}i.textContent=r}var ZR=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function Yy(i,r,o){var l=r.indexOf("--")===0;o==null||typeof o=="boolean"||o===""?l?i.setProperty(r,""):r==="float"?i.cssFloat="":i[r]="":l?i.setProperty(r,o):typeof o!="number"||o===0||ZR.has(r)?r==="float"?i.cssFloat=o:i[r]=(""+o).trim():i[r]=o+"px"}function Xy(i,r,o){if(r!=null&&typeof r!="object")throw Error(s(62));if(i=i.style,o!=null){for(var l in o)!o.hasOwnProperty(l)||r!=null&&r.hasOwnProperty(l)||(l.indexOf("--")===0?i.setProperty(l,""):l==="float"?i.cssFloat="":i[l]="");for(var f in r)l=r[f],r.hasOwnProperty(f)&&o[f]!==l&&Yy(i,f,l)}else for(var m in r)r.hasOwnProperty(m)&&Yy(i,m,r[m])}function mf(i){if(i.indexOf("-")===-1)return!1;switch(i){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var JR=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),QR=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Ol(i){return QR.test(""+i)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":i}var yf=null;function gf(i){return i=i.target||i.srcElement||window,i.correspondingUseElement&&(i=i.correspondingUseElement),i.nodeType===3?i.parentNode:i}var br=null,vr=null;function Zy(i){var r=dr(i);if(r&&(i=r.stateNode)){var o=i[Zt]||null;e:switch(i=r.stateNode,r.type){case"input":if(hf(i,o.value,o.defaultValue,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name),r=o.name,o.type==="radio"&&r!=null){for(o=i;o.parentNode;)o=o.parentNode;for(o=o.querySelectorAll('input[name="'+xn(""+r)+'"][type="radio"]'),r=0;r<o.length;r++){var l=o[r];if(l!==i&&l.form===i.form){var f=l[Zt]||null;if(!f)throw Error(s(90));hf(l,f.value,f.defaultValue,f.defaultValue,f.checked,f.defaultChecked,f.type,f.name)}}for(r=0;r<o.length;r++)l=o[r],l.form===i.form&&Iy(l)}break e;case"textarea":Gy(i,o.value,o.defaultValue);break e;case"select":r=o.value,r!=null&&yr(i,!!o.multiple,r,!1)}}}var bf=!1;function Jy(i,r,o){if(bf)return i(r,o);bf=!0;try{var l=i(r);return l}finally{if(bf=!1,(br!==null||vr!==null)&&(du(),br&&(r=br,i=vr,vr=br=null,Zy(r),i)))for(r=0;r<i.length;r++)Zy(i[r])}}function La(i,r){var o=i.stateNode;if(o===null)return null;var l=o[Zt]||null;if(l===null)return null;o=l[r];e:switch(r){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(l=!l.disabled)||(i=i.type,l=!(i==="button"||i==="input"||i==="select"||i==="textarea")),i=!l;break e;default:i=!1}if(i)return null;if(o&&typeof o!="function")throw Error(s(231,r,typeof o));return o}var ui=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),vf=!1;if(ui)try{var Va={};Object.defineProperty(Va,"passive",{get:function(){vf=!0}}),window.addEventListener("test",Va,Va),window.removeEventListener("test",Va,Va)}catch{vf=!1}var Pi=null,Sf=null,Ml=null;function Qy(){if(Ml)return Ml;var i,r=Sf,o=r.length,l,f="value"in Pi?Pi.value:Pi.textContent,m=f.length;for(i=0;i<o&&r[i]===f[i];i++);var b=o-i;for(l=1;l<=b&&r[o-l]===f[m-l];l++);return Ml=f.slice(i,1<l?1-l:void 0)}function Cl(i){var r=i.keyCode;return"charCode"in i?(i=i.charCode,i===0&&r===13&&(i=13)):i=r,i===10&&(i=13),32<=i||i===13?i:0}function kl(){return!0}function Wy(){return!1}function Jt(i){function r(o,l,f,m,b){this._reactName=o,this._targetInst=f,this.type=l,this.nativeEvent=m,this.target=b,this.currentTarget=null;for(var x in i)i.hasOwnProperty(x)&&(o=i[x],this[x]=o?o(m):m[x]);return this.isDefaultPrevented=(m.defaultPrevented!=null?m.defaultPrevented:m.returnValue===!1)?kl:Wy,this.isPropagationStopped=Wy,this}return y(r.prototype,{preventDefault:function(){this.defaultPrevented=!0;var o=this.nativeEvent;o&&(o.preventDefault?o.preventDefault():typeof o.returnValue!="unknown"&&(o.returnValue=!1),this.isDefaultPrevented=kl)},stopPropagation:function(){var o=this.nativeEvent;o&&(o.stopPropagation?o.stopPropagation():typeof o.cancelBubble!="unknown"&&(o.cancelBubble=!0),this.isPropagationStopped=kl)},persist:function(){},isPersistent:kl}),r}var Os={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(i){return i.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Dl=Jt(Os),ja=y({},Os,{view:0,detail:0}),WR=Jt(ja),xf,wf,za,Nl=y({},ja,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Tf,button:0,buttons:0,relatedTarget:function(i){return i.relatedTarget===void 0?i.fromElement===i.srcElement?i.toElement:i.fromElement:i.relatedTarget},movementX:function(i){return"movementX"in i?i.movementX:(i!==za&&(za&&i.type==="mousemove"?(xf=i.screenX-za.screenX,wf=i.screenY-za.screenY):wf=xf=0,za=i),xf)},movementY:function(i){return"movementY"in i?i.movementY:wf}}),eg=Jt(Nl),eO=y({},Nl,{dataTransfer:0}),tO=Jt(eO),nO=y({},ja,{relatedTarget:0}),Af=Jt(nO),iO=y({},Os,{animationName:0,elapsedTime:0,pseudoElement:0}),sO=Jt(iO),rO=y({},Os,{clipboardData:function(i){return"clipboardData"in i?i.clipboardData:window.clipboardData}}),aO=Jt(rO),oO=y({},Os,{data:0}),tg=Jt(oO),lO={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},uO={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},cO={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function fO(i){var r=this.nativeEvent;return r.getModifierState?r.getModifierState(i):(i=cO[i])?!!r[i]:!1}function Tf(){return fO}var dO=y({},ja,{key:function(i){if(i.key){var r=lO[i.key]||i.key;if(r!=="Unidentified")return r}return i.type==="keypress"?(i=Cl(i),i===13?"Enter":String.fromCharCode(i)):i.type==="keydown"||i.type==="keyup"?uO[i.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Tf,charCode:function(i){return i.type==="keypress"?Cl(i):0},keyCode:function(i){return i.type==="keydown"||i.type==="keyup"?i.keyCode:0},which:function(i){return i.type==="keypress"?Cl(i):i.type==="keydown"||i.type==="keyup"?i.keyCode:0}}),hO=Jt(dO),pO=y({},Nl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),ng=Jt(pO),mO=y({},ja,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Tf}),yO=Jt(mO),gO=y({},Os,{propertyName:0,elapsedTime:0,pseudoElement:0}),bO=Jt(gO),vO=y({},Nl,{deltaX:function(i){return"deltaX"in i?i.deltaX:"wheelDeltaX"in i?-i.wheelDeltaX:0},deltaY:function(i){return"deltaY"in i?i.deltaY:"wheelDeltaY"in i?-i.wheelDeltaY:"wheelDelta"in i?-i.wheelDelta:0},deltaZ:0,deltaMode:0}),SO=Jt(vO),xO=y({},Os,{newState:0,oldState:0}),wO=Jt(xO),AO=[9,13,27,32],Ef=ui&&"CompositionEvent"in window,Ua=null;ui&&"documentMode"in document&&(Ua=document.documentMode);var TO=ui&&"TextEvent"in window&&!Ua,ig=ui&&(!Ef||Ua&&8<Ua&&11>=Ua),sg=" ",rg=!1;function ag(i,r){switch(i){case"keyup":return AO.indexOf(r.keyCode)!==-1;case"keydown":return r.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function og(i){return i=i.detail,typeof i=="object"&&"data"in i?i.data:null}var Sr=!1;function EO(i,r){switch(i){case"compositionend":return og(r);case"keypress":return r.which!==32?null:(rg=!0,sg);case"textInput":return i=r.data,i===sg&&rg?null:i;default:return null}}function RO(i,r){if(Sr)return i==="compositionend"||!Ef&&ag(i,r)?(i=Qy(),Ml=Sf=Pi=null,Sr=!1,i):null;switch(i){case"paste":return null;case"keypress":if(!(r.ctrlKey||r.altKey||r.metaKey)||r.ctrlKey&&r.altKey){if(r.char&&1<r.char.length)return r.char;if(r.which)return String.fromCharCode(r.which)}return null;case"compositionend":return ig&&r.locale!=="ko"?null:r.data;default:return null}}var OO={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function lg(i){var r=i&&i.nodeName&&i.nodeName.toLowerCase();return r==="input"?!!OO[i.type]:r==="textarea"}function ug(i,r,o,l){br?vr?vr.push(l):vr=[l]:br=l,r=bu(r,"onChange"),0<r.length&&(o=new Dl("onChange","change",null,o,l),i.push({event:o,listeners:r}))}var qa=null,Ka=null;function MO(i){Pv(i,0)}function _l(i){var r=Ba(i);if(Iy(r))return i}function cg(i,r){if(i==="change")return r}var fg=!1;if(ui){var Rf;if(ui){var Of="oninput"in document;if(!Of){var dg=document.createElement("div");dg.setAttribute("oninput","return;"),Of=typeof dg.oninput=="function"}Rf=Of}else Rf=!1;fg=Rf&&(!document.documentMode||9<document.documentMode)}function hg(){qa&&(qa.detachEvent("onpropertychange",pg),Ka=qa=null)}function pg(i){if(i.propertyName==="value"&&_l(Ka)){var r=[];ug(r,Ka,i,gf(i)),Jy(MO,r)}}function CO(i,r,o){i==="focusin"?(hg(),qa=r,Ka=o,qa.attachEvent("onpropertychange",pg)):i==="focusout"&&hg()}function kO(i){if(i==="selectionchange"||i==="keyup"||i==="keydown")return _l(Ka)}function DO(i,r){if(i==="click")return _l(r)}function NO(i,r){if(i==="input"||i==="change")return _l(r)}function _O(i,r){return i===r&&(i!==0||1/i===1/r)||i!==i&&r!==r}var un=typeof Object.is=="function"?Object.is:_O;function Pa(i,r){if(un(i,r))return!0;if(typeof i!="object"||i===null||typeof r!="object"||r===null)return!1;var o=Object.keys(i),l=Object.keys(r);if(o.length!==l.length)return!1;for(l=0;l<o.length;l++){var f=o[l];if(!Ae.call(r,f)||!un(i[f],r[f]))return!1}return!0}function mg(i){for(;i&&i.firstChild;)i=i.firstChild;return i}function yg(i,r){var o=mg(i);i=0;for(var l;o;){if(o.nodeType===3){if(l=i+o.textContent.length,i<=r&&l>=r)return{node:o,offset:r-i};i=l}e:{for(;o;){if(o.nextSibling){o=o.nextSibling;break e}o=o.parentNode}o=void 0}o=mg(o)}}function gg(i,r){return i&&r?i===r?!0:i&&i.nodeType===3?!1:r&&r.nodeType===3?gg(i,r.parentNode):"contains"in i?i.contains(r):i.compareDocumentPosition?!!(i.compareDocumentPosition(r)&16):!1:!1}function bg(i){i=i!=null&&i.ownerDocument!=null&&i.ownerDocument.defaultView!=null?i.ownerDocument.defaultView:window;for(var r=Rl(i.document);r instanceof i.HTMLIFrameElement;){try{var o=typeof r.contentWindow.location.href=="string"}catch{o=!1}if(o)i=r.contentWindow;else break;r=Rl(i.document)}return r}function Mf(i){var r=i&&i.nodeName&&i.nodeName.toLowerCase();return r&&(r==="input"&&(i.type==="text"||i.type==="search"||i.type==="tel"||i.type==="url"||i.type==="password")||r==="textarea"||i.contentEditable==="true")}var $O=ui&&"documentMode"in document&&11>=document.documentMode,xr=null,Cf=null,Ia=null,kf=!1;function vg(i,r,o){var l=o.window===o?o.document:o.nodeType===9?o:o.ownerDocument;kf||xr==null||xr!==Rl(l)||(l=xr,"selectionStart"in l&&Mf(l)?l={start:l.selectionStart,end:l.selectionEnd}:(l=(l.ownerDocument&&l.ownerDocument.defaultView||window).getSelection(),l={anchorNode:l.anchorNode,anchorOffset:l.anchorOffset,focusNode:l.focusNode,focusOffset:l.focusOffset}),Ia&&Pa(Ia,l)||(Ia=l,l=bu(Cf,"onSelect"),0<l.length&&(r=new Dl("onSelect","select",null,r,o),i.push({event:r,listeners:l}),r.target=xr)))}function Ms(i,r){var o={};return o[i.toLowerCase()]=r.toLowerCase(),o["Webkit"+i]="webkit"+r,o["Moz"+i]="moz"+r,o}var wr={animationend:Ms("Animation","AnimationEnd"),animationiteration:Ms("Animation","AnimationIteration"),animationstart:Ms("Animation","AnimationStart"),transitionrun:Ms("Transition","TransitionRun"),transitionstart:Ms("Transition","TransitionStart"),transitioncancel:Ms("Transition","TransitionCancel"),transitionend:Ms("Transition","TransitionEnd")},Df={},Sg={};ui&&(Sg=document.createElement("div").style,"AnimationEvent"in window||(delete wr.animationend.animation,delete wr.animationiteration.animation,delete wr.animationstart.animation),"TransitionEvent"in window||delete wr.transitionend.transition);function Cs(i){if(Df[i])return Df[i];if(!wr[i])return i;var r=wr[i],o;for(o in r)if(r.hasOwnProperty(o)&&o in Sg)return Df[i]=r[o];return i}var xg=Cs("animationend"),wg=Cs("animationiteration"),Ag=Cs("animationstart"),BO=Cs("transitionrun"),LO=Cs("transitionstart"),VO=Cs("transitioncancel"),Tg=Cs("transitionend"),Eg=new Map,Nf="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");Nf.push("scrollEnd");function Bn(i,r){Eg.set(i,r),Rs(r,[i])}var Rg=new WeakMap;function wn(i,r){if(typeof i=="object"&&i!==null){var o=Rg.get(i);return o!==void 0?o:(r={value:i,source:r,stack:Ky(r)},Rg.set(i,r),r)}return{value:i,source:r,stack:Ky(r)}}var An=[],Ar=0,_f=0;function $l(){for(var i=Ar,r=_f=Ar=0;r<i;){var o=An[r];An[r++]=null;var l=An[r];An[r++]=null;var f=An[r];An[r++]=null;var m=An[r];if(An[r++]=null,l!==null&&f!==null){var b=l.pending;b===null?f.next=f:(f.next=b.next,b.next=f),l.pending=f}m!==0&&Og(o,f,m)}}function Bl(i,r,o,l){An[Ar++]=i,An[Ar++]=r,An[Ar++]=o,An[Ar++]=l,_f|=l,i.lanes|=l,i=i.alternate,i!==null&&(i.lanes|=l)}function $f(i,r,o,l){return Bl(i,r,o,l),Ll(i)}function Tr(i,r){return Bl(i,null,null,r),Ll(i)}function Og(i,r,o){i.lanes|=o;var l=i.alternate;l!==null&&(l.lanes|=o);for(var f=!1,m=i.return;m!==null;)m.childLanes|=o,l=m.alternate,l!==null&&(l.childLanes|=o),m.tag===22&&(i=m.stateNode,i===null||i._visibility&1||(f=!0)),i=m,m=m.return;return i.tag===3?(m=i.stateNode,f&&r!==null&&(f=31-ln(o),i=m.hiddenUpdates,l=i[f],l===null?i[f]=[r]:l.push(r),r.lane=o|536870912),m):null}function Ll(i){if(50<yo)throw yo=0,Ud=null,Error(s(185));for(var r=i.return;r!==null;)i=r,r=i.return;return i.tag===3?i.stateNode:null}var Er={};function jO(i,r,o,l){this.tag=i,this.key=o,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=r,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=l,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function cn(i,r,o,l){return new jO(i,r,o,l)}function Bf(i){return i=i.prototype,!(!i||!i.isReactComponent)}function ci(i,r){var o=i.alternate;return o===null?(o=cn(i.tag,r,i.key,i.mode),o.elementType=i.elementType,o.type=i.type,o.stateNode=i.stateNode,o.alternate=i,i.alternate=o):(o.pendingProps=r,o.type=i.type,o.flags=0,o.subtreeFlags=0,o.deletions=null),o.flags=i.flags&65011712,o.childLanes=i.childLanes,o.lanes=i.lanes,o.child=i.child,o.memoizedProps=i.memoizedProps,o.memoizedState=i.memoizedState,o.updateQueue=i.updateQueue,r=i.dependencies,o.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext},o.sibling=i.sibling,o.index=i.index,o.ref=i.ref,o.refCleanup=i.refCleanup,o}function Mg(i,r){i.flags&=65011714;var o=i.alternate;return o===null?(i.childLanes=0,i.lanes=r,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=o.childLanes,i.lanes=o.lanes,i.child=o.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=o.memoizedProps,i.memoizedState=o.memoizedState,i.updateQueue=o.updateQueue,i.type=o.type,r=o.dependencies,i.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext}),i}function Vl(i,r,o,l,f,m){var b=0;if(l=i,typeof i=="function")Bf(i)&&(b=1);else if(typeof i=="string")b=UM(i,o,ae.current)?26:i==="html"||i==="head"||i==="body"?27:5;else e:switch(i){case ee:return i=cn(31,o,r,f),i.elementType=ee,i.lanes=m,i;case T:return ks(o.children,f,m,r);case R:b=8,f|=24;break;case M:return i=cn(12,o,r,f|2),i.elementType=M,i.lanes=m,i;case z:return i=cn(13,o,r,f),i.elementType=z,i.lanes=m,i;case ne:return i=cn(19,o,r,f),i.elementType=ne,i.lanes=m,i;default:if(typeof i=="object"&&i!==null)switch(i.$$typeof){case D:case k:b=10;break e;case $:b=9;break e;case Y:b=11;break e;case ie:b=14;break e;case te:b=16,l=null;break e}b=29,o=Error(s(130,i===null?"null":typeof i,"")),l=null}return r=cn(b,o,r,f),r.elementType=i,r.type=l,r.lanes=m,r}function ks(i,r,o,l){return i=cn(7,i,l,r),i.lanes=o,i}function Lf(i,r,o){return i=cn(6,i,null,r),i.lanes=o,i}function Vf(i,r,o){return r=cn(4,i.children!==null?i.children:[],i.key,r),r.lanes=o,r.stateNode={containerInfo:i.containerInfo,pendingChildren:null,implementation:i.implementation},r}var Rr=[],Or=0,jl=null,zl=0,Tn=[],En=0,Ds=null,fi=1,di="";function Ns(i,r){Rr[Or++]=zl,Rr[Or++]=jl,jl=i,zl=r}function Cg(i,r,o){Tn[En++]=fi,Tn[En++]=di,Tn[En++]=Ds,Ds=i;var l=fi;i=di;var f=32-ln(l)-1;l&=~(1<<f),o+=1;var m=32-ln(r)+f;if(30<m){var b=f-f%5;m=(l&(1<<b)-1).toString(32),l>>=b,f-=b,fi=1<<32-ln(r)+f|o<<f|l,di=m+i}else fi=1<<m|o<<f|l,di=i}function jf(i){i.return!==null&&(Ns(i,1),Cg(i,1,0))}function zf(i){for(;i===jl;)jl=Rr[--Or],Rr[Or]=null,zl=Rr[--Or],Rr[Or]=null;for(;i===Ds;)Ds=Tn[--En],Tn[En]=null,di=Tn[--En],Tn[En]=null,fi=Tn[--En],Tn[En]=null}var Ht=null,st=null,$e=!1,_s=null,Hn=!1,Uf=Error(s(519));function $s(i){var r=Error(s(418,""));throw Fa(wn(r,i)),Uf}function kg(i){var r=i.stateNode,o=i.type,l=i.memoizedProps;switch(r[Vt]=i,r[Zt]=l,o){case"dialog":Ee("cancel",r),Ee("close",r);break;case"iframe":case"object":case"embed":Ee("load",r);break;case"video":case"audio":for(o=0;o<bo.length;o++)Ee(bo[o],r);break;case"source":Ee("error",r);break;case"img":case"image":case"link":Ee("error",r),Ee("load",r);break;case"details":Ee("toggle",r);break;case"input":Ee("invalid",r),Hy(r,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0),El(r);break;case"select":Ee("invalid",r);break;case"textarea":Ee("invalid",r),Fy(r,l.value,l.defaultValue,l.children),El(r)}o=l.children,typeof o!="string"&&typeof o!="number"&&typeof o!="bigint"||r.textContent===""+o||l.suppressHydrationWarning===!0||Fv(r.textContent,o)?(l.popover!=null&&(Ee("beforetoggle",r),Ee("toggle",r)),l.onScroll!=null&&Ee("scroll",r),l.onScrollEnd!=null&&Ee("scrollend",r),l.onClick!=null&&(r.onclick=vu),r=!0):r=!1,r||$s(i)}function Dg(i){for(Ht=i.return;Ht;)switch(Ht.tag){case 5:case 13:Hn=!1;return;case 27:case 3:Hn=!0;return;default:Ht=Ht.return}}function Ha(i){if(i!==Ht)return!1;if(!$e)return Dg(i),$e=!0,!1;var r=i.tag,o;if((o=r!==3&&r!==27)&&((o=r===5)&&(o=i.type,o=!(o!=="form"&&o!=="button")||nh(i.type,i.memoizedProps)),o=!o),o&&st&&$s(i),Dg(i),r===13){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(s(317));e:{for(i=i.nextSibling,r=0;i;){if(i.nodeType===8)if(o=i.data,o==="/$"){if(r===0){st=Vn(i.nextSibling);break e}r--}else o!=="$"&&o!=="$!"&&o!=="$?"||r++;i=i.nextSibling}st=null}}else r===27?(r=st,rs(i.type)?(i=ah,ah=null,st=i):st=r):st=Ht?Vn(i.stateNode.nextSibling):null;return!0}function Ga(){st=Ht=null,$e=!1}function Ng(){var i=_s;return i!==null&&(en===null?en=i:en.push.apply(en,i),_s=null),i}function Fa(i){_s===null?_s=[i]:_s.push(i)}var qf=U(null),Bs=null,hi=null;function Ii(i,r,o){Q(qf,r._currentValue),r._currentValue=o}function pi(i){i._currentValue=qf.current,F(qf)}function Kf(i,r,o){for(;i!==null;){var l=i.alternate;if((i.childLanes&r)!==r?(i.childLanes|=r,l!==null&&(l.childLanes|=r)):l!==null&&(l.childLanes&r)!==r&&(l.childLanes|=r),i===o)break;i=i.return}}function Pf(i,r,o,l){var f=i.child;for(f!==null&&(f.return=i);f!==null;){var m=f.dependencies;if(m!==null){var b=f.child;m=m.firstContext;e:for(;m!==null;){var x=m;m=f;for(var E=0;E<r.length;E++)if(x.context===r[E]){m.lanes|=o,x=m.alternate,x!==null&&(x.lanes|=o),Kf(m.return,o,i),l||(b=null);break e}m=x.next}}else if(f.tag===18){if(b=f.return,b===null)throw Error(s(341));b.lanes|=o,m=b.alternate,m!==null&&(m.lanes|=o),Kf(b,o,i),b=null}else b=f.child;if(b!==null)b.return=f;else for(b=f;b!==null;){if(b===i){b=null;break}if(f=b.sibling,f!==null){f.return=b.return,b=f;break}b=b.return}f=b}}function Ya(i,r,o,l){i=null;for(var f=r,m=!1;f!==null;){if(!m){if((f.flags&524288)!==0)m=!0;else if((f.flags&262144)!==0)break}if(f.tag===10){var b=f.alternate;if(b===null)throw Error(s(387));if(b=b.memoizedProps,b!==null){var x=f.type;un(f.pendingProps.value,b.value)||(i!==null?i.push(x):i=[x])}}else if(f===Xe.current){if(b=f.alternate,b===null)throw Error(s(387));b.memoizedState.memoizedState!==f.memoizedState.memoizedState&&(i!==null?i.push(To):i=[To])}f=f.return}i!==null&&Pf(r,i,o,l),r.flags|=262144}function Ul(i){for(i=i.firstContext;i!==null;){if(!un(i.context._currentValue,i.memoizedValue))return!0;i=i.next}return!1}function Ls(i){Bs=i,hi=null,i=i.dependencies,i!==null&&(i.firstContext=null)}function jt(i){return _g(Bs,i)}function ql(i,r){return Bs===null&&Ls(i),_g(i,r)}function _g(i,r){var o=r._currentValue;if(r={context:r,memoizedValue:o,next:null},hi===null){if(i===null)throw Error(s(308));hi=r,i.dependencies={lanes:0,firstContext:r},i.flags|=524288}else hi=hi.next=r;return o}var zO=typeof AbortController<"u"?AbortController:function(){var i=[],r=this.signal={aborted:!1,addEventListener:function(o,l){i.push(l)}};this.abort=function(){r.aborted=!0,i.forEach(function(o){return o()})}},UO=e.unstable_scheduleCallback,qO=e.unstable_NormalPriority,vt={$$typeof:k,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function If(){return{controller:new zO,data:new Map,refCount:0}}function Xa(i){i.refCount--,i.refCount===0&&UO(qO,function(){i.controller.abort()})}var Za=null,Hf=0,Mr=0,Cr=null;function KO(i,r){if(Za===null){var o=Za=[];Hf=0,Mr=Fd(),Cr={status:"pending",value:void 0,then:function(l){o.push(l)}}}return Hf++,r.then($g,$g),r}function $g(){if(--Hf===0&&Za!==null){Cr!==null&&(Cr.status="fulfilled");var i=Za;Za=null,Mr=0,Cr=null;for(var r=0;r<i.length;r++)(0,i[r])()}}function PO(i,r){var o=[],l={status:"pending",value:null,reason:null,then:function(f){o.push(f)}};return i.then(function(){l.status="fulfilled",l.value=r;for(var f=0;f<o.length;f++)(0,o[f])(r)},function(f){for(l.status="rejected",l.reason=f,f=0;f<o.length;f++)(0,o[f])(void 0)}),l}var Bg=L.S;L.S=function(i,r){typeof r=="object"&&r!==null&&typeof r.then=="function"&&KO(i,r),Bg!==null&&Bg(i,r)};var Vs=U(null);function Gf(){var i=Vs.current;return i!==null?i:Fe.pooledCache}function Kl(i,r){r===null?Q(Vs,Vs.current):Q(Vs,r.pool)}function Lg(){var i=Gf();return i===null?null:{parent:vt._currentValue,pool:i}}var Ja=Error(s(460)),Vg=Error(s(474)),Pl=Error(s(542)),Ff={then:function(){}};function jg(i){return i=i.status,i==="fulfilled"||i==="rejected"}function Il(){}function zg(i,r,o){switch(o=i[o],o===void 0?i.push(r):o!==r&&(r.then(Il,Il),r=o),r.status){case"fulfilled":return r.value;case"rejected":throw i=r.reason,qg(i),i;default:if(typeof r.status=="string")r.then(Il,Il);else{if(i=Fe,i!==null&&100<i.shellSuspendCounter)throw Error(s(482));i=r,i.status="pending",i.then(function(l){if(r.status==="pending"){var f=r;f.status="fulfilled",f.value=l}},function(l){if(r.status==="pending"){var f=r;f.status="rejected",f.reason=l}})}switch(r.status){case"fulfilled":return r.value;case"rejected":throw i=r.reason,qg(i),i}throw Qa=r,Ja}}var Qa=null;function Ug(){if(Qa===null)throw Error(s(459));var i=Qa;return Qa=null,i}function qg(i){if(i===Ja||i===Pl)throw Error(s(483))}var Hi=!1;function Yf(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Xf(i,r){i=i.updateQueue,r.updateQueue===i&&(r.updateQueue={baseState:i.baseState,firstBaseUpdate:i.firstBaseUpdate,lastBaseUpdate:i.lastBaseUpdate,shared:i.shared,callbacks:null})}function Gi(i){return{lane:i,tag:0,payload:null,callback:null,next:null}}function Fi(i,r,o){var l=i.updateQueue;if(l===null)return null;if(l=l.shared,(Le&2)!==0){var f=l.pending;return f===null?r.next=r:(r.next=f.next,f.next=r),l.pending=r,r=Ll(i),Og(i,null,o),r}return Bl(i,l,r,o),Ll(i)}function Wa(i,r,o){if(r=r.updateQueue,r!==null&&(r=r.shared,(o&4194048)!==0)){var l=r.lanes;l&=i.pendingLanes,o|=l,r.lanes=o,$y(i,o)}}function Zf(i,r){var o=i.updateQueue,l=i.alternate;if(l!==null&&(l=l.updateQueue,o===l)){var f=null,m=null;if(o=o.firstBaseUpdate,o!==null){do{var b={lane:o.lane,tag:o.tag,payload:o.payload,callback:null,next:null};m===null?f=m=b:m=m.next=b,o=o.next}while(o!==null);m===null?f=m=r:m=m.next=r}else f=m=r;o={baseState:l.baseState,firstBaseUpdate:f,lastBaseUpdate:m,shared:l.shared,callbacks:l.callbacks},i.updateQueue=o;return}i=o.lastBaseUpdate,i===null?o.firstBaseUpdate=r:i.next=r,o.lastBaseUpdate=r}var Jf=!1;function eo(){if(Jf){var i=Cr;if(i!==null)throw i}}function to(i,r,o,l){Jf=!1;var f=i.updateQueue;Hi=!1;var m=f.firstBaseUpdate,b=f.lastBaseUpdate,x=f.shared.pending;if(x!==null){f.shared.pending=null;var E=x,_=E.next;E.next=null,b===null?m=_:b.next=_,b=E;var q=i.alternate;q!==null&&(q=q.updateQueue,x=q.lastBaseUpdate,x!==b&&(x===null?q.firstBaseUpdate=_:x.next=_,q.lastBaseUpdate=E))}if(m!==null){var H=f.baseState;b=0,q=_=E=null,x=m;do{var B=x.lane&-536870913,V=B!==x.lane;if(V?(Ce&B)===B:(l&B)===B){B!==0&&B===Mr&&(Jf=!0),q!==null&&(q=q.next={lane:0,tag:x.tag,payload:x.payload,callback:null,next:null});e:{var de=i,ue=x;B=r;var Ue=o;switch(ue.tag){case 1:if(de=ue.payload,typeof de=="function"){H=de.call(Ue,H,B);break e}H=de;break e;case 3:de.flags=de.flags&-65537|128;case 0:if(de=ue.payload,B=typeof de=="function"?de.call(Ue,H,B):de,B==null)break e;H=y({},H,B);break e;case 2:Hi=!0}}B=x.callback,B!==null&&(i.flags|=64,V&&(i.flags|=8192),V=f.callbacks,V===null?f.callbacks=[B]:V.push(B))}else V={lane:B,tag:x.tag,payload:x.payload,callback:x.callback,next:null},q===null?(_=q=V,E=H):q=q.next=V,b|=B;if(x=x.next,x===null){if(x=f.shared.pending,x===null)break;V=x,x=V.next,V.next=null,f.lastBaseUpdate=V,f.shared.pending=null}}while(!0);q===null&&(E=H),f.baseState=E,f.firstBaseUpdate=_,f.lastBaseUpdate=q,m===null&&(f.shared.lanes=0),ts|=b,i.lanes=b,i.memoizedState=H}}function Kg(i,r){if(typeof i!="function")throw Error(s(191,i));i.call(r)}function Pg(i,r){var o=i.callbacks;if(o!==null)for(i.callbacks=null,i=0;i<o.length;i++)Kg(o[i],r)}var kr=U(null),Hl=U(0);function Ig(i,r){i=xi,Q(Hl,i),Q(kr,r),xi=i|r.baseLanes}function Qf(){Q(Hl,xi),Q(kr,kr.current)}function Wf(){xi=Hl.current,F(kr),F(Hl)}var Yi=0,ve=null,je=null,dt=null,Gl=!1,Dr=!1,js=!1,Fl=0,no=0,Nr=null,IO=0;function lt(){throw Error(s(321))}function ed(i,r){if(r===null)return!1;for(var o=0;o<r.length&&o<i.length;o++)if(!un(i[o],r[o]))return!1;return!0}function td(i,r,o,l,f,m){return Yi=m,ve=r,r.memoizedState=null,r.updateQueue=null,r.lanes=0,L.H=i===null||i.memoizedState===null?Ob:Mb,js=!1,m=o(l,f),js=!1,Dr&&(m=Gg(r,o,l,f)),Hg(i),m}function Hg(i){L.H=Wl;var r=je!==null&&je.next!==null;if(Yi=0,dt=je=ve=null,Gl=!1,no=0,Nr=null,r)throw Error(s(300));i===null||Et||(i=i.dependencies,i!==null&&Ul(i)&&(Et=!0))}function Gg(i,r,o,l){ve=i;var f=0;do{if(Dr&&(Nr=null),no=0,Dr=!1,25<=f)throw Error(s(301));if(f+=1,dt=je=null,i.updateQueue!=null){var m=i.updateQueue;m.lastEffect=null,m.events=null,m.stores=null,m.memoCache!=null&&(m.memoCache.index=0)}L.H=JO,m=r(o,l)}while(Dr);return m}function HO(){var i=L.H,r=i.useState()[0];return r=typeof r.then=="function"?io(r):r,i=i.useState()[0],(je!==null?je.memoizedState:null)!==i&&(ve.flags|=1024),r}function nd(){var i=Fl!==0;return Fl=0,i}function id(i,r,o){r.updateQueue=i.updateQueue,r.flags&=-2053,i.lanes&=~o}function sd(i){if(Gl){for(i=i.memoizedState;i!==null;){var r=i.queue;r!==null&&(r.pending=null),i=i.next}Gl=!1}Yi=0,dt=je=ve=null,Dr=!1,no=Fl=0,Nr=null}function Qt(){var i={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return dt===null?ve.memoizedState=dt=i:dt=dt.next=i,dt}function ht(){if(je===null){var i=ve.alternate;i=i!==null?i.memoizedState:null}else i=je.next;var r=dt===null?ve.memoizedState:dt.next;if(r!==null)dt=r,je=i;else{if(i===null)throw ve.alternate===null?Error(s(467)):Error(s(310));je=i,i={memoizedState:je.memoizedState,baseState:je.baseState,baseQueue:je.baseQueue,queue:je.queue,next:null},dt===null?ve.memoizedState=dt=i:dt=dt.next=i}return dt}function rd(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function io(i){var r=no;return no+=1,Nr===null&&(Nr=[]),i=zg(Nr,i,r),r=ve,(dt===null?r.memoizedState:dt.next)===null&&(r=r.alternate,L.H=r===null||r.memoizedState===null?Ob:Mb),i}function Yl(i){if(i!==null&&typeof i=="object"){if(typeof i.then=="function")return io(i);if(i.$$typeof===k)return jt(i)}throw Error(s(438,String(i)))}function ad(i){var r=null,o=ve.updateQueue;if(o!==null&&(r=o.memoCache),r==null){var l=ve.alternate;l!==null&&(l=l.updateQueue,l!==null&&(l=l.memoCache,l!=null&&(r={data:l.data.map(function(f){return f.slice()}),index:0})))}if(r==null&&(r={data:[],index:0}),o===null&&(o=rd(),ve.updateQueue=o),o.memoCache=r,o=r.data[r.index],o===void 0)for(o=r.data[r.index]=Array(i),l=0;l<i;l++)o[l]=me;return r.index++,o}function mi(i,r){return typeof r=="function"?r(i):r}function Xl(i){var r=ht();return od(r,je,i)}function od(i,r,o){var l=i.queue;if(l===null)throw Error(s(311));l.lastRenderedReducer=o;var f=i.baseQueue,m=l.pending;if(m!==null){if(f!==null){var b=f.next;f.next=m.next,m.next=b}r.baseQueue=f=m,l.pending=null}if(m=i.baseState,f===null)i.memoizedState=m;else{r=f.next;var x=b=null,E=null,_=r,q=!1;do{var H=_.lane&-536870913;if(H!==_.lane?(Ce&H)===H:(Yi&H)===H){var B=_.revertLane;if(B===0)E!==null&&(E=E.next={lane:0,revertLane:0,action:_.action,hasEagerState:_.hasEagerState,eagerState:_.eagerState,next:null}),H===Mr&&(q=!0);else if((Yi&B)===B){_=_.next,B===Mr&&(q=!0);continue}else H={lane:0,revertLane:_.revertLane,action:_.action,hasEagerState:_.hasEagerState,eagerState:_.eagerState,next:null},E===null?(x=E=H,b=m):E=E.next=H,ve.lanes|=B,ts|=B;H=_.action,js&&o(m,H),m=_.hasEagerState?_.eagerState:o(m,H)}else B={lane:H,revertLane:_.revertLane,action:_.action,hasEagerState:_.hasEagerState,eagerState:_.eagerState,next:null},E===null?(x=E=B,b=m):E=E.next=B,ve.lanes|=H,ts|=H;_=_.next}while(_!==null&&_!==r);if(E===null?b=m:E.next=x,!un(m,i.memoizedState)&&(Et=!0,q&&(o=Cr,o!==null)))throw o;i.memoizedState=m,i.baseState=b,i.baseQueue=E,l.lastRenderedState=m}return f===null&&(l.lanes=0),[i.memoizedState,l.dispatch]}function ld(i){var r=ht(),o=r.queue;if(o===null)throw Error(s(311));o.lastRenderedReducer=i;var l=o.dispatch,f=o.pending,m=r.memoizedState;if(f!==null){o.pending=null;var b=f=f.next;do m=i(m,b.action),b=b.next;while(b!==f);un(m,r.memoizedState)||(Et=!0),r.memoizedState=m,r.baseQueue===null&&(r.baseState=m),o.lastRenderedState=m}return[m,l]}function Fg(i,r,o){var l=ve,f=ht(),m=$e;if(m){if(o===void 0)throw Error(s(407));o=o()}else o=r();var b=!un((je||f).memoizedState,o);b&&(f.memoizedState=o,Et=!0),f=f.queue;var x=Zg.bind(null,l,f,i);if(so(2048,8,x,[i]),f.getSnapshot!==r||b||dt!==null&&dt.memoizedState.tag&1){if(l.flags|=2048,_r(9,Zl(),Xg.bind(null,l,f,o,r),null),Fe===null)throw Error(s(349));m||(Yi&124)!==0||Yg(l,r,o)}return o}function Yg(i,r,o){i.flags|=16384,i={getSnapshot:r,value:o},r=ve.updateQueue,r===null?(r=rd(),ve.updateQueue=r,r.stores=[i]):(o=r.stores,o===null?r.stores=[i]:o.push(i))}function Xg(i,r,o,l){r.value=o,r.getSnapshot=l,Jg(r)&&Qg(i)}function Zg(i,r,o){return o(function(){Jg(r)&&Qg(i)})}function Jg(i){var r=i.getSnapshot;i=i.value;try{var o=r();return!un(i,o)}catch{return!0}}function Qg(i){var r=Tr(i,2);r!==null&&mn(r,i,2)}function ud(i){var r=Qt();if(typeof i=="function"){var o=i;if(i=o(),js){qi(!0);try{o()}finally{qi(!1)}}}return r.memoizedState=r.baseState=i,r.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:mi,lastRenderedState:i},r}function Wg(i,r,o,l){return i.baseState=o,od(i,je,typeof l=="function"?l:mi)}function GO(i,r,o,l,f){if(Ql(i))throw Error(s(485));if(i=r.action,i!==null){var m={payload:f,action:i,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(b){m.listeners.push(b)}};L.T!==null?o(!0):m.isTransition=!1,l(m),o=r.pending,o===null?(m.next=r.pending=m,eb(r,m)):(m.next=o.next,r.pending=o.next=m)}}function eb(i,r){var o=r.action,l=r.payload,f=i.state;if(r.isTransition){var m=L.T,b={};L.T=b;try{var x=o(f,l),E=L.S;E!==null&&E(b,x),tb(i,r,x)}catch(_){cd(i,r,_)}finally{L.T=m}}else try{m=o(f,l),tb(i,r,m)}catch(_){cd(i,r,_)}}function tb(i,r,o){o!==null&&typeof o=="object"&&typeof o.then=="function"?o.then(function(l){nb(i,r,l)},function(l){return cd(i,r,l)}):nb(i,r,o)}function nb(i,r,o){r.status="fulfilled",r.value=o,ib(r),i.state=o,r=i.pending,r!==null&&(o=r.next,o===r?i.pending=null:(o=o.next,r.next=o,eb(i,o)))}function cd(i,r,o){var l=i.pending;if(i.pending=null,l!==null){l=l.next;do r.status="rejected",r.reason=o,ib(r),r=r.next;while(r!==l)}i.action=null}function ib(i){i=i.listeners;for(var r=0;r<i.length;r++)(0,i[r])()}function sb(i,r){return r}function rb(i,r){if($e){var o=Fe.formState;if(o!==null){e:{var l=ve;if($e){if(st){t:{for(var f=st,m=Hn;f.nodeType!==8;){if(!m){f=null;break t}if(f=Vn(f.nextSibling),f===null){f=null;break t}}m=f.data,f=m==="F!"||m==="F"?f:null}if(f){st=Vn(f.nextSibling),l=f.data==="F!";break e}}$s(l)}l=!1}l&&(r=o[0])}}return o=Qt(),o.memoizedState=o.baseState=r,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:sb,lastRenderedState:r},o.queue=l,o=Tb.bind(null,ve,l),l.dispatch=o,l=ud(!1),m=md.bind(null,ve,!1,l.queue),l=Qt(),f={state:r,dispatch:null,action:i,pending:null},l.queue=f,o=GO.bind(null,ve,f,m,o),f.dispatch=o,l.memoizedState=i,[r,o,!1]}function ab(i){var r=ht();return ob(r,je,i)}function ob(i,r,o){if(r=od(i,r,sb)[0],i=Xl(mi)[0],typeof r=="object"&&r!==null&&typeof r.then=="function")try{var l=io(r)}catch(b){throw b===Ja?Pl:b}else l=r;r=ht();var f=r.queue,m=f.dispatch;return o!==r.memoizedState&&(ve.flags|=2048,_r(9,Zl(),FO.bind(null,f,o),null)),[l,m,i]}function FO(i,r){i.action=r}function lb(i){var r=ht(),o=je;if(o!==null)return ob(r,o,i);ht(),r=r.memoizedState,o=ht();var l=o.queue.dispatch;return o.memoizedState=i,[r,l,!1]}function _r(i,r,o,l){return i={tag:i,create:o,deps:l,inst:r,next:null},r=ve.updateQueue,r===null&&(r=rd(),ve.updateQueue=r),o=r.lastEffect,o===null?r.lastEffect=i.next=i:(l=o.next,o.next=i,i.next=l,r.lastEffect=i),i}function Zl(){return{destroy:void 0,resource:void 0}}function ub(){return ht().memoizedState}function Jl(i,r,o,l){var f=Qt();l=l===void 0?null:l,ve.flags|=i,f.memoizedState=_r(1|r,Zl(),o,l)}function so(i,r,o,l){var f=ht();l=l===void 0?null:l;var m=f.memoizedState.inst;je!==null&&l!==null&&ed(l,je.memoizedState.deps)?f.memoizedState=_r(r,m,o,l):(ve.flags|=i,f.memoizedState=_r(1|r,m,o,l))}function cb(i,r){Jl(8390656,8,i,r)}function fb(i,r){so(2048,8,i,r)}function db(i,r){return so(4,2,i,r)}function hb(i,r){return so(4,4,i,r)}function pb(i,r){if(typeof r=="function"){i=i();var o=r(i);return function(){typeof o=="function"?o():r(null)}}if(r!=null)return i=i(),r.current=i,function(){r.current=null}}function mb(i,r,o){o=o!=null?o.concat([i]):null,so(4,4,pb.bind(null,r,i),o)}function fd(){}function yb(i,r){var o=ht();r=r===void 0?null:r;var l=o.memoizedState;return r!==null&&ed(r,l[1])?l[0]:(o.memoizedState=[i,r],i)}function gb(i,r){var o=ht();r=r===void 0?null:r;var l=o.memoizedState;if(r!==null&&ed(r,l[1]))return l[0];if(l=i(),js){qi(!0);try{i()}finally{qi(!1)}}return o.memoizedState=[l,r],l}function dd(i,r,o){return o===void 0||(Yi&1073741824)!==0?i.memoizedState=r:(i.memoizedState=o,i=Sv(),ve.lanes|=i,ts|=i,o)}function bb(i,r,o,l){return un(o,r)?o:kr.current!==null?(i=dd(i,o,l),un(i,r)||(Et=!0),i):(Yi&42)===0?(Et=!0,i.memoizedState=o):(i=Sv(),ve.lanes|=i,ts|=i,r)}function vb(i,r,o,l,f){var m=I.p;I.p=m!==0&&8>m?m:8;var b=L.T,x={};L.T=x,md(i,!1,r,o);try{var E=f(),_=L.S;if(_!==null&&_(x,E),E!==null&&typeof E=="object"&&typeof E.then=="function"){var q=PO(E,l);ro(i,r,q,pn(i))}else ro(i,r,l,pn(i))}catch(H){ro(i,r,{then:function(){},status:"rejected",reason:H},pn())}finally{I.p=m,L.T=b}}function YO(){}function hd(i,r,o,l){if(i.tag!==5)throw Error(s(476));var f=Sb(i).queue;vb(i,f,r,G,o===null?YO:function(){return xb(i),o(l)})}function Sb(i){var r=i.memoizedState;if(r!==null)return r;r={memoizedState:G,baseState:G,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:mi,lastRenderedState:G},next:null};var o={};return r.next={memoizedState:o,baseState:o,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:mi,lastRenderedState:o},next:null},i.memoizedState=r,i=i.alternate,i!==null&&(i.memoizedState=r),r}function xb(i){var r=Sb(i).next.queue;ro(i,r,{},pn())}function pd(){return jt(To)}function wb(){return ht().memoizedState}function Ab(){return ht().memoizedState}function XO(i){for(var r=i.return;r!==null;){switch(r.tag){case 24:case 3:var o=pn();i=Gi(o);var l=Fi(r,i,o);l!==null&&(mn(l,r,o),Wa(l,r,o)),r={cache:If()},i.payload=r;return}r=r.return}}function ZO(i,r,o){var l=pn();o={lane:l,revertLane:0,action:o,hasEagerState:!1,eagerState:null,next:null},Ql(i)?Eb(r,o):(o=$f(i,r,o,l),o!==null&&(mn(o,i,l),Rb(o,r,l)))}function Tb(i,r,o){var l=pn();ro(i,r,o,l)}function ro(i,r,o,l){var f={lane:l,revertLane:0,action:o,hasEagerState:!1,eagerState:null,next:null};if(Ql(i))Eb(r,f);else{var m=i.alternate;if(i.lanes===0&&(m===null||m.lanes===0)&&(m=r.lastRenderedReducer,m!==null))try{var b=r.lastRenderedState,x=m(b,o);if(f.hasEagerState=!0,f.eagerState=x,un(x,b))return Bl(i,r,f,0),Fe===null&&$l(),!1}catch{}finally{}if(o=$f(i,r,f,l),o!==null)return mn(o,i,l),Rb(o,r,l),!0}return!1}function md(i,r,o,l){if(l={lane:2,revertLane:Fd(),action:l,hasEagerState:!1,eagerState:null,next:null},Ql(i)){if(r)throw Error(s(479))}else r=$f(i,o,l,2),r!==null&&mn(r,i,2)}function Ql(i){var r=i.alternate;return i===ve||r!==null&&r===ve}function Eb(i,r){Dr=Gl=!0;var o=i.pending;o===null?r.next=r:(r.next=o.next,o.next=r),i.pending=r}function Rb(i,r,o){if((o&4194048)!==0){var l=r.lanes;l&=i.pendingLanes,o|=l,r.lanes=o,$y(i,o)}}var Wl={readContext:jt,use:Yl,useCallback:lt,useContext:lt,useEffect:lt,useImperativeHandle:lt,useLayoutEffect:lt,useInsertionEffect:lt,useMemo:lt,useReducer:lt,useRef:lt,useState:lt,useDebugValue:lt,useDeferredValue:lt,useTransition:lt,useSyncExternalStore:lt,useId:lt,useHostTransitionStatus:lt,useFormState:lt,useActionState:lt,useOptimistic:lt,useMemoCache:lt,useCacheRefresh:lt},Ob={readContext:jt,use:Yl,useCallback:function(i,r){return Qt().memoizedState=[i,r===void 0?null:r],i},useContext:jt,useEffect:cb,useImperativeHandle:function(i,r,o){o=o!=null?o.concat([i]):null,Jl(4194308,4,pb.bind(null,r,i),o)},useLayoutEffect:function(i,r){return Jl(4194308,4,i,r)},useInsertionEffect:function(i,r){Jl(4,2,i,r)},useMemo:function(i,r){var o=Qt();r=r===void 0?null:r;var l=i();if(js){qi(!0);try{i()}finally{qi(!1)}}return o.memoizedState=[l,r],l},useReducer:function(i,r,o){var l=Qt();if(o!==void 0){var f=o(r);if(js){qi(!0);try{o(r)}finally{qi(!1)}}}else f=r;return l.memoizedState=l.baseState=f,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:i,lastRenderedState:f},l.queue=i,i=i.dispatch=ZO.bind(null,ve,i),[l.memoizedState,i]},useRef:function(i){var r=Qt();return i={current:i},r.memoizedState=i},useState:function(i){i=ud(i);var r=i.queue,o=Tb.bind(null,ve,r);return r.dispatch=o,[i.memoizedState,o]},useDebugValue:fd,useDeferredValue:function(i,r){var o=Qt();return dd(o,i,r)},useTransition:function(){var i=ud(!1);return i=vb.bind(null,ve,i.queue,!0,!1),Qt().memoizedState=i,[!1,i]},useSyncExternalStore:function(i,r,o){var l=ve,f=Qt();if($e){if(o===void 0)throw Error(s(407));o=o()}else{if(o=r(),Fe===null)throw Error(s(349));(Ce&124)!==0||Yg(l,r,o)}f.memoizedState=o;var m={value:o,getSnapshot:r};return f.queue=m,cb(Zg.bind(null,l,m,i),[i]),l.flags|=2048,_r(9,Zl(),Xg.bind(null,l,m,o,r),null),o},useId:function(){var i=Qt(),r=Fe.identifierPrefix;if($e){var o=di,l=fi;o=(l&~(1<<32-ln(l)-1)).toString(32)+o,r="ยซ"+r+"R"+o,o=Fl++,0<o&&(r+="H"+o.toString(32)),r+="ยป"}else o=IO++,r="ยซ"+r+"r"+o.toString(32)+"ยป";return i.memoizedState=r},useHostTransitionStatus:pd,useFormState:rb,useActionState:rb,useOptimistic:function(i){var r=Qt();r.memoizedState=r.baseState=i;var o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return r.queue=o,r=md.bind(null,ve,!0,o),o.dispatch=r,[i,r]},useMemoCache:ad,useCacheRefresh:function(){return Qt().memoizedState=XO.bind(null,ve)}},Mb={readContext:jt,use:Yl,useCallback:yb,useContext:jt,useEffect:fb,useImperativeHandle:mb,useInsertionEffect:db,useLayoutEffect:hb,useMemo:gb,useReducer:Xl,useRef:ub,useState:function(){return Xl(mi)},useDebugValue:fd,useDeferredValue:function(i,r){var o=ht();return bb(o,je.memoizedState,i,r)},useTransition:function(){var i=Xl(mi)[0],r=ht().memoizedState;return[typeof i=="boolean"?i:io(i),r]},useSyncExternalStore:Fg,useId:wb,useHostTransitionStatus:pd,useFormState:ab,useActionState:ab,useOptimistic:function(i,r){var o=ht();return Wg(o,je,i,r)},useMemoCache:ad,useCacheRefresh:Ab},JO={readContext:jt,use:Yl,useCallback:yb,useContext:jt,useEffect:fb,useImperativeHandle:mb,useInsertionEffect:db,useLayoutEffect:hb,useMemo:gb,useReducer:ld,useRef:ub,useState:function(){return ld(mi)},useDebugValue:fd,useDeferredValue:function(i,r){var o=ht();return je===null?dd(o,i,r):bb(o,je.memoizedState,i,r)},useTransition:function(){var i=ld(mi)[0],r=ht().memoizedState;return[typeof i=="boolean"?i:io(i),r]},useSyncExternalStore:Fg,useId:wb,useHostTransitionStatus:pd,useFormState:lb,useActionState:lb,useOptimistic:function(i,r){var o=ht();return je!==null?Wg(o,je,i,r):(o.baseState=i,[i,o.queue.dispatch])},useMemoCache:ad,useCacheRefresh:Ab},$r=null,ao=0;function eu(i){var r=ao;return ao+=1,$r===null&&($r=[]),zg($r,i,r)}function oo(i,r){r=r.props.ref,i.ref=r!==void 0?r:null}function tu(i,r){throw r.$$typeof===g?Error(s(525)):(i=Object.prototype.toString.call(r),Error(s(31,i==="[object Object]"?"object with keys {"+Object.keys(r).join(", ")+"}":i)))}function Cb(i){var r=i._init;return r(i._payload)}function kb(i){function r(C,O){if(i){var N=C.deletions;N===null?(C.deletions=[O],C.flags|=16):N.push(O)}}function o(C,O){if(!i)return null;for(;O!==null;)r(C,O),O=O.sibling;return null}function l(C){for(var O=new Map;C!==null;)C.key!==null?O.set(C.key,C):O.set(C.index,C),C=C.sibling;return O}function f(C,O){return C=ci(C,O),C.index=0,C.sibling=null,C}function m(C,O,N){return C.index=N,i?(N=C.alternate,N!==null?(N=N.index,N<O?(C.flags|=67108866,O):N):(C.flags|=67108866,O)):(C.flags|=1048576,O)}function b(C){return i&&C.alternate===null&&(C.flags|=67108866),C}function x(C,O,N,P){return O===null||O.tag!==6?(O=Lf(N,C.mode,P),O.return=C,O):(O=f(O,N),O.return=C,O)}function E(C,O,N,P){var se=N.type;return se===T?q(C,O,N.props.children,P,N.key):O!==null&&(O.elementType===se||typeof se=="object"&&se!==null&&se.$$typeof===te&&Cb(se)===O.type)?(O=f(O,N.props),oo(O,N),O.return=C,O):(O=Vl(N.type,N.key,N.props,null,C.mode,P),oo(O,N),O.return=C,O)}function _(C,O,N,P){return O===null||O.tag!==4||O.stateNode.containerInfo!==N.containerInfo||O.stateNode.implementation!==N.implementation?(O=Vf(N,C.mode,P),O.return=C,O):(O=f(O,N.children||[]),O.return=C,O)}function q(C,O,N,P,se){return O===null||O.tag!==7?(O=ks(N,C.mode,P,se),O.return=C,O):(O=f(O,N),O.return=C,O)}function H(C,O,N){if(typeof O=="string"&&O!==""||typeof O=="number"||typeof O=="bigint")return O=Lf(""+O,C.mode,N),O.return=C,O;if(typeof O=="object"&&O!==null){switch(O.$$typeof){case v:return N=Vl(O.type,O.key,O.props,null,C.mode,N),oo(N,O),N.return=C,N;case S:return O=Vf(O,C.mode,N),O.return=C,O;case te:var P=O._init;return O=P(O._payload),H(C,O,N)}if(X(O)||De(O))return O=ks(O,C.mode,N,null),O.return=C,O;if(typeof O.then=="function")return H(C,eu(O),N);if(O.$$typeof===k)return H(C,ql(C,O),N);tu(C,O)}return null}function B(C,O,N,P){var se=O!==null?O.key:null;if(typeof N=="string"&&N!==""||typeof N=="number"||typeof N=="bigint")return se!==null?null:x(C,O,""+N,P);if(typeof N=="object"&&N!==null){switch(N.$$typeof){case v:return N.key===se?E(C,O,N,P):null;case S:return N.key===se?_(C,O,N,P):null;case te:return se=N._init,N=se(N._payload),B(C,O,N,P)}if(X(N)||De(N))return se!==null?null:q(C,O,N,P,null);if(typeof N.then=="function")return B(C,O,eu(N),P);if(N.$$typeof===k)return B(C,O,ql(C,N),P);tu(C,N)}return null}function V(C,O,N,P,se){if(typeof P=="string"&&P!==""||typeof P=="number"||typeof P=="bigint")return C=C.get(N)||null,x(O,C,""+P,se);if(typeof P=="object"&&P!==null){switch(P.$$typeof){case v:return C=C.get(P.key===null?N:P.key)||null,E(O,C,P,se);case S:return C=C.get(P.key===null?N:P.key)||null,_(O,C,P,se);case te:var we=P._init;return P=we(P._payload),V(C,O,N,P,se)}if(X(P)||De(P))return C=C.get(N)||null,q(O,C,P,se,null);if(typeof P.then=="function")return V(C,O,N,eu(P),se);if(P.$$typeof===k)return V(C,O,N,ql(O,P),se);tu(O,P)}return null}function de(C,O,N,P){for(var se=null,we=null,le=O,ce=O=0,Ot=null;le!==null&&ce<N.length;ce++){le.index>ce?(Ot=le,le=null):Ot=le.sibling;var _e=B(C,le,N[ce],P);if(_e===null){le===null&&(le=Ot);break}i&&le&&_e.alternate===null&&r(C,le),O=m(_e,O,ce),we===null?se=_e:we.sibling=_e,we=_e,le=Ot}if(ce===N.length)return o(C,le),$e&&Ns(C,ce),se;if(le===null){for(;ce<N.length;ce++)le=H(C,N[ce],P),le!==null&&(O=m(le,O,ce),we===null?se=le:we.sibling=le,we=le);return $e&&Ns(C,ce),se}for(le=l(le);ce<N.length;ce++)Ot=V(le,C,ce,N[ce],P),Ot!==null&&(i&&Ot.alternate!==null&&le.delete(Ot.key===null?ce:Ot.key),O=m(Ot,O,ce),we===null?se=Ot:we.sibling=Ot,we=Ot);return i&&le.forEach(function(cs){return r(C,cs)}),$e&&Ns(C,ce),se}function ue(C,O,N,P){if(N==null)throw Error(s(151));for(var se=null,we=null,le=O,ce=O=0,Ot=null,_e=N.next();le!==null&&!_e.done;ce++,_e=N.next()){le.index>ce?(Ot=le,le=null):Ot=le.sibling;var cs=B(C,le,_e.value,P);if(cs===null){le===null&&(le=Ot);break}i&&le&&cs.alternate===null&&r(C,le),O=m(cs,O,ce),we===null?se=cs:we.sibling=cs,we=cs,le=Ot}if(_e.done)return o(C,le),$e&&Ns(C,ce),se;if(le===null){for(;!_e.done;ce++,_e=N.next())_e=H(C,_e.value,P),_e!==null&&(O=m(_e,O,ce),we===null?se=_e:we.sibling=_e,we=_e);return $e&&Ns(C,ce),se}for(le=l(le);!_e.done;ce++,_e=N.next())_e=V(le,C,ce,_e.value,P),_e!==null&&(i&&_e.alternate!==null&&le.delete(_e.key===null?ce:_e.key),O=m(_e,O,ce),we===null?se=_e:we.sibling=_e,we=_e);return i&&le.forEach(function(QM){return r(C,QM)}),$e&&Ns(C,ce),se}function Ue(C,O,N,P){if(typeof N=="object"&&N!==null&&N.type===T&&N.key===null&&(N=N.props.children),typeof N=="object"&&N!==null){switch(N.$$typeof){case v:e:{for(var se=N.key;O!==null;){if(O.key===se){if(se=N.type,se===T){if(O.tag===7){o(C,O.sibling),P=f(O,N.props.children),P.return=C,C=P;break e}}else if(O.elementType===se||typeof se=="object"&&se!==null&&se.$$typeof===te&&Cb(se)===O.type){o(C,O.sibling),P=f(O,N.props),oo(P,N),P.return=C,C=P;break e}o(C,O);break}else r(C,O);O=O.sibling}N.type===T?(P=ks(N.props.children,C.mode,P,N.key),P.return=C,C=P):(P=Vl(N.type,N.key,N.props,null,C.mode,P),oo(P,N),P.return=C,C=P)}return b(C);case S:e:{for(se=N.key;O!==null;){if(O.key===se)if(O.tag===4&&O.stateNode.containerInfo===N.containerInfo&&O.stateNode.implementation===N.implementation){o(C,O.sibling),P=f(O,N.children||[]),P.return=C,C=P;break e}else{o(C,O);break}else r(C,O);O=O.sibling}P=Vf(N,C.mode,P),P.return=C,C=P}return b(C);case te:return se=N._init,N=se(N._payload),Ue(C,O,N,P)}if(X(N))return de(C,O,N,P);if(De(N)){if(se=De(N),typeof se!="function")throw Error(s(150));return N=se.call(N),ue(C,O,N,P)}if(typeof N.then=="function")return Ue(C,O,eu(N),P);if(N.$$typeof===k)return Ue(C,O,ql(C,N),P);tu(C,N)}return typeof N=="string"&&N!==""||typeof N=="number"||typeof N=="bigint"?(N=""+N,O!==null&&O.tag===6?(o(C,O.sibling),P=f(O,N),P.return=C,C=P):(o(C,O),P=Lf(N,C.mode,P),P.return=C,C=P),b(C)):o(C,O)}return function(C,O,N,P){try{ao=0;var se=Ue(C,O,N,P);return $r=null,se}catch(le){if(le===Ja||le===Pl)throw le;var we=cn(29,le,null,C.mode);return we.lanes=P,we.return=C,we}finally{}}}var Br=kb(!0),Db=kb(!1),Rn=U(null),Gn=null;function Xi(i){var r=i.alternate;Q(St,St.current&1),Q(Rn,i),Gn===null&&(r===null||kr.current!==null||r.memoizedState!==null)&&(Gn=i)}function Nb(i){if(i.tag===22){if(Q(St,St.current),Q(Rn,i),Gn===null){var r=i.alternate;r!==null&&r.memoizedState!==null&&(Gn=i)}}else Zi()}function Zi(){Q(St,St.current),Q(Rn,Rn.current)}function yi(i){F(Rn),Gn===i&&(Gn=null),F(St)}var St=U(0);function nu(i){for(var r=i;r!==null;){if(r.tag===13){var o=r.memoizedState;if(o!==null&&(o=o.dehydrated,o===null||o.data==="$?"||rh(o)))return r}else if(r.tag===19&&r.memoizedProps.revealOrder!==void 0){if((r.flags&128)!==0)return r}else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===i)break;for(;r.sibling===null;){if(r.return===null||r.return===i)return null;r=r.return}r.sibling.return=r.return,r=r.sibling}return null}function yd(i,r,o,l){r=i.memoizedState,o=o(l,r),o=o==null?r:y({},r,o),i.memoizedState=o,i.lanes===0&&(i.updateQueue.baseState=o)}var gd={enqueueSetState:function(i,r,o){i=i._reactInternals;var l=pn(),f=Gi(l);f.payload=r,o!=null&&(f.callback=o),r=Fi(i,f,l),r!==null&&(mn(r,i,l),Wa(r,i,l))},enqueueReplaceState:function(i,r,o){i=i._reactInternals;var l=pn(),f=Gi(l);f.tag=1,f.payload=r,o!=null&&(f.callback=o),r=Fi(i,f,l),r!==null&&(mn(r,i,l),Wa(r,i,l))},enqueueForceUpdate:function(i,r){i=i._reactInternals;var o=pn(),l=Gi(o);l.tag=2,r!=null&&(l.callback=r),r=Fi(i,l,o),r!==null&&(mn(r,i,o),Wa(r,i,o))}};function _b(i,r,o,l,f,m,b){return i=i.stateNode,typeof i.shouldComponentUpdate=="function"?i.shouldComponentUpdate(l,m,b):r.prototype&&r.prototype.isPureReactComponent?!Pa(o,l)||!Pa(f,m):!0}function $b(i,r,o,l){i=r.state,typeof r.componentWillReceiveProps=="function"&&r.componentWillReceiveProps(o,l),typeof r.UNSAFE_componentWillReceiveProps=="function"&&r.UNSAFE_componentWillReceiveProps(o,l),r.state!==i&&gd.enqueueReplaceState(r,r.state,null)}function zs(i,r){var o=r;if("ref"in r){o={};for(var l in r)l!=="ref"&&(o[l]=r[l])}if(i=i.defaultProps){o===r&&(o=y({},o));for(var f in i)o[f]===void 0&&(o[f]=i[f])}return o}var iu=typeof reportError=="function"?reportError:function(i){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var r=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof i=="object"&&i!==null&&typeof i.message=="string"?String(i.message):String(i),error:i});if(!window.dispatchEvent(r))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",i);return}console.error(i)};function Bb(i){iu(i)}function Lb(i){console.error(i)}function Vb(i){iu(i)}function su(i,r){try{var o=i.onUncaughtError;o(r.value,{componentStack:r.stack})}catch(l){setTimeout(function(){throw l})}}function jb(i,r,o){try{var l=i.onCaughtError;l(o.value,{componentStack:o.stack,errorBoundary:r.tag===1?r.stateNode:null})}catch(f){setTimeout(function(){throw f})}}function bd(i,r,o){return o=Gi(o),o.tag=3,o.payload={element:null},o.callback=function(){su(i,r)},o}function zb(i){return i=Gi(i),i.tag=3,i}function Ub(i,r,o,l){var f=o.type.getDerivedStateFromError;if(typeof f=="function"){var m=l.value;i.payload=function(){return f(m)},i.callback=function(){jb(r,o,l)}}var b=o.stateNode;b!==null&&typeof b.componentDidCatch=="function"&&(i.callback=function(){jb(r,o,l),typeof f!="function"&&(ns===null?ns=new Set([this]):ns.add(this));var x=l.stack;this.componentDidCatch(l.value,{componentStack:x!==null?x:""})})}function QO(i,r,o,l,f){if(o.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(r=o.alternate,r!==null&&Ya(r,o,f,!0),o=Rn.current,o!==null){switch(o.tag){case 13:return Gn===null?Kd():o.alternate===null&&rt===0&&(rt=3),o.flags&=-257,o.flags|=65536,o.lanes=f,l===Ff?o.flags|=16384:(r=o.updateQueue,r===null?o.updateQueue=new Set([l]):r.add(l),Id(i,l,f)),!1;case 22:return o.flags|=65536,l===Ff?o.flags|=16384:(r=o.updateQueue,r===null?(r={transitions:null,markerInstances:null,retryQueue:new Set([l])},o.updateQueue=r):(o=r.retryQueue,o===null?r.retryQueue=new Set([l]):o.add(l)),Id(i,l,f)),!1}throw Error(s(435,o.tag))}return Id(i,l,f),Kd(),!1}if($e)return r=Rn.current,r!==null?((r.flags&65536)===0&&(r.flags|=256),r.flags|=65536,r.lanes=f,l!==Uf&&(i=Error(s(422),{cause:l}),Fa(wn(i,o)))):(l!==Uf&&(r=Error(s(423),{cause:l}),Fa(wn(r,o))),i=i.current.alternate,i.flags|=65536,f&=-f,i.lanes|=f,l=wn(l,o),f=bd(i.stateNode,l,f),Zf(i,f),rt!==4&&(rt=2)),!1;var m=Error(s(520),{cause:l});if(m=wn(m,o),mo===null?mo=[m]:mo.push(m),rt!==4&&(rt=2),r===null)return!0;l=wn(l,o),o=r;do{switch(o.tag){case 3:return o.flags|=65536,i=f&-f,o.lanes|=i,i=bd(o.stateNode,l,i),Zf(o,i),!1;case 1:if(r=o.type,m=o.stateNode,(o.flags&128)===0&&(typeof r.getDerivedStateFromError=="function"||m!==null&&typeof m.componentDidCatch=="function"&&(ns===null||!ns.has(m))))return o.flags|=65536,f&=-f,o.lanes|=f,f=zb(f),Ub(f,i,o,l),Zf(o,f),!1}o=o.return}while(o!==null);return!1}var qb=Error(s(461)),Et=!1;function Dt(i,r,o,l){r.child=i===null?Db(r,null,o,l):Br(r,i.child,o,l)}function Kb(i,r,o,l,f){o=o.render;var m=r.ref;if("ref"in l){var b={};for(var x in l)x!=="ref"&&(b[x]=l[x])}else b=l;return Ls(r),l=td(i,r,o,b,m,f),x=nd(),i!==null&&!Et?(id(i,r,f),gi(i,r,f)):($e&&x&&jf(r),r.flags|=1,Dt(i,r,l,f),r.child)}function Pb(i,r,o,l,f){if(i===null){var m=o.type;return typeof m=="function"&&!Bf(m)&&m.defaultProps===void 0&&o.compare===null?(r.tag=15,r.type=m,Ib(i,r,m,l,f)):(i=Vl(o.type,null,l,r,r.mode,f),i.ref=r.ref,i.return=r,r.child=i)}if(m=i.child,!Rd(i,f)){var b=m.memoizedProps;if(o=o.compare,o=o!==null?o:Pa,o(b,l)&&i.ref===r.ref)return gi(i,r,f)}return r.flags|=1,i=ci(m,l),i.ref=r.ref,i.return=r,r.child=i}function Ib(i,r,o,l,f){if(i!==null){var m=i.memoizedProps;if(Pa(m,l)&&i.ref===r.ref)if(Et=!1,r.pendingProps=l=m,Rd(i,f))(i.flags&131072)!==0&&(Et=!0);else return r.lanes=i.lanes,gi(i,r,f)}return vd(i,r,o,l,f)}function Hb(i,r,o){var l=r.pendingProps,f=l.children,m=i!==null?i.memoizedState:null;if(l.mode==="hidden"){if((r.flags&128)!==0){if(l=m!==null?m.baseLanes|o:o,i!==null){for(f=r.child=i.child,m=0;f!==null;)m=m|f.lanes|f.childLanes,f=f.sibling;r.childLanes=m&~l}else r.childLanes=0,r.child=null;return Gb(i,r,l,o)}if((o&536870912)!==0)r.memoizedState={baseLanes:0,cachePool:null},i!==null&&Kl(r,m!==null?m.cachePool:null),m!==null?Ig(r,m):Qf(),Nb(r);else return r.lanes=r.childLanes=536870912,Gb(i,r,m!==null?m.baseLanes|o:o,o)}else m!==null?(Kl(r,m.cachePool),Ig(r,m),Zi(),r.memoizedState=null):(i!==null&&Kl(r,null),Qf(),Zi());return Dt(i,r,f,o),r.child}function Gb(i,r,o,l){var f=Gf();return f=f===null?null:{parent:vt._currentValue,pool:f},r.memoizedState={baseLanes:o,cachePool:f},i!==null&&Kl(r,null),Qf(),Nb(r),i!==null&&Ya(i,r,l,!0),null}function ru(i,r){var o=r.ref;if(o===null)i!==null&&i.ref!==null&&(r.flags|=4194816);else{if(typeof o!="function"&&typeof o!="object")throw Error(s(284));(i===null||i.ref!==o)&&(r.flags|=4194816)}}function vd(i,r,o,l,f){return Ls(r),o=td(i,r,o,l,void 0,f),l=nd(),i!==null&&!Et?(id(i,r,f),gi(i,r,f)):($e&&l&&jf(r),r.flags|=1,Dt(i,r,o,f),r.child)}function Fb(i,r,o,l,f,m){return Ls(r),r.updateQueue=null,o=Gg(r,l,o,f),Hg(i),l=nd(),i!==null&&!Et?(id(i,r,m),gi(i,r,m)):($e&&l&&jf(r),r.flags|=1,Dt(i,r,o,m),r.child)}function Yb(i,r,o,l,f){if(Ls(r),r.stateNode===null){var m=Er,b=o.contextType;typeof b=="object"&&b!==null&&(m=jt(b)),m=new o(l,m),r.memoizedState=m.state!==null&&m.state!==void 0?m.state:null,m.updater=gd,r.stateNode=m,m._reactInternals=r,m=r.stateNode,m.props=l,m.state=r.memoizedState,m.refs={},Yf(r),b=o.contextType,m.context=typeof b=="object"&&b!==null?jt(b):Er,m.state=r.memoizedState,b=o.getDerivedStateFromProps,typeof b=="function"&&(yd(r,o,b,l),m.state=r.memoizedState),typeof o.getDerivedStateFromProps=="function"||typeof m.getSnapshotBeforeUpdate=="function"||typeof m.UNSAFE_componentWillMount!="function"&&typeof m.componentWillMount!="function"||(b=m.state,typeof m.componentWillMount=="function"&&m.componentWillMount(),typeof m.UNSAFE_componentWillMount=="function"&&m.UNSAFE_componentWillMount(),b!==m.state&&gd.enqueueReplaceState(m,m.state,null),to(r,l,m,f),eo(),m.state=r.memoizedState),typeof m.componentDidMount=="function"&&(r.flags|=4194308),l=!0}else if(i===null){m=r.stateNode;var x=r.memoizedProps,E=zs(o,x);m.props=E;var _=m.context,q=o.contextType;b=Er,typeof q=="object"&&q!==null&&(b=jt(q));var H=o.getDerivedStateFromProps;q=typeof H=="function"||typeof m.getSnapshotBeforeUpdate=="function",x=r.pendingProps!==x,q||typeof m.UNSAFE_componentWillReceiveProps!="function"&&typeof m.componentWillReceiveProps!="function"||(x||_!==b)&&$b(r,m,l,b),Hi=!1;var B=r.memoizedState;m.state=B,to(r,l,m,f),eo(),_=r.memoizedState,x||B!==_||Hi?(typeof H=="function"&&(yd(r,o,H,l),_=r.memoizedState),(E=Hi||_b(r,o,E,l,B,_,b))?(q||typeof m.UNSAFE_componentWillMount!="function"&&typeof m.componentWillMount!="function"||(typeof m.componentWillMount=="function"&&m.componentWillMount(),typeof m.UNSAFE_componentWillMount=="function"&&m.UNSAFE_componentWillMount()),typeof m.componentDidMount=="function"&&(r.flags|=4194308)):(typeof m.componentDidMount=="function"&&(r.flags|=4194308),r.memoizedProps=l,r.memoizedState=_),m.props=l,m.state=_,m.context=b,l=E):(typeof m.componentDidMount=="function"&&(r.flags|=4194308),l=!1)}else{m=r.stateNode,Xf(i,r),b=r.memoizedProps,q=zs(o,b),m.props=q,H=r.pendingProps,B=m.context,_=o.contextType,E=Er,typeof _=="object"&&_!==null&&(E=jt(_)),x=o.getDerivedStateFromProps,(_=typeof x=="function"||typeof m.getSnapshotBeforeUpdate=="function")||typeof m.UNSAFE_componentWillReceiveProps!="function"&&typeof m.componentWillReceiveProps!="function"||(b!==H||B!==E)&&$b(r,m,l,E),Hi=!1,B=r.memoizedState,m.state=B,to(r,l,m,f),eo();var V=r.memoizedState;b!==H||B!==V||Hi||i!==null&&i.dependencies!==null&&Ul(i.dependencies)?(typeof x=="function"&&(yd(r,o,x,l),V=r.memoizedState),(q=Hi||_b(r,o,q,l,B,V,E)||i!==null&&i.dependencies!==null&&Ul(i.dependencies))?(_||typeof m.UNSAFE_componentWillUpdate!="function"&&typeof m.componentWillUpdate!="function"||(typeof m.componentWillUpdate=="function"&&m.componentWillUpdate(l,V,E),typeof m.UNSAFE_componentWillUpdate=="function"&&m.UNSAFE_componentWillUpdate(l,V,E)),typeof m.componentDidUpdate=="function"&&(r.flags|=4),typeof m.getSnapshotBeforeUpdate=="function"&&(r.flags|=1024)):(typeof m.componentDidUpdate!="function"||b===i.memoizedProps&&B===i.memoizedState||(r.flags|=4),typeof m.getSnapshotBeforeUpdate!="function"||b===i.memoizedProps&&B===i.memoizedState||(r.flags|=1024),r.memoizedProps=l,r.memoizedState=V),m.props=l,m.state=V,m.context=E,l=q):(typeof m.componentDidUpdate!="function"||b===i.memoizedProps&&B===i.memoizedState||(r.flags|=4),typeof m.getSnapshotBeforeUpdate!="function"||b===i.memoizedProps&&B===i.memoizedState||(r.flags|=1024),l=!1)}return m=l,ru(i,r),l=(r.flags&128)!==0,m||l?(m=r.stateNode,o=l&&typeof o.getDerivedStateFromError!="function"?null:m.render(),r.flags|=1,i!==null&&l?(r.child=Br(r,i.child,null,f),r.child=Br(r,null,o,f)):Dt(i,r,o,f),r.memoizedState=m.state,i=r.child):i=gi(i,r,f),i}function Xb(i,r,o,l){return Ga(),r.flags|=256,Dt(i,r,o,l),r.child}var Sd={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function xd(i){return{baseLanes:i,cachePool:Lg()}}function wd(i,r,o){return i=i!==null?i.childLanes&~o:0,r&&(i|=On),i}function Zb(i,r,o){var l=r.pendingProps,f=!1,m=(r.flags&128)!==0,b;if((b=m)||(b=i!==null&&i.memoizedState===null?!1:(St.current&2)!==0),b&&(f=!0,r.flags&=-129),b=(r.flags&32)!==0,r.flags&=-33,i===null){if($e){if(f?Xi(r):Zi(),$e){var x=st,E;if(E=x){e:{for(E=x,x=Hn;E.nodeType!==8;){if(!x){x=null;break e}if(E=Vn(E.nextSibling),E===null){x=null;break e}}x=E}x!==null?(r.memoizedState={dehydrated:x,treeContext:Ds!==null?{id:fi,overflow:di}:null,retryLane:536870912,hydrationErrors:null},E=cn(18,null,null,0),E.stateNode=x,E.return=r,r.child=E,Ht=r,st=null,E=!0):E=!1}E||$s(r)}if(x=r.memoizedState,x!==null&&(x=x.dehydrated,x!==null))return rh(x)?r.lanes=32:r.lanes=536870912,null;yi(r)}return x=l.children,l=l.fallback,f?(Zi(),f=r.mode,x=au({mode:"hidden",children:x},f),l=ks(l,f,o,null),x.return=r,l.return=r,x.sibling=l,r.child=x,f=r.child,f.memoizedState=xd(o),f.childLanes=wd(i,b,o),r.memoizedState=Sd,l):(Xi(r),Ad(r,x))}if(E=i.memoizedState,E!==null&&(x=E.dehydrated,x!==null)){if(m)r.flags&256?(Xi(r),r.flags&=-257,r=Td(i,r,o)):r.memoizedState!==null?(Zi(),r.child=i.child,r.flags|=128,r=null):(Zi(),f=l.fallback,x=r.mode,l=au({mode:"visible",children:l.children},x),f=ks(f,x,o,null),f.flags|=2,l.return=r,f.return=r,l.sibling=f,r.child=l,Br(r,i.child,null,o),l=r.child,l.memoizedState=xd(o),l.childLanes=wd(i,b,o),r.memoizedState=Sd,r=f);else if(Xi(r),rh(x)){if(b=x.nextSibling&&x.nextSibling.dataset,b)var _=b.dgst;b=_,l=Error(s(419)),l.stack="",l.digest=b,Fa({value:l,source:null,stack:null}),r=Td(i,r,o)}else if(Et||Ya(i,r,o,!1),b=(o&i.childLanes)!==0,Et||b){if(b=Fe,b!==null&&(l=o&-o,l=(l&42)!==0?1:af(l),l=(l&(b.suspendedLanes|o))!==0?0:l,l!==0&&l!==E.retryLane))throw E.retryLane=l,Tr(i,l),mn(b,i,l),qb;x.data==="$?"||Kd(),r=Td(i,r,o)}else x.data==="$?"?(r.flags|=192,r.child=i.child,r=null):(i=E.treeContext,st=Vn(x.nextSibling),Ht=r,$e=!0,_s=null,Hn=!1,i!==null&&(Tn[En++]=fi,Tn[En++]=di,Tn[En++]=Ds,fi=i.id,di=i.overflow,Ds=r),r=Ad(r,l.children),r.flags|=4096);return r}return f?(Zi(),f=l.fallback,x=r.mode,E=i.child,_=E.sibling,l=ci(E,{mode:"hidden",children:l.children}),l.subtreeFlags=E.subtreeFlags&65011712,_!==null?f=ci(_,f):(f=ks(f,x,o,null),f.flags|=2),f.return=r,l.return=r,l.sibling=f,r.child=l,l=f,f=r.child,x=i.child.memoizedState,x===null?x=xd(o):(E=x.cachePool,E!==null?(_=vt._currentValue,E=E.parent!==_?{parent:_,pool:_}:E):E=Lg(),x={baseLanes:x.baseLanes|o,cachePool:E}),f.memoizedState=x,f.childLanes=wd(i,b,o),r.memoizedState=Sd,l):(Xi(r),o=i.child,i=o.sibling,o=ci(o,{mode:"visible",children:l.children}),o.return=r,o.sibling=null,i!==null&&(b=r.deletions,b===null?(r.deletions=[i],r.flags|=16):b.push(i)),r.child=o,r.memoizedState=null,o)}function Ad(i,r){return r=au({mode:"visible",children:r},i.mode),r.return=i,i.child=r}function au(i,r){return i=cn(22,i,null,r),i.lanes=0,i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null},i}function Td(i,r,o){return Br(r,i.child,null,o),i=Ad(r,r.pendingProps.children),i.flags|=2,r.memoizedState=null,i}function Jb(i,r,o){i.lanes|=r;var l=i.alternate;l!==null&&(l.lanes|=r),Kf(i.return,r,o)}function Ed(i,r,o,l,f){var m=i.memoizedState;m===null?i.memoizedState={isBackwards:r,rendering:null,renderingStartTime:0,last:l,tail:o,tailMode:f}:(m.isBackwards=r,m.rendering=null,m.renderingStartTime=0,m.last=l,m.tail=o,m.tailMode=f)}function Qb(i,r,o){var l=r.pendingProps,f=l.revealOrder,m=l.tail;if(Dt(i,r,l.children,o),l=St.current,(l&2)!==0)l=l&1|2,r.flags|=128;else{if(i!==null&&(i.flags&128)!==0)e:for(i=r.child;i!==null;){if(i.tag===13)i.memoizedState!==null&&Jb(i,o,r);else if(i.tag===19)Jb(i,o,r);else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===r)break e;for(;i.sibling===null;){if(i.return===null||i.return===r)break e;i=i.return}i.sibling.return=i.return,i=i.sibling}l&=1}switch(Q(St,l),f){case"forwards":for(o=r.child,f=null;o!==null;)i=o.alternate,i!==null&&nu(i)===null&&(f=o),o=o.sibling;o=f,o===null?(f=r.child,r.child=null):(f=o.sibling,o.sibling=null),Ed(r,!1,f,o,m);break;case"backwards":for(o=null,f=r.child,r.child=null;f!==null;){if(i=f.alternate,i!==null&&nu(i)===null){r.child=f;break}i=f.sibling,f.sibling=o,o=f,f=i}Ed(r,!0,o,null,m);break;case"together":Ed(r,!1,null,null,void 0);break;default:r.memoizedState=null}return r.child}function gi(i,r,o){if(i!==null&&(r.dependencies=i.dependencies),ts|=r.lanes,(o&r.childLanes)===0)if(i!==null){if(Ya(i,r,o,!1),(o&r.childLanes)===0)return null}else return null;if(i!==null&&r.child!==i.child)throw Error(s(153));if(r.child!==null){for(i=r.child,o=ci(i,i.pendingProps),r.child=o,o.return=r;i.sibling!==null;)i=i.sibling,o=o.sibling=ci(i,i.pendingProps),o.return=r;o.sibling=null}return r.child}function Rd(i,r){return(i.lanes&r)!==0?!0:(i=i.dependencies,!!(i!==null&&Ul(i)))}function WO(i,r,o){switch(r.tag){case 3:Ne(r,r.stateNode.containerInfo),Ii(r,vt,i.memoizedState.cache),Ga();break;case 27:case 5:Ui(r);break;case 4:Ne(r,r.stateNode.containerInfo);break;case 10:Ii(r,r.type,r.memoizedProps.value);break;case 13:var l=r.memoizedState;if(l!==null)return l.dehydrated!==null?(Xi(r),r.flags|=128,null):(o&r.child.childLanes)!==0?Zb(i,r,o):(Xi(r),i=gi(i,r,o),i!==null?i.sibling:null);Xi(r);break;case 19:var f=(i.flags&128)!==0;if(l=(o&r.childLanes)!==0,l||(Ya(i,r,o,!1),l=(o&r.childLanes)!==0),f){if(l)return Qb(i,r,o);r.flags|=128}if(f=r.memoizedState,f!==null&&(f.rendering=null,f.tail=null,f.lastEffect=null),Q(St,St.current),l)break;return null;case 22:case 23:return r.lanes=0,Hb(i,r,o);case 24:Ii(r,vt,i.memoizedState.cache)}return gi(i,r,o)}function Wb(i,r,o){if(i!==null)if(i.memoizedProps!==r.pendingProps)Et=!0;else{if(!Rd(i,o)&&(r.flags&128)===0)return Et=!1,WO(i,r,o);Et=(i.flags&131072)!==0}else Et=!1,$e&&(r.flags&1048576)!==0&&Cg(r,zl,r.index);switch(r.lanes=0,r.tag){case 16:e:{i=r.pendingProps;var l=r.elementType,f=l._init;if(l=f(l._payload),r.type=l,typeof l=="function")Bf(l)?(i=zs(l,i),r.tag=1,r=Yb(null,r,l,i,o)):(r.tag=0,r=vd(null,r,l,i,o));else{if(l!=null){if(f=l.$$typeof,f===Y){r.tag=11,r=Kb(null,r,l,i,o);break e}else if(f===ie){r.tag=14,r=Pb(null,r,l,i,o);break e}}throw r=ke(l)||l,Error(s(306,r,""))}}return r;case 0:return vd(i,r,r.type,r.pendingProps,o);case 1:return l=r.type,f=zs(l,r.pendingProps),Yb(i,r,l,f,o);case 3:e:{if(Ne(r,r.stateNode.containerInfo),i===null)throw Error(s(387));l=r.pendingProps;var m=r.memoizedState;f=m.element,Xf(i,r),to(r,l,null,o);var b=r.memoizedState;if(l=b.cache,Ii(r,vt,l),l!==m.cache&&Pf(r,[vt],o,!0),eo(),l=b.element,m.isDehydrated)if(m={element:l,isDehydrated:!1,cache:b.cache},r.updateQueue.baseState=m,r.memoizedState=m,r.flags&256){r=Xb(i,r,l,o);break e}else if(l!==f){f=wn(Error(s(424)),r),Fa(f),r=Xb(i,r,l,o);break e}else{switch(i=r.stateNode.containerInfo,i.nodeType){case 9:i=i.body;break;default:i=i.nodeName==="HTML"?i.ownerDocument.body:i}for(st=Vn(i.firstChild),Ht=r,$e=!0,_s=null,Hn=!0,o=Db(r,null,l,o),r.child=o;o;)o.flags=o.flags&-3|4096,o=o.sibling}else{if(Ga(),l===f){r=gi(i,r,o);break e}Dt(i,r,l,o)}r=r.child}return r;case 26:return ru(i,r),i===null?(o=i0(r.type,null,r.pendingProps,null))?r.memoizedState=o:$e||(o=r.type,i=r.pendingProps,l=Su(re.current).createElement(o),l[Vt]=r,l[Zt]=i,_t(l,o,i),Tt(l),r.stateNode=l):r.memoizedState=i0(r.type,i.memoizedProps,r.pendingProps,i.memoizedState),null;case 27:return Ui(r),i===null&&$e&&(l=r.stateNode=e0(r.type,r.pendingProps,re.current),Ht=r,Hn=!0,f=st,rs(r.type)?(ah=f,st=Vn(l.firstChild)):st=f),Dt(i,r,r.pendingProps.children,o),ru(i,r),i===null&&(r.flags|=4194304),r.child;case 5:return i===null&&$e&&((f=l=st)&&(l=OM(l,r.type,r.pendingProps,Hn),l!==null?(r.stateNode=l,Ht=r,st=Vn(l.firstChild),Hn=!1,f=!0):f=!1),f||$s(r)),Ui(r),f=r.type,m=r.pendingProps,b=i!==null?i.memoizedProps:null,l=m.children,nh(f,m)?l=null:b!==null&&nh(f,b)&&(r.flags|=32),r.memoizedState!==null&&(f=td(i,r,HO,null,null,o),To._currentValue=f),ru(i,r),Dt(i,r,l,o),r.child;case 6:return i===null&&$e&&((i=o=st)&&(o=MM(o,r.pendingProps,Hn),o!==null?(r.stateNode=o,Ht=r,st=null,i=!0):i=!1),i||$s(r)),null;case 13:return Zb(i,r,o);case 4:return Ne(r,r.stateNode.containerInfo),l=r.pendingProps,i===null?r.child=Br(r,null,l,o):Dt(i,r,l,o),r.child;case 11:return Kb(i,r,r.type,r.pendingProps,o);case 7:return Dt(i,r,r.pendingProps,o),r.child;case 8:return Dt(i,r,r.pendingProps.children,o),r.child;case 12:return Dt(i,r,r.pendingProps.children,o),r.child;case 10:return l=r.pendingProps,Ii(r,r.type,l.value),Dt(i,r,l.children,o),r.child;case 9:return f=r.type._context,l=r.pendingProps.children,Ls(r),f=jt(f),l=l(f),r.flags|=1,Dt(i,r,l,o),r.child;case 14:return Pb(i,r,r.type,r.pendingProps,o);case 15:return Ib(i,r,r.type,r.pendingProps,o);case 19:return Qb(i,r,o);case 31:return l=r.pendingProps,o=r.mode,l={mode:l.mode,children:l.children},i===null?(o=au(l,o),o.ref=r.ref,r.child=o,o.return=r,r=o):(o=ci(i.child,l),o.ref=r.ref,r.child=o,o.return=r,r=o),r;case 22:return Hb(i,r,o);case 24:return Ls(r),l=jt(vt),i===null?(f=Gf(),f===null&&(f=Fe,m=If(),f.pooledCache=m,m.refCount++,m!==null&&(f.pooledCacheLanes|=o),f=m),r.memoizedState={parent:l,cache:f},Yf(r),Ii(r,vt,f)):((i.lanes&o)!==0&&(Xf(i,r),to(r,null,null,o),eo()),f=i.memoizedState,m=r.memoizedState,f.parent!==l?(f={parent:l,cache:l},r.memoizedState=f,r.lanes===0&&(r.memoizedState=r.updateQueue.baseState=f),Ii(r,vt,l)):(l=m.cache,Ii(r,vt,l),l!==f.cache&&Pf(r,[vt],o,!0))),Dt(i,r,r.pendingProps.children,o),r.child;case 29:throw r.pendingProps}throw Error(s(156,r.tag))}function bi(i){i.flags|=4}function ev(i,r){if(r.type!=="stylesheet"||(r.state.loading&4)!==0)i.flags&=-16777217;else if(i.flags|=16777216,!l0(r)){if(r=Rn.current,r!==null&&((Ce&4194048)===Ce?Gn!==null:(Ce&62914560)!==Ce&&(Ce&536870912)===0||r!==Gn))throw Qa=Ff,Vg;i.flags|=8192}}function ou(i,r){r!==null&&(i.flags|=4),i.flags&16384&&(r=i.tag!==22?Ny():536870912,i.lanes|=r,zr|=r)}function lo(i,r){if(!$e)switch(i.tailMode){case"hidden":r=i.tail;for(var o=null;r!==null;)r.alternate!==null&&(o=r),r=r.sibling;o===null?i.tail=null:o.sibling=null;break;case"collapsed":o=i.tail;for(var l=null;o!==null;)o.alternate!==null&&(l=o),o=o.sibling;l===null?r||i.tail===null?i.tail=null:i.tail.sibling=null:l.sibling=null}}function tt(i){var r=i.alternate!==null&&i.alternate.child===i.child,o=0,l=0;if(r)for(var f=i.child;f!==null;)o|=f.lanes|f.childLanes,l|=f.subtreeFlags&65011712,l|=f.flags&65011712,f.return=i,f=f.sibling;else for(f=i.child;f!==null;)o|=f.lanes|f.childLanes,l|=f.subtreeFlags,l|=f.flags,f.return=i,f=f.sibling;return i.subtreeFlags|=l,i.childLanes=o,r}function eM(i,r,o){var l=r.pendingProps;switch(zf(r),r.tag){case 31:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return tt(r),null;case 1:return tt(r),null;case 3:return o=r.stateNode,l=null,i!==null&&(l=i.memoizedState.cache),r.memoizedState.cache!==l&&(r.flags|=2048),pi(vt),rn(),o.pendingContext&&(o.context=o.pendingContext,o.pendingContext=null),(i===null||i.child===null)&&(Ha(r)?bi(r):i===null||i.memoizedState.isDehydrated&&(r.flags&256)===0||(r.flags|=1024,Ng())),tt(r),null;case 26:return o=r.memoizedState,i===null?(bi(r),o!==null?(tt(r),ev(r,o)):(tt(r),r.flags&=-16777217)):o?o!==i.memoizedState?(bi(r),tt(r),ev(r,o)):(tt(r),r.flags&=-16777217):(i.memoizedProps!==l&&bi(r),tt(r),r.flags&=-16777217),null;case 27:ge(r),o=re.current;var f=r.type;if(i!==null&&r.stateNode!=null)i.memoizedProps!==l&&bi(r);else{if(!l){if(r.stateNode===null)throw Error(s(166));return tt(r),null}i=ae.current,Ha(r)?kg(r):(i=e0(f,l,o),r.stateNode=i,bi(r))}return tt(r),null;case 5:if(ge(r),o=r.type,i!==null&&r.stateNode!=null)i.memoizedProps!==l&&bi(r);else{if(!l){if(r.stateNode===null)throw Error(s(166));return tt(r),null}if(i=ae.current,Ha(r))kg(r);else{switch(f=Su(re.current),i){case 1:i=f.createElementNS("http://www.w3.org/2000/svg",o);break;case 2:i=f.createElementNS("http://www.w3.org/1998/Math/MathML",o);break;default:switch(o){case"svg":i=f.createElementNS("http://www.w3.org/2000/svg",o);break;case"math":i=f.createElementNS("http://www.w3.org/1998/Math/MathML",o);break;case"script":i=f.createElement("div"),i.innerHTML="<script><\/script>",i=i.removeChild(i.firstChild);break;case"select":i=typeof l.is=="string"?f.createElement("select",{is:l.is}):f.createElement("select"),l.multiple?i.multiple=!0:l.size&&(i.size=l.size);break;default:i=typeof l.is=="string"?f.createElement(o,{is:l.is}):f.createElement(o)}}i[Vt]=r,i[Zt]=l;e:for(f=r.child;f!==null;){if(f.tag===5||f.tag===6)i.appendChild(f.stateNode);else if(f.tag!==4&&f.tag!==27&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===r)break e;for(;f.sibling===null;){if(f.return===null||f.return===r)break e;f=f.return}f.sibling.return=f.return,f=f.sibling}r.stateNode=i;e:switch(_t(i,o,l),o){case"button":case"input":case"select":case"textarea":i=!!l.autoFocus;break e;case"img":i=!0;break e;default:i=!1}i&&bi(r)}}return tt(r),r.flags&=-16777217,null;case 6:if(i&&r.stateNode!=null)i.memoizedProps!==l&&bi(r);else{if(typeof l!="string"&&r.stateNode===null)throw Error(s(166));if(i=re.current,Ha(r)){if(i=r.stateNode,o=r.memoizedProps,l=null,f=Ht,f!==null)switch(f.tag){case 27:case 5:l=f.memoizedProps}i[Vt]=r,i=!!(i.nodeValue===o||l!==null&&l.suppressHydrationWarning===!0||Fv(i.nodeValue,o)),i||$s(r)}else i=Su(i).createTextNode(l),i[Vt]=r,r.stateNode=i}return tt(r),null;case 13:if(l=r.memoizedState,i===null||i.memoizedState!==null&&i.memoizedState.dehydrated!==null){if(f=Ha(r),l!==null&&l.dehydrated!==null){if(i===null){if(!f)throw Error(s(318));if(f=r.memoizedState,f=f!==null?f.dehydrated:null,!f)throw Error(s(317));f[Vt]=r}else Ga(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;tt(r),f=!1}else f=Ng(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=f),f=!0;if(!f)return r.flags&256?(yi(r),r):(yi(r),null)}if(yi(r),(r.flags&128)!==0)return r.lanes=o,r;if(o=l!==null,i=i!==null&&i.memoizedState!==null,o){l=r.child,f=null,l.alternate!==null&&l.alternate.memoizedState!==null&&l.alternate.memoizedState.cachePool!==null&&(f=l.alternate.memoizedState.cachePool.pool);var m=null;l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(m=l.memoizedState.cachePool.pool),m!==f&&(l.flags|=2048)}return o!==i&&o&&(r.child.flags|=8192),ou(r,r.updateQueue),tt(r),null;case 4:return rn(),i===null&&Jd(r.stateNode.containerInfo),tt(r),null;case 10:return pi(r.type),tt(r),null;case 19:if(F(St),f=r.memoizedState,f===null)return tt(r),null;if(l=(r.flags&128)!==0,m=f.rendering,m===null)if(l)lo(f,!1);else{if(rt!==0||i!==null&&(i.flags&128)!==0)for(i=r.child;i!==null;){if(m=nu(i),m!==null){for(r.flags|=128,lo(f,!1),i=m.updateQueue,r.updateQueue=i,ou(r,i),r.subtreeFlags=0,i=o,o=r.child;o!==null;)Mg(o,i),o=o.sibling;return Q(St,St.current&1|2),r.child}i=i.sibling}f.tail!==null&&Ke()>cu&&(r.flags|=128,l=!0,lo(f,!1),r.lanes=4194304)}else{if(!l)if(i=nu(m),i!==null){if(r.flags|=128,l=!0,i=i.updateQueue,r.updateQueue=i,ou(r,i),lo(f,!0),f.tail===null&&f.tailMode==="hidden"&&!m.alternate&&!$e)return tt(r),null}else 2*Ke()-f.renderingStartTime>cu&&o!==536870912&&(r.flags|=128,l=!0,lo(f,!1),r.lanes=4194304);f.isBackwards?(m.sibling=r.child,r.child=m):(i=f.last,i!==null?i.sibling=m:r.child=m,f.last=m)}return f.tail!==null?(r=f.tail,f.rendering=r,f.tail=r.sibling,f.renderingStartTime=Ke(),r.sibling=null,i=St.current,Q(St,l?i&1|2:i&1),r):(tt(r),null);case 22:case 23:return yi(r),Wf(),l=r.memoizedState!==null,i!==null?i.memoizedState!==null!==l&&(r.flags|=8192):l&&(r.flags|=8192),l?(o&536870912)!==0&&(r.flags&128)===0&&(tt(r),r.subtreeFlags&6&&(r.flags|=8192)):tt(r),o=r.updateQueue,o!==null&&ou(r,o.retryQueue),o=null,i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(o=i.memoizedState.cachePool.pool),l=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(l=r.memoizedState.cachePool.pool),l!==o&&(r.flags|=2048),i!==null&&F(Vs),null;case 24:return o=null,i!==null&&(o=i.memoizedState.cache),r.memoizedState.cache!==o&&(r.flags|=2048),pi(vt),tt(r),null;case 25:return null;case 30:return null}throw Error(s(156,r.tag))}function tM(i,r){switch(zf(r),r.tag){case 1:return i=r.flags,i&65536?(r.flags=i&-65537|128,r):null;case 3:return pi(vt),rn(),i=r.flags,(i&65536)!==0&&(i&128)===0?(r.flags=i&-65537|128,r):null;case 26:case 27:case 5:return ge(r),null;case 13:if(yi(r),i=r.memoizedState,i!==null&&i.dehydrated!==null){if(r.alternate===null)throw Error(s(340));Ga()}return i=r.flags,i&65536?(r.flags=i&-65537|128,r):null;case 19:return F(St),null;case 4:return rn(),null;case 10:return pi(r.type),null;case 22:case 23:return yi(r),Wf(),i!==null&&F(Vs),i=r.flags,i&65536?(r.flags=i&-65537|128,r):null;case 24:return pi(vt),null;case 25:return null;default:return null}}function tv(i,r){switch(zf(r),r.tag){case 3:pi(vt),rn();break;case 26:case 27:case 5:ge(r);break;case 4:rn();break;case 13:yi(r);break;case 19:F(St);break;case 10:pi(r.type);break;case 22:case 23:yi(r),Wf(),i!==null&&F(Vs);break;case 24:pi(vt)}}function uo(i,r){try{var o=r.updateQueue,l=o!==null?o.lastEffect:null;if(l!==null){var f=l.next;o=f;do{if((o.tag&i)===i){l=void 0;var m=o.create,b=o.inst;l=m(),b.destroy=l}o=o.next}while(o!==f)}}catch(x){Pe(r,r.return,x)}}function Ji(i,r,o){try{var l=r.updateQueue,f=l!==null?l.lastEffect:null;if(f!==null){var m=f.next;l=m;do{if((l.tag&i)===i){var b=l.inst,x=b.destroy;if(x!==void 0){b.destroy=void 0,f=r;var E=o,_=x;try{_()}catch(q){Pe(f,E,q)}}}l=l.next}while(l!==m)}}catch(q){Pe(r,r.return,q)}}function nv(i){var r=i.updateQueue;if(r!==null){var o=i.stateNode;try{Pg(r,o)}catch(l){Pe(i,i.return,l)}}}function iv(i,r,o){o.props=zs(i.type,i.memoizedProps),o.state=i.memoizedState;try{o.componentWillUnmount()}catch(l){Pe(i,r,l)}}function co(i,r){try{var o=i.ref;if(o!==null){switch(i.tag){case 26:case 27:case 5:var l=i.stateNode;break;case 30:l=i.stateNode;break;default:l=i.stateNode}typeof o=="function"?i.refCleanup=o(l):o.current=l}}catch(f){Pe(i,r,f)}}function Fn(i,r){var o=i.ref,l=i.refCleanup;if(o!==null)if(typeof l=="function")try{l()}catch(f){Pe(i,r,f)}finally{i.refCleanup=null,i=i.alternate,i!=null&&(i.refCleanup=null)}else if(typeof o=="function")try{o(null)}catch(f){Pe(i,r,f)}else o.current=null}function sv(i){var r=i.type,o=i.memoizedProps,l=i.stateNode;try{e:switch(r){case"button":case"input":case"select":case"textarea":o.autoFocus&&l.focus();break e;case"img":o.src?l.src=o.src:o.srcSet&&(l.srcset=o.srcSet)}}catch(f){Pe(i,i.return,f)}}function Od(i,r,o){try{var l=i.stateNode;wM(l,i.type,o,r),l[Zt]=r}catch(f){Pe(i,i.return,f)}}function rv(i){return i.tag===5||i.tag===3||i.tag===26||i.tag===27&&rs(i.type)||i.tag===4}function Md(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||rv(i.return))return null;i=i.return}for(i.sibling.return=i.return,i=i.sibling;i.tag!==5&&i.tag!==6&&i.tag!==18;){if(i.tag===27&&rs(i.type)||i.flags&2||i.child===null||i.tag===4)continue e;i.child.return=i,i=i.child}if(!(i.flags&2))return i.stateNode}}function Cd(i,r,o){var l=i.tag;if(l===5||l===6)i=i.stateNode,r?(o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o).insertBefore(i,r):(r=o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o,r.appendChild(i),o=o._reactRootContainer,o!=null||r.onclick!==null||(r.onclick=vu));else if(l!==4&&(l===27&&rs(i.type)&&(o=i.stateNode,r=null),i=i.child,i!==null))for(Cd(i,r,o),i=i.sibling;i!==null;)Cd(i,r,o),i=i.sibling}function lu(i,r,o){var l=i.tag;if(l===5||l===6)i=i.stateNode,r?o.insertBefore(i,r):o.appendChild(i);else if(l!==4&&(l===27&&rs(i.type)&&(o=i.stateNode),i=i.child,i!==null))for(lu(i,r,o),i=i.sibling;i!==null;)lu(i,r,o),i=i.sibling}function av(i){var r=i.stateNode,o=i.memoizedProps;try{for(var l=i.type,f=r.attributes;f.length;)r.removeAttributeNode(f[0]);_t(r,l,o),r[Vt]=i,r[Zt]=o}catch(m){Pe(i,i.return,m)}}var vi=!1,ut=!1,kd=!1,ov=typeof WeakSet=="function"?WeakSet:Set,Rt=null;function nM(i,r){if(i=i.containerInfo,eh=Ru,i=bg(i),Mf(i)){if("selectionStart"in i)var o={start:i.selectionStart,end:i.selectionEnd};else e:{o=(o=i.ownerDocument)&&o.defaultView||window;var l=o.getSelection&&o.getSelection();if(l&&l.rangeCount!==0){o=l.anchorNode;var f=l.anchorOffset,m=l.focusNode;l=l.focusOffset;try{o.nodeType,m.nodeType}catch{o=null;break e}var b=0,x=-1,E=-1,_=0,q=0,H=i,B=null;t:for(;;){for(var V;H!==o||f!==0&&H.nodeType!==3||(x=b+f),H!==m||l!==0&&H.nodeType!==3||(E=b+l),H.nodeType===3&&(b+=H.nodeValue.length),(V=H.firstChild)!==null;)B=H,H=V;for(;;){if(H===i)break t;if(B===o&&++_===f&&(x=b),B===m&&++q===l&&(E=b),(V=H.nextSibling)!==null)break;H=B,B=H.parentNode}H=V}o=x===-1||E===-1?null:{start:x,end:E}}else o=null}o=o||{start:0,end:0}}else o=null;for(th={focusedElem:i,selectionRange:o},Ru=!1,Rt=r;Rt!==null;)if(r=Rt,i=r.child,(r.subtreeFlags&1024)!==0&&i!==null)i.return=r,Rt=i;else for(;Rt!==null;){switch(r=Rt,m=r.alternate,i=r.flags,r.tag){case 0:break;case 11:case 15:break;case 1:if((i&1024)!==0&&m!==null){i=void 0,o=r,f=m.memoizedProps,m=m.memoizedState,l=o.stateNode;try{var de=zs(o.type,f,o.elementType===o.type);i=l.getSnapshotBeforeUpdate(de,m),l.__reactInternalSnapshotBeforeUpdate=i}catch(ue){Pe(o,o.return,ue)}}break;case 3:if((i&1024)!==0){if(i=r.stateNode.containerInfo,o=i.nodeType,o===9)sh(i);else if(o===1)switch(i.nodeName){case"HEAD":case"HTML":case"BODY":sh(i);break;default:i.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((i&1024)!==0)throw Error(s(163))}if(i=r.sibling,i!==null){i.return=r.return,Rt=i;break}Rt=r.return}}function lv(i,r,o){var l=o.flags;switch(o.tag){case 0:case 11:case 15:Qi(i,o),l&4&&uo(5,o);break;case 1:if(Qi(i,o),l&4)if(i=o.stateNode,r===null)try{i.componentDidMount()}catch(b){Pe(o,o.return,b)}else{var f=zs(o.type,r.memoizedProps);r=r.memoizedState;try{i.componentDidUpdate(f,r,i.__reactInternalSnapshotBeforeUpdate)}catch(b){Pe(o,o.return,b)}}l&64&&nv(o),l&512&&co(o,o.return);break;case 3:if(Qi(i,o),l&64&&(i=o.updateQueue,i!==null)){if(r=null,o.child!==null)switch(o.child.tag){case 27:case 5:r=o.child.stateNode;break;case 1:r=o.child.stateNode}try{Pg(i,r)}catch(b){Pe(o,o.return,b)}}break;case 27:r===null&&l&4&&av(o);case 26:case 5:Qi(i,o),r===null&&l&4&&sv(o),l&512&&co(o,o.return);break;case 12:Qi(i,o);break;case 13:Qi(i,o),l&4&&fv(i,o),l&64&&(i=o.memoizedState,i!==null&&(i=i.dehydrated,i!==null&&(o=fM.bind(null,o),CM(i,o))));break;case 22:if(l=o.memoizedState!==null||vi,!l){r=r!==null&&r.memoizedState!==null||ut,f=vi;var m=ut;vi=l,(ut=r)&&!m?Wi(i,o,(o.subtreeFlags&8772)!==0):Qi(i,o),vi=f,ut=m}break;case 30:break;default:Qi(i,o)}}function uv(i){var r=i.alternate;r!==null&&(i.alternate=null,uv(r)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(r=i.stateNode,r!==null&&uf(r)),i.stateNode=null,i.return=null,i.dependencies=null,i.memoizedProps=null,i.memoizedState=null,i.pendingProps=null,i.stateNode=null,i.updateQueue=null}var et=null,Wt=!1;function Si(i,r,o){for(o=o.child;o!==null;)cv(i,r,o),o=o.sibling}function cv(i,r,o){if(on&&typeof on.onCommitFiberUnmount=="function")try{on.onCommitFiberUnmount(Da,o)}catch{}switch(o.tag){case 26:ut||Fn(o,r),Si(i,r,o),o.memoizedState?o.memoizedState.count--:o.stateNode&&(o=o.stateNode,o.parentNode.removeChild(o));break;case 27:ut||Fn(o,r);var l=et,f=Wt;rs(o.type)&&(et=o.stateNode,Wt=!1),Si(i,r,o),So(o.stateNode),et=l,Wt=f;break;case 5:ut||Fn(o,r);case 6:if(l=et,f=Wt,et=null,Si(i,r,o),et=l,Wt=f,et!==null)if(Wt)try{(et.nodeType===9?et.body:et.nodeName==="HTML"?et.ownerDocument.body:et).removeChild(o.stateNode)}catch(m){Pe(o,r,m)}else try{et.removeChild(o.stateNode)}catch(m){Pe(o,r,m)}break;case 18:et!==null&&(Wt?(i=et,Qv(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,o.stateNode),Mo(i)):Qv(et,o.stateNode));break;case 4:l=et,f=Wt,et=o.stateNode.containerInfo,Wt=!0,Si(i,r,o),et=l,Wt=f;break;case 0:case 11:case 14:case 15:ut||Ji(2,o,r),ut||Ji(4,o,r),Si(i,r,o);break;case 1:ut||(Fn(o,r),l=o.stateNode,typeof l.componentWillUnmount=="function"&&iv(o,r,l)),Si(i,r,o);break;case 21:Si(i,r,o);break;case 22:ut=(l=ut)||o.memoizedState!==null,Si(i,r,o),ut=l;break;default:Si(i,r,o)}}function fv(i,r){if(r.memoizedState===null&&(i=r.alternate,i!==null&&(i=i.memoizedState,i!==null&&(i=i.dehydrated,i!==null))))try{Mo(i)}catch(o){Pe(r,r.return,o)}}function iM(i){switch(i.tag){case 13:case 19:var r=i.stateNode;return r===null&&(r=i.stateNode=new ov),r;case 22:return i=i.stateNode,r=i._retryCache,r===null&&(r=i._retryCache=new ov),r;default:throw Error(s(435,i.tag))}}function Dd(i,r){var o=iM(i);r.forEach(function(l){var f=dM.bind(null,i,l);o.has(l)||(o.add(l),l.then(f,f))})}function fn(i,r){var o=r.deletions;if(o!==null)for(var l=0;l<o.length;l++){var f=o[l],m=i,b=r,x=b;e:for(;x!==null;){switch(x.tag){case 27:if(rs(x.type)){et=x.stateNode,Wt=!1;break e}break;case 5:et=x.stateNode,Wt=!1;break e;case 3:case 4:et=x.stateNode.containerInfo,Wt=!0;break e}x=x.return}if(et===null)throw Error(s(160));cv(m,b,f),et=null,Wt=!1,m=f.alternate,m!==null&&(m.return=null),f.return=null}if(r.subtreeFlags&13878)for(r=r.child;r!==null;)dv(r,i),r=r.sibling}var Ln=null;function dv(i,r){var o=i.alternate,l=i.flags;switch(i.tag){case 0:case 11:case 14:case 15:fn(r,i),dn(i),l&4&&(Ji(3,i,i.return),uo(3,i),Ji(5,i,i.return));break;case 1:fn(r,i),dn(i),l&512&&(ut||o===null||Fn(o,o.return)),l&64&&vi&&(i=i.updateQueue,i!==null&&(l=i.callbacks,l!==null&&(o=i.shared.hiddenCallbacks,i.shared.hiddenCallbacks=o===null?l:o.concat(l))));break;case 26:var f=Ln;if(fn(r,i),dn(i),l&512&&(ut||o===null||Fn(o,o.return)),l&4){var m=o!==null?o.memoizedState:null;if(l=i.memoizedState,o===null)if(l===null)if(i.stateNode===null){e:{l=i.type,o=i.memoizedProps,f=f.ownerDocument||f;t:switch(l){case"title":m=f.getElementsByTagName("title")[0],(!m||m[$a]||m[Vt]||m.namespaceURI==="http://www.w3.org/2000/svg"||m.hasAttribute("itemprop"))&&(m=f.createElement(l),f.head.insertBefore(m,f.querySelector("head > title"))),_t(m,l,o),m[Vt]=i,Tt(m),l=m;break e;case"link":var b=a0("link","href",f).get(l+(o.href||""));if(b){for(var x=0;x<b.length;x++)if(m=b[x],m.getAttribute("href")===(o.href==null||o.href===""?null:o.href)&&m.getAttribute("rel")===(o.rel==null?null:o.rel)&&m.getAttribute("title")===(o.title==null?null:o.title)&&m.getAttribute("crossorigin")===(o.crossOrigin==null?null:o.crossOrigin)){b.splice(x,1);break t}}m=f.createElement(l),_t(m,l,o),f.head.appendChild(m);break;case"meta":if(b=a0("meta","content",f).get(l+(o.content||""))){for(x=0;x<b.length;x++)if(m=b[x],m.getAttribute("content")===(o.content==null?null:""+o.content)&&m.getAttribute("name")===(o.name==null?null:o.name)&&m.getAttribute("property")===(o.property==null?null:o.property)&&m.getAttribute("http-equiv")===(o.httpEquiv==null?null:o.httpEquiv)&&m.getAttribute("charset")===(o.charSet==null?null:o.charSet)){b.splice(x,1);break t}}m=f.createElement(l),_t(m,l,o),f.head.appendChild(m);break;default:throw Error(s(468,l))}m[Vt]=i,Tt(m),l=m}i.stateNode=l}else o0(f,i.type,i.stateNode);else i.stateNode=r0(f,l,i.memoizedProps);else m!==l?(m===null?o.stateNode!==null&&(o=o.stateNode,o.parentNode.removeChild(o)):m.count--,l===null?o0(f,i.type,i.stateNode):r0(f,l,i.memoizedProps)):l===null&&i.stateNode!==null&&Od(i,i.memoizedProps,o.memoizedProps)}break;case 27:fn(r,i),dn(i),l&512&&(ut||o===null||Fn(o,o.return)),o!==null&&l&4&&Od(i,i.memoizedProps,o.memoizedProps);break;case 5:if(fn(r,i),dn(i),l&512&&(ut||o===null||Fn(o,o.return)),i.flags&32){f=i.stateNode;try{gr(f,"")}catch(V){Pe(i,i.return,V)}}l&4&&i.stateNode!=null&&(f=i.memoizedProps,Od(i,f,o!==null?o.memoizedProps:f)),l&1024&&(kd=!0);break;case 6:if(fn(r,i),dn(i),l&4){if(i.stateNode===null)throw Error(s(162));l=i.memoizedProps,o=i.stateNode;try{o.nodeValue=l}catch(V){Pe(i,i.return,V)}}break;case 3:if(Au=null,f=Ln,Ln=xu(r.containerInfo),fn(r,i),Ln=f,dn(i),l&4&&o!==null&&o.memoizedState.isDehydrated)try{Mo(r.containerInfo)}catch(V){Pe(i,i.return,V)}kd&&(kd=!1,hv(i));break;case 4:l=Ln,Ln=xu(i.stateNode.containerInfo),fn(r,i),dn(i),Ln=l;break;case 12:fn(r,i),dn(i);break;case 13:fn(r,i),dn(i),i.child.flags&8192&&i.memoizedState!==null!=(o!==null&&o.memoizedState!==null)&&(Vd=Ke()),l&4&&(l=i.updateQueue,l!==null&&(i.updateQueue=null,Dd(i,l)));break;case 22:f=i.memoizedState!==null;var E=o!==null&&o.memoizedState!==null,_=vi,q=ut;if(vi=_||f,ut=q||E,fn(r,i),ut=q,vi=_,dn(i),l&8192)e:for(r=i.stateNode,r._visibility=f?r._visibility&-2:r._visibility|1,f&&(o===null||E||vi||ut||Us(i)),o=null,r=i;;){if(r.tag===5||r.tag===26){if(o===null){E=o=r;try{if(m=E.stateNode,f)b=m.style,typeof b.setProperty=="function"?b.setProperty("display","none","important"):b.display="none";else{x=E.stateNode;var H=E.memoizedProps.style,B=H!=null&&H.hasOwnProperty("display")?H.display:null;x.style.display=B==null||typeof B=="boolean"?"":(""+B).trim()}}catch(V){Pe(E,E.return,V)}}}else if(r.tag===6){if(o===null){E=r;try{E.stateNode.nodeValue=f?"":E.memoizedProps}catch(V){Pe(E,E.return,V)}}}else if((r.tag!==22&&r.tag!==23||r.memoizedState===null||r===i)&&r.child!==null){r.child.return=r,r=r.child;continue}if(r===i)break e;for(;r.sibling===null;){if(r.return===null||r.return===i)break e;o===r&&(o=null),r=r.return}o===r&&(o=null),r.sibling.return=r.return,r=r.sibling}l&4&&(l=i.updateQueue,l!==null&&(o=l.retryQueue,o!==null&&(l.retryQueue=null,Dd(i,o))));break;case 19:fn(r,i),dn(i),l&4&&(l=i.updateQueue,l!==null&&(i.updateQueue=null,Dd(i,l)));break;case 30:break;case 21:break;default:fn(r,i),dn(i)}}function dn(i){var r=i.flags;if(r&2){try{for(var o,l=i.return;l!==null;){if(rv(l)){o=l;break}l=l.return}if(o==null)throw Error(s(160));switch(o.tag){case 27:var f=o.stateNode,m=Md(i);lu(i,m,f);break;case 5:var b=o.stateNode;o.flags&32&&(gr(b,""),o.flags&=-33);var x=Md(i);lu(i,x,b);break;case 3:case 4:var E=o.stateNode.containerInfo,_=Md(i);Cd(i,_,E);break;default:throw Error(s(161))}}catch(q){Pe(i,i.return,q)}i.flags&=-3}r&4096&&(i.flags&=-4097)}function hv(i){if(i.subtreeFlags&1024)for(i=i.child;i!==null;){var r=i;hv(r),r.tag===5&&r.flags&1024&&r.stateNode.reset(),i=i.sibling}}function Qi(i,r){if(r.subtreeFlags&8772)for(r=r.child;r!==null;)lv(i,r.alternate,r),r=r.sibling}function Us(i){for(i=i.child;i!==null;){var r=i;switch(r.tag){case 0:case 11:case 14:case 15:Ji(4,r,r.return),Us(r);break;case 1:Fn(r,r.return);var o=r.stateNode;typeof o.componentWillUnmount=="function"&&iv(r,r.return,o),Us(r);break;case 27:So(r.stateNode);case 26:case 5:Fn(r,r.return),Us(r);break;case 22:r.memoizedState===null&&Us(r);break;case 30:Us(r);break;default:Us(r)}i=i.sibling}}function Wi(i,r,o){for(o=o&&(r.subtreeFlags&8772)!==0,r=r.child;r!==null;){var l=r.alternate,f=i,m=r,b=m.flags;switch(m.tag){case 0:case 11:case 15:Wi(f,m,o),uo(4,m);break;case 1:if(Wi(f,m,o),l=m,f=l.stateNode,typeof f.componentDidMount=="function")try{f.componentDidMount()}catch(_){Pe(l,l.return,_)}if(l=m,f=l.updateQueue,f!==null){var x=l.stateNode;try{var E=f.shared.hiddenCallbacks;if(E!==null)for(f.shared.hiddenCallbacks=null,f=0;f<E.length;f++)Kg(E[f],x)}catch(_){Pe(l,l.return,_)}}o&&b&64&&nv(m),co(m,m.return);break;case 27:av(m);case 26:case 5:Wi(f,m,o),o&&l===null&&b&4&&sv(m),co(m,m.return);break;case 12:Wi(f,m,o);break;case 13:Wi(f,m,o),o&&b&4&&fv(f,m);break;case 22:m.memoizedState===null&&Wi(f,m,o),co(m,m.return);break;case 30:break;default:Wi(f,m,o)}r=r.sibling}}function Nd(i,r){var o=null;i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(o=i.memoizedState.cachePool.pool),i=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(i=r.memoizedState.cachePool.pool),i!==o&&(i!=null&&i.refCount++,o!=null&&Xa(o))}function _d(i,r){i=null,r.alternate!==null&&(i=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==i&&(r.refCount++,i!=null&&Xa(i))}function Yn(i,r,o,l){if(r.subtreeFlags&10256)for(r=r.child;r!==null;)pv(i,r,o,l),r=r.sibling}function pv(i,r,o,l){var f=r.flags;switch(r.tag){case 0:case 11:case 15:Yn(i,r,o,l),f&2048&&uo(9,r);break;case 1:Yn(i,r,o,l);break;case 3:Yn(i,r,o,l),f&2048&&(i=null,r.alternate!==null&&(i=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==i&&(r.refCount++,i!=null&&Xa(i)));break;case 12:if(f&2048){Yn(i,r,o,l),i=r.stateNode;try{var m=r.memoizedProps,b=m.id,x=m.onPostCommit;typeof x=="function"&&x(b,r.alternate===null?"mount":"update",i.passiveEffectDuration,-0)}catch(E){Pe(r,r.return,E)}}else Yn(i,r,o,l);break;case 13:Yn(i,r,o,l);break;case 23:break;case 22:m=r.stateNode,b=r.alternate,r.memoizedState!==null?m._visibility&2?Yn(i,r,o,l):fo(i,r):m._visibility&2?Yn(i,r,o,l):(m._visibility|=2,Lr(i,r,o,l,(r.subtreeFlags&10256)!==0)),f&2048&&Nd(b,r);break;case 24:Yn(i,r,o,l),f&2048&&_d(r.alternate,r);break;default:Yn(i,r,o,l)}}function Lr(i,r,o,l,f){for(f=f&&(r.subtreeFlags&10256)!==0,r=r.child;r!==null;){var m=i,b=r,x=o,E=l,_=b.flags;switch(b.tag){case 0:case 11:case 15:Lr(m,b,x,E,f),uo(8,b);break;case 23:break;case 22:var q=b.stateNode;b.memoizedState!==null?q._visibility&2?Lr(m,b,x,E,f):fo(m,b):(q._visibility|=2,Lr(m,b,x,E,f)),f&&_&2048&&Nd(b.alternate,b);break;case 24:Lr(m,b,x,E,f),f&&_&2048&&_d(b.alternate,b);break;default:Lr(m,b,x,E,f)}r=r.sibling}}function fo(i,r){if(r.subtreeFlags&10256)for(r=r.child;r!==null;){var o=i,l=r,f=l.flags;switch(l.tag){case 22:fo(o,l),f&2048&&Nd(l.alternate,l);break;case 24:fo(o,l),f&2048&&_d(l.alternate,l);break;default:fo(o,l)}r=r.sibling}}var ho=8192;function Vr(i){if(i.subtreeFlags&ho)for(i=i.child;i!==null;)mv(i),i=i.sibling}function mv(i){switch(i.tag){case 26:Vr(i),i.flags&ho&&i.memoizedState!==null&&KM(Ln,i.memoizedState,i.memoizedProps);break;case 5:Vr(i);break;case 3:case 4:var r=Ln;Ln=xu(i.stateNode.containerInfo),Vr(i),Ln=r;break;case 22:i.memoizedState===null&&(r=i.alternate,r!==null&&r.memoizedState!==null?(r=ho,ho=16777216,Vr(i),ho=r):Vr(i));break;default:Vr(i)}}function yv(i){var r=i.alternate;if(r!==null&&(i=r.child,i!==null)){r.child=null;do r=i.sibling,i.sibling=null,i=r;while(i!==null)}}function po(i){var r=i.deletions;if((i.flags&16)!==0){if(r!==null)for(var o=0;o<r.length;o++){var l=r[o];Rt=l,bv(l,i)}yv(i)}if(i.subtreeFlags&10256)for(i=i.child;i!==null;)gv(i),i=i.sibling}function gv(i){switch(i.tag){case 0:case 11:case 15:po(i),i.flags&2048&&Ji(9,i,i.return);break;case 3:po(i);break;case 12:po(i);break;case 22:var r=i.stateNode;i.memoizedState!==null&&r._visibility&2&&(i.return===null||i.return.tag!==13)?(r._visibility&=-3,uu(i)):po(i);break;default:po(i)}}function uu(i){var r=i.deletions;if((i.flags&16)!==0){if(r!==null)for(var o=0;o<r.length;o++){var l=r[o];Rt=l,bv(l,i)}yv(i)}for(i=i.child;i!==null;){switch(r=i,r.tag){case 0:case 11:case 15:Ji(8,r,r.return),uu(r);break;case 22:o=r.stateNode,o._visibility&2&&(o._visibility&=-3,uu(r));break;default:uu(r)}i=i.sibling}}function bv(i,r){for(;Rt!==null;){var o=Rt;switch(o.tag){case 0:case 11:case 15:Ji(8,o,r);break;case 23:case 22:if(o.memoizedState!==null&&o.memoizedState.cachePool!==null){var l=o.memoizedState.cachePool.pool;l!=null&&l.refCount++}break;case 24:Xa(o.memoizedState.cache)}if(l=o.child,l!==null)l.return=o,Rt=l;else e:for(o=i;Rt!==null;){l=Rt;var f=l.sibling,m=l.return;if(uv(l),l===o){Rt=null;break e}if(f!==null){f.return=m,Rt=f;break e}Rt=m}}}var sM={getCacheForType:function(i){var r=jt(vt),o=r.data.get(i);return o===void 0&&(o=i(),r.data.set(i,o)),o}},rM=typeof WeakMap=="function"?WeakMap:Map,Le=0,Fe=null,Te=null,Ce=0,Ve=0,hn=null,es=!1,jr=!1,$d=!1,xi=0,rt=0,ts=0,qs=0,Bd=0,On=0,zr=0,mo=null,en=null,Ld=!1,Vd=0,cu=1/0,fu=null,ns=null,Nt=0,is=null,Ur=null,qr=0,jd=0,zd=null,vv=null,yo=0,Ud=null;function pn(){if((Le&2)!==0&&Ce!==0)return Ce&-Ce;if(L.T!==null){var i=Mr;return i!==0?i:Fd()}return By()}function Sv(){On===0&&(On=(Ce&536870912)===0||$e?Dy():536870912);var i=Rn.current;return i!==null&&(i.flags|=32),On}function mn(i,r,o){(i===Fe&&(Ve===2||Ve===9)||i.cancelPendingCommit!==null)&&(Kr(i,0),ss(i,Ce,On,!1)),_a(i,o),((Le&2)===0||i!==Fe)&&(i===Fe&&((Le&2)===0&&(qs|=o),rt===4&&ss(i,Ce,On,!1)),Xn(i))}function xv(i,r,o){if((Le&6)!==0)throw Error(s(327));var l=!o&&(r&124)===0&&(r&i.expiredLanes)===0||Na(i,r),f=l?lM(i,r):Pd(i,r,!0),m=l;do{if(f===0){jr&&!l&&ss(i,r,0,!1);break}else{if(o=i.current.alternate,m&&!aM(o)){f=Pd(i,r,!1),m=!1;continue}if(f===2){if(m=r,i.errorRecoveryDisabledLanes&m)var b=0;else b=i.pendingLanes&-536870913,b=b!==0?b:b&536870912?536870912:0;if(b!==0){r=b;e:{var x=i;f=mo;var E=x.current.memoizedState.isDehydrated;if(E&&(Kr(x,b).flags|=256),b=Pd(x,b,!1),b!==2){if($d&&!E){x.errorRecoveryDisabledLanes|=m,qs|=m,f=4;break e}m=en,en=f,m!==null&&(en===null?en=m:en.push.apply(en,m))}f=b}if(m=!1,f!==2)continue}}if(f===1){Kr(i,0),ss(i,r,0,!0);break}e:{switch(l=i,m=f,m){case 0:case 1:throw Error(s(345));case 4:if((r&4194048)!==r)break;case 6:ss(l,r,On,!es);break e;case 2:en=null;break;case 3:case 5:break;default:throw Error(s(329))}if((r&62914560)===r&&(f=Vd+300-Ke(),10<f)){if(ss(l,r,On,!es),wl(l,0,!0)!==0)break e;l.timeoutHandle=Zv(wv.bind(null,l,o,en,fu,Ld,r,On,qs,zr,es,m,2,-0,0),f);break e}wv(l,o,en,fu,Ld,r,On,qs,zr,es,m,0,-0,0)}}break}while(!0);Xn(i)}function wv(i,r,o,l,f,m,b,x,E,_,q,H,B,V){if(i.timeoutHandle=-1,H=r.subtreeFlags,(H&8192||(H&16785408)===16785408)&&(Ao={stylesheets:null,count:0,unsuspend:qM},mv(r),H=PM(),H!==null)){i.cancelPendingCommit=H(Cv.bind(null,i,r,m,o,l,f,b,x,E,q,1,B,V)),ss(i,m,b,!_);return}Cv(i,r,m,o,l,f,b,x,E)}function aM(i){for(var r=i;;){var o=r.tag;if((o===0||o===11||o===15)&&r.flags&16384&&(o=r.updateQueue,o!==null&&(o=o.stores,o!==null)))for(var l=0;l<o.length;l++){var f=o[l],m=f.getSnapshot;f=f.value;try{if(!un(m(),f))return!1}catch{return!1}}if(o=r.child,r.subtreeFlags&16384&&o!==null)o.return=r,r=o;else{if(r===i)break;for(;r.sibling===null;){if(r.return===null||r.return===i)return!0;r=r.return}r.sibling.return=r.return,r=r.sibling}}return!0}function ss(i,r,o,l){r&=~Bd,r&=~qs,i.suspendedLanes|=r,i.pingedLanes&=~r,l&&(i.warmLanes|=r),l=i.expirationTimes;for(var f=r;0<f;){var m=31-ln(f),b=1<<m;l[m]=-1,f&=~b}o!==0&&_y(i,o,r)}function du(){return(Le&6)===0?(go(0),!1):!0}function qd(){if(Te!==null){if(Ve===0)var i=Te.return;else i=Te,hi=Bs=null,sd(i),$r=null,ao=0,i=Te;for(;i!==null;)tv(i.alternate,i),i=i.return;Te=null}}function Kr(i,r){var o=i.timeoutHandle;o!==-1&&(i.timeoutHandle=-1,TM(o)),o=i.cancelPendingCommit,o!==null&&(i.cancelPendingCommit=null,o()),qd(),Fe=i,Te=o=ci(i.current,null),Ce=r,Ve=0,hn=null,es=!1,jr=Na(i,r),$d=!1,zr=On=Bd=qs=ts=rt=0,en=mo=null,Ld=!1,(r&8)!==0&&(r|=r&32);var l=i.entangledLanes;if(l!==0)for(i=i.entanglements,l&=r;0<l;){var f=31-ln(l),m=1<<f;r|=i[f],l&=~m}return xi=r,$l(),o}function Av(i,r){ve=null,L.H=Wl,r===Ja||r===Pl?(r=Ug(),Ve=3):r===Vg?(r=Ug(),Ve=4):Ve=r===qb?8:r!==null&&typeof r=="object"&&typeof r.then=="function"?6:1,hn=r,Te===null&&(rt=1,su(i,wn(r,i.current)))}function Tv(){var i=L.H;return L.H=Wl,i===null?Wl:i}function Ev(){var i=L.A;return L.A=sM,i}function Kd(){rt=4,es||(Ce&4194048)!==Ce&&Rn.current!==null||(jr=!0),(ts&134217727)===0&&(qs&134217727)===0||Fe===null||ss(Fe,Ce,On,!1)}function Pd(i,r,o){var l=Le;Le|=2;var f=Tv(),m=Ev();(Fe!==i||Ce!==r)&&(fu=null,Kr(i,r)),r=!1;var b=rt;e:do try{if(Ve!==0&&Te!==null){var x=Te,E=hn;switch(Ve){case 8:qd(),b=6;break e;case 3:case 2:case 9:case 6:Rn.current===null&&(r=!0);var _=Ve;if(Ve=0,hn=null,Pr(i,x,E,_),o&&jr){b=0;break e}break;default:_=Ve,Ve=0,hn=null,Pr(i,x,E,_)}}oM(),b=rt;break}catch(q){Av(i,q)}while(!0);return r&&i.shellSuspendCounter++,hi=Bs=null,Le=l,L.H=f,L.A=m,Te===null&&(Fe=null,Ce=0,$l()),b}function oM(){for(;Te!==null;)Rv(Te)}function lM(i,r){var o=Le;Le|=2;var l=Tv(),f=Ev();Fe!==i||Ce!==r?(fu=null,cu=Ke()+500,Kr(i,r)):jr=Na(i,r);e:do try{if(Ve!==0&&Te!==null){r=Te;var m=hn;t:switch(Ve){case 1:Ve=0,hn=null,Pr(i,r,m,1);break;case 2:case 9:if(jg(m)){Ve=0,hn=null,Ov(r);break}r=function(){Ve!==2&&Ve!==9||Fe!==i||(Ve=7),Xn(i)},m.then(r,r);break e;case 3:Ve=7;break e;case 4:Ve=5;break e;case 7:jg(m)?(Ve=0,hn=null,Ov(r)):(Ve=0,hn=null,Pr(i,r,m,7));break;case 5:var b=null;switch(Te.tag){case 26:b=Te.memoizedState;case 5:case 27:var x=Te;if(!b||l0(b)){Ve=0,hn=null;var E=x.sibling;if(E!==null)Te=E;else{var _=x.return;_!==null?(Te=_,hu(_)):Te=null}break t}}Ve=0,hn=null,Pr(i,r,m,5);break;case 6:Ve=0,hn=null,Pr(i,r,m,6);break;case 8:qd(),rt=6;break e;default:throw Error(s(462))}}uM();break}catch(q){Av(i,q)}while(!0);return hi=Bs=null,L.H=l,L.A=f,Le=o,Te!==null?0:(Fe=null,Ce=0,$l(),rt)}function uM(){for(;Te!==null&&!Qe();)Rv(Te)}function Rv(i){var r=Wb(i.alternate,i,xi);i.memoizedProps=i.pendingProps,r===null?hu(i):Te=r}function Ov(i){var r=i,o=r.alternate;switch(r.tag){case 15:case 0:r=Fb(o,r,r.pendingProps,r.type,void 0,Ce);break;case 11:r=Fb(o,r,r.pendingProps,r.type.render,r.ref,Ce);break;case 5:sd(r);default:tv(o,r),r=Te=Mg(r,xi),r=Wb(o,r,xi)}i.memoizedProps=i.pendingProps,r===null?hu(i):Te=r}function Pr(i,r,o,l){hi=Bs=null,sd(r),$r=null,ao=0;var f=r.return;try{if(QO(i,f,r,o,Ce)){rt=1,su(i,wn(o,i.current)),Te=null;return}}catch(m){if(f!==null)throw Te=f,m;rt=1,su(i,wn(o,i.current)),Te=null;return}r.flags&32768?($e||l===1?i=!0:jr||(Ce&536870912)!==0?i=!1:(es=i=!0,(l===2||l===9||l===3||l===6)&&(l=Rn.current,l!==null&&l.tag===13&&(l.flags|=16384))),Mv(r,i)):hu(r)}function hu(i){var r=i;do{if((r.flags&32768)!==0){Mv(r,es);return}i=r.return;var o=eM(r.alternate,r,xi);if(o!==null){Te=o;return}if(r=r.sibling,r!==null){Te=r;return}Te=r=i}while(r!==null);rt===0&&(rt=5)}function Mv(i,r){do{var o=tM(i.alternate,i);if(o!==null){o.flags&=32767,Te=o;return}if(o=i.return,o!==null&&(o.flags|=32768,o.subtreeFlags=0,o.deletions=null),!r&&(i=i.sibling,i!==null)){Te=i;return}Te=i=o}while(i!==null);rt=6,Te=null}function Cv(i,r,o,l,f,m,b,x,E){i.cancelPendingCommit=null;do pu();while(Nt!==0);if((Le&6)!==0)throw Error(s(327));if(r!==null){if(r===i.current)throw Error(s(177));if(m=r.lanes|r.childLanes,m|=_f,qR(i,o,m,b,x,E),i===Fe&&(Te=Fe=null,Ce=0),Ur=r,is=i,qr=o,jd=m,zd=f,vv=l,(r.subtreeFlags&10256)!==0||(r.flags&10256)!==0?(i.callbackNode=null,i.callbackPriority=0,hM(an,function(){return $v(),null})):(i.callbackNode=null,i.callbackPriority=0),l=(r.flags&13878)!==0,(r.subtreeFlags&13878)!==0||l){l=L.T,L.T=null,f=I.p,I.p=2,b=Le,Le|=4;try{nM(i,r,o)}finally{Le=b,I.p=f,L.T=l}}Nt=1,kv(),Dv(),Nv()}}function kv(){if(Nt===1){Nt=0;var i=is,r=Ur,o=(r.flags&13878)!==0;if((r.subtreeFlags&13878)!==0||o){o=L.T,L.T=null;var l=I.p;I.p=2;var f=Le;Le|=4;try{dv(r,i);var m=th,b=bg(i.containerInfo),x=m.focusedElem,E=m.selectionRange;if(b!==x&&x&&x.ownerDocument&&gg(x.ownerDocument.documentElement,x)){if(E!==null&&Mf(x)){var _=E.start,q=E.end;if(q===void 0&&(q=_),"selectionStart"in x)x.selectionStart=_,x.selectionEnd=Math.min(q,x.value.length);else{var H=x.ownerDocument||document,B=H&&H.defaultView||window;if(B.getSelection){var V=B.getSelection(),de=x.textContent.length,ue=Math.min(E.start,de),Ue=E.end===void 0?ue:Math.min(E.end,de);!V.extend&&ue>Ue&&(b=Ue,Ue=ue,ue=b);var C=yg(x,ue),O=yg(x,Ue);if(C&&O&&(V.rangeCount!==1||V.anchorNode!==C.node||V.anchorOffset!==C.offset||V.focusNode!==O.node||V.focusOffset!==O.offset)){var N=H.createRange();N.setStart(C.node,C.offset),V.removeAllRanges(),ue>Ue?(V.addRange(N),V.extend(O.node,O.offset)):(N.setEnd(O.node,O.offset),V.addRange(N))}}}}for(H=[],V=x;V=V.parentNode;)V.nodeType===1&&H.push({element:V,left:V.scrollLeft,top:V.scrollTop});for(typeof x.focus=="function"&&x.focus(),x=0;x<H.length;x++){var P=H[x];P.element.scrollLeft=P.left,P.element.scrollTop=P.top}}Ru=!!eh,th=eh=null}finally{Le=f,I.p=l,L.T=o}}i.current=r,Nt=2}}function Dv(){if(Nt===2){Nt=0;var i=is,r=Ur,o=(r.flags&8772)!==0;if((r.subtreeFlags&8772)!==0||o){o=L.T,L.T=null;var l=I.p;I.p=2;var f=Le;Le|=4;try{lv(i,r.alternate,r)}finally{Le=f,I.p=l,L.T=o}}Nt=3}}function Nv(){if(Nt===4||Nt===3){Nt=0,In();var i=is,r=Ur,o=qr,l=vv;(r.subtreeFlags&10256)!==0||(r.flags&10256)!==0?Nt=5:(Nt=0,Ur=is=null,_v(i,i.pendingLanes));var f=i.pendingLanes;if(f===0&&(ns=null),of(o),r=r.stateNode,on&&typeof on.onCommitFiberRoot=="function")try{on.onCommitFiberRoot(Da,r,void 0,(r.current.flags&128)===128)}catch{}if(l!==null){r=L.T,f=I.p,I.p=2,L.T=null;try{for(var m=i.onRecoverableError,b=0;b<l.length;b++){var x=l[b];m(x.value,{componentStack:x.stack})}}finally{L.T=r,I.p=f}}(qr&3)!==0&&pu(),Xn(i),f=i.pendingLanes,(o&4194090)!==0&&(f&42)!==0?i===Ud?yo++:(yo=0,Ud=i):yo=0,go(0)}}function _v(i,r){(i.pooledCacheLanes&=r)===0&&(r=i.pooledCache,r!=null&&(i.pooledCache=null,Xa(r)))}function pu(i){return kv(),Dv(),Nv(),$v()}function $v(){if(Nt!==5)return!1;var i=is,r=jd;jd=0;var o=of(qr),l=L.T,f=I.p;try{I.p=32>o?32:o,L.T=null,o=zd,zd=null;var m=is,b=qr;if(Nt=0,Ur=is=null,qr=0,(Le&6)!==0)throw Error(s(331));var x=Le;if(Le|=4,gv(m.current),pv(m,m.current,b,o),Le=x,go(0,!1),on&&typeof on.onPostCommitFiberRoot=="function")try{on.onPostCommitFiberRoot(Da,m)}catch{}return!0}finally{I.p=f,L.T=l,_v(i,r)}}function Bv(i,r,o){r=wn(o,r),r=bd(i.stateNode,r,2),i=Fi(i,r,2),i!==null&&(_a(i,2),Xn(i))}function Pe(i,r,o){if(i.tag===3)Bv(i,i,o);else for(;r!==null;){if(r.tag===3){Bv(r,i,o);break}else if(r.tag===1){var l=r.stateNode;if(typeof r.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(ns===null||!ns.has(l))){i=wn(o,i),o=zb(2),l=Fi(r,o,2),l!==null&&(Ub(o,l,r,i),_a(l,2),Xn(l));break}}r=r.return}}function Id(i,r,o){var l=i.pingCache;if(l===null){l=i.pingCache=new rM;var f=new Set;l.set(r,f)}else f=l.get(r),f===void 0&&(f=new Set,l.set(r,f));f.has(o)||($d=!0,f.add(o),i=cM.bind(null,i,r,o),r.then(i,i))}function cM(i,r,o){var l=i.pingCache;l!==null&&l.delete(r),i.pingedLanes|=i.suspendedLanes&o,i.warmLanes&=~o,Fe===i&&(Ce&o)===o&&(rt===4||rt===3&&(Ce&62914560)===Ce&&300>Ke()-Vd?(Le&2)===0&&Kr(i,0):Bd|=o,zr===Ce&&(zr=0)),Xn(i)}function Lv(i,r){r===0&&(r=Ny()),i=Tr(i,r),i!==null&&(_a(i,r),Xn(i))}function fM(i){var r=i.memoizedState,o=0;r!==null&&(o=r.retryLane),Lv(i,o)}function dM(i,r){var o=0;switch(i.tag){case 13:var l=i.stateNode,f=i.memoizedState;f!==null&&(o=f.retryLane);break;case 19:l=i.stateNode;break;case 22:l=i.stateNode._retryCache;break;default:throw Error(s(314))}l!==null&&l.delete(r),Lv(i,o)}function hM(i,r){return xe(i,r)}var mu=null,Ir=null,Hd=!1,yu=!1,Gd=!1,Ks=0;function Xn(i){i!==Ir&&i.next===null&&(Ir===null?mu=Ir=i:Ir=Ir.next=i),yu=!0,Hd||(Hd=!0,mM())}function go(i,r){if(!Gd&&yu){Gd=!0;do for(var o=!1,l=mu;l!==null;){if(i!==0){var f=l.pendingLanes;if(f===0)var m=0;else{var b=l.suspendedLanes,x=l.pingedLanes;m=(1<<31-ln(42|i)+1)-1,m&=f&~(b&~x),m=m&201326741?m&201326741|1:m?m|2:0}m!==0&&(o=!0,Uv(l,m))}else m=Ce,m=wl(l,l===Fe?m:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(m&3)===0||Na(l,m)||(o=!0,Uv(l,m));l=l.next}while(o);Gd=!1}}function pM(){Vv()}function Vv(){yu=Hd=!1;var i=0;Ks!==0&&(AM()&&(i=Ks),Ks=0);for(var r=Ke(),o=null,l=mu;l!==null;){var f=l.next,m=jv(l,r);m===0?(l.next=null,o===null?mu=f:o.next=f,f===null&&(Ir=o)):(o=l,(i!==0||(m&3)!==0)&&(yu=!0)),l=f}go(i)}function jv(i,r){for(var o=i.suspendedLanes,l=i.pingedLanes,f=i.expirationTimes,m=i.pendingLanes&-62914561;0<m;){var b=31-ln(m),x=1<<b,E=f[b];E===-1?((x&o)===0||(x&l)!==0)&&(f[b]=UR(x,r)):E<=r&&(i.expiredLanes|=x),m&=~x}if(r=Fe,o=Ce,o=wl(i,i===r?o:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),l=i.callbackNode,o===0||i===r&&(Ve===2||Ve===9)||i.cancelPendingCommit!==null)return l!==null&&l!==null&&Me(l),i.callbackNode=null,i.callbackPriority=0;if((o&3)===0||Na(i,o)){if(r=o&-o,r===i.callbackPriority)return r;switch(l!==null&&Me(l),of(o)){case 2:case 8:o=Ze;break;case 32:o=an;break;case 268435456:o=ky;break;default:o=an}return l=zv.bind(null,i),o=xe(o,l),i.callbackPriority=r,i.callbackNode=o,r}return l!==null&&l!==null&&Me(l),i.callbackPriority=2,i.callbackNode=null,2}function zv(i,r){if(Nt!==0&&Nt!==5)return i.callbackNode=null,i.callbackPriority=0,null;var o=i.callbackNode;if(pu()&&i.callbackNode!==o)return null;var l=Ce;return l=wl(i,i===Fe?l:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),l===0?null:(xv(i,l,r),jv(i,Ke()),i.callbackNode!=null&&i.callbackNode===o?zv.bind(null,i):null)}function Uv(i,r){if(pu())return null;xv(i,r,!0)}function mM(){EM(function(){(Le&6)!==0?xe(We,pM):Vv()})}function Fd(){return Ks===0&&(Ks=Dy()),Ks}function qv(i){return i==null||typeof i=="symbol"||typeof i=="boolean"?null:typeof i=="function"?i:Ol(""+i)}function Kv(i,r){var o=r.ownerDocument.createElement("input");return o.name=r.name,o.value=r.value,i.id&&o.setAttribute("form",i.id),r.parentNode.insertBefore(o,r),i=new FormData(i),o.parentNode.removeChild(o),i}function yM(i,r,o,l,f){if(r==="submit"&&o&&o.stateNode===f){var m=qv((f[Zt]||null).action),b=l.submitter;b&&(r=(r=b[Zt]||null)?qv(r.formAction):b.getAttribute("formAction"),r!==null&&(m=r,b=null));var x=new Dl("action","action",null,l,f);i.push({event:x,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(Ks!==0){var E=b?Kv(f,b):new FormData(f);hd(o,{pending:!0,data:E,method:f.method,action:m},null,E)}}else typeof m=="function"&&(x.preventDefault(),E=b?Kv(f,b):new FormData(f),hd(o,{pending:!0,data:E,method:f.method,action:m},m,E))},currentTarget:f}]})}}for(var Yd=0;Yd<Nf.length;Yd++){var Xd=Nf[Yd],gM=Xd.toLowerCase(),bM=Xd[0].toUpperCase()+Xd.slice(1);Bn(gM,"on"+bM)}Bn(xg,"onAnimationEnd"),Bn(wg,"onAnimationIteration"),Bn(Ag,"onAnimationStart"),Bn("dblclick","onDoubleClick"),Bn("focusin","onFocus"),Bn("focusout","onBlur"),Bn(BO,"onTransitionRun"),Bn(LO,"onTransitionStart"),Bn(VO,"onTransitionCancel"),Bn(Tg,"onTransitionEnd"),pr("onMouseEnter",["mouseout","mouseover"]),pr("onMouseLeave",["mouseout","mouseover"]),pr("onPointerEnter",["pointerout","pointerover"]),pr("onPointerLeave",["pointerout","pointerover"]),Rs("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Rs("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Rs("onBeforeInput",["compositionend","keypress","textInput","paste"]),Rs("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Rs("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Rs("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var bo="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),vM=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(bo));function Pv(i,r){r=(r&4)!==0;for(var o=0;o<i.length;o++){var l=i[o],f=l.event;l=l.listeners;e:{var m=void 0;if(r)for(var b=l.length-1;0<=b;b--){var x=l[b],E=x.instance,_=x.currentTarget;if(x=x.listener,E!==m&&f.isPropagationStopped())break e;m=x,f.currentTarget=_;try{m(f)}catch(q){iu(q)}f.currentTarget=null,m=E}else for(b=0;b<l.length;b++){if(x=l[b],E=x.instance,_=x.currentTarget,x=x.listener,E!==m&&f.isPropagationStopped())break e;m=x,f.currentTarget=_;try{m(f)}catch(q){iu(q)}f.currentTarget=null,m=E}}}}function Ee(i,r){var o=r[lf];o===void 0&&(o=r[lf]=new Set);var l=i+"__bubble";o.has(l)||(Iv(r,i,2,!1),o.add(l))}function Zd(i,r,o){var l=0;r&&(l|=4),Iv(o,i,l,r)}var gu="_reactListening"+Math.random().toString(36).slice(2);function Jd(i){if(!i[gu]){i[gu]=!0,Vy.forEach(function(o){o!=="selectionchange"&&(vM.has(o)||Zd(o,!1,i),Zd(o,!0,i))});var r=i.nodeType===9?i:i.ownerDocument;r===null||r[gu]||(r[gu]=!0,Zd("selectionchange",!1,r))}}function Iv(i,r,o,l){switch(p0(r)){case 2:var f=GM;break;case 8:f=FM;break;default:f=fh}o=f.bind(null,r,o,i),f=void 0,!vf||r!=="touchstart"&&r!=="touchmove"&&r!=="wheel"||(f=!0),l?f!==void 0?i.addEventListener(r,o,{capture:!0,passive:f}):i.addEventListener(r,o,!0):f!==void 0?i.addEventListener(r,o,{passive:f}):i.addEventListener(r,o,!1)}function Qd(i,r,o,l,f){var m=l;if((r&1)===0&&(r&2)===0&&l!==null)e:for(;;){if(l===null)return;var b=l.tag;if(b===3||b===4){var x=l.stateNode.containerInfo;if(x===f)break;if(b===4)for(b=l.return;b!==null;){var E=b.tag;if((E===3||E===4)&&b.stateNode.containerInfo===f)return;b=b.return}for(;x!==null;){if(b=fr(x),b===null)return;if(E=b.tag,E===5||E===6||E===26||E===27){l=m=b;continue e}x=x.parentNode}}l=l.return}Jy(function(){var _=m,q=gf(o),H=[];e:{var B=Eg.get(i);if(B!==void 0){var V=Dl,de=i;switch(i){case"keypress":if(Cl(o)===0)break e;case"keydown":case"keyup":V=hO;break;case"focusin":de="focus",V=Af;break;case"focusout":de="blur",V=Af;break;case"beforeblur":case"afterblur":V=Af;break;case"click":if(o.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":V=eg;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":V=tO;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":V=yO;break;case xg:case wg:case Ag:V=sO;break;case Tg:V=bO;break;case"scroll":case"scrollend":V=WR;break;case"wheel":V=SO;break;case"copy":case"cut":case"paste":V=aO;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":V=ng;break;case"toggle":case"beforetoggle":V=wO}var ue=(r&4)!==0,Ue=!ue&&(i==="scroll"||i==="scrollend"),C=ue?B!==null?B+"Capture":null:B;ue=[];for(var O=_,N;O!==null;){var P=O;if(N=P.stateNode,P=P.tag,P!==5&&P!==26&&P!==27||N===null||C===null||(P=La(O,C),P!=null&&ue.push(vo(O,P,N))),Ue)break;O=O.return}0<ue.length&&(B=new V(B,de,null,o,q),H.push({event:B,listeners:ue}))}}if((r&7)===0){e:{if(B=i==="mouseover"||i==="pointerover",V=i==="mouseout"||i==="pointerout",B&&o!==yf&&(de=o.relatedTarget||o.fromElement)&&(fr(de)||de[cr]))break e;if((V||B)&&(B=q.window===q?q:(B=q.ownerDocument)?B.defaultView||B.parentWindow:window,V?(de=o.relatedTarget||o.toElement,V=_,de=de?fr(de):null,de!==null&&(Ue=u(de),ue=de.tag,de!==Ue||ue!==5&&ue!==27&&ue!==6)&&(de=null)):(V=null,de=_),V!==de)){if(ue=eg,P="onMouseLeave",C="onMouseEnter",O="mouse",(i==="pointerout"||i==="pointerover")&&(ue=ng,P="onPointerLeave",C="onPointerEnter",O="pointer"),Ue=V==null?B:Ba(V),N=de==null?B:Ba(de),B=new ue(P,O+"leave",V,o,q),B.target=Ue,B.relatedTarget=N,P=null,fr(q)===_&&(ue=new ue(C,O+"enter",de,o,q),ue.target=N,ue.relatedTarget=Ue,P=ue),Ue=P,V&&de)t:{for(ue=V,C=de,O=0,N=ue;N;N=Hr(N))O++;for(N=0,P=C;P;P=Hr(P))N++;for(;0<O-N;)ue=Hr(ue),O--;for(;0<N-O;)C=Hr(C),N--;for(;O--;){if(ue===C||C!==null&&ue===C.alternate)break t;ue=Hr(ue),C=Hr(C)}ue=null}else ue=null;V!==null&&Hv(H,B,V,ue,!1),de!==null&&Ue!==null&&Hv(H,Ue,de,ue,!0)}}e:{if(B=_?Ba(_):window,V=B.nodeName&&B.nodeName.toLowerCase(),V==="select"||V==="input"&&B.type==="file")var se=cg;else if(lg(B))if(fg)se=NO;else{se=kO;var we=CO}else V=B.nodeName,!V||V.toLowerCase()!=="input"||B.type!=="checkbox"&&B.type!=="radio"?_&&mf(_.elementType)&&(se=cg):se=DO;if(se&&(se=se(i,_))){ug(H,se,o,q);break e}we&&we(i,B,_),i==="focusout"&&_&&B.type==="number"&&_.memoizedProps.value!=null&&pf(B,"number",B.value)}switch(we=_?Ba(_):window,i){case"focusin":(lg(we)||we.contentEditable==="true")&&(xr=we,Cf=_,Ia=null);break;case"focusout":Ia=Cf=xr=null;break;case"mousedown":kf=!0;break;case"contextmenu":case"mouseup":case"dragend":kf=!1,vg(H,o,q);break;case"selectionchange":if($O)break;case"keydown":case"keyup":vg(H,o,q)}var le;if(Ef)e:{switch(i){case"compositionstart":var ce="onCompositionStart";break e;case"compositionend":ce="onCompositionEnd";break e;case"compositionupdate":ce="onCompositionUpdate";break e}ce=void 0}else Sr?ag(i,o)&&(ce="onCompositionEnd"):i==="keydown"&&o.keyCode===229&&(ce="onCompositionStart");ce&&(ig&&o.locale!=="ko"&&(Sr||ce!=="onCompositionStart"?ce==="onCompositionEnd"&&Sr&&(le=Qy()):(Pi=q,Sf="value"in Pi?Pi.value:Pi.textContent,Sr=!0)),we=bu(_,ce),0<we.length&&(ce=new tg(ce,i,null,o,q),H.push({event:ce,listeners:we}),le?ce.data=le:(le=og(o),le!==null&&(ce.data=le)))),(le=TO?EO(i,o):RO(i,o))&&(ce=bu(_,"onBeforeInput"),0<ce.length&&(we=new tg("onBeforeInput","beforeinput",null,o,q),H.push({event:we,listeners:ce}),we.data=le)),yM(H,i,_,o,q)}Pv(H,r)})}function vo(i,r,o){return{instance:i,listener:r,currentTarget:o}}function bu(i,r){for(var o=r+"Capture",l=[];i!==null;){var f=i,m=f.stateNode;if(f=f.tag,f!==5&&f!==26&&f!==27||m===null||(f=La(i,o),f!=null&&l.unshift(vo(i,f,m)),f=La(i,r),f!=null&&l.push(vo(i,f,m))),i.tag===3)return l;i=i.return}return[]}function Hr(i){if(i===null)return null;do i=i.return;while(i&&i.tag!==5&&i.tag!==27);return i||null}function Hv(i,r,o,l,f){for(var m=r._reactName,b=[];o!==null&&o!==l;){var x=o,E=x.alternate,_=x.stateNode;if(x=x.tag,E!==null&&E===l)break;x!==5&&x!==26&&x!==27||_===null||(E=_,f?(_=La(o,m),_!=null&&b.unshift(vo(o,_,E))):f||(_=La(o,m),_!=null&&b.push(vo(o,_,E)))),o=o.return}b.length!==0&&i.push({event:r,listeners:b})}var SM=/\r\n?/g,xM=/\u0000|\uFFFD/g;function Gv(i){return(typeof i=="string"?i:""+i).replace(SM,`
|
|
62
|
-
`).replace(xM,"")}function Fv(i,r){return r=Gv(r),Gv(i)===r}function vu(){}function ze(i,r,o,l,f,m){switch(o){case"children":typeof l=="string"?r==="body"||r==="textarea"&&l===""||gr(i,l):(typeof l=="number"||typeof l=="bigint")&&r!=="body"&&gr(i,""+l);break;case"className":Tl(i,"class",l);break;case"tabIndex":Tl(i,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":Tl(i,o,l);break;case"style":Xy(i,l,m);break;case"data":if(r!=="object"){Tl(i,"data",l);break}case"src":case"href":if(l===""&&(r!=="a"||o!=="href")){i.removeAttribute(o);break}if(l==null||typeof l=="function"||typeof l=="symbol"||typeof l=="boolean"){i.removeAttribute(o);break}l=Ol(""+l),i.setAttribute(o,l);break;case"action":case"formAction":if(typeof l=="function"){i.setAttribute(o,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof m=="function"&&(o==="formAction"?(r!=="input"&&ze(i,r,"name",f.name,f,null),ze(i,r,"formEncType",f.formEncType,f,null),ze(i,r,"formMethod",f.formMethod,f,null),ze(i,r,"formTarget",f.formTarget,f,null)):(ze(i,r,"encType",f.encType,f,null),ze(i,r,"method",f.method,f,null),ze(i,r,"target",f.target,f,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){i.removeAttribute(o);break}l=Ol(""+l),i.setAttribute(o,l);break;case"onClick":l!=null&&(i.onclick=vu);break;case"onScroll":l!=null&&Ee("scroll",i);break;case"onScrollEnd":l!=null&&Ee("scrollend",i);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(s(61));if(o=l.__html,o!=null){if(f.children!=null)throw Error(s(60));i.innerHTML=o}}break;case"multiple":i.multiple=l&&typeof l!="function"&&typeof l!="symbol";break;case"muted":i.muted=l&&typeof l!="function"&&typeof l!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(l==null||typeof l=="function"||typeof l=="boolean"||typeof l=="symbol"){i.removeAttribute("xlink:href");break}o=Ol(""+l),i.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",o);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":l!=null&&typeof l!="function"&&typeof l!="symbol"?i.setAttribute(o,""+l):i.removeAttribute(o);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":l&&typeof l!="function"&&typeof l!="symbol"?i.setAttribute(o,""):i.removeAttribute(o);break;case"capture":case"download":l===!0?i.setAttribute(o,""):l!==!1&&l!=null&&typeof l!="function"&&typeof l!="symbol"?i.setAttribute(o,l):i.removeAttribute(o);break;case"cols":case"rows":case"size":case"span":l!=null&&typeof l!="function"&&typeof l!="symbol"&&!isNaN(l)&&1<=l?i.setAttribute(o,l):i.removeAttribute(o);break;case"rowSpan":case"start":l==null||typeof l=="function"||typeof l=="symbol"||isNaN(l)?i.removeAttribute(o):i.setAttribute(o,l);break;case"popover":Ee("beforetoggle",i),Ee("toggle",i),Al(i,"popover",l);break;case"xlinkActuate":li(i,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":li(i,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":li(i,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":li(i,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":li(i,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":li(i,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":li(i,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":li(i,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":li(i,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":Al(i,"is",l);break;case"innerText":case"textContent":break;default:(!(2<o.length)||o[0]!=="o"&&o[0]!=="O"||o[1]!=="n"&&o[1]!=="N")&&(o=JR.get(o)||o,Al(i,o,l))}}function Wd(i,r,o,l,f,m){switch(o){case"style":Xy(i,l,m);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(s(61));if(o=l.__html,o!=null){if(f.children!=null)throw Error(s(60));i.innerHTML=o}}break;case"children":typeof l=="string"?gr(i,l):(typeof l=="number"||typeof l=="bigint")&&gr(i,""+l);break;case"onScroll":l!=null&&Ee("scroll",i);break;case"onScrollEnd":l!=null&&Ee("scrollend",i);break;case"onClick":l!=null&&(i.onclick=vu);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!jy.hasOwnProperty(o))e:{if(o[0]==="o"&&o[1]==="n"&&(f=o.endsWith("Capture"),r=o.slice(2,f?o.length-7:void 0),m=i[Zt]||null,m=m!=null?m[o]:null,typeof m=="function"&&i.removeEventListener(r,m,f),typeof l=="function")){typeof m!="function"&&m!==null&&(o in i?i[o]=null:i.hasAttribute(o)&&i.removeAttribute(o)),i.addEventListener(r,l,f);break e}o in i?i[o]=l:l===!0?i.setAttribute(o,""):Al(i,o,l)}}}function _t(i,r,o){switch(r){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ee("error",i),Ee("load",i);var l=!1,f=!1,m;for(m in o)if(o.hasOwnProperty(m)){var b=o[m];if(b!=null)switch(m){case"src":l=!0;break;case"srcSet":f=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(s(137,r));default:ze(i,r,m,b,o,null)}}f&&ze(i,r,"srcSet",o.srcSet,o,null),l&&ze(i,r,"src",o.src,o,null);return;case"input":Ee("invalid",i);var x=m=b=f=null,E=null,_=null;for(l in o)if(o.hasOwnProperty(l)){var q=o[l];if(q!=null)switch(l){case"name":f=q;break;case"type":b=q;break;case"checked":E=q;break;case"defaultChecked":_=q;break;case"value":m=q;break;case"defaultValue":x=q;break;case"children":case"dangerouslySetInnerHTML":if(q!=null)throw Error(s(137,r));break;default:ze(i,r,l,q,o,null)}}Hy(i,m,x,E,_,b,f,!1),El(i);return;case"select":Ee("invalid",i),l=b=m=null;for(f in o)if(o.hasOwnProperty(f)&&(x=o[f],x!=null))switch(f){case"value":m=x;break;case"defaultValue":b=x;break;case"multiple":l=x;default:ze(i,r,f,x,o,null)}r=m,o=b,i.multiple=!!l,r!=null?yr(i,!!l,r,!1):o!=null&&yr(i,!!l,o,!0);return;case"textarea":Ee("invalid",i),m=f=l=null;for(b in o)if(o.hasOwnProperty(b)&&(x=o[b],x!=null))switch(b){case"value":l=x;break;case"defaultValue":f=x;break;case"children":m=x;break;case"dangerouslySetInnerHTML":if(x!=null)throw Error(s(91));break;default:ze(i,r,b,x,o,null)}Fy(i,l,f,m),El(i);return;case"option":for(E in o)if(o.hasOwnProperty(E)&&(l=o[E],l!=null))switch(E){case"selected":i.selected=l&&typeof l!="function"&&typeof l!="symbol";break;default:ze(i,r,E,l,o,null)}return;case"dialog":Ee("beforetoggle",i),Ee("toggle",i),Ee("cancel",i),Ee("close",i);break;case"iframe":case"object":Ee("load",i);break;case"video":case"audio":for(l=0;l<bo.length;l++)Ee(bo[l],i);break;case"image":Ee("error",i),Ee("load",i);break;case"details":Ee("toggle",i);break;case"embed":case"source":case"link":Ee("error",i),Ee("load",i);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(_ in o)if(o.hasOwnProperty(_)&&(l=o[_],l!=null))switch(_){case"children":case"dangerouslySetInnerHTML":throw Error(s(137,r));default:ze(i,r,_,l,o,null)}return;default:if(mf(r)){for(q in o)o.hasOwnProperty(q)&&(l=o[q],l!==void 0&&Wd(i,r,q,l,o,void 0));return}}for(x in o)o.hasOwnProperty(x)&&(l=o[x],l!=null&&ze(i,r,x,l,o,null))}function wM(i,r,o,l){switch(r){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var f=null,m=null,b=null,x=null,E=null,_=null,q=null;for(V in o){var H=o[V];if(o.hasOwnProperty(V)&&H!=null)switch(V){case"checked":break;case"value":break;case"defaultValue":E=H;default:l.hasOwnProperty(V)||ze(i,r,V,null,l,H)}}for(var B in l){var V=l[B];if(H=o[B],l.hasOwnProperty(B)&&(V!=null||H!=null))switch(B){case"type":m=V;break;case"name":f=V;break;case"checked":_=V;break;case"defaultChecked":q=V;break;case"value":b=V;break;case"defaultValue":x=V;break;case"children":case"dangerouslySetInnerHTML":if(V!=null)throw Error(s(137,r));break;default:V!==H&&ze(i,r,B,V,l,H)}}hf(i,b,x,E,_,q,m,f);return;case"select":V=b=x=B=null;for(m in o)if(E=o[m],o.hasOwnProperty(m)&&E!=null)switch(m){case"value":break;case"multiple":V=E;default:l.hasOwnProperty(m)||ze(i,r,m,null,l,E)}for(f in l)if(m=l[f],E=o[f],l.hasOwnProperty(f)&&(m!=null||E!=null))switch(f){case"value":B=m;break;case"defaultValue":x=m;break;case"multiple":b=m;default:m!==E&&ze(i,r,f,m,l,E)}r=x,o=b,l=V,B!=null?yr(i,!!o,B,!1):!!l!=!!o&&(r!=null?yr(i,!!o,r,!0):yr(i,!!o,o?[]:"",!1));return;case"textarea":V=B=null;for(x in o)if(f=o[x],o.hasOwnProperty(x)&&f!=null&&!l.hasOwnProperty(x))switch(x){case"value":break;case"children":break;default:ze(i,r,x,null,l,f)}for(b in l)if(f=l[b],m=o[b],l.hasOwnProperty(b)&&(f!=null||m!=null))switch(b){case"value":B=f;break;case"defaultValue":V=f;break;case"children":break;case"dangerouslySetInnerHTML":if(f!=null)throw Error(s(91));break;default:f!==m&&ze(i,r,b,f,l,m)}Gy(i,B,V);return;case"option":for(var de in o)if(B=o[de],o.hasOwnProperty(de)&&B!=null&&!l.hasOwnProperty(de))switch(de){case"selected":i.selected=!1;break;default:ze(i,r,de,null,l,B)}for(E in l)if(B=l[E],V=o[E],l.hasOwnProperty(E)&&B!==V&&(B!=null||V!=null))switch(E){case"selected":i.selected=B&&typeof B!="function"&&typeof B!="symbol";break;default:ze(i,r,E,B,l,V)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var ue in o)B=o[ue],o.hasOwnProperty(ue)&&B!=null&&!l.hasOwnProperty(ue)&&ze(i,r,ue,null,l,B);for(_ in l)if(B=l[_],V=o[_],l.hasOwnProperty(_)&&B!==V&&(B!=null||V!=null))switch(_){case"children":case"dangerouslySetInnerHTML":if(B!=null)throw Error(s(137,r));break;default:ze(i,r,_,B,l,V)}return;default:if(mf(r)){for(var Ue in o)B=o[Ue],o.hasOwnProperty(Ue)&&B!==void 0&&!l.hasOwnProperty(Ue)&&Wd(i,r,Ue,void 0,l,B);for(q in l)B=l[q],V=o[q],!l.hasOwnProperty(q)||B===V||B===void 0&&V===void 0||Wd(i,r,q,B,l,V);return}}for(var C in o)B=o[C],o.hasOwnProperty(C)&&B!=null&&!l.hasOwnProperty(C)&&ze(i,r,C,null,l,B);for(H in l)B=l[H],V=o[H],!l.hasOwnProperty(H)||B===V||B==null&&V==null||ze(i,r,H,B,l,V)}var eh=null,th=null;function Su(i){return i.nodeType===9?i:i.ownerDocument}function Yv(i){switch(i){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Xv(i,r){if(i===0)switch(r){case"svg":return 1;case"math":return 2;default:return 0}return i===1&&r==="foreignObject"?0:i}function nh(i,r){return i==="textarea"||i==="noscript"||typeof r.children=="string"||typeof r.children=="number"||typeof r.children=="bigint"||typeof r.dangerouslySetInnerHTML=="object"&&r.dangerouslySetInnerHTML!==null&&r.dangerouslySetInnerHTML.__html!=null}var ih=null;function AM(){var i=window.event;return i&&i.type==="popstate"?i===ih?!1:(ih=i,!0):(ih=null,!1)}var Zv=typeof setTimeout=="function"?setTimeout:void 0,TM=typeof clearTimeout=="function"?clearTimeout:void 0,Jv=typeof Promise=="function"?Promise:void 0,EM=typeof queueMicrotask=="function"?queueMicrotask:typeof Jv<"u"?function(i){return Jv.resolve(null).then(i).catch(RM)}:Zv;function RM(i){setTimeout(function(){throw i})}function rs(i){return i==="head"}function Qv(i,r){var o=r,l=0,f=0;do{var m=o.nextSibling;if(i.removeChild(o),m&&m.nodeType===8)if(o=m.data,o==="/$"){if(0<l&&8>l){o=l;var b=i.ownerDocument;if(o&1&&So(b.documentElement),o&2&&So(b.body),o&4)for(o=b.head,So(o),b=o.firstChild;b;){var x=b.nextSibling,E=b.nodeName;b[$a]||E==="SCRIPT"||E==="STYLE"||E==="LINK"&&b.rel.toLowerCase()==="stylesheet"||o.removeChild(b),b=x}}if(f===0){i.removeChild(m),Mo(r);return}f--}else o==="$"||o==="$?"||o==="$!"?f++:l=o.charCodeAt(0)-48;else l=0;o=m}while(o);Mo(r)}function sh(i){var r=i.firstChild;for(r&&r.nodeType===10&&(r=r.nextSibling);r;){var o=r;switch(r=r.nextSibling,o.nodeName){case"HTML":case"HEAD":case"BODY":sh(o),uf(o);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(o.rel.toLowerCase()==="stylesheet")continue}i.removeChild(o)}}function OM(i,r,o,l){for(;i.nodeType===1;){var f=o;if(i.nodeName.toLowerCase()!==r.toLowerCase()){if(!l&&(i.nodeName!=="INPUT"||i.type!=="hidden"))break}else if(l){if(!i[$a])switch(r){case"meta":if(!i.hasAttribute("itemprop"))break;return i;case"link":if(m=i.getAttribute("rel"),m==="stylesheet"&&i.hasAttribute("data-precedence"))break;if(m!==f.rel||i.getAttribute("href")!==(f.href==null||f.href===""?null:f.href)||i.getAttribute("crossorigin")!==(f.crossOrigin==null?null:f.crossOrigin)||i.getAttribute("title")!==(f.title==null?null:f.title))break;return i;case"style":if(i.hasAttribute("data-precedence"))break;return i;case"script":if(m=i.getAttribute("src"),(m!==(f.src==null?null:f.src)||i.getAttribute("type")!==(f.type==null?null:f.type)||i.getAttribute("crossorigin")!==(f.crossOrigin==null?null:f.crossOrigin))&&m&&i.hasAttribute("async")&&!i.hasAttribute("itemprop"))break;return i;default:return i}}else if(r==="input"&&i.type==="hidden"){var m=f.name==null?null:""+f.name;if(f.type==="hidden"&&i.getAttribute("name")===m)return i}else return i;if(i=Vn(i.nextSibling),i===null)break}return null}function MM(i,r,o){if(r==="")return null;for(;i.nodeType!==3;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!o||(i=Vn(i.nextSibling),i===null))return null;return i}function rh(i){return i.data==="$!"||i.data==="$?"&&i.ownerDocument.readyState==="complete"}function CM(i,r){var o=i.ownerDocument;if(i.data!=="$?"||o.readyState==="complete")r();else{var l=function(){r(),o.removeEventListener("DOMContentLoaded",l)};o.addEventListener("DOMContentLoaded",l),i._reactRetry=l}}function Vn(i){for(;i!=null;i=i.nextSibling){var r=i.nodeType;if(r===1||r===3)break;if(r===8){if(r=i.data,r==="$"||r==="$!"||r==="$?"||r==="F!"||r==="F")break;if(r==="/$")return null}}return i}var ah=null;function Wv(i){i=i.previousSibling;for(var r=0;i;){if(i.nodeType===8){var o=i.data;if(o==="$"||o==="$!"||o==="$?"){if(r===0)return i;r--}else o==="/$"&&r++}i=i.previousSibling}return null}function e0(i,r,o){switch(r=Su(o),i){case"html":if(i=r.documentElement,!i)throw Error(s(452));return i;case"head":if(i=r.head,!i)throw Error(s(453));return i;case"body":if(i=r.body,!i)throw Error(s(454));return i;default:throw Error(s(451))}}function So(i){for(var r=i.attributes;r.length;)i.removeAttributeNode(r[0]);uf(i)}var Mn=new Map,t0=new Set;function xu(i){return typeof i.getRootNode=="function"?i.getRootNode():i.nodeType===9?i:i.ownerDocument}var wi=I.d;I.d={f:kM,r:DM,D:NM,C:_M,L:$M,m:BM,X:VM,S:LM,M:jM};function kM(){var i=wi.f(),r=du();return i||r}function DM(i){var r=dr(i);r!==null&&r.tag===5&&r.type==="form"?xb(r):wi.r(i)}var Gr=typeof document>"u"?null:document;function n0(i,r,o){var l=Gr;if(l&&typeof r=="string"&&r){var f=xn(r);f='link[rel="'+i+'"][href="'+f+'"]',typeof o=="string"&&(f+='[crossorigin="'+o+'"]'),t0.has(f)||(t0.add(f),i={rel:i,crossOrigin:o,href:r},l.querySelector(f)===null&&(r=l.createElement("link"),_t(r,"link",i),Tt(r),l.head.appendChild(r)))}}function NM(i){wi.D(i),n0("dns-prefetch",i,null)}function _M(i,r){wi.C(i,r),n0("preconnect",i,r)}function $M(i,r,o){wi.L(i,r,o);var l=Gr;if(l&&i&&r){var f='link[rel="preload"][as="'+xn(r)+'"]';r==="image"&&o&&o.imageSrcSet?(f+='[imagesrcset="'+xn(o.imageSrcSet)+'"]',typeof o.imageSizes=="string"&&(f+='[imagesizes="'+xn(o.imageSizes)+'"]')):f+='[href="'+xn(i)+'"]';var m=f;switch(r){case"style":m=Fr(i);break;case"script":m=Yr(i)}Mn.has(m)||(i=y({rel:"preload",href:r==="image"&&o&&o.imageSrcSet?void 0:i,as:r},o),Mn.set(m,i),l.querySelector(f)!==null||r==="style"&&l.querySelector(xo(m))||r==="script"&&l.querySelector(wo(m))||(r=l.createElement("link"),_t(r,"link",i),Tt(r),l.head.appendChild(r)))}}function BM(i,r){wi.m(i,r);var o=Gr;if(o&&i){var l=r&&typeof r.as=="string"?r.as:"script",f='link[rel="modulepreload"][as="'+xn(l)+'"][href="'+xn(i)+'"]',m=f;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":m=Yr(i)}if(!Mn.has(m)&&(i=y({rel:"modulepreload",href:i},r),Mn.set(m,i),o.querySelector(f)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(o.querySelector(wo(m)))return}l=o.createElement("link"),_t(l,"link",i),Tt(l),o.head.appendChild(l)}}}function LM(i,r,o){wi.S(i,r,o);var l=Gr;if(l&&i){var f=hr(l).hoistableStyles,m=Fr(i);r=r||"default";var b=f.get(m);if(!b){var x={loading:0,preload:null};if(b=l.querySelector(xo(m)))x.loading=5;else{i=y({rel:"stylesheet",href:i,"data-precedence":r},o),(o=Mn.get(m))&&oh(i,o);var E=b=l.createElement("link");Tt(E),_t(E,"link",i),E._p=new Promise(function(_,q){E.onload=_,E.onerror=q}),E.addEventListener("load",function(){x.loading|=1}),E.addEventListener("error",function(){x.loading|=2}),x.loading|=4,wu(b,r,l)}b={type:"stylesheet",instance:b,count:1,state:x},f.set(m,b)}}}function VM(i,r){wi.X(i,r);var o=Gr;if(o&&i){var l=hr(o).hoistableScripts,f=Yr(i),m=l.get(f);m||(m=o.querySelector(wo(f)),m||(i=y({src:i,async:!0},r),(r=Mn.get(f))&&lh(i,r),m=o.createElement("script"),Tt(m),_t(m,"link",i),o.head.appendChild(m)),m={type:"script",instance:m,count:1,state:null},l.set(f,m))}}function jM(i,r){wi.M(i,r);var o=Gr;if(o&&i){var l=hr(o).hoistableScripts,f=Yr(i),m=l.get(f);m||(m=o.querySelector(wo(f)),m||(i=y({src:i,async:!0,type:"module"},r),(r=Mn.get(f))&&lh(i,r),m=o.createElement("script"),Tt(m),_t(m,"link",i),o.head.appendChild(m)),m={type:"script",instance:m,count:1,state:null},l.set(f,m))}}function i0(i,r,o,l){var f=(f=re.current)?xu(f):null;if(!f)throw Error(s(446));switch(i){case"meta":case"title":return null;case"style":return typeof o.precedence=="string"&&typeof o.href=="string"?(r=Fr(o.href),o=hr(f).hoistableStyles,l=o.get(r),l||(l={type:"style",instance:null,count:0,state:null},o.set(r,l)),l):{type:"void",instance:null,count:0,state:null};case"link":if(o.rel==="stylesheet"&&typeof o.href=="string"&&typeof o.precedence=="string"){i=Fr(o.href);var m=hr(f).hoistableStyles,b=m.get(i);if(b||(f=f.ownerDocument||f,b={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},m.set(i,b),(m=f.querySelector(xo(i)))&&!m._p&&(b.instance=m,b.state.loading=5),Mn.has(i)||(o={rel:"preload",as:"style",href:o.href,crossOrigin:o.crossOrigin,integrity:o.integrity,media:o.media,hrefLang:o.hrefLang,referrerPolicy:o.referrerPolicy},Mn.set(i,o),m||zM(f,i,o,b.state))),r&&l===null)throw Error(s(528,""));return b}if(r&&l!==null)throw Error(s(529,""));return null;case"script":return r=o.async,o=o.src,typeof o=="string"&&r&&typeof r!="function"&&typeof r!="symbol"?(r=Yr(o),o=hr(f).hoistableScripts,l=o.get(r),l||(l={type:"script",instance:null,count:0,state:null},o.set(r,l)),l):{type:"void",instance:null,count:0,state:null};default:throw Error(s(444,i))}}function Fr(i){return'href="'+xn(i)+'"'}function xo(i){return'link[rel="stylesheet"]['+i+"]"}function s0(i){return y({},i,{"data-precedence":i.precedence,precedence:null})}function zM(i,r,o,l){i.querySelector('link[rel="preload"][as="style"]['+r+"]")?l.loading=1:(r=i.createElement("link"),l.preload=r,r.addEventListener("load",function(){return l.loading|=1}),r.addEventListener("error",function(){return l.loading|=2}),_t(r,"link",o),Tt(r),i.head.appendChild(r))}function Yr(i){return'[src="'+xn(i)+'"]'}function wo(i){return"script[async]"+i}function r0(i,r,o){if(r.count++,r.instance===null)switch(r.type){case"style":var l=i.querySelector('style[data-href~="'+xn(o.href)+'"]');if(l)return r.instance=l,Tt(l),l;var f=y({},o,{"data-href":o.href,"data-precedence":o.precedence,href:null,precedence:null});return l=(i.ownerDocument||i).createElement("style"),Tt(l),_t(l,"style",f),wu(l,o.precedence,i),r.instance=l;case"stylesheet":f=Fr(o.href);var m=i.querySelector(xo(f));if(m)return r.state.loading|=4,r.instance=m,Tt(m),m;l=s0(o),(f=Mn.get(f))&&oh(l,f),m=(i.ownerDocument||i).createElement("link"),Tt(m);var b=m;return b._p=new Promise(function(x,E){b.onload=x,b.onerror=E}),_t(m,"link",l),r.state.loading|=4,wu(m,o.precedence,i),r.instance=m;case"script":return m=Yr(o.src),(f=i.querySelector(wo(m)))?(r.instance=f,Tt(f),f):(l=o,(f=Mn.get(m))&&(l=y({},o),lh(l,f)),i=i.ownerDocument||i,f=i.createElement("script"),Tt(f),_t(f,"link",l),i.head.appendChild(f),r.instance=f);case"void":return null;default:throw Error(s(443,r.type))}else r.type==="stylesheet"&&(r.state.loading&4)===0&&(l=r.instance,r.state.loading|=4,wu(l,o.precedence,i));return r.instance}function wu(i,r,o){for(var l=o.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),f=l.length?l[l.length-1]:null,m=f,b=0;b<l.length;b++){var x=l[b];if(x.dataset.precedence===r)m=x;else if(m!==f)break}m?m.parentNode.insertBefore(i,m.nextSibling):(r=o.nodeType===9?o.head:o,r.insertBefore(i,r.firstChild))}function oh(i,r){i.crossOrigin==null&&(i.crossOrigin=r.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=r.referrerPolicy),i.title==null&&(i.title=r.title)}function lh(i,r){i.crossOrigin==null&&(i.crossOrigin=r.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=r.referrerPolicy),i.integrity==null&&(i.integrity=r.integrity)}var Au=null;function a0(i,r,o){if(Au===null){var l=new Map,f=Au=new Map;f.set(o,l)}else f=Au,l=f.get(o),l||(l=new Map,f.set(o,l));if(l.has(i))return l;for(l.set(i,null),o=o.getElementsByTagName(i),f=0;f<o.length;f++){var m=o[f];if(!(m[$a]||m[Vt]||i==="link"&&m.getAttribute("rel")==="stylesheet")&&m.namespaceURI!=="http://www.w3.org/2000/svg"){var b=m.getAttribute(r)||"";b=i+b;var x=l.get(b);x?x.push(m):l.set(b,[m])}}return l}function o0(i,r,o){i=i.ownerDocument||i,i.head.insertBefore(o,r==="title"?i.querySelector("head > title"):null)}function UM(i,r,o){if(o===1||r.itemProp!=null)return!1;switch(i){case"meta":case"title":return!0;case"style":if(typeof r.precedence!="string"||typeof r.href!="string"||r.href==="")break;return!0;case"link":if(typeof r.rel!="string"||typeof r.href!="string"||r.href===""||r.onLoad||r.onError)break;switch(r.rel){case"stylesheet":return i=r.disabled,typeof r.precedence=="string"&&i==null;default:return!0}case"script":if(r.async&&typeof r.async!="function"&&typeof r.async!="symbol"&&!r.onLoad&&!r.onError&&r.src&&typeof r.src=="string")return!0}return!1}function l0(i){return!(i.type==="stylesheet"&&(i.state.loading&3)===0)}var Ao=null;function qM(){}function KM(i,r,o){if(Ao===null)throw Error(s(475));var l=Ao;if(r.type==="stylesheet"&&(typeof o.media!="string"||matchMedia(o.media).matches!==!1)&&(r.state.loading&4)===0){if(r.instance===null){var f=Fr(o.href),m=i.querySelector(xo(f));if(m){i=m._p,i!==null&&typeof i=="object"&&typeof i.then=="function"&&(l.count++,l=Tu.bind(l),i.then(l,l)),r.state.loading|=4,r.instance=m,Tt(m);return}m=i.ownerDocument||i,o=s0(o),(f=Mn.get(f))&&oh(o,f),m=m.createElement("link"),Tt(m);var b=m;b._p=new Promise(function(x,E){b.onload=x,b.onerror=E}),_t(m,"link",o),r.instance=m}l.stylesheets===null&&(l.stylesheets=new Map),l.stylesheets.set(r,i),(i=r.state.preload)&&(r.state.loading&3)===0&&(l.count++,r=Tu.bind(l),i.addEventListener("load",r),i.addEventListener("error",r))}}function PM(){if(Ao===null)throw Error(s(475));var i=Ao;return i.stylesheets&&i.count===0&&uh(i,i.stylesheets),0<i.count?function(r){var o=setTimeout(function(){if(i.stylesheets&&uh(i,i.stylesheets),i.unsuspend){var l=i.unsuspend;i.unsuspend=null,l()}},6e4);return i.unsuspend=r,function(){i.unsuspend=null,clearTimeout(o)}}:null}function Tu(){if(this.count--,this.count===0){if(this.stylesheets)uh(this,this.stylesheets);else if(this.unsuspend){var i=this.unsuspend;this.unsuspend=null,i()}}}var Eu=null;function uh(i,r){i.stylesheets=null,i.unsuspend!==null&&(i.count++,Eu=new Map,r.forEach(IM,i),Eu=null,Tu.call(i))}function IM(i,r){if(!(r.state.loading&4)){var o=Eu.get(i);if(o)var l=o.get(null);else{o=new Map,Eu.set(i,o);for(var f=i.querySelectorAll("link[data-precedence],style[data-precedence]"),m=0;m<f.length;m++){var b=f[m];(b.nodeName==="LINK"||b.getAttribute("media")!=="not all")&&(o.set(b.dataset.precedence,b),l=b)}l&&o.set(null,l)}f=r.instance,b=f.getAttribute("data-precedence"),m=o.get(b)||l,m===l&&o.set(null,f),o.set(b,f),this.count++,l=Tu.bind(this),f.addEventListener("load",l),f.addEventListener("error",l),m?m.parentNode.insertBefore(f,m.nextSibling):(i=i.nodeType===9?i.head:i,i.insertBefore(f,i.firstChild)),r.state.loading|=4}}var To={$$typeof:k,Provider:null,Consumer:null,_currentValue:G,_currentValue2:G,_threadCount:0};function HM(i,r,o,l,f,m,b,x){this.tag=1,this.containerInfo=i,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=rf(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=rf(0),this.hiddenUpdates=rf(null),this.identifierPrefix=l,this.onUncaughtError=f,this.onCaughtError=m,this.onRecoverableError=b,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=x,this.incompleteTransitions=new Map}function u0(i,r,o,l,f,m,b,x,E,_,q,H){return i=new HM(i,r,o,b,x,E,_,H),r=1,m===!0&&(r|=24),m=cn(3,null,null,r),i.current=m,m.stateNode=i,r=If(),r.refCount++,i.pooledCache=r,r.refCount++,m.memoizedState={element:l,isDehydrated:o,cache:r},Yf(m),i}function c0(i){return i?(i=Er,i):Er}function f0(i,r,o,l,f,m){f=c0(f),l.context===null?l.context=f:l.pendingContext=f,l=Gi(r),l.payload={element:o},m=m===void 0?null:m,m!==null&&(l.callback=m),o=Fi(i,l,r),o!==null&&(mn(o,i,r),Wa(o,i,r))}function d0(i,r){if(i=i.memoizedState,i!==null&&i.dehydrated!==null){var o=i.retryLane;i.retryLane=o!==0&&o<r?o:r}}function ch(i,r){d0(i,r),(i=i.alternate)&&d0(i,r)}function h0(i){if(i.tag===13){var r=Tr(i,67108864);r!==null&&mn(r,i,67108864),ch(i,67108864)}}var Ru=!0;function GM(i,r,o,l){var f=L.T;L.T=null;var m=I.p;try{I.p=2,fh(i,r,o,l)}finally{I.p=m,L.T=f}}function FM(i,r,o,l){var f=L.T;L.T=null;var m=I.p;try{I.p=8,fh(i,r,o,l)}finally{I.p=m,L.T=f}}function fh(i,r,o,l){if(Ru){var f=dh(l);if(f===null)Qd(i,r,l,Ou,o),m0(i,l);else if(XM(f,i,r,o,l))l.stopPropagation();else if(m0(i,l),r&4&&-1<YM.indexOf(i)){for(;f!==null;){var m=dr(f);if(m!==null)switch(m.tag){case 3:if(m=m.stateNode,m.current.memoizedState.isDehydrated){var b=Es(m.pendingLanes);if(b!==0){var x=m;for(x.pendingLanes|=2,x.entangledLanes|=2;b;){var E=1<<31-ln(b);x.entanglements[1]|=E,b&=~E}Xn(m),(Le&6)===0&&(cu=Ke()+500,go(0))}}break;case 13:x=Tr(m,2),x!==null&&mn(x,m,2),du(),ch(m,2)}if(m=dh(l),m===null&&Qd(i,r,l,Ou,o),m===f)break;f=m}f!==null&&l.stopPropagation()}else Qd(i,r,l,null,o)}}function dh(i){return i=gf(i),hh(i)}var Ou=null;function hh(i){if(Ou=null,i=fr(i),i!==null){var r=u(i);if(r===null)i=null;else{var o=r.tag;if(o===13){if(i=c(r),i!==null)return i;i=null}else if(o===3){if(r.stateNode.current.memoizedState.isDehydrated)return r.tag===3?r.stateNode.containerInfo:null;i=null}else r!==i&&(i=null)}}return Ou=i,null}function p0(i){switch(i){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(kt()){case We:return 2;case Ze:return 8;case an:case $R:return 32;case ky:return 268435456;default:return 32}default:return 32}}var ph=!1,as=null,os=null,ls=null,Eo=new Map,Ro=new Map,us=[],YM="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function m0(i,r){switch(i){case"focusin":case"focusout":as=null;break;case"dragenter":case"dragleave":os=null;break;case"mouseover":case"mouseout":ls=null;break;case"pointerover":case"pointerout":Eo.delete(r.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ro.delete(r.pointerId)}}function Oo(i,r,o,l,f,m){return i===null||i.nativeEvent!==m?(i={blockedOn:r,domEventName:o,eventSystemFlags:l,nativeEvent:m,targetContainers:[f]},r!==null&&(r=dr(r),r!==null&&h0(r)),i):(i.eventSystemFlags|=l,r=i.targetContainers,f!==null&&r.indexOf(f)===-1&&r.push(f),i)}function XM(i,r,o,l,f){switch(r){case"focusin":return as=Oo(as,i,r,o,l,f),!0;case"dragenter":return os=Oo(os,i,r,o,l,f),!0;case"mouseover":return ls=Oo(ls,i,r,o,l,f),!0;case"pointerover":var m=f.pointerId;return Eo.set(m,Oo(Eo.get(m)||null,i,r,o,l,f)),!0;case"gotpointercapture":return m=f.pointerId,Ro.set(m,Oo(Ro.get(m)||null,i,r,o,l,f)),!0}return!1}function y0(i){var r=fr(i.target);if(r!==null){var o=u(r);if(o!==null){if(r=o.tag,r===13){if(r=c(o),r!==null){i.blockedOn=r,KR(i.priority,function(){if(o.tag===13){var l=pn();l=af(l);var f=Tr(o,l);f!==null&&mn(f,o,l),ch(o,l)}});return}}else if(r===3&&o.stateNode.current.memoizedState.isDehydrated){i.blockedOn=o.tag===3?o.stateNode.containerInfo:null;return}}}i.blockedOn=null}function Mu(i){if(i.blockedOn!==null)return!1;for(var r=i.targetContainers;0<r.length;){var o=dh(i.nativeEvent);if(o===null){o=i.nativeEvent;var l=new o.constructor(o.type,o);yf=l,o.target.dispatchEvent(l),yf=null}else return r=dr(o),r!==null&&h0(r),i.blockedOn=o,!1;r.shift()}return!0}function g0(i,r,o){Mu(i)&&o.delete(r)}function ZM(){ph=!1,as!==null&&Mu(as)&&(as=null),os!==null&&Mu(os)&&(os=null),ls!==null&&Mu(ls)&&(ls=null),Eo.forEach(g0),Ro.forEach(g0)}function Cu(i,r){i.blockedOn===r&&(i.blockedOn=null,ph||(ph=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,ZM)))}var ku=null;function b0(i){ku!==i&&(ku=i,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){ku===i&&(ku=null);for(var r=0;r<i.length;r+=3){var o=i[r],l=i[r+1],f=i[r+2];if(typeof l!="function"){if(hh(l||o)===null)continue;break}var m=dr(o);m!==null&&(i.splice(r,3),r-=3,hd(m,{pending:!0,data:f,method:o.method,action:l},l,f))}}))}function Mo(i){function r(E){return Cu(E,i)}as!==null&&Cu(as,i),os!==null&&Cu(os,i),ls!==null&&Cu(ls,i),Eo.forEach(r),Ro.forEach(r);for(var o=0;o<us.length;o++){var l=us[o];l.blockedOn===i&&(l.blockedOn=null)}for(;0<us.length&&(o=us[0],o.blockedOn===null);)y0(o),o.blockedOn===null&&us.shift();if(o=(i.ownerDocument||i).$$reactFormReplay,o!=null)for(l=0;l<o.length;l+=3){var f=o[l],m=o[l+1],b=f[Zt]||null;if(typeof m=="function")b||b0(o);else if(b){var x=null;if(m&&m.hasAttribute("formAction")){if(f=m,b=m[Zt]||null)x=b.formAction;else if(hh(f)!==null)continue}else x=b.action;typeof x=="function"?o[l+1]=x:(o.splice(l,3),l-=3),b0(o)}}}function mh(i){this._internalRoot=i}Du.prototype.render=mh.prototype.render=function(i){var r=this._internalRoot;if(r===null)throw Error(s(409));var o=r.current,l=pn();f0(o,l,i,r,null,null)},Du.prototype.unmount=mh.prototype.unmount=function(){var i=this._internalRoot;if(i!==null){this._internalRoot=null;var r=i.containerInfo;f0(i.current,2,null,i,null,null),du(),r[cr]=null}};function Du(i){this._internalRoot=i}Du.prototype.unstable_scheduleHydration=function(i){if(i){var r=By();i={blockedOn:null,target:i,priority:r};for(var o=0;o<us.length&&r!==0&&r<us[o].priority;o++);us.splice(o,0,i),o===0&&y0(i)}};var v0=t.version;if(v0!=="19.1.0")throw Error(s(527,v0,"19.1.0"));I.findDOMNode=function(i){var r=i._reactInternals;if(r===void 0)throw typeof i.render=="function"?Error(s(188)):(i=Object.keys(i).join(","),Error(s(268,i)));return i=h(r),i=i!==null?p(i):null,i=i===null?null:i.stateNode,i};var JM={bundleType:0,version:"19.1.0",rendererPackageName:"react-dom",currentDispatcherRef:L,reconcilerVersion:"19.1.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Nu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Nu.isDisabled&&Nu.supportsFiber)try{Da=Nu.inject(JM),on=Nu}catch{}}return ko.createRoot=function(i,r){if(!a(i))throw Error(s(299));var o=!1,l="",f=Bb,m=Lb,b=Vb,x=null;return r!=null&&(r.unstable_strictMode===!0&&(o=!0),r.identifierPrefix!==void 0&&(l=r.identifierPrefix),r.onUncaughtError!==void 0&&(f=r.onUncaughtError),r.onCaughtError!==void 0&&(m=r.onCaughtError),r.onRecoverableError!==void 0&&(b=r.onRecoverableError),r.unstable_transitionCallbacks!==void 0&&(x=r.unstable_transitionCallbacks)),r=u0(i,1,!1,null,null,o,l,f,m,b,x,null),i[cr]=r.current,Jd(i),new mh(r)},ko.hydrateRoot=function(i,r,o){if(!a(i))throw Error(s(299));var l=!1,f="",m=Bb,b=Lb,x=Vb,E=null,_=null;return o!=null&&(o.unstable_strictMode===!0&&(l=!0),o.identifierPrefix!==void 0&&(f=o.identifierPrefix),o.onUncaughtError!==void 0&&(m=o.onUncaughtError),o.onCaughtError!==void 0&&(b=o.onCaughtError),o.onRecoverableError!==void 0&&(x=o.onRecoverableError),o.unstable_transitionCallbacks!==void 0&&(E=o.unstable_transitionCallbacks),o.formState!==void 0&&(_=o.formState)),r=u0(i,1,!0,r,o??null,l,f,m,b,x,E,_),r.context=c0(null),o=r.current,l=pn(),l=af(l),f=Gi(l),f.callback=null,Fi(o,f,l),o=l,r.current.lanes=o,_a(r,o),Xn(r),i[cr]=r.current,Jd(i),new Du(r)},ko.version="19.1.0",ko}var N0;function mk(){if(N0)return vh.exports;N0=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),vh.exports=pk(),vh.exports}var yk=mk();function Lc(){return typeof window<"u"}function As(e){return hw(e)?(e.nodeName||"").toLowerCase():"#document"}function bn(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function ri(e){var t;return(t=(hw(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function hw(e){return Lc()?e instanceof Node||e instanceof bn(e).Node:!1}function ft(e){return Lc()?e instanceof Element||e instanceof bn(e).Element:!1}function wt(e){return Lc()?e instanceof HTMLElement||e instanceof bn(e).HTMLElement:!1}function up(e){return!Lc()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof bn(e).ShadowRoot}function rl(e){const{overflow:t,overflowX:n,overflowY:s,display:a}=$n(e);return/auto|scroll|overlay|hidden|clip/.test(t+s+n)&&!["inline","contents"].includes(a)}function gk(e){return["table","td","th"].includes(As(e))}function Vc(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function Sm(e){const t=jc(),n=ft(e)?$n(e):e;return["transform","translate","scale","rotate","perspective"].some(s=>n[s]?n[s]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||["transform","translate","scale","rotate","perspective","filter"].some(s=>(n.willChange||"").includes(s))||["paint","layout","strict","content"].some(s=>(n.contain||"").includes(s))}function bk(e){let t=Di(e);for(;wt(t)&&!Mi(t);){if(Sm(t))return t;if(Vc(t))return null;t=Di(t)}return null}function jc(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Mi(e){return["html","body","#document"].includes(As(e))}function $n(e){return bn(e).getComputedStyle(e)}function zc(e){return ft(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Di(e){if(As(e)==="html")return e;const t=e.assignedSlot||e.parentNode||up(e)&&e.host||ri(e);return up(t)?t.host:t}function pw(e){const t=Di(e);return Mi(t)?e.ownerDocument?e.ownerDocument.body:e.body:wt(t)&&rl(t)?t:pw(t)}function ys(e,t,n){var s;t===void 0&&(t=[]),n===void 0&&(n=!0);const a=pw(e),u=a===((s=e.ownerDocument)==null?void 0:s.body),c=bn(a);if(u){const d=cp(c);return t.concat(c,c.visualViewport||[],rl(a)?a:[],d&&n?ys(d):[])}return t.concat(a,ys(a,[],n))}function cp(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}const oc=Math.min,Ws=Math.max,lc=Math.round,$u=Math.floor,Wn=e=>({x:e,y:e}),vk={left:"right",right:"left",bottom:"top",top:"bottom"},Sk={start:"end",end:"start"};function _0(e,t,n){return Ws(e,oc(t,n))}function Uc(e,t){return typeof e=="function"?e(t):e}function rr(e){return e.split("-")[0]}function qc(e){return e.split("-")[1]}function mw(e){return e==="x"?"y":"x"}function yw(e){return e==="y"?"height":"width"}function er(e){return["top","bottom"].includes(rr(e))?"y":"x"}function gw(e){return mw(er(e))}function xk(e,t,n){n===void 0&&(n=!1);const s=qc(e),a=gw(e),u=yw(a);let c=a==="x"?s===(n?"end":"start")?"right":"left":s==="start"?"bottom":"top";return t.reference[u]>t.floating[u]&&(c=uc(c)),[c,uc(c)]}function wk(e){const t=uc(e);return[fp(e),t,fp(t)]}function fp(e){return e.replace(/start|end/g,t=>Sk[t])}function Ak(e,t,n){const s=["left","right"],a=["right","left"],u=["top","bottom"],c=["bottom","top"];switch(e){case"top":case"bottom":return n?t?a:s:t?s:a;case"left":case"right":return t?u:c;default:return[]}}function Tk(e,t,n,s){const a=qc(e);let u=Ak(rr(e),n==="start",s);return a&&(u=u.map(c=>c+"-"+a),t&&(u=u.concat(u.map(fp)))),u}function uc(e){return e.replace(/left|right|bottom|top/g,t=>vk[t])}function Ek(e){return{top:0,right:0,bottom:0,left:0,...e}}function Rk(e){return typeof e!="number"?Ek(e):{top:e,right:e,bottom:e,left:e}}function cc(e){const{x:t,y:n,width:s,height:a}=e;return{width:s,height:a,top:n,left:t,right:t+s,bottom:n+a,x:t,y:n}}/*!
|
|
63
|
-
* tabbable 6.2.0
|
|
64
|
-
* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
|
|
65
|
-
*/var Ok=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[href]:not([inert])","button:not([inert])","[tabindex]:not(slot):not([inert])","audio[controls]:not([inert])","video[controls]:not([inert])",'[contenteditable]:not([contenteditable="false"]):not([inert])',"details>summary:first-of-type:not([inert])","details:not([inert])"],fc=Ok.join(","),bw=typeof Element>"u",ma=bw?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,dc=!bw&&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==null?void 0:e.ownerDocument},hc=function e(t,n){var s;n===void 0&&(n=!0);var a=t==null||(s=t.getAttribute)===null||s===void 0?void 0:s.call(t,"inert"),u=a===""||a==="true",c=u||n&&t&&e(t.parentNode);return c},Mk=function(t){var n,s=t==null||(n=t.getAttribute)===null||n===void 0?void 0:n.call(t,"contenteditable");return s===""||s==="true"},vw=function(t,n,s){if(hc(t))return[];var a=Array.prototype.slice.apply(t.querySelectorAll(fc));return n&&ma.call(t,fc)&&a.unshift(t),a=a.filter(s),a},Sw=function e(t,n,s){for(var a=[],u=Array.from(t);u.length;){var c=u.shift();if(!hc(c,!1))if(c.tagName==="SLOT"){var d=c.assignedElements(),h=d.length?d:c.children,p=e(h,!0,s);s.flatten?a.push.apply(a,p):a.push({scopeParent:c,candidates:p})}else{var y=ma.call(c,fc);y&&s.filter(c)&&(n||!t.includes(c))&&a.push(c);var g=c.shadowRoot||typeof s.getShadowRoot=="function"&&s.getShadowRoot(c),v=!hc(g,!1)&&(!s.shadowRootFilter||s.shadowRootFilter(c));if(g&&v){var S=e(g===!0?c.children:g.children,!0,s);s.flatten?a.push.apply(a,S):a.push({scopeParent:c,candidates:S})}else u.unshift.apply(u,c.children)}}return a},xw=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},ww=function(t){if(!t)throw new Error("No node provided");return t.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||Mk(t))&&!xw(t)?0:t.tabIndex},Ck=function(t,n){var s=ww(t);return s<0&&n&&!xw(t)?0:s},kk=function(t,n){return t.tabIndex===n.tabIndex?t.documentOrder-n.documentOrder:t.tabIndex-n.tabIndex},Aw=function(t){return t.tagName==="INPUT"},Dk=function(t){return Aw(t)&&t.type==="hidden"},Nk=function(t){var n=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(s){return s.tagName==="SUMMARY"});return n},_k=function(t,n){for(var s=0;s<t.length;s++)if(t[s].checked&&t[s].form===n)return t[s]},$k=function(t){if(!t.name)return!0;var n=t.form||dc(t),s=function(d){return n.querySelectorAll('input[type="radio"][name="'+d+'"]')},a;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")a=s(window.CSS.escape(t.name));else try{a=s(t.name)}catch(c){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",c.message),!1}var u=_k(a,t.form);return!u||u===t},Bk=function(t){return Aw(t)&&t.type==="radio"},Lk=function(t){return Bk(t)&&!$k(t)},Vk=function(t){var n,s=t&&dc(t),a=(n=s)===null||n===void 0?void 0:n.host,u=!1;if(s&&s!==t){var c,d,h;for(u=!!((c=a)!==null&&c!==void 0&&(d=c.ownerDocument)!==null&&d!==void 0&&d.contains(a)||t!=null&&(h=t.ownerDocument)!==null&&h!==void 0&&h.contains(t));!u&&a;){var p,y,g;s=dc(a),a=(p=s)===null||p===void 0?void 0:p.host,u=!!((y=a)!==null&&y!==void 0&&(g=y.ownerDocument)!==null&&g!==void 0&&g.contains(a))}}return u},$0=function(t){var n=t.getBoundingClientRect(),s=n.width,a=n.height;return s===0&&a===0},jk=function(t,n){var s=n.displayCheck,a=n.getShadowRoot;if(getComputedStyle(t).visibility==="hidden")return!0;var u=ma.call(t,"details>summary:first-of-type"),c=u?t.parentElement:t;if(ma.call(c,"details:not([open]) *"))return!0;if(!s||s==="full"||s==="legacy-full"){if(typeof a=="function"){for(var d=t;t;){var h=t.parentElement,p=dc(t);if(h&&!h.shadowRoot&&a(h)===!0)return $0(t);t.assignedSlot?t=t.assignedSlot:!h&&p!==t.ownerDocument?t=p.host:t=h}t=d}if(Vk(t))return!t.getClientRects().length;if(s!=="legacy-full")return!0}else if(s==="non-zero-area")return $0(t);return!1},zk=function(t){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(t.tagName))for(var n=t.parentElement;n;){if(n.tagName==="FIELDSET"&&n.disabled){for(var s=0;s<n.children.length;s++){var a=n.children.item(s);if(a.tagName==="LEGEND")return ma.call(n,"fieldset[disabled] *")?!0:!a.contains(t)}return!0}n=n.parentElement}return!1},dp=function(t,n){return!(n.disabled||hc(n)||Dk(n)||jk(n,t)||Nk(n)||zk(n))},hp=function(t,n){return!(Lk(n)||ww(n)<0||!dp(t,n))},Uk=function(t){var n=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},qk=function e(t){var n=[],s=[];return t.forEach(function(a,u){var c=!!a.scopeParent,d=c?a.scopeParent:a,h=Ck(d,c),p=c?e(a.candidates):d;h===0?c?n.push.apply(n,p):n.push(d):s.push({documentOrder:u,tabIndex:h,item:a,isScope:c,content:p})}),s.sort(kk).reduce(function(a,u){return u.isScope?a.push.apply(a,u.content):a.push(u.content),a},[]).concat(n)},xm=function(t,n){n=n||{};var s;return n.getShadowRoot?s=Sw([t],n.includeContainer,{filter:hp.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:Uk}):s=vw(t,n.includeContainer,hp.bind(null,n)),qk(s)},Kk=function(t,n){n=n||{};var s;return n.getShadowRoot?s=Sw([t],n.includeContainer,{filter:dp.bind(null,n),flatten:!0,getShadowRoot:n.getShadowRoot}):s=vw(t,n.includeContainer,dp.bind(null,n)),s},Tw=function(t,n){if(n=n||{},!t)throw new Error("No node provided");return ma.call(t,fc)===!1?!1:hp(n,t)};function Pk(){const e=navigator.userAgentData;return e!=null&&e.platform?e.platform:navigator.platform}function Ew(){const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(t=>{let{brand:n,version:s}=t;return n+"/"+s}).join(" "):navigator.userAgent}function Ik(){return/apple/i.test(navigator.vendor)}function pp(){const e=/android/i;return e.test(Pk())||e.test(Ew())}function Hk(){return Ew().includes("jsdom/")}const B0="data-floating-ui-focusable",Gk="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function Wr(e){let t=e.activeElement;for(;((n=t)==null||(n=n.shadowRoot)==null?void 0:n.activeElement)!=null;){var n;t=t.shadowRoot.activeElement}return t}function yn(e,t){if(!e||!t)return!1;const n=t.getRootNode==null?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&up(n)){let s=t;for(;s;){if(e===s)return!0;s=s.parentNode||s.host}}return!1}function Ys(e){return"composedPath"in e?e.composedPath()[0]:e.target}function Ah(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 Fk(e){return e.matches("html,body")}function qn(e){return(e==null?void 0:e.ownerDocument)||document}function Rw(e){return wt(e)&&e.matches(Gk)}function L0(e){return e?e.getAttribute("role")==="combobox"&&Rw(e):!1}function mp(e){return e?e.hasAttribute(B0)?e:e.querySelector("["+B0+"]")||e:null}function Vo(e,t,n){n===void 0&&(n=!0);let s=e.filter(u=>{var c;return u.parentId===t&&((c=u.context)==null?void 0:c.open)}),a=s;for(;a.length;)a=n?e.filter(u=>{var c;return(c=a)==null?void 0:c.some(d=>{var h;return u.parentId===d.id&&((h=u.context)==null?void 0:h.open)})}):e,s=s.concat(a);return s}function V0(e,t){var n;let s=[],a=(n=e.find(u=>u.id===t))==null?void 0:n.parentId;for(;a;){const u=e.find(c=>c.id===a);a=u==null?void 0:u.parentId,u&&(s=s.concat(u))}return s}function Th(e){e.preventDefault(),e.stopPropagation()}function Yk(e){return"nativeEvent"in e}function Xk(e){return e.mozInputSource===0&&e.isTrusted?!0:pp()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function Zk(e){return Hk()?!1:!pp()&&e.width===0&&e.height===0||pp()&&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 j0(e,t){return["mouse","pen"].includes(e)}var Oi=typeof document<"u"?j.useLayoutEffect:j.useEffect;const Jk={...Kx};function Eh(e){const t=j.useRef(e);return Oi(()=>{t.current=e}),t}const Qk=Jk.useInsertionEffect,Wk=Qk||(e=>e());function Jn(e){const t=j.useRef(()=>{});return Wk(()=>{t.current=e}),j.useCallback(function(){for(var n=arguments.length,s=new Array(n),a=0;a<n;a++)s[a]=arguments[a];return t.current==null?void 0:t.current(...s)},[])}const Kc=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function Ow(e,t){const n=xm(e,Kc()),s=n.length;if(s===0)return;const a=Wr(qn(e)),u=n.indexOf(a),c=u===-1?t===1?0:s-1:u+t;return n[c]}function eD(e){return Ow(qn(e).body,1)||e}function tD(e){return Ow(qn(e).body,-1)||e}function z0(e,t){const n=t||e.currentTarget,s=e.relatedTarget;return!s||!yn(n,s)}var nD=dw();function U0(e,t,n){let{reference:s,floating:a}=e;const u=er(t),c=gw(t),d=yw(c),h=rr(t),p=u==="y",y=s.x+s.width/2-a.width/2,g=s.y+s.height/2-a.height/2,v=s[d]/2-a[d]/2;let S;switch(h){case"top":S={x:y,y:s.y-a.height};break;case"bottom":S={x:y,y:s.y+s.height};break;case"right":S={x:s.x+s.width,y:g};break;case"left":S={x:s.x-a.width,y:g};break;default:S={x:s.x,y:s.y}}switch(qc(t)){case"start":S[c]-=v*(n&&p?-1:1);break;case"end":S[c]+=v*(n&&p?-1:1);break}return S}const iD=async(e,t,n)=>{const{placement:s="bottom",strategy:a="absolute",middleware:u=[],platform:c}=n,d=u.filter(Boolean),h=await(c.isRTL==null?void 0:c.isRTL(t));let p=await c.getElementRects({reference:e,floating:t,strategy:a}),{x:y,y:g}=U0(p,s,h),v=s,S={},T=0;for(let R=0;R<d.length;R++){const{name:M,fn:D}=d[R],{x:$,y:k,data:Y,reset:z}=await D({x:y,y:g,initialPlacement:s,placement:v,strategy:a,middlewareData:S,rects:p,platform:c,elements:{reference:e,floating:t}});y=$??y,g=k??g,S={...S,[M]:{...S[M],...Y}},z&&T<=50&&(T++,typeof z=="object"&&(z.placement&&(v=z.placement),z.rects&&(p=z.rects===!0?await c.getElementRects({reference:e,floating:t,strategy:a}):z.rects),{x:y,y:g}=U0(p,v,h)),R=-1)}return{x:y,y:g,placement:v,strategy:a,middlewareData:S}};async function Mw(e,t){var n;t===void 0&&(t={});const{x:s,y:a,platform:u,rects:c,elements:d,strategy:h}=e,{boundary:p="clippingAncestors",rootBoundary:y="viewport",elementContext:g="floating",altBoundary:v=!1,padding:S=0}=Uc(t,e),T=Rk(S),M=d[v?g==="floating"?"reference":"floating":g],D=cc(await u.getClippingRect({element:(n=await(u.isElement==null?void 0:u.isElement(M)))==null||n?M:M.contextElement||await(u.getDocumentElement==null?void 0:u.getDocumentElement(d.floating)),boundary:p,rootBoundary:y,strategy:h})),$=g==="floating"?{x:s,y:a,width:c.floating.width,height:c.floating.height}:c.reference,k=await(u.getOffsetParent==null?void 0:u.getOffsetParent(d.floating)),Y=await(u.isElement==null?void 0:u.isElement(k))?await(u.getScale==null?void 0:u.getScale(k))||{x:1,y:1}:{x:1,y:1},z=cc(u.convertOffsetParentRelativeRectToViewportRelativeRect?await u.convertOffsetParentRelativeRectToViewportRelativeRect({elements:d,rect:$,offsetParent:k,strategy:h}):$);return{top:(D.top-z.top+T.top)/Y.y,bottom:(z.bottom-D.bottom+T.bottom)/Y.y,left:(D.left-z.left+T.left)/Y.x,right:(z.right-D.right+T.right)/Y.x}}const sD=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,s;const{placement:a,middlewareData:u,rects:c,initialPlacement:d,platform:h,elements:p}=t,{mainAxis:y=!0,crossAxis:g=!0,fallbackPlacements:v,fallbackStrategy:S="bestFit",fallbackAxisSideDirection:T="none",flipAlignment:R=!0,...M}=Uc(e,t);if((n=u.arrow)!=null&&n.alignmentOffset)return{};const D=rr(a),$=er(d),k=rr(d)===d,Y=await(h.isRTL==null?void 0:h.isRTL(p.floating)),z=v||(k||!R?[uc(d)]:wk(d)),ne=T!=="none";!v&&ne&&z.push(...Tk(d,R,T,Y));const ie=[d,...z],te=await Mw(t,M),ee=[];let me=((s=u.flip)==null?void 0:s.overflows)||[];if(y&&ee.push(te[D]),g){const X=xk(a,c,Y);ee.push(te[X[0]],te[X[1]])}if(me=[...me,{placement:a,overflows:ee}],!ee.every(X=>X<=0)){var be,De;const X=(((be=u.flip)==null?void 0:be.index)||0)+1,L=ie[X];if(L){var Ge;const G=g==="alignment"?$!==er(L):!1,J=((Ge=me[0])==null?void 0:Ge.overflows[0])>0;if(!G||J)return{data:{index:X,overflows:me},reset:{placement:L}}}let I=(De=me.filter(G=>G.overflows[0]<=0).sort((G,J)=>G.overflows[1]-J.overflows[1])[0])==null?void 0:De.placement;if(!I)switch(S){case"bestFit":{var ke;const G=(ke=me.filter(J=>{if(ne){const A=er(J.placement);return A===$||A==="y"}return!0}).map(J=>[J.placement,J.overflows.filter(A=>A>0).reduce((A,U)=>A+U,0)]).sort((J,A)=>J[1]-A[1])[0])==null?void 0:ke[0];G&&(I=G);break}case"initialPlacement":I=d;break}if(a!==I)return{reset:{placement:I}}}return{}}}};async function rD(e,t){const{placement:n,platform:s,elements:a}=e,u=await(s.isRTL==null?void 0:s.isRTL(a.floating)),c=rr(n),d=qc(n),h=er(n)==="y",p=["left","top"].includes(c)?-1:1,y=u&&h?-1:1,g=Uc(t,e);let{mainAxis:v,crossAxis:S,alignmentAxis:T}=typeof g=="number"?{mainAxis:g,crossAxis:0,alignmentAxis:null}:{mainAxis:g.mainAxis||0,crossAxis:g.crossAxis||0,alignmentAxis:g.alignmentAxis};return d&&typeof T=="number"&&(S=d==="end"?T*-1:T),h?{x:S*y,y:v*p}:{x:v*p,y:S*y}}const aD=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,s;const{x:a,y:u,placement:c,middlewareData:d}=t,h=await rD(t,e);return c===((n=d.offset)==null?void 0:n.placement)&&(s=d.arrow)!=null&&s.alignmentOffset?{}:{x:a+h.x,y:u+h.y,data:{...h,placement:c}}}}},oD=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:s,placement:a}=t,{mainAxis:u=!0,crossAxis:c=!1,limiter:d={fn:M=>{let{x:D,y:$}=M;return{x:D,y:$}}},...h}=Uc(e,t),p={x:n,y:s},y=await Mw(t,h),g=er(rr(a)),v=mw(g);let S=p[v],T=p[g];if(u){const M=v==="y"?"top":"left",D=v==="y"?"bottom":"right",$=S+y[M],k=S-y[D];S=_0($,S,k)}if(c){const M=g==="y"?"top":"left",D=g==="y"?"bottom":"right",$=T+y[M],k=T-y[D];T=_0($,T,k)}const R=d.fn({...t,[v]:S,[g]:T});return{...R,data:{x:R.x-n,y:R.y-s,enabled:{[v]:u,[g]:c}}}}}};function Cw(e){const t=$n(e);let n=parseFloat(t.width)||0,s=parseFloat(t.height)||0;const a=wt(e),u=a?e.offsetWidth:n,c=a?e.offsetHeight:s,d=lc(n)!==u||lc(s)!==c;return d&&(n=u,s=c),{width:n,height:s,$:d}}function wm(e){return ft(e)?e:e.contextElement}function la(e){const t=wm(e);if(!wt(t))return Wn(1);const n=t.getBoundingClientRect(),{width:s,height:a,$:u}=Cw(t);let c=(u?lc(n.width):n.width)/s,d=(u?lc(n.height):n.height)/a;return(!c||!Number.isFinite(c))&&(c=1),(!d||!Number.isFinite(d))&&(d=1),{x:c,y:d}}const lD=Wn(0);function kw(e){const t=bn(e);return!jc()||!t.visualViewport?lD:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function uD(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==bn(e)?!1:t}function ar(e,t,n,s){t===void 0&&(t=!1),n===void 0&&(n=!1);const a=e.getBoundingClientRect(),u=wm(e);let c=Wn(1);t&&(s?ft(s)&&(c=la(s)):c=la(e));const d=uD(u,n,s)?kw(u):Wn(0);let h=(a.left+d.x)/c.x,p=(a.top+d.y)/c.y,y=a.width/c.x,g=a.height/c.y;if(u){const v=bn(u),S=s&&ft(s)?bn(s):s;let T=v,R=cp(T);for(;R&&s&&S!==T;){const M=la(R),D=R.getBoundingClientRect(),$=$n(R),k=D.left+(R.clientLeft+parseFloat($.paddingLeft))*M.x,Y=D.top+(R.clientTop+parseFloat($.paddingTop))*M.y;h*=M.x,p*=M.y,y*=M.x,g*=M.y,h+=k,p+=Y,T=bn(R),R=cp(T)}}return cc({width:y,height:g,x:h,y:p})}function Am(e,t){const n=zc(e).scrollLeft;return t?t.left+n:ar(ri(e)).left+n}function Dw(e,t,n){n===void 0&&(n=!1);const s=e.getBoundingClientRect(),a=s.left+t.scrollLeft-(n?0:Am(e,s)),u=s.top+t.scrollTop;return{x:a,y:u}}function cD(e){let{elements:t,rect:n,offsetParent:s,strategy:a}=e;const u=a==="fixed",c=ri(s),d=t?Vc(t.floating):!1;if(s===c||d&&u)return n;let h={scrollLeft:0,scrollTop:0},p=Wn(1);const y=Wn(0),g=wt(s);if((g||!g&&!u)&&((As(s)!=="body"||rl(c))&&(h=zc(s)),wt(s))){const S=ar(s);p=la(s),y.x=S.x+s.clientLeft,y.y=S.y+s.clientTop}const v=c&&!g&&!u?Dw(c,h,!0):Wn(0);return{width:n.width*p.x,height:n.height*p.y,x:n.x*p.x-h.scrollLeft*p.x+y.x+v.x,y:n.y*p.y-h.scrollTop*p.y+y.y+v.y}}function fD(e){return Array.from(e.getClientRects())}function dD(e){const t=ri(e),n=zc(e),s=e.ownerDocument.body,a=Ws(t.scrollWidth,t.clientWidth,s.scrollWidth,s.clientWidth),u=Ws(t.scrollHeight,t.clientHeight,s.scrollHeight,s.clientHeight);let c=-n.scrollLeft+Am(e);const d=-n.scrollTop;return $n(s).direction==="rtl"&&(c+=Ws(t.clientWidth,s.clientWidth)-a),{width:a,height:u,x:c,y:d}}function hD(e,t){const n=bn(e),s=ri(e),a=n.visualViewport;let u=s.clientWidth,c=s.clientHeight,d=0,h=0;if(a){u=a.width,c=a.height;const p=jc();(!p||p&&t==="fixed")&&(d=a.offsetLeft,h=a.offsetTop)}return{width:u,height:c,x:d,y:h}}function pD(e,t){const n=ar(e,!0,t==="fixed"),s=n.top+e.clientTop,a=n.left+e.clientLeft,u=wt(e)?la(e):Wn(1),c=e.clientWidth*u.x,d=e.clientHeight*u.y,h=a*u.x,p=s*u.y;return{width:c,height:d,x:h,y:p}}function q0(e,t,n){let s;if(t==="viewport")s=hD(e,n);else if(t==="document")s=dD(ri(e));else if(ft(t))s=pD(t,n);else{const a=kw(e);s={x:t.x-a.x,y:t.y-a.y,width:t.width,height:t.height}}return cc(s)}function Nw(e,t){const n=Di(e);return n===t||!ft(n)||Mi(n)?!1:$n(n).position==="fixed"||Nw(n,t)}function mD(e,t){const n=t.get(e);if(n)return n;let s=ys(e,[],!1).filter(d=>ft(d)&&As(d)!=="body"),a=null;const u=$n(e).position==="fixed";let c=u?Di(e):e;for(;ft(c)&&!Mi(c);){const d=$n(c),h=Sm(c);!h&&d.position==="fixed"&&(a=null),(u?!h&&!a:!h&&d.position==="static"&&!!a&&["absolute","fixed"].includes(a.position)||rl(c)&&!h&&Nw(e,c))?s=s.filter(y=>y!==c):a=d,c=Di(c)}return t.set(e,s),s}function yD(e){let{element:t,boundary:n,rootBoundary:s,strategy:a}=e;const c=[...n==="clippingAncestors"?Vc(t)?[]:mD(t,this._c):[].concat(n),s],d=c[0],h=c.reduce((p,y)=>{const g=q0(t,y,a);return p.top=Ws(g.top,p.top),p.right=oc(g.right,p.right),p.bottom=oc(g.bottom,p.bottom),p.left=Ws(g.left,p.left),p},q0(t,d,a));return{width:h.right-h.left,height:h.bottom-h.top,x:h.left,y:h.top}}function gD(e){const{width:t,height:n}=Cw(e);return{width:t,height:n}}function bD(e,t,n){const s=wt(t),a=ri(t),u=n==="fixed",c=ar(e,!0,u,t);let d={scrollLeft:0,scrollTop:0};const h=Wn(0);function p(){h.x=Am(a)}if(s||!s&&!u)if((As(t)!=="body"||rl(a))&&(d=zc(t)),s){const S=ar(t,!0,u,t);h.x=S.x+t.clientLeft,h.y=S.y+t.clientTop}else a&&p();u&&!s&&a&&p();const y=a&&!s&&!u?Dw(a,d):Wn(0),g=c.left+d.scrollLeft-h.x-y.x,v=c.top+d.scrollTop-h.y-y.y;return{x:g,y:v,width:c.width,height:c.height}}function Rh(e){return $n(e).position==="static"}function K0(e,t){if(!wt(e)||$n(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return ri(e)===n&&(n=n.ownerDocument.body),n}function _w(e,t){const n=bn(e);if(Vc(e))return n;if(!wt(e)){let a=Di(e);for(;a&&!Mi(a);){if(ft(a)&&!Rh(a))return a;a=Di(a)}return n}let s=K0(e,t);for(;s&&gk(s)&&Rh(s);)s=K0(s,t);return s&&Mi(s)&&Rh(s)&&!Sm(s)?n:s||bk(e)||n}const vD=async function(e){const t=this.getOffsetParent||_w,n=this.getDimensions,s=await n(e.floating);return{reference:bD(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function SD(e){return $n(e).direction==="rtl"}const xD={convertOffsetParentRelativeRectToViewportRelativeRect:cD,getDocumentElement:ri,getClippingRect:yD,getOffsetParent:_w,getElementRects:vD,getClientRects:fD,getDimensions:gD,getScale:la,isElement:ft,isRTL:SD};function $w(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function wD(e,t){let n=null,s;const a=ri(e);function u(){var d;clearTimeout(s),(d=n)==null||d.disconnect(),n=null}function c(d,h){d===void 0&&(d=!1),h===void 0&&(h=1),u();const p=e.getBoundingClientRect(),{left:y,top:g,width:v,height:S}=p;if(d||t(),!v||!S)return;const T=$u(g),R=$u(a.clientWidth-(y+v)),M=$u(a.clientHeight-(g+S)),D=$u(y),k={rootMargin:-T+"px "+-R+"px "+-M+"px "+-D+"px",threshold:Ws(0,oc(1,h))||1};let Y=!0;function z(ne){const ie=ne[0].intersectionRatio;if(ie!==h){if(!Y)return c();ie?c(!1,ie):s=setTimeout(()=>{c(!1,1e-7)},1e3)}ie===1&&!$w(p,e.getBoundingClientRect())&&c(),Y=!1}try{n=new IntersectionObserver(z,{...k,root:a.ownerDocument})}catch{n=new IntersectionObserver(z,k)}n.observe(e)}return c(!0),u}function AD(e,t,n,s){s===void 0&&(s={});const{ancestorScroll:a=!0,ancestorResize:u=!0,elementResize:c=typeof ResizeObserver=="function",layoutShift:d=typeof IntersectionObserver=="function",animationFrame:h=!1}=s,p=wm(e),y=a||u?[...p?ys(p):[],...ys(t)]:[];y.forEach(D=>{a&&D.addEventListener("scroll",n,{passive:!0}),u&&D.addEventListener("resize",n)});const g=p&&d?wD(p,n):null;let v=-1,S=null;c&&(S=new ResizeObserver(D=>{let[$]=D;$&&$.target===p&&S&&(S.unobserve(t),cancelAnimationFrame(v),v=requestAnimationFrame(()=>{var k;(k=S)==null||k.observe(t)})),n()}),p&&!h&&S.observe(p),S.observe(t));let T,R=h?ar(e):null;h&&M();function M(){const D=ar(e);R&&!$w(R,D)&&n(),R=D,T=requestAnimationFrame(M)}return n(),()=>{var D;y.forEach($=>{a&&$.removeEventListener("scroll",n),u&&$.removeEventListener("resize",n)}),g==null||g(),(D=S)==null||D.disconnect(),S=null,h&&cancelAnimationFrame(T)}}const TD=aD,ED=oD,RD=sD,OD=(e,t,n)=>{const s=new Map,a={platform:xD,...n},u={...a.platform,_c:s};return iD(e,t,{...a,platform:u})};var Yu=typeof document<"u"?j.useLayoutEffect:j.useEffect;function pc(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,s,a;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(s=n;s--!==0;)if(!pc(e[s],t[s]))return!1;return!0}if(a=Object.keys(e),n=a.length,n!==Object.keys(t).length)return!1;for(s=n;s--!==0;)if(!{}.hasOwnProperty.call(t,a[s]))return!1;for(s=n;s--!==0;){const u=a[s];if(!(u==="_owner"&&e.$$typeof)&&!pc(e[u],t[u]))return!1}return!0}return e!==e&&t!==t}function Bw(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function P0(e,t){const n=Bw(e);return Math.round(t*n)/n}function Oh(e){const t=j.useRef(e);return Yu(()=>{t.current=e}),t}function MD(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:s=[],platform:a,elements:{reference:u,floating:c}={},transform:d=!0,whileElementsMounted:h,open:p}=e,[y,g]=j.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[v,S]=j.useState(s);pc(v,s)||S(s);const[T,R]=j.useState(null),[M,D]=j.useState(null),$=j.useCallback(G=>{G!==ne.current&&(ne.current=G,R(G))},[]),k=j.useCallback(G=>{G!==ie.current&&(ie.current=G,D(G))},[]),Y=u||T,z=c||M,ne=j.useRef(null),ie=j.useRef(null),te=j.useRef(y),ee=h!=null,me=Oh(h),be=Oh(a),De=Oh(p),Ge=j.useCallback(()=>{if(!ne.current||!ie.current)return;const G={placement:t,strategy:n,middleware:v};be.current&&(G.platform=be.current),OD(ne.current,ie.current,G).then(J=>{const A={...J,isPositioned:De.current!==!1};ke.current&&!pc(te.current,A)&&(te.current=A,nD.flushSync(()=>{g(A)}))})},[v,t,n,be,De]);Yu(()=>{p===!1&&te.current.isPositioned&&(te.current.isPositioned=!1,g(G=>({...G,isPositioned:!1})))},[p]);const ke=j.useRef(!1);Yu(()=>(ke.current=!0,()=>{ke.current=!1}),[]),Yu(()=>{if(Y&&(ne.current=Y),z&&(ie.current=z),Y&&z){if(me.current)return me.current(Y,z,Ge);Ge()}},[Y,z,Ge,me,ee]);const X=j.useMemo(()=>({reference:ne,floating:ie,setReference:$,setFloating:k}),[$,k]),L=j.useMemo(()=>({reference:Y,floating:z}),[Y,z]),I=j.useMemo(()=>{const G={position:n,left:0,top:0};if(!L.floating)return G;const J=P0(L.floating,y.x),A=P0(L.floating,y.y);return d?{...G,transform:"translate("+J+"px, "+A+"px)",...Bw(L.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:J,top:A}},[n,d,L.floating,y.x,y.y]);return j.useMemo(()=>({...y,update:Ge,refs:X,elements:L,floatingStyles:I}),[y,Ge,X,L,I])}const CD=(e,t)=>({...TD(e),options:[e,t]}),kD=(e,t)=>({...ED(e),options:[e,t]}),DD=(e,t)=>({...RD(e),options:[e,t]}),ND="data-floating-ui-focusable",I0="active",H0="selected",_D={...Kx};let G0=!1,$D=0;const F0=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+$D++;function BD(){const[e,t]=j.useState(()=>G0?F0():void 0);return Oi(()=>{e==null&&t(F0())},[]),j.useEffect(()=>{G0=!0},[]),e}const LD=_D.useId,Lw=LD||BD;function VD(){const e=new Map;return{emit(t,n){var s;(s=e.get(t))==null||s.forEach(a=>a(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){var s;(s=e.get(t))==null||s.delete(n)}}}const jD=j.createContext(null),zD=j.createContext(null),Vw=()=>{var e;return((e=j.useContext(jD))==null?void 0:e.id)||null},Tm=()=>j.useContext(zD);function mc(e){return"data-floating-ui-"+e}let Y0=0;function Xr(e,t){t===void 0&&(t={});const{preventScroll:n=!1,cancelPrevious:s=!0,sync:a=!1}=t;s&&cancelAnimationFrame(Y0);const u=()=>e==null?void 0:e.focus({preventScroll:n});a?u():Y0=requestAnimationFrame(u)}function UD(e){return(e==null?void 0:e.ownerDocument)||document}let Zr=new WeakMap,Bu=new WeakSet,Lu={},Mh=0;const qD=()=>typeof HTMLElement<"u"&&"inert"in HTMLElement.prototype,jw=e=>e&&(e.host||jw(e.parentNode)),KD=(e,t)=>t.map(n=>{if(e.contains(n))return n;const s=jw(n);return e.contains(s)?s:null}).filter(n=>n!=null);function PD(e,t,n,s){const a="data-floating-ui-inert",u=s?"inert":n?"aria-hidden":null,c=KD(t,e),d=new Set,h=new Set(c),p=[];Lu[a]||(Lu[a]=new WeakMap);const y=Lu[a];c.forEach(g),v(t),d.clear();function g(S){!S||d.has(S)||(d.add(S),S.parentNode&&g(S.parentNode))}function v(S){!S||h.has(S)||[].forEach.call(S.children,T=>{if(As(T)!=="script")if(d.has(T))v(T);else{const R=u?T.getAttribute(u):null,M=R!==null&&R!=="false",D=Zr.get(T)||0,$=u?D+1:D,k=(y.get(T)||0)+1;Zr.set(T,$),y.set(T,k),p.push(T),$===1&&M&&Bu.add(T),k===1&&T.setAttribute(a,""),!M&&u&&T.setAttribute(u,u==="inert"?"":"true")}})}return Mh++,()=>{p.forEach(S=>{const T=Zr.get(S)||0,R=u?T-1:T,M=(y.get(S)||0)-1;Zr.set(S,R),y.set(S,M),R||(!Bu.has(S)&&u&&S.removeAttribute(u),Bu.delete(S)),M||S.removeAttribute(a)}),Mh--,Mh||(Zr=new WeakMap,Zr=new WeakMap,Bu=new WeakSet,Lu={})}}function X0(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=UD(e[0]).body;return PD(e.concat(Array.from(s.querySelectorAll("[aria-live]"))),s,t,n)}const Em={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0},Z0=j.forwardRef(function(t,n){const[s,a]=j.useState();Oi(()=>{Ik()&&a("button")},[]);const u={ref:n,tabIndex:0,role:s,"aria-hidden":s?void 0:!0,[mc("focus-guard")]:"",style:Em};return K.jsx("span",{...t,...u})}),ID=j.createContext(null),HD=()=>j.useContext(ID);function J0(e){return j.useMemo(()=>t=>{e.forEach(n=>{n&&(n.current=t)})},e)}const GD=20;let Is=[];function FD(e){Is=Is.filter(t=>t.isConnected),e&&As(e)!=="body"&&(Is.push(e),Is.length>GD&&(Is=Is.slice(-20)))}function Q0(){return Is.slice().reverse().find(e=>e.isConnected)}function YD(e){const t=Kc();return Tw(e,t)?e:xm(e,t)[0]||e}function W0(e,t){var n;if(!t.current.includes("floating")&&!((n=e.getAttribute("role"))!=null&&n.includes("dialog")))return;const s=Kc(),u=Kk(e,s).filter(d=>{const h=d.getAttribute("data-tabindex")||"";return Tw(d,s)||d.hasAttribute("data-tabindex")&&!h.startsWith("-")}),c=e.getAttribute("tabindex");t.current.includes("floating")||u.length===0?c!=="0"&&e.setAttribute("tabindex","0"):(c!=="-1"||e.hasAttribute("data-tabindex")&&e.getAttribute("data-tabindex")!=="-1")&&(e.setAttribute("tabindex","-1"),e.setAttribute("data-tabindex","-1"))}const XD=j.forwardRef(function(t,n){return K.jsx("button",{...t,type:"button",ref:n,tabIndex:-1,style:Em})});function ZD(e){const{context:t,children:n,disabled:s=!1,order:a=["content"],guards:u=!0,initialFocus:c=0,returnFocus:d=!0,restoreFocus:h=!1,modal:p=!0,visuallyHiddenDismiss:y=!1,closeOnFocusOut:g=!0,outsideElementsInert:v=!1,getInsideElements:S=()=>[]}=e,{open:T,onOpenChange:R,events:M,dataRef:D,elements:{domReference:$,floating:k}}=t,Y=Jn(()=>{var ge;return(ge=D.current.floatingContext)==null?void 0:ge.nodeId}),z=Jn(S),ne=typeof c=="number"&&c<0,ie=L0($)&&ne,te=qD(),ee=te?u:!0,me=!ee||te&&v,be=Eh(a),De=Eh(c),Ge=Eh(d),ke=Tm(),X=HD(),L=j.useRef(null),I=j.useRef(null),G=j.useRef(!1),J=j.useRef(!1),A=j.useRef(-1),U=X!=null,F=mp(k),Q=Jn(function(ge){return ge===void 0&&(ge=F),ge?xm(ge,Kc()):[]}),ae=Jn(ge=>{const Ae=Q(ge);return be.current.map(xe=>$&&xe==="reference"?$:F&&xe==="floating"?F:Ae).filter(Boolean).flat()});j.useEffect(()=>{if(s||!p)return;function ge(xe){if(xe.key==="Tab"){yn(F,Wr(qn(F)))&&Q().length===0&&!ie&&Th(xe);const Me=ae(),Qe=Ys(xe);be.current[0]==="reference"&&Qe===$&&(Th(xe),xe.shiftKey?Xr(Me[Me.length-1]):Xr(Me[1])),be.current[1]==="floating"&&Qe===F&&xe.shiftKey&&(Th(xe),Xr(Me[0]))}}const Ae=qn(F);return Ae.addEventListener("keydown",ge),()=>{Ae.removeEventListener("keydown",ge)}},[s,$,F,p,be,ie,Q,ae]),j.useEffect(()=>{if(s||!k)return;function ge(Ae){const xe=Ys(Ae),Qe=Q().indexOf(xe);Qe!==-1&&(A.current=Qe)}return k.addEventListener("focusin",ge),()=>{k.removeEventListener("focusin",ge)}},[s,k,Q]),j.useEffect(()=>{if(s||!g)return;function ge(){J.current=!0,setTimeout(()=>{J.current=!1})}function Ae(xe){const Me=xe.relatedTarget,Qe=xe.currentTarget;queueMicrotask(()=>{const In=Y(),Ke=!(yn($,Me)||yn(k,Me)||yn(Me,k)||yn(X==null?void 0:X.portalNode,Me)||Me!=null&&Me.hasAttribute(mc("focus-guard"))||ke&&(Vo(ke.nodesRef.current,In).find(kt=>{var We,Ze;return yn((We=kt.context)==null?void 0:We.elements.floating,Me)||yn((Ze=kt.context)==null?void 0:Ze.elements.domReference,Me)})||V0(ke.nodesRef.current,In).find(kt=>{var We,Ze,an;return[(We=kt.context)==null?void 0:We.elements.floating,mp((Ze=kt.context)==null?void 0:Ze.elements.floating)].includes(Me)||((an=kt.context)==null?void 0:an.elements.domReference)===Me})));if(Qe===$&&F&&W0(F,be),h&&Ke&&Wr(qn(F))===qn(F).body){wt(F)&&F.focus();const kt=A.current,We=Q(),Ze=We[kt]||We[We.length-1]||F;wt(Ze)&&Ze.focus()}(ie||!p)&&Me&&Ke&&!J.current&&Me!==Q0()&&(G.current=!0,R(!1,xe,"focus-out"))})}if(k&&wt($))return $.addEventListener("focusout",Ae),$.addEventListener("pointerdown",ge),k.addEventListener("focusout",Ae),()=>{$.removeEventListener("focusout",Ae),$.removeEventListener("pointerdown",ge),k.removeEventListener("focusout",Ae)}},[s,$,k,F,p,ke,X,R,g,h,Q,ie,Y,be]);const Se=j.useRef(null),re=j.useRef(null),Xe=J0([Se,X==null?void 0:X.beforeInsideRef]),Ne=J0([re,X==null?void 0:X.afterInsideRef]);j.useEffect(()=>{var ge,Ae;if(s||!k)return;const xe=Array.from((X==null||(ge=X.portalNode)==null?void 0:ge.querySelectorAll("["+mc("portal")+"]"))||[]),Me=ke?V0(ke.nodesRef.current,Y()):[],Qe=ke&&!p?Me.map(We=>{var Ze;return(Ze=We.context)==null?void 0:Ze.elements.floating}):[],In=(Ae=Me.find(We=>{var Ze;return L0(((Ze=We.context)==null?void 0:Ze.elements.domReference)||null)}))==null||(Ae=Ae.context)==null?void 0:Ae.elements.domReference,Ke=[k,In,...xe,...Qe,...z(),L.current,I.current,Se.current,re.current,X==null?void 0:X.beforeOutsideRef.current,X==null?void 0:X.afterOutsideRef.current,be.current.includes("reference")||ie?$:null].filter(We=>We!=null),kt=p||ie?X0(Ke,!me,me):X0(Ke);return()=>{kt()}},[s,$,k,p,be,X,ie,ee,me,ke,Y,z]),Oi(()=>{if(s||!wt(F))return;const ge=qn(F),Ae=Wr(ge);queueMicrotask(()=>{const xe=ae(F),Me=De.current,Qe=(typeof Me=="number"?xe[Me]:Me.current)||F,In=yn(F,Ae);!ne&&!In&&T&&Xr(Qe,{preventScroll:Qe===F})})},[s,T,F,ne,ae,De]),Oi(()=>{if(s||!F)return;let ge=!1;const Ae=qn(F),xe=Wr(Ae);FD(xe);function Me(Ke){let{reason:kt,event:We,nested:Ze}=Ke;if(["hover","safe-polygon"].includes(kt)&&We.type==="mouseleave"&&(G.current=!0),kt==="outside-press")if(Ze)G.current=!1,ge=!0;else if(Xk(We)||Zk(We))G.current=!1;else{let an=!1;document.createElement("div").focus({get preventScroll(){return an=!0,!1}}),an?(G.current=!1,ge=!0):G.current=!0}}M.on("openchange",Me);const Qe=Ae.createElement("span");Qe.setAttribute("tabindex","-1"),Qe.setAttribute("aria-hidden","true"),Object.assign(Qe.style,Em),U&&$&&$.insertAdjacentElement("afterend",Qe);function In(){if(typeof Ge.current=="boolean"){const Ke=$||Q0();return Ke&&Ke.isConnected?Ke:Qe}return Ge.current.current||Qe}return()=>{M.off("openchange",Me);const Ke=Wr(Ae),kt=yn(k,Ke)||ke&&Vo(ke.nodesRef.current,Y()).some(Ze=>{var an;return yn((an=Ze.context)==null?void 0:an.elements.floating,Ke)}),We=In();queueMicrotask(()=>{const Ze=YD(We);Ge.current&&!G.current&&wt(Ze)&&(!(Ze!==Ke&&Ke!==Ae.body)||kt)&&Ze.focus({preventScroll:ge}),Qe.remove()})}},[s,k,F,Ge,D,M,ke,U,$,Y]),j.useEffect(()=>{queueMicrotask(()=>{G.current=!1})},[s]),Oi(()=>{if(!s&&X)return X.setFocusManagerState({modal:p,closeOnFocusOut:g,open:T,onOpenChange:R,domReference:$}),()=>{X.setFocusManagerState(null)}},[s,X,p,T,R,g,$]),Oi(()=>{s||F&&W0(F,be)},[s,F,be]);function rn(ge){return s||!y||!p?null:K.jsx(XD,{ref:ge==="start"?L:I,onClick:Ae=>R(!1,Ae.nativeEvent),children:typeof y=="string"?y:"Dismiss"})}const Ui=!s&&ee&&(p?!ie:!0)&&(U||p);return K.jsxs(K.Fragment,{children:[Ui&&K.jsx(Z0,{"data-type":"inside",ref:Xe,onFocus:ge=>{if(p){const xe=ae();Xr(a[0]==="reference"?xe[0]:xe[xe.length-1])}else if(X!=null&&X.preserveTabOrder&&X.portalNode)if(G.current=!1,z0(ge,X.portalNode)){const xe=eD($);xe==null||xe.focus()}else{var Ae;(Ae=X.beforeOutsideRef.current)==null||Ae.focus()}}}),!ie&&rn("start"),n,rn("end"),Ui&&K.jsx(Z0,{"data-type":"inside",ref:Ne,onFocus:ge=>{if(p)Xr(ae()[0]);else if(X!=null&&X.preserveTabOrder&&X.portalNode)if(g&&(G.current=!0),z0(ge,X.portalNode)){const xe=tD($);xe==null||xe.focus()}else{var Ae;(Ae=X.afterOutsideRef.current)==null||Ae.focus()}}})]})}function eS(e){return wt(e.target)&&e.target.tagName==="BUTTON"}function JD(e){return wt(e.target)&&e.target.tagName==="A"}function tS(e){return Rw(e)}function QD(e,t){t===void 0&&(t={});const{open:n,onOpenChange:s,dataRef:a,elements:{domReference:u}}=e,{enabled:c=!0,event:d="click",toggle:h=!0,ignoreMouse:p=!1,keyboardHandlers:y=!0,stickIfOpen:g=!0}=t,v=j.useRef(),S=j.useRef(!1),T=j.useMemo(()=>({onPointerDown(R){v.current=R.pointerType},onMouseDown(R){const M=v.current;R.button===0&&d!=="click"&&(j0(M)&&p||(n&&h&&(!(a.current.openEvent&&g)||a.current.openEvent.type==="mousedown")?s(!1,R.nativeEvent,"click"):(R.preventDefault(),s(!0,R.nativeEvent,"click"))))},onClick(R){const M=v.current;if(d==="mousedown"&&v.current){v.current=void 0;return}j0(M)&&p||(n&&h&&(!(a.current.openEvent&&g)||a.current.openEvent.type==="click")?s(!1,R.nativeEvent,"click"):s(!0,R.nativeEvent,"click"))},onKeyDown(R){v.current=void 0,!(R.defaultPrevented||!y||eS(R))&&(R.key===" "&&!tS(u)&&(R.preventDefault(),S.current=!0),!JD(R)&&R.key==="Enter"&&s(!(n&&h),R.nativeEvent,"click"))},onKeyUp(R){R.defaultPrevented||!y||eS(R)||tS(u)||R.key===" "&&S.current&&(S.current=!1,s(!(n&&h),R.nativeEvent,"click"))}}),[a,u,d,p,y,s,n,g,h]);return j.useMemo(()=>c?{reference:T}:{},[c,T])}const WD={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},eN={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},nS=e=>{var t,n;return{escapeKey:typeof e=="boolean"?e:(t=e==null?void 0:e.escapeKey)!=null?t:!1,outsidePress:typeof e=="boolean"?e:(n=e==null?void 0:e.outsidePress)!=null?n:!0}};function tN(e,t){t===void 0&&(t={});const{open:n,onOpenChange:s,elements:a,dataRef:u}=e,{enabled:c=!0,escapeKey:d=!0,outsidePress:h=!0,outsidePressEvent:p="pointerdown",referencePress:y=!1,referencePressEvent:g="pointerdown",ancestorScroll:v=!1,bubbles:S,capture:T}=t,R=Tm(),M=Jn(typeof h=="function"?h:()=>!1),D=typeof h=="function"?M:h,$=j.useRef(!1),k=j.useRef(!1),{escapeKey:Y,outsidePress:z}=nS(S),{escapeKey:ne,outsidePress:ie}=nS(T),te=j.useRef(!1),ee=Jn(X=>{var L;if(!n||!c||!d||X.key!=="Escape"||te.current)return;const I=(L=u.current.floatingContext)==null?void 0:L.nodeId,G=R?Vo(R.nodesRef.current,I):[];if(!Y&&(X.stopPropagation(),G.length>0)){let J=!0;if(G.forEach(A=>{var U;if((U=A.context)!=null&&U.open&&!A.context.dataRef.current.__escapeKeyBubbles){J=!1;return}}),!J)return}s(!1,Yk(X)?X.nativeEvent:X,"escape-key")}),me=Jn(X=>{var L;const I=()=>{var G;ee(X),(G=Ys(X))==null||G.removeEventListener("keydown",I)};(L=Ys(X))==null||L.addEventListener("keydown",I)}),be=Jn(X=>{var L;const I=$.current;$.current=!1;const G=k.current;if(k.current=!1,p==="click"&&G||I||typeof D=="function"&&!D(X))return;const J=Ys(X),A="["+mc("inert")+"]",U=qn(a.floating).querySelectorAll(A);let F=ft(J)?J:null;for(;F&&!Mi(F);){const re=Di(F);if(Mi(re)||!ft(re))break;F=re}if(U.length&&ft(J)&&!Fk(J)&&!yn(J,a.floating)&&Array.from(U).every(re=>!yn(F,re)))return;if(wt(J)&&ke){const re=Mi(J),Xe=$n(J),Ne=/auto|scroll/,rn=re||Ne.test(Xe.overflowX),Ui=re||Ne.test(Xe.overflowY),ge=rn&&J.clientWidth>0&&J.scrollWidth>J.clientWidth,Ae=Ui&&J.clientHeight>0&&J.scrollHeight>J.clientHeight,xe=Xe.direction==="rtl",Me=Ae&&(xe?X.offsetX<=J.offsetWidth-J.clientWidth:X.offsetX>J.clientWidth),Qe=ge&&X.offsetY>J.clientHeight;if(Me||Qe)return}const Q=(L=u.current.floatingContext)==null?void 0:L.nodeId,ae=R&&Vo(R.nodesRef.current,Q).some(re=>{var Xe;return Ah(X,(Xe=re.context)==null?void 0:Xe.elements.floating)});if(Ah(X,a.floating)||Ah(X,a.domReference)||ae)return;const Se=R?Vo(R.nodesRef.current,Q):[];if(Se.length>0){let re=!0;if(Se.forEach(Xe=>{var Ne;if((Ne=Xe.context)!=null&&Ne.open&&!Xe.context.dataRef.current.__outsidePressBubbles){re=!1;return}}),!re)return}s(!1,X,"outside-press")}),De=Jn(X=>{var L;const I=()=>{var G;be(X),(G=Ys(X))==null||G.removeEventListener(p,I)};(L=Ys(X))==null||L.addEventListener(p,I)});j.useEffect(()=>{if(!n||!c)return;u.current.__escapeKeyBubbles=Y,u.current.__outsidePressBubbles=z;let X=-1;function L(U){s(!1,U,"ancestor-scroll")}function I(){window.clearTimeout(X),te.current=!0}function G(){X=window.setTimeout(()=>{te.current=!1},jc()?5:0)}const J=qn(a.floating);d&&(J.addEventListener("keydown",ne?me:ee,ne),J.addEventListener("compositionstart",I),J.addEventListener("compositionend",G)),D&&J.addEventListener(p,ie?De:be,ie);let A=[];return v&&(ft(a.domReference)&&(A=ys(a.domReference)),ft(a.floating)&&(A=A.concat(ys(a.floating))),!ft(a.reference)&&a.reference&&a.reference.contextElement&&(A=A.concat(ys(a.reference.contextElement)))),A=A.filter(U=>{var F;return U!==((F=J.defaultView)==null?void 0:F.visualViewport)}),A.forEach(U=>{U.addEventListener("scroll",L,{passive:!0})}),()=>{d&&(J.removeEventListener("keydown",ne?me:ee,ne),J.removeEventListener("compositionstart",I),J.removeEventListener("compositionend",G)),D&&J.removeEventListener(p,ie?De:be,ie),A.forEach(U=>{U.removeEventListener("scroll",L)}),window.clearTimeout(X)}},[u,a,d,D,p,n,s,v,c,Y,z,ee,ne,me,be,ie,De]),j.useEffect(()=>{$.current=!1},[D,p]);const Ge=j.useMemo(()=>({onKeyDown:ee,...y&&{[WD[g]]:X=>{s(!1,X.nativeEvent,"reference-press")},...g!=="click"&&{onClick(X){s(!1,X.nativeEvent,"reference-press")}}}}),[ee,s,y,g]),ke=j.useMemo(()=>({onKeyDown:ee,onMouseDown(){k.current=!0},onMouseUp(){k.current=!0},[eN[p]]:()=>{$.current=!0}}),[ee,p]);return j.useMemo(()=>c?{reference:Ge,floating:ke}:{},[c,Ge,ke])}function nN(e){const{open:t=!1,onOpenChange:n,elements:s}=e,a=Lw(),u=j.useRef({}),[c]=j.useState(()=>VD()),d=Vw()!=null,[h,p]=j.useState(s.reference),y=Jn((S,T,R)=>{u.current.openEvent=S?T:void 0,c.emit("openchange",{open:S,event:T,reason:R,nested:d}),n==null||n(S,T,R)}),g=j.useMemo(()=>({setPositionReference:p}),[]),v=j.useMemo(()=>({reference:h||s.reference||null,floating:s.floating||null,domReference:s.reference}),[h,s.reference,s.floating]);return j.useMemo(()=>({dataRef:u,open:t,onOpenChange:y,elements:v,events:c,floatingId:a,refs:g}),[t,y,v,c,a,g])}function iN(e){e===void 0&&(e={});const{nodeId:t}=e,n=nN({...e,elements:{reference:null,floating:null,...e.elements}}),s=e.rootContext||n,a=s.elements,[u,c]=j.useState(null),[d,h]=j.useState(null),y=(a==null?void 0:a.domReference)||u,g=j.useRef(null),v=Tm();Oi(()=>{y&&(g.current=y)},[y]);const S=MD({...e,elements:{...a,...d&&{reference:d}}}),T=j.useCallback(k=>{const Y=ft(k)?{getBoundingClientRect:()=>k.getBoundingClientRect(),getClientRects:()=>k.getClientRects(),contextElement:k}:k;h(Y),S.refs.setReference(Y)},[S.refs]),R=j.useCallback(k=>{(ft(k)||k===null)&&(g.current=k,c(k)),(ft(S.refs.reference.current)||S.refs.reference.current===null||k!==null&&!ft(k))&&S.refs.setReference(k)},[S.refs]),M=j.useMemo(()=>({...S.refs,setReference:R,setPositionReference:T,domReference:g}),[S.refs,R,T]),D=j.useMemo(()=>({...S.elements,domReference:y}),[S.elements,y]),$=j.useMemo(()=>({...S,...s,refs:M,elements:D,nodeId:t}),[S,M,D,t,s]);return Oi(()=>{s.dataRef.current.floatingContext=$;const k=v==null?void 0:v.nodesRef.current.find(Y=>Y.id===t);k&&(k.context=$)}),j.useMemo(()=>({...S,context:$,refs:M,elements:D}),[S,M,D,$])}function Ch(e,t,n){const s=new Map,a=n==="item";let u=e;if(a&&e){const{[I0]:c,[H0]:d,...h}=e;u=h}return{...n==="floating"&&{tabIndex:-1,[ND]:""},...u,...t.map(c=>{const d=c?c[n]:null;return typeof d=="function"?e?d(e):null:d}).concat(e).reduce((c,d)=>(d&&Object.entries(d).forEach(h=>{let[p,y]=h;if(!(a&&[I0,H0].includes(p)))if(p.indexOf("on")===0){if(s.has(p)||s.set(p,[]),typeof y=="function"){var g;(g=s.get(p))==null||g.push(y),c[p]=function(){for(var v,S=arguments.length,T=new Array(S),R=0;R<S;R++)T[R]=arguments[R];return(v=s.get(p))==null?void 0:v.map(M=>M(...T)).find(M=>M!==void 0)}}}else c[p]=y}),c),{})}}function sN(e){e===void 0&&(e=[]);const t=e.map(d=>d==null?void 0:d.reference),n=e.map(d=>d==null?void 0:d.floating),s=e.map(d=>d==null?void 0:d.item),a=j.useCallback(d=>Ch(d,e,"reference"),t),u=j.useCallback(d=>Ch(d,e,"floating"),n),c=j.useCallback(d=>Ch(d,e,"item"),s);return j.useMemo(()=>({getReferenceProps:a,getFloatingProps:u,getItemProps:c}),[a,u,c])}const rN=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function aN(e,t){var n,s;t===void 0&&(t={});const{open:a,elements:u,floatingId:c}=e,{enabled:d=!0,role:h="dialog"}=t,p=Lw(),y=((n=u.domReference)==null?void 0:n.id)||p,g=j.useMemo(()=>{var $;return(($=mp(u.floating))==null?void 0:$.id)||c},[u.floating,c]),v=(s=rN.get(h))!=null?s:h,T=Vw()!=null,R=j.useMemo(()=>v==="tooltip"||h==="label"?{["aria-"+(h==="label"?"labelledby":"describedby")]:a?g:void 0}:{"aria-expanded":a?"true":"false","aria-haspopup":v==="alertdialog"?"dialog":v,"aria-controls":a?g:void 0,...v==="listbox"&&{role:"combobox"},...v==="menu"&&{id:y},...v==="menu"&&T&&{role:"menuitem"},...h==="select"&&{"aria-autocomplete":"none"},...h==="combobox"&&{"aria-autocomplete":"list"}},[v,g,T,a,y,h]),M=j.useMemo(()=>{const $={id:g,...v&&{role:v}};return v==="tooltip"||h==="label"?$:{...$,...v==="menu"&&{"aria-labelledby":y}}},[v,g,y,h]),D=j.useCallback($=>{let{active:k,selected:Y}=$;const z={role:"option",...k&&{id:g+"-fui-option"}};switch(h){case"select":return{...z,"aria-selected":k&&Y};case"combobox":return{...z,"aria-selected":Y}}return{}},[g,h]);return j.useMemo(()=>d?{reference:R,floating:M,item:D}:{},[d,R,M,D])}const al=e=>Array.isArray(e)?e:[e],oN=(e,t)=>{const n=[[],[]];for(const s of e)t(s)?n[0].push(s):n[1].push(s);return n},zw=Array,Hs=(e,t)=>e.includes(t),lN=(e,t=0)=>[...new Array(e)].map((n,s)=>s+t),Ie=(e,t,n)=>e===void 0?t===void 0?[]:Array.isArray(t)?t:[t]:(Array.isArray(t)?e.push(...t):e.push(t),e),Zs=(e,t)=>t==null?e??[]:e==null?al(t):e.concat(t),uN=(...e)=>e.reduce(Zs,[]),tr=(e,t,n)=>{if(e===void 0)return Array.isArray(t)?t:[t];const s=(n==null?void 0:n.isEqual)??((a,u)=>a===u);for(const a of al(t))e.some(u=>s(u,a))||e.push(a);return e},cN=(e,t)=>e.reduce((n,s)=>{const a=s[t];return n[a]=Ie(n[a],s),n},{}),ya=(e,t,n)=>e.length===t.length&&e.every(n!=null&&n.isEqual?(s,a)=>n.isEqual(s,t[a]):(s,a)=>s===t[a]),lr=(e,t)=>Pn(e)===t,Pn=e=>{const t=typeof e;return t==="object"?e===null?"null":"object":t==="function"?"object":t},Ni={boolean:"boolean",null:"null",undefined:"undefined",bigint:"a bigint",number:"a number",object:"an object",string:"a string",symbol:"a symbol"},fN={...Ni,function:"a function"};class dN extends Error{}const bt=e=>ga(e,dN),ga=(e,t=Error)=>{throw new t(e)};class hN extends Error{constructor(){super(...arguments);w(this,"name","ParseError")}}const Z=e=>ga(e,hN),Uw=e=>` ${e}`,He=(e,t)=>{const n={},s=Array.isArray(e);let a=!1;for(const[u,c]of Object.entries(e).entries()){const d=s?t(u,c[1]):t(...c,u);a||(a=typeof d[0]=="number");const h=Array.isArray(d[0])||d.length===0?d:[d];for(const[p,y]of h)typeof p=="object"?n[p.group]=Ie(n[p.group],y):n[p]=y}return a?Object.values(n):n},qw=Object.entries,ai=(e,t)=>e in t,Rm=(e,t)=>t in e;class pN{constructor(t){Object.assign(this,t)}}const mN=class{};class Kw extends mN{}const yN=(e,t)=>{const n={},s={};let a;for(a in e)a in t?n[a]=e[a]:s[a]=e[a];return[n,s]},gN=(e,t)=>yN(e,t)[1],ol=e=>Object.keys(e).length===0,yc=e=>[...Object.entries(e),...Object.getOwnPropertySymbols(e).map(t=>[t,e[t]])],bN=(e,t)=>Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)),vN=e=>{const t=Object.keys(e).sort(),n={};for(let s=0;s<t.length;s++)n[t[s]]=e[t[s]];return n},Ti=Uw("represents an uninitialized value"),SN=e=>Object.values(e).filter(t=>typeof t=="number"?!0:typeof e[t]!="number"),Pw={Array,Boolean,Date,Error,Function,Map,Number,Promise,RegExp,Set,String,WeakMap,WeakSet},Iw=globalThis.File??Blob,Hw={ArrayBuffer,Blob,File:Iw,FormData,Headers,Request,Response,URL},xN={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array},ba={...Pw,...Hw,...xN,String,Number,Boolean},Om=e=>{var s;let t=Object.getPrototypeOf(e);for(;t!=null&&t.constructor&&(!ai(t.constructor.name,ba)||!(e instanceof ba[t.constructor.name]));)t=Object.getPrototypeOf(t);const n=(s=t==null?void 0:t.constructor)==null?void 0:s.name;if(!(n===void 0||n==="Object"))return n},yp=e=>typeof e=="object"&&e!==null?Om(e)??"object":Pn(e),Pt=Array.isArray,wN={Array:"an array",Function:"a function",Date:"a Date",RegExp:"a RegExp",Error:"an Error",Map:"a Map",Set:"a Set",String:"a String object",Number:"a Number object",Boolean:"a Boolean object",Promise:"a Promise",WeakMap:"a WeakMap",WeakSet:"a WeakSet"},AN={ArrayBuffer:"an ArrayBuffer instance",Blob:"a Blob instance",File:"a File instance",FormData:"a FormData instance",Headers:"a Headers instance",Request:"a Request instance",Response:"a Response instance",URL:"a URL instance"},TN={Int8Array:"an Int8Array",Uint8Array:"a Uint8Array",Uint8ClampedArray:"a Uint8ClampedArray",Int16Array:"an Int16Array",Uint16Array:"a Uint16Array",Int32Array:"an Int32Array",Uint32Array:"a Uint32Array",Float32Array:"a Float32Array",Float64Array:"a Float64Array",BigInt64Array:"a BigInt64Array",BigUint64Array:"a BigUint64Array"},EN={...wN,...AN,...TN},Mm=e=>{const t=Object(e).name??null;return t&&ai(t,ba)&&ba[t]===e?t:null},iS=(e,t)=>{let n=e.prototype;for(;n!==null;){if(n===t.prototype)return!0;n=Object.getPrototypeOf(n)}return!1},RN=e=>Gw(e,new Map),Gw=(e,t)=>{if(typeof e!="object"||e===null)return e;if(t!=null&&t.has(e))return t.get(e);const n=Mm(e.constructor);if(n==="Date")return new Date(e.getTime());if(n&&n!=="Array")return e;const s=Array.isArray(e)?e.slice():Object.create(Object.getPrototypeOf(e)),a=Object.getOwnPropertyDescriptors(e);if(t){t.set(e,s);for(const u in a){const c=a[u];"get"in c||"set"in c||(c.value=Gw(c.value,t))}}return Object.defineProperties(s,a),s},ON=e=>{let t=Ti;return()=>t===Ti?t=e():t},Pc=e=>typeof e=="function"&&e.length===0,MN=class extends Function{constructor(...e){const t=e.slice(0,-1),n=e.at(-1);try{super(...t,n)}catch(s){return bt(`Encountered an unexpected error while compiling your definition:
|
|
66
|
-
Message: ${s}
|
|
67
|
-
Source: (${e.slice(0,-1)}) => {
|
|
68
|
-
${e.at(-1)}
|
|
69
|
-
}`)}}};class Ta{constructor(t,...[n]){return Object.assign(Object.setPrototypeOf(t.bind((n==null?void 0:n.bind)??this),this.constructor.prototype),n==null?void 0:n.attach)}}const CN=ON(()=>{try{return new Function("return false")()}catch{return!0}});class oi{constructor(){}}const kN=()=>{var e,t,n;try{return(((n=(((t=(e=new Error().stack)==null?void 0:e.split(`
|
|
70
|
-
`)[2])==null?void 0:t.trim())||"").match(/\(?(.+?)(?::\d+:\d+)?\)?$/))==null?void 0:n[1])||"unknown").replace(/^file:\/\//,"")}catch{return"unknown"}};var Ax;const DN=((Ax=globalThis.process)==null?void 0:Ax.env)??{},NN={fileName:kN,env:DN},_N=e=>e[0].toUpperCase()+e.slice(1),Fw=e=>new RegExp($N(e),typeof e=="string"?"":e.flags),$N=e=>`^(?:${typeof e=="string"?e:e.source})$`,hs={negativeLookahead:e=>`(?!${e})`,nonCapturingGroup:e=>`(?:${e})`},gp="\\",Ic={" ":1,"\n":1," ":1},BN=/^-0\.?0*$/.source,Yw=/[1-9]\d*/.source,LN=/\.\d+/.source,VN=/\.\d*[1-9]/.source,Xw=e=>Fw(hs.negativeLookahead(BN)+hs.nonCapturingGroup("-?"+hs.nonCapturingGroup(hs.nonCapturingGroup("0|"+Yw)+hs.nonCapturingGroup(e.decimalPattern)+"?")+(e.allowDecimalOnly?"|"+e.decimalPattern:"")+"?")),sS=Xw({decimalPattern:VN,allowDecimalOnly:!1}),jN=sS.test.bind(sS),bp=Xw({decimalPattern:LN,allowDecimalOnly:!0});bp.test.bind(bp);const zN=/^-?\d*\.?\d*$/,UN=e=>e.length!==0&&zN.test(e),gc=Fw(hs.negativeLookahead("^-0$")+"-?"+hs.nonCapturingGroup(hs.nonCapturingGroup("0|"+Yw))),qN=gc.test.bind(gc),vp=/^-?\d+$/,KN=vp.test.bind(vp),Zw={number:"a number",bigint:"a bigint",integer:"an integer"},Jw=(e,t)=>`'${e}' was parsed as ${Zw[t]} but could not be narrowed to a literal value. Avoid unnecessary leading or trailing zeros and other abnormal notation`,PN=(e,t)=>t==="number"?jN(e):qN(e),IN=(e,t)=>t==="number"?Number(e):Number.parseInt(e),HN=(e,t)=>t==="number"?UN(e):KN(e),GN=(e,t)=>Cm(e,"number",t),FN=(e,t)=>Cm(e,"number",{...t,strict:!0}),YN=(e,t)=>Cm(e,"integer",t),Cm=(e,t,n)=>{const s=IN(e,t);return!Number.isNaN(s)&&HN(e,t)?n!=null&&n.strict?PN(e,t)?s:Z(Jw(e,t)):s:n!=null&&n.errorOnFail?Z((n==null?void 0:n.errorOnFail)===!0?`Failed to parse ${Zw[t]} from '${e}'`:n==null?void 0:n.errorOnFail):void 0},XN=e=>{if(e[e.length-1]!=="n")return;const t=e.slice(0,-1);let n;try{n=BigInt(t)}catch{return}if(gc.test(t))return n;if(vp.test(t))return Z(Jw(e,"bigint"))},ZN="0.46.0",JN={version:ZN,filename:NN.fileName(),FileConstructor:Iw},ll=JN,rS=new Map,kh=Object.create(null),Sp=e=>{const t=rS.get(e);if(t)return t;let n=QN(e);return kh[n]?n=`${n}${kh[n]++}`:kh[n]=1,ll[n]=e,rS.set(e,n),n},Ho=e=>/^[$A-Z_a-z][\w$]*$/.test(e),QN=e=>{switch(typeof e){case"object":{if(e===null)break;const t=Om(e)??"object";return t[0].toLowerCase()+t.slice(1)}case"function":return Ho(e.name)?e.name:"fn";case"symbol":return e.description&&Ho(e.description)?e.description:"symbol"}return bt(`Unexpected attempt to register serializable value of type ${Pn(e)}`)},km=e=>typeof e=="string"?JSON.stringify(e):typeof e=="bigint"?`${e}n`:`${e}`,WN=(e,t={})=>jo(e,{onUndefined:"$ark.undefined",onBigInt:n=>`$ark.bigint-${n}`,...t},[]),qe=(e,t)=>{switch(Pn(e)){case"object":const n=e,s=n.constructor.name;return s==="Object"||s==="Array"?(t==null?void 0:t.quoteKeys)===!1?bc(n,(t==null?void 0:t.indent)??0,""):JSON.stringify(jo(n,va,[]),null,t==null?void 0:t.indent):bc(n,(t==null?void 0:t.indent)??0,"");case"symbol":return va.onSymbol(e);default:return km(e)}},bc=(e,t,n)=>{if(typeof e=="function")return va.onFunction(e);if(typeof e!="object"||e===null)return km(e);const s=n+" ".repeat(t);if(Array.isArray(e)){if(e.length===0)return"[]";const u=e.map(c=>bc(c,t,s)).join(`,
|
|
71
|
-
`+s);return t?`[
|
|
72
|
-
${s}${u}
|
|
73
|
-
${n}]`:`[${u}]`}const a=e.constructor.name;if(a==="Object"){const u=yc(e).map(([c,d])=>{const h=typeof c=="symbol"?va.onSymbol(c):Ho(c)?c:JSON.stringify(c),p=bc(d,t,s);return`${s}${h}: ${p}`});return u.length===0?"{}":t?`{
|
|
74
|
-
${u.join(`,
|
|
75
|
-
`)}
|
|
76
|
-
${n}}`:`{${u.join(", ")}}`}return e instanceof Date?ul(e):"expression"in e&&typeof e.expression=="string"?e.expression:a},va={onCycle:()=>"(cycle)",onSymbol:e=>`Symbol(${Sp(e)})`,onFunction:e=>`Function(${Sp(e)})`},jo=(e,t,n)=>{var s,a;switch(Pn(e)){case"object":{const u=e;if("toJSON"in u&&typeof u.toJSON=="function")return u.toJSON();if(typeof u=="function")return va.onFunction(u);if(n.includes(u))return"(cycle)";const c=[...n,u];if(Array.isArray(u))return u.map(h=>jo(h,t,c));if(u instanceof Date)return u.toDateString();const d={};for(const h in u)d[h]=jo(u[h],t,c);for(const h of Object.getOwnPropertySymbols(u))d[((s=t.onSymbol)==null?void 0:s.call(t,h))??h.toString()]=jo(u[h],t,c);return d}case"symbol":return va.onSymbol(e);case"bigint":return((a=t.onBigInt)==null?void 0:a.call(t,e))??`${e}n`;case"undefined":return t.onUndefined??"undefined";case"string":return e.replaceAll("\\","\\\\");default:return e}},ul=e=>{const t=e.getFullYear(),n=e.getMonth(),s=e.getDate(),a=e.getHours(),u=e.getMinutes(),c=e.getSeconds(),d=e.getMilliseconds();if(n===0&&s===1&&a===0&&u===0&&c===0&&d===0)return`${t}`;const h=`${e_[n]} ${s}, ${t}`;if(a===0&&u===0&&c===0&&d===0)return h;let p=e.toLocaleTimeString();const y=p.endsWith(" AM")||p.endsWith(" PM")?p.slice(-3):"";return y&&(p=p.slice(0,-y.length)),d?p+=`.${n_(d,3)}`:t_.test(p)&&(p=p.slice(0,-3)),`${p+y}, ${h}`},e_=["January","February","March","April","May","June","July","August","September","October","November","December"],t_=/:\d\d:00$/,n_=(e,t)=>String(e).padStart(t,"0"),Qw=(e,t,...[n])=>{const s=(n==null?void 0:n.stringifySymbol)??qe;let a=e;switch(typeof t){case"string":a=Ho(t)?e===""?t:`${e}.${t}`:`${e}[${JSON.stringify(t)}]`;break;case"number":a=`${e}[${t}]`;break;case"symbol":a=`${e}[${s(t)}]`;break;default:n!=null&&n.stringifyNonKey?a=`${e}[${n.stringifyNonKey(t)}]`:Z(`${qe(t)} must be a PropertyKey or stringifyNonKey must be passed to options`)}return a},cl=(e,...t)=>e.reduce((n,s)=>Qw(n,s,...t),"");class Ww extends zw{constructor(...n){super();w(this,"cache",{});this.push(...n)}toJSON(){if(this.cache.json)return this.cache.json;this.cache.json=[];for(let n=0;n<this.length;n++)this.cache.json.push(typeof this[n]=="symbol"?qe(this[n]):this[n]);return this.cache.json}stringify(){return this.cache.stringify?this.cache.stringify:this.cache.stringify=cl(this)}stringifyAncestors(){if(this.cache.stringifyAncestors)return this.cache.stringifyAncestors;let n="";const s=[n];for(const a of this)n=Qw(n,a),s.push(n);return this.cache.stringifyAncestors=s}}class i_{constructor(t){w(this,"chars");w(this,"i");w(this,"def");this.def=t,this.chars=[...t],this.i=0}shift(){return this.chars[this.i++]??""}get lookahead(){return this.chars[this.i]??""}get nextLookahead(){return this.chars[this.i+1]??""}get length(){return this.chars.length}shiftUntil(t){let n="";for(;this.lookahead;){if(t(this,n))if(n[n.length-1]===gp)n=n.slice(0,-1);else break;n+=this.shift()}return n}shiftUntilLookahead(t){return typeof t=="string"?this.shiftUntil(n=>n.lookahead===t):this.shiftUntil(n=>n.lookahead in t)}shiftUntilNonWhitespace(){return this.shiftUntil(()=>!(this.lookahead in Ic))}jumpToIndex(t){this.i=t<0?this.length+t:t}jumpForward(t){this.i+=t}get location(){return this.i}get unscanned(){return this.chars.slice(this.i,this.length).join("")}get scanned(){return this.chars.slice(0,this.i).join("")}sliceChars(t,n){return this.chars.slice(t,n).join("")}lookaheadIs(t){return this.lookahead===t}lookaheadIsIn(t){return this.lookahead in t}}let xp="$ark",s_=2;for(;xp in globalThis;)xp=`$ark${s_++}`;const eA=xp;globalThis[eA]=ll;const W=ll,r_=e=>`${eA}.${e}`,Xt=e=>r_(Sp(e));class tA extends Kw{constructor(...n){super();w(this,"argNames");w(this,"body","");w(this,"indentation",0);this.argNames=n;for(const s of n){if(s in this)throw new Error(`Arg name '${s}' would overwrite an existing property on FunctionBody`);this[s]=s}}indent(){return this.indentation+=4,this}dedent(){return this.indentation-=4,this}prop(n,s=!1){return nA(n,s)}index(n,s=!1){return iA(`${n}`,s)}line(n){return this.body+=`${" ".repeat(this.indentation)}${n}
|
|
77
|
-
`,this}const(n,s){return this.line(`const ${n} = ${s}`),this}let(n,s){return this.line(`let ${n} = ${s}`)}set(n,s){return this.line(`${n} = ${s}`)}if(n,s){return this.block(`if (${n})`,s)}elseIf(n,s){return this.block(`else if (${n})`,s)}else(n){return this.block("else",n)}for(n,s,a=0){return this.block(`for (let i = ${a}; ${n}; i++)`,s)}forIn(n,s){return this.block(`for (const k in ${n})`,s)}block(n,s,a=""){return this.line(`${n} {`),this.indent(),s(this),this.dedent(),this.line(`}${a}`)}return(n=""){return this.line(`return ${n}`)}write(n="anonymous",s=0){return`${n}(${this.argNames.join(", ")}) { ${s?this.body.split(`
|
|
78
|
-
`).map(a=>" ".repeat(s)+`${a}`).join(`
|
|
79
|
-
`):this.body} }`}compile(){return new MN(...this.argNames,this.body)}}const fl=e=>lr(e,"object")||typeof e=="symbol"?Xt(e):km(e),nA=(e,t=!1)=>typeof e=="string"&&Ho(e)?`${t?"?":""}.${e}`:iA(a_(e),t),a_=e=>typeof e=="symbol"?Xt(e):JSON.stringify(e),iA=(e,t=!1)=>`${t?"?.":""}[${e}]`;class Dh extends tA{constructor(n){super("data","ctx");w(this,"traversalKind");w(this,"optimistic");this.traversalKind=n.kind,this.optimistic=n.optimistic===!0}invoke(n,s){const a=(s==null?void 0:s.arg)??this.data,u=typeof n=="string"?!0:this.requiresContextFor(n),c=typeof n=="string"?n:n.id;return u?`${this.referenceToId(c,s)}(${a}, ${this.ctx})`:`${this.referenceToId(c,s)}(${a})`}referenceToId(n,s){const a=(s==null?void 0:s.kind)??this.traversalKind,u=`this.${n}${a}`;return s!=null&&s.bind?`${u}.bind(${s==null?void 0:s.bind})`:u}requiresContextFor(n){return this.traversalKind==="Apply"||n.allowsRequiresContext}initializeErrorCount(){return this.const("errorCount","ctx.currentErrorCount")}returnIfFail(){return this.if("ctx.currentErrorCount > errorCount",()=>this.return())}returnIfFailFast(){return this.if("ctx.failFast && ctx.currentErrorCount > errorCount",()=>this.return())}traverseKey(n,s,a){const u=this.requiresContextFor(a);return u&&this.line(`${this.ctx}.path.push(${n})`),this.check(a,{arg:s}),u&&this.line(`${this.ctx}.path.pop()`),this}check(n,s){return this.traversalKind==="Allows"?this.if(`!${this.invoke(n,s)}`,()=>this.return(!1)):this.line(this.invoke(n,s))}}const sA=e=>He(e,(t,n)=>[t,Pt(n)?[...n]:n]),_i=Uw("arkKind"),fe=(e,t)=>(e==null?void 0:e[_i])===t,Ft=e=>fe(e,"root")||fe(e,"constraint"),o_=["unit","proto","domain"],Hc=["required","optional","index","sequence"],rA=["pattern","divisor","exactLength","max","min","maxLength","minLength","before","after"],Dm=[...rA,...Hc,"structure","predicate"],Gc=["alias","union","morph","unit","intersection","proto","domain"],l_=[...Gc,...Dm],aA=He(Dm,(e,t)=>[t,1]),u_=He([...Hc,"undeclared"],(e,t)=>[t,1]),oA=He(l_,(e,t)=>[t,e]),Xu=e=>typeof e=="string"&&e in oA,vc=e=>oA[e],Nm=e=>Gc.slice(vc(e)+1);[...Nm("union")];[...Nm("morph")];const or=e=>typeof e=="string"||typeof e=="boolean"||e===null?e:typeof e=="number"?Number.isNaN(e)?"NaN":e===Number.POSITIVE_INFINITY?"Infinity":e===Number.NEGATIVE_INFINITY?"-Infinity":e:fl(e),Fc=e=>{let t="{ ";for(const[n,s]of Object.entries(e))t+=`${n}: ${fl(s)}, `;return t+" }"},ot=e=>{var n,s,a,u;const t=e;return t.hasAssociatedError&&((n=t.defaults).expected??(n.expected=c=>"description"in c?c.description:t.defaults.description(c)),(s=t.defaults).actual??(s.actual=c=>qe(c)),(a=t.defaults).problem??(a.problem=c=>`must be ${c.expected}${c.actual?` (was ${c.actual})`:""}`),(u=t.defaults).message??(u.message=c=>{if(c.path.length===0)return c.problem;const d=`${c.propString} ${c.problem}`;return d[0]==="["?`value at ${d}`:d})),t};class c_ extends Error{constructor(n,s){super(qe(s,{quoteKeys:!1,indent:4}));w(this,"name","ToJsonSchemaError");w(this,"code");w(this,"context");this.code=n,this.context=s}hasCode(n){return this.code===n}}const f_={dialect:"https://json-schema.org/draft/2020-12/schema",useRefs:!1,fallback:{arrayObject:e=>xt.throw("arrayObject",e),arrayPostfix:e=>xt.throw("arrayPostfix",e),defaultValue:e=>xt.throw("defaultValue",e),domain:e=>xt.throw("domain",e),morph:e=>xt.throw("morph",e),patternIntersection:e=>xt.throw("patternIntersection",e),predicate:e=>xt.throw("predicate",e),proto:e=>xt.throw("proto",e),symbolKey:e=>xt.throw("symbolKey",e),unit:e=>xt.throw("unit",e),date:e=>xt.throw("date",e)}},xt={Error:c_,throw:(...e)=>{throw new xt.Error(...e)},throwInternalOperandError:(e,t)=>bt(`Unexpected JSON Schema input for ${e}: ${qe(t)}`),defaultConfig:f_};W.config??(W.config={});const wp=(e,t)=>{if(!t)return e;const n={...e};let s;for(s in t){const a={...e.keywords};if(s==="keywords"){for(const u in t[s]){const c=t.keywords[u];c!==void 0&&(a[u]=typeof c=="string"?{description:c}:c)}n.keywords=a}else s==="toJsonSchema"?n[s]=lA(e.toJsonSchema,t.toJsonSchema):Xu(s)?n[s]={...e[s],...t[s]}:n[s]=t[s]}return n},lA=(e,t)=>{if(!e)return t??{};if(!t)return e;const n={...e};let s;for(s in t)s==="fallback"?n.fallback=d_(e.fallback,t.fallback):n[s]=t[s];return n},d_=(e,t)=>{e=aS(e),t=aS(t);const n={};let s;for(s in xt.defaultConfig.fallback)n[s]=t[s]??t.default??e[s]??e.default??xt.defaultConfig.fallback[s];return n},aS=e=>typeof e=="function"?{default:e}:e??{};var Tx,Ex;class Sa extends(Ex=Kw,Tx=_i,Ex){constructor({prefixPath:n,relativePath:s,...a},u){super();w(this,Tx,"error");w(this,"path");w(this,"data");w(this,"nodeConfig");w(this,"input");w(this,"ctx");this.input=a,this.ctx=u,bN(this,a);const c=u.data;a.code==="union"&&(a.errors=a.errors.flatMap(h=>{const p=h.hasCode("union")?h.errors:[h];return!n&&!s?p:p.map(y=>y.transform(g=>({...g,path:uN(n,g.path,s)})))})),this.nodeConfig=u.config[this.code];const d=[...a.path??u.path];s&&d.push(...s),n&&d.unshift(...n),this.path=new Ww(...d),this.data="data"in a?a.data:c}transform(n){return new Sa(n({data:this.data,path:this.path,...this.input}),this.ctx)}hasCode(n){return this.code===n}get propString(){return cl(this.path)}get expected(){var s;if(this.input.expected)return this.input.expected;const n=((s=this.meta)==null?void 0:s.expected)??this.nodeConfig.expected;return typeof n=="function"?n(this.input):n}get actual(){var s;if(this.input.actual)return this.input.actual;const n=((s=this.meta)==null?void 0:s.actual)??this.nodeConfig.actual;return typeof n=="function"?n(this.data):n}get problem(){var s;if(this.input.problem)return this.input.problem;const n=((s=this.meta)==null?void 0:s.problem)??this.nodeConfig.problem;return typeof n=="function"?n(this):n}get message(){var s;if(this.input.message)return this.input.message;const n=((s=this.meta)==null?void 0:s.message)??this.nodeConfig.message;return typeof n=="function"?n(this):n}get flat(){return this.hasCode("intersection")?[...this.errors]:[this]}toJSON(){return{data:this.data,path:this.path,...this.input,expected:this.expected,actual:this.actual,problem:this.problem,message:this.message}}toString(){return this.message}throw(){throw this}}var Rx,Ox;class vs extends(Ox=zw,Rx=_i,Ox){constructor(n){super();w(this,Rx,"errors");w(this,"ctx");w(this,"byPath",Object.create(null));w(this,"byAncestorPath",Object.create(null));w(this,"count",0);w(this,"mutable",this);this.ctx=n}get flatByPath(){return He(this.byPath,(n,s)=>[n,s.flat])}get flatProblemsByPath(){return He(this.byPath,(n,s)=>[n,s.flat.map(a=>a.problem)])}throw(){throw this.toTraversalError()}toTraversalError(){return new h_(this)}add(n){this.includes(n)||this._add(n)}transform(n){const s=new vs(this.ctx);for(const a of this)s.add(n(a));return s}merge(n){for(const s of n)this.includes(s)||this._add(new Sa({...s,path:[...this.ctx.path,...s.path]},this.ctx))}affectsPath(n){return this.length===0?!1:n.stringifyAncestors().some(s=>s in this.byPath)||n.stringify()in this.byAncestorPath}get summary(){return this.toString()}get issues(){return this}toJSON(){return[...this.map(n=>n.toJSON())]}toString(){return this.join(`
|
|
80
|
-
`)}_add(n){const s=this.byPath[n.propString];if(s){if(s.hasCode("union")&&s.errors.length===0)return;const a=n.hasCode("union")&&n.errors.length===0?n:new Sa({code:"intersection",errors:s.hasCode("intersection")?[...s.errors,n]:[s,n]},this.ctx),u=this.indexOf(s);this.mutable[u===-1?this.length:u]=a,this.byPath[n.propString]=a,this.addAncestorPaths(n)}else this.byPath[n.propString]=n,this.addAncestorPaths(n),this.mutable.push(n);this.count++}addAncestorPaths(n){for(const s of n.path.stringifyAncestors())this.byAncestorPath[s]=Ie(this.byAncestorPath[s],n)}}class h_ extends Error{constructor(n){var t=(...Hq)=>(super(...Hq),w(this,"name","TraversalError"),this);n.length===1?t(n.summary):t(`
|
|
81
|
-
`+n.map(s=>` โข ${p_(s)}`).join(`
|
|
82
|
-
`)),Object.defineProperty(this,"arkErrors",{value:n,enumerable:!1})}}const p_=e=>e.toString().split(`
|
|
83
|
-
`).join(`
|
|
84
|
-
`);class ta{constructor(t,n){w(this,"path",[]);w(this,"errors",new vs(this));w(this,"root");w(this,"config");w(this,"queuedMorphs",[]);w(this,"branches",[]);w(this,"seen",{});this.root=t,this.config=n}get data(){let t=this.root;for(const n of this.path)t=t==null?void 0:t[n];return t}get propString(){return cl(this.path)}reject(t){return this.error(t),!1}mustBe(t){return this.error(t),!1}error(t){const n=typeof t=="object"?t.code?t:{...t,code:"predicate"}:{code:"predicate",expected:t};return this.errorFromContext(n)}hasError(){return this.currentErrorCount!==0}get currentBranch(){return this.branches.at(-1)}queueMorphs(t){const n={path:new Ww(...this.path),morphs:t};this.currentBranch?this.currentBranch.queuedMorphs.push(n):this.queuedMorphs.push(n)}finalize(t){return this.queuedMorphs.length&&(typeof this.root=="object"&&this.root!==null&&this.config.clone&&(this.root=this.config.clone(this.root)),this.applyQueuedMorphs()),this.hasError()?t?t(this.errors):this.errors:this.root}get currentErrorCount(){return this.currentBranch?this.currentBranch.error?1:0:this.errors.count}get failFast(){return this.branches.length!==0}pushBranch(){this.branches.push({error:void 0,queuedMorphs:[]})}popBranch(){return this.branches.pop()}get external(){return this}errorFromNodeContext(t){return this.errorFromContext(t)}errorFromContext(t){const n=new Sa(t,this);return this.currentBranch?this.currentBranch.error=n:this.errors.add(n),n}applyQueuedMorphs(){for(;this.queuedMorphs.length;){const t=this.queuedMorphs;this.queuedMorphs=[];for(const{path:n,morphs:s}of t)this.errors.affectsPath(n)||this.applyMorphsAtPath(n,s)}}applyMorphsAtPath(t,n){const s=t.at(-1);let a;if(s!==void 0){a=this.root;for(let u=0;u<t.length-1;u++)a=a[t[u]]}this.path=[...t];for(const u of n){const c=Ft(u),d=u(a===void 0?this.root:a[s],this);if(d instanceof Sa){this.errors.add(d);break}if(d instanceof vs){c||this.errors.merge(d);break}a===void 0?this.root=d:a[s]=d,this.applyQueuedMorphs()}}}const $i=(e,t,n)=>{if(!n)return t();n.path.push(e);const s=t();return n.path.pop(),s};class uA extends Ta{constructor(n,s){var u;super((c,d,h=this.onFail)=>d?(this.traverseApply(c,d),d.hasError()?d.errors:d.data):this.rootApply(c,h),{attach:n});w(this,"attachments");w(this,"$");w(this,"onFail");w(this,"includesTransform");w(this,"includesContextualPredicate");w(this,"isCyclic");w(this,"allowsRequiresContext");w(this,"rootApplyStrategy");w(this,"contextFreeMorph");w(this,"rootApply");w(this,"referencesById");w(this,"shallowReferences");w(this,"flatRefs");w(this,"flatMorphs");w(this,"allows");w(this,"compiledMeta",g_(this.metaJson));w(this,"precedence",vc(this.kind));w(this,"precompilation");w(this,"assert",(n,s)=>this(n,s,a=>a.throw()));this.attachments=n,this.$=s,this.onFail=this.meta.onFail??this.$.resolvedConfig.onFail,this.includesTransform=this.hasKind("morph")||this.hasKind("structure")&&this.structuralMorph!==void 0,this.includesContextualPredicate=this.hasKind("predicate")&&this.inner.predicate.length!==1,this.isCyclic=this.kind==="alias",this.referencesById={[this.id]:this},this.shallowReferences=this.hasKind("structure")?[this,...this.children]:this.children.reduce((c,d)=>b_(c,d.shallowReferences),[this]);const a=this.isStructural();this.flatRefs=[],this.flatMorphs=[];for(let c=0;c<this.children.length;c++){if(this.includesTransform||(this.includesTransform=this.children[c].includesTransform),this.includesContextualPredicate||(this.includesContextualPredicate=this.children[c].includesContextualPredicate),this.isCyclic||(this.isCyclic=this.children[c].isCyclic),!a){const d=this.children[c].flatRefs;for(let h=0;h<d.length;h++){const p=d[h];if(!this.flatRefs.some(y=>cA(y,p))){this.flatRefs.push(p);for(const y of p.node.branches)(y.hasKind("morph")||y.hasKind("intersection")&&((u=y.structure)==null?void 0:u.structuralMorph)!==void 0)&&this.flatMorphs.push({path:p.path,propString:p.propString,node:y})}}}Object.assign(this.referencesById,this.children[c].referencesById)}this.flatRefs.sort((c,d)=>c.path.length>d.path.length?1:c.path.length<d.path.length?-1:c.propString>d.propString?1:c.propString<d.propString||c.node.expression<d.node.expression?-1:1),this.allowsRequiresContext=this.includesContextualPredicate||this.isCyclic,this.rootApplyStrategy=!this.allowsRequiresContext&&this.flatMorphs.length===0?this.shallowMorphs.length===0?"allows":this.shallowMorphs.every(c=>c.length===1||c.name==="$arkStructuralMorph")?this.hasKind("union")?this.branches.some(c=>c.shallowMorphs.length>1)?"contextual":"branchedOptimistic":this.shallowMorphs.length>1?"contextual":"optimistic":"contextual":"contextual",this.rootApply=this.createRootApply(),this.allows=this.allowsRequiresContext?c=>this.traverseAllows(c,new ta(c,this.$.resolvedConfig)):c=>this.traverseAllows(c)}get shallowMorphs(){return[]}createRootApply(){switch(this.rootApplyStrategy){case"allows":return(s,a)=>{if(this.allows(s))return s;const u=new ta(s,this.$.resolvedConfig);return this.traverseApply(s,u),u.finalize(a)};case"contextual":return(s,a)=>{const u=new ta(s,this.$.resolvedConfig);return this.traverseApply(s,u),u.finalize(a)};case"optimistic":this.contextFreeMorph=this.shallowMorphs[0];const n=this.$.resolvedConfig.clone;return(s,a)=>{if(this.allows(s))return this.contextFreeMorph(n&&(typeof s=="object"&&s!==null||typeof s=="function")?n(s):s);const u=new ta(s,this.$.resolvedConfig);return this.traverseApply(s,u),u.finalize(a)};case"branchedOptimistic":return this.createBranchedOptimisticRootApply();default:return this.rootApplyStrategy,bt(`Unexpected rootApplyStrategy ${this.rootApplyStrategy}`)}}cacheGetter(n,s){return Object.defineProperty(this,n,{value:s}),s}get description(){var n;return this.cacheGetter("description",((n=this.meta)==null?void 0:n.description)??this.$.resolvedConfig[this.kind].description(this))}get references(){return Object.values(this.referencesById)}traverse(n,s){return this(n,s,null)}get in(){return this.cacheGetter("in",this.getIo("in"))}get out(){return this.cacheGetter("out",this.getIo("out"))}getIo(n){if(!this.includesTransform)return this;const s={};for(const[a,u]of this.innerEntries){const c=this.impl.keys[a];if(c.reduceIo)c.reduceIo(n,s,u);else if(c.child){const d=u;s[a]=Pt(d)?d.map(h=>h[n]):d[n]}else s[a]=u}return this.$.node(this.kind,s)}toJSON(){return this.json}toString(){return`Type<${this.expression}>`}equals(n){const s=Ft(n)?n:this.$.parseDefinition(n);return this.innerHash===s.innerHash}ifEquals(n){return this.equals(n)?this:void 0}hasKind(n){return this.kind===n}assertHasKind(n){return this.kind!==n&&ga(`${this.kind} node was not of asserted kind ${n}`),this}hasKindIn(...n){return n.includes(this.kind)}assertHasKindIn(...n){return Hs(n,this.kind)||ga(`${this.kind} node was not one of asserted kinds ${n}`),this}isBasis(){return Hs(o_,this.kind)}isConstraint(){return Hs(Dm,this.kind)}isStructural(){return Hs(Hc,this.kind)}isRefinement(){return Hs(rA,this.kind)}isRoot(){return Hs(Gc,this.kind)}isUnknown(){return this.hasKind("intersection")&&this.children.length===0}isNever(){return this.hasKind("union")&&this.children.length===0}hasUnit(n){return this.hasKind("unit")&&this.allows(n)}hasOpenIntersection(){return this.impl.intersectionIsOpen}get nestableExpression(){return this.expression}select(n){const s=_o.normalize(n);return this._select(s)}_select(n){let s=_o.applyBoundary[n.boundary??"references"](this);return n.kind&&(s=s.filter(a=>a.kind===n.kind)),n.where&&(s=s.filter(n.where)),_o.applyMethod[n.method??"filter"](s,this,n)}transform(n,s){return this._transform(n,this._createTransformContext(s))}_createTransformContext(n){return{root:this,selected:void 0,seen:{},path:[],parseOptions:{prereduced:(n==null?void 0:n.prereduced)??!1},undeclaredKeyHandling:void 0,...n}}_transform(n,s){var g;const a=s.bindScope??this.$;if(s.seen[this.id])return this.$.lazilyResolve(s.seen[this.id]);if(((g=s.shouldTransform)==null?void 0:g.call(s,this,s))===!1)return this;let u;s.seen[this.id]=()=>u,this.hasKind("structure")&&this.undeclared!==s.undeclaredKeyHandling&&(s={...s,undeclaredKeyHandling:this.undeclared});const c=He(this.inner,(v,S)=>{if(!this.impl.keys[v].child)return[v,S];const T=S;if(!Pt(T)){const M=T._transform(n,s);return M?[v,M]:[]}if(T.length===0)return[v,S];const R=T.flatMap(M=>M._transform(n,s)??[]);return R.length?[v,R]:[]});delete s.seen[this.id];const d=Object.assign(c,{meta:this.meta}),h=s.selected&&!s.selected.includes(this)?d:n(this.kind,d,s);if(h===null)return null;if(Ft(h))return u=h;const p=Object.keys(h);return(p.length===0||p.length===1&&p[0]==="meta")&&!ol(this.inner)?null:(this.kind==="required"||this.kind==="optional"||this.kind==="index")&&!("value"in h)?s.undeclaredKeyHandling?{...h,value:W.intrinsic.unknown}:null:(this.kind==="morph"&&(h.in??(h.in=W.intrinsic.unknown)),u=a.node(this.kind,h,s.parseOptions))}configureReferences(n,s="references"){const a=_o.normalize(s),u=typeof n=="string"?(p,y)=>({...y,meta:{...y.meta,description:n}}):typeof n=="function"?(p,y)=>({...y,meta:n(y.meta)}):(p,y)=>({...y,meta:{...y.meta,...n}});if(a.boundary==="self")return this.$.node(this.kind,u(this.kind,{...this.inner,meta:this.meta}));const c=this._select(a),d=c&&al(c),h=a.boundary==="child"?(p,y)=>y.root.children.includes(p):a.boundary==="shallow"?p=>p.kind!=="structure":()=>!0;return this.$.finalize(this.transform(u,{shouldTransform:h,selected:d}))}}const _o={applyBoundary:{self:e=>[e],child:e=>[...e.children],shallow:e=>[...e.shallowReferences],references:e=>[...e.references]},applyMethod:{filter:e=>e,assertFilter:(e,t,n)=>(e.length===0&&ga(oS(t,n)),e),find:e=>e[0],assertFind:(e,t,n)=>(e.length===0&&ga(oS(t,n)),e[0])},normalize:e=>typeof e=="function"?{boundary:"references",method:"filter",where:e}:typeof e=="string"?ai(e,_o.applyBoundary)?{method:"filter",boundary:e}:{boundary:"references",method:"filter",kind:e}:{boundary:"references",method:"filter",...e}},oS=(e,t)=>`${e} had no references matching ${qe(t)}.`,m_=e=>cl(e,{stringifyNonKey:t=>t.expression}),y_=/"(\$ark\.[^"]+)"/g,g_=e=>JSON.stringify(e).replaceAll(y_,"$1"),ps=(e,t)=>({path:e,node:t,propString:m_(e)}),cA=(e,t)=>e.propString===t.propString&&e.node.equals(t.node),lS=(e,t)=>tr(e,t,{isEqual:cA}),b_=(e,t)=>tr(e,t,{isEqual:(n,s)=>n.equals(s)});class oe extends Array{static init(t,n,s,a){return new oe({kind:t,l:n,r:s,path:(a==null?void 0:a.path)??[],optional:(a==null?void 0:a.optional)??!1})}add(t,n,s,a){return this.push({kind:t,l:n,r:s,path:(a==null?void 0:a.path)??[],optional:(a==null?void 0:a.optional)??!1}),this}get summary(){return this.describeReasons()}describeReasons(){if(this.length===1){const{path:t,l:n,r:s}=this[0],a=cl(t);return fA(`Intersection${a&&` at ${a}`} of ${uS(n,s)}`)}return`The following intersections result in unsatisfiable types:
|
|
85
|
-
โข ${this.map(({path:t,l:n,r:s})=>`${t}: ${uS(n,s)}`).join(`
|
|
86
|
-
โข `)}`}throw(){return Z(this.describeReasons())}invert(){const t=this.map(n=>({...n,l:n.r,r:n.l}));return t instanceof oe?t:new oe(...t)}withPrefixKey(t,n){return this.map(s=>({...s,path:[t,...s.path],optional:s.optional||n==="optional"}))}toNeverIfDisjoint(){return W.intrinsic.never}}const uS=(e,t)=>`${Ap(e)} and ${Ap(t)}`,Ap=e=>Ft(e)?e.expression:Pt(e)?e.map(Ap).join(" | ")||"never":String(e),fA=e=>`${e} results in an unsatisfiable type`,Jr={},Bi=(e,t,n)=>Ct(e,t,{$:n,invert:!1,pipe:!1}),Tp=(e,t,n)=>Ct(e,t,{$:n,invert:!1,pipe:!0}),Ct=(e,t,n)=>{const s=n.pipe?"|>":"&",a=`${e.hash}${s}${t.hash}`;if(Jr[a]!==void 0)return Jr[a];if(!n.pipe){const d=`${t.hash}${s}${e.hash}`;if(Jr[d]!==void 0){const h=Jr[d],p=h instanceof oe?h.invert():h;return Jr[a]=p,p}}const u=!n.pipe||!e.includesTransform&&!t.includesTransform;if(u&&e.equals(t))return e;let c=u?Ep(e,t,n):e.hasKindIn(...Gc)?v_(e,t,n):Ep(e,t,n);return Ft(c)&&(e.equals(c)?c=e:t.equals(c)&&(c=t)),Jr[a]=c,c},Ep=(e,t,n)=>{const s=e.precedence<t.precedence?e.kind:t.kind,a=e.impl.intersections[t.kind]??t.impl.intersections[e.kind];if(a===void 0)return null;if(s===e.kind)return a(e,t,n);{let u=a(t,e,{...n,invert:!n.invert});return u instanceof oe&&(u=u.invert()),u}},v_=(e,t,n)=>e.includesTransform||t.includesTransform?n.invert?cS(t,e,n):cS(e,t,n):Ep(e,t,n),cS=(e,t,n)=>e.distribute(s=>S_(s,t,n),s=>{const a=s.filter(Ft);if(a.length===0)return oe.init("union",e.branches,t.branches);if(a.length<e.branches.length||!e.branches.every((c,d)=>c.in.equals(a[d].in)))return n.$.parseSchema(a);if(a.length===1)return a[0];const u={branches:a};return n.$.parseSchema(u)}),S_=(e,t,n)=>{if(e.hasKind("morph")){const a=[...e.morphs];if(e.lastMorphIfNode){const u=Ct(e.lastMorphIfNode,t,n);if(u instanceof oe)return u;a[a.length-1]=u}else a.push(t);return n.$.node("morph",{morphs:a,in:e.inner.in})}if(t.hasKind("morph")){const a=Ct(e,t.in,n);return a instanceof oe?a:n.$.node("morph",{morphs:[t],in:a})}return n.$.node("morph",{morphs:[t],in:e})};class Ea extends uA{constructor(n,s){super(n,s);w(this,"impliedSiblings");Object.defineProperty(this,_i,{value:"constraint",enumerable:!1})}intersect(n){return Bi(this,n,this.$)}}class Yc extends Ea{constructor(){super(...arguments);w(this,"traverseApply",(n,s)=>{this.traverseAllows(n,s)||s.errorFromNodeContext(this.errorContext)})}compile(n){n.traversalKind==="Allows"?n.return(this.compiledCondition):n.if(this.compiledNegation,()=>n.line(`${n.ctx}.errorFromNodeContext(${this.compiledErrorContext})`))}get errorContext(){return{code:this.kind,description:this.description,meta:this.meta,...this.inner}}get compiledErrorContext(){return Fc(this.errorContext)}}const tn=e=>(t,n)=>{if(Pt(t)){if(t.length===0)return;const a=t.map(u=>n.$.node(e,u));return e==="predicate"?a:a.sort((u,c)=>u.hash<c.hash?-1:1)}const s=n.$.node(e,t);return s.hasOpenIntersection()?[s]:s},Sc=e=>{const t=e.r.shift();if(!t){let s=e.l.length===0&&e.kind==="structure"?W.intrinsic.unknown.internal:e.ctx.$.node(e.kind,Object.assign(e.baseInner,x_(e.l)),{prereduced:!0});for(const a of e.roots){if(s instanceof oe)return s;s=Ct(a,s,e.ctx)}return s}let n=!1;for(let s=0;s<e.l.length;s++){const a=Ct(e.l[s],t,e.ctx);if(a!==null){if(a instanceof oe)return a;if(n){if(!e.l.includes(a))return bt(`Unexpectedly encountered multiple distinct intersection results for refinement ${a}`)}else{if(a.isRoot())return e.roots.push(a),e.l.splice(s),Sc(e);e.l[s]=a,n=!0}}}if(n||e.l.push(t),e.kind==="intersection"&&t.impliedSiblings)for(const s of t.impliedSiblings)tr(e.r,s);return Sc(e)},xc=e=>Object.entries(e).flatMap(([n,s])=>n in aA?s:[]).sort((n,s)=>n.precedence<s.precedence?-1:n.precedence>s.precedence?1:n.kind==="predicate"&&s.kind==="predicate"?0:n.hash<s.hash?-1:1),x_=e=>{const t={};for(const n of e)if(n.hasOpenIntersection())t[n.kind]=Ie(t[n.kind],n);else{if(t[n.kind])return bt(`Unexpected intersection of closed refinements of kind ${n.kind}`);t[n.kind]=n}return t},w_=(...e)=>Z(A_(...e)),A_=(e,t,n)=>{const s=n.hasKind("morph")?"a morph":n.isUnknown()?"unknown":n.exclude(t).defaultShortDescription;return`${_N(e)} operand must be ${t.description} (was ${s})`},T_=(e,t,n)=>new wc(e,t,n,n,null);class dA extends Ta{}var Mx,Cx;class wc extends(Cx=Ta,Mx=_i,Cx){constructor(n,s,a,u,c){super((...d)=>{const h=He(this.names,(p,y)=>{const g=this.arg$.parse(d[p]);return g.extends(this.constraints[p])||Z(E_(y,this.constraints[p].expression,g.expression)),[y,g]});if(this.defIsLazy()){const p=this.bodyDef(h);return this.$.parse(p)}return this.$.parse(s,{args:h})});w(this,Mx,"generic");w(this,"paramDefs");w(this,"bodyDef");w(this,"$");w(this,"arg$");w(this,"baseInstantiation");w(this,"hkt");w(this,"description");this.paramDefs=n,this.bodyDef=s,this.$=a,this.arg$=u,this.hkt=c,this.description=c?new c().description??`a generic type for ${c.constructor.name}`:"a generic type",this.baseInstantiation=this(...this.constraints)}defIsLazy(){return this.bodyDef instanceof dA}cacheGetter(n,s){return Object.defineProperty(this,n,{value:s}),s}get json(){return this.cacheGetter("json",{params:this.params.map(n=>n[1].isUnknown()?n[0]:[n[0],n[1].json]),body:WN(this.bodyDef)})}get params(){return this.cacheGetter("params",this.paramDefs.map(n=>typeof n=="string"?[n,W.intrinsic.unknown]:[n[0],this.$.parse(n[1])]))}get names(){return this.cacheGetter("names",this.params.map(n=>n[0]))}get constraints(){return this.cacheGetter("constraints",this.params.map(n=>n[1]))}get internal(){return this}get referencesById(){return this.baseInstantiation.internal.referencesById}get references(){return this.baseInstantiation.internal.references}}const E_=(e,t,n)=>`${e} must be assignable to ${t} (was ${n})`,R_=ot({kind:"predicate",hasAssociatedError:!0,collapsibleKey:"predicate",keys:{predicate:{}},normalize:e=>typeof e=="function"?{predicate:e}:e,defaults:{description:e=>`valid according to ${e.predicate.name||"an anonymous predicate"}`},intersectionIsOpen:!0,intersections:{predicate:()=>null}});class O_ extends Ea{constructor(){super(...arguments);w(this,"serializedPredicate",Xt(this.predicate));w(this,"compiledCondition",`${this.serializedPredicate}(data, ctx)`);w(this,"compiledNegation",`!${this.compiledCondition}`);w(this,"impliedBasis",null);w(this,"expression",this.serializedPredicate);w(this,"traverseAllows",this.predicate);w(this,"errorContext",{code:"predicate",description:this.description,meta:this.meta});w(this,"compiledErrorContext",Fc(this.errorContext));w(this,"traverseApply",(n,s)=>{!this.predicate(n,s.external)&&!s.hasError()&&s.errorFromNodeContext(this.errorContext)})}compile(n){if(n.traversalKind==="Allows"){n.return(this.compiledCondition);return}n.if(`${this.compiledNegation} && !ctx.hasError()`,()=>n.line(`ctx.errorFromNodeContext(${this.compiledErrorContext})`))}reduceJsonSchema(n,s){return s.fallback.predicate({code:"predicate",base:n,predicate:this.predicate})}}const hA={implementation:R_,Node:O_},M_=ot({kind:"divisor",collapsibleKey:"rule",keys:{rule:{parse:e=>Number.isInteger(e)?e:Z(k_(e))}},normalize:e=>typeof e=="number"?{rule:e}:e,hasAssociatedError:!0,defaults:{description:e=>e.rule===1?"an integer":e.rule===2?"even":`a multiple of ${e.rule}`},intersections:{divisor:(e,t,n)=>n.$.node("divisor",{rule:Math.abs(e.rule*t.rule/D_(e.rule,t.rule))})},obviatesBasisDescription:!0});class C_ extends Yc{constructor(){super(...arguments);w(this,"traverseAllows",n=>n%this.rule===0);w(this,"compiledCondition",`data % ${this.rule} === 0`);w(this,"compiledNegation",`data % ${this.rule} !== 0`);w(this,"impliedBasis",W.intrinsic.number.internal);w(this,"expression",`% ${this.rule}`)}reduceJsonSchema(n){return n.type="integer",this.rule===1||(n.multipleOf=this.rule),n}}const pA={implementation:M_,Node:C_},k_=e=>`divisor must be an integer (was ${e})`,D_=(e,t)=>{let n,s=e,a=t;for(;a!==0;)n=a,a=s%a,s=n;return s};class Ra extends Yc{constructor(){super(...arguments);w(this,"boundOperandKind",B_[this.kind]);w(this,"compiledActual",this.boundOperandKind==="value"?"data":this.boundOperandKind==="length"?"data.length":"data.valueOf()");w(this,"comparator",L_(this.kind,this.exclusive));w(this,"numericLimit",this.rule.valueOf());w(this,"expression",`${this.comparator} ${this.rule}`);w(this,"compiledCondition",`${this.compiledActual} ${this.comparator} ${this.numericLimit}`);w(this,"compiledNegation",`${this.compiledActual} ${N_[this.comparator]} ${this.numericLimit}`);w(this,"stringLimit",this.boundOperandKind==="date"?V_(this.numericLimit):`${this.numericLimit}`);w(this,"limitKind",this.comparator[0]==="<"?"upper":"lower")}isStricterThan(n){return(this.limitKind==="upper"?this.numericLimit<n.numericLimit:this.numericLimit>n.numericLimit)||this.numericLimit===n.numericLimit&&this.exclusive===!0&&!n.exclusive}overlapsRange(n){return!(this.isStricterThan(n)||this.numericLimit===n.numericLimit&&(this.exclusive||n.exclusive))}overlapIsUnit(n){return this.numericLimit===n.numericLimit&&!this.exclusive&&!n.exclusive}}const N_={"<":">=","<=":">",">":"<=",">=":"<"},__={min:"max",minLength:"maxLength",after:"before"},mA={parse:e=>e||void 0},yA=e=>t=>{if(typeof t=="number")return{rule:t};const{exclusive:n,...s}=t;return n?{...s,rule:e==="minLength"?s.rule+1:s.rule-1}:s},gA=e=>t=>{if(typeof t=="number"||typeof t=="string"||t instanceof Date)return{rule:t};const{exclusive:n,...s}=t;if(!n)return s;const a=typeof s.rule=="number"?s.rule:typeof s.rule=="string"?new Date(s.rule).valueOf():s.rule.valueOf();return n?{...s,rule:e==="after"?a+1:a-1}:s},bA=e=>typeof e=="string"||typeof e=="number"?new Date(e):e,$_=(e,t)=>`${e} bound must be a positive integer (was ${t})`,_m=e=>t=>((!Number.isInteger(t)||t<0)&&Z($_(e,t)),t),B_={min:"value",max:"value",minLength:"length",maxLength:"length",after:"date",before:"date"},L_=(e,t)=>`${ai(e,__)?">":"<"}${t?"":"="}`,V_=e=>typeof e=="string"?e:new Date(e).toLocaleString(),j_=e=>`Bounded expression ${e} must be exactly one of number, string, Array, or Date`,z_=ot({kind:"after",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{parse:bA,serialize:e=>e.toISOString()}},normalize:gA("after"),defaults:{description:e=>`${e.collapsibleLimitString} or later`,actual:ul},intersections:{after:(e,t)=>e.isStricterThan(t)?e:t}});class U_ extends Ra{constructor(){super(...arguments);w(this,"impliedBasis",W.intrinsic.Date.internal);w(this,"collapsibleLimitString",ul(this.rule));w(this,"traverseAllows",n=>n>=this.rule)}reduceJsonSchema(n,s){return s.fallback.date({code:"date",base:n,after:this.rule})}}const vA={implementation:z_,Node:U_},q_=ot({kind:"before",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{parse:bA,serialize:e=>e.toISOString()}},normalize:gA("before"),defaults:{description:e=>`${e.collapsibleLimitString} or earlier`,actual:ul},intersections:{before:(e,t)=>e.isStricterThan(t)?e:t,after:(e,t,n)=>e.overlapsRange(t)?e.overlapIsUnit(t)?n.$.node("unit",{unit:e.rule}):null:oe.init("range",e,t)}});class K_ extends Ra{constructor(){super(...arguments);w(this,"collapsibleLimitString",ul(this.rule));w(this,"traverseAllows",n=>n<=this.rule);w(this,"impliedBasis",W.intrinsic.Date.internal)}reduceJsonSchema(n,s){return s.fallback.date({code:"date",base:n,before:this.rule})}}const SA={implementation:q_,Node:K_},P_=ot({kind:"exactLength",collapsibleKey:"rule",keys:{rule:{parse:_m("exactLength")}},normalize:e=>typeof e=="number"?{rule:e}:e,hasAssociatedError:!0,defaults:{description:e=>`exactly length ${e.rule}`,actual:e=>`${e.length}`},intersections:{exactLength:(e,t,n)=>oe.init("unit",n.$.node("unit",{unit:e.rule}),n.$.node("unit",{unit:t.rule}),{path:["length"]}),minLength:(e,t)=>e.rule>=t.rule?e:oe.init("range",e,t),maxLength:(e,t)=>e.rule<=t.rule?e:oe.init("range",e,t)}});class I_ extends Yc{constructor(){super(...arguments);w(this,"traverseAllows",n=>n.length===this.rule);w(this,"compiledCondition",`data.length === ${this.rule}`);w(this,"compiledNegation",`data.length !== ${this.rule}`);w(this,"impliedBasis",W.intrinsic.lengthBoundable.internal);w(this,"expression",`== ${this.rule}`)}reduceJsonSchema(n){switch(n.type){case"string":return n.minLength=this.rule,n.maxLength=this.rule,n;case"array":return n.minItems=this.rule,n.maxItems=this.rule,n;default:return xt.throwInternalOperandError("exactLength",n)}}}const xA={implementation:P_,Node:I_},H_=ot({kind:"max",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{},exclusive:mA},normalize:e=>typeof e=="number"?{rule:e}:e,defaults:{description:e=>e.rule===0?e.exclusive?"negative":"non-positive":`${e.exclusive?"less than":"at most"} ${e.rule}`},intersections:{max:(e,t)=>e.isStricterThan(t)?e:t,min:(e,t,n)=>e.overlapsRange(t)?e.overlapIsUnit(t)?n.$.node("unit",{unit:e.rule}):null:oe.init("range",e,t)},obviatesBasisDescription:!0});class G_ extends Ra{constructor(){super(...arguments);w(this,"impliedBasis",W.intrinsic.number.internal);w(this,"traverseAllows",this.exclusive?n=>n<this.rule:n=>n<=this.rule)}reduceJsonSchema(n){return this.exclusive?n.exclusiveMaximum=this.rule:n.maximum=this.rule,n}}const wA={implementation:H_,Node:G_},F_=ot({kind:"maxLength",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{parse:_m("maxLength")}},reduce:(e,t)=>e.rule===0?t.node("exactLength",e):void 0,normalize:yA("maxLength"),defaults:{description:e=>`at most length ${e.rule}`,actual:e=>`${e.length}`},intersections:{maxLength:(e,t)=>e.isStricterThan(t)?e:t,minLength:(e,t,n)=>e.overlapsRange(t)?e.overlapIsUnit(t)?n.$.node("exactLength",{rule:e.rule}):null:oe.init("range",e,t)}});class Y_ extends Ra{constructor(){super(...arguments);w(this,"impliedBasis",W.intrinsic.lengthBoundable.internal);w(this,"traverseAllows",n=>n.length<=this.rule)}reduceJsonSchema(n){switch(n.type){case"string":return n.maxLength=this.rule,n;case"array":return n.maxItems=this.rule,n;default:return xt.throwInternalOperandError("maxLength",n)}}}const AA={implementation:F_,Node:Y_},X_=ot({kind:"min",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{},exclusive:mA},normalize:e=>typeof e=="number"?{rule:e}:e,defaults:{description:e=>e.rule===0?e.exclusive?"positive":"non-negative":`${e.exclusive?"more than":"at least"} ${e.rule}`},intersections:{min:(e,t)=>e.isStricterThan(t)?e:t},obviatesBasisDescription:!0});class Z_ extends Ra{constructor(){super(...arguments);w(this,"impliedBasis",W.intrinsic.number.internal);w(this,"traverseAllows",this.exclusive?n=>n>this.rule:n=>n>=this.rule)}reduceJsonSchema(n){return this.exclusive?n.exclusiveMinimum=this.rule:n.minimum=this.rule,n}}const TA={implementation:X_,Node:Z_},J_=ot({kind:"minLength",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{parse:_m("minLength")}},reduce:e=>e.rule===0?W.intrinsic.unknown:void 0,normalize:yA("minLength"),defaults:{description:e=>e.rule===1?"non-empty":`at least length ${e.rule}`,actual:e=>e.length===0?"":`${e.length}`},intersections:{minLength:(e,t)=>e.isStricterThan(t)?e:t}});class Q_ extends Ra{constructor(){super(...arguments);w(this,"impliedBasis",W.intrinsic.lengthBoundable.internal);w(this,"traverseAllows",n=>n.length>=this.rule)}reduceJsonSchema(n){switch(n.type){case"string":return n.minLength=this.rule,n;case"array":return n.minItems=this.rule,n;default:return xt.throwInternalOperandError("minLength",n)}}}const EA={implementation:J_,Node:Q_},W_={min:TA.implementation,max:wA.implementation,minLength:EA.implementation,maxLength:AA.implementation,exactLength:xA.implementation,after:vA.implementation,before:SA.implementation},e2={min:TA.Node,max:wA.Node,minLength:EA.Node,maxLength:AA.Node,exactLength:xA.Node,after:vA.Node,before:SA.Node},t2=ot({kind:"pattern",collapsibleKey:"rule",keys:{rule:{},flags:{}},normalize:e=>typeof e=="string"?{rule:e}:e instanceof RegExp?e.flags?{rule:e.source,flags:e.flags}:{rule:e.source}:e,obviatesBasisDescription:!0,obviatesBasisExpression:!0,hasAssociatedError:!0,intersectionIsOpen:!0,defaults:{description:e=>`matched by ${e.rule}`},intersections:{pattern:()=>null}});class n2 extends Yc{constructor(){super(...arguments);w(this,"instance",new RegExp(this.rule,this.flags));w(this,"expression",`${this.instance}`);w(this,"traverseAllows",this.instance.test.bind(this.instance));w(this,"compiledCondition",`${this.expression}.test(data)`);w(this,"compiledNegation",`!${this.compiledCondition}`);w(this,"impliedBasis",W.intrinsic.string.internal)}reduceJsonSchema(n,s){return n.pattern?s.fallback.patternIntersection({code:"patternIntersection",base:n,pattern:this.rule}):(n.pattern=this.rule,n)}}const RA={implementation:t2,Node:n2},Zu=(e,t)=>{const n=i2(e);return t&&!t.includes(n)?Z(`Root of kind ${n} should be one of ${t}`):n},i2=e=>{if(fe(e,"root"))return e.kind;if(typeof e=="string")return e[0]==="$"?"alias":e in Ni?"domain":"proto";if(typeof e=="function")return"proto";if(typeof e!="object"||e===null)return Z(fS(e));if("morphs"in e)return"morph";if("branches"in e||Pt(e))return"union";if("unit"in e)return"unit";if("reference"in e)return"alias";const t=Object.keys(e);return t.length===0||t.some(n=>n in aA)?"intersection":"proto"in e?"proto":"domain"in e?"domain":Z(fS(e))},fS=e=>`${qe(e)} is not a valid type schema`,Vu={},s2=e=>Pt(e)?e.map(t=>t.collapsibleJson):e.collapsibleJson,Dn={};W.nodesByRegisteredId=Dn;const OA=e=>(Vu[e]??(Vu[e]=0),`${e}${++Vu[e]}`),MA=e=>{var p;const t=Xc[e.kind],n=((p=t.applyConfig)==null?void 0:p.call(t,e.def,e.$.resolvedConfig))??e.def,s={},{meta:a,...u}=n,c=a===void 0?{}:typeof a=="string"?{description:a}:a,d=qw(u).sort(([y],[g])=>Xu(y)?Xu(g)?vc(y)-vc(g):1:Xu(g)||y<g?-1:1).filter(([y,g])=>{if(y.startsWith("meta.")){const v=y.slice(5);return c[v]=g,!1}return!0});for(const y of d){const g=y[0],v=t.keys[g];if(!v)return Z(`Key ${g} is not valid on ${e.kind} schema`);const S=v.parse?v.parse(y[1],e):y[1];S!==Ti&&(S!==void 0||v.preserveUndefined)&&(s[g]=S)}if(t.reduce&&!e.prereduced){const y=t.reduce(s,e.$);if(y)return y instanceof oe?y.throw():a2(y,c)}return $m({id:e.id,kind:e.kind,inner:s,meta:c,$:e.$})},$m=({id:e,kind:t,inner:n,meta:s,$:a,ignoreCache:u})=>{const c=Xc[t],d=qw(n),h=[];let p={};for(const[D,$]of d){const k=c.keys[D],Y=k.serialize??(k.child?s2:or);if(p[D]=Y($),k.child===!0){const z=$;Pt(z)?h.push(...z):h.push(z)}else typeof k.child=="function"&&h.push(...k.child($))}c.finalizeInnerJson&&(p=c.finalizeInnerJson(p));let y={...p},g={};ol(s)||(g=He(s,(D,$)=>[D,D==="examples"?$:or($)]),y.meta=ju(g,"description",!0)),p=ju(p,c.collapsibleKey,!1);const v=JSON.stringify({kind:t,...p});y=ju(y,c.collapsibleKey,!1);const S=ju(y,c.collapsibleKey,!0),T=JSON.stringify({kind:t,...y});if(a.nodesByHash[T]&&!u)return a.nodesByHash[T];const R={id:e,kind:t,impl:c,inner:n,innerEntries:d,innerJson:p,innerHash:v,meta:s,metaJson:g,json:y,hash:T,collapsibleJson:S,children:h};if(t!=="intersection")for(const D in n)D!=="in"&&D!=="out"&&(R[D]=n[D]);const M=new c$[t](R,a);return a.nodesByHash[T]=M},r2=(e,t)=>e.id===t?e:(Ft(Dn[t])&&bt(`Unexpected attempt to overwrite node id ${t}`),$m({id:t,kind:e.kind,inner:e.inner,meta:e.meta,$:e.$,ignoreCache:!0})),a2=(e,t,n)=>$m({id:OA(t.alias??e.kind),kind:e.kind,inner:e.inner,meta:t,$:e.$}),ju=(e,t,n)=>{const s=Object.keys(e);if(s.length===1&&s[0]===t){const a=e[t];if(n||lr(a,"object")&&(Object.keys(a).length===1||Array.isArray(a)))return a}return e},Rp=(e,t,n)=>{if(e.key!==t.key)return null;const s=e.key;let a=Ct(e.value,t.value,n);const u=e.required||t.required?"required":"optional";if(a instanceof oe)if(u==="optional")a=W.intrinsic.never.internal;else return a.withPrefixKey(e.key,e.required&&t.required?"required":"optional");if(u==="required")return n.$.node("required",{key:s,value:a});const c=e.hasDefault()?t.hasDefault()?e.default===t.default?e.default:Z(kA(e.default,t.default)):e.default:t.hasDefault()?t.default:Ti;return n.$.node("optional",{key:s,value:a,default:c})};class CA extends Ea{constructor(){super(...arguments);w(this,"required",this.kind==="required");w(this,"optional",this.kind==="optional");w(this,"impliedBasis",W.intrinsic.object.internal);w(this,"serializedKey",fl(this.key));w(this,"compiledKey",typeof this.key=="string"?this.key:this.serializedKey);w(this,"flatRefs",Ie(this.value.flatRefs.map(n=>ps([this.key,...n.path],n.node)),ps([this.key],this.value)));w(this,"traverseAllows",(n,s)=>this.key in n?$i(this.key,()=>this.value.traverseAllows(n[this.key],s),s):this.optional);w(this,"traverseApply",(n,s)=>{this.key in n?$i(this.key,()=>this.value.traverseApply(n[this.key],s),s):this.hasKind("required")&&s.errorFromNodeContext(this.errorContext)})}_transform(n,s){s.path.push(this.key);const a=super._transform(n,s);return s.path.pop(),a}hasDefault(){return"default"in this.inner}compile(n){n.if(`${this.serializedKey} in data`,()=>n.traverseKey(this.serializedKey,`data${n.prop(this.key)}`,this.value)),this.hasKind("required")&&n.else(()=>n.traversalKind==="Apply"?n.line(`ctx.errorFromNodeContext(${this.compiledErrorContext})`):n.return(!1)),n.traversalKind==="Allows"&&n.return(!0)}}const kA=(e,t)=>`Invalid intersection of default values ${qe(e)} & ${qe(t)}`,o2=ot({kind:"optional",hasAssociatedError:!1,intersectionIsOpen:!0,keys:{key:{},value:{child:!0,parse:(e,t)=>t.$.parseSchema(e)},default:{preserveUndefined:!0}},normalize:e=>e,reduce:(e,t)=>{if(t.resolvedConfig.exactOptionalPropertyTypes===!1&&!e.value.allows(void 0))return t.node("optional",{...e,value:e.value.or(pe.undefined)},{prereduced:!0})},defaults:{description:e=>`${e.compiledKey}?: ${e.value.description}`},intersections:{optional:Rp}});class l2 extends CA{constructor(...n){super(...n);w(this,"expression",this.hasDefault()?`${this.compiledKey}: ${this.value.expression} = ${qe(this.inner.default)}`:`${this.compiledKey}?: ${this.value.expression}`);w(this,"defaultValueMorph",u2(this));w(this,"defaultValueMorphRef",this.defaultValueMorph&&Xt(this.defaultValueMorph));"default"in this.inner&&Lm(this.value,this.inner.default,this.key)}get outProp(){if(!this.hasDefault())return this;const{default:n,...s}=this.inner;return this.cacheGetter("outProp",this.$.node("required",s,{prereduced:!0}))}}const Bm={implementation:o2,Node:l2},Nh={},u2=e=>{if(!e.hasDefault())return;const t=`{${e.compiledKey}: ${e.value.id} = ${or(e.default)}}`;return Nh[t]??(Nh[t]=DA(e.key,e.value,e.default))},DA=(e,t,n)=>{if(typeof n=="function")return t.includesTransform?(a,u)=>($i(e,()=>t(a[e]=n(),u),u),a):a=>(a[e]=n(),a);const s=t.includesTransform?t.assert(n):n;return lr(s,"object")?(a,u)=>($i(e,()=>t(a[e]=n,u),u),a):a=>(a[e]=s,a)},Lm=(e,t,n)=>{const s=Pc(t);lr(t,"object")&&!s&&Z(c2(n));const a=e.in(s?t():t);if(a instanceof vs){n===null&&Z(`Default ${a.summary}`);const u=a.transform(c=>c.transform(d=>({...d,prefixPath:[n]})));Z(`Default for ${u.summary}`)}return t},c2=e=>`Non-primitive default ${e===null?"":typeof e=="number"?`for value at [${e}] `:`for ${fl(e)} `}must be specified as a function like () => ({my: 'object'})`;class dl extends uA{constructor(n,s){super(n,s);w(this,"branches",this.hasKind("union")?this.inner.branches:[this]);w(this,"_keyof");w(this,"pipe",Object.assign(this._pipe.bind(this),{try:this.tryPipe.bind(this)}));Object.defineProperty(this,_i,{value:"root",enumerable:!1})}get internal(){return this}get"~standard"(){return{vendor:"arktype",version:1,validate:n=>{const s=this(n);return s instanceof vs?s:{value:s}}}}as(){return this}brand(n){return n===""?Z(f2):this}readonly(){return this}distribute(n,s){const a=this.branches.map(n);return(s==null?void 0:s(a))??a}get shortDescription(){return this.meta.description??this.defaultShortDescription}toJsonSchema(n={}){const s=lA(this.$.resolvedConfig.toJsonSchema,n);s.useRefs||(s.useRefs=this.isCyclic);const a=typeof s.dialect=="string"?{$schema:s.dialect}:{};return Object.assign(a,this.toJsonSchemaRecurse(s)),s.useRefs&&(a.$defs=He(this.references,(u,c)=>c.isRoot()&&!c.alwaysExpandJsonSchema?[c.id,c.toResolvedJsonSchema(s)]:[])),a}toJsonSchemaRecurse(n){return n.useRefs&&!this.alwaysExpandJsonSchema?{$ref:`#/$defs/${this.id}`}:this.toResolvedJsonSchema(n)}get alwaysExpandJsonSchema(){return this.isBasis()||this.kind==="alias"||this.hasKind("union")&&this.isBoolean}toResolvedJsonSchema(n){const s=this.innerToJsonSchema(n);return Object.assign(s,this.metaJson)}intersect(n){const s=this.$.parseDefinition(n),a=this.rawIntersect(s);return a instanceof oe?a:this.$.finalize(a)}rawIntersect(n){return Bi(this,n,this.$)}toNeverIfDisjoint(){return this}and(n){const s=this.intersect(n);return s instanceof oe?s.throw():s}rawAnd(n){const s=this.rawIntersect(n);return s instanceof oe?s.throw():s}or(n){const s=this.$.parseDefinition(n);return this.$.finalize(this.rawOr(s))}rawOr(n){const s=[...this.branches,...n.branches];return this.$.node("union",s)}map(n){return this.$.schema(this.applyStructuralOperation("map",[n]))}pick(...n){return this.$.schema(this.applyStructuralOperation("pick",n))}omit(...n){return this.$.schema(this.applyStructuralOperation("omit",n))}required(){return this.$.schema(this.applyStructuralOperation("required",[]))}partial(){return this.$.schema(this.applyStructuralOperation("partial",[]))}keyof(){if(this._keyof)return this._keyof;const n=this.applyStructuralOperation("keyof",[]).reduce((s,a)=>s.intersect(a).toNeverIfDisjoint(),W.intrinsic.unknown.internal);return n.branches.length===0&&Z(fA(`keyof ${this.expression}`)),this._keyof=this.$.finalize(n)}get props(){return this.branches.length!==1?Z(d2(this.expression)):[...this.applyStructuralOperation("props",[])[0]]}merge(n){const s=this.$.parseDefinition(n);return this.$.schema(s.distribute(a=>this.applyStructuralOperation("merge",[dS(a)??Z(hS("merge",a.expression))])))}applyStructuralOperation(n,s){return this.distribute(a=>{if(a.equals(W.intrinsic.object)&&n!=="merge")return a;const u=dS(a);if(u||Z(hS(n,a.expression)),n==="keyof")return u.keyof();if(n==="get")return u.get(...s);if(n==="props")return u.props;const c=n==="required"?"require":n==="partial"?"optionalize":n;return this.$.node("intersection",{...a.inner,structure:u[c](...s)})})}get(...n){return n[0]===void 0?this:this.$.schema(this.applyStructuralOperation("get",n))}extract(n){const s=this.$.parseDefinition(n);return this.$.schema(this.branches.filter(a=>a.extends(s)))}exclude(n){const s=this.$.parseDefinition(n);return this.$.schema(this.branches.filter(a=>!a.extends(s)))}array(){return this.$.schema(this.isUnknown()?{proto:Array}:{proto:Array,sequence:this},{prereduced:!0})}overlaps(n){return!(this.intersect(n)instanceof oe)}extends(n){const s=this.intersect(n);return!(s instanceof oe)&&this.equals(s)}ifExtends(n){return this.extends(n)?this:void 0}subsumes(n){return this.$.parseDefinition(n).extends(this)}configure(n,s="shallow"){return this.configureReferences(n,s)}describe(n,s="shallow"){return this.configure({description:n},s)}optional(){return[this,"?"]}default(n){return Lm(this,n,null),[this,"=",n]}from(n){return this.assert(n)}_pipe(...n){const s=n.reduce((a,u)=>a.rawPipeOnce(u),this);return this.$.finalize(s)}tryPipe(...n){const s=n.reduce((a,u)=>a.rawPipeOnce(fe(u,"root")?u:(c,d)=>{try{return u(c,d)}catch(h){return d.error({code:"predicate",predicate:u,actual:`aborted due to error:
|
|
87
|
-
${h}
|
|
88
|
-
`})}}),this);return this.$.finalize(s)}to(n){return this.$.finalize(this.toNode(this.$.parseDefinition(n)))}toNode(n){const s=Tp(this,n,this.$);return s instanceof oe?s.throw():s}rawPipeOnce(n){return fe(n,"root")?this.toNode(n):this.distribute(s=>s.hasKind("morph")?this.$.node("morph",{in:s.inner.in,morphs:[...s.morphs,n]}):this.$.node("morph",{in:s,morphs:[n]}),this.$.parseSchema)}narrow(n){return this.constrainOut("predicate",n)}constrain(n,s){return this._constrain("root",n,s)}constrainIn(n,s){return this._constrain("in",n,s)}constrainOut(n,s){return this._constrain("out",n,s)}_constrain(n,s,a){const u=this.$.node(s,a);if(u.isRoot())return u.isUnknown()?this:bt(`Unexpected constraint node ${u}`);const c=n==="root"?this:this[n];if(c.hasKind("morph")||u.impliedBasis&&!c.extends(u.impliedBasis))return w_(s,u.impliedBasis,this);const d=this.$.node("intersection",{[u.kind]:u}),h=n==="out"?Tp(this,d,this.$):Bi(this,d,this.$);return h instanceof oe&&h.throw(),this.$.finalize(h)}onUndeclaredKey(n){const s=typeof n=="string"?n:n.rule,a=typeof n=="string"?!1:n.deep;return this.$.finalize(this.transform((u,c)=>u==="structure"?s==="ignore"?gN(c,{undeclared:1}):{...c,undeclared:s}:c,a?void 0:{shouldTransform:u=>!Hs(Hc,u.kind)}))}hasEqualMorphs(n){return!this.includesTransform&&!n.includesTransform?!0:!(!ya(this.shallowMorphs,n.shallowMorphs)||!ya(this.flatMorphs,n.flatMorphs,{isEqual:(s,a)=>{var u,c;return s.propString===a.propString&&(s.node.hasKind("morph")&&a.node.hasKind("morph")?s.node.hasEqualMorphs(a.node):s.node.hasKind("intersection")&&a.node.hasKind("intersection")?((u=s.node.structure)==null?void 0:u.structuralMorphRef)===((c=a.node.structure)==null?void 0:c.structuralMorphRef):!1)}}))}onDeepUndeclaredKey(n){return this.onUndeclaredKey({rule:n,deep:!0})}filter(n){return this.constrainIn("predicate",n)}divisibleBy(n){return this.constrain("divisor",n)}matching(n){return this.constrain("pattern",n)}atLeast(n){return this.constrain("min",n)}atMost(n){return this.constrain("max",n)}moreThan(n){return this.constrain("min",Qr(n))}lessThan(n){return this.constrain("max",Qr(n))}atLeastLength(n){return this.constrain("minLength",n)}atMostLength(n){return this.constrain("maxLength",n)}moreThanLength(n){return this.constrain("minLength",Qr(n))}lessThanLength(n){return this.constrain("maxLength",Qr(n))}exactlyLength(n){return this.constrain("exactLength",n)}atOrAfter(n){return this.constrain("after",n)}atOrBefore(n){return this.constrain("before",n)}laterThan(n){return this.constrain("after",Qr(n))}earlierThan(n){return this.constrain("before",Qr(n))}}const f2="Expected a non-empty brand name after #",Qr=e=>typeof e=="object"&&!(e instanceof Date)?{...e,exclusive:!0}:{rule:e,exclusive:!0},zu=(e,t)=>fe(t,"root")?fe(e,"root")?e.extends(t):t.allows(e):fe(e,"root")?e.hasUnit(t):t===e,dS=e=>{var t;return e.hasKind("morph")?null:e.hasKind("intersection")?e.inner.structure??(((t=e.basis)==null?void 0:t.domain)==="object"?e.$.bindReference(W.intrinsic.emptyStructure):null):e.isBasis()&&e.domain==="object"?e.$.bindReference(W.intrinsic.emptyStructure):null},d2=e=>`Props cannot be extracted from a union. Use .distribute to extract props from each branch instead. Received:
|
|
89
|
-
${e}`,hS=(e,t)=>`${e} operand must be an object (was ${t})`,hl=(e,t)=>He(Nm(e),(n,s)=>[s,t]),h2=e=>typeof e=="string"?{reference:e}:e,pS=e=>e instanceof oe?W.intrinsic.never.internal:e,p2=ot({kind:"alias",hasAssociatedError:!1,collapsibleKey:"reference",keys:{reference:{serialize:e=>e.startsWith("$")?e:`$ark.${e}`},resolve:{}},normalize:h2,defaults:{description:e=>e.reference},intersections:{alias:(e,t,n)=>n.$.lazilyResolve(()=>pS(Ct(e.resolution,t.resolution,n)),`${e.reference}${n.pipe?"=>":"&"}${t.reference}`),...hl("alias",(e,t,n)=>t.isUnknown()?e:t.isNever()?t:t.isBasis()&&!t.overlaps(W.intrinsic.object)?oe.init("assignability",W.intrinsic.object,t):n.$.lazilyResolve(()=>pS(Ct(e.resolution,t,n)),`${e.reference}${n.pipe?"=>":"&"}${t.id}`))}});class m2 extends dl{constructor(){super(...arguments);w(this,"expression",this.reference);w(this,"structure");w(this,"traverseAllows",(n,s)=>{const a=s.seen[this.reference];return a!=null&&a.includes(n)?!0:(s.seen[this.reference]=Ie(a,n),this.resolution.traverseAllows(n,s))});w(this,"traverseApply",(n,s)=>{const a=s.seen[this.reference];a!=null&&a.includes(n)||(s.seen[this.reference]=Ie(a,n),this.resolution.traverseApply(n,s))})}get resolution(){const n=this._resolve();return Dn[this.id]=n}_resolve(){if(this.resolve)return this.resolve();if(this.reference[0]==="$")return this.$.resolveRoot(this.reference.slice(1));const n=this.reference;let s=Dn[n];const a=[];for(;fe(s,"context");){if(a.includes(s.id))return Z(y2(s.id,a));a.push(s.id),s=Dn[s.id]}return fe(s,"root")?s:bt(`Unexpected resolution for reference ${this.reference}
|
|
90
|
-
Seen: [${a.join("->")}]
|
|
91
|
-
Resolution: ${qe(s)}`)}get resolutionId(){if(this.reference.includes("&")||this.reference.includes("=>"))return this.resolution.id;if(this.reference[0]!=="$")return this.reference;const n=this.reference.slice(1),s=this.$.resolutions[n];return typeof s=="string"?s:fe(s,"root")?s.id:bt(`Unexpected resolution for reference ${this.reference}: ${qe(s)}`)}get defaultShortDescription(){return Ni.object}innerToJsonSchema(n){return this.resolution.toJsonSchemaRecurse(n)}compile(n){const s=this.resolutionId;n.if(`ctx.seen.${s} && ctx.seen.${s}.includes(data)`,()=>n.return(!0)),n.if(`!ctx.seen.${s}`,()=>n.line(`ctx.seen.${s} = []`)),n.line(`ctx.seen.${s}.push(data)`),n.return(n.invoke(s))}}const y2=(e,t)=>`Alias '${e}' has a shallow resolution cycle: ${[...t,e].join("->")}`,Vm={implementation:p2,Node:m2};class jm extends dl{constructor(){super(...arguments);w(this,"traverseApply",(n,s)=>{this.traverseAllows(n,s)||s.errorFromNodeContext(this.errorContext)})}get errorContext(){return{code:this.kind,description:this.description,meta:this.meta,...this.inner}}get compiledErrorContext(){return Fc(this.errorContext)}compile(n){n.traversalKind==="Allows"?n.return(this.compiledCondition):n.if(this.compiledNegation,()=>n.line(`${n.ctx}.errorFromNodeContext(${this.compiledErrorContext})`))}}const g2=ot({kind:"domain",hasAssociatedError:!0,collapsibleKey:"domain",keys:{domain:{},numberAllowsNaN:{}},normalize:e=>typeof e=="string"?{domain:e}:Rm(e,"numberAllowsNaN")&&e.domain!=="number"?Z(zm.writeBadAllowNanMessage(e.domain)):e,applyConfig:(e,t)=>e.numberAllowsNaN===void 0&&e.domain==="number"&&t.numberAllowsNaN?{...e,numberAllowsNaN:!0}:e,defaults:{description:e=>Ni[e.domain],actual:e=>Number.isNaN(e)?"NaN":Ni[Pn(e)]},intersections:{domain:(e,t)=>e.domain==="number"&&t.domain==="number"?e.numberAllowsNaN?t:e:oe.init("domain",e,t)}});class b2 extends jm{constructor(){super(...arguments);w(this,"requiresNaNCheck",this.domain==="number"&&!this.numberAllowsNaN);w(this,"traverseAllows",this.requiresNaNCheck?n=>typeof n=="number"&&!Number.isNaN(n):n=>Pn(n)===this.domain);w(this,"compiledCondition",this.domain==="object"?'((typeof data === "object" && data !== null) || typeof data === "function")':`typeof data === "${this.domain}"${this.requiresNaNCheck?" && !Number.isNaN(data)":""}`);w(this,"compiledNegation",this.domain==="object"?'((typeof data !== "object" || data === null) && typeof data !== "function")':`typeof data !== "${this.domain}"${this.requiresNaNCheck?" || Number.isNaN(data)":""}`);w(this,"expression",this.numberAllowsNaN?"number | NaN":this.domain)}get nestableExpression(){return this.numberAllowsNaN?`(${this.expression})`:this.expression}get defaultShortDescription(){return Ni[this.domain]}innerToJsonSchema(n){return this.domain==="bigint"||this.domain==="symbol"?n.fallback.domain({code:"domain",base:{},domain:this.domain}):{type:this.domain}}}const zm={implementation:g2,Node:b2,writeBadAllowNanMessage:e=>`numberAllowsNaN may only be specified with domain "number" (was ${e})`},v2=ot({kind:"intersection",hasAssociatedError:!0,normalize:e=>{if(Ft(e))return e;const{structure:t,...n}=e,s=!!t,a=t??{},u=He(n,(c,d)=>ai(c,u_)?(s&&Z(`Flattened structure key ${c} cannot be specified alongside a root 'structure' key.`),a[c]=d,[]):[c,d]);return(fe(a,"constraint")||!ol(a))&&(u.structure=a),u},finalizeInnerJson:({structure:e,...t})=>lr(e,"object")?{...e,...t}:t,keys:{domain:{child:!0,parse:(e,t)=>t.$.node("domain",e)},proto:{child:!0,parse:(e,t)=>t.$.node("proto",e)},structure:{child:!0,parse:(e,t)=>t.$.node("structure",e),serialize:e=>{var c;if(!((c=e.sequence)!=null&&c.minLength))return e.collapsibleJson;const{sequence:t,...n}=e.collapsibleJson,{minVariadicLength:s,...a}=t,u=a.variadic&&Object.keys(a).length===1?a.variadic:a;return{...n,sequence:u}}},divisor:{child:!0,parse:tn("divisor")},max:{child:!0,parse:tn("max")},min:{child:!0,parse:tn("min")},maxLength:{child:!0,parse:tn("maxLength")},minLength:{child:!0,parse:tn("minLength")},exactLength:{child:!0,parse:tn("exactLength")},before:{child:!0,parse:tn("before")},after:{child:!0,parse:tn("after")},pattern:{child:!0,parse:tn("pattern")},predicate:{child:!0,parse:tn("predicate")}},reduce:(e,t)=>mS({},e,{$:t,invert:!1,pipe:!1}),defaults:{description:e=>{if(e.children.length===0)return"unknown";if(e.structure)return e.structure.description;const t=[];if(e.basis&&!e.refinements.some(n=>n.impl.obviatesBasisDescription)&&t.push(e.basis.description),e.refinements.length){const n=e.refinements.toSorted((s,a)=>s.kind==="min"&&a.kind==="max"?-1:0).map(s=>s.description);t.push(...n)}return e.inner.predicate&&t.push(...e.inner.predicate.map(n=>n.description)),t.join(" and ")},expected:e=>` โฆ ${e.errors.map(t=>t.expected).join(`
|
|
92
|
-
โฆ `)}`,problem:e=>`(${e.actual}) must be...
|
|
93
|
-
${e.expected}`},intersections:{intersection:(e,t,n)=>mS(e.inner,t.inner,n),...hl("intersection",(e,t,n)=>{var h;if(e.children.length===0)return t;const{domain:s,proto:a,...u}=e.inner,c=a??s,d=c?Ct(c,t,n):t;return d instanceof oe?d:(h=e==null?void 0:e.basis)!=null&&h.equals(d)?e:e.$.node("intersection",{...u,[d.kind]:d},{prereduced:!0})})}});class S2 extends dl{constructor(){super(...arguments);w(this,"basis",this.inner.domain??this.inner.proto??null);w(this,"refinements",this.children.filter(n=>n.isRefinement()));w(this,"structure",this.inner.structure);w(this,"expression",x2(this));w(this,"traverseAllows",(n,s)=>this.children.every(a=>a.traverseAllows(n,s)));w(this,"traverseApply",(n,s)=>{const a=s.currentErrorCount;if(!(this.basis&&(this.basis.traverseApply(n,s),s.currentErrorCount>a))){if(this.refinements.length){for(let u=0;u<this.refinements.length-1;u++)if(this.refinements[u].traverseApply(n,s),s.failFast&&s.currentErrorCount>a)return;if(this.refinements.at(-1).traverseApply(n,s),s.currentErrorCount>a)return}if(!(this.structure&&(this.structure.traverseApply(n,s),s.currentErrorCount>a))&&this.inner.predicate){for(let u=0;u<this.inner.predicate.length-1;u++)if(this.inner.predicate[u].traverseApply(n,s),s.failFast&&s.currentErrorCount>a)return;this.inner.predicate.at(-1).traverseApply(n,s)}}})}get shallowMorphs(){var n;return(n=this.inner.structure)!=null&&n.structuralMorph?[this.inner.structure.structuralMorph]:[]}get defaultShortDescription(){var n;return((n=this.basis)==null?void 0:n.defaultShortDescription)??"present"}innerToJsonSchema(n){return this.children.reduce((s,a)=>a.isBasis()?a.toJsonSchemaRecurse(n):a.reduceJsonSchema(s,n),{})}compile(n){if(n.traversalKind==="Allows"){for(const s of this.children)n.check(s);n.return(!0);return}if(n.initializeErrorCount(),this.basis&&(n.check(this.basis),this.children.length>1&&n.returnIfFail()),this.refinements.length){for(let s=0;s<this.refinements.length-1;s++)n.check(this.refinements[s]),n.returnIfFailFast();n.check(this.refinements.at(-1)),(this.structure||this.inner.predicate)&&n.returnIfFail()}if(this.structure&&(n.check(this.structure),this.inner.predicate&&n.returnIfFail()),this.inner.predicate){for(let s=0;s<this.inner.predicate.length-1;s++)n.check(this.inner.predicate[s]),n.returnIfFail();n.check(this.inner.predicate.at(-1))}}}const NA={implementation:v2,Node:S2},x2=e=>{var n;let t=((n=e.structure)==null?void 0:n.expression)||`${e.basis&&!e.refinements.some(s=>s.impl.obviatesBasisExpression)?e.basis.nestableExpression+" ":""}${e.refinements.map(s=>s.expression).join(" & ")}`||"unknown";return t==="Array == 0"&&(t="[]"),t},mS=(e,t,n)=>{const s={},a=e.proto??e.domain,u=t.proto??t.domain,c=a?u?Ct(a,u,n):a:u;return c instanceof oe?c:(c&&(s[c.kind]=c),Sc({kind:"intersection",baseInner:s,l:xc(e),r:xc(t),roots:[],ctx:n}))},w2=ot({kind:"morph",hasAssociatedError:!1,keys:{in:{child:!0,parse:(e,t)=>t.$.parseSchema(e)},morphs:{parse:al,serialize:e=>e.map(t=>fe(t,"root")?t.json:Xt(t))},declaredIn:{child:!1,serialize:e=>e.json},declaredOut:{child:!1,serialize:e=>e.json}},normalize:e=>e,defaults:{description:e=>{var t;return`a morph from ${e.in.description} to ${((t=e.out)==null?void 0:t.description)??"unknown"}`}},intersections:{morph:(e,t,n)=>{if(!e.hasEqualMorphs(t))return Z(T2(e.expression,t.expression));const s=Ct(e.in,t.in,n);if(s instanceof oe)return s;const a={morphs:e.morphs};if(e.declaredIn||t.declaredIn){const u=Ct(e.in,t.in,n);if(u instanceof oe)return u.throw();a.declaredIn=u}if(e.declaredOut||t.declaredOut){const u=Ct(e.out,t.out,n);if(u instanceof oe)return u.throw();a.declaredOut=u}return s.distribute(u=>n.$.node("morph",{...a,in:u}),n.$.parseSchema)},...hl("morph",(e,t,n)=>{const s=e.inner.in?Ct(e.inner.in,t,n):t;return s instanceof oe?s:s.equals(e.inner.in)?e:n.$.node("morph",{...e.inner,in:s})})}});class A2 extends dl{constructor(){super(...arguments);w(this,"serializedMorphs",this.morphs.map(Xt));w(this,"compiledMorphs",`[${this.serializedMorphs}]`);w(this,"lastMorph",this.inner.morphs.at(-1));w(this,"lastMorphIfNode",fe(this.lastMorph,"root")?this.lastMorph:void 0);w(this,"introspectableIn",this.inner.in);w(this,"introspectableOut",this.lastMorphIfNode?Object.assign(this.referencesById,this.lastMorphIfNode.referencesById)&&this.lastMorphIfNode.out:void 0);w(this,"expression",`(In: ${this.in.expression}) => ${this.lastMorphIfNode?"To":"Out"}<${this.out.expression}>`);w(this,"traverseAllows",(n,s)=>!this.introspectableIn||this.introspectableIn.traverseAllows(n,s));w(this,"traverseApply",(n,s)=>{this.introspectableIn&&this.introspectableIn.traverseApply(n,s),s.queueMorphs(this.morphs)})}get shallowMorphs(){var n;return Array.isArray((n=this.inner.in)==null?void 0:n.shallowMorphs)?[...this.inner.in.shallowMorphs,...this.morphs]:this.morphs}get in(){var n;return this.declaredIn??((n=this.inner.in)==null?void 0:n.in)??W.intrinsic.unknown.internal}get out(){return this.declaredOut??this.introspectableOut??W.intrinsic.unknown.internal}declareIn(n){return this.$.node("morph",{...this.inner,declaredIn:n})}declareOut(n){return this.$.node("morph",{...this.inner,declaredOut:n})}get defaultShortDescription(){return this.in.meta.description??this.in.defaultShortDescription}innerToJsonSchema(n){var s;return n.fallback.morph({code:"morph",base:this.in.toJsonSchemaRecurse(n),out:((s=this.introspectableOut)==null?void 0:s.toJsonSchemaRecurse(n))??null})}compile(n){if(n.traversalKind==="Allows"){if(!this.introspectableIn)return;n.return(n.invoke(this.introspectableIn));return}this.introspectableIn&&n.line(n.invoke(this.introspectableIn)),n.line(`ctx.queueMorphs(${this.compiledMorphs})`)}hasEqualMorphs(n){return ya(this.morphs,n.morphs,{isEqual:(s,a)=>s===a||fe(s,"root")&&fe(a,"root")&&s.equals(a)})}}const _A={implementation:w2,Node:A2},T2=(e,t)=>`The intersection of distinct morphs at a single path is indeterminate:
|
|
94
|
-
Left: ${e}
|
|
95
|
-
Right: ${t}`,E2=ot({kind:"proto",hasAssociatedError:!0,collapsibleKey:"proto",keys:{proto:{serialize:e=>Mm(e)??or(e)},dateAllowsInvalid:{}},normalize:e=>{const t=typeof e=="string"?{proto:ba[e]}:typeof e=="function"?Ft(e)?e:{proto:e}:typeof e.proto=="string"?{...e,proto:ba[e.proto]}:e;return typeof t.proto!="function"&&Z(Ac.writeInvalidSchemaMessage(t.proto)),Rm(t,"dateAllowsInvalid")&&t.proto!==Date&&Z(Ac.writeBadInvalidDateMessage(t.proto)),t},applyConfig:(e,t)=>e.dateAllowsInvalid===void 0&&e.proto===Date&&t.dateAllowsInvalid?{...e,dateAllowsInvalid:!0}:e,defaults:{description:e=>e.builtinName?EN[e.builtinName]:`an instance of ${e.proto.name}`,actual:e=>e instanceof Date&&e.toString()==="Invalid Date"?"an invalid Date":yp(e)},intersections:{proto:(e,t)=>e.proto===Date&&t.proto===Date?e.dateAllowsInvalid?t:e:iS(e.proto,t.proto)?e:iS(t.proto,e.proto)?t:oe.init("proto",e,t),domain:(e,t)=>t.domain==="object"?e:oe.init("domain",W.intrinsic.object.internal,t)}});class R2 extends jm{constructor(){super(...arguments);w(this,"builtinName",Mm(this.proto));w(this,"serializedConstructor",this.json.proto);w(this,"requiresInvalidDateCheck",this.proto===Date&&!this.dateAllowsInvalid);w(this,"traverseAllows",this.requiresInvalidDateCheck?n=>n instanceof Date&&n.toString()!=="Invalid Date":n=>n instanceof this.proto);w(this,"compiledCondition",`data instanceof ${this.serializedConstructor}${this.requiresInvalidDateCheck?' && data.toString() !== "Invalid Date"':""}`);w(this,"compiledNegation",`!(${this.compiledCondition})`);w(this,"expression",this.dateAllowsInvalid?"Date | InvalidDate":this.proto.name);w(this,"domain","object")}innerToJsonSchema(n){var s,a;switch(this.builtinName){case"Array":return{type:"array"};case"Date":return((a=(s=n.fallback).date)==null?void 0:a.call(s,{code:"date",base:{}}))??n.fallback.proto({code:"proto",base:{},proto:this.proto});default:return n.fallback.proto({code:"proto",base:{},proto:this.proto})}}get nestableExpression(){return this.dateAllowsInvalid?`(${this.expression})`:this.expression}get defaultShortDescription(){return this.description}}const Ac={implementation:E2,Node:R2,writeBadInvalidDateMessage:e=>`dateAllowsInvalid may only be specified with constructor Date (was ${e.name})`,writeInvalidSchemaMessage:e=>`instanceOf operand must be a function (was ${Pn(e)})`},O2=ot({kind:"union",hasAssociatedError:!0,collapsibleKey:"branches",keys:{ordered:{},branches:{child:!0,parse:(e,t)=>{const n=[];for(const s of e){const a=fe(s,"root")?s.branches:t.$.parseSchema(s).branches;for(const u of a)if(u.hasKind("morph")){const c=n.findIndex(d=>d.hasKind("morph")&&d.hasEqualMorphs(u));if(c===-1)n.push(u);else{const d=n[c];n[c]=t.$.node("morph",{...d.inner,in:d.in.rawOr(u.in)})}}else n.push(u)}return t.def.ordered||n.sort((s,a)=>s.hash<a.hash?-1:1),n}}},normalize:e=>Pt(e)?{branches:e}:e,reduce:(e,t)=>{const n=j2(e);if(n.length===1)return n[0];if(n.length!==e.branches.length)return t.node("union",{...e,branches:n},{prereduced:!0})},defaults:{description:e=>e.distribute(t=>t.description,ua),expected:e=>{const t=cN(e.errors,"propString"),n=Object.entries(t).map(([s,a])=>{const u=[];for(const h of a)tr(u,h.expected);const c=ua(u),d=a.every(h=>h.actual===a[0].actual)?a[0].actual:qe(a[0].data);return`${s&&`${s} `}must be ${c}${d&&` (was ${d})`}`});return ua(n)},problem:e=>e.expected,message:e=>e.problem},intersections:{union:(e,t,n)=>{if(e.isNever!==t.isNever)return oe.init("presence",e,t);let s;return e.ordered?(t.ordered&&Z(U2(e.expression,t.expression)),s=_h(t.branches,e.branches,n),s instanceof oe&&s.invert()):s=_h(e.branches,t.branches,n),s instanceof oe?s:n.$.parseSchema(e.ordered||t.ordered?{branches:s,ordered:!0}:{branches:s})},...hl("union",(e,t,n)=>{const s=_h(e.branches,[t],n);return s instanceof oe?s:s.length===1?s[0]:n.$.parseSchema(e.ordered?{branches:s,ordered:!0}:{branches:s})})}});class M2 extends dl{constructor(){super(...arguments);w(this,"isBoolean",this.branches.length===2&&this.branches[0].hasUnit(!1)&&this.branches[1].hasUnit(!0));w(this,"unitBranches",this.branches.filter(n=>n.in.hasKind("unit")));w(this,"discriminant",this.discriminate());w(this,"discriminantJson",this.discriminant?B2(this.discriminant):null);w(this,"expression",this.distribute(n=>n.nestableExpression,V2));w(this,"traverseAllows",(n,s)=>this.branches.some(a=>a.traverseAllows(n,s)));w(this,"traverseApply",(n,s)=>{const a=[];for(let u=0;u<this.branches.length;u++){if(s.pushBranch(),this.branches[u].traverseApply(n,s),!s.hasError())return this.branches[u].includesTransform?s.queuedMorphs.push(...s.popBranch().queuedMorphs):s.popBranch();a.push(s.popBranch().error)}s.errorFromNodeContext({code:"union",errors:a,meta:this.meta})});w(this,"traverseOptimistic",n=>{for(let s=0;s<this.branches.length;s++){const a=this.branches[s];if(a.traverseAllows(n))return a.contextFreeMorph?a.contextFreeMorph(n):n}return Ti})}get branchGroups(){const n=[];let s=-1;for(const a of this.branches){if(a.hasKind("unit")&&a.domain==="boolean"){s===-1?(s=n.length,n.push(a)):n[s]=W.intrinsic.boolean;continue}n.push(a)}return n}createBranchedOptimisticRootApply(){return(n,s)=>{const a=this.traverseOptimistic(n);if(a!==Ti)return a;const u=new ta(n,this.$.resolvedConfig);return this.traverseApply(n,u),u.finalize(s)}}get shallowMorphs(){return this.branches.reduce((n,s)=>tr(n,s.shallowMorphs),[])}get defaultShortDescription(){return this.distribute(n=>n.defaultShortDescription,ua)}innerToJsonSchema(n){if(this.branchGroups.length===1&&this.branchGroups[0].equals(W.intrinsic.boolean))return{type:"boolean"};const s=this.branchGroups.map(a=>a.toJsonSchemaRecurse(n));return s.every(a=>Object.keys(a).length===1&&Rm(a,"const"))?{enum:s.map(a=>a.const)}:{anyOf:s}}compile(n){if(!this.discriminant||this.unitBranches.length===this.branches.length&&this.branches.length===2)return this.compileIndiscriminable(n);let s=this.discriminant.optionallyChainedPropString;this.discriminant.kind==="domain"&&(s=`typeof ${s} === "object" ? ${s} === null ? "null" : "object" : typeof ${s} === "function" ? "object" : typeof ${s}`);const a=this.discriminant.cases,u=Object.keys(a),{optimistic:c}=n;if(n.optimistic=!1,n.block(`switch(${s})`,()=>{for(const g in a){const v=a[g],S=g==="default"?g:`case ${g}`;n.line(`${S}: return ${v===!0?c?n.data:v:c?`${n.invoke(v)} ? ${v.contextFreeMorph?`${Xt(v.contextFreeMorph)}(${n.data})`:n.data} : "${Ti}"`:n.invoke(v)}`)}return n}),n.traversalKind==="Allows"){n.return(c?`"${Ti}"`:!1);return}const d=ua(this.discriminant.kind==="domain"?u.map(g=>{const v=g.slice(1,-1);return v==="function"?Ni.object:Ni[v]}):u),h=this.discriminant.path.map(g=>typeof g=="symbol"?Xt(g):JSON.stringify(g)),p=JSON.stringify(d),y=this.discriminant.kind==="domain"?`${_2}[${s}]`:`${$2}(${s})`;n.line(`ctx.errorFromNodeContext({
|
|
96
|
-
code: "predicate",
|
|
97
|
-
expected: ${p},
|
|
98
|
-
actual: ${y},
|
|
99
|
-
relativePath: [${h}],
|
|
100
|
-
meta: ${this.compiledMeta}
|
|
101
|
-
})`)}compileIndiscriminable(n){if(n.traversalKind==="Apply"){n.const("errors","[]");for(const s of this.branches)n.line("ctx.pushBranch()").line(n.invoke(s)).if("!ctx.hasError()",()=>n.return(s.includesTransform?"ctx.queuedMorphs.push(...ctx.popBranch().queuedMorphs)":"ctx.popBranch()")).line("errors.push(ctx.popBranch().error)");n.line(`ctx.errorFromNodeContext({ code: "union", errors, meta: ${this.compiledMeta} })`)}else{const{optimistic:s}=n;n.optimistic=!1;for(const a of this.branches)n.if(`${n.invoke(a)}`,()=>n.return(s?a.contextFreeMorph?`${Xt(a.contextFreeMorph)}(${n.data})`:n.data:!0));n.return(s?`"${Ti}"`:!1)}}get nestableExpression(){return this.isBoolean?"boolean":`(${this.expression})`}discriminate(){var c,d;if(this.branches.length<2||this.isCyclic)return null;if(this.unitBranches.length===this.branches.length){const h=He(this.unitBranches,(p,y)=>[`${y.in.serializedValue}`,y.hasKind("morph")?y:!0]);return{kind:"unit",path:[],optionallyChainedPropString:"data",cases:h}}const n=[];for(let h=0;h<this.branches.length-1;h++){const p=this.branches[h];for(let y=h+1;y<this.branches.length;y++){const g=this.branches[y],v=Bi(p.in,g.in,p.$);if(v instanceof oe)for(const S of v){if(!S.kind||S.optional)continue;let T,R;if(S.kind==="domain"){const D=S.l,$=S.r;T=`"${typeof D=="string"?D:D.domain}"`,R=`"${typeof $=="string"?$:$.domain}"`}else if(S.kind==="unit")T=S.l.serializedValue,R=S.r.serializedValue;else continue;const M=n.find(D=>ya(D.path,S.path)&&D.kind===S.kind);M?(M.cases[T]?M.cases[T].branchIndices=tr(M.cases[T].branchIndices,h):(c=M.cases)[T]??(c[T]={branchIndices:[h],condition:S.l}),M.cases[R]?M.cases[R].branchIndices=tr(M.cases[R].branchIndices,y):(d=M.cases)[R]??(d[R]={branchIndices:[y],condition:S.r})):n.push({kind:S.kind,cases:{[T]:{branchIndices:[h],condition:S.l},[R]:{branchIndices:[y],condition:S.r}},path:S.path})}}}const s=this.ordered?D2(n,this.branches):n;if(!s.length)return null;const a=C2(s,this),u={};for(const h in a.best.cases){const p=k2(a,h);if(p===null){u[h]=!0;continue}if(p.length===this.branches.length)return null;this.ordered&&p.sort((v,S)=>v.originalIndex-S.originalIndex);const y=p.map(v=>v.branch),g=y.length===1?y[0]:this.$.node("union",this.ordered?{branches:y,ordered:!0}:y);Object.assign(this.referencesById,g.referencesById),u[h]=g}if(a.defaultEntries.length){const h=a.defaultEntries.map(p=>p.branch);u.default=this.$.node("union",this.ordered?{branches:h,ordered:!0}:h,{prereduced:!0}),Object.assign(this.referencesById,u.default.referencesById)}return Object.assign(a.location,{cases:u})}}const C2=(e,t)=>{const n=e.sort((u,c)=>Object.keys(c.cases).length-Object.keys(u.cases).length)[0],s={kind:n.kind,path:n.path,optionallyChainedPropString:$A(n.path)},a=t.branches.map((u,c)=>({originalIndex:c,branch:u}));return{best:n,location:s,defaultEntries:a,node:t}},k2=(e,t)=>{const n=e.best.cases[t],s=N2(n.condition,e.location.path,e.node.$);let a=[];const u=[];for(let c=0;c<e.defaultEntries.length;c++){const d=e.defaultEntries[c];if(n.branchIndices.includes(d.originalIndex)){const h=yS(e.node.branches[d.originalIndex],e.location);h===null?a=null:a==null||a.push({originalIndex:d.originalIndex,branch:h})}else if(d.branch.hasKind("alias")&&s.hasKind("domain")&&s.domain==="object")a==null||a.push(d);else{if(d.branch.in.overlaps(s)){const h=yS(d.branch,e.location);a==null||a.push({originalIndex:d.originalIndex,branch:h})}u.push(d)}}return e.defaultEntries=u,a},D2=(e,t)=>e.filter(s=>{const a=Object.values(s.cases).map(u=>u.branchIndices);for(let u=0;u<a.length-1;u++){const c=a[u];for(let d=u+1;d<a.length;d++){const h=a[d];for(const p of c)for(const y of h)if(p>y&&t[p].overlaps(t[y]))return!1}}return!0}),N2=(e,t,n)=>{let s=e==="undefined"?n.node("unit",{unit:void 0}):e==="null"?n.node("unit",{unit:null}):e==="boolean"?n.units([!0,!1]):e;for(let a=t.length-1;a>=0;a--){const u=t[a];s=n.node("intersection",typeof u=="number"?{proto:"Array",sequence:[...lN(u).map(c=>({})),s]}:{domain:"object",required:[{key:u,value:s}]})}return s},$A=e=>e.reduce((t,n)=>t+nA(n,!0),"data"),_2=Xt(fN),$2=Xt(qe),BA={implementation:O2,Node:M2},B2=e=>({kind:e.kind,path:e.path.map(t=>typeof t=="string"?t:fl(t)),cases:He(e.cases,(t,n)=>[t,n===!0?n:n.hasKind("union")&&n.discriminantJson?n.discriminantJson:n.json])}),L2={delimiter:" | ",finalDelimiter:" | "},V2=e=>ua(e,L2),ua=(e,t)=>{const n=(t==null?void 0:t.delimiter)??", ",s=(t==null?void 0:t.finalDelimiter)??" or ";if(e.length===0)return"never";if(e.length===1)return e[0];if(e.length===2&&e[0]==="false"&&e[1]==="true"||e[0]==="true"&&e[1]==="false")return"boolean";const a={},u=e.filter(d=>a[d]?!1:a[d]=!0),c=u.pop();return`${u.join(n)}${u.length?s:""}${c}`},_h=(e,t,n)=>{const s=t.map(()=>[]);for(let u=0;u<e.length;u++){let c={};for(let d=0;d<t.length;d++){if(s[d]===null)continue;if(e[u].equals(t[d])){s[d]=null,c={};break}const h=Ct(e[u],t[d],n);if(!(h instanceof oe)){if(h.equals(e[u])){s[d].push(e[u]),c={};break}h.equals(t[d])?s[d]=null:c[d]=h}}for(const d in c)s[d][u]=c[d]}const a=s.flatMap((u,c)=>(u==null?void 0:u.flatMap(d=>d.branches))??t[c]);return a.length===0?oe.init("union",e,t):a},j2=({branches:e,ordered:t})=>{if(e.length<2)return e;const n=e.map(()=>!0);for(let s=0;s<e.length;s++)for(let a=s+1;a<e.length&&n[s]&&n[a];a++){if(e[s].equals(e[a])){n[a]=!1;continue}const u=Bi(e[s].in,e[a].in,e[0].$);u instanceof oe||(t||z2(e[s],e[a]),u.equals(e[s].in)?n[s]=!!t:u.equals(e[a].in)&&(n[a]=!1))}return e.filter((s,a)=>n[a])},z2=(e,t)=>{!e.includesTransform&&!t.includesTransform||(ya(e.shallowMorphs,t.shallowMorphs)||Z(gS(e.expression,t.expression)),ya(e.flatMorphs,t.flatMorphs,{isEqual:(n,s)=>{var a,u;return n.propString===s.propString&&(n.node.hasKind("morph")&&s.node.hasKind("morph")?n.node.hasEqualMorphs(s.node):n.node.hasKind("intersection")&&s.node.hasKind("intersection")?((a=n.node.structure)==null?void 0:a.structuralMorphRef)===((u=s.node.structure)==null?void 0:u.structuralMorphRef):!1)}})||Z(gS(e.expression,t.expression)))},yS=(e,t)=>e.transform((n,s)=>n==="domain"||n==="unit"?null:s,{shouldTransform:(n,s)=>{const a=$A(s.path);return t.optionallyChainedPropString.startsWith(a)?n.hasKind("domain")&&n.domain==="object"||(n.hasKind("domain")||t.kind==="unit")&&a===t.optionallyChainedPropString?!0:n.children.length!==0&&n.kind!=="index":!1}}),gS=(e,t)=>`An unordered union of a type including a morph and a type with overlapping input is indeterminate:
|
|
102
|
-
Left: ${e}
|
|
103
|
-
Right: ${t}`,U2=(e,t)=>`The intersection of two ordered unions is indeterminate:
|
|
104
|
-
Left: ${e}
|
|
105
|
-
Right: ${t}`,q2=ot({kind:"unit",hasAssociatedError:!0,keys:{unit:{preserveUndefined:!0,serialize:e=>e instanceof Date?e.toISOString():or(e)}},normalize:e=>e,defaults:{description:e=>qe(e.unit),problem:({expected:e,actual:t})=>`${e===t?`must be reference equal to ${e} (serialized to the same value)`:`must be ${e} (was ${t})`}`},intersections:{unit:(e,t)=>oe.init("unit",e,t),...hl("unit",(e,t)=>{if(t.allows(e.unit))return e;const n=t.hasKind("intersection")?t.basis:t;if(n){const s=n.hasKind("domain")?n:W.intrinsic.object;if(e.domain!==s.domain){const a=e.domain==="undefined"||e.domain==="null"||e.domain==="boolean"?e.domain:W.intrinsic[e.domain];return oe.init("domain",a,s)}}return oe.init("assignability",e,t.hasKind("intersection")?t.children.find(s=>!s.allows(e.unit)):t)})}});class K2 extends jm{constructor(){super(...arguments);w(this,"compiledValue",this.json.unit);w(this,"serializedValue",typeof this.unit=="string"||this.unit instanceof Date?JSON.stringify(this.compiledValue):`${this.compiledValue}`);w(this,"compiledCondition",bS(this.unit,this.serializedValue));w(this,"compiledNegation",bS(this.unit,this.serializedValue,"negated"));w(this,"expression",qe(this.unit));w(this,"domain",Pn(this.unit));w(this,"traverseAllows",this.unit instanceof Date?n=>n instanceof Date&&n.toISOString()===this.compiledValue:Number.isNaN(this.unit)?n=>Number.isNaN(n):n=>n===this.unit)}get defaultShortDescription(){return this.domain==="object"?Ni.object:this.description}innerToJsonSchema(n){return this.unit===null?{type:"null"}:W.intrinsic.jsonPrimitive.allows(this.unit)?{const:this.unit}:n.fallback.unit({code:"unit",base:{},unit:this.unit})}}const LA={implementation:q2,Node:K2},bS=(e,t,n)=>{if(e instanceof Date){const s=`data instanceof Date && data.toISOString() === ${t}`;return n?`!(${s})`:s}return Number.isNaN(e)?`${n?"!":""}Number.isNaN(data)`:`data ${n?"!":"="}== ${t}`},P2=ot({kind:"index",hasAssociatedError:!1,intersectionIsOpen:!0,keys:{signature:{child:!0,parse:(e,t)=>{const n=t.$.parseSchema(e);if(!n.extends(W.intrinsic.key))return Z(G2(n.expression));const s=n.branches.filter(a=>a.hasKind("unit"));return s.length?Z(H2(s.map(a=>qe(a.unit)))):n}},value:{child:!0,parse:(e,t)=>t.$.parseSchema(e)}},normalize:e=>e,defaults:{description:e=>`[${e.signature.expression}]: ${e.value.description}`},intersections:{index:(e,t,n)=>{if(e.signature.equals(t.signature)){const s=Ct(e.value,t.value,n),a=s instanceof oe?W.intrinsic.never.internal:s;return n.$.node("index",{signature:e.signature,value:a})}return e.signature.extends(t.signature)&&e.value.subsumes(t.value)?t:t.signature.extends(e.signature)&&t.value.subsumes(e.value)?e:null}}});class I2 extends Ea{constructor(){super(...arguments);w(this,"impliedBasis",W.intrinsic.object.internal);w(this,"expression",`[${this.signature.expression}]: ${this.value.expression}`);w(this,"flatRefs",Ie(this.value.flatRefs.map(n=>ps([this.signature,...n.path],n.node)),ps([this.signature],this.value)));w(this,"traverseAllows",(n,s)=>yc(n).every(a=>this.signature.traverseAllows(a[0],s)?$i(a[0],()=>this.value.traverseAllows(a[1],s),s):!0));w(this,"traverseApply",(n,s)=>{for(const a of yc(n))this.signature.traverseAllows(a[0],s)&&$i(a[0],()=>this.value.traverseApply(a[1],s),s)})}_transform(n,s){s.path.push(this.signature);const a=super._transform(n,s);return s.path.pop(),a}compile(){}}const VA={implementation:P2,Node:I2},H2=e=>`Index keys ${e.join(", ")} should be specified as named props.`,G2=e=>`Indexed key definition '${e}' must be a string or symbol`,F2=ot({kind:"required",hasAssociatedError:!0,intersectionIsOpen:!0,keys:{key:{},value:{child:!0,parse:(e,t)=>t.$.parseSchema(e)}},normalize:e=>e,defaults:{description:e=>`${e.compiledKey}: ${e.value.description}`,expected:e=>e.missingValueDescription,actual:()=>"missing"},intersections:{required:Rp,optional:Rp}});class Y2 extends CA{constructor(){super(...arguments);w(this,"expression",`${this.compiledKey}: ${this.value.expression}`);w(this,"errorContext",Object.freeze({code:"required",missingValueDescription:this.value.defaultShortDescription,relativePath:[this.key],meta:this.meta}));w(this,"compiledErrorContext",Fc(this.errorContext))}}const jA={implementation:F2,Node:Y2},X2=ot({kind:"sequence",hasAssociatedError:!1,collapsibleKey:"variadic",keys:{prefix:{child:!0,parse:(e,t)=>{if(e.length!==0)return e.map(n=>t.$.parseSchema(n))}},optionals:{child:!0,parse:(e,t)=>{if(e.length!==0)return e.map(n=>t.$.parseSchema(n))}},defaultables:{child:e=>e.map(t=>t[0]),parse:(e,t)=>{if(e.length!==0)return e.map(n=>{const s=t.$.parseSchema(n[0]);return Lm(s,n[1],null),[s,n[1]]})},serialize:e=>e.map(t=>[t[0].collapsibleJson,or(t[1])])},variadic:{child:!0,parse:(e,t)=>t.$.parseSchema(e,t)},minVariadicLength:{parse:e=>e===0?void 0:e},postfix:{child:!0,parse:(e,t)=>{if(e.length!==0)return e.map(n=>t.$.parseSchema(n))}}},normalize:e=>{var t,n,s;if(typeof e=="string")return{variadic:e};if("variadic"in e||"prefix"in e||"defaultables"in e||"optionals"in e||"postfix"in e||"minVariadicLength"in e){if((t=e.postfix)!=null&&t.length){if(!e.variadic)return Z(W2);if((n=e.optionals)!=null&&n.length||(s=e.defaultables)!=null&&s.length)return Z(UA)}return e.minVariadicLength&&!e.variadic?Z("minVariadicLength may not be specified without a variadic element"):e}return{variadic:e}},reduce:(e,t)=>{var d,h,p,y,g,v,S;let n=e.minVariadicLength??0;const s=((d=e.prefix)==null?void 0:d.slice())??[],a=((h=e.defaultables)==null?void 0:h.slice())??[],u=((p=e.optionals)==null?void 0:p.slice())??[],c=((y=e.postfix)==null?void 0:y.slice())??[];if(e.variadic){for(;(g=u.at(-1))!=null&&g.equals(e.variadic);)u.pop();if(u.length===0&&a.length===0)for(;(v=s.at(-1))!=null&&v.equals(e.variadic);)s.pop(),n++;for(;(S=c[0])!=null&&S.equals(e.variadic);)c.shift(),n++}else u.length===0&&a.length===0&&s.push(...c.splice(0));if(n!==e.minVariadicLength||e.prefix&&e.prefix.length!==s.length)return t.node("sequence",{...e,prefix:s,defaultables:a,optionals:u,postfix:c,minVariadicLength:n},{prereduced:!0})},defaults:{description:e=>e.isVariadicOnly?`${e.variadic.nestableExpression}[]`:`[${e.tuple.map(n=>n.kind==="defaultables"?`${n.node.nestableExpression} = ${qe(n.default)}`:n.kind==="optionals"?`${n.node.nestableExpression}?`:n.kind==="variadic"?`...${n.node.nestableExpression}[]`:n.node.expression).join(", ")}]`},intersections:{sequence:(e,t,n)=>{const s=$o({l:e.tuple,r:t.tuple,disjoint:new oe,result:[],fixedVariants:[],ctx:n}),a=s.disjoint.length===0?[s,...s.fixedVariants]:s.fixedVariants;return a.length===0?s.disjoint:a.length===1?n.$.node("sequence",vS(a[0].result)):n.$.node("union",a.map(u=>({proto:Array,sequence:vS(u.result)})))}}});var kx,Dx,Nx,_x;class Z2 extends Ea{constructor(){super(...arguments);w(this,"impliedBasis",W.intrinsic.Array.internal);w(this,"tuple",Q2(this.inner));w(this,"prefixLength",((kx=this.prefix)==null?void 0:kx.length)??0);w(this,"defaultablesLength",((Dx=this.defaultables)==null?void 0:Dx.length)??0);w(this,"optionalsLength",((Nx=this.optionals)==null?void 0:Nx.length)??0);w(this,"postfixLength",((_x=this.postfix)==null?void 0:_x.length)??0);w(this,"defaultablesAndOptionals",[]);w(this,"prevariadic",this.tuple.filter(n=>n.kind==="defaultables"||n.kind==="optionals"?(this.defaultablesAndOptionals.push(n.node),!0):n.kind==="prefix"));w(this,"variadicOrPostfix",Zs(this.variadic&&[this.variadic],this.postfix));w(this,"flatRefs",this.addFlatRefs());w(this,"isVariadicOnly",this.prevariadic.length+this.postfixLength===0);w(this,"minVariadicLength",this.inner.minVariadicLength??0);w(this,"minLength",this.prefixLength+this.minVariadicLength+this.postfixLength);w(this,"minLengthNode",this.minLength===0?null:this.$.node("minLength",this.minLength));w(this,"maxLength",this.variadic?null:this.tuple.length);w(this,"maxLengthNode",this.maxLength===null?null:this.$.node("maxLength",this.maxLength));w(this,"impliedSiblings",this.minLengthNode?this.maxLengthNode?[this.minLengthNode,this.maxLengthNode]:[this.minLengthNode]:this.maxLengthNode?[this.maxLengthNode]:[]);w(this,"defaultValueMorphs",J2(this));w(this,"defaultValueMorphsReference",this.defaultValueMorphs.length?Xt(this.defaultValueMorphs):void 0);w(this,"traverseAllows",(n,s)=>{for(let a=0;a<n.length;a++)if(!this.elementAtIndex(n,a).node.traverseAllows(n[a],s))return!1;return!0});w(this,"traverseApply",(n,s)=>{let a=0;for(;a<n.length;a++)$i(a,()=>this.elementAtIndex(n,a).node.traverseApply(n[a],s),s)});w(this,"expression",this.description)}addFlatRefs(){return lS(this.flatRefs,this.prevariadic.flatMap((n,s)=>Ie(n.node.flatRefs.map(a=>ps([`${s}`,...a.path],a.node)),ps([`${s}`],n.node)))),lS(this.flatRefs,this.variadicOrPostfix.flatMap(n=>Ie(n.flatRefs.map(s=>ps([W.intrinsic.nonNegativeIntegerString.internal,...s.path],s.node)),ps([W.intrinsic.nonNegativeIntegerString.internal],n)))),this.flatRefs}elementAtIndex(n,s){if(s<this.prevariadic.length)return this.tuple[s];const a=n.length-this.postfixLength;return s>=a?{kind:"postfix",node:this.postfix[s-a]}:{kind:"variadic",node:this.variadic??bt(`Unexpected attempt to access index ${s} on ${this}`)}}get element(){return this.cacheGetter("element",this.$.node("union",this.children))}compile(n){if(this.prefix)for(const[s,a]of this.prefix.entries())n.traverseKey(`${s}`,`data[${s}]`,a);for(const[s,a]of this.defaultablesAndOptionals.entries()){const u=`${s+this.prefixLength}`;n.if(`${u} >= ${n.data}.length`,()=>n.traversalKind==="Allows"?n.return(!0):n.return()),n.traverseKey(u,`data[${u}]`,a)}if(this.variadic&&(this.postfix&&n.const("firstPostfixIndex",`${n.data}.length${this.postfix?`- ${this.postfix.length}`:""}`),n.for(`i < ${this.postfix?"firstPostfixIndex":"data.length"}`,()=>n.traverseKey("i","data[i]",this.variadic),this.prevariadic.length),this.postfix))for(const[s,a]of this.postfix.entries()){const u=`firstPostfixIndex + ${s}`;n.traverseKey(u,`data[${u}]`,a)}n.traversalKind==="Allows"&&n.return(!0)}_transform(n,s){s.path.push(W.intrinsic.nonNegativeIntegerString.internal);const a=super._transform(n,s);return s.path.pop(),a}reduceJsonSchema(n,s){if(this.prevariadic.length&&(n.prefixItems=this.prevariadic.map(a=>{const u=a.node.toJsonSchemaRecurse(s);if(a.kind==="defaultables"){const c=typeof a.default=="function"?a.default():a.default;u.default=W.intrinsic.jsonData.allows(c)?c:s.fallback.defaultValue({code:"defaultValue",base:u,value:c})}return u})),this.minLength&&(n.minItems=this.minLength),this.variadic){const a=Object.assign(n,{items:this.variadic.toJsonSchemaRecurse(s)});if(this.maxLength&&(a.maxItems=this.maxLength),this.postfix){const u=this.postfix.map(c=>c.toJsonSchemaRecurse(s));n=s.fallback.arrayPostfix({code:"arrayPostfix",base:a,elements:u})}}else n.items=!1,delete n.maxItems;return n}}const $h={},J2=e=>{if(!e.defaultables)return[];const t=[];let n="[";const s=e.prefixLength+e.defaultablesLength-1;for(let a=e.prefixLength;a<=s;a++){const[u,c]=e.defaultables[a-e.prefixLength];t.push(DA(a,u,c)),n+=`${a}: ${u.id} = ${or(c)}, `}return n+="]",$h[n]??($h[n]=t)},zA={implementation:X2,Node:Z2},Q2=e=>{const t=[];if(e.prefix)for(const n of e.prefix)t.push({kind:"prefix",node:n});if(e.defaultables)for(const[n,s]of e.defaultables)t.push({kind:"defaultables",node:n,default:s});if(e.optionals)for(const n of e.optionals)t.push({kind:"optionals",node:n});if(e.variadic&&t.push({kind:"variadic",node:e.variadic}),e.postfix)for(const n of e.postfix)t.push({kind:"postfix",node:n});return t},vS=e=>e.reduce((t,n)=>(n.kind==="variadic"?t.variadic=n.node:n.kind==="defaultables"?t.defaultables=Ie(t.defaultables,[[n.node,n.default]]):t[n.kind]=Ie(t[n.kind],n.node),t),{}),UA="A postfix required element cannot follow an optional or defaultable element",W2="A postfix element requires a variadic element",$o=e=>{var g,v;const[t,...n]=e.l,[s,...a]=e.r;if(!t||!s)return e;const u=((g=n.at(-1))==null?void 0:g.kind)==="postfix",c=((v=a.at(-1))==null?void 0:v.kind)==="postfix",d=t.kind==="prefix"||s.kind==="prefix"?"prefix":t.kind==="postfix"||s.kind==="postfix"?"postfix":t.kind==="variadic"&&s.kind==="variadic"?"variadic":u||c?"prefix":t.kind==="defaultables"||s.kind==="defaultables"?"defaultables":"optionals";if(t.kind==="prefix"&&s.kind==="variadic"&&c){const S=$o({...e,fixedVariants:[],r:a.map(T=>({...T,kind:"prefix"}))});S.disjoint.length===0&&e.fixedVariants.push(S)}else if(s.kind==="prefix"&&t.kind==="variadic"&&u){const S=$o({...e,fixedVariants:[],l:n.map(T=>({...T,kind:"prefix"}))});S.disjoint.length===0&&e.fixedVariants.push(S)}const h=Ct(t.node,s.node,e.ctx);if(h instanceof oe)if(d==="prefix"||d==="postfix")e.disjoint.push(...h.withPrefixKey(d==="prefix"?e.result.length:`-${n.length+1}`,"required")),e.result=[...e.result,{kind:d,node:W.intrinsic.never.internal}];else return d==="optionals"||d==="defaultables"?e:$o({...e,fixedVariants:[],l:n.map(S=>({...S,kind:"prefix"})),r:n.map(S=>({...S,kind:"prefix"}))});else d==="defaultables"?(t.kind==="defaultables"&&s.kind==="defaultables"&&t.default!==s.default&&Z(kA(t.default,s.default)),e.result=[...e.result,{kind:d,node:h,default:t.kind==="defaultables"?t.default:s.kind==="defaultables"?s.default:bt(`Unexpected defaultable intersection from ${t.kind} and ${s.kind} elements.`)}]):e.result=[...e.result,{kind:d,node:h}];const p=e.l.length,y=e.r.length;return(t.kind!=="variadic"||p>=y&&(s.kind==="variadic"||y===1))&&(e.l=n),(s.kind!=="variadic"||y>=p&&(t.kind==="variadic"||p===1))&&(e.r=a),$o(e)},qA=e=>t=>{var n,s;if(t.props.length||t.index){const a=((n=t.index)==null?void 0:n.map(c=>c[e]))??[];for(const c of t.props)a.push(c[e]);t.undeclared&&a.push(`+ (undeclared): ${t.undeclared}`);const u=`{ ${a.join(", ")} }`;return t.sequence?`${u} & ${t.sequence.description}`:u}return((s=t.sequence)==null?void 0:s.description)??"{}"},e$=qA("description"),t$=qA("expression"),SS=(e,t,n)=>{const s=e.required?"required":"optional";if(!t.signature.allows(e.key))return null;const a=Bi(e.value,t.value,n);return a instanceof oe?s==="optional"?n.node("optional",{key:e.key,value:W.intrinsic.never.internal}):a.withPrefixKey(e.key,e.kind):null},n$=ot({kind:"structure",hasAssociatedError:!1,normalize:e=>e,applyConfig:(e,t)=>!e.undeclared&&t.onUndeclaredKey!=="ignore"?{...e,undeclared:t.onUndeclaredKey}:e,keys:{required:{child:!0,parse:tn("required"),reduceIo:(e,t,n)=>{t.required=Ie(t.required,n.map(s=>s[e]))}},optional:{child:!0,parse:tn("optional"),reduceIo:(e,t,n)=>{if(e==="in"){t.optional=n.map(s=>s.in);return}for(const s of n)t[s.outProp.kind]=Ie(t[s.outProp.kind],s.outProp.out)}},index:{child:!0,parse:tn("index")},sequence:{child:!0,parse:tn("sequence")},undeclared:{parse:e=>e==="ignore"?void 0:e,reduceIo:(e,t,n)=>{n==="delete"&&(e==="in"?delete t.undeclared:t.undeclared="reject")}}},defaults:{description:e$},intersections:{structure:(e,t,n)=>{const s={...e.inner},a={...t.inner},u=new oe;if(e.undeclared){const h=e.keyof();for(const p of t.requiredKeys)h.allows(p)||u.add("presence",W.intrinsic.never.internal,t.propsByKey[p].value,{path:[p]});a.optional&&(a.optional=a.optional.filter(p=>h.allows(p.key))),a.index&&(a.index=a.index.flatMap(p=>{if(p.signature.extends(h))return p;const y=Bi(h,p.signature,n.$);if(y instanceof oe)return[];const g=Op(y,p.value,n.$);return g.required&&(a.required=Zs(a.required,g.required)),g.optional&&(a.optional=Zs(a.optional,g.optional)),g.index??[]}))}if(t.undeclared){const h=t.keyof();for(const p of e.requiredKeys)h.allows(p)||u.add("presence",e.propsByKey[p].value,W.intrinsic.never.internal,{path:[p]});s.optional&&(s.optional=s.optional.filter(p=>h.allows(p.key))),s.index&&(s.index=s.index.flatMap(p=>{if(p.signature.extends(h))return p;const y=Bi(h,p.signature,n.$);if(y instanceof oe)return[];const g=Op(y,p.value,n.$);return g.required&&(s.required=Zs(s.required,g.required)),g.optional&&(s.optional=Zs(s.optional,g.optional)),g.index??[]}))}const c={};(e.undeclared||t.undeclared)&&(c.undeclared=e.undeclared==="reject"||t.undeclared==="reject"?"reject":"delete");const d=Sc({kind:"structure",baseInner:c,l:xc(s),r:xc(a),roots:[],ctx:n});return d instanceof oe&&u.push(...d),u.length?u:d}},reduce:(e,t)=>{if(e.index){if(!(e.required||e.optional))return;let n=!1;const s=e.required??[],a=e.optional??[],u=[...a];for(const c of e.index){for(const d of s){const h=SS(d,c,t);if(h instanceof oe)return h}for(const[d,h]of a.entries()){const p=SS(h,c,t);if(p instanceof oe)return p;p!==null&&(u[d]=p,n=!0)}}if(n)return t.node("structure",{...e,optional:u},{prereduced:!0})}}});var $x,Bx;class i$ extends Ea{constructor(){super(...arguments);w(this,"impliedBasis",W.intrinsic.object.internal);w(this,"impliedSiblings",this.children.flatMap(n=>n.impliedSiblings??[]));w(this,"props",Zs(this.required,this.optional));w(this,"propsByKey",He(this.props,(n,s)=>[s.key,s]));w(this,"propsByKeyReference",Xt(this.propsByKey));w(this,"expression",t$(this));w(this,"requiredKeys",(($x=this.required)==null?void 0:$x.map(n=>n.key))??[]);w(this,"optionalKeys",((Bx=this.optional)==null?void 0:Bx.map(n=>n.key))??[]);w(this,"literalKeys",[...this.requiredKeys,...this.optionalKeys]);w(this,"_keyof");w(this,"traverseAllows",(n,s)=>this._traverse("Allows",n,s));w(this,"traverseApply",(n,s)=>this._traverse("Apply",n,s));w(this,"_traverse",(n,s,a)=>{const u=(a==null?void 0:a.currentErrorCount)??0;for(let c=0;c<this.props.length;c++)if(n==="Allows"){if(!this.props[c].traverseAllows(s,a))return!1}else if(this.props[c].traverseApply(s,a),a.failFast&&a.currentErrorCount>u)return!1;if(this.sequence){if(n==="Allows"){if(!this.sequence.traverseAllows(s,a))return!1}else if(this.sequence.traverseApply(s,a),a.failFast&&a.currentErrorCount>u)return!1}if(this.index||this.undeclared==="reject"){const c=Object.keys(s);c.push(...Object.getOwnPropertySymbols(s));for(let d=0;d<c.length;d++){const h=c[d];if(this.index){for(const p of this.index)if(p.signature.traverseAllows(h,a)){if(n==="Allows"){if(!$i(h,()=>p.value.traverseAllows(s[h],a),a))return!1}else if($i(h,()=>p.value.traverseApply(s[h],a),a),a.failFast&&a.currentErrorCount>u)return!1}}if(this.undeclared==="reject"&&!this.declaresKey(h)&&(n==="Allows"||(a.errorFromNodeContext({code:"predicate",expected:"removed",actual:"",relativePath:[h],meta:this.meta}),a.failFast)))return!1}}return this.structuralMorph&&a&&!a.hasError()&&a.queueMorphs([this.structuralMorph]),!0});w(this,"declaresKey",n=>{var s;return n in this.propsByKey||((s=this.index)==null?void 0:s.some(a=>a.signature.allows(n)))||this.sequence!==void 0&&W.intrinsic.nonNegativeIntegerString.allows(n)});w(this,"structuralMorphRef",this.structuralMorph&&Xt(this.structuralMorph))}keyof(){if(this._keyof)return this._keyof;let n=this.$.units(this.literalKeys).branches;if(this.index)for(const{signature:s}of this.index)n=n.concat(s.branches);return this._keyof=this.$.node("union",n)}map(n){return this.$.node("structure",this.props.flatMap(n).reduce((s,a)=>{const u=this.propsByKey[a.key];if(Ft(a))return a.kind!=="required"&&a.kind!=="optional"?Z(`Map result must have kind "required" or "optional" (was ${a.kind})`):(s[a.kind]=Ie(s[a.kind],a),s);const c=a.kind??(u==null?void 0:u.kind)??"required",d=He(a,(h,p)=>h in Bm.implementation.keys?[h,p]:[]);return s[c]=Ie(s[c],this.$.node(c,d)),s},{}))}assertHasKeys(n){const s=n.filter(a=>!zu(a,this.keyof()));if(s.length)return Z(xS(this.expression,s))}get(n,...s){var h;let a,u=!1;const c=o$(n);if((typeof c=="string"||typeof c=="symbol")&&this.propsByKey[c]&&(a=this.propsByKey[c].value,u=this.propsByKey[c].required),this.index)for(const p of this.index)zu(c,p.signature)&&(a=(a==null?void 0:a.and(p.value))??p.value);if(this.sequence&&zu(c,W.intrinsic.nonNegativeIntegerString))if(fe(c,"root"))this.sequence.variadic&&(a=(a==null?void 0:a.and(this.sequence.element))??this.sequence.element);else{const p=Number.parseInt(c);if(p<this.sequence.prevariadic.length){const y=this.sequence.prevariadic[p].node;a=(a==null?void 0:a.and(y))??y,u||(u=p<this.sequence.prefixLength)}else if(this.sequence.variadic){const y=this.$.node("union",this.sequence.variadicOrPostfix);a=(a==null?void 0:a.and(y))??y}}if(!a)return(h=this.sequence)!=null&&h.variadic&&fe(c,"root")&&c.extends(W.intrinsic.number)?Z(l$(c.expression,this.sequence.expression)):Z(xS(this.expression,[c]));const d=a.get(...s);return u?d:d.or(W.intrinsic.undefined)}pick(...n){return this.assertHasKeys(n),this.$.node("structure",this.filterKeys("pick",n))}omit(...n){return this.assertHasKeys(n),this.$.node("structure",this.filterKeys("omit",n))}optionalize(){const{required:n,...s}=this.inner;return this.$.node("structure",{...s,optional:this.props.map(a=>a.hasKind("required")?this.$.node("optional",a.inner):a)})}require(){const{optional:n,...s}=this.inner;return this.$.node("structure",{...s,required:this.props.map(a=>a.hasKind("optional")?{key:a.key,value:a.value}:a)})}merge(n){const s=this.filterKeys("omit",[n.keyof()]);return n.required&&(s.required=Ie(s.required,n.required)),n.optional&&(s.optional=Ie(s.optional,n.optional)),n.index&&(s.index=Ie(s.index,n.index)),n.sequence&&(s.sequence=n.sequence),n.undeclared?s.undeclared=n.undeclared:delete s.undeclared,this.$.node("structure",s)}filterKeys(n,s){const a=sA(this.inner),u=c=>{const d=s.some(h=>zu(c,h));return n==="pick"?d:!d};return a.required&&(a.required=a.required.filter(c=>u(c.key))),a.optional&&(a.optional=a.optional.filter(c=>u(c.key))),a.index&&(a.index=a.index.filter(c=>u(c.signature))),a}get defaultable(){var n;return this.cacheGetter("defaultable",((n=this.optional)==null?void 0:n.filter(s=>s.hasDefault()))??[])}_compileDeclaresKey(n){const s=[];if(this.props.length&&s.push(`k in ${this.propsByKeyReference}`),this.index)for(const a of this.index)s.push(n.invoke(a.signature,{kind:"Allows",arg:"k"}));return this.sequence&&s.push("$ark.intrinsic.nonNegativeIntegerString.allows(k)"),s.join(" || ")||"false"}get structuralMorph(){return this.cacheGetter("structuralMorph",r$(this))}compile(n){n.traversalKind==="Apply"&&n.initializeErrorCount();for(const s of this.props)n.check(s),n.traversalKind==="Apply"&&n.returnIfFailFast();if(this.sequence&&(n.check(this.sequence),n.traversalKind==="Apply"&&n.returnIfFailFast()),(this.index||this.undeclared==="reject")&&(n.const("keys","Object.keys(data)"),n.line("keys.push(...Object.getOwnPropertySymbols(data))"),n.for("i < keys.length",()=>this.compileExhaustiveEntry(n))),n.traversalKind==="Allows")return n.return(!0);this.structuralMorphRef&&n.if("ctx && !ctx.hasError()",()=>(n.line("ctx.queueMorphs(["),a$(n,this),n.line("])")))}compileExhaustiveEntry(n){if(n.const("k","keys[i]"),this.index)for(const s of this.index)n.if(`${n.invoke(s.signature,{arg:"k",kind:"Allows"})}`,()=>n.traverseKey("k","data[k]",s.value));return this.undeclared==="reject"&&n.if(`!(${this._compileDeclaresKey(n)})`,()=>n.traversalKind==="Allows"?n.return(!1):n.line(`ctx.errorFromNodeContext({ code: "predicate", expected: "removed", actual: "", relativePath: [k], meta: ${this.compiledMeta} })`).if("ctx.failFast",()=>n.return())),n}reduceJsonSchema(n,s){var a;switch(n.type){case"object":return this.reduceObjectJsonSchema(n,s);case"array":const u=((a=this.sequence)==null?void 0:a.reduceJsonSchema(n,s))??n;return this.props.length||this.index?s.fallback.arrayObject({code:"arrayObject",base:u,object:this.reduceObjectJsonSchema({type:"object"},s)}):u;default:return xt.throwInternalOperandError("structure",n)}}reduceObjectJsonSchema(n,s){if(this.props.length){n.properties={};for(const a of this.props){const u=a.value.toJsonSchemaRecurse(s);if(typeof a.key=="symbol"){s.fallback.symbolKey({code:"symbolKey",base:n,key:a.key,value:u,optional:a.optional});continue}if(a.hasDefault()){const c=typeof a.default=="function"?a.default():a.default;u.default=W.intrinsic.jsonData.allows(c)?c:s.fallback.defaultValue({code:"defaultValue",base:u,value:c})}n.properties[a.key]=u}this.requiredKeys.length&&n.properties&&(n.required=this.requiredKeys.filter(a=>typeof a=="string"&&a in n.properties))}if(this.index)for(const a of this.index){const u=a.value.toJsonSchemaRecurse(s);if(a.signature.equals(W.intrinsic.string)){n.additionalProperties=u;continue}for(const c of a.signature.branches){if(!c.extends(W.intrinsic.string)){n=s.fallback.symbolKey({code:"symbolKey",base:n,key:null,value:u,optional:!1});continue}let d={type:"string"};if(c.hasKind("morph")&&(d=s.fallback.morph({code:"morph",base:c.in.toJsonSchemaRecurse(s),out:c.out.toJsonSchemaRecurse(s)})),!c.hasKind("intersection"))return bt(`Unexpected index branch kind ${c.kind}.`);const{pattern:h}=c.inner;if(h){const p=Object.assign(d,{pattern:h[0].rule});for(let y=1;y<h.length;y++)d=s.fallback.patternIntersection({code:"patternIntersection",base:p,pattern:h[y].rule});n.patternProperties??(n.patternProperties={}),n.patternProperties[p.pattern]=u}}}return this.undeclared&&!n.additionalProperties&&(n.additionalProperties=!1),n}}const Bh={},s$=e=>{var n,s;let t="";for(let a=0;a<e.defaultable.length;a++)t+=e.defaultable[a].defaultValueMorphRef;if((n=e.sequence)!=null&&n.defaultValueMorphsReference&&(t+=(s=e.sequence)==null?void 0:s.defaultValueMorphsReference),e.undeclared==="delete"){if(t+="delete !(",e.required)for(const a of e.required)t+=a.compiledKey+" | ";if(e.optional)for(const a of e.optional)t+=a.compiledKey+" | ";if(e.index)for(const a of e.index)t+=a.signature.id+" | ";if(e.sequence)if(e.sequence.maxLength===null)t+=pe.nonNegativeIntegerString.id;else for(let a=0;a<e.sequence.tuple.length;a++)t+=a+" | ";t+=")"}return t},r$=e=>{const t=s$(e);if(!t)return;if(Bh[t])return Bh[t];const n=(s,a)=>{var u;for(let c=0;c<e.defaultable.length;c++)e.defaultable[c].key in s||e.defaultable[c].defaultValueMorph(s,a);if((u=e.sequence)!=null&&u.defaultables)for(let c=s.length-e.sequence.prefixLength;c<e.sequence.defaultables.length;c++)e.sequence.defaultValueMorphs[c](s,a);if(e.undeclared==="delete")for(const c in s)e.declaresKey(c)||delete s[c];return s};return Bh[t]=n},a$=(e,t)=>{var a;const s=`(data${t.defaultable.some(u=>u.defaultValueMorph.length===2)||((a=t.sequence)==null?void 0:a.defaultValueMorphs.some(u=>u.length===2))?", ctx":""})`;return e.block(`${s} => `,u=>{var c;for(let d=0;d<t.defaultable.length;d++){const{serializedKey:h,defaultValueMorphRef:p}=t.defaultable[d];u.if(`!(${h} in data)`,y=>y.line(`${p}${s}`))}return(c=t.sequence)!=null&&c.defaultables&&u.for(`i < ${t.sequence.defaultables.length}`,d=>d.set("data[i]",5),`data.length - ${t.sequence.prefixLength}`),t.undeclared==="delete"&&u.forIn("data",d=>d.if(`!(${t._compileDeclaresKey(d)})`,h=>h.line("delete data[k]"))),u.return("data")})},KA={implementation:n$,Node:i$},o$=e=>(fe(e,"root")&&e.hasKind("unit")&&(e=e.unit),typeof e=="number"&&(e=`${e}`),e),l$=(e,t)=>`${e} is not allowed as an array index on ${t}. Use the 'nonNegativeIntegerString' keyword instead.`,Op=(e,t,n)=>{const[s,a]=oN(e.branches,c=>c.hasKind("unit"));if(!s.length)return{index:n.node("index",{signature:e,value:t})};const u={};for(const c of s){const d=n.node("required",{key:c.unit,value:t});u[d.kind]=Ie(u[d.kind],d)}return a.length&&(u.index=n.node("index",{signature:a,value:t})),u},u$=e=>fe(e,"root")?e.expression:qe(e),xS=(e,t)=>`Key${t.length===1?"":"s"} ${t.map(u$).join(", ")} ${t.length===1?"does":"do"} not exist on ${e}`,Xc={...W_,alias:Vm.implementation,domain:zm.implementation,unit:LA.implementation,proto:Ac.implementation,union:BA.implementation,morph:_A.implementation,intersection:NA.implementation,divisor:pA.implementation,pattern:RA.implementation,predicate:hA.implementation,required:jA.implementation,optional:Bm.implementation,index:VA.implementation,sequence:zA.implementation,structure:KA.implementation};W.defaultConfig=vN(Object.assign(He(Xc,(e,t)=>[e,t.defaults]),{jitless:CN(),clone:RN,onUndeclaredKey:"ignore",exactOptionalPropertyTypes:!0,numberAllowsNaN:!1,dateAllowsInvalid:!1,onFail:null,keywords:{},toJsonSchema:xt.defaultConfig}));W.resolvedConfig=wp(W.defaultConfig,W.config);const c$={...e2,alias:Vm.Node,domain:zm.Node,unit:LA.Node,proto:Ac.Node,union:BA.Node,morph:_A.Node,intersection:NA.Node,divisor:pA.Node,pattern:RA.Node,predicate:hA.Node,required:jA.Node,optional:Bm.Node,index:VA.Node,sequence:zA.Node,structure:KA.Node};class Mp extends pN{get[_i](){return"module"}}const PA=(e,t)=>new Mp(He(e,(n,s)=>[n,fe(s,"module")?PA(s,t):t.bindReference(s)])),f$=e=>Pt(e)?e:"branches"in e&&Pt(e.branches)?e.branches:void 0,d$=(e,t)=>Z(`Node of kind ${t} is not valid as a ${e} definition`),wS=e=>`#${e} duplicates public alias ${e}`,Lh={};W.ambient??(W.ambient={});let AS;const IA="function $",h$=e=>HA(e,GA(e)),HA=(e,t)=>{const n=t.write(IA,4),s=t.compile()();for(const a of e)a.precompilation||(a.traverseAllows=s[`${a.id}Allows`].bind(s),a.isRoot()&&!a.allowsRequiresContext&&(a.allows=a.traverseAllows),a.traverseApply=s[`${a.id}Apply`].bind(s),s[`${a.id}Optimistic`]&&(a.traverseOptimistic=s[`${a.id}Optimistic`].bind(s)),a.precompilation=n)},GA=e=>new tA().return(e.reduce((t,n)=>{const s=new Dh({kind:"Allows"}).indent();n.compile(s);const a=s.write(`${n.id}Allows`),u=new Dh({kind:"Apply"}).indent();n.compile(u);const c=u.write(`${n.id}Apply`),d=`${t}${a},
|
|
106
|
-
${c},
|
|
107
|
-
`;if(!n.hasKind("union"))return d;const h=new Dh({kind:"Allows",optimistic:!0}).indent();n.compile(h);const p=h.write(`${n.id}Optimistic`);return`${d}${p},
|
|
108
|
-
`},`{
|
|
109
|
-
`)+"}");class FA{constructor(t,n){w(this,"config");w(this,"resolvedConfig");w(this,"name");w(this,"referencesById",{});w(this,"references",[]);w(this,"resolutions",{});w(this,"exportedNames",[]);w(this,"aliases",{});w(this,"resolved",!1);w(this,"nodesByHash",{});w(this,"intrinsic");w(this,"_json");w(this,"generic",(...t)=>{const n=this;return(s,a)=>new wc(t,a?new dA(s):s,n,n,a??null)});w(this,"units",(t,n)=>{const s=[];for(const u of t)s.includes(u)||s.push(u);const a=s.map(u=>this.node("unit",{unit:u},n));return this.node("union",a,{...n,prereduced:!0})});w(this,"lazyResolutions",[]);w(this,"schema",(t,n)=>this.finalize(this.parseSchema(t,n)));w(this,"parseSchema",(t,n)=>this.node(Zu(t),t,n));w(this,"precompilation");w(this,"_exportedResolutions");w(this,"_exports");w(this,"node",(t,n,s={})=>{const a=this.preparseNode(t,n,s);if(Ft(a))return this.bindReference(a);const u=this.createParseContext(a),c=MA(u),d=this.bindReference(c);return Dn[u.id]=d});w(this,"parse",(t,n={})=>this.finalize(this.parseDefinition(t,n)));this.config=wp(W.config,n),this.resolvedConfig=wp(W.resolvedConfig,n),this.name=this.resolvedConfig.name??`anonymousScope${Object.keys(Lh).length}`,this.name in Lh&&Z(`A Scope already named ${this.name} already exists`),Lh[this.name]=this;const s=Object.entries(t).map(a=>this.preparseOwnAliasEntry(...a));for(const[a,u]of s){let c=a;if(a[0]==="#"?(c=a.slice(1),c in this.aliases&&Z(wS(c)),this.aliases[c]=u):(c in this.aliases&&Z(wS(a)),this.aliases[c]=u,this.exportedNames.push(c)),!fe(u,"module")&&!fe(u,"generic")&&!Pc(u)){const d=this.preparseOwnDefinitionFormat(u,{alias:c});this.resolutions[c]=fe(d,"root")?this.bindReference(d):this.createParseContext(d).id}}AS??(AS=this.node("union",{branches:["string","number","object","bigint","symbol",{unit:!0},{unit:!1},{unit:void 0},{unit:null}]},{prereduced:!0})),this.nodesByHash[AS.hash]=this.node("intersection",{},{prereduced:!0}),this.intrinsic=W.intrinsic?He(W.intrinsic,(a,u)=>a.startsWith("json")?[]:[a,this.bindReference(u)]):{}}get[_i](){return"scope"}cacheGetter(t,n){return Object.defineProperty(this,t,{value:n}),n}get internal(){return this}get json(){return this._json||this.export(),this._json}defineSchema(t){return t}lazilyResolve(t,n){const s=this.node("alias",{reference:n??"synthetic",resolve:t},{prereduced:!0});return this.resolved||this.lazyResolutions.push(s),s}preparseNode(t,n,s){var d;let a=typeof t=="string"?t:Zu(n,t);if(Ft(n)&&n.kind===a)return n;if(a==="alias"&&!(s!=null&&s.prereduced)){const{reference:h}=Vm.implementation.normalize(n,this);if(h.startsWith("$")){const p=this.resolveRoot(h.slice(1));n=p,a=p.kind}}else if(a==="union"&&lr(n,"object")){const h=f$(n);(h==null?void 0:h.length)===1&&(n=h[0],a=Zu(n))}if(Ft(n)&&n.kind===a)return n;const u=Xc[a],c=((d=u.normalize)==null?void 0:d.call(u,n,this))??n;return Ft(c)?c.kind===a?c:d$(a,c.kind):{...s,$:this,kind:a,def:c,prefix:s.alias??a}}bindReference(t){let n;return Ft(t)?n=t.$===this?t:new t.constructor(t.attachments,this):n=t.$===this?t:new wc(t.params,t.bodyDef,t.$,this,t.hkt),this.resolved||Object.assign(this.referencesById,n.referencesById),n}resolveRoot(t){return this.maybeResolveRoot(t)??Z(JA(t))}maybeResolveRoot(t){const n=this.maybeResolve(t);if(!fe(n,"generic"))return n}maybeResolveSubalias(t){return Cp(this.aliases,t)??Cp(this.ambient,t)}get ambient(){return W.ambient}maybeResolve(t){var a;const n=this.resolutions[t];if(n){if(typeof n!="string")return this.bindReference(n);const u=Dn[n];if(fe(u,"root"))return this.resolutions[t]=u;if(fe(u,"context")){if(u.phase==="resolving")return this.node("alias",{reference:`$${t}`},{prereduced:!0});if(u.phase==="resolved")return bt(`Unexpected resolved context for was uncached by its scope: ${qe(u)}`);u.phase="resolving";const c=this.bindReference(this.parseOwnDefinitionFormat(u.def,u));return u.phase="resolved",Dn[c.id]=c,Dn[u.id]=c,this.resolutions[t]=c}return bt(`Unexpected nodesById entry for ${n}: ${qe(u)}`)}let s=this.aliases[t]??((a=this.ambient)==null?void 0:a[t]);return s?(s=this.normalizeRootScopeValue(s),fe(s,"generic")?this.resolutions[t]=this.bindReference(s):fe(s,"module")?(s.root||Z(QA(t)),this.resolutions[t]=this.bindReference(s.root)):this.resolutions[t]=this.parse(s,{alias:t})):this.maybeResolveSubalias(t)}createParseContext(t){const n=t.id??OA(t.prefix);return Dn[n]=Object.assign(t,{[_i]:"context",$:this,id:n,phase:"unresolved"})}traversal(t){return new ta(t,this.resolvedConfig)}import(...t){return new Mp(He(this.export(...t),(n,s)=>[`#${n}`,s]))}export(...t){if(!this._exports){this._exports={};for(const s of this.exportedNames){const a=this.aliases[s];this._exports[s]=fe(a,"module")?PA(a,this):TS(this.maybeResolve(s))}for(const s of this.lazyResolutions)s.resolution;if(this._exportedResolutions=ZA(this,this._exports),this._json=XA(this._exportedResolutions),Object.assign(this.resolutions,this._exportedResolutions),this.references=Object.values(this.referencesById),!this.resolvedConfig.jitless){const s=GA(this.references);this.precompilation=s.write(IA,4),HA(this.references,s)}this.resolved=!0}const n=t.length?t:this.exportedNames;return new Mp(He(n,(s,a)=>[a,this._exports[a]]))}resolve(t){return this.export()[t]}parseDefinition(t,n={}){if(fe(t,"root"))return this.bindReference(t);const s=this.preparseOwnDefinitionFormat(t,n);if(fe(s,"root"))return this.bindReference(s);const a=this.createParseContext(s);Dn[a.id]=a;let u=this.bindReference(this.parseOwnDefinitionFormat(t,a));return u.isCyclic&&(u=r2(u,a.id)),Dn[a.id]=u,u}finalize(t){return TS(t),!t.precompilation&&!this.resolvedConfig.jitless&&h$(t.references),t}}class YA extends FA{parseOwnDefinitionFormat(t,n){return MA(n)}preparseOwnDefinitionFormat(t,n){return this.preparseNode(Zu(t),t,n)}preparseOwnAliasEntry(t,n){return[t,n]}normalizeRootScopeValue(t){return t}}const TS=e=>{const t=e.references.filter(n=>n.hasKind("alias"));for(const n of t){Object.assign(n.referencesById,n.resolution.referencesById);for(const s of e.references)n.id in s.referencesById&&Object.assign(s.referencesById,n.referencesById)}return e},XA=e=>He(e,(t,n)=>[t,fe(n,"root")||fe(n,"generic")?n.json:fe(n,"module")?XA(n):bt(`Unexpected resolution ${qe(n)}`)]),Cp=(e,t)=>{const n=t.indexOf(".");if(n===-1)return;const s=t.slice(0,n),a=e[s];if(a===void 0)return;if(!fe(a,"module"))return Z(p$(s));const u=t.slice(n+1),c=a[u];if(c===void 0)return Cp(a,u);if(fe(c,"root")||fe(c,"generic"))return c;if(fe(c,"module"))return c.root??Z(QA(t));bt(`Unexpected resolution for alias '${t}': ${qe(c)}`)},Um=(e,t)=>new YA(e,t),pl=new YA({}),ZA=(e,t)=>{const n={};for(const s in t){const a=t[s];if(fe(a,"module")){const u=ZA(e,a),c=He(u,(d,h)=>[`${s}.${d}`,h]);Object.assign(n,c)}else fe(a,"root")||fe(a,"generic")?n[s]=a:bt(`Unexpected scope resolution ${qe(a)}`)}return n},JA=e=>`'${e}' is unresolvable`,p$=e=>`'${e}' must reference a module to be accessed using dot syntax`,QA=e=>`Reference to submodule '${e}' must specify an alias`;pl.export();const Ye=pl.schema,qm=pl.node;pl.defineSchema;const zi=pl.generic,WA="^(?:0|[1-9]\\d*)$",m$=new RegExp(WA);Xt(m$);const eT=Um({bigint:"bigint",boolean:[{unit:!1},{unit:!0}],false:{unit:!1},never:[],null:{unit:null},number:"number",object:"object",string:"string",symbol:"symbol",true:{unit:!0},unknown:{},undefined:{unit:void 0},Array,Date},{prereducedAliases:!0}).export();W.intrinsic={...eT};const tT=Um({integer:{domain:"number",divisor:1},lengthBoundable:["string",Array],key:["string","symbol"],nonNegativeIntegerString:{domain:"string",pattern:WA}},{prereducedAliases:!0}).export();Object.assign(W.intrinsic,tT);const y$=Um({jsonPrimitive:["string","number",{unit:!0},{unit:!1},{unit:null}],jsonObject:{domain:"object",index:{signature:"string",value:"$jsonData"}},jsonData:["$jsonPrimitive","$jsonObject"]},{prereducedAliases:!0}).export(),pe={...eT,...tT,...y$,emptyStructure:qm("structure",{},{prereduced:!0})};W.intrinsic={...pe};const g$=e=>typeof e=="string"&&e[0]==="d"&&(e[1]==="'"||e[1]==='"')&&e.at(-1)===e[1],ES=e=>e.toString()!=="Invalid Date",b$=e=>e.slice(2,-1),nT=e=>`'${e}' could not be parsed by the Date constructor`,v$=(e,t)=>S$(e,t),S$=(e,t)=>{const n=new Date(e);if(ES(n))return n;const s=GN(e);if(s!==void 0){const a=new Date(s);if(ES(a))return a}return t?Z(t===!0?nT(e):t):void 0},RS=(e,t)=>{const n=e.scanner.shiftUntil(w$[sT[t]]);if(e.scanner.lookahead==="")return e.error(T$(n,t));if(e.scanner.shift(),t==="/"){try{new RegExp(n)}catch(s){Z(String(s))}e.root=e.ctx.$.node("intersection",{domain:"string",pattern:n},{prereduced:!0})}else if(ai(t,iT))e.root=e.ctx.$.node("unit",{unit:n});else{const s=v$(n,nT(n));e.root=e.ctx.$.node("unit",{meta:n,unit:s})}},iT={"'":1,'"':1},x$={"/":1,"'":1,'"':1},sT={"d'":"'",'d"':'"',"'":"'",'"':'"',"/":"/"},w$={"'":e=>e.lookahead==="'",'"':e=>e.lookahead==='"',"/":e=>e.lookahead==="/"},A$={'"':"double-quote","'":"single-quote","/":"forward slash"},T$=(e,t)=>`${t}${e} requires a closing ${A$[sT[t]]}`,E$=e=>`Private type references should not include '#'. Use '${e}' instead.`,rT="Optional definitions like 'string?' are only valid as properties in an object or tuple",aT="Defaultable definitions like 'number = 0' are only valid as properties in an object or tuple",R$={">":!0,">=":!0},O$={"<":!0,"<=":!0},Tc={"<":">",">":"<","<=":">=",">=":"<=","==":"=="},M$=e=>`Unmatched )${e===""?"":` before ${e}`}`,oT=e=>`Missing ${e}`,C$=(e,t)=>`Left bounds are only valid when paired with right bounds (try ...${t}${e})`,lT=e=>`Left-bounded expressions must specify their limits using < or <= (was ${e})`,k$=(e,t,n,s)=>`An expression may have at most one left bound (parsed ${e}${Tc[t]}, ${n}${Tc[s]})`,D$=(e,t,n)=>uT(e,t,n,[]),uT=(e,t,n,s)=>{const a=n.parseUntilFinalizer();return s.push(a.root),a.finalizer===">"?s.length!==t.params.length?n.error(cT(e,t.names,s.map(u=>u.expression))):s:a.finalizer===","?uT(e,t,n,s):a.error(oT(">"))},cT=(e,t,n)=>`${e}<${t.join(", ")}> requires exactly ${t.length} args (got ${n.length}${n.length===0?"":`: ${n.join(", ")}`})`,OS=e=>{const t=e.scanner.shiftUntilNextTerminator();t==="keyof"?e.addPrefix("keyof"):e.root=_$(e,t)},N$=(e,t,n)=>{if(n.scanner.shiftUntilNonWhitespace(),n.scanner.shift()!=="<")return n.error(cT(e,t.names,[]));const a=D$(e,t,n);return t(...a)},_$=(e,t)=>$$(e,t)??B$(e,t)??e.error(t===""?e.scanner.lookahead==="#"?E$(e.shiftedByOne().scanner.shiftUntilNextTerminator()):fT(e):JA(t)),$$=(e,t)=>{var s;if((s=e.ctx.args)!=null&&s[t]){const a=e.ctx.args[t];return typeof a!="string"?a:e.ctx.$.node("alias",{reference:a},{prereduced:!0})}const n=e.ctx.$.maybeResolve(t);if(fe(n,"root"))return n;if(n!==void 0)return fe(n,"generic")?N$(t,n,e):Z(`Unexpected resolution ${qe(n)}`)},B$=(e,t)=>{const n=FN(t);if(n!==void 0)return e.ctx.$.node("unit",{unit:n});const s=XN(t);if(s!==void 0)return e.ctx.$.node("unit",{unit:s})},fT=e=>{const t=e.previousOperator();return t?dT(t,e.scanner.unscanned):L$(e.scanner.unscanned)},dT=(e,t="")=>`Token '${e}' requires a right operand${t?` before '${t}'`:""}`,L$=e=>`Expected an expression${e?` before '${e}'`:""}`,hT=e=>e.scanner.lookahead===""?e.error(fT(e)):e.scanner.lookahead==="("?e.shiftedByOne().reduceGroupOpen():e.scanner.lookaheadIsIn(x$)?RS(e,e.scanner.shift()):e.scanner.lookaheadIsIn(Ic)?hT(e.shiftedByOne()):e.scanner.lookahead==="d"&&e.scanner.nextLookahead in iT?RS(e,`${e.scanner.shift()}${e.scanner.shift()}`):OS(e),Xs=class Xs extends i_{shiftUntilNextTerminator(){return this.shiftUntilNonWhitespace(),this.shiftUntil(()=>this.lookahead in Xs.terminatingChars)}};w(Xs,"terminatingChars",{"<":1,">":1,"=":1,"|":1,"&":1,")":1,"[":1,"%":1,",":1,":":1,"?":1,"#":1,...Ic}),w(Xs,"finalizingLookaheads",{">":1,",":1,"":1,"=":1,"?":1}),w(Xs,"lookaheadIsFinalizing",(t,n)=>t===">"?n[0]==="="?n[1]==="=":n.trimStart()===""||ai(n.trimStart()[0],Xs.terminatingChars):t==="="?n[0]!=="=":t===","||t==="?");let Go=Xs;const V$=(e,t)=>{const n=z$(e,t);if(e.root.hasKind("unit")){if(typeof e.root.unit=="number"){e.reduceLeftBound(e.root.unit,n),e.unsetRoot();return}if(e.root.unit instanceof Date){const s=`d'${e.root.description??e.root.unit.toISOString()}'`;e.unsetRoot(),e.reduceLeftBound(s,n);return}}return q$(e,n)},j$={"<":1,">":1,"=":1},z$=(e,t)=>e.scanner.lookaheadIs("=")?`${t}${e.scanner.shift()}`:t,MS=(e,t,n,s)=>n.extends(W.intrinsic.number)?typeof t!="number"?Z(kp(e,t,s)):e==="=="?["min","max"]:e[0]===">"?["min"]:["max"]:n.extends(W.intrinsic.lengthBoundable)?typeof t!="number"?Z(kp(e,t,s)):e==="=="?["exactLength"]:e[0]===">"?["minLength"]:["maxLength"]:n.extends(W.intrinsic.Date)?e==="=="?["after","before"]:e[0]===">"?["after"]:["before"]:Z(j_(n.expression)),U$=e=>({rule:g$(e.limit)?b$(e.limit):e.limit,exclusive:e.comparator.length===1}),q$=(e,t)=>{const n=e.unsetRoot(),s=e.scanner.location;e.parseOperand();const a=e.unsetRoot(),u=e.scanner.sliceChars(s,e.scanner.location);if(e.root=n,!a.hasKind("unit")||typeof a.unit!="number"&&!(a.unit instanceof Date))return e.error(kp(t,u,"right"));const c=a.unit,d=t.length===1,h=MS(t,typeof c=="number"?c:u,n,"right");for(const y of h)e.constrainRoot(y,t==="=="?{rule:c}:{rule:c,exclusive:d});if(!e.branches.leftBound)return;if(!ai(t,O$))return e.error(lT(t));const p=MS(e.branches.leftBound.comparator,e.branches.leftBound.limit,n,"left");e.constrainRoot(p[0],U$(e.branches.leftBound)),e.branches.leftBound=null},kp=(e,t,n)=>`Comparator ${n==="left"?Tc[e]:e} must be ${n==="left"?"preceded":"followed"} by a corresponding literal (was ${t})`,K$=e=>{e.scanner.shiftUntilNonWhitespace();const t=e.scanner.shiftUntilNextTerminator();e.root=e.root.brand(t)},P$=e=>{const t=e.scanner.shiftUntilNextTerminator(),n=YN(t,{errorOnFail:CS(t)});n===0&&e.error(CS(0)),e.root=e.root.constrain("divisor",n)},CS=e=>`% operator must be followed by a non-zero integer literal (was ${e})`,pT=e=>{const t=e.scanner.shift();return t===""?e.finalize(""):t==="["?e.scanner.shift()==="]"?e.setRoot(e.root.array()):e.error(I$):t==="|"?e.scanner.lookahead===">"?e.shiftedByOne().pushRootToBranch("|>"):e.pushRootToBranch(t):t==="&"?e.pushRootToBranch(t):t===")"?e.finalizeGroup():Go.lookaheadIsFinalizing(t,e.scanner.unscanned)?e.finalize(t):ai(t,j$)?V$(e,t):t==="%"?P$(e):t==="#"?K$(e):t in Ic?pT(e):e.error(Km(t))},Km=(e,t="")=>`'${e}' is not allowed here${t&&` (should be ${t})`}`,I$="Missing expected ']'",H$=e=>{const t=e.unsetRoot();e.parseOperand();const n=e.unsetRoot();if(!n.hasKind("unit"))return e.error(G$(n.expression));const s=n.unit instanceof Date?()=>new Date(n.unit):n.unit;return[t,"=",s]},G$=e=>`Default value '${e}' must a literal value`,kS=(e,t)=>{const n=t.$.maybeResolveRoot(e);if(n)return n;if(e.endsWith("[]")){const u=t.$.maybeResolveRoot(e.slice(0,-2));if(u)return u.array()}const s=new Zc(new Go(e),t),a=F$(s);return s.finalizer===">"&&Z(Km(">")),a},F$=e=>{e.parseOperand();let t=Pm(e).root;return t?(e.finalizer==="="?t=H$(e):e.finalizer==="?"&&(t=[t,"?"]),e.scanner.shiftUntilNonWhitespace(),e.scanner.lookahead&&Z(Km(e.scanner.lookahead)),t):bt(`Root was unexpectedly unset after parsing string '${e.scanner.scanned}'`)},Pm=e=>{for(;e.finalizer===void 0;)Y$(e);return e},Y$=e=>e.hasRoot()?e.parseOperator():e.parseOperand();class Zc{constructor(t,n){w(this,"root");w(this,"branches",{prefixes:[],leftBound:null,intersection:null,union:null,pipe:null});w(this,"finalizer");w(this,"groups",[]);w(this,"scanner");w(this,"ctx");this.scanner=t,this.ctx=n}error(t){return Z(t)}hasRoot(){return this.root!==void 0}setRoot(t){this.root=t}unsetRoot(){const t=this.root;return this.root=void 0,t}constrainRoot(...t){this.root=this.root.constrain(t[0],t[1])}finalize(t){if(this.groups.length)return this.error(oT(")"));this.finalizeBranches(),this.finalizer=t}reduceLeftBound(t,n){const s=Tc[n];if(!ai(s,R$))return this.error(lT(n));if(this.branches.leftBound)return this.error(k$(this.branches.leftBound.limit,this.branches.leftBound.comparator,t,s));this.branches.leftBound={comparator:s,limit:t}}finalizeBranches(){if(this.assertRangeUnset(),this.branches.pipe){this.pushRootToBranch("|>"),this.root=this.branches.pipe;return}if(this.branches.union){this.pushRootToBranch("|"),this.root=this.branches.union;return}if(this.branches.intersection){this.pushRootToBranch("&"),this.root=this.branches.intersection;return}this.applyPrefixes()}finalizeGroup(){this.finalizeBranches();const t=this.groups.pop();if(!t)return this.error(M$(this.scanner.unscanned));this.branches=t}addPrefix(t){this.branches.prefixes.push(t)}applyPrefixes(){for(;this.branches.prefixes.length;){const t=this.branches.prefixes.pop();this.root=t==="keyof"?this.root.keyof():bt(`Unexpected prefix '${t}'`)}}pushRootToBranch(t){var s,a,u;this.assertRangeUnset(),this.applyPrefixes();const n=this.root;this.root=void 0,this.branches.intersection=((s=this.branches.intersection)==null?void 0:s.rawAnd(n))??n,t!=="&"&&(this.branches.union=((a=this.branches.union)==null?void 0:a.rawOr(this.branches.intersection))??this.branches.intersection,this.branches.intersection=null,t!=="|"&&(this.branches.pipe=((u=this.branches.pipe)==null?void 0:u.rawPipeOnce(this.branches.union))??this.branches.union,this.branches.union=null))}parseUntilFinalizer(){return Pm(new Zc(this.scanner,this.ctx))}parseOperator(){return pT(this)}parseOperand(){return hT(this)}assertRangeUnset(){if(this.branches.leftBound)return this.error(C$(this.branches.leftBound.limit,this.branches.leftBound.comparator))}reduceGroupOpen(){this.groups.push(this.branches),this.branches={prefixes:[],leftBound:null,union:null,intersection:null,pipe:null}}previousOperator(){var t;return((t=this.branches.leftBound)==null?void 0:t.comparator)??this.branches.prefixes.at(-1)??(this.branches.intersection?"&":this.branches.union?"|":this.branches.pipe?"|>":void 0)}shiftedByOne(){return this.scanner.shift(),this}}const X$="An empty string is not a valid generic parameter name",Dp=(e,t,n)=>{e.shiftUntilNonWhitespace();const s=e.shiftUntilNextTerminator();return s===""?e.lookahead===""&&t.length?t:Z(X$):(e.shiftUntilNonWhitespace(),Z$(e,s,t,n))},DS="extends ",Z$=(e,t,n,s)=>{if(e.shiftUntilNonWhitespace(),e.unscanned.startsWith(DS))e.jumpForward(DS.length);else return e.lookahead===","&&e.shift(),n.push(t),Dp(e,n,s);const a=Pm(new Zc(e,s));return n.push([t,a.root]),Dp(e,n,s)};class J$ extends Ta{constructor(n){super((...s)=>new Uu(n)(...s),{bind:n});w(this,"$");this.$=n}in(n){return new Uu(this.$,n===void 0?void 0:this.$.parse(n))}at(n,s){return new Uu(this.$).at(n,s)}case(n,s){return new Uu(this.$).case(n,s)}}class Uu extends Ta{constructor(n,s){super(a=>this.caseEntries(Object.entries(a).map(([u,c])=>u==="default"?[u,c]:[this.$.parse(u),c])));w(this,"$");w(this,"in");w(this,"key");w(this,"branches",[]);this.$=n,this.in=s}at(n,s){return this.key&&Z(W$),this.branches.length&&Z(Q$),this.key=n,s?this.match(s):this}case(n,s){return this.caseEntry(this.$.parse(n),s)}caseEntry(n,s){const u=(this.key?this.$.parse({[this.key]:n}):n).pipe(s);return this.branches.push(u),this}match(n){return this(n)}strings(n){return this.caseEntries(Object.entries(n).map(([s,a])=>s==="default"?[s,a]:[this.$.node("unit",{unit:s}),a]))}caseEntries(n){for(let s=0;s<n.length;s++){const[a,u]=n[s];if(a==="default")return s!==n.length-1&&Z("default may only be specified as the last key of a switch definition"),this.default(u);if(typeof u!="function")return Z(`Value for case "${a}" must be a function (was ${Pn(u)})`);this.caseEntry(a,u)}return this}default(n){typeof n=="function"&&this.case(pe.unknown,n);const s={branches:this.branches,ordered:!0};(n==="never"||n==="assert")&&(s.meta={onFail:NS});const a=this.$.node("union",s);if(!this.in)return this.$.finalize(a);let u=this.in.pipe(a);return(n==="never"||n==="assert")&&(u=u.configureReferences({onFail:NS},"self")),this.$.finalize(u)}}const NS=e=>e.throw(),Q$="A key matcher must be specified before the first case i.e. match.at('foo') or match.in<object>().at('bar')",W$="At most one key matcher may be specified per expression",mT=(e,t)=>{if(Pt(e)){if(e[1]==="=")return[t.$.parseOwnDefinitionFormat(e[0],t),"=",e[2]];if(e[1]==="?")return[t.$.parseOwnDefinitionFormat(e[0],t),"?"]}return wT(e,t)},e3="Only required keys may make their values optional, e.g. { [mySymbol]: ['number', '?'] }",t3="Only required keys may specify default values, e.g. { value: 'number = 0' }",n3=(e,t)=>{var c;let n;const s={},a=yc(e);for(const[d,h]of a){const p=r3(d);if(p.kind==="spread"){if(!ol(s))return Z(s3);const T=t.$.parseOwnDefinitionFormat(h,t);if(T.equals(pe.object))continue;if(!T.hasKind("intersection")||!((c=T.basis)!=null&&c.equals(pe.object)))return Z(a3(T.expression));n=T.structure;continue}if(p.kind==="undeclared"){h!=="reject"&&h!=="delete"&&h!=="ignore"&&Z(i3(h)),s.undeclared=h;continue}const y=mT(h,t),g=p;if(p.kind==="required"){Pt(y)?Vh(s,"optional",y[1]==="="?{key:p.normalized,value:y[0],default:y[2]}:{key:p.normalized,value:y[0]},t):Vh(s,"required",{key:p.normalized,value:y},t);continue}if(Pt(y)&&(y[1]==="?"&&Z(e3),y[1]==="="&&Z(t3)),p.kind==="optional"){Vh(s,"optional",{key:p.normalized,value:y},t);continue}const v=t.$.parseOwnDefinitionFormat(g.normalized,t),S=Op(v,y,t.$);S.index&&(s.index=Ie(s.index,S.index)),S.required&&(s.required=Ie(s.required,S.required))}const u=t.$.node("structure",s);return t.$.parseSchema({domain:"object",structure:(n==null?void 0:n.merge(u))??u})},Vh=(e,t,n,s)=>{e[t]=Ie(e[t],s.$.node(t,n))},i3=e=>`Value of '+' key must be 'reject', 'delete', or 'ignore' (was ${qe(e)})`,s3="Spread operator may only be used as the first key in an object",r3=e=>typeof e=="symbol"?{kind:"required",normalized:e}:e.at(-1)==="?"?e.at(-2)===gp?{kind:"required",normalized:`${e.slice(0,-2)}?`}:{kind:"optional",normalized:e.slice(0,-1)}:e[0]==="["&&e.at(-1)==="]"?{kind:"index",normalized:e.slice(1,-1)}:e[0]===gp&&e[1]==="["&&e.at(-1)==="]"?{kind:"required",normalized:e.slice(1)}:e==="..."?{kind:"spread"}:e==="+"?{kind:"undeclared"}:{kind:"required",normalized:e==="\\..."?"...":e==="\\+"?"+":e},a3=e=>`Spread operand must resolve to an object literal type (was ${e})`,o3=(e,t)=>g3(e)?vT[e[0]](e,t):m3(e)?bT[e[1]](e,t):null,l3=(e,t)=>t.$.parseOwnDefinitionFormat(e[1],t).keyof(),jh=(e,t)=>{if(e[2]===void 0)return Z(dT(e[1],""));const n=t.$.parseOwnDefinitionFormat(e[0],t),s=t.$.parseOwnDefinitionFormat(e[2],t);if(e[1]==="|")return t.$.node("union",{branches:[n,s]});const a=e[1]==="&"?Bi(n,s,t.$):Tp(n,s,t.$);return a instanceof oe?a.throw():a},u3=(e,t)=>t.$.parseOwnDefinitionFormat(e[0],t).array(),c3=(e,t)=>typeof e[2]!="function"?Z(yT("=>",e[2])):t.$.parseOwnDefinitionFormat(e[0],t).pipe(e[2]),yT=(e,t)=>`${e===":"?"Narrow":"Morph"} expression requires a function following '${e}' (was ${typeof t})`,f3=(e,t)=>typeof e[2]!="function"?Z(yT(":",e[2])):t.$.parseOwnDefinitionFormat(e[0],t).constrain("predicate",e[2]),d3=(e,t)=>t.$.parseOwnDefinitionFormat(e[0],t).configureReferences(e[2],"shallow"),gT=e=>e,h3=gT({"[]":u3,"?":()=>Z(rT)}),p3=gT({"|":jh,"&":jh,":":f3,"=>":c3,"|>":jh,"@":d3,"=":()=>Z(aT)}),bT={...h3,...p3},m3=e=>bT[e[1]]!==void 0,y3=e=>e,vT=y3({keyof:l3,instanceof:(e,t)=>{if(typeof e[1]!="function")return Z(_S(yp(e[1])));const n=e.slice(1).map(s=>typeof s=="function"?t.$.node("proto",{proto:s}):Z(_S(yp(s))));return n.length===1?n[0]:t.$.node("union",{branches:n})},"===":(e,t)=>t.$.units(e.slice(1))}),g3=e=>vT[e[0]]!==void 0,_S=e=>`Expected a constructor following 'instanceof' operator (was ${e})`,b3=(e,t)=>{let n=[{}],s=0;for(;s<e.length;){let a=!1;e[s]==="..."&&s<e.length-1&&(a=!0,s++);const u=mT(e[s],t),[c,d,h]=Pt(u)?u:[u];if(s++,a){if(!c.extends(W.intrinsic.Array))return Z(x3(c.expression));n=n.flatMap(p=>c.distribute(y=>S3(sA(p),y)))}else n=n.map(p=>d==="?"?ST(p,c):d==="="?v3(p,c,h):Np(p,c))}return t.$.parseSchema(n.map(a=>ol(a)?{proto:Array,exactLength:0}:{proto:Array,sequence:a}))},Np=(e,t)=>e.defaultables||e.optionals?Z(e.variadic?UA:w3):(e.variadic?e.postfix=Ie(e.postfix,t):e.prefix=Ie(e.prefix,t),e),ST=(e,t)=>e.variadic?Z(xT):(e.optionals=Ie(e.optionals,t),e),v3=(e,t,n)=>e.variadic?Z(xT):e.optionals?Z(A3):(e.defaultables=Ie(e.defaultables,[[t,n]]),e),$S=(e,t)=>(e.postfix&&Z(BS),e.variadic?e.variadic.equals(t)||Z(BS):e.variadic=t.internal,e),S3=(e,t)=>{const n=t.select({method:"find",kind:"sequence"});if(!n)return $S(e,W.intrinsic.unknown);if(n.prefix)for(const s of n.prefix)Np(e,s);if(n.optionals)for(const s of n.optionals)ST(e,s);if(n.variadic&&$S(e,n.variadic),n.postfix)for(const s of n.postfix)Np(e,s);return e},x3=e=>`Spread element must be an array (was ${e})`,BS="A tuple may have at most one variadic element",w3="A required element may not follow an optional element",xT="An optional element may not follow a variadic element",A3="A defaultable element may not follow an optional element without a default",zh={},wT=(e,t)=>{var n;if(typeof e=="string"){if(t.args&&Object.keys(t.args).some(a=>e.includes(a)))return kS(e,t);const s=zh[n=t.$.name]??(zh[n]={});return s[e]??(s[e]=kS(e,t))}return lr(e,"object")?T3(e,t):Z(_p(Pn(e)))},T3=(e,t)=>{const n=Om(e);switch(n){case void 0:return fe(e,"root")?e:n3(e,t);case"Array":return E3(e,t);case"RegExp":return t.$.node("intersection",{domain:"string",pattern:e},{prereduced:!0});case"Function":{const s=Pc(e)?e():e;return fe(s,"root")?s:Z(_p("Function"))}default:return Z(_p(n??qe(e)))}},E3=(e,t)=>o3(e,t)??b3(e,t),_p=e=>`Type definitions must be strings or objects (was ${e})`;class R3 extends Ta{constructor(t){const n=Object.assign({errors:vs,hkt:oi,$:t,raw:t.parse,module:t.constructor.module,scope:t.constructor.scope,define:t.define,match:t.match,generic:t.generic,schema:t.schema,keywords:t.ambient,unit:t.unit,enumerated:t.enumerated,instanceOf:t.instanceOf,valueOf:t.valueOf,or:t.or,and:t.and,merge:t.merge,pipe:t.pipe},t.ambientAttachments);super((...s)=>{if(s.length===1)return t.parse(s[0]);if(s.length===2&&typeof s[0]=="string"&&s[0][0]==="<"&&s[0].at(-1)===">"){const a=s[0].slice(1,-1),u=t.parseGenericParams(a,{});return new wc(u,s[1],t,t,null)}return t.parse(s)},{bind:t,attach:n})}}const Fo=W,oa=class oa extends FA{constructor(){super(...arguments);w(this,"unit",n=>this.units([n]));w(this,"valueOf",n=>this.units(SN(n)));w(this,"enumerated",(...n)=>this.units(n));w(this,"instanceOf",n=>this.node("proto",{proto:n},{prereduced:!0}));w(this,"or",(...n)=>this.schema(n.map(s=>this.parse(s))));w(this,"and",(...n)=>n.reduce((s,a)=>s.and(this.parse(a)),this.intrinsic.unknown));w(this,"merge",(...n)=>n.reduce((s,a)=>s.merge(this.parse(a)),this.intrinsic.object));w(this,"pipe",(...n)=>this.intrinsic.unknown.pipe(...n));w(this,"match",new J$(this));w(this,"declare",()=>({type:this.type}));w(this,"type",new R3(this))}get ambientAttachments(){if(Fo.typeAttachments)return this.cacheGetter("ambientAttachments",He(Fo.typeAttachments,(n,s)=>[n,this.bindReference(s)]))}preparseOwnAliasEntry(n,s){var d;const a=n.indexOf("<");if(a===-1){if(fe(s,"module")||fe(s,"generic"))return[n,s];const h=this.name==="ark"?n:n==="root"?this.name:`${this.name}.${n}`,p=(d=this.resolvedConfig.keywords)==null?void 0:d[h];return p&&(s=[s,"@",p]),[n,s]}n.at(-1)!==">"&&Z("'>' must be the last character of a generic declaration in a scope");const u=n.slice(0,a),c=n.slice(a+1,-1);return[u,()=>{const h=this.parseGenericParams(c,{alias:u});return T_(h,s,this)}]}parseGenericParams(n,s){return Dp(new Go(n),[],this.createParseContext({...s,def:n,prefix:"generic"}))}normalizeRootScopeValue(n){return Pc(n)&&!fe(n,"generic")?n():n}preparseOwnDefinitionFormat(n,s){return{...s,def:n,prefix:s.alias??"type"}}parseOwnDefinitionFormat(n,s){!(s.alias&&s.alias in this.aliases)&&!s.args&&(s.args={this:s.id});const u=wT(n,s);if(Pt(u)){if(u[1]==="=")return Z(aT);if(u[1]==="?")return Z(rT)}return u}define(n){return n}};w(oa,"scope",(n,s={})=>new oa(n,s)),w(oa,"module",(n,s={})=>oa.scope(n,s).export());let Ec=oa;const O3=Object.assign(Ec.scope,{define:e=>e}),Be=Ec;class M3 extends oi{constructor(){super(...arguments);w(this,"description",'merge an object\'s properties onto another like `Merge(User, { isAdmin: "true" })`')}}const C3=zi(["base",pe.object],["props",pe.object])(e=>e.base.merge(e.props),M3),k3=Be.module({Key:pe.key,Merge:C3});class D3 extends oi{}const N3=zi("element")(e=>{const t=e.element.exclude(pe.Array),n=t.array();return t.rawOr(n).pipe(al).distribute(s=>s.assertHasKind("morph").declareOut(n),Ye)},D3),_3=Be.module({root:pe.Array,readonly:"root",index:pe.nonNegativeIntegerString,liftFrom:N3},{name:"Array"}),$p=Ye(["string",ll.FileConstructor]),$3=$p.rawOr($p.array()),LS=Ye({meta:"an object representing parsed form data",domain:"object",index:{signature:"string",value:$3}}),B3=Be.module({root:["instanceof",FormData],value:$p,parsed:LS,parse:Ye({in:FormData,morphs:e=>{const t={};for(const[n,s]of e)if(n in t){const a=t[n];typeof a=="string"||a instanceof ll.FileConstructor?t[n]=[a,s]:a.push(s)}else t[n]=s;return t},declaredOut:LS})},{name:"FormData"}),L3=Be.module({Int8:["instanceof",Int8Array],Uint8:["instanceof",Uint8Array],Uint8Clamped:["instanceof",Uint8ClampedArray],Int16:["instanceof",Int16Array],Uint16:["instanceof",Uint16Array],Int32:["instanceof",Int32Array],Uint32:["instanceof",Uint32Array],Float32:["instanceof",Float32Array],Float64:["instanceof",Float64Array],BigInt64:["instanceof",BigInt64Array],BigUint64:["instanceof",BigUint64Array]},{name:"TypedArray"}),V3={Boolean:1,Number:1,String:1},j3=Be.module({...He({...Pw,...Hw},(e,t)=>e in V3?[]:[e,["instanceof",t]]),Array:_3,TypedArray:L3,FormData:B3}),z3=Ye({domain:{domain:"number",meta:"a number representing a Unix timestamp"},divisor:{rule:1,meta:"an integer representing a Unix timestamp"},min:{rule:-864e13,meta:"a Unix timestamp after -8640000000000000"},max:{rule:864e13,meta:"a Unix timestamp before 8640000000000000"},meta:"an integer representing a safe Unix timestamp"}),U3=Ye({domain:"number",divisor:1}),AT=Be.module({root:pe.number,integer:U3,epoch:z3,safe:Ye({domain:{domain:"number",numberAllowsNaN:!1},min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER}),NaN:["===",Number.NaN],Infinity:["===",Number.POSITIVE_INFINITY],NegativeInfinity:["===",Number.NEGATIVE_INFINITY]},{name:"number"}),Je=(e,t,n)=>{const s={domain:"string",pattern:{rule:e.source,flags:e.flags,meta:t}};return n&&(s.meta={format:n}),qm("intersection",s)},VS=Je(gc,"a well-formed integer string"),TT=Be.module({root:VS,parse:Ye({in:VS,morphs:(e,t)=>{const n=Number.parseInt(e);return Number.isSafeInteger(n)?n:t.error("an integer in the range Number.MIN_SAFE_INTEGER to Number.MAX_SAFE_INTEGER")},declaredOut:pe.integer})},{name:"string.integer"}),q3=Je(/^[\dA-Fa-f]+$/,"hex characters only"),K3=Be.module({root:Je(/^(?:[\d+/A-Za-z]{4})*(?:[\d+/A-Za-z]{2}==|[\d+/A-Za-z]{3}=)?$/,"base64-encoded"),url:Je(/^(?:[\w-]{4})*(?:[\w-]{2}(?:==|%3D%3D)?|[\w-]{3}(?:=|%3D)?)?$/,"base64url-encoded")},{name:"string.base64"}),jS=Je(/^[A-Z].*$/,"capitalized"),P3=Be.module({root:Ye({in:"string",morphs:e=>e.charAt(0).toUpperCase()+e.slice(1),declaredOut:jS}),preformatted:jS},{name:"string.capitalize"}),I3=e=>{const t=e.replaceAll(/[ -]+/g,"");let n=0,s,a,u=!1;for(let c=t.length-1;c>=0;c--)s=t.substring(c,c+1),a=Number.parseInt(s,10),u?(a*=2,n+=a>=10?a%10+1:a):n+=a,u=!u;return!!(n%10===0&&t)},H3=/^(?:4\d{12}(?:\d{3,6})?|5[1-5]\d{14}|(222[1-9]|22[3-9]\d|2[3-6]\d{2}|27[01]\d|2720)\d{12}|6(?:011|5\d\d)\d{12,15}|3[47]\d{13}|3(?:0[0-5]|[68]\d)\d{11}|(?:2131|1800|35\d{3})\d{11}|6[27]\d{14}|^(81\d{14,17}))$/,G3=Ye({domain:"string",pattern:{meta:"a credit card number",rule:H3.source},predicate:{meta:"a credit card number",predicate:I3}}),F3=/^([+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-3])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))(T((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([,.]\d+(?!:))?)?(\17[0-5]\d([,.]\d+)?)?([Zz]|([+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/,Y3=e=>!Number.isNaN(new Date(e).valueOf()),zS=Ye({domain:"string",predicate:{meta:"a parsable date",predicate:Y3}}).assertHasKind("intersection"),US=TT.root.internal.narrow((e,t)=>{const n=Number.parseInt(e),s=AT.epoch(n);return s instanceof vs?(t.errors.merge(s),!1):!0}).configure({description:"an integer string representing a safe Unix timestamp"},"self").assertHasKind("intersection"),X3=Be.module({root:US,parse:Ye({in:US,morphs:e=>new Date(e),declaredOut:pe.Date})},{name:"string.date.epoch"}),qS=Je(F3,"an ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) date").internal.assertHasKind("intersection"),Z3=Be.module({root:qS,parse:Ye({in:qS,morphs:e=>new Date(e),declaredOut:pe.Date})},{name:"string.date.iso"}),J3=Be.module({root:zS,parse:Ye({declaredIn:zS,in:"string",morphs:(e,t)=>{const n=new Date(e);return Number.isNaN(n.valueOf())?t.error("a parsable date"):n},declaredOut:pe.Date}),iso:Z3,epoch:X3},{name:"string.date"}),Q3=Je(/^[\w%+.-]+@[\d.A-Za-z-]+\.[A-Za-z]{2,}$/,"an email address","email"),KS="(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])",fs=`(${KS}[.]){3}${KS}`,W3=new RegExp(`^${fs}$`),pt="(?:[0-9a-fA-F]{1,4})",eB=new RegExp(`^((?:${pt}:){7}(?:${pt}|:)|(?:${pt}:){6}(?:${fs}|:${pt}|:)|(?:${pt}:){5}(?::${fs}|(:${pt}){1,2}|:)|(?:${pt}:){4}(?:(:${pt}){0,1}:${fs}|(:${pt}){1,3}|:)|(?:${pt}:){3}(?:(:${pt}){0,2}:${fs}|(:${pt}){1,4}|:)|(?:${pt}:){2}(?:(:${pt}){0,3}:${fs}|(:${pt}){1,5}|:)|(?:${pt}:){1}(?:(:${pt}){0,4}:${fs}|(:${pt}){1,6}|:)|(?::((?::${pt}){0,5}:${fs}|(?::${pt}){1,7}|:)))(%[0-9a-zA-Z.]{1,})?$`),tB=Be.module({root:["v4 | v6","@","an IP address"],v4:Je(W3,"an IPv4 address","ipv4"),v6:Je(eB,"an IPv6 address","ipv6")},{name:"string.ip"}),ca="a JSON string",ET=e=>{if(!(e instanceof SyntaxError))throw e;return`must be ${ca} (${e})`},nB=Ye({meta:ca,domain:"string",predicate:{meta:ca,predicate:(e,t)=>{try{return JSON.parse(e),!0}catch(n){return t.reject({code:"predicate",expected:ca,problem:ET(n)})}}}}),iB=(e,t)=>{if(e.length===0)return t.error({code:"predicate",expected:ca,actual:"empty"});try{return JSON.parse(e)}catch(n){return t.error({code:"predicate",expected:ca,problem:ET(n)})}},sB=Be.module({root:nB,parse:Ye({meta:"safe JSON string parser",in:"string",morphs:iB,declaredOut:pe.jsonObject})},{name:"string.json"}),PS=Je(/^[a-z]*$/,"only lowercase letters"),rB=Be.module({root:Ye({in:"string",morphs:e=>e.toLowerCase(),declaredOut:PS}),preformatted:PS},{name:"string.lower"}),RT=["NFC","NFD","NFKC","NFKD"],ml=He(RT,(e,t)=>[t,Ye({domain:"string",predicate:n=>n.normalize(t)===n,meta:`${t}-normalized unicode`})]),Jc=He(RT,(e,t)=>[t,Ye({in:"string",morphs:n=>n.normalize(t),declaredOut:ml[t]})]),aB=Be.module({root:Jc.NFC,preformatted:ml.NFC},{name:"string.normalize.NFC"}),oB=Be.module({root:Jc.NFD,preformatted:ml.NFD},{name:"string.normalize.NFD"}),lB=Be.module({root:Jc.NFKC,preformatted:ml.NFKC},{name:"string.normalize.NFKC"}),uB=Be.module({root:Jc.NFKD,preformatted:ml.NFKD},{name:"string.normalize.NFKD"}),cB=Be.module({root:"NFC",NFC:aB,NFD:oB,NFKC:lB,NFKD:uB},{name:"string.normalize"}),IS=Je(bp,"a well-formed numeric string"),fB=Be.module({root:IS,parse:Ye({in:IS,morphs:e=>Number.parseFloat(e),declaredOut:pe.number})},{name:"string.numeric"}),HS="a regex pattern",dB=Ye({domain:"string",predicate:{meta:HS,predicate:(e,t)=>{try{return new RegExp(e),!0}catch(n){return t.reject({code:"predicate",expected:HS,problem:String(n)})}}},meta:{format:"regex"}}),hB=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[A-Za-z-][\dA-Za-z-]*)(?:\.(?:0|[1-9]\d*|\d*[A-Za-z-][\dA-Za-z-]*))*))?(?:\+([\dA-Za-z-]+(?:\.[\dA-Za-z-]+)*))?$/,pB=Je(hB,"a semantic version (see https://semver.org/)"),GS=Je(/^\S.*\S$|^\S?$/,"trimmed"),mB=Be.module({root:Ye({in:"string",morphs:e=>e.trim(),declaredOut:GS}),preformatted:GS},{name:"string.trim"}),FS=Je(/^[A-Z]*$/,"only uppercase letters"),yB=Be.module({root:Ye({in:"string",morphs:e=>e.toUpperCase(),declaredOut:FS}),preformatted:FS},{name:"string.upper"}),gB=e=>{if(URL.canParse)return URL.canParse(e);try{return new URL(e),!0}catch{return!1}},YS=Ye({domain:"string",predicate:{meta:"a URL string",predicate:gB},meta:{format:"uri"}}),bB=Be.module({root:YS,parse:Ye({declaredIn:YS,in:"string",morphs:(e,t)=>{try{return new URL(e)}catch{return t.error("a URL string")}},declaredOut:Ye(URL)})},{name:"string.url"}),vB=Be.module({root:["versioned | nil | max","@",{description:"a UUID",format:"uuid"}],"#nil":"'00000000-0000-0000-0000-000000000000'","#max":"'ffffffff-ffff-ffff-ffff-ffffffffffff'","#versioned":/[\da-f]{8}-[\da-f]{4}-[1-8][\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}/i,v1:Je(/^[\da-f]{8}-[\da-f]{4}-1[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv1"),v2:Je(/^[\da-f]{8}-[\da-f]{4}-2[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv2"),v3:Je(/^[\da-f]{8}-[\da-f]{4}-3[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv3"),v4:Je(/^[\da-f]{8}-[\da-f]{4}-4[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv4"),v5:Je(/^[\da-f]{8}-[\da-f]{4}-5[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv5"),v6:Je(/^[\da-f]{8}-[\da-f]{4}-6[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv6"),v7:Je(/^[\da-f]{8}-[\da-f]{4}-7[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv7"),v8:Je(/^[\da-f]{8}-[\da-f]{4}-8[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv8")},{name:"string.uuid"}),SB=Be.module({root:pe.string,alpha:Je(/^[A-Za-z]*$/,"only letters"),alphanumeric:Je(/^[\dA-Za-z]*$/,"only letters and digits 0-9"),hex:q3,base64:K3,capitalize:P3,creditCard:G3,date:J3,digits:Je(/^\d*$/,"only digits 0-9"),email:Q3,integer:TT,ip:tB,json:sB,lower:rB,normalize:cB,numeric:fB,regex:dB,semver:pB,trim:mB,upper:yB,url:bB,uuid:vB},{name:"string"}),xB=Be.module({bigint:pe.bigint,boolean:pe.boolean,false:pe.false,never:pe.never,null:pe.null,number:pe.number,object:pe.object,string:pe.string,symbol:pe.symbol,true:pe.true,unknown:pe.unknown,undefined:pe.undefined}),wB=Be.module({root:pe.unknown,any:pe.unknown},{name:"unknown"}),AB=Be.module({root:pe.jsonObject,stringify:qm("morph",{in:pe.jsonObject,morphs:e=>JSON.stringify(e),declaredOut:pe.string})},{name:"object.json"}),TB=Be.module({root:pe.object,json:AB},{name:"object"});class EB extends oi{constructor(){super(...arguments);w(this,"description",'instantiate an object from an index signature and corresponding value type like `Record("string", "number")`')}}const RB=zi(["K",pe.key],"V")(e=>({domain:"object",index:{signature:e.K,value:e.V}}),EB);class OB extends oi{constructor(){super(...arguments);w(this,"description",'pick a set of properties from an object like `Pick(User, "name | age")`')}}const MB=zi(["T",pe.object],["K",pe.key])(e=>e.T.pick(e.K),OB);class CB extends oi{constructor(){super(...arguments);w(this,"description",'omit a set of properties from an object like `Omit(User, "age")`')}}const kB=zi(["T",pe.object],["K",pe.key])(e=>e.T.omit(e.K),CB);class DB extends oi{constructor(){super(...arguments);w(this,"description","make all named properties of an object optional like `Partial(User)`")}}const NB=zi(["T",pe.object])(e=>e.T.partial(),DB);class _B extends oi{constructor(){super(...arguments);w(this,"description","make all named properties of an object required like `Required(User)`")}}const $B=zi(["T",pe.object])(e=>e.T.required(),_B);class BB extends oi{constructor(){super(...arguments);w(this,"description",'exclude branches of a union like `Exclude("boolean", "true")`')}}const LB=zi("T","U")(e=>e.T.exclude(e.U),BB);class VB extends oi{constructor(){super(...arguments);w(this,"description",'extract branches of a union like `Extract("0 | false | 1", "number")`')}}const jB=zi("T","U")(e=>e.T.extract(e.U),VB),zB=Be.module({Exclude:LB,Extract:jB,Omit:kB,Partial:NB,Pick:MB,Record:RB,Required:$B}),ur=O3({...xB,...zB,...j3,...k3,string:SB,number:AT,object:TB,unknown:wB},{prereducedAliases:!0,name:"ark"}),Mt=ur.export();Object.assign(Fo.ambient,Mt);Fo.typeAttachments={string:Mt.string.root,number:Mt.number.root,bigint:Mt.bigint,boolean:Mt.boolean,symbol:Mt.symbol,undefined:Mt.undefined,null:Mt.null,object:Mt.object.root,unknown:Mt.unknown.root,false:Mt.false,true:Mt.true,never:Mt.never,arrayIndex:Mt.Array.index,Key:Mt.Key,Record:Mt.Record,Array:Mt.Array.root,Date:Mt.Date};const yt=Object.assign(ur.type,Fo.typeAttachments);ur.match;ur.generic;ur.schema;ur.define;ur.declare;const OT={100:'"Continue"',101:'"Switching Protocols"',102:'"Processing"',103:'"Early Hints"',200:'"OK"',201:'"Created"',202:'"Accepted"',203:'"Non-Authoritative Information"',204:'"No Content"',205:'"Reset Content"',206:'"Partial Content"',207:'"Multi-Status"',208:'"Already Reported"',226:'"IM Used"',300:'"Multiple Choices"',301:'"Moved Permanently"',302:'"Found"',303:'"See Other"',304:'"Not Modified"',305:'"Use Proxy"',306:'"Switch Proxy"',307:'"Temporary Redirect"',308:'"Permanent Redirect"',400:'"Bad Request"',401:'"Unauthorized"',402:'"Payment Required"',403:'"Forbidden"',404:'"Not Found"',405:'"Method Not Allowed"',406:'"Not Acceptable"',407:'"Proxy Authentication Required"',408:'"Request Timeout"',409:'"Conflict"',410:'"Gone"',411:'"Length Required"',412:'"Precondition Failed"',413:'"Payload Too Large"',414:'"URI Too Long"',415:'"Unsupported Media Type"',416:'"Range Not Satisfiable"',417:'"Expectation Failed"',418:`"I'm a teapot"`,421:'"Misdirected Request"',422:'"Unprocessable Entity"',423:'"Locked"',424:'"Failed Dependency"',425:'"Too Early"',426:'"Upgrade Required"',428:'"Precondition Required"',429:'"Too Many Requests"',431:'"Request Header Fields Too Large"',451:'"Unavailable For Legal Reasons"',500:'"Internal Server Error"',501:'"Not Implemented"',502:'"Bad Gateway"',503:'"Service Unavailable"',504:'"Gateway Timeout"',505:'"HTTP Version Not Supported"',506:'"Variant Also Negotiates"',507:'"Insufficient Storage"',508:'"Loop Detected"',510:'"Not Extended"',511:'"Network Authentication Required"'};function UB(e){return Number.parseInt(e,10)}const qB=yt(OT),KB=qB.keyof().pipe(e=>UB(e));yt([KB,"string"]);function PB(e){return K.jsxs("svg",{id:"uuid-3d2d6be6-f179-42a3-9511-1e9ddeb8575f",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 500 101",...e,children:[K.jsx("title",{children:"Tempest Games Logo"}),K.jsx("path",{d:"M155.76.93v59.89h-17.11V7.78h-13.69V.93h30.8Z",style:{fill:"var(--logo-color)",strokeWidth:0}}),K.jsx("path",{d:"M202.91,7.86h-13.18v17.03h13.18v6.84h-13.18v22.24h13.18v6.84h-30.29V.93h30.29v6.93Z",style:{fill:"var(--logo-color)",strokeWidth:0}}),K.jsx("path",{d:"M289.49.93v59.89h-17.11V7.78h-.43c-8.21,0-11.21,5.82-11.21,17.03v36.02h-16.25V24.8c0-11.21-2.99-17.03-11.21-17.03h-.43v53.04h-17.11V.93h18.74c9.92,0,15.31,4.96,18.14,11.21,2.82-6.25,8.21-11.21,18.14-11.21h18.73Z",style:{fill:"var(--logo-color)",strokeWidth:0}}),K.jsx("path",{d:"M352.82,29.68c0,11.72-6.42,19.16-24.55,19.16h-4.53v11.98h-17.11V1.1l46.2-.17v28.75ZM323.73,7.78v34.22h2.48c7.36,0,9.5-4.11,9.5-12.15V7.78h-11.98Z",style:{fill:"var(--logo-color)",strokeWidth:0}}),K.jsx("path",{d:"M396.8,7.86h-13.17v17.03h13.17v6.84h-13.17v22.24h13.17v6.84h-30.28V.93h30.28v6.93Z",style:{fill:"var(--logo-color)",strokeWidth:0}}),K.jsx("path",{d:"M425.9,12.57v14.03h27.89v16.94c0,12.75-1.71,18.13-16.43,18.13h-14.54c-9.58,0-14.03-2.74-14.03-11.97v-5.99h15.4v5.13c0,4.53.77,5.99,4.62,5.99h1.71c5.05,0,6.16-1.46,6.16-6.84v-14.54h-27.89v-16.68c0-13.52,3.85-16.68,18.82-16.68h12.83c8.81,0,13.17,1.54,13.17,10.78v7.19h-15.4v-6.5c0-3.42-1.03-4.62-4.45-4.62h-1.45c-4.28,0-6.42,1.46-6.42,5.65Z",style:{fill:"var(--logo-color)",strokeWidth:0}}),K.jsx("path",{d:"M500,7.78h-13.69v53.04h-17.11V.93h30.8v6.84Z",style:{fill:"var(--logo-color)",strokeWidth:0}}),K.jsx("path",{d:"M155.96,93.78v-3.57h-5.58v-7.14h13.39v17.85h-24.76v-28.56h24.76v7.14h-16.96v14.28h9.15Z",style:{fill:"var(--logo-color)",strokeWidth:0}}),K.jsx("path",{d:"M224.26,100.92h-8.25v-10.71h-8.25v3.57h4.68v7.14h-12.94v-17.85h16.51v-3.57h-16.51v-7.14h24.76v28.56Z",style:{fill:"var(--logo-color)",strokeWidth:0}}),K.jsx("path",{d:"M259.99,72.36h30.57v28.56h-7.81v-21.42h-3.57v21.42h-7.81v-21.42h-3.57v21.42h-7.81v-28.56Z",style:{fill:"var(--logo-color)",strokeWidth:0}}),K.jsx("path",{d:"M343.24,83.08v-3.57h-9.14v14.28h16.96v7.14h-24.76v-28.56h24.76v17.85h-13.38v-7.14h5.57Z",style:{fill:"var(--logo-color)",strokeWidth:0}}),K.jsx("path",{d:"M394.59,79.5v3.57h16.96v17.85h-24.76v-7.14h16.96v-3.57h-16.96v-17.85h24.76v7.14h-16.96Z",style:{fill:"var(--logo-color)",strokeWidth:0}}),K.jsx("path",{d:"M0,63.42v-20.84h20.83L0,63.42ZM100,.92v32.29h-35.42v8.33h-8.33V14.46h-22.92l1.04,7.29h9.38v19.79h-8.33v-8.33H0V.92h100ZM0,100.92v-26.04l6.25-1.04,25-26.04,1.04,1.05-10.42,18.75-4.16,7.29h13.54l3.13-3.12,8.33-22.92h1.04v41.66h3.12l9.38-8.33v-33.33h1.04l8.33,22.92,3.12,3.12h13.54l-4.17-7.29-10.42-19.8,1.04-1.04,25,27.09,6.25,1.04v26.04H0ZM100,42.59v20.84l-20.83-20.84h20.83Z",style:{fill:"var(--logo-color)",strokeWidth:0}})]})}function MT(e){return K.jsx("a",{...e})}const IB={class:"_class_1nbks_1"};function Qc(e){const t={subscribe(n){let s=null,a=!1,u=!1,c=!1;function d(){if(s===null){c=!0;return}u||(u=!0,typeof s=="function"?s():s&&s.unsubscribe())}return s=e({next(h){var p;a||(p=n.next)==null||p.call(n,h)},error(h){var p;a||(a=!0,(p=n.error)==null||p.call(n,h),d())},complete(){var h;a||(a=!0,(h=n.complete)==null||h.call(n),d())}}),c&&d(),{unsubscribe:d}},pipe(...n){return n.reduce(HB,t)}};return t}function HB(e,t){return t(e)}function GB(e){const t=new AbortController;return new Promise((s,a)=>{let u=!1;function c(){u||(u=!0,d.unsubscribe())}t.signal.addEventListener("abort",()=>{a(t.signal.reason)});const d=e.subscribe({next(h){u=!0,s(h),c()},error(h){a(h)},complete(){t.abort(),c()}})})}function FB(e){return t=>{let n=0,s=null;const a=[];function u(){s||(s=t.subscribe({next(d){var h;for(const p of a)(h=p.next)==null||h.call(p,d)},error(d){var h;for(const p of a)(h=p.error)==null||h.call(p,d)},complete(){var d;for(const h of a)(d=h.complete)==null||d.call(h)}}))}function c(){if(n===0&&s){const d=s;s=null,d.unsubscribe()}}return Qc(d=>(n++,a.push(d),u(),{unsubscribe(){n--,c();const h=a.findIndex(p=>p===d);h>-1&&a.splice(h,1)}}))}}function YB(e){let t=e;const n=[],s=c=>{t!==void 0&&c.next(t),n.push(c)},a=c=>{n.splice(n.indexOf(c),1)},u=Qc(c=>(s(c),()=>{a(c)}));return u.next=c=>{if(t!==c){t=c;for(const d of n)d.next(c)}},u.get=()=>t,u}function XB(e){return Qc(t=>{function n(a=0,u=e.op){const c=e.links[a];if(!c)throw new Error("No more links to execute - did you forget to add an ending link?");return c({op:u,next(h){return n(a+1,h)}})}return n().subscribe(t)})}const CT=()=>{},XS=e=>{Object.freeze&&Object.freeze(e)};function kT(e,t,n){var s,a;const u=t.join(".");return(s=n)[a=u]??(s[a]=new Proxy(CT,{get(c,d){if(!(typeof d!="string"||d==="then"))return kT(e,[...t,d],n)},apply(c,d,h){const p=t[t.length-1];let y={args:h,path:t};return p==="call"?y={args:h.length>=2?[h[1]]:[],path:t.slice(0,-1)}:p==="apply"&&(y={args:h.length>=2?h[1]:[],path:t.slice(0,-1)}),XS(y.args),XS(y.path),e(y)}})),n[u]}const ZB=e=>kT(e,[],Object.create(null)),JB=e=>new Proxy(CT,{get(t,n){if(n!=="then")return e(n)}});function Yo(e){return!!e&&!Array.isArray(e)&&typeof e=="object"}function QB(e,t){if("error"in e){const s=t.deserialize(e.error);return{ok:!1,error:{...e,error:s}}}return{ok:!0,result:{...e.result,...(!e.result.type||e.result.type==="data")&&{type:"data",data:t.deserialize(e.result.data)}}}}class Uh extends Error{constructor(){super("Unable to transform response from server")}}function WB(e,t){let n;try{n=QB(e,t)}catch{throw new Uh}if(!n.ok&&(!Yo(n.error.error)||typeof n.error.error.code!="number"))throw new Uh;if(n.ok&&!Yo(n.result))throw new Uh;return n}var ZS,JS;(ZS=Symbol).dispose??(ZS.dispose=Symbol());(JS=Symbol).asyncDispose??(JS.asyncDispose=Symbol());var Lx,Vx,jx,zx,Ux,qx;typeof window>"u"||"Deno"in window||((Vx=(Lx=globalThis.process)==null?void 0:Lx.env)==null?void 0:Vx.NODE_ENV)==="test"||(zx=(jx=globalThis.process)==null?void 0:jx.env)!=null&&zx.JEST_WORKER_ID||(qx=(Ux=globalThis.process)==null?void 0:Ux.env)!=null&&qx.VITEST_WORKER_ID;function qu(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function eL(e){return e instanceof ei||e instanceof Error&&e.name==="TRPCClientError"}function tL(e){return Yo(e)&&Yo(e.error)&&typeof e.error.code=="number"&&typeof e.error.message=="string"}function nL(e,t){return typeof e=="string"?e:Yo(e)&&typeof e.message=="string"?e.message:t}class ei extends Error{static from(t,n={}){const s=t;return eL(s)?(n.meta&&(s.meta={...s.meta,...n.meta}),s):tL(s)?new ei(s.error.message,{...n,result:s}):new ei(nL(s,"Unknown error"),{...n,cause:s})}constructor(t,n){var a,u;const s=n==null?void 0:n.cause;super(t,{cause:s}),qu(this,"cause",void 0),qu(this,"shape",void 0),qu(this,"data",void 0),qu(this,"meta",void 0),this.meta=n==null?void 0:n.meta,this.cause=s,this.shape=(a=n==null?void 0:n.result)==null?void 0:a.error,this.data=(u=n==null?void 0:n.result)==null?void 0:u.error.data,this.name="TRPCClientError",Object.setPrototypeOf(this,ei.prototype)}}function qh(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class iL{$request(t){return XB({links:this.links,op:{...t,context:t.context??{},id:++this.requestId}}).pipe(FB())}async requestAsPromise(t){try{const n=this.$request(t);return(await GB(n)).result.data}catch(n){throw ei.from(n)}}query(t,n,s){return this.requestAsPromise({type:"query",path:t,input:n,context:s==null?void 0:s.context,signal:s==null?void 0:s.signal})}mutation(t,n,s){return this.requestAsPromise({type:"mutation",path:t,input:n,context:s==null?void 0:s.context,signal:s==null?void 0:s.signal})}subscription(t,n,s){return this.$request({type:"subscription",path:t,input:n,context:s.context,signal:s.signal}).subscribe({next(u){var c,d,h,p;switch(u.result.type){case"state":{(c=s.onConnectionStateChange)==null||c.call(s,u.result);break}case"started":{(d=s.onStarted)==null||d.call(s,{context:u.context});break}case"stopped":{(h=s.onStopped)==null||h.call(s);break}case"data":case void 0:{(p=s.onData)==null||p.call(s,u.result.data);break}}},error(u){var c;(c=s.onError)==null||c.call(s,u)},complete(){var u;(u=s.onComplete)==null||u.call(s)}})}constructor(t){qh(this,"links",void 0),qh(this,"runtime",void 0),qh(this,"requestId",void 0),this.requestId=0,this.runtime={},this.links=t.links.map(n=>n(this.runtime))}}const sL=Symbol.for("trpc_untypedClient"),rL={query:"query",mutate:"mutation",subscribe:"subscription"},aL=e=>rL[e];function oL(e){const t=ZB(({path:n,args:s})=>{const a=[...n],u=aL(a.pop()),c=a.join(".");return e[u](c,...s)});return JB(n=>n===sL?e:t[n])}function lL(e){const t=new iL(e);return oL(t)}const QS=e=>typeof e=="function";function uL(e){if(e)return e;if(typeof window<"u"&&QS(window.fetch))return window.fetch;if(typeof globalThis<"u"&&QS(globalThis.fetch))return globalThis.fetch;throw new Error("No fetch implementation found")}const WS=()=>{throw new Error("Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new")};function e1(e){let t=null,n=null;const s=()=>{clearTimeout(n),n=null,t=null};function a(d){var y,g;const h=[[]];let p=0;for(;;){const v=d[p];if(!v)break;const S=h[h.length-1];if(v.aborted){(y=v.reject)==null||y.call(v,new Error("Aborted")),p++;continue}if(e.validate(S.concat(v).map(R=>R.key))){S.push(v),p++;continue}if(S.length===0){(g=v.reject)==null||g.call(v,new Error("Input is too big for a single dispatch")),p++;continue}h.push([])}return h}function u(){const d=a(t);s();for(const h of d){if(!h.length)continue;const p={items:h};for(const g of h)g.batch=p;e.fetch(p.items.map(g=>g.key)).then(async g=>{var v;await Promise.all(g.map(async(S,T)=>{var M,D;const R=p.items[T];try{const $=await Promise.resolve(S);(M=R.resolve)==null||M.call(R,$)}catch($){(D=R.reject)==null||D.call(R,$)}R.batch=null,R.reject=null,R.resolve=null}));for(const S of p.items)(v=S.reject)==null||v.call(S,new Error("Missing result")),S.batch=null}).catch(g=>{var v;for(const S of p.items)(v=S.reject)==null||v.call(S,g),S.batch=null})}}function c(d){const h={aborted:!1,key:d,batch:null,resolve:WS,reject:WS},p=new Promise((y,g)=>{h.reject=g,h.resolve=y,t||(t=[]),t.push(h)});return n||(n=setTimeout(u)),p}return{load:c}}function cL(...e){const t=new AbortController,n=e.length;let s=0;const a=()=>{++s===n&&t.abort()};for(const u of e)u!=null&&u.aborted?a():u==null||u.addEventListener("abort",a,{once:!0});return t.signal}function fL(e){const t=e;return t?"input"in t?t:{input:t,output:t}:{input:{serialize:n=>n,deserialize:n=>n},output:{serialize:n=>n,deserialize:n=>n}}}function dL(e){return{url:e.url.toString(),fetch:e.fetch,transformer:fL(e.transformer),methodOverride:e.methodOverride}}function hL(e){const t={};for(let n=0;n<e.length;n++){const s=e[n];t[n]=s}return t}const pL={query:"GET",mutation:"POST",subscription:"PATCH"};function DT(e){return"input"in e?e.transformer.input.serialize(e.input):hL(e.inputs.map(t=>e.transformer.input.serialize(t)))}const NT=e=>{const t=e.url.split("?");let s=t[0].replace(/\/$/,"")+"/"+e.path;const a=[];if(t[1]&&a.push(t[1]),"inputs"in e&&a.push("batch=1"),e.type==="query"||e.type==="subscription"){const u=DT(e);u!==void 0&&e.methodOverride!=="POST"&&a.push(`input=${encodeURIComponent(JSON.stringify(u))}`)}return a.length&&(s+="?"+a.join("&")),s},mL=e=>{if(e.type==="query"&&e.methodOverride!=="POST")return;const t=DT(e);return t!==void 0?JSON.stringify(t):void 0},yL=e=>SL({...e,contentTypeHeader:"application/json",getUrl:NT,getBody:mL});class gL extends Error{constructor(){const t="AbortError";super(t),this.name=t,this.message=t}}const bL=e=>{var t;if(e!=null&&e.aborted)throw(t=e.throwIfAborted)==null||t.call(e),typeof DOMException<"u"?new DOMException("AbortError","AbortError"):new gL};async function vL(e){bL(e.signal);const t=e.getUrl(e),n=e.getBody(e),{type:s}=e,a=await(async()=>{const c=await e.headers();return Symbol.iterator in c?Object.fromEntries(c):c})(),u={...e.contentTypeHeader?{"content-type":e.contentTypeHeader}:{},...e.trpcAcceptHeader?{"trpc-accept":e.trpcAcceptHeader}:void 0,...a};return uL(e.fetch)(t,{method:e.methodOverride??pL[s],signal:e.signal,body:n,headers:u})}async function SL(e){const t={},n=await vL(e);t.response=n;const s=await n.json();return t.responseJSON=s,{json:s,meta:t}}function xL(e){const t=dL(e),n=e.maxURLLength??1/0,s=e.maxItems??1/0;return()=>{const a=h=>({validate(p){if(n===1/0&&s===1/0)return!0;if(p.length>s)return!1;const y=p.map(S=>S.path).join(","),g=p.map(S=>S.input);return NT({...t,type:h,path:y,inputs:g,signal:null}).length<=n},async fetch(p){const y=p.map(M=>M.path).join(","),g=p.map(M=>M.input),v=cL(...p.map(M=>M.signal)),S=await yL({...t,path:y,inputs:g,type:h,headers(){return e.headers?typeof e.headers=="function"?e.headers({opList:p}):e.headers:{}},signal:v});return(Array.isArray(S.json)?S.json:p.map(()=>S.json)).map(M=>({meta:S.meta,json:M}))}}),u=e1(a("query")),c=e1(a("mutation")),d={query:u,mutation:c};return({op:h})=>Qc(p=>{/* istanbul ignore if -- @preserve */if(h.type==="subscription")throw new Error("Subscriptions are unsupported by `httpLink` - use `httpSubscriptionLink` or `wsLink`");const g=d[h.type].load(h);let v;return g.then(S=>{v=S;const T=WB(S.json,t.transformer.output);if(!T.ok){p.error(ei.from(T.error,{meta:S.meta}));return}p.next({context:S.meta,result:T.result}),p.complete()}).catch(S=>{p.error(ei.from(S,{meta:v==null?void 0:v.meta}))}),()=>{}})}}const _T=(e,...t)=>typeof e=="function"?e(...t):e;function wL(){let e,t;return{promise:new Promise((s,a)=>{e=s,t=a}),resolve:e,reject:t}}async function AL(e){const t=await _T(e.url);if(!e.connectionParams)return t;const s=`${t.includes("?")?"&":"?"}connectionParams=1`;return t+s}async function TL(e){const t={method:"connectionParams",data:await _T(e)};return JSON.stringify(t)}function Gs(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function EL(e){const{promise:t,resolve:n,reject:s}=wL();return e.addEventListener("open",()=>{e.removeEventListener("error",s),n()}),e.addEventListener("error",s),t}function RL(e,{intervalMs:t,pongTimeoutMs:n}){let s,a;function u(){s=setTimeout(()=>{e.send("PING"),a=setTimeout(()=>{e.close()},n)},t)}function c(){clearTimeout(s),u()}function d(){clearTimeout(a),c()}e.addEventListener("open",u),e.addEventListener("message",({data:h})=>{clearTimeout(s),u(),h==="PONG"&&d()}),e.addEventListener("close",()=>{clearTimeout(s),clearTimeout(a)})}class Rc{get ws(){return this.wsObservable.get()}set ws(t){this.wsObservable.next(t)}isOpen(){return!!this.ws&&this.ws.readyState===this.WebSocketPonyfill.OPEN&&!this.openPromise}isClosed(){return!!this.ws&&(this.ws.readyState===this.WebSocketPonyfill.CLOSING||this.ws.readyState===this.WebSocketPonyfill.CLOSED)}async open(){if(this.openPromise)return this.openPromise;this.id=++Rc.connectCount;const t=AL(this.urlOptions).then(n=>new this.WebSocketPonyfill(n));this.openPromise=t.then(async n=>{this.ws=n,n.addEventListener("message",function({data:s}){s==="PING"&&this.send("PONG")}),this.keepAliveOpts.enabled&&RL(n,this.keepAliveOpts),n.addEventListener("close",()=>{this.ws===n&&(this.ws=null)}),await EL(n),this.urlOptions.connectionParams&&n.send(await TL(this.urlOptions.connectionParams))});try{await this.openPromise}finally{this.openPromise=null}}async close(){var t;try{await this.openPromise}finally{(t=this.ws)==null||t.close()}}constructor(t){if(Gs(this,"id",++Rc.connectCount),Gs(this,"WebSocketPonyfill",void 0),Gs(this,"urlOptions",void 0),Gs(this,"keepAliveOpts",void 0),Gs(this,"wsObservable",YB(null)),Gs(this,"openPromise",null),this.WebSocketPonyfill=t.WebSocketPonyfill??WebSocket,!this.WebSocketPonyfill)throw new Error("No WebSocket implementation found - you probably don't want to use this on the server, but if you do you need to pass a `WebSocket`-ponyfill");this.urlOptions=t.urlOptions,this.keepAliveOpts=t.keepAlive}}Gs(Rc,"connectCount",0);var OL={};function $T(e,t){if(e instanceof Promise)throw new Error(t)}function ML(e,t){const n={},s=[];for(const a in e){const u=e[a]["~standard"].validate(t[a]);if($T(u,`Validation must be synchronous, but ${a} returned a Promise.`),u.issues){s.push(...u.issues.map(c=>({...c,path:[a,...c.path??[]]})));continue}n[a]=u.value}return s.length?{issues:s}:{value:n}}function CL(e){var $;const t=e.runtimeEnvStrict??e.runtimeEnv??OL;if(e.emptyStringAsUndefined??!1)for(const[k,Y]of Object.entries(t))Y===""&&delete t[k];if(!!e.skipValidation)return t;const a=typeof e.client=="object"?e.client:{},u=typeof e.server=="object"?e.server:{},c=typeof e.shared=="object"?e.shared:{},d=e.isServer??(typeof window>"u"||"Deno"in window),h=d?{...u,...c,...a}:{...a,...c},p=(($=e.createFinalSchema)==null?void 0:$.call(e,h,d)["~standard"].validate(t))??ML(h,t);$T(p,"Validation must be synchronous");const y=e.onValidationError??(k=>{throw console.error("โ Invalid environment variables:",k),new Error("Invalid environment variables")}),g=e.onInvalidAccess??(()=>{throw new Error("โ Attempted to access a server-side environment variable on the client")});if(p.issues)return y(p.issues);const v=k=>e.clientPrefix?!k.startsWith(e.clientPrefix)&&!(k in c):!0,S=k=>d||!v(k),T=k=>k==="__esModule"||k==="$$typeof",R=(e.extends??[]).reduce((k,Y)=>Object.assign(k,Y),{}),M=Object.assign(R,p.value);return new Proxy(M,{get(k,Y){if(typeof Y=="string"&&!T(Y))return S(Y)?Reflect.get(k,Y):g(Y)}})}const kL={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_BACKEND_ORIGIN:"https://realtime.tempest.games"},DL="__vite_start_time"in globalThis,NL=typeof window<"u",Ai=yt("string"),t1=yt('"true" | "false" | undefined'),BT=CL({isServer:!DL&&!NL,server:{CI:yt("string | undefined").pipe(Boolean),POSTGRES_USER:Ai,POSTGRES_PASSWORD:Ai,POSTGRES_DATABASE:Ai,POSTGRES_HOST:Ai,POSTGRES_PORT:Ai.pipe(e=>Number.parseInt(e,10)),BACKEND_PORT:Ai.pipe(e=>Number.parseInt(e,10)),RUN_WORKERS_FROM_SOURCE:t1.pipe(e=>e==="true"),FRONTEND_PORT:Ai.pipe(e=>Number.parseInt(e,10)),FRONTEND_ORIGINS:Ai.pipe.try(e=>JSON.parse(e),yt("string[]")),API_KEY_OPENAI:yt("string | undefined"),API_KEY_RESEND:yt("string | undefined")},clientPrefix:"VITE_",client:{VITE_BACKEND_ORIGIN:Ai,VITE_DEV_FRONTEND_HOST:yt("string | undefined"),VITE_DEV_HTTPS:t1.pipe(e=>e==="true")},runtimeEnv:kL,emptyStringAsUndefined:!0}),ms=lL({links:[xL({url:BT.VITE_BACKEND_ORIGIN})]}),_L=It({key:"appVersionQuery",default:ms.version.query});It({key:"lastKnownVersion",default:null,effects:[uw(localStorage,JSON,"lastKnownVersion")]});function Kh(e){return["optional",e]}function $L(e,t){let n=[e];for(const s of t){if(typeof s!="string")return!1;n=n.flatMap(a=>{if(a===null)return[];const u=[],c=a[1],d=c[s];d!==void 0&&u.push(d);const h=Object.keys(c).find(p=>p.startsWith("$"));if(h){const p=c[h];p&&u.push(p)}return u})}for(const s of n)if(s===null||s[0]==="optional")return!0;return!1}const BL="modulepreload",LL=function(e){return"/"+e},n1={},VL=function(t,n,s){let a=Promise.resolve();if(n&&n.length>0){let c=function(p){return Promise.all(p.map(y=>Promise.resolve(y).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const d=document.querySelector("meta[property=csp-nonce]"),h=(d==null?void 0:d.nonce)||(d==null?void 0:d.getAttribute("nonce"));a=c(n.map(p=>{if(p=LL(p),p in n1)return;n1[p]=!0;const y=p.endsWith(".css"),g=y?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${p}"]${g}`))return;const v=document.createElement("link");if(v.rel=y?"stylesheet":BL,y||(v.as="script"),v.crossOrigin="",v.href=p,h&&v.setAttribute("nonce",h),document.head.appendChild(v),y)return new Promise((S,T)=>{v.addEventListener("load",S),v.addEventListener("error",()=>T(new Error(`Unable to preload CSS for ${p}`)))})}))}function u(c){const d=new Event("vite:preloadError",{cancelable:!0});if(d.payload=c,window.dispatchEvent(d),!d.defaultPrevented)throw c}return a.then(c=>{for(const d of c||[])d.status==="rejected"&&u(d.reason);return t().catch(u)})},si=Object.create(null);si.open="0";si.close="1";si.ping="2";si.pong="3";si.message="4";si.upgrade="5";si.noop="6";const Ju=Object.create(null);Object.keys(si).forEach(e=>{Ju[si[e]]=e});const Bp={type:"error",data:"parser error"},LT=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",VT=typeof ArrayBuffer=="function",jT=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,Im=({type:e,data:t},n,s)=>LT&&t instanceof Blob?n?s(t):i1(t,s):VT&&(t instanceof ArrayBuffer||jT(t))?n?s(t):i1(new Blob([t]),s):s(si[e]+(t||"")),i1=(e,t)=>{const n=new FileReader;return n.onload=function(){const s=n.result.split(",")[1];t("b"+(s||""))},n.readAsDataURL(e)};function s1(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let Ph;function jL(e,t){if(LT&&e.data instanceof Blob)return e.data.arrayBuffer().then(s1).then(t);if(VT&&(e.data instanceof ArrayBuffer||jT(e.data)))return t(s1(e.data));Im(e,!1,n=>{Ph||(Ph=new TextEncoder),t(Ph.encode(n))})}const r1="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Bo=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let e=0;e<r1.length;e++)Bo[r1.charCodeAt(e)]=e;const zL=e=>{let t=e.length*.75,n=e.length,s,a=0,u,c,d,h;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);const p=new ArrayBuffer(t),y=new Uint8Array(p);for(s=0;s<n;s+=4)u=Bo[e.charCodeAt(s)],c=Bo[e.charCodeAt(s+1)],d=Bo[e.charCodeAt(s+2)],h=Bo[e.charCodeAt(s+3)],y[a++]=u<<2|c>>4,y[a++]=(c&15)<<4|d>>2,y[a++]=(d&3)<<6|h&63;return p},UL=typeof ArrayBuffer=="function",Hm=(e,t)=>{if(typeof e!="string")return{type:"message",data:zT(e,t)};const n=e.charAt(0);return n==="b"?{type:"message",data:qL(e.substring(1),t)}:Ju[n]?e.length>1?{type:Ju[n],data:e.substring(1)}:{type:Ju[n]}:Bp},qL=(e,t)=>{if(UL){const n=zL(e);return zT(n,t)}else return{base64:!0,data:e}},zT=(e,t)=>{switch(t){case"blob":return e instanceof Blob?e:new Blob([e]);case"arraybuffer":default:return e instanceof ArrayBuffer?e:e.buffer}},UT="",KL=(e,t)=>{const n=e.length,s=new Array(n);let a=0;e.forEach((u,c)=>{Im(u,!1,d=>{s[c]=d,++a===n&&t(s.join(UT))})})},PL=(e,t)=>{const n=e.split(UT),s=[];for(let a=0;a<n.length;a++){const u=Hm(n[a],t);if(s.push(u),u.type==="error")break}return s};function IL(){return new TransformStream({transform(e,t){jL(e,n=>{const s=n.length;let a;if(s<126)a=new Uint8Array(1),new DataView(a.buffer).setUint8(0,s);else if(s<65536){a=new Uint8Array(3);const u=new DataView(a.buffer);u.setUint8(0,126),u.setUint16(1,s)}else{a=new Uint8Array(9);const u=new DataView(a.buffer);u.setUint8(0,127),u.setBigUint64(1,BigInt(s))}e.data&&typeof e.data!="string"&&(a[0]|=128),t.enqueue(a),t.enqueue(n)})}})}let Ih;function Ku(e){return e.reduce((t,n)=>t+n.length,0)}function Pu(e,t){if(e[0].length===t)return e.shift();const n=new Uint8Array(t);let s=0;for(let a=0;a<t;a++)n[a]=e[0][s++],s===e[0].length&&(e.shift(),s=0);return e.length&&s<e[0].length&&(e[0]=e[0].slice(s)),n}function HL(e,t){Ih||(Ih=new TextDecoder);const n=[];let s=0,a=-1,u=!1;return new TransformStream({transform(c,d){for(n.push(c);;){if(s===0){if(Ku(n)<1)break;const h=Pu(n,1);u=(h[0]&128)===128,a=h[0]&127,a<126?s=3:a===126?s=1:s=2}else if(s===1){if(Ku(n)<2)break;const h=Pu(n,2);a=new DataView(h.buffer,h.byteOffset,h.length).getUint16(0),s=3}else if(s===2){if(Ku(n)<8)break;const h=Pu(n,8),p=new DataView(h.buffer,h.byteOffset,h.length),y=p.getUint32(0);if(y>Math.pow(2,21)-1){d.enqueue(Bp);break}a=y*Math.pow(2,32)+p.getUint32(4),s=3}else{if(Ku(n)<a)break;const h=Pu(n,a);d.enqueue(Hm(u?h:Ih.decode(h),t)),s=0}if(a===0||a>e){d.enqueue(Bp);break}}}})}const qT=4;function gt(e){if(e)return GL(e)}function GL(e){for(var t in gt.prototype)e[t]=gt.prototype[t];return e}gt.prototype.on=gt.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this};gt.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this};gt.prototype.off=gt.prototype.removeListener=gt.prototype.removeAllListeners=gt.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks["$"+e];if(!n)return this;if(arguments.length==1)return delete this._callbacks["$"+e],this;for(var s,a=0;a<n.length;a++)if(s=n[a],s===t||s.fn===t){n.splice(a,1);break}return n.length===0&&delete this._callbacks["$"+e],this};gt.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),n=this._callbacks["$"+e],s=1;s<arguments.length;s++)t[s-1]=arguments[s];if(n){n=n.slice(0);for(var s=0,a=n.length;s<a;++s)n[s].apply(this,t)}return this};gt.prototype.emitReserved=gt.prototype.emit;gt.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]};gt.prototype.hasListeners=function(e){return!!this.listeners(e).length};const Wc=typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,n)=>n(t,0),Nn=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),FL="arraybuffer";function KT(e,...t){return t.reduce((n,s)=>(e.hasOwnProperty(s)&&(n[s]=e[s]),n),{})}const YL=Nn.setTimeout,XL=Nn.clearTimeout;function ef(e,t){t.useNativeTimers?(e.setTimeoutFn=YL.bind(Nn),e.clearTimeoutFn=XL.bind(Nn)):(e.setTimeoutFn=Nn.setTimeout.bind(Nn),e.clearTimeoutFn=Nn.clearTimeout.bind(Nn))}const ZL=1.33;function JL(e){return typeof e=="string"?QL(e):Math.ceil((e.byteLength||e.size)*ZL)}function QL(e){let t=0,n=0;for(let s=0,a=e.length;s<a;s++)t=e.charCodeAt(s),t<128?n+=1:t<2048?n+=2:t<55296||t>=57344?n+=3:(s++,n+=4);return n}function PT(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function WL(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}function eV(e){let t={},n=e.split("&");for(let s=0,a=n.length;s<a;s++){let u=n[s].split("=");t[decodeURIComponent(u[0])]=decodeURIComponent(u[1])}return t}class tV extends Error{constructor(t,n,s){super(t),this.description=n,this.context=s,this.type="TransportError"}}class Gm extends gt{constructor(t){super(),this.writable=!1,ef(this,t),this.opts=t,this.query=t.query,this.socket=t.socket,this.supportsBinary=!t.forceBase64}onError(t,n,s){return super.emitReserved("error",new tV(t,n,s)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(t){this.readyState==="open"&&this.write(t)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(t){const n=Hm(t,this.socket.binaryType);this.onPacket(n)}onPacket(t){super.emitReserved("packet",t)}onClose(t){this.readyState="closed",super.emitReserved("close",t)}pause(t){}createUri(t,n={}){return t+"://"+this._hostname()+this._port()+this.opts.path+this._query(n)}_hostname(){const t=this.opts.hostname;return t.indexOf(":")===-1?t:"["+t+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(t){const n=WL(t);return n.length?"?"+n:""}}class nV extends Gm{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(t){this.readyState="pausing";const n=()=>{this.readyState="paused",t()};if(this._polling||!this.writable){let s=0;this._polling&&(s++,this.once("pollComplete",function(){--s||n()})),this.writable||(s++,this.once("drain",function(){--s||n()}))}else n()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){const n=s=>{if(this.readyState==="opening"&&s.type==="open"&&this.onOpen(),s.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(s)};PL(t,this.socket.binaryType).forEach(n),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const t=()=>{this.write([{type:"close"}])};this.readyState==="open"?t():this.once("open",t)}write(t){this.writable=!1,KL(t,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const t=this.opts.secure?"https":"http",n=this.query||{};return this.opts.timestampRequests!==!1&&(n[this.opts.timestampParam]=PT()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(t,n)}}let IT=!1;try{IT=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const iV=IT;function sV(){}class rV extends nV{constructor(t){if(super(t),typeof location<"u"){const n=location.protocol==="https:";let s=location.port;s||(s=n?"443":"80"),this.xd=typeof location<"u"&&t.hostname!==location.hostname||s!==t.port}}doWrite(t,n){const s=this.request({method:"POST",data:t});s.on("success",n),s.on("error",(a,u)=>{this.onError("xhr post error",a,u)})}doPoll(){const t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(n,s)=>{this.onError("xhr poll error",n,s)}),this.pollXhr=t}}let fa=class Qu extends gt{constructor(t,n,s){super(),this.createRequest=t,ef(this,s),this._opts=s,this._method=s.method||"GET",this._uri=n,this._data=s.data!==void 0?s.data:null,this._create()}_create(){var t;const n=KT(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this._opts.xd;const s=this._xhr=this.createRequest(n);try{s.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){s.setDisableHeaderCheck&&s.setDisableHeaderCheck(!0);for(let a in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(a)&&s.setRequestHeader(a,this._opts.extraHeaders[a])}}catch{}if(this._method==="POST")try{s.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{s.setRequestHeader("Accept","*/*")}catch{}(t=this._opts.cookieJar)===null||t===void 0||t.addCookies(s),"withCredentials"in s&&(s.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(s.timeout=this._opts.requestTimeout),s.onreadystatechange=()=>{var a;s.readyState===3&&((a=this._opts.cookieJar)===null||a===void 0||a.parseCookies(s.getResponseHeader("set-cookie"))),s.readyState===4&&(s.status===200||s.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof s.status=="number"?s.status:0)},0))},s.send(this._data)}catch(a){this.setTimeoutFn(()=>{this._onError(a)},0);return}typeof document<"u"&&(this._index=Qu.requestsCount++,Qu.requests[this._index]=this)}_onError(t){this.emitReserved("error",t,this._xhr),this._cleanup(!0)}_cleanup(t){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=sV,t)try{this._xhr.abort()}catch{}typeof document<"u"&&delete Qu.requests[this._index],this._xhr=null}}_onLoad(){const t=this._xhr.responseText;t!==null&&(this.emitReserved("data",t),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}};fa.requestsCount=0;fa.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",a1);else if(typeof addEventListener=="function"){const e="onpagehide"in Nn?"pagehide":"unload";addEventListener(e,a1,!1)}}function a1(){for(let e in fa.requests)fa.requests.hasOwnProperty(e)&&fa.requests[e].abort()}const aV=function(){const e=HT({xdomain:!1});return e&&e.responseType!==null}();class oV extends rV{constructor(t){super(t);const n=t&&t.forceBase64;this.supportsBinary=aV&&!n}request(t={}){return Object.assign(t,{xd:this.xd},this.opts),new fa(HT,this.uri(),t)}}function HT(e){const t=e.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!t||iV))return new XMLHttpRequest}catch{}if(!t)try{return new Nn[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const GT=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class lV extends Gm{get name(){return"websocket"}doOpen(){const t=this.uri(),n=this.opts.protocols,s=GT?{}:KT(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(s.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(t,n,s)}catch(a){return this.emitReserved("error",a)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let n=0;n<t.length;n++){const s=t[n],a=n===t.length-1;Im(s,this.supportsBinary,u=>{try{this.doWrite(s,u)}catch{}a&&Wc(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const t=this.opts.secure?"wss":"ws",n=this.query||{};return this.opts.timestampRequests&&(n[this.opts.timestampParam]=PT()),this.supportsBinary||(n.b64=1),this.createUri(t,n)}}const Hh=Nn.WebSocket||Nn.MozWebSocket;class uV extends lV{createSocket(t,n,s){return GT?new Hh(t,n,s):n?new Hh(t,n):new Hh(t)}doWrite(t,n){this.ws.send(n)}}class cV extends Gm{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(t){return this.emitReserved("error",t)}this._transport.closed.then(()=>{this.onClose()}).catch(t=>{this.onError("webtransport error",t)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(t=>{const n=HL(Number.MAX_SAFE_INTEGER,this.socket.binaryType),s=t.readable.pipeThrough(n).getReader(),a=IL();a.readable.pipeTo(t.writable),this._writer=a.writable.getWriter();const u=()=>{s.read().then(({done:d,value:h})=>{d||(this.onPacket(h),u())}).catch(d=>{})};u();const c={type:"open"};this.query.sid&&(c.data=`{"sid":"${this.query.sid}"}`),this._writer.write(c).then(()=>this.onOpen())})})}write(t){this.writable=!1;for(let n=0;n<t.length;n++){const s=t[n],a=n===t.length-1;this._writer.write(s).then(()=>{a&&Wc(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this._transport)===null||t===void 0||t.close()}}const fV={websocket:uV,webtransport:cV,polling:oV},dV=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,hV=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Lp(e){if(e.length>8e3)throw"URI too long";const t=e,n=e.indexOf("["),s=e.indexOf("]");n!=-1&&s!=-1&&(e=e.substring(0,n)+e.substring(n,s).replace(/:/g,";")+e.substring(s,e.length));let a=dV.exec(e||""),u={},c=14;for(;c--;)u[hV[c]]=a[c]||"";return n!=-1&&s!=-1&&(u.source=t,u.host=u.host.substring(1,u.host.length-1).replace(/;/g,":"),u.authority=u.authority.replace("[","").replace("]","").replace(/;/g,":"),u.ipv6uri=!0),u.pathNames=pV(u,u.path),u.queryKey=mV(u,u.query),u}function pV(e,t){const n=/\/{2,9}/g,s=t.replace(n,"/").split("/");return(t.slice(0,1)=="/"||t.length===0)&&s.splice(0,1),t.slice(-1)=="/"&&s.splice(s.length-1,1),s}function mV(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(s,a,u){a&&(n[a]=u)}),n}const Vp=typeof addEventListener=="function"&&typeof removeEventListener=="function",Wu=[];Vp&&addEventListener("offline",()=>{Wu.forEach(e=>e())},!1);class gs extends gt{constructor(t,n){if(super(),this.binaryType=FL,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,t&&typeof t=="object"&&(n=t,t=null),t){const s=Lp(t);n.hostname=s.host,n.secure=s.protocol==="https"||s.protocol==="wss",n.port=s.port,s.query&&(n.query=s.query)}else n.host&&(n.hostname=Lp(n.host).host);ef(this,n),this.secure=n.secure!=null?n.secure:typeof location<"u"&&location.protocol==="https:",n.hostname&&!n.port&&(n.port=this.secure?"443":"80"),this.hostname=n.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=n.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},n.transports.forEach(s=>{const a=s.prototype.name;this.transports.push(a),this._transportsByName[a]=s}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},n),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=eV(this.opts.query)),Vp&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},Wu.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(t){const n=Object.assign({},this.opts.query);n.EIO=qT,n.transport=t,this.id&&(n.sid=this.id);const s=Object.assign({},this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new this._transportsByName[t](s)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const t=this.opts.rememberUpgrade&&gs.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const n=this.createTransport(t);n.open(),this.setTransport(n)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",n=>this._onClose("transport close",n))}onOpen(){this.readyState="open",gs.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",t),this.emitReserved("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const n=new Error("server error");n.code=t.data,this._onError(n);break;case"message":this.emitReserved("data",t.data),this.emitReserved("message",t.data);break}}onHandshake(t){this.emitReserved("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this._pingInterval=t.pingInterval,this._pingTimeout=t.pingTimeout,this._maxPayload=t.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const t=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+t,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},t),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const t=this._getWritablePackets();this.transport.send(t),this._prevBufferLen=t.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let n=1;for(let s=0;s<this.writeBuffer.length;s++){const a=this.writeBuffer[s].data;if(a&&(n+=JL(a)),s>0&&n>this._maxPayload)return this.writeBuffer.slice(0,s);n+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const t=Date.now()>this._pingTimeoutTime;return t&&(this._pingTimeoutTime=0,Wc(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),t}write(t,n,s){return this._sendPacket("message",t,n,s),this}send(t,n,s){return this._sendPacket("message",t,n,s),this}_sendPacket(t,n,s,a){if(typeof n=="function"&&(a=n,n=void 0),typeof s=="function"&&(a=s,s=null),this.readyState==="closing"||this.readyState==="closed")return;s=s||{},s.compress=s.compress!==!1;const u={type:t,data:n,options:s};this.emitReserved("packetCreate",u),this.writeBuffer.push(u),a&&this.once("flush",a),this.flush()}close(){const t=()=>{this._onClose("forced close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),t()},s=()=>{this.once("upgrade",n),this.once("upgradeError",n)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?s():t()}):this.upgrading?s():t()),this}_onError(t){if(gs.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",t),this._onClose("transport error",t)}_onClose(t,n){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),Vp&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const s=Wu.indexOf(this._offlineEventListener);s!==-1&&Wu.splice(s,1)}this.readyState="closed",this.id=null,this.emitReserved("close",t,n),this.writeBuffer=[],this._prevBufferLen=0}}}gs.protocol=qT;class yV extends gs{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let t=0;t<this._upgrades.length;t++)this._probe(this._upgrades[t])}_probe(t){let n=this.createTransport(t),s=!1;gs.priorWebsocketSuccess=!1;const a=()=>{s||(n.send([{type:"ping",data:"probe"}]),n.once("packet",g=>{if(!s)if(g.type==="pong"&&g.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;gs.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{s||this.readyState!=="closed"&&(y(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{const v=new Error("probe error");v.transport=n.name,this.emitReserved("upgradeError",v)}}))};function u(){s||(s=!0,y(),n.close(),n=null)}const c=g=>{const v=new Error("probe error: "+g);v.transport=n.name,u(),this.emitReserved("upgradeError",v)};function d(){c("transport closed")}function h(){c("socket closed")}function p(g){n&&g.name!==n.name&&u()}const y=()=>{n.removeListener("open",a),n.removeListener("error",c),n.removeListener("close",d),this.off("close",h),this.off("upgrading",p)};n.once("open",a),n.once("error",c),n.once("close",d),this.once("close",h),this.once("upgrading",p),this._upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{s||n.open()},200):n.open()}onHandshake(t){this._upgrades=this._filterUpgrades(t.upgrades),super.onHandshake(t)}_filterUpgrades(t){const n=[];for(let s=0;s<t.length;s++)~this.transports.indexOf(t[s])&&n.push(t[s]);return n}}let gV=class extends yV{constructor(t,n={}){const s=typeof t=="object"?t:n;(!s.transports||s.transports&&typeof s.transports[0]=="string")&&(s.transports=(s.transports||["polling","websocket","webtransport"]).map(a=>fV[a]).filter(a=>!!a)),super(t,s)}};function bV(e,t="",n){let s=e;n=n||typeof location<"u"&&location,e==null&&(e=n.protocol+"//"+n.host),typeof e=="string"&&(e.charAt(0)==="/"&&(e.charAt(1)==="/"?e=n.protocol+e:e=n.host+e),/^(https?|wss?):\/\//.test(e)||(typeof n<"u"?e=n.protocol+"//"+e:e="https://"+e),s=Lp(e)),s.port||(/^(http|ws)$/.test(s.protocol)?s.port="80":/^(http|ws)s$/.test(s.protocol)&&(s.port="443")),s.path=s.path||"/";const u=s.host.indexOf(":")!==-1?"["+s.host+"]":s.host;return s.id=s.protocol+"://"+u+":"+s.port+t,s.href=s.protocol+"://"+u+(n&&n.port===s.port?"":":"+s.port),s}const vV=typeof ArrayBuffer=="function",SV=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,FT=Object.prototype.toString,xV=typeof Blob=="function"||typeof Blob<"u"&&FT.call(Blob)==="[object BlobConstructor]",wV=typeof File=="function"||typeof File<"u"&&FT.call(File)==="[object FileConstructor]";function Fm(e){return vV&&(e instanceof ArrayBuffer||SV(e))||xV&&e instanceof Blob||wV&&e instanceof File}function ec(e,t){if(!e||typeof e!="object")return!1;if(Array.isArray(e)){for(let n=0,s=e.length;n<s;n++)if(ec(e[n]))return!0;return!1}if(Fm(e))return!0;if(e.toJSON&&typeof e.toJSON=="function"&&arguments.length===1)return ec(e.toJSON(),!0);for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&ec(e[n]))return!0;return!1}function AV(e){const t=[],n=e.data,s=e;return s.data=jp(n,t),s.attachments=t.length,{packet:s,buffers:t}}function jp(e,t){if(!e)return e;if(Fm(e)){const n={_placeholder:!0,num:t.length};return t.push(e),n}else if(Array.isArray(e)){const n=new Array(e.length);for(let s=0;s<e.length;s++)n[s]=jp(e[s],t);return n}else if(typeof e=="object"&&!(e instanceof Date)){const n={};for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&(n[s]=jp(e[s],t));return n}return e}function TV(e,t){return e.data=zp(e.data,t),delete e.attachments,e}function zp(e,t){if(!e)return e;if(e&&e._placeholder===!0){if(typeof e.num=="number"&&e.num>=0&&e.num<t.length)return t[e.num];throw new Error("illegal attachments")}else if(Array.isArray(e))for(let n=0;n<e.length;n++)e[n]=zp(e[n],t);else if(typeof e=="object")for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=zp(e[n],t));return e}const EV=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],RV=5;var Oe;(function(e){e[e.CONNECT=0]="CONNECT",e[e.DISCONNECT=1]="DISCONNECT",e[e.EVENT=2]="EVENT",e[e.ACK=3]="ACK",e[e.CONNECT_ERROR=4]="CONNECT_ERROR",e[e.BINARY_EVENT=5]="BINARY_EVENT",e[e.BINARY_ACK=6]="BINARY_ACK"})(Oe||(Oe={}));class OV{constructor(t){this.replacer=t}encode(t){return(t.type===Oe.EVENT||t.type===Oe.ACK)&&ec(t)?this.encodeAsBinary({type:t.type===Oe.EVENT?Oe.BINARY_EVENT:Oe.BINARY_ACK,nsp:t.nsp,data:t.data,id:t.id}):[this.encodeAsString(t)]}encodeAsString(t){let n=""+t.type;return(t.type===Oe.BINARY_EVENT||t.type===Oe.BINARY_ACK)&&(n+=t.attachments+"-"),t.nsp&&t.nsp!=="/"&&(n+=t.nsp+","),t.id!=null&&(n+=t.id),t.data!=null&&(n+=JSON.stringify(t.data,this.replacer)),n}encodeAsBinary(t){const n=AV(t),s=this.encodeAsString(n.packet),a=n.buffers;return a.unshift(s),a}}function o1(e){return Object.prototype.toString.call(e)==="[object Object]"}class Ym extends gt{constructor(t){super(),this.reviver=t}add(t){let n;if(typeof t=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");n=this.decodeString(t);const s=n.type===Oe.BINARY_EVENT;s||n.type===Oe.BINARY_ACK?(n.type=s?Oe.EVENT:Oe.ACK,this.reconstructor=new MV(n),n.attachments===0&&super.emitReserved("decoded",n)):super.emitReserved("decoded",n)}else if(Fm(t)||t.base64)if(this.reconstructor)n=this.reconstructor.takeBinaryData(t),n&&(this.reconstructor=null,super.emitReserved("decoded",n));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+t)}decodeString(t){let n=0;const s={type:Number(t.charAt(0))};if(Oe[s.type]===void 0)throw new Error("unknown packet type "+s.type);if(s.type===Oe.BINARY_EVENT||s.type===Oe.BINARY_ACK){const u=n+1;for(;t.charAt(++n)!=="-"&&n!=t.length;);const c=t.substring(u,n);if(c!=Number(c)||t.charAt(n)!=="-")throw new Error("Illegal attachments");s.attachments=Number(c)}if(t.charAt(n+1)==="/"){const u=n+1;for(;++n&&!(t.charAt(n)===","||n===t.length););s.nsp=t.substring(u,n)}else s.nsp="/";const a=t.charAt(n+1);if(a!==""&&Number(a)==a){const u=n+1;for(;++n;){const c=t.charAt(n);if(c==null||Number(c)!=c){--n;break}if(n===t.length)break}s.id=Number(t.substring(u,n+1))}if(t.charAt(++n)){const u=this.tryParse(t.substr(n));if(Ym.isPayloadValid(s.type,u))s.data=u;else throw new Error("invalid payload")}return s}tryParse(t){try{return JSON.parse(t,this.reviver)}catch{return!1}}static isPayloadValid(t,n){switch(t){case Oe.CONNECT:return o1(n);case Oe.DISCONNECT:return n===void 0;case Oe.CONNECT_ERROR:return typeof n=="string"||o1(n);case Oe.EVENT:case Oe.BINARY_EVENT:return Array.isArray(n)&&(typeof n[0]=="number"||typeof n[0]=="string"&&EV.indexOf(n[0])===-1);case Oe.ACK:case Oe.BINARY_ACK:return Array.isArray(n)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class MV{constructor(t){this.packet=t,this.buffers=[],this.reconPack=t}takeBinaryData(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){const n=TV(this.reconPack,this.buffers);return this.finishedReconstruction(),n}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const CV=Object.freeze(Object.defineProperty({__proto__:null,Decoder:Ym,Encoder:OV,get PacketType(){return Oe},protocol:RV},Symbol.toStringTag,{value:"Module"}));function Un(e,t,n){return e.on(t,n),function(){e.off(t,n)}}const kV=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class YT extends gt{constructor(t,n,s){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=t,this.nsp=n,s&&s.auth&&(this.auth=s.auth),this._opts=Object.assign({},s),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const t=this.io;this.subs=[Un(t,"open",this.onopen.bind(this)),Un(t,"packet",this.onpacket.bind(this)),Un(t,"error",this.onerror.bind(this)),Un(t,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...t){return t.unshift("message"),this.emit.apply(this,t),this}emit(t,...n){var s,a,u;if(kV.hasOwnProperty(t))throw new Error('"'+t.toString()+'" is a reserved event name');if(n.unshift(t),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(n),this;const c={type:Oe.EVENT,data:n};if(c.options={},c.options.compress=this.flags.compress!==!1,typeof n[n.length-1]=="function"){const y=this.ids++,g=n.pop();this._registerAckCallback(y,g),c.id=y}const d=(a=(s=this.io.engine)===null||s===void 0?void 0:s.transport)===null||a===void 0?void 0:a.writable,h=this.connected&&!(!((u=this.io.engine)===null||u===void 0)&&u._hasPingExpired());return this.flags.volatile&&!d||(h?(this.notifyOutgoingListeners(c),this.packet(c)):this.sendBuffer.push(c)),this.flags={},this}_registerAckCallback(t,n){var s;const a=(s=this.flags.timeout)!==null&&s!==void 0?s:this._opts.ackTimeout;if(a===void 0){this.acks[t]=n;return}const u=this.io.setTimeoutFn(()=>{delete this.acks[t];for(let d=0;d<this.sendBuffer.length;d++)this.sendBuffer[d].id===t&&this.sendBuffer.splice(d,1);n.call(this,new Error("operation has timed out"))},a),c=(...d)=>{this.io.clearTimeoutFn(u),n.apply(this,d)};c.withError=!0,this.acks[t]=c}emitWithAck(t,...n){return new Promise((s,a)=>{const u=(c,d)=>c?a(c):s(d);u.withError=!0,n.push(u),this.emit(t,...n)})}_addToQueue(t){let n;typeof t[t.length-1]=="function"&&(n=t.pop());const s={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((a,...u)=>s!==this._queue[0]?void 0:(a!==null?s.tryCount>this._opts.retries&&(this._queue.shift(),n&&n(a)):(this._queue.shift(),n&&n(null,...u)),s.pending=!1,this._drainQueue())),this._queue.push(s),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||this._queue.length===0)return;const n=this._queue[0];n.pending&&!t||(n.pending=!0,n.tryCount++,this.flags=n.flags,this.emit.apply(this,n.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){typeof this.auth=="function"?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:Oe.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,n){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,n),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(t=>{if(!this.sendBuffer.some(s=>String(s.id)===t)){const s=this.acks[t];delete this.acks[t],s.withError&&s.call(this,new Error("socket has been disconnected"))}})}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case Oe.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case Oe.EVENT:case Oe.BINARY_EVENT:this.onevent(t);break;case Oe.ACK:case Oe.BINARY_ACK:this.onack(t);break;case Oe.DISCONNECT:this.ondisconnect();break;case Oe.CONNECT_ERROR:this.destroy();const s=new Error(t.data.message);s.data=t.data.data,this.emitReserved("connect_error",s);break}}onevent(t){const n=t.data||[];t.id!=null&&n.push(this.ack(t.id)),this.connected?this.emitEvent(n):this.receiveBuffer.push(Object.freeze(n))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){const n=this._anyListeners.slice();for(const s of n)s.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&typeof t[t.length-1]=="string"&&(this._lastOffset=t[t.length-1])}ack(t){const n=this;let s=!1;return function(...a){s||(s=!0,n.packet({type:Oe.ACK,id:t,data:a}))}}onack(t){const n=this.acks[t.id];typeof n=="function"&&(delete this.acks[t.id],n.withError&&t.data.unshift(null),n.apply(this,t.data))}onconnect(t,n){this.id=t,this.recovered=n&&this._pid===n,this._pid=n,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Oe.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){const n=this._anyListeners;for(let s=0;s<n.length;s++)if(t===n[s])return n.splice(s,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(t),this}prependAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(t),this}offAnyOutgoing(t){if(!this._anyOutgoingListeners)return this;if(t){const n=this._anyOutgoingListeners;for(let s=0;s<n.length;s++)if(t===n[s])return n.splice(s,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(t){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const n=this._anyOutgoingListeners.slice();for(const s of n)s.apply(this,t.data)}}}function Oa(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}Oa.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=(Math.floor(t*10)&1)==0?e-n:e+n}return Math.min(e,this.max)|0};Oa.prototype.reset=function(){this.attempts=0};Oa.prototype.setMin=function(e){this.ms=e};Oa.prototype.setMax=function(e){this.max=e};Oa.prototype.setJitter=function(e){this.jitter=e};class Up extends gt{constructor(t,n){var s;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(n=t,t=void 0),n=n||{},n.path=n.path||"/socket.io",this.opts=n,ef(this,n),this.reconnection(n.reconnection!==!1),this.reconnectionAttempts(n.reconnectionAttempts||1/0),this.reconnectionDelay(n.reconnectionDelay||1e3),this.reconnectionDelayMax(n.reconnectionDelayMax||5e3),this.randomizationFactor((s=n.randomizationFactor)!==null&&s!==void 0?s:.5),this.backoff=new Oa({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=t;const a=n.parser||CV;this.encoder=new a.Encoder,this.decoder=new a.Decoder,this._autoConnect=n.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,t||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(t){return t===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var n;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(n=this.backoff)===null||n===void 0||n.setMin(t),this)}randomizationFactor(t){var n;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(n=this.backoff)===null||n===void 0||n.setJitter(t),this)}reconnectionDelayMax(t){var n;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(n=this.backoff)===null||n===void 0||n.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new gV(this.uri,this.opts);const n=this.engine,s=this;this._readyState="opening",this.skipReconnect=!1;const a=Un(n,"open",function(){s.onopen(),t&&t()}),u=d=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",d),t?t(d):this.maybeReconnectOnOpen()},c=Un(n,"error",u);if(this._timeout!==!1){const d=this._timeout,h=this.setTimeoutFn(()=>{a(),u(new Error("timeout")),n.close()},d);this.opts.autoUnref&&h.unref(),this.subs.push(()=>{this.clearTimeoutFn(h)})}return this.subs.push(a),this.subs.push(c),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(Un(t,"ping",this.onping.bind(this)),Un(t,"data",this.ondata.bind(this)),Un(t,"error",this.onerror.bind(this)),Un(t,"close",this.onclose.bind(this)),Un(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(n){this.onclose("parse error",n)}}ondecoded(t){Wc(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,n){let s=this.nsps[t];return s?this._autoConnect&&!s.active&&s.connect():(s=new YT(this,t,n),this.nsps[t]=s),s}_destroy(t){const n=Object.keys(this.nsps);for(const s of n)if(this.nsps[s].active)return;this._close()}_packet(t){const n=this.encoder.encode(t);for(let s=0;s<n.length;s++)this.engine.write(n[s],t.options)}cleanup(){this.subs.forEach(t=>t()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(t,n){var s;this.cleanup(),(s=this.engine)===null||s===void 0||s.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,n),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const n=this.backoff.duration();this._reconnecting=!0;const s=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),!t.skipReconnect&&t.open(a=>{a?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",a)):t.onreconnect()}))},n);this.opts.autoUnref&&s.unref(),this.subs.push(()=>{this.clearTimeoutFn(s)})}}onreconnect(){const t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}const Do={};function tc(e,t){typeof e=="object"&&(t=e,e=void 0),t=t||{};const n=bV(e,t.path||"/socket.io"),s=n.source,a=n.id,u=n.path,c=Do[a]&&u in Do[a].nsps,d=t.forceNew||t["force new connection"]||t.multiplex===!1||c;let h;return d?h=new Up(s,t):(Do[a]||(Do[a]=new Up(s,t)),h=Do[a]),n.query&&!t.query&&(t.query=n.queryKey),h.socket(n.path,t)}Object.assign(tc,{Manager:Up,Socket:YT,io:tc,connect:tc});const DV=["123","321","abc","admin","adobe","alexander","amanda","andrea","andrew","angel","apple","asdf","ashley","baby","banana","baseball","batman","bear","biteme","blazer","blonde","boston","buster","butterfly","cameron","charlie","cheese","chelsea","chicken","chocolate","chris","compaq","computer","cookie","corvette","cowboys","dakota","dallas","daniel","david","diamond","dolphin","donald","dragon","eagle","flower","football","frank","freedom","friend","gateway","george","ginger","god","golf","hannah","hardcore","harley","heather","hello","hottie","hunter","internet","jasmine","jennifer","jessica","jesus","johnny","jordan","joshua","justin","justme","killer","knight","lakers","letmein","liverpool","login","london","love","lucky","mackenzie","maggie","master","matrix","matthew","maverick","melissa","mercedes","michael","michelle","mickey","miller","money","monkey","morgan","mother","muffin","mustang","natasha","nathan","nicole","ninja","orange","pass","password","patrick","peanut","pepper","phoenix","photoshop","pokemon","princess","purple","qazwsx","qwerty","rainbow","ranger","root","samantha","samsung","scooter","secret","shadow","simpson","smile","soccer","sparkle","starwars","summer","sunflower","sunshine","superman","taylor","temp","test","thomas","tigers","tigger","tinkerbell","trust","turtle","victoria","welcome","whatever","william","winter","yellow","zaq12wsx","zxcvbn"],NV=3,_V=15,$V=/^[a-zA-Z0-9_-]+$/,BV=yt($V).pipe(yt(`string > ${NV} & string < ${_V}`)).brand("username"),l1=20,u1={0:"o",1:"l",3:"e",4:"a",5:"s",7:"t","@":"a",$:"s","!":"i"};function LV(e){let t="";for(const n of e)n in u1?t+=u1[n]:t+=n;return t}function VV(e){const t=e.toLocaleLowerCase(),n=LV(t);for(const s of DV)if(n.includes(s)||t.includes(s))return!0;return!1}function jV(e){const t=new Set(e).size;return e.length*Math.log2(t)}function zV(e){let t=0;return VV(e)&&(t-=100),t+=jV(e)*.5,Math.max(t,0)}const UV=yt("string").narrow((e,t)=>{const n=zV(e);return n>=l1?!0:t.mustBe(`Of complexity ${l1} or more. Was ${n.toFixed(2)}.`)}).brand("password");yt({"+":"delete",email:"string",password:"string"});const qV=yt("string").brand("email");yt({"+":"delete",username:"string",password:"string",email:"string"});const Ci=tc(BT.VITE_BACKEND_ORIGIN,{auth:e=>{const t=Ei(Bt);t&&e(t)},autoConnect:!1});Ci.on("connect",()=>{console.log("connected")}).on("connect_error",()=>{console.log("connect_error"),Qn(Bt,null)}).on("usernameChanged",e=>{Qn(Bt,t=>t===null?null:{...t,username:e})});const Bt=It({key:"auth",default:()=>{const e=localStorage.getItem("email"),t=localStorage.getItem("username"),n=localStorage.getItem("password")==="1",s=localStorage.getItem("sessionKey"),a=localStorage.getItem("verification");return e&&t&&s&&a&&(a==="verified"||a==="unverified")?{email:e,username:t,password:n,sessionKey:s,verification:a}:null},effects:[({onSet:e})=>{e(async({newValue:t})=>{console.log("setting auth",t),t?(console.log("setting auth",t),localStorage.setItem("email",t.email),localStorage.setItem("username",t.username),localStorage.setItem("password",`${+t.password}`),localStorage.setItem("sessionKey",t.sessionKey),localStorage.setItem("verification",t.verification),console.log("connecting..."),t.verification==="verified"?Ci.connect():await VL(async()=>{const{navigate:n}=await Promise.resolve().then(()=>HV);return{navigate:n}},void 0).then(({navigate:n})=>{n("/verify")})):(console.log("clearing session..."),localStorage.removeItem("sessionKey"))})},({setSelf:e})=>{const t=localStorage.getItem("email"),n=localStorage.getItem("username"),s=localStorage.getItem("password")==="1",a=localStorage.getItem("sessionKey"),u=localStorage.getItem("verification");t&&n&&a&&u&&(u==="verified"||u==="unverified")&&e({email:t,username:n,password:s,sessionKey:a,verification:u})}]}),da=It({key:"username",default:window.localStorage.getItem("username")??""}),Gh=It({key:"usernameDebounce",default:!0}),KV=It({key:"usernameDebounced100ms",default:window.localStorage.getItem("username")??"",effects:[({setSelf:e})=>{mC(da,()=>{Ei(Gh)&&(e(Ei(da)),Qn(Gh,!1),setTimeout(()=>{Qn(Gh,!0),e(Ei(da))},2e3))})}]}),PV=ws({key:"isUsernameTakenQuery",get:async({get:e})=>{const t=e(KV);if(!t)return!1;const n=Ei(Bt);return t===(n==null?void 0:n.username)?!1:ms.isUsernameTaken.query({username:t})}}),XT=ws({key:"usernameIssues",get:({get:e})=>{const t=e(da),n=BV(t);return n instanceof yt.errors?n:null}}),xa=It({key:"password0",default:""}),ZT=ws({key:"password0Issues",get:({get:e})=>{const t=e(xa),n=UV(t);return n instanceof yt.errors?n:null}}),qp=It({key:"password1",default:""}),JT=ws({key:"password1Issues",get:({get:e})=>{const t=e(xa),n=e(qp),s=yt(`"${t}"`)(n);return s instanceof yt.errors?s:null}}),Xo=It({key:"email",default:""}),QT=ws({key:"emailIssues",get:({get:e})=>{const t=e(Xo),n=qV(t);return n instanceof yt.errors?n:null}});ws({key:"signupReady",get:({get:e})=>{const t=e(XT),n=e(ZT),s=e(JT),a=e(QT);return!(t??n??s??a)}});const Zo=It({key:"oneTimeCode",default:""}),Xm=Kh({verify:Kh({$token:null}),game:Kh({clicker:null}),account:null,admin:null});function WT(e){return $L(Xm,e)}const eE=[[]];function IV(e){return eE.some(t=>t.join("/")===e.join("/"))}function bs(e){history.pushState(null,"",e),Qn(Zm,e)}const Zm=It({key:"pathName",default:window.location.pathname,effects:[({onSet:e,setSelf:t})=>{const n=a=>{history.replaceState(null,"",a),t(a)},s=a=>{switch(a){case"/":{const u=Ei(Bt);switch(console.log("/","auth",u),u==null?void 0:u.verification){case"verified":n("/game");break;case"unverified":n("/verify");break}break}case"/verify":{const u=Ei(Bt);(u==null?void 0:u.verification)==="verified"&&n("/game");break}case"/game":case"/game/clicker":{const u=Ei(Bt);(u==null?void 0:u.verification)==="unverified"&&n("/verify");break}case"/admin":break;case"/account":{const u=Ei(Bt);if(!u){n("/");break}u.verification==="unverified"&&n("/verify");break}}};s(window.location.pathname),e(({newValue:a})=>{s(a)})},({setSelf:e})=>{document.addEventListener("click",t=>{const n=t.target.closest("a");if(n&&n instanceof HTMLAnchorElement){const s=n.getAttribute("href");s!=null&&s.startsWith("/")&&(t.preventDefault(),history.pushState(null,"",s),e(s))}}),window.addEventListener("popstate",()=>{e(window.location.pathname)})}]}),tE=ws({key:"route",get:({get:e})=>{const n=e(Zm).split("/").slice(1).filter(Boolean);return WT(n)?IV(n)||e(Bt)?n:401:404}}),HV=Object.freeze(Object.defineProperty({__proto__:null,PUBLIC_ROUTES:eE,ROUTES:Xm,isRoute:WT,navigate:bs,pathnameAtom:Zm,routeSelector:tE},Symbol.toStringTag,{value:"Module"}));function GV(){const e=Ri(da),t=Ri(xa),n=Ri(qp),s=Ri(Xo),a=mt(Bt);mt(Zo);const u=mt(da),c=mt(xa),d=mt(qp),h=mt(Xo),p=mt(XT),y=mt(ZT),g=mt(JT),v=mt(QT),S=mt(PV);console.log("usernameIsTaken",S);const[T,R]=zn.useState(!1),[M,D]=zn.useState(null),[$,k]=zn.useState(null),[Y,z]=zn.useState(!1),ne=zn.useRef(null),ie=zn.useRef(null),te=zn.useRef(null);return console.log("isEditing",M),zn.useEffect(()=>{var ee,me;switch(M){case"username":{(ee=ne.current)==null||ee.focus();break}case"password":{(me=te.current)==null||me.focus();break}}}),ac(()=>{a&&s(a.email)}),a?K.jsxs("article",{"data-css":"editor",children:[K.jsxs("form",{onSubmit:ee=>{if(ee.preventDefault(),Y){z(!1);return}console.log("submitted! changing username to",u),Ci.emit("changeUsername",u),D(null)},children:[M==="username"?K.jsx("button",{type:"button",onClick:()=>{D(null)},children:"x"}):null,K.jsx("main",{children:K.jsxs("label",{htmlFor:"username",children:[u&&(p||S===!0)?K.jsxs("aside",{children:[S===!0?K.jsx("span",{children:"This username is taken."}):null,p==null?void 0:p.map(ee=>K.jsx("span",{children:ee.message},ee.path.join(".")))]}):null,K.jsx("span",{children:"Username"}),K.jsx("input",{id:"username",type:"text",ref:ne,value:u,onChange:ee=>{e(ee.target.value)},autoComplete:"username",autoCapitalize:"none",disabled:M!=="username"})]})}),M==="username"?K.jsx("button",{type:"submit",disabled:T,children:"->"}):K.jsx("button",{type:"button",onMouseDown:()=>{z(!0),D("username")},onMouseUp:()=>{z(!1)},children:"/"})]}),K.jsxs("form",{onSubmit:ee=>{ee.preventDefault()},children:[M==="email"?K.jsx("button",{type:"button",onClick:()=>{D(null)},children:"x"}):null,K.jsxs("main",{children:[$?K.jsx("aside",{children:$}):null,K.jsxs("label",{htmlFor:"email",children:[h&&v?K.jsx("aside",{children:v.map(ee=>K.jsx("span",{children:ee.message},ee.path.join(".")))}):null,K.jsx("span",{children:"Email"}),K.jsx("input",{id:"email",type:"text",ref:ie,value:h,onChange:ee=>{s(ee.target.value)},autoComplete:"email",autoCapitalize:"none",disabled:M!=="email"})]})]}),M==="email"?K.jsx("button",{type:"submit",disabled:T,children:"->"}):K.jsx("button",{type:"button",onClick:()=>{D("email")},children:"/"})]}),K.jsxs("form",{onSubmit:ee=>{ee.preventDefault()},children:[M==="password"?K.jsx("button",{type:"button",onClick:()=>{D(null)},children:"x"}):null,K.jsxs("main",{children:[$?K.jsx("aside",{children:$}):null,K.jsxs("label",{htmlFor:"password",children:[c&&y?K.jsx("aside",{children:y.map(ee=>K.jsx("span",{children:ee.message},ee.path.join(".")))}):null,K.jsx("span",{children:"Password"}),K.jsx("input",{id:"password0",ref:te,type:"password",placeholder:M==="password"?"":a.password?"โขโขโขโขโขโขโขโขโขโขโขโข":"none",value:c,onChange:ee=>{t(ee.target.value)},autoComplete:"new-password",autoCapitalize:"none",style:{"--energy-color":a.password?"green":void 0},disabled:M!=="password"})]}),M==="password"?K.jsxs("label",{htmlFor:"password",children:[d&&g?K.jsx("aside",{children:g.map(ee=>K.jsx("span",{children:ee.message},ee.path.join(".")))}):null,K.jsx("span",{children:"Confirm Password"}),K.jsx("input",{id:"password1",type:"password",placeholder:M==="password"?"":a.password?"โขโขโขโขโขโขโขโขโขโขโขโข":"none",value:d,onChange:ee=>{n(ee.target.value)},autoComplete:"new-password",autoCapitalize:"none",style:{"--energy-color":a.password?"green":void 0},disabled:M!=="password"})]}):null]}),M==="password"?K.jsx("button",{type:"submit",disabled:T,children:"->"}):a.password?K.jsx("button",{type:"button",onClick:()=>{D("password")},children:"/"}):K.jsx("button",{type:"button",onClick:()=>{D("password")},children:"+ add password"})]})]}):K.jsx("p",{children:"You must be logged in to verify your account."})}function FV(){return K.jsx("article",{children:K.jsx("h1",{children:"admin"})})}class YV extends Map{set(t,n){return this.has(t)?(console.warn("Tried to set a key that already exists in an InvariantMap",{key:t,value:n}),this):super.set(t,n)}clear(){throw new Error("Cannot clear an InvariantMap")}}const Io=class Io{constructor(t){w(this,"type","continuity");w(this,"globals",[]);w(this,"actions",[]);w(this,"perspectives",[]);w(this,"key");this.key=t}static create(t,n){const s=new Io(t),{type:a,globals:u,actions:c,perspectives:d}=n(s),h={type:a,key:t,globals:u,actions:c,perspectives:d};return Io.existing.set(t,h),h}add(...t){switch(t[0].type){case"atom":case"mutable_atom":this.globals.push(...t);break;case"transaction":this.actions.push(...t);break;case"atom_family":case"mutable_atom_family":{const[s,a]=t;this.perspectives.push({type:"realtime_perspective",resourceAtoms:s,viewAtoms:a})}break}return this}};w(Io,"existing",new YV);let Kp=Io;function XV(e){const{key:t,config:n}=e,s=Kp.create(t,n),{actions:a}=s;for(const u of a)ew(vn.STORE,t,u.key);return ym(vn.STORE,t,-1),s}const Jm=It({key:"count",default:0}),nE=yC({key:"incrementTX",do:({set:e})=>{e(Jm,t=>t+1)}}),ZV=XV({key:"countContinuity",config:e=>e.add(Jm).add(nE)});function JV({route:[,e]}){return K.jsx("article",{children:e?K.jsx(WV,{gameId:e}):K.jsx(QV,{})})}function QV(){return K.jsx("nav",{children:K.jsx(MT,{href:"/game/clicker",children:"Clicker"})})}uC(Xm[1].game[1]);function WV({gameId:e}){console.log(e);const t=mt(Jm),n=gC(nE);return ck(ZV),K.jsxs("article",{children:[K.jsxs("button",{type:"button",onClick:()=>{n()},children:["count is ",t]}),K.jsx("p",{children:"Let's see how high we can count!"})]})}const iE=j.createContext({});function e4(e){const t=j.useRef(null);return t.current===null&&(t.current=e()),t.current}const Qm=typeof window<"u",t4=Qm?j.useLayoutEffect:j.useEffect,Wm=j.createContext(null),sE=j.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});function rE(e){return typeof e=="object"&&e!==null}function aE(e){return rE(e)&&"offsetHeight"in e}function n4(e=!0){const t=j.useContext(Wm);if(t===null)return[!0,null];const{isPresent:n,onExitComplete:s,register:a}=t,u=j.useId();j.useEffect(()=>{if(e)return a(u)},[e]);const c=j.useCallback(()=>e&&s&&s(u),[u,s,e]);return!n&&s?[!1,c]:[!0]}const Iu=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"],c1={value:null};function i4(e,t){let n=new Set,s=new Set,a=!1,u=!1;const c=new WeakSet;let d={delta:0,timestamp:0,isProcessing:!1},h=0;function p(g){c.has(g)&&(y.schedule(g),e()),h++,g(d)}const y={schedule:(g,v=!1,S=!1)=>{const R=S&&a?n:s;return v&&c.add(g),R.has(g)||R.add(g),g},cancel:g=>{s.delete(g),c.delete(g)},process:g=>{if(d=g,a){u=!0;return}a=!0,[n,s]=[s,n],n.forEach(p),t&&c1.value&&c1.value.frameloop[t].push(h),h=0,n.clear(),a=!1,u&&(u=!1,y.process(g))}};return y}const Li={},s4=40;function oE(e,t){let n=!1,s=!0;const a={delta:0,timestamp:0,isProcessing:!1},u=()=>n=!0,c=Iu.reduce((k,Y)=>(k[Y]=i4(u,t?Y:void 0),k),{}),{setup:d,read:h,resolveKeyframes:p,preUpdate:y,update:g,preRender:v,render:S,postRender:T}=c,R=()=>{const k=Li.useManualTiming?a.timestamp:performance.now();n=!1,Li.useManualTiming||(a.delta=s?1e3/60:Math.max(Math.min(k-a.timestamp,s4),1)),a.timestamp=k,a.isProcessing=!0,d.process(a),h.process(a),p.process(a),y.process(a),g.process(a),v.process(a),S.process(a),T.process(a),a.isProcessing=!1,n&&t&&(s=!1,e(R))},M=()=>{n=!0,s=!0,a.isProcessing||e(R)};return{schedule:Iu.reduce((k,Y)=>{const z=c[Y];return k[Y]=(ne,ie=!1,te=!1)=>(n||M(),z.schedule(ne,ie,te)),k},{}),cancel:k=>{for(let Y=0;Y<Iu.length;Y++)c[Iu[Y]].cancel(k)},state:a,steps:c}}const _n=e=>e,{schedule:it,cancel:Ss,state:$t,steps:Fh}=oE(typeof requestAnimationFrame<"u"?requestAnimationFrame:_n,!0),lE=j.createContext({strict:!1}),f1={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},wa={};for(const e in f1)wa[e]={isEnabled:t=>f1[e].some(n=>!!t[n])};function r4(e){for(const t in e)wa[t]={...wa[t],...e[t]}}const a4=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function Oc(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||a4.has(e)}let uE=e=>!Oc(e);function o4(e){e&&(uE=t=>t.startsWith("on")?!Oc(t):e(t))}try{o4(require("@emotion/is-prop-valid").default)}catch{}function l4(e,t,n){const s={};for(const a in e)a==="values"&&typeof e.values=="object"||(uE(a)||n===!0&&Oc(a)||!t&&!Oc(a)||e.draggable&&a.startsWith("onDrag"))&&(s[a]=e[a]);return s}function u4(e){if(typeof Proxy>"u")return e;const t=new Map,n=(...s)=>e(...s);return new Proxy(n,{get:(s,a)=>a==="create"?e:(t.has(a)||t.set(a,e(a)),t.get(a))})}const tf=j.createContext({});function nf(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}function Jo(e){return typeof e=="string"||Array.isArray(e)}const ey=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],ty=["initial",...ey];function sf(e){return nf(e.animate)||ty.some(t=>Jo(e[t]))}function cE(e){return!!(sf(e)||e.variants)}function c4(e,t){if(sf(e)){const{initial:n,animate:s}=e;return{initial:n===!1||Jo(n)?n:void 0,animate:Jo(s)?s:void 0}}return e.inherit!==!1?t:{}}function f4(e){const{initial:t,animate:n}=c4(e,j.useContext(tf));return j.useMemo(()=>({initial:t,animate:n}),[d1(t),d1(n)])}function d1(e){return Array.isArray(e)?e.join(" "):e}const d4=Symbol.for("motionComponentSymbol");function na(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function h4(e,t,n){return j.useCallback(s=>{s&&e.onMount&&e.onMount(s),t&&(s?t.mount(s):t.unmount()),n&&(typeof n=="function"?n(s):na(n)&&(n.current=s))},[t])}const ny=e=>e.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),p4="framerAppearId",fE="data-"+ny(p4),dE=j.createContext({}),{schedule:iy}=oE(queueMicrotask,!1);function m4(e,t,n,s,a){var R,M;const{visualElement:u}=j.useContext(tf),c=j.useContext(lE),d=j.useContext(Wm),h=j.useContext(sE).reducedMotion,p=j.useRef(null);s=s||c.renderer,!p.current&&s&&(p.current=s(e,{visualState:t,parent:u,props:n,presenceContext:d,blockInitialAnimation:d?d.initial===!1:!1,reducedMotionConfig:h}));const y=p.current,g=j.useContext(dE);y&&!y.projection&&a&&(y.type==="html"||y.type==="svg")&&y4(p.current,n,a,g);const v=j.useRef(!1);j.useInsertionEffect(()=>{y&&v.current&&y.update(n,d)});const S=n[fE],T=j.useRef(!!S&&!((R=window.MotionHandoffIsComplete)!=null&&R.call(window,S))&&((M=window.MotionHasOptimisedAnimation)==null?void 0:M.call(window,S)));return t4(()=>{y&&(v.current=!0,window.MotionIsMounted=!0,y.updateFeatures(),iy.render(y.render),T.current&&y.animationState&&y.animationState.animateChanges())}),j.useEffect(()=>{y&&(!T.current&&y.animationState&&y.animationState.animateChanges(),T.current&&(queueMicrotask(()=>{var D;(D=window.MotionHandoffMarkAsComplete)==null||D.call(window,S)}),T.current=!1))}),y}function y4(e,t,n,s){const{layoutId:a,layout:u,drag:c,dragConstraints:d,layoutScroll:h,layoutRoot:p,layoutCrossfade:y}=t;e.projection=new n(e.latestValues,t["data-framer-portal-id"]?void 0:hE(e.parent)),e.projection.setOptions({layoutId:a,layout:u,alwaysMeasureLayout:!!c||d&&na(d),visualElement:e,animationType:typeof u=="string"?u:"both",initialPromotionConfig:s,crossfade:y,layoutScroll:h,layoutRoot:p})}function hE(e){if(e)return e.options.allowProjection!==!1?e.projection:hE(e.parent)}let sy=()=>{};function g4({preloadedFeatures:e,createVisualElement:t,useRender:n,useVisualState:s,Component:a}){e&&r4(e);function u(d,h){let p;const y={...j.useContext(sE),...d,layoutId:b4(d)},{isStatic:g}=y,v=f4(d),S=s(d,g);if(!g&&Qm){v4();const T=S4(y);p=T.MeasureLayout,v.visualElement=m4(a,S,y,t,T.ProjectionNode)}return K.jsxs(tf.Provider,{value:v,children:[p&&v.visualElement?K.jsx(p,{visualElement:v.visualElement,...y}):null,n(a,d,h4(S,v.visualElement,h),S,g,v.visualElement)]})}u.displayName=`motion.${typeof a=="string"?a:`create(${a.displayName??a.name??""})`}`;const c=j.forwardRef(u);return c[d4]=a,c}function b4({layoutId:e}){const t=j.useContext(iE).id;return t&&e!==void 0?t+"-"+e:e}function v4(e,t){j.useContext(lE).strict}function S4(e){const{drag:t,layout:n}=wa;if(!t&&!n)return{};const s={...t,...n};return{MeasureLayout:t!=null&&t.isEnabled(e)||n!=null&&n.isEnabled(e)?s.MeasureLayout:void 0,ProjectionNode:s.ProjectionNode}}const pE=e=>t=>typeof t=="string"&&t.startsWith(e),ry=pE("--"),x4=pE("var(--"),ay=e=>x4(e)?w4.test(e.split("/*")[0].trim()):!1,w4=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,Qo={};function A4(e){for(const t in e)Qo[t]=e[t],ry(t)&&(Qo[t].isCSSVariable=!0)}const Ma=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Ca=new Set(Ma);function mE(e,{layout:t,layoutId:n}){return Ca.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!Qo[e]||e==="opacity")}const yE=(e,t)=>t&&typeof e=="number"?t.transform(e):e,Vi=(e,t,n)=>n>t?t:n<e?e:n,ka={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},Wo={...ka,transform:e=>Vi(0,1,e)},Hu={...ka,default:1},h1={...ka,transform:Math.round},yl=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),ds=yl("deg"),ti=yl("%"),he=yl("px"),T4=yl("vh"),E4=yl("vw"),p1={...ti,parse:e=>ti.parse(e)/100,transform:e=>ti.transform(e*100)},R4={rotate:ds,rotateX:ds,rotateY:ds,rotateZ:ds,scale:Hu,scaleX:Hu,scaleY:Hu,scaleZ:Hu,skew:ds,skewX:ds,skewY:ds,distance:he,translateX:he,translateY:he,translateZ:he,x:he,y:he,z:he,perspective:he,transformPerspective:he,opacity:Wo,originX:p1,originY:p1,originZ:he},oy={borderWidth:he,borderTopWidth:he,borderRightWidth:he,borderBottomWidth:he,borderLeftWidth:he,borderRadius:he,radius:he,borderTopLeftRadius:he,borderTopRightRadius:he,borderBottomRightRadius:he,borderBottomLeftRadius:he,width:he,maxWidth:he,height:he,maxHeight:he,top:he,right:he,bottom:he,left:he,padding:he,paddingTop:he,paddingRight:he,paddingBottom:he,paddingLeft:he,margin:he,marginTop:he,marginRight:he,marginBottom:he,marginLeft:he,backgroundPositionX:he,backgroundPositionY:he,...R4,zIndex:h1,fillOpacity:Wo,strokeOpacity:Wo,numOctaves:h1},O4={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},M4=Ma.length;function C4(e,t,n){let s="",a=!0;for(let u=0;u<M4;u++){const c=Ma[u],d=e[c];if(d===void 0)continue;let h=!0;if(typeof d=="number"?h=d===(c.startsWith("scale")?1:0):h=parseFloat(d)===0,!h||n){const p=yE(d,oy[c]);if(!h){a=!1;const y=O4[c]||c;s+=`${y}(${p}) `}n&&(t[c]=p)}}return s=s.trim(),n?s=n(t,a?"":s):a&&(s="none"),s}function ly(e,t,n){const{style:s,vars:a,transformOrigin:u}=e;let c=!1,d=!1;for(const h in t){const p=t[h];if(Ca.has(h)){c=!0;continue}else if(ry(h)){a[h]=p;continue}else{const y=yE(p,oy[h]);h.startsWith("origin")?(d=!0,u[h]=y):s[h]=y}}if(t.transform||(c||n?s.transform=C4(t,e.transform,n):s.transform&&(s.transform="none")),d){const{originX:h="50%",originY:p="50%",originZ:y=0}=u;s.transformOrigin=`${h} ${p} ${y}`}}const uy=()=>({style:{},transform:{},transformOrigin:{},vars:{}}),qt=e=>!!(e&&e.getVelocity);function gE(e,t,n){for(const s in t)!qt(t[s])&&!mE(s,n)&&(e[s]=t[s])}function k4({transformTemplate:e},t){return j.useMemo(()=>{const n=uy();return ly(n,t,e),Object.assign({},n.vars,n.style)},[t])}function D4(e,t){const n=e.style||{},s={};return gE(s,n,e),Object.assign(s,k4(e,t)),s}function N4(e,t){const n={},s=D4(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,s.userSelect=s.WebkitUserSelect=s.WebkitTouchCallout="none",s.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=s,n}const _4={offset:"stroke-dashoffset",array:"stroke-dasharray"},$4={offset:"strokeDashoffset",array:"strokeDasharray"};function B4(e,t,n=1,s=0,a=!0){e.pathLength=1;const u=a?_4:$4;e[u.offset]=he.transform(-s);const c=he.transform(t),d=he.transform(n);e[u.array]=`${c} ${d}`}function bE(e,{attrX:t,attrY:n,attrScale:s,pathLength:a,pathSpacing:u=1,pathOffset:c=0,...d},h,p,y){if(ly(e,d,p),h){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:g,style:v}=e;g.transform&&(v.transform=g.transform,delete g.transform),(v.transform||g.transformOrigin)&&(v.transformOrigin=g.transformOrigin??"50% 50%",delete g.transformOrigin),v.transform&&(v.transformBox=(y==null?void 0:y.transformBox)??"fill-box",delete g.transformBox),t!==void 0&&(g.x=t),n!==void 0&&(g.y=n),s!==void 0&&(g.scale=s),a!==void 0&&B4(g,a,u,c,!1)}const vE=()=>({...uy(),attrs:{}}),SE=e=>typeof e=="string"&&e.toLowerCase()==="svg";function L4(e,t,n,s){const a=j.useMemo(()=>{const u=vE();return bE(u,t,SE(s),e.transformTemplate,e.style),{...u.attrs,style:{...u.style}}},[t]);if(e.style){const u={};gE(u,e.style,e),a.style={...u,...a.style}}return a}const V4=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function cy(e){return typeof e!="string"||e.includes("-")?!1:!!(V4.indexOf(e)>-1||/[A-Z]/u.test(e))}function j4(e=!1){return(n,s,a,{latestValues:u},c)=>{const h=(cy(n)?L4:N4)(s,u,c,n),p=l4(s,typeof n=="string",e),y=n!==j.Fragment?{...p,...h,ref:a}:{},{children:g}=s,v=j.useMemo(()=>qt(g)?g.get():g,[g]);return j.createElement(n,{...y,children:v})}}function m1(e){const t=[{},{}];return e==null||e.values.forEach((n,s)=>{t[0][s]=n.get(),t[1][s]=n.getVelocity()}),t}function fy(e,t,n,s){if(typeof t=="function"){const[a,u]=m1(s);t=t(n!==void 0?n:e.custom,a,u)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[a,u]=m1(s);t=t(n!==void 0?n:e.custom,a,u)}return t}function nc(e){return qt(e)?e.get():e}function z4({scrapeMotionValuesFromProps:e,createRenderState:t},n,s,a){return{latestValues:U4(n,s,a,e),renderState:t()}}const xE=e=>(t,n)=>{const s=j.useContext(tf),a=j.useContext(Wm),u=()=>z4(e,t,s,a);return n?u():e4(u)};function U4(e,t,n,s){const a={},u=s(e,{});for(const v in u)a[v]=nc(u[v]);let{initial:c,animate:d}=e;const h=sf(e),p=cE(e);t&&p&&!h&&e.inherit!==!1&&(c===void 0&&(c=t.initial),d===void 0&&(d=t.animate));let y=n?n.initial===!1:!1;y=y||c===!1;const g=y?d:c;if(g&&typeof g!="boolean"&&!nf(g)){const v=Array.isArray(g)?g:[g];for(let S=0;S<v.length;S++){const T=fy(e,v[S]);if(T){const{transitionEnd:R,transition:M,...D}=T;for(const $ in D){let k=D[$];if(Array.isArray(k)){const Y=y?k.length-1:0;k=k[Y]}k!==null&&(a[$]=k)}for(const $ in R)a[$]=R[$]}}}return a}function dy(e,t,n){var u;const{style:s}=e,a={};for(const c in s)(qt(s[c])||t.style&&qt(t.style[c])||mE(c,e)||((u=n==null?void 0:n.getValue(c))==null?void 0:u.liveStyle)!==void 0)&&(a[c]=s[c]);return a}const q4={useVisualState:xE({scrapeMotionValuesFromProps:dy,createRenderState:uy})};function wE(e,t,n){const s=dy(e,t,n);for(const a in e)if(qt(e[a])||qt(t[a])){const u=Ma.indexOf(a)!==-1?"attr"+a.charAt(0).toUpperCase()+a.substring(1):a;s[u]=e[a]}return s}const K4={useVisualState:xE({scrapeMotionValuesFromProps:wE,createRenderState:vE})};function P4(e,t){return function(s,{forwardMotionProps:a}={forwardMotionProps:!1}){const c={...cy(s)?K4:q4,preloadedFeatures:e,useRender:j4(a),createVisualElement:t,Component:s};return g4(c)}}function el(e,t,n){const s=e.getProps();return fy(s,t,n!==void 0?n:s.custom,e)}const Pp=e=>Array.isArray(e);let ic;function I4(){ic=void 0}const sn={now:()=>(ic===void 0&&sn.set($t.isProcessing||Li.useManualTiming?$t.timestamp:performance.now()),ic),set:e=>{ic=e,queueMicrotask(I4)}};function hy(e,t){e.indexOf(t)===-1&&e.push(t)}function py(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}class my{constructor(){this.subscriptions=[]}add(t){return hy(this.subscriptions,t),()=>py(this.subscriptions,t)}notify(t,n,s){const a=this.subscriptions.length;if(a)if(a===1)this.subscriptions[0](t,n,s);else for(let u=0;u<a;u++){const c=this.subscriptions[u];c&&c(t,n,s)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}function AE(e,t){return t?e*(1e3/t):0}const y1=30,H4=e=>!isNaN(parseFloat(e));class G4{constructor(t,n={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=(s,a=!0)=>{var c,d;const u=sn.now();if(this.updatedAt!==u&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(s),this.current!==this.prev&&((c=this.events.change)==null||c.notify(this.current),this.dependents))for(const h of this.dependents)h.dirty();a&&((d=this.events.renderRequest)==null||d.notify(this.current))},this.hasAnimated=!1,this.setCurrent(t),this.owner=n.owner}setCurrent(t){this.current=t,this.updatedAt=sn.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=H4(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,n){this.events[t]||(this.events[t]=new my);const s=this.events[t].add(n);return t==="change"?()=>{s(),it.read(()=>{this.events.change.getSize()||this.stop()})}:s}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,n){this.passiveEffect=t,this.stopPassiveEffect=n}set(t,n=!0){!n||!this.passiveEffect?this.updateAndNotify(t,n):this.passiveEffect(t,this.updateAndNotify)}setWithVelocity(t,n,s){this.set(n),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-s}jump(t,n=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){var t;(t=this.events.change)==null||t.notify(this.current)}addDependent(t){this.dependents||(this.dependents=new Set),this.dependents.add(t)}removeDependent(t){this.dependents&&this.dependents.delete(t)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=sn.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>y1)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,y1);return AE(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(t){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=t(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){var t,n;(t=this.dependents)==null||t.clear(),(n=this.events.destroy)==null||n.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Aa(e,t){return new G4(e,t)}function F4(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,Aa(n))}function Y4(e){return Pp(e)?e[e.length-1]||0:e}function X4(e,t){const n=el(e,t);let{transitionEnd:s={},transition:a={},...u}=n||{};u={...u,...s};for(const c in u){const d=Y4(u[c]);F4(e,c,d)}}function Z4(e){return!!(qt(e)&&e.add)}function Ip(e,t){const n=e.getValue("willChange");if(Z4(n))return n.add(t);if(!n&&Li.WillChange){const s=new Li.WillChange("auto");e.addValue("willChange",s),s.add(t)}}function TE(e){return e.props[fE]}const J4=e=>e!==null;function Q4(e,{repeat:t,repeatType:n="loop"},s){const a=e.filter(J4),u=t&&n!=="loop"&&t%2===1?0:a.length-1;return a[u]}const W4={type:"spring",stiffness:500,damping:25,restSpeed:10},ej=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),tj={type:"keyframes",duration:.8},nj={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},ij=(e,{keyframes:t})=>t.length>2?tj:Ca.has(e)?e.startsWith("scale")?ej(t[1]):W4:nj;function sj({when:e,delay:t,delayChildren:n,staggerChildren:s,staggerDirection:a,repeat:u,repeatType:c,repeatDelay:d,from:h,elapsed:p,...y}){return!!Object.keys(y).length}function yy(e,t){return(e==null?void 0:e[t])??(e==null?void 0:e.default)??e}const ni=e=>e*1e3,ii=e=>e/1e3,zo=e=>Math.round(e*1e5)/1e5,gy=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function rj(e){return e==null}const aj=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,by=(e,t)=>n=>!!(typeof n=="string"&&aj.test(n)&&n.startsWith(e)||t&&!rj(n)&&Object.prototype.hasOwnProperty.call(n,t)),EE=(e,t,n)=>s=>{if(typeof s!="string")return s;const[a,u,c,d]=s.match(gy);return{[e]:parseFloat(a),[t]:parseFloat(u),[n]:parseFloat(c),alpha:d!==void 0?parseFloat(d):1}},oj=e=>Vi(0,255,e),Yh={...ka,transform:e=>Math.round(oj(e))},Js={test:by("rgb","red"),parse:EE("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:s=1})=>"rgba("+Yh.transform(e)+", "+Yh.transform(t)+", "+Yh.transform(n)+", "+zo(Wo.transform(s))+")"};function lj(e){let t="",n="",s="",a="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),s=e.substring(5,7),a=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),s=e.substring(3,4),a=e.substring(4,5),t+=t,n+=n,s+=s,a+=a),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(s,16),alpha:a?parseInt(a,16)/255:1}}const Hp={test:by("#"),parse:lj,transform:Js.transform},ia={test:by("hsl","hue"),parse:EE("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:s=1})=>"hsla("+Math.round(e)+", "+ti.transform(zo(t))+", "+ti.transform(zo(n))+", "+zo(Wo.transform(s))+")"},Ut={test:e=>Js.test(e)||Hp.test(e)||ia.test(e),parse:e=>Js.test(e)?Js.parse(e):ia.test(e)?ia.parse(e):Hp.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?Js.transform(e):ia.transform(e)},uj=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function cj(e){var t,n;return isNaN(e)&&typeof e=="string"&&(((t=e.match(gy))==null?void 0:t.length)||0)+(((n=e.match(uj))==null?void 0:n.length)||0)>0}const RE="number",OE="color",fj="var",dj="var(",g1="${}",hj=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function tl(e){const t=e.toString(),n=[],s={color:[],number:[],var:[]},a=[];let u=0;const d=t.replace(hj,h=>(Ut.test(h)?(s.color.push(u),a.push(OE),n.push(Ut.parse(h))):h.startsWith(dj)?(s.var.push(u),a.push(fj),n.push(h)):(s.number.push(u),a.push(RE),n.push(parseFloat(h))),++u,g1)).split(g1);return{values:n,split:d,indexes:s,types:a}}function ME(e){return tl(e).values}function CE(e){const{split:t,types:n}=tl(e),s=t.length;return a=>{let u="";for(let c=0;c<s;c++)if(u+=t[c],a[c]!==void 0){const d=n[c];d===RE?u+=zo(a[c]):d===OE?u+=Ut.transform(a[c]):u+=a[c]}return u}}const pj=e=>typeof e=="number"?0:e;function mj(e){const t=ME(e);return CE(e)(t.map(pj))}const xs={test:cj,parse:ME,createTransformer:CE,getAnimatableNone:mj};function Xh(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function yj({hue:e,saturation:t,lightness:n,alpha:s}){e/=360,t/=100,n/=100;let a=0,u=0,c=0;if(!t)a=u=c=n;else{const d=n<.5?n*(1+t):n+t-n*t,h=2*n-d;a=Xh(h,d,e+1/3),u=Xh(h,d,e),c=Xh(h,d,e-1/3)}return{red:Math.round(a*255),green:Math.round(u*255),blue:Math.round(c*255),alpha:s}}function Mc(e,t){return n=>n>0?t:e}const nt=(e,t,n)=>e+(t-e)*n,Zh=(e,t,n)=>{const s=e*e,a=n*(t*t-s)+s;return a<0?0:Math.sqrt(a)},gj=[Hp,Js,ia],bj=e=>gj.find(t=>t.test(e));function b1(e){const t=bj(e);if(!t)return!1;let n=t.parse(e);return t===ia&&(n=yj(n)),n}const v1=(e,t)=>{const n=b1(e),s=b1(t);if(!n||!s)return Mc(e,t);const a={...n};return u=>(a.red=Zh(n.red,s.red,u),a.green=Zh(n.green,s.green,u),a.blue=Zh(n.blue,s.blue,u),a.alpha=nt(n.alpha,s.alpha,u),Js.transform(a))},Gp=new Set(["none","hidden"]);function vj(e,t){return Gp.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}const Sj=(e,t)=>n=>t(e(n)),gl=(...e)=>e.reduce(Sj);function xj(e,t){return n=>nt(e,t,n)}function vy(e){return typeof e=="number"?xj:typeof e=="string"?ay(e)?Mc:Ut.test(e)?v1:Tj:Array.isArray(e)?kE:typeof e=="object"?Ut.test(e)?v1:wj:Mc}function kE(e,t){const n=[...e],s=n.length,a=e.map((u,c)=>vy(u)(u,t[c]));return u=>{for(let c=0;c<s;c++)n[c]=a[c](u);return n}}function wj(e,t){const n={...e,...t},s={};for(const a in n)e[a]!==void 0&&t[a]!==void 0&&(s[a]=vy(e[a])(e[a],t[a]));return a=>{for(const u in s)n[u]=s[u](a);return n}}function Aj(e,t){const n=[],s={color:0,var:0,number:0};for(let a=0;a<t.values.length;a++){const u=t.types[a],c=e.indexes[u][s[u]],d=e.values[c]??0;n[a]=d,s[u]++}return n}const Tj=(e,t)=>{const n=xs.createTransformer(t),s=tl(e),a=tl(t);return s.indexes.var.length===a.indexes.var.length&&s.indexes.color.length===a.indexes.color.length&&s.indexes.number.length>=a.indexes.number.length?Gp.has(e)&&!a.values.length||Gp.has(t)&&!s.values.length?vj(e,t):gl(kE(Aj(s,a),a.values),n):Mc(e,t)};function DE(e,t,n){return typeof e=="number"&&typeof t=="number"&&typeof n=="number"?nt(e,t,n):vy(e)(e,t)}const Ej=e=>{const t=({timestamp:n})=>e(n);return{start:(n=!0)=>it.update(t,n),stop:()=>Ss(t),now:()=>$t.isProcessing?$t.timestamp:sn.now()}},NE=(e,t,n=10)=>{let s="";const a=Math.max(Math.round(t/n),2);for(let u=0;u<a;u++)s+=e(u/(a-1))+", ";return`linear(${s.substring(0,s.length-2)})`},Cc=2e4;function Sy(e){let t=0;const n=50;let s=e.next(t);for(;!s.done&&t<Cc;)t+=n,s=e.next(t);return t>=Cc?1/0:t}function Rj(e,t=100,n){const s=n({...e,keyframes:[0,t]}),a=Math.min(Sy(s),Cc);return{type:"keyframes",ease:u=>s.next(a*u).value/t,duration:ii(a)}}const Oj=5;function _E(e,t,n){const s=Math.max(t-Oj,0);return AE(n-e(s),t-s)}const at={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},S1=.001;function Mj({duration:e=at.duration,bounce:t=at.bounce,velocity:n=at.velocity,mass:s=at.mass}){let a,u,c=1-t;c=Vi(at.minDamping,at.maxDamping,c),e=Vi(at.minDuration,at.maxDuration,ii(e)),c<1?(a=p=>{const y=p*c,g=y*e,v=y-n,S=Fp(p,c),T=Math.exp(-g);return S1-v/S*T},u=p=>{const g=p*c*e,v=g*n+n,S=Math.pow(c,2)*Math.pow(p,2)*e,T=Math.exp(-g),R=Fp(Math.pow(p,2),c);return(-a(p)+S1>0?-1:1)*((v-S)*T)/R}):(a=p=>{const y=Math.exp(-p*e),g=(p-n)*e+1;return-.001+y*g},u=p=>{const y=Math.exp(-p*e),g=(n-p)*(e*e);return y*g});const d=5/e,h=kj(a,u,d);if(e=ni(e),isNaN(h))return{stiffness:at.stiffness,damping:at.damping,duration:e};{const p=Math.pow(h,2)*s;return{stiffness:p,damping:c*2*Math.sqrt(s*p),duration:e}}}const Cj=12;function kj(e,t,n){let s=n;for(let a=1;a<Cj;a++)s=s-e(s)/t(s);return s}function Fp(e,t){return e*Math.sqrt(1-t*t)}const Dj=["duration","bounce"],Nj=["stiffness","damping","mass"];function x1(e,t){return t.some(n=>e[n]!==void 0)}function _j(e){let t={velocity:at.velocity,stiffness:at.stiffness,damping:at.damping,mass:at.mass,isResolvedFromDuration:!1,...e};if(!x1(e,Nj)&&x1(e,Dj))if(e.visualDuration){const n=e.visualDuration,s=2*Math.PI/(n*1.2),a=s*s,u=2*Vi(.05,1,1-(e.bounce||0))*Math.sqrt(a);t={...t,mass:at.mass,stiffness:a,damping:u}}else{const n=Mj(e);t={...t,...n,mass:at.mass},t.isResolvedFromDuration=!0}return t}function kc(e=at.visualDuration,t=at.bounce){const n=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:s,restDelta:a}=n;const u=n.keyframes[0],c=n.keyframes[n.keyframes.length-1],d={done:!1,value:u},{stiffness:h,damping:p,mass:y,duration:g,velocity:v,isResolvedFromDuration:S}=_j({...n,velocity:-ii(n.velocity||0)}),T=v||0,R=p/(2*Math.sqrt(h*y)),M=c-u,D=ii(Math.sqrt(h/y)),$=Math.abs(M)<5;s||(s=$?at.restSpeed.granular:at.restSpeed.default),a||(a=$?at.restDelta.granular:at.restDelta.default);let k;if(R<1){const z=Fp(D,R);k=ne=>{const ie=Math.exp(-R*D*ne);return c-ie*((T+R*D*M)/z*Math.sin(z*ne)+M*Math.cos(z*ne))}}else if(R===1)k=z=>c-Math.exp(-D*z)*(M+(T+D*M)*z);else{const z=D*Math.sqrt(R*R-1);k=ne=>{const ie=Math.exp(-R*D*ne),te=Math.min(z*ne,300);return c-ie*((T+R*D*M)*Math.sinh(te)+z*M*Math.cosh(te))/z}}const Y={calculatedDuration:S&&g||null,next:z=>{const ne=k(z);if(S)d.done=z>=g;else{let ie=z===0?T:0;R<1&&(ie=z===0?ni(T):_E(k,z,ne));const te=Math.abs(ie)<=s,ee=Math.abs(c-ne)<=a;d.done=te&&ee}return d.value=d.done?c:ne,d},toString:()=>{const z=Math.min(Sy(Y),Cc),ne=NE(ie=>Y.next(z*ie).value,z,30);return z+"ms "+ne},toTransition:()=>{}};return Y}kc.applyToOptions=e=>{const t=Rj(e,100,kc);return e.ease=t.ease,e.duration=ni(t.duration),e.type="keyframes",e};function Yp({keyframes:e,velocity:t=0,power:n=.8,timeConstant:s=325,bounceDamping:a=10,bounceStiffness:u=500,modifyTarget:c,min:d,max:h,restDelta:p=.5,restSpeed:y}){const g=e[0],v={done:!1,value:g},S=te=>d!==void 0&&te<d||h!==void 0&&te>h,T=te=>d===void 0?h:h===void 0||Math.abs(d-te)<Math.abs(h-te)?d:h;let R=n*t;const M=g+R,D=c===void 0?M:c(M);D!==M&&(R=D-g);const $=te=>-R*Math.exp(-te/s),k=te=>D+$(te),Y=te=>{const ee=$(te),me=k(te);v.done=Math.abs(ee)<=p,v.value=v.done?D:me};let z,ne;const ie=te=>{S(v.value)&&(z=te,ne=kc({keyframes:[v.value,T(v.value)],velocity:_E(k,te,v.value),damping:a,stiffness:u,restDelta:p,restSpeed:y}))};return ie(0),{calculatedDuration:null,next:te=>{let ee=!1;return!ne&&z===void 0&&(ee=!0,Y(te),ie(te)),z!==void 0&&te>=z?ne.next(te-z):(!ee&&Y(te),v)}}}const nl=(e,t,n)=>{const s=t-e;return s===0?1:(n-e)/s};function $j(e,t,n){const s=[],a=n||Li.mix||DE,u=e.length-1;for(let c=0;c<u;c++){let d=a(e[c],e[c+1]);if(t){const h=Array.isArray(t)?t[c]||_n:t;d=gl(h,d)}s.push(d)}return s}function Bj(e,t,{clamp:n=!0,ease:s,mixer:a}={}){const u=e.length;if(sy(u===t.length),u===1)return()=>t[0];if(u===2&&t[0]===t[1])return()=>t[1];const c=e[0]===e[1];e[0]>e[u-1]&&(e=[...e].reverse(),t=[...t].reverse());const d=$j(t,s,a),h=d.length,p=y=>{if(c&&y<e[0])return t[0];let g=0;if(h>1)for(;g<e.length-2&&!(y<e[g+1]);g++);const v=nl(e[g],e[g+1],y);return d[g](v)};return n?y=>p(Vi(e[0],e[u-1],y)):p}function Lj(e,t){const n=e[e.length-1];for(let s=1;s<=t;s++){const a=nl(0,t,s);e.push(nt(n,1,a))}}function Vj(e){const t=[0];return Lj(t,e.length-1),t}function jj(e,t){return e.map(n=>n*t)}const $E=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,zj=1e-7,Uj=12;function qj(e,t,n,s,a){let u,c,d=0;do c=t+(n-t)/2,u=$E(c,s,a)-e,u>0?n=c:t=c;while(Math.abs(u)>zj&&++d<Uj);return c}function bl(e,t,n,s){if(e===t&&n===s)return _n;const a=u=>qj(u,0,1,e,n);return u=>u===0||u===1?u:$E(a(u),t,s)}const Kj=bl(.42,0,1,1),Pj=bl(0,0,.58,1),BE=bl(.42,0,.58,1),Ij=e=>Array.isArray(e)&&typeof e[0]!="number",LE=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,VE=e=>t=>1-e(1-t),jE=bl(.33,1.53,.69,.99),xy=VE(jE),zE=LE(xy),UE=e=>(e*=2)<1?.5*xy(e):.5*(2-Math.pow(2,-10*(e-1))),wy=e=>1-Math.sin(Math.acos(e)),qE=VE(wy),KE=LE(wy),PE=e=>Array.isArray(e)&&typeof e[0]=="number",Hj={linear:_n,easeIn:Kj,easeInOut:BE,easeOut:Pj,circIn:wy,circInOut:KE,circOut:qE,backIn:xy,backInOut:zE,backOut:jE,anticipate:UE},Gj=e=>typeof e=="string",w1=e=>{if(PE(e)){sy(e.length===4);const[t,n,s,a]=e;return bl(t,n,s,a)}else if(Gj(e))return Hj[e];return e};function Fj(e,t){return e.map(()=>t||BE).splice(0,e.length-1)}function Uo({duration:e=300,keyframes:t,times:n,ease:s="easeInOut"}){const a=Ij(s)?s.map(w1):w1(s),u={done:!1,value:t[0]},c=jj(n&&n.length===t.length?n:Vj(t),e),d=Bj(c,t,{ease:Array.isArray(a)?a:Fj(t,a)});return{calculatedDuration:e,next:h=>(u.value=d(h),u.done=h>=e,u)}}const Yj=e=>e!==null;function Ay(e,{repeat:t,repeatType:n="loop"},s,a=1){const u=e.filter(Yj),d=a<0||t&&n!=="loop"&&t%2===1?0:u.length-1;return!d||s===void 0?u[d]:s}const Xj={decay:Yp,inertia:Yp,tween:Uo,keyframes:Uo,spring:kc};function IE(e){typeof e.type=="string"&&(e.type=Xj[e.type])}class Ty{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(t=>{this.resolve=t})}notifyFinished(){this.resolve()}then(t,n){return this.finished.then(t,n)}}const Zj=e=>e/100;class Ey extends Ty{constructor(t){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=(n=!0)=>{var s,a;if(n){const{motionValue:u}=this.options;u&&u.updatedAt!==sn.now()&&this.tick(sn.now())}this.isStopped=!0,this.state!=="idle"&&(this.teardown(),(a=(s=this.options).onStop)==null||a.call(s))},this.options=t,this.initAnimation(),this.play(),t.autoplay===!1&&this.pause()}initAnimation(){const{options:t}=this;IE(t);const{type:n=Uo,repeat:s=0,repeatDelay:a=0,repeatType:u,velocity:c=0}=t;let{keyframes:d}=t;const h=n||Uo;h!==Uo&&typeof d[0]!="number"&&(this.mixKeyframes=gl(Zj,DE(d[0],d[1])),d=[0,100]);const p=h({...t,keyframes:d});u==="mirror"&&(this.mirroredGenerator=h({...t,keyframes:[...d].reverse(),velocity:-c})),p.calculatedDuration===null&&(p.calculatedDuration=Sy(p));const{calculatedDuration:y}=p;this.calculatedDuration=y,this.resolvedDuration=y+a,this.totalDuration=this.resolvedDuration*(s+1)-a,this.generator=p}updateTime(t){const n=Math.round(t-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=n}tick(t,n=!1){const{generator:s,totalDuration:a,mixKeyframes:u,mirroredGenerator:c,resolvedDuration:d,calculatedDuration:h}=this;if(this.startTime===null)return s.next(0);const{delay:p=0,keyframes:y,repeat:g,repeatType:v,repeatDelay:S,type:T,onUpdate:R,finalKeyframe:M}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-a/this.speed,this.startTime)),n?this.currentTime=t:this.updateTime(t);const D=this.currentTime-p*(this.playbackSpeed>=0?1:-1),$=this.playbackSpeed>=0?D<0:D>a;this.currentTime=Math.max(D,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=a);let k=this.currentTime,Y=s;if(g){const te=Math.min(this.currentTime,a)/d;let ee=Math.floor(te),me=te%1;!me&&te>=1&&(me=1),me===1&&ee--,ee=Math.min(ee,g+1),!!(ee%2)&&(v==="reverse"?(me=1-me,S&&(me-=S/d)):v==="mirror"&&(Y=c)),k=Vi(0,1,me)*d}const z=$?{done:!1,value:y[0]}:Y.next(k);u&&(z.value=u(z.value));let{done:ne}=z;!$&&h!==null&&(ne=this.playbackSpeed>=0?this.currentTime>=a:this.currentTime<=0);const ie=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&ne);return ie&&T!==Yp&&(z.value=Ay(y,this.options,M,this.speed)),R&&R(z.value),ie&&this.finish(),z}then(t,n){return this.finished.then(t,n)}get duration(){return ii(this.calculatedDuration)}get time(){return ii(this.currentTime)}set time(t){var n;t=ni(t),this.currentTime=t,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.playbackSpeed),(n=this.driver)==null||n.start(!1)}get speed(){return this.playbackSpeed}set speed(t){this.updateTime(sn.now());const n=this.playbackSpeed!==t;this.playbackSpeed=t,n&&(this.time=ii(this.currentTime))}play(){var a,u;if(this.isStopped)return;const{driver:t=Ej,startTime:n}=this.options;this.driver||(this.driver=t(c=>this.tick(c))),(u=(a=this.options).onPlay)==null||u.call(a);const s=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=s):this.holdTime!==null?this.startTime=s-this.holdTime:this.startTime||(this.startTime=n??s),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(sn.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){var t,n;this.notifyFinished(),this.teardown(),this.state="finished",(n=(t=this.options).onComplete)==null||n.call(t)}cancel(){var t,n;this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),(n=(t=this.options).onCancel)==null||n.call(t)}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}attachTimeline(t){var n;return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),(n=this.driver)==null||n.stop(),t.observe(this)}}function Jj(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}const Qs=e=>e*180/Math.PI,Xp=e=>{const t=Qs(Math.atan2(e[1],e[0]));return Zp(t)},Qj={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:Xp,rotateZ:Xp,skewX:e=>Qs(Math.atan(e[1])),skewY:e=>Qs(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},Zp=e=>(e=e%360,e<0&&(e+=360),e),A1=Xp,T1=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),E1=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),Wj={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:T1,scaleY:E1,scale:e=>(T1(e)+E1(e))/2,rotateX:e=>Zp(Qs(Math.atan2(e[6],e[5]))),rotateY:e=>Zp(Qs(Math.atan2(-e[2],e[0]))),rotateZ:A1,rotate:A1,skewX:e=>Qs(Math.atan(e[4])),skewY:e=>Qs(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function Jp(e){return e.includes("scale")?1:0}function Qp(e,t){if(!e||e==="none")return Jp(t);const n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let s,a;if(n)s=Wj,a=n;else{const d=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);s=Qj,a=d}if(!a)return Jp(t);const u=s[t],c=a[1].split(",").map(tz);return typeof u=="function"?u(c):c[u]}const ez=(e,t)=>{const{transform:n="none"}=getComputedStyle(e);return Qp(n,t)};function tz(e){return parseFloat(e.trim())}const R1=e=>e===ka||e===he,nz=new Set(["x","y","z"]),iz=Ma.filter(e=>!nz.has(e));function sz(e){const t=[];return iz.forEach(n=>{const s=e.getValue(n);s!==void 0&&(t.push([n,s.get()]),s.set(n.startsWith("scale")?1:0))}),t}const nr={width:({x:e},{paddingLeft:t="0",paddingRight:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),height:({y:e},{paddingTop:t="0",paddingBottom:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>Qp(t,"x"),y:(e,{transform:t})=>Qp(t,"y")};nr.translateX=nr.x;nr.translateY=nr.y;const ir=new Set;let Wp=!1,em=!1,tm=!1;function HE(){if(em){const e=Array.from(ir).filter(s=>s.needsMeasurement),t=new Set(e.map(s=>s.element)),n=new Map;t.forEach(s=>{const a=sz(s);a.length&&(n.set(s,a),s.render())}),e.forEach(s=>s.measureInitialState()),t.forEach(s=>{s.render();const a=n.get(s);a&&a.forEach(([u,c])=>{var d;(d=s.getValue(u))==null||d.set(c)})}),e.forEach(s=>s.measureEndState()),e.forEach(s=>{s.suspendedScrollY!==void 0&&window.scrollTo(0,s.suspendedScrollY)})}em=!1,Wp=!1,ir.forEach(e=>e.complete(tm)),ir.clear()}function GE(){ir.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(em=!0)})}function rz(){tm=!0,GE(),HE(),tm=!1}class Ry{constructor(t,n,s,a,u,c=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...t],this.onComplete=n,this.name=s,this.motionValue=a,this.element=u,this.isAsync=c}scheduleResolve(){this.state="scheduled",this.isAsync?(ir.add(this),Wp||(Wp=!0,it.read(GE),it.resolveKeyframes(HE))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:n,element:s,motionValue:a}=this;if(t[0]===null){const u=a==null?void 0:a.get(),c=t[t.length-1];if(u!==void 0)t[0]=u;else if(s&&n){const d=s.readValue(n,c);d!=null&&(t[0]=d)}t[0]===void 0&&(t[0]=c),a&&u===void 0&&a.set(t[0])}Jj(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),ir.delete(this)}cancel(){this.state==="scheduled"&&(ir.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const az=e=>e.startsWith("--");function oz(e,t,n){az(t)?e.style.setProperty(t,n):e.style[t]=n}function Oy(e){let t;return()=>(t===void 0&&(t=e()),t)}const lz=Oy(()=>window.ScrollTimeline!==void 0),uz={};function cz(e,t){const n=Oy(e);return()=>uz[t]??n()}const FE=cz(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),Lo=([e,t,n,s])=>`cubic-bezier(${e}, ${t}, ${n}, ${s})`,O1={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Lo([0,.65,.55,1]),circOut:Lo([.55,0,1,.45]),backIn:Lo([.31,.01,.66,-.59]),backOut:Lo([.33,1.53,.69,.99])};function YE(e,t){if(e)return typeof e=="function"?FE()?NE(e,t):"ease-out":PE(e)?Lo(e):Array.isArray(e)?e.map(n=>YE(n,t)||O1.easeOut):O1[e]}function fz(e,t,n,{delay:s=0,duration:a=300,repeat:u=0,repeatType:c="loop",ease:d="easeOut",times:h}={},p=void 0){const y={[t]:n};h&&(y.offset=h);const g=YE(d,a);Array.isArray(g)&&(y.easing=g);const v={delay:s,duration:a,easing:Array.isArray(g)?"linear":g,fill:"both",iterations:u+1,direction:c==="reverse"?"alternate":"normal"};return p&&(v.pseudoElement=p),e.animate(y,v)}function XE(e){return typeof e=="function"&&"applyToOptions"in e}function dz({type:e,...t}){return XE(e)&&FE()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}class hz extends Ty{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,!t)return;const{element:n,name:s,keyframes:a,pseudoElement:u,allowFlatten:c=!1,finalKeyframe:d,onComplete:h}=t;this.isPseudoElement=!!u,this.allowFlatten=c,this.options=t,sy(typeof t.type!="string");const p=dz(t);this.animation=fz(n,s,a,p,u),p.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!u){const y=Ay(a,this.options,d,this.speed);this.updateMotionValue?this.updateMotionValue(y):oz(n,s,y),this.animation.cancel()}h==null||h(),this.notifyFinished()}}play(){this.isStopped||(this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){var t,n;(n=(t=this.animation).finish)==null||n.call(t)}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:t}=this;t==="idle"||t==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){var t,n;this.isPseudoElement||(n=(t=this.animation).commitStyles)==null||n.call(t)}get duration(){var n,s;const t=((s=(n=this.animation.effect)==null?void 0:n.getComputedTiming)==null?void 0:s.call(n).duration)||0;return ii(Number(t))}get time(){return ii(Number(this.animation.currentTime)||0)}set time(t){this.finishedTime=null,this.animation.currentTime=ni(t)}get speed(){return this.animation.playbackRate}set speed(t){t<0&&(this.finishedTime=null),this.animation.playbackRate=t}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return Number(this.animation.startTime)}set startTime(t){this.animation.startTime=t}attachTimeline({timeline:t,observe:n}){var s;return this.allowFlatten&&((s=this.animation.effect)==null||s.updateTiming({easing:"linear"})),this.animation.onfinish=null,t&&lz()?(this.animation.timeline=t,_n):n(this)}}const ZE={anticipate:UE,backInOut:zE,circInOut:KE};function pz(e){return e in ZE}function mz(e){typeof e.ease=="string"&&pz(e.ease)&&(e.ease=ZE[e.ease])}const M1=10;class yz extends hz{constructor(t){mz(t),IE(t),super(t),t.startTime&&(this.startTime=t.startTime),this.options=t}updateMotionValue(t){const{motionValue:n,onUpdate:s,onComplete:a,element:u,...c}=this.options;if(!n)return;if(t!==void 0){n.set(t);return}const d=new Ey({...c,autoplay:!1}),h=ni(this.finishedTime??this.time);n.setWithVelocity(d.sample(h-M1).value,d.sample(h).value,M1),d.stop()}}const C1=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(xs.test(e)||e==="0")&&!e.startsWith("url("));function gz(e){const t=e[0];if(e.length===1)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t)return!0}function bz(e,t,n,s){const a=e[0];if(a===null)return!1;if(t==="display"||t==="visibility")return!0;const u=e[e.length-1],c=C1(a,t),d=C1(u,t);return!c||!d?!1:gz(e)||(n==="spring"||XE(n))&&s}const vz=new Set(["opacity","clipPath","filter","transform"]),Sz=Oy(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function xz(e){var p;const{motionValue:t,name:n,repeatDelay:s,repeatType:a,damping:u,type:c}=e;if(!aE((p=t==null?void 0:t.owner)==null?void 0:p.current))return!1;const{onUpdate:d,transformTemplate:h}=t.owner.getProps();return Sz()&&n&&vz.has(n)&&(n!=="transform"||!h)&&!d&&!s&&a!=="mirror"&&u!==0&&c!=="inertia"}const wz=40;class Az extends Ty{constructor({autoplay:t=!0,delay:n=0,type:s="keyframes",repeat:a=0,repeatDelay:u=0,repeatType:c="loop",keyframes:d,name:h,motionValue:p,element:y,...g}){var T;super(),this.stop=()=>{var R,M;this._animation&&(this._animation.stop(),(R=this.stopTimeline)==null||R.call(this)),(M=this.keyframeResolver)==null||M.cancel()},this.createdAt=sn.now();const v={autoplay:t,delay:n,type:s,repeat:a,repeatDelay:u,repeatType:c,name:h,motionValue:p,element:y,...g},S=(y==null?void 0:y.KeyframeResolver)||Ry;this.keyframeResolver=new S(d,(R,M,D)=>this.onKeyframesResolved(R,M,v,!D),h,p,y),(T=this.keyframeResolver)==null||T.scheduleResolve()}onKeyframesResolved(t,n,s,a){this.keyframeResolver=void 0;const{name:u,type:c,velocity:d,delay:h,isHandoff:p,onUpdate:y}=s;this.resolvedAt=sn.now(),bz(t,u,c,d)||((Li.instantAnimations||!h)&&(y==null||y(Ay(t,s,n))),t[0]=t[t.length-1],s.duration=0,s.repeat=0);const v={startTime:a?this.resolvedAt?this.resolvedAt-this.createdAt>wz?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:n,...s,keyframes:t},S=!p&&xz(v)?new yz({...v,element:v.motionValue.owner.current}):new Ey(v);S.finished.then(()=>this.notifyFinished()).catch(_n),this.pendingTimeline&&(this.stopTimeline=S.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=S}get finished(){return this._animation?this.animation.finished:this._finished}then(t,n){return this.finished.finally(t).then(()=>{})}get animation(){var t;return this._animation||((t=this.keyframeResolver)==null||t.resume(),rz()),this._animation}get duration(){return this.animation.duration}get time(){return this.animation.time}set time(t){this.animation.time=t}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(t){this.animation.speed=t}get startTime(){return this.animation.startTime}attachTimeline(t){return this._animation?this.stopTimeline=this.animation.attachTimeline(t):this.pendingTimeline=t,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){var t;this._animation&&this.animation.cancel(),(t=this.keyframeResolver)==null||t.cancel()}}const My=(e,t,n,s={},a,u)=>c=>{const d=yy(s,e)||{},h=d.delay||s.delay||0;let{elapsed:p=0}=s;p=p-ni(h);const y={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:t.getVelocity(),...d,delay:-p,onUpdate:v=>{t.set(v),d.onUpdate&&d.onUpdate(v)},onComplete:()=>{c(),d.onComplete&&d.onComplete()},name:e,motionValue:t,element:u?void 0:a};sj(d)||Object.assign(y,ij(e,y)),y.duration&&(y.duration=ni(y.duration)),y.repeatDelay&&(y.repeatDelay=ni(y.repeatDelay)),y.from!==void 0&&(y.keyframes[0]=y.from);let g=!1;if((y.type===!1||y.duration===0&&!y.repeatDelay)&&(y.duration=0,y.delay===0&&(g=!0)),(Li.instantAnimations||Li.skipAnimations)&&(g=!0,y.duration=0,y.delay=0),y.allowFlatten=!d.type&&!d.ease,g&&!u&&t.get()!==void 0){const v=Q4(y.keyframes,d);if(v!==void 0){it.update(()=>{y.onUpdate(v),y.onComplete()});return}}return d.isSync?new Ey(y):new Az(y)},JE=new Set(["width","height","top","left","right","bottom",...Ma]);function Tz({protectedKeys:e,needsAnimating:t},n){const s=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,s}function QE(e,t,{delay:n=0,transitionOverride:s,type:a}={}){let{transition:u=e.getDefaultTransition(),transitionEnd:c,...d}=t;s&&(u=s);const h=[],p=a&&e.animationState&&e.animationState.getState()[a];for(const y in d){const g=e.getValue(y,e.latestValues[y]??null),v=d[y];if(v===void 0||p&&Tz(p,y))continue;const S={delay:n,...yy(u||{},y)},T=g.get();if(T!==void 0&&!g.isAnimating&&!Array.isArray(v)&&v===T&&!S.velocity)continue;let R=!1;if(window.MotionHandoffAnimation){const D=TE(e);if(D){const $=window.MotionHandoffAnimation(D,y,it);$!==null&&(S.startTime=$,R=!0)}}Ip(e,y),g.start(My(y,g,v,e.shouldReduceMotion&&JE.has(y)?{type:!1}:S,e,R));const M=g.animation;M&&h.push(M)}return c&&Promise.all(h).then(()=>{it.update(()=>{c&&X4(e,c)})}),h}function nm(e,t,n={}){var h;const s=el(e,t,n.type==="exit"?(h=e.presenceContext)==null?void 0:h.custom:void 0);let{transition:a=e.getDefaultTransition()||{}}=s||{};n.transitionOverride&&(a=n.transitionOverride);const u=s?()=>Promise.all(QE(e,s,n)):()=>Promise.resolve(),c=e.variantChildren&&e.variantChildren.size?(p=0)=>{const{delayChildren:y=0,staggerChildren:g,staggerDirection:v}=a;return Ez(e,t,y+p,g,v,n)}:()=>Promise.resolve(),{when:d}=a;if(d){const[p,y]=d==="beforeChildren"?[u,c]:[c,u];return p().then(()=>y())}else return Promise.all([u(),c(n.delay)])}function Ez(e,t,n=0,s=0,a=1,u){const c=[],d=(e.variantChildren.size-1)*s,h=a===1?(p=0)=>p*s:(p=0)=>d-p*s;return Array.from(e.variantChildren).sort(Rz).forEach((p,y)=>{p.notify("AnimationStart",t),c.push(nm(p,t,{...u,delay:n+h(y)}).then(()=>p.notify("AnimationComplete",t)))}),Promise.all(c)}function Rz(e,t){return e.sortNodePosition(t)}function Oz(e,t,n={}){e.notify("AnimationStart",t);let s;if(Array.isArray(t)){const a=t.map(u=>nm(e,u,n));s=Promise.all(a)}else if(typeof t=="string")s=nm(e,t,n);else{const a=typeof t=="function"?el(e,t,n.custom):t;s=Promise.all(QE(e,a,n))}return s.then(()=>{e.notify("AnimationComplete",t)})}function WE(e,t){if(!Array.isArray(t))return!1;const n=t.length;if(n!==e.length)return!1;for(let s=0;s<n;s++)if(t[s]!==e[s])return!1;return!0}const Mz=ty.length;function eR(e){if(!e)return;if(!e.isControllingVariants){const n=e.parent?eR(e.parent)||{}:{};return e.props.initial!==void 0&&(n.initial=e.props.initial),n}const t={};for(let n=0;n<Mz;n++){const s=ty[n],a=e.props[s];(Jo(a)||a===!1)&&(t[s]=a)}return t}const Cz=[...ey].reverse(),kz=ey.length;function Dz(e){return t=>Promise.all(t.map(({animation:n,options:s})=>Oz(e,n,s)))}function Nz(e){let t=Dz(e),n=k1(),s=!0;const a=h=>(p,y)=>{var v;const g=el(e,y,h==="exit"?(v=e.presenceContext)==null?void 0:v.custom:void 0);if(g){const{transition:S,transitionEnd:T,...R}=g;p={...p,...R,...T}}return p};function u(h){t=h(e)}function c(h){const{props:p}=e,y=eR(e.parent)||{},g=[],v=new Set;let S={},T=1/0;for(let M=0;M<kz;M++){const D=Cz[M],$=n[D],k=p[D]!==void 0?p[D]:y[D],Y=Jo(k),z=D===h?$.isActive:null;z===!1&&(T=M);let ne=k===y[D]&&k!==p[D]&&Y;if(ne&&s&&e.manuallyAnimateOnMount&&(ne=!1),$.protectedKeys={...S},!$.isActive&&z===null||!k&&!$.prevProp||nf(k)||typeof k=="boolean")continue;const ie=_z($.prevProp,k);let te=ie||D===h&&$.isActive&&!ne&&Y||M>T&&Y,ee=!1;const me=Array.isArray(k)?k:[k];let be=me.reduce(a(D),{});z===!1&&(be={});const{prevResolvedValues:De={}}=$,Ge={...De,...be},ke=I=>{te=!0,v.has(I)&&(ee=!0,v.delete(I)),$.needsAnimating[I]=!0;const G=e.getValue(I);G&&(G.liveStyle=!1)};for(const I in Ge){const G=be[I],J=De[I];if(S.hasOwnProperty(I))continue;let A=!1;Pp(G)&&Pp(J)?A=!WE(G,J):A=G!==J,A?G!=null?ke(I):v.add(I):G!==void 0&&v.has(I)?ke(I):$.protectedKeys[I]=!0}$.prevProp=k,$.prevResolvedValues=be,$.isActive&&(S={...S,...be}),s&&e.blockInitialAnimation&&(te=!1),te&&(!(ne&&ie)||ee)&&g.push(...me.map(I=>({animation:I,options:{type:D}})))}if(v.size){const M={};if(typeof p.initial!="boolean"){const D=el(e,Array.isArray(p.initial)?p.initial[0]:p.initial);D&&D.transition&&(M.transition=D.transition)}v.forEach(D=>{const $=e.getBaseTarget(D),k=e.getValue(D);k&&(k.liveStyle=!0),M[D]=$??null}),g.push({animation:M})}let R=!!g.length;return s&&(p.initial===!1||p.initial===p.animate)&&!e.manuallyAnimateOnMount&&(R=!1),s=!1,R?t(g):Promise.resolve()}function d(h,p){var g;if(n[h].isActive===p)return Promise.resolve();(g=e.variantChildren)==null||g.forEach(v=>{var S;return(S=v.animationState)==null?void 0:S.setActive(h,p)}),n[h].isActive=p;const y=c(h);for(const v in n)n[v].protectedKeys={};return y}return{animateChanges:c,setActive:d,setAnimateFunction:u,getState:()=>n,reset:()=>{n=k1(),s=!0}}}function _z(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!WE(t,e):!1}function Ps(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function k1(){return{animate:Ps(!0),whileInView:Ps(),whileHover:Ps(),whileTap:Ps(),whileDrag:Ps(),whileFocus:Ps(),exit:Ps()}}class Ts{constructor(t){this.isMounted=!1,this.node=t}update(){}}class $z extends Ts{constructor(t){super(t),t.animationState||(t.animationState=Nz(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();nf(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:n}=this.node.prevProps||{};t!==n&&this.updateAnimationControlsSubscription()}unmount(){var t;this.node.animationState.reset(),(t=this.unmountControls)==null||t.call(this)}}let Bz=0;class Lz extends Ts{constructor(){super(...arguments),this.id=Bz++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:n}=this.node.presenceContext,{isPresent:s}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===s)return;const a=this.node.animationState.setActive("exit",!t);n&&!t&&a.then(()=>{n(this.id)})}mount(){const{register:t,onExitComplete:n}=this.node.presenceContext||{};n&&n(this.id),t&&(this.unmount=t(this.id))}unmount(){}}const Vz={animation:{Feature:$z},exit:{Feature:Lz}};function il(e,t,n,s={passive:!0}){return e.addEventListener(t,n,s),()=>e.removeEventListener(t,n)}const Cy=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1;function vl(e){return{point:{x:e.pageX,y:e.pageY}}}const jz=e=>t=>Cy(t)&&e(t,vl(t));function qo(e,t,n,s){return il(e,t,jz(n),s)}function tR({top:e,left:t,right:n,bottom:s}){return{x:{min:t,max:n},y:{min:e,max:s}}}function zz({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function Uz(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),s=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:s.y,right:s.x}}const nR=1e-4,qz=1-nR,Kz=1+nR,iR=.01,Pz=0-iR,Iz=0+iR;function Yt(e){return e.max-e.min}function Hz(e,t,n){return Math.abs(e-t)<=n}function D1(e,t,n,s=.5){e.origin=s,e.originPoint=nt(t.min,t.max,e.origin),e.scale=Yt(n)/Yt(t),e.translate=nt(n.min,n.max,e.origin)-e.originPoint,(e.scale>=qz&&e.scale<=Kz||isNaN(e.scale))&&(e.scale=1),(e.translate>=Pz&&e.translate<=Iz||isNaN(e.translate))&&(e.translate=0)}function Ko(e,t,n,s){D1(e.x,t.x,n.x,s?s.originX:void 0),D1(e.y,t.y,n.y,s?s.originY:void 0)}function N1(e,t,n){e.min=n.min+t.min,e.max=e.min+Yt(t)}function Gz(e,t,n){N1(e.x,t.x,n.x),N1(e.y,t.y,n.y)}function _1(e,t,n){e.min=t.min-n.min,e.max=e.min+Yt(t)}function Po(e,t,n){_1(e.x,t.x,n.x),_1(e.y,t.y,n.y)}const $1=()=>({translate:0,scale:1,origin:0,originPoint:0}),sa=()=>({x:$1(),y:$1()}),B1=()=>({min:0,max:0}),ct=()=>({x:B1(),y:B1()});function kn(e){return[e("x"),e("y")]}function Jh(e){return e===void 0||e===1}function im({scale:e,scaleX:t,scaleY:n}){return!Jh(e)||!Jh(t)||!Jh(n)}function Fs(e){return im(e)||sR(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function sR(e){return L1(e.x)||L1(e.y)}function L1(e){return e&&e!=="0%"}function Dc(e,t,n){const s=e-n,a=t*s;return n+a}function V1(e,t,n,s,a){return a!==void 0&&(e=Dc(e,a,s)),Dc(e,n,s)+t}function sm(e,t=0,n=1,s,a){e.min=V1(e.min,t,n,s,a),e.max=V1(e.max,t,n,s,a)}function rR(e,{x:t,y:n}){sm(e.x,t.translate,t.scale,t.originPoint),sm(e.y,n.translate,n.scale,n.originPoint)}const j1=.999999999999,z1=1.0000000000001;function Fz(e,t,n,s=!1){const a=n.length;if(!a)return;t.x=t.y=1;let u,c;for(let d=0;d<a;d++){u=n[d],c=u.projectionDelta;const{visualElement:h}=u.options;h&&h.props.style&&h.props.style.display==="contents"||(s&&u.options.layoutScroll&&u.scroll&&u!==u.root&&aa(e,{x:-u.scroll.offset.x,y:-u.scroll.offset.y}),c&&(t.x*=c.x.scale,t.y*=c.y.scale,rR(e,c)),s&&Fs(u.latestValues)&&aa(e,u.latestValues))}t.x<z1&&t.x>j1&&(t.x=1),t.y<z1&&t.y>j1&&(t.y=1)}function ra(e,t){e.min=e.min+t,e.max=e.max+t}function U1(e,t,n,s,a=.5){const u=nt(e.min,e.max,a);sm(e,t,n,u,s)}function aa(e,t){U1(e.x,t.x,t.scaleX,t.scale,t.originX),U1(e.y,t.y,t.scaleY,t.scale,t.originY)}function aR(e,t){return tR(Uz(e.getBoundingClientRect(),t))}function Yz(e,t,n){const s=aR(e,n),{scroll:a}=t;return a&&(ra(s.x,a.offset.x),ra(s.y,a.offset.y)),s}const oR=({current:e})=>e?e.ownerDocument.defaultView:null,q1=(e,t)=>Math.abs(e-t);function Xz(e,t){const n=q1(e.x,t.x),s=q1(e.y,t.y);return Math.sqrt(n**2+s**2)}class lR{constructor(t,n,{transformPagePoint:s,contextWindow:a,dragSnapToOrigin:u=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const g=Wh(this.lastMoveEventInfo,this.history),v=this.startEvent!==null,S=Xz(g.offset,{x:0,y:0})>=3;if(!v&&!S)return;const{point:T}=g,{timestamp:R}=$t;this.history.push({...T,timestamp:R});const{onStart:M,onMove:D}=this.handlers;v||(M&&M(this.lastMoveEvent,g),this.startEvent=this.lastMoveEvent),D&&D(this.lastMoveEvent,g)},this.handlePointerMove=(g,v)=>{this.lastMoveEvent=g,this.lastMoveEventInfo=Qh(v,this.transformPagePoint),it.update(this.updatePoint,!0)},this.handlePointerUp=(g,v)=>{this.end();const{onEnd:S,onSessionEnd:T,resumeAnimation:R}=this.handlers;if(this.dragSnapToOrigin&&R&&R(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const M=Wh(g.type==="pointercancel"?this.lastMoveEventInfo:Qh(v,this.transformPagePoint),this.history);this.startEvent&&S&&S(g,M),T&&T(g,M)},!Cy(t))return;this.dragSnapToOrigin=u,this.handlers=n,this.transformPagePoint=s,this.contextWindow=a||window;const c=vl(t),d=Qh(c,this.transformPagePoint),{point:h}=d,{timestamp:p}=$t;this.history=[{...h,timestamp:p}];const{onSessionStart:y}=n;y&&y(t,Wh(d,this.history)),this.removeListeners=gl(qo(this.contextWindow,"pointermove",this.handlePointerMove),qo(this.contextWindow,"pointerup",this.handlePointerUp),qo(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),Ss(this.updatePoint)}}function Qh(e,t){return t?{point:t(e.point)}:e}function K1(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Wh({point:e},t){return{point:e,delta:K1(e,uR(t)),offset:K1(e,Zz(t)),velocity:Jz(t,.1)}}function Zz(e){return e[0]}function uR(e){return e[e.length-1]}function Jz(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,s=null;const a=uR(e);for(;n>=0&&(s=e[n],!(a.timestamp-s.timestamp>ni(t)));)n--;if(!s)return{x:0,y:0};const u=ii(a.timestamp-s.timestamp);if(u===0)return{x:0,y:0};const c={x:(a.x-s.x)/u,y:(a.y-s.y)/u};return c.x===1/0&&(c.x=0),c.y===1/0&&(c.y=0),c}function Qz(e,{min:t,max:n},s){return t!==void 0&&e<t?e=s?nt(t,e,s.min):Math.max(e,t):n!==void 0&&e>n&&(e=s?nt(n,e,s.max):Math.min(e,n)),e}function P1(e,t,n){return{min:t!==void 0?e.min+t:void 0,max:n!==void 0?e.max+n-(e.max-e.min):void 0}}function Wz(e,{top:t,left:n,bottom:s,right:a}){return{x:P1(e.x,n,a),y:P1(e.y,t,s)}}function I1(e,t){let n=t.min-e.min,s=t.max-e.max;return t.max-t.min<e.max-e.min&&([n,s]=[s,n]),{min:n,max:s}}function eU(e,t){return{x:I1(e.x,t.x),y:I1(e.y,t.y)}}function tU(e,t){let n=.5;const s=Yt(e),a=Yt(t);return a>s?n=nl(t.min,t.max-s,e.min):s>a&&(n=nl(e.min,e.max-a,t.min)),Vi(0,1,n)}function nU(e,t){const n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}const rm=.35;function iU(e=rm){return e===!1?e=0:e===!0&&(e=rm),{x:H1(e,"left","right"),y:H1(e,"top","bottom")}}function H1(e,t,n){return{min:G1(e,t),max:G1(e,n)}}function G1(e,t){return typeof e=="number"?e:e[t]||0}const jn={x:!1,y:!1};function cR(){return jn.x||jn.y}function sU(e){return e==="x"||e==="y"?jn[e]?null:(jn[e]=!0,()=>{jn[e]=!1}):jn.x||jn.y?null:(jn.x=jn.y=!0,()=>{jn.x=jn.y=!1})}const rU=new WeakMap;class aU{constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=ct(),this.visualElement=t}start(t,{snapToCursor:n=!1}={}){const{presenceContext:s}=this.visualElement;if(s&&s.isPresent===!1)return;const a=y=>{const{dragSnapToOrigin:g}=this.getProps();g?this.pauseAnimation():this.stopAnimation(),n&&this.snapToCursor(vl(y).point)},u=(y,g)=>{const{drag:v,dragPropagation:S,onDragStart:T}=this.getProps();if(v&&!S&&(this.openDragLock&&this.openDragLock(),this.openDragLock=sU(v),!this.openDragLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),kn(M=>{let D=this.getAxisMotionValue(M).get()||0;if(ti.test(D)){const{projection:$}=this.visualElement;if($&&$.layout){const k=$.layout.layoutBox[M];k&&(D=Yt(k)*(parseFloat(D)/100))}}this.originPoint[M]=D}),T&&it.postRender(()=>T(y,g)),Ip(this.visualElement,"transform");const{animationState:R}=this.visualElement;R&&R.setActive("whileDrag",!0)},c=(y,g)=>{const{dragPropagation:v,dragDirectionLock:S,onDirectionLock:T,onDrag:R}=this.getProps();if(!v&&!this.openDragLock)return;const{offset:M}=g;if(S&&this.currentDirection===null){this.currentDirection=oU(M),this.currentDirection!==null&&T&&T(this.currentDirection);return}this.updateAxis("x",g.point,M),this.updateAxis("y",g.point,M),this.visualElement.render(),R&&R(y,g)},d=(y,g)=>this.stop(y,g),h=()=>kn(y=>{var g;return this.getAnimationState(y)==="paused"&&((g=this.getAxisMotionValue(y).animation)==null?void 0:g.play())}),{dragSnapToOrigin:p}=this.getProps();this.panSession=new lR(t,{onSessionStart:a,onStart:u,onMove:c,onSessionEnd:d,resumeAnimation:h},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:p,contextWindow:oR(this.visualElement)})}stop(t,n){const s=this.isDragging;if(this.cancel(),!s)return;const{velocity:a}=n;this.startAnimation(a);const{onDragEnd:u}=this.getProps();u&&it.postRender(()=>u(t,n))}cancel(){this.isDragging=!1;const{projection:t,animationState:n}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:s}=this.getProps();!s&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(t,n,s){const{drag:a}=this.getProps();if(!s||!Gu(t,a,this.currentDirection))return;const u=this.getAxisMotionValue(t);let c=this.originPoint[t]+s[t];this.constraints&&this.constraints[t]&&(c=Qz(c,this.constraints[t],this.elastic[t])),u.set(c)}resolveConstraints(){var u;const{dragConstraints:t,dragElastic:n}=this.getProps(),s=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(u=this.visualElement.projection)==null?void 0:u.layout,a=this.constraints;t&&na(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):t&&s?this.constraints=Wz(s.layoutBox,t):this.constraints=!1,this.elastic=iU(n),a!==this.constraints&&s&&this.constraints&&!this.hasMutatedConstraints&&kn(c=>{this.constraints!==!1&&this.getAxisMotionValue(c)&&(this.constraints[c]=nU(s.layoutBox[c],this.constraints[c]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!na(t))return!1;const s=t.current,{projection:a}=this.visualElement;if(!a||!a.layout)return!1;const u=Yz(s,a.root,this.visualElement.getTransformPagePoint());let c=eU(a.layout.layoutBox,u);if(n){const d=n(zz(c));this.hasMutatedConstraints=!!d,d&&(c=tR(d))}return c}startAnimation(t){const{drag:n,dragMomentum:s,dragElastic:a,dragTransition:u,dragSnapToOrigin:c,onDragTransitionEnd:d}=this.getProps(),h=this.constraints||{},p=kn(y=>{if(!Gu(y,n,this.currentDirection))return;let g=h&&h[y]||{};c&&(g={min:0,max:0});const v=a?200:1e6,S=a?40:1e7,T={type:"inertia",velocity:s?t[y]:0,bounceStiffness:v,bounceDamping:S,timeConstant:750,restDelta:1,restSpeed:10,...u,...g};return this.startAxisValueAnimation(y,T)});return Promise.all(p).then(d)}startAxisValueAnimation(t,n){const s=this.getAxisMotionValue(t);return Ip(this.visualElement,t),s.start(My(t,s,0,n,this.visualElement,!1))}stopAnimation(){kn(t=>this.getAxisMotionValue(t).stop())}pauseAnimation(){kn(t=>{var n;return(n=this.getAxisMotionValue(t).animation)==null?void 0:n.pause()})}getAnimationState(t){var n;return(n=this.getAxisMotionValue(t).animation)==null?void 0:n.state}getAxisMotionValue(t){const n=`_drag${t.toUpperCase()}`,s=this.visualElement.getProps(),a=s[n];return a||this.visualElement.getValue(t,(s.initial?s.initial[t]:void 0)||0)}snapToCursor(t){kn(n=>{const{drag:s}=this.getProps();if(!Gu(n,s,this.currentDirection))return;const{projection:a}=this.visualElement,u=this.getAxisMotionValue(n);if(a&&a.layout){const{min:c,max:d}=a.layout.layoutBox[n];u.set(t[n]-nt(c,d,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:s}=this.visualElement;if(!na(n)||!s||!this.constraints)return;this.stopAnimation();const a={x:0,y:0};kn(c=>{const d=this.getAxisMotionValue(c);if(d&&this.constraints!==!1){const h=d.get();a[c]=tU({min:h,max:h},this.constraints[c])}});const{transformTemplate:u}=this.visualElement.getProps();this.visualElement.current.style.transform=u?u({},""):"none",s.root&&s.root.updateScroll(),s.updateLayout(),this.resolveConstraints(),kn(c=>{if(!Gu(c,t,null))return;const d=this.getAxisMotionValue(c),{min:h,max:p}=this.constraints[c];d.set(nt(h,p,a[c]))})}addListeners(){if(!this.visualElement.current)return;rU.set(this.visualElement,this);const t=this.visualElement.current,n=qo(t,"pointerdown",h=>{const{drag:p,dragListener:y=!0}=this.getProps();p&&y&&this.start(h)}),s=()=>{const{dragConstraints:h}=this.getProps();na(h)&&h.current&&(this.constraints=this.resolveRefConstraints())},{projection:a}=this.visualElement,u=a.addEventListener("measure",s);a&&!a.layout&&(a.root&&a.root.updateScroll(),a.updateLayout()),it.read(s);const c=il(window,"resize",()=>this.scalePositionWithinConstraints()),d=a.addEventListener("didUpdate",({delta:h,hasLayoutChanged:p})=>{this.isDragging&&p&&(kn(y=>{const g=this.getAxisMotionValue(y);g&&(this.originPoint[y]+=h[y].translate,g.set(g.get()+h[y].translate))}),this.visualElement.render())});return()=>{c(),n(),u(),d&&d()}}getProps(){const t=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:s=!1,dragPropagation:a=!1,dragConstraints:u=!1,dragElastic:c=rm,dragMomentum:d=!0}=t;return{...t,drag:n,dragDirectionLock:s,dragPropagation:a,dragConstraints:u,dragElastic:c,dragMomentum:d}}}function Gu(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function oU(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class lU extends Ts{constructor(t){super(t),this.removeGroupControls=_n,this.removeListeners=_n,this.controls=new aU(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||_n}unmount(){this.removeGroupControls(),this.removeListeners()}}const F1=e=>(t,n)=>{e&&it.postRender(()=>e(t,n))};class uU extends Ts{constructor(){super(...arguments),this.removePointerDownListener=_n}onPointerDown(t){this.session=new lR(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:oR(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:s,onPanEnd:a}=this.node.getProps();return{onSessionStart:F1(t),onStart:F1(n),onMove:s,onEnd:(u,c)=>{delete this.session,a&&it.postRender(()=>a(u,c))}}}mount(){this.removePointerDownListener=qo(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const sc={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function Y1(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const No={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(he.test(e))e=parseFloat(e);else return e;const n=Y1(e,t.target.x),s=Y1(e,t.target.y);return`${n}% ${s}%`}},cU={correct:(e,{treeScale:t,projectionDelta:n})=>{const s=e,a=xs.parse(e);if(a.length>5)return s;const u=xs.createTransformer(e),c=typeof a[0]!="number"?1:0,d=n.x.scale*t.x,h=n.y.scale*t.y;a[0+c]/=d,a[1+c]/=h;const p=nt(d,h,.5);return typeof a[2+c]=="number"&&(a[2+c]/=p),typeof a[3+c]=="number"&&(a[3+c]/=p),u(a)}};class fU extends j.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:s,layoutId:a}=this.props,{projection:u}=t;A4(dU),u&&(n.group&&n.group.add(u),s&&s.register&&a&&s.register(u),u.root.didUpdate(),u.addEventListener("animationComplete",()=>{this.safeToRemove()}),u.setOptions({...u.options,onExitComplete:()=>this.safeToRemove()})),sc.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:s,drag:a,isPresent:u}=this.props,{projection:c}=s;return c&&(c.isPresent=u,a||t.layoutDependency!==n||n===void 0||t.isPresent!==u?c.willUpdate():this.safeToRemove(),t.isPresent!==u&&(u?c.promote():c.relegate()||it.postRender(()=>{const d=c.getStack();(!d||!d.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),iy.postRender(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:s}=this.props,{projection:a}=t;a&&(a.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(a),s&&s.deregister&&s.deregister(a))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function fR(e){const[t,n]=n4(),s=j.useContext(iE);return K.jsx(fU,{...e,layoutGroup:s,switchLayoutGroup:j.useContext(dE),isPresent:t,safeToRemove:n})}const dU={borderRadius:{...No,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:No,borderTopRightRadius:No,borderBottomLeftRadius:No,borderBottomRightRadius:No,boxShadow:cU};function hU(e,t,n){const s=qt(e)?e:Aa(e);return s.start(My("",s,t,n)),s.animation}const pU=(e,t)=>e.depth-t.depth;class mU{constructor(){this.children=[],this.isDirty=!1}add(t){hy(this.children,t),this.isDirty=!0}remove(t){py(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(pU),this.isDirty=!1,this.children.forEach(t)}}function yU(e,t){const n=sn.now(),s=({timestamp:a})=>{const u=a-n;u>=t&&(Ss(s),e(u-t))};return it.setup(s,!0),()=>Ss(s)}const dR=["TopLeft","TopRight","BottomLeft","BottomRight"],gU=dR.length,X1=e=>typeof e=="string"?parseFloat(e):e,Z1=e=>typeof e=="number"||he.test(e);function bU(e,t,n,s,a,u){a?(e.opacity=nt(0,n.opacity??1,vU(s)),e.opacityExit=nt(t.opacity??1,0,SU(s))):u&&(e.opacity=nt(t.opacity??1,n.opacity??1,s));for(let c=0;c<gU;c++){const d=`border${dR[c]}Radius`;let h=J1(t,d),p=J1(n,d);if(h===void 0&&p===void 0)continue;h||(h=0),p||(p=0),h===0||p===0||Z1(h)===Z1(p)?(e[d]=Math.max(nt(X1(h),X1(p),s),0),(ti.test(p)||ti.test(h))&&(e[d]+="%")):e[d]=p}(t.rotate||n.rotate)&&(e.rotate=nt(t.rotate||0,n.rotate||0,s))}function J1(e,t){return e[t]!==void 0?e[t]:e.borderRadius}const vU=hR(0,.5,qE),SU=hR(.5,.95,_n);function hR(e,t,n){return s=>s<e?0:s>t?1:n(nl(e,t,s))}function Q1(e,t){e.min=t.min,e.max=t.max}function Cn(e,t){Q1(e.x,t.x),Q1(e.y,t.y)}function W1(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function ex(e,t,n,s,a){return e-=t,e=Dc(e,1/n,s),a!==void 0&&(e=Dc(e,1/a,s)),e}function xU(e,t=0,n=1,s=.5,a,u=e,c=e){if(ti.test(t)&&(t=parseFloat(t),t=nt(c.min,c.max,t/100)-c.min),typeof t!="number")return;let d=nt(u.min,u.max,s);e===u&&(d-=t),e.min=ex(e.min,t,n,d,a),e.max=ex(e.max,t,n,d,a)}function tx(e,t,[n,s,a],u,c){xU(e,t[n],t[s],t[a],t.scale,u,c)}const wU=["x","scaleX","originX"],AU=["y","scaleY","originY"];function nx(e,t,n,s){tx(e.x,t,wU,n?n.x:void 0,s?s.x:void 0),tx(e.y,t,AU,n?n.y:void 0,s?s.y:void 0)}function ix(e){return e.translate===0&&e.scale===1}function pR(e){return ix(e.x)&&ix(e.y)}function sx(e,t){return e.min===t.min&&e.max===t.max}function TU(e,t){return sx(e.x,t.x)&&sx(e.y,t.y)}function rx(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function mR(e,t){return rx(e.x,t.x)&&rx(e.y,t.y)}function ax(e){return Yt(e.x)/Yt(e.y)}function ox(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}class EU{constructor(){this.members=[]}add(t){hy(this.members,t),t.scheduleRender()}remove(t){if(py(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(t){const n=this.members.findIndex(a=>t===a);if(n===0)return!1;let s;for(let a=n;a>=0;a--){const u=this.members[a];if(u.isPresent!==!1){s=u;break}}return s?(this.promote(s),!0):!1}promote(t,n){const s=this.lead;if(t!==s&&(this.prevLead=s,this.lead=t,t.show(),s)){s.instance&&s.scheduleRender(),t.scheduleRender(),t.resumeFrom=s,n&&(t.resumeFrom.preserveOpacity=!0),s.snapshot&&(t.snapshot=s.snapshot,t.snapshot.latestValues=s.animationValues||s.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0);const{crossfade:a}=t.options;a===!1&&s.hide()}}exitAnimationComplete(){this.members.forEach(t=>{const{options:n,resumingFrom:s}=t;n.onExitComplete&&n.onExitComplete(),s&&s.options.onExitComplete&&s.options.onExitComplete()})}scheduleRender(){this.members.forEach(t=>{t.instance&&t.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function RU(e,t,n){let s="";const a=e.x.translate/t.x,u=e.y.translate/t.y,c=(n==null?void 0:n.z)||0;if((a||u||c)&&(s=`translate3d(${a}px, ${u}px, ${c}px) `),(t.x!==1||t.y!==1)&&(s+=`scale(${1/t.x}, ${1/t.y}) `),n){const{transformPerspective:p,rotate:y,rotateX:g,rotateY:v,skewX:S,skewY:T}=n;p&&(s=`perspective(${p}px) ${s}`),y&&(s+=`rotate(${y}deg) `),g&&(s+=`rotateX(${g}deg) `),v&&(s+=`rotateY(${v}deg) `),S&&(s+=`skewX(${S}deg) `),T&&(s+=`skewY(${T}deg) `)}const d=e.x.scale*t.x,h=e.y.scale*t.y;return(d!==1||h!==1)&&(s+=`scale(${d}, ${h})`),s||"none"}function yR(e){return rE(e)&&"ownerSVGElement"in e}function OU(e){return yR(e)&&e.tagName==="svg"}const ep=["","X","Y","Z"],MU={visibility:"hidden"},CU=1e3;let kU=0;function tp(e,t,n,s){const{latestValues:a}=t;a[e]&&(n[e]=a[e],t.setStaticValue(e,0),s&&(s[e]=0))}function gR(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=TE(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:a,layoutId:u}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",it,!(a||u))}const{parent:s}=e;s&&!s.hasCheckedOptimisedAppear&&gR(s)}function bR({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:s,resetTransform:a}){return class{constructor(c={},d=t==null?void 0:t()){this.id=kU++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(_U),this.nodes.forEach(jU),this.nodes.forEach(zU),this.nodes.forEach($U)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=c,this.root=d?d.root||d:this,this.path=d?[...d.path,d]:[],this.parent=d,this.depth=d?d.depth+1:0;for(let h=0;h<this.path.length;h++)this.path[h].shouldResetTransform=!0;this.root===this&&(this.nodes=new mU)}addEventListener(c,d){return this.eventHandlers.has(c)||this.eventHandlers.set(c,new my),this.eventHandlers.get(c).add(d)}notifyListeners(c,...d){const h=this.eventHandlers.get(c);h&&h.notify(...d)}hasListeners(c){return this.eventHandlers.has(c)}mount(c){if(this.instance)return;this.isSVG=yR(c)&&!OU(c),this.instance=c;const{layoutId:d,layout:h,visualElement:p}=this.options;if(p&&!p.current&&p.mount(c),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(h||d)&&(this.isLayoutDirty=!0),e){let y;const g=()=>this.root.updateBlockedByResize=!1;e(c,()=>{this.root.updateBlockedByResize=!0,y&&y(),y=yU(g,250),sc.hasAnimatedSinceResize&&(sc.hasAnimatedSinceResize=!1,this.nodes.forEach(ux))})}d&&this.root.registerSharedNode(d,this),this.options.animate!==!1&&p&&(d||h)&&this.addEventListener("didUpdate",({delta:y,hasLayoutChanged:g,hasRelativeLayoutChanged:v,layout:S})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const T=this.options.transition||p.getDefaultTransition()||IU,{onLayoutAnimationStart:R,onLayoutAnimationComplete:M}=p.getProps(),D=!this.targetLayout||!mR(this.targetLayout,S),$=!g&&v;if(this.options.layoutRoot||this.resumeFrom||$||g&&(D||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(y,$);const k={...yy(T,"layout"),onPlay:R,onComplete:M};(p.shouldReduceMotion||this.options.layoutRoot)&&(k.delay=0,k.type=!1),this.startAnimation(k)}else g||ux(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=S})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const c=this.getStack();c&&c.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),Ss(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(UU),this.animationId++)}getTransformTemplate(){const{visualElement:c}=this.options;return c&&c.getProps().transformTemplate}willUpdate(c=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&gR(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let y=0;y<this.path.length;y++){const g=this.path[y];g.shouldResetTransform=!0,g.updateScroll("snapshot"),g.options.layoutRoot&&g.willUpdate(!1)}const{layoutId:d,layout:h}=this.options;if(d===void 0&&!h)return;const p=this.getTransformTemplate();this.prevTransformTemplateValue=p?p(this.latestValues,""):void 0,this.updateSnapshot(),c&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(lx);return}this.isUpdating||this.nodes.forEach(LU),this.isUpdating=!1,this.nodes.forEach(VU),this.nodes.forEach(DU),this.nodes.forEach(NU),this.clearAllSnapshots();const d=sn.now();$t.delta=Vi(0,1e3/60,d-$t.timestamp),$t.timestamp=d,$t.isProcessing=!0,Fh.update.process($t),Fh.preRender.process($t),Fh.render.process($t),$t.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,iy.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(BU),this.sharedNodes.forEach(qU)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,it.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){it.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!Yt(this.snapshot.measuredBox.x)&&!Yt(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let h=0;h<this.path.length;h++)this.path[h].updateScroll();const c=this.layout;this.layout=this.measure(!1),this.layoutCorrected=ct(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:d}=this.options;d&&d.notify("LayoutMeasure",this.layout.layoutBox,c?c.layoutBox:void 0)}updateScroll(c="measure"){let d=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===c&&(d=!1),d&&this.instance){const h=s(this.instance);this.scroll={animationId:this.root.animationId,phase:c,isRoot:h,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:h}}}resetTransform(){if(!a)return;const c=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,d=this.projectionDelta&&!pR(this.projectionDelta),h=this.getTransformTemplate(),p=h?h(this.latestValues,""):void 0,y=p!==this.prevTransformTemplateValue;c&&this.instance&&(d||Fs(this.latestValues)||y)&&(a(this.instance,p),this.shouldResetTransform=!1,this.scheduleRender())}measure(c=!0){const d=this.measurePageBox();let h=this.removeElementScroll(d);return c&&(h=this.removeTransform(h)),HU(h),{animationId:this.root.animationId,measuredBox:d,layoutBox:h,latestValues:{},source:this.id}}measurePageBox(){var p;const{visualElement:c}=this.options;if(!c)return ct();const d=c.measureViewportBox();if(!(((p=this.scroll)==null?void 0:p.wasRoot)||this.path.some(GU))){const{scroll:y}=this.root;y&&(ra(d.x,y.offset.x),ra(d.y,y.offset.y))}return d}removeElementScroll(c){var h;const d=ct();if(Cn(d,c),(h=this.scroll)!=null&&h.wasRoot)return d;for(let p=0;p<this.path.length;p++){const y=this.path[p],{scroll:g,options:v}=y;y!==this.root&&g&&v.layoutScroll&&(g.wasRoot&&Cn(d,c),ra(d.x,g.offset.x),ra(d.y,g.offset.y))}return d}applyTransform(c,d=!1){const h=ct();Cn(h,c);for(let p=0;p<this.path.length;p++){const y=this.path[p];!d&&y.options.layoutScroll&&y.scroll&&y!==y.root&&aa(h,{x:-y.scroll.offset.x,y:-y.scroll.offset.y}),Fs(y.latestValues)&&aa(h,y.latestValues)}return Fs(this.latestValues)&&aa(h,this.latestValues),h}removeTransform(c){const d=ct();Cn(d,c);for(let h=0;h<this.path.length;h++){const p=this.path[h];if(!p.instance||!Fs(p.latestValues))continue;im(p.latestValues)&&p.updateSnapshot();const y=ct(),g=p.measurePageBox();Cn(y,g),nx(d,p.latestValues,p.snapshot?p.snapshot.layoutBox:void 0,y)}return Fs(this.latestValues)&&nx(d,this.latestValues),d}setTargetDelta(c){this.targetDelta=c,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(c){this.options={...this.options,...c,crossfade:c.crossfade!==void 0?c.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==$t.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(c=!1){var v;const d=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=d.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=d.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=d.isSharedProjectionDirty);const h=!!this.resumingFrom||this!==d;if(!(c||h&&this.isSharedProjectionDirty||this.isProjectionDirty||(v=this.parent)!=null&&v.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:y,layoutId:g}=this.options;if(!(!this.layout||!(y||g))){if(this.resolvedRelativeTargetAt=$t.timestamp,!this.targetDelta&&!this.relativeTarget){const S=this.getClosestProjectingParent();S&&S.layout&&this.animationProgress!==1?(this.relativeParent=S,this.forceRelativeParentToResolveTarget(),this.relativeTarget=ct(),this.relativeTargetOrigin=ct(),Po(this.relativeTargetOrigin,this.layout.layoutBox,S.layout.layoutBox),Cn(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=ct(),this.targetWithTransforms=ct()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),Gz(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):Cn(this.target,this.layout.layoutBox),rR(this.target,this.targetDelta)):Cn(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget)){this.attemptToResolveRelativeTarget=!1;const S=this.getClosestProjectingParent();S&&!!S.resumingFrom==!!this.resumingFrom&&!S.options.layoutScroll&&S.target&&this.animationProgress!==1?(this.relativeParent=S,this.forceRelativeParentToResolveTarget(),this.relativeTarget=ct(),this.relativeTargetOrigin=ct(),Po(this.relativeTargetOrigin,this.target,S.target),Cn(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}}}getClosestProjectingParent(){if(!(!this.parent||im(this.parent.latestValues)||sR(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}calcProjection(){var T;const c=this.getLead(),d=!!this.resumingFrom||this!==c;let h=!0;if((this.isProjectionDirty||(T=this.parent)!=null&&T.isProjectionDirty)&&(h=!1),d&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(h=!1),this.resolvedRelativeTargetAt===$t.timestamp&&(h=!1),h)return;const{layout:p,layoutId:y}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(p||y))return;Cn(this.layoutCorrected,this.layout.layoutBox);const g=this.treeScale.x,v=this.treeScale.y;Fz(this.layoutCorrected,this.treeScale,this.path,d),c.layout&&!c.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(c.target=c.layout.layoutBox,c.targetWithTransforms=ct());const{target:S}=c;if(!S){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(W1(this.prevProjectionDelta.x,this.projectionDelta.x),W1(this.prevProjectionDelta.y,this.projectionDelta.y)),Ko(this.projectionDelta,this.layoutCorrected,S,this.latestValues),(this.treeScale.x!==g||this.treeScale.y!==v||!ox(this.projectionDelta.x,this.prevProjectionDelta.x)||!ox(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",S))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(c=!0){var d;if((d=this.options.visualElement)==null||d.scheduleRender(),c){const h=this.getStack();h&&h.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=sa(),this.projectionDelta=sa(),this.projectionDeltaWithTransform=sa()}setAnimationOrigin(c,d=!1){const h=this.snapshot,p=h?h.latestValues:{},y={...this.latestValues},g=sa();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!d;const v=ct(),S=h?h.source:void 0,T=this.layout?this.layout.source:void 0,R=S!==T,M=this.getStack(),D=!M||M.members.length<=1,$=!!(R&&!D&&this.options.crossfade===!0&&!this.path.some(PU));this.animationProgress=0;let k;this.mixTargetDelta=Y=>{const z=Y/1e3;cx(g.x,c.x,z),cx(g.y,c.y,z),this.setTargetDelta(g),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Po(v,this.layout.layoutBox,this.relativeParent.layout.layoutBox),KU(this.relativeTarget,this.relativeTargetOrigin,v,z),k&&TU(this.relativeTarget,k)&&(this.isProjectionDirty=!1),k||(k=ct()),Cn(k,this.relativeTarget)),R&&(this.animationValues=y,bU(y,p,this.latestValues,z,$,D)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=z},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(c){var d,h,p;this.notifyListeners("animationStart"),(d=this.currentAnimation)==null||d.stop(!1),(p=(h=this.resumingFrom)==null?void 0:h.currentAnimation)==null||p.stop(!1),this.pendingAnimation&&(Ss(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=it.update(()=>{sc.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=Aa(0)),this.currentAnimation=hU(this.motionValue,[0,1e3],{...c,isSync:!0,onUpdate:y=>{this.mixTargetDelta(y),c.onUpdate&&c.onUpdate(y)},onStop:()=>{},onComplete:()=>{c.onComplete&&c.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const c=this.getStack();c&&c.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(CU),this.currentAnimation.stop(!1)),this.completeAnimation()}applyTransformsToTarget(){const c=this.getLead();let{targetWithTransforms:d,target:h,layout:p,latestValues:y}=c;if(!(!d||!h||!p)){if(this!==c&&this.layout&&p&&vR(this.options.animationType,this.layout.layoutBox,p.layoutBox)){h=this.target||ct();const g=Yt(this.layout.layoutBox.x);h.x.min=c.target.x.min,h.x.max=h.x.min+g;const v=Yt(this.layout.layoutBox.y);h.y.min=c.target.y.min,h.y.max=h.y.min+v}Cn(d,h),aa(d,y),Ko(this.projectionDeltaWithTransform,this.layoutCorrected,d,y)}}registerSharedNode(c,d){this.sharedNodes.has(c)||this.sharedNodes.set(c,new EU),this.sharedNodes.get(c).add(d);const p=d.options.initialPromotionConfig;d.promote({transition:p?p.transition:void 0,preserveFollowOpacity:p&&p.shouldPreserveFollowOpacity?p.shouldPreserveFollowOpacity(d):void 0})}isLead(){const c=this.getStack();return c?c.lead===this:!0}getLead(){var d;const{layoutId:c}=this.options;return c?((d=this.getStack())==null?void 0:d.lead)||this:this}getPrevLead(){var d;const{layoutId:c}=this.options;return c?(d=this.getStack())==null?void 0:d.prevLead:void 0}getStack(){const{layoutId:c}=this.options;if(c)return this.root.sharedNodes.get(c)}promote({needsReset:c,transition:d,preserveFollowOpacity:h}={}){const p=this.getStack();p&&p.promote(this,h),c&&(this.projectionDelta=void 0,this.needsReset=!0),d&&this.setOptions({transition:d})}relegate(){const c=this.getStack();return c?c.relegate(this):!1}resetSkewAndRotation(){const{visualElement:c}=this.options;if(!c)return;let d=!1;const{latestValues:h}=c;if((h.z||h.rotate||h.rotateX||h.rotateY||h.rotateZ||h.skewX||h.skewY)&&(d=!0),!d)return;const p={};h.z&&tp("z",c,p,this.animationValues);for(let y=0;y<ep.length;y++)tp(`rotate${ep[y]}`,c,p,this.animationValues),tp(`skew${ep[y]}`,c,p,this.animationValues);c.render();for(const y in p)c.setStaticValue(y,p[y]),this.animationValues&&(this.animationValues[y]=p[y]);c.scheduleRender()}getProjectionStyles(c){if(!this.instance||this.isSVG)return;if(!this.isVisible)return MU;const d={visibility:""},h=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,d.opacity="",d.pointerEvents=nc(c==null?void 0:c.pointerEvents)||"",d.transform=h?h(this.latestValues,""):"none",d;const p=this.getLead();if(!this.projectionDelta||!this.layout||!p.target){const S={};return this.options.layoutId&&(S.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,S.pointerEvents=nc(c==null?void 0:c.pointerEvents)||""),this.hasProjected&&!Fs(this.latestValues)&&(S.transform=h?h({},""):"none",this.hasProjected=!1),S}const y=p.animationValues||p.latestValues;this.applyTransformsToTarget(),d.transform=RU(this.projectionDeltaWithTransform,this.treeScale,y),h&&(d.transform=h(y,d.transform));const{x:g,y:v}=this.projectionDelta;d.transformOrigin=`${g.origin*100}% ${v.origin*100}% 0`,p.animationValues?d.opacity=p===this?y.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:y.opacityExit:d.opacity=p===this?y.opacity!==void 0?y.opacity:"":y.opacityExit!==void 0?y.opacityExit:0;for(const S in Qo){if(y[S]===void 0)continue;const{correct:T,applyTo:R,isCSSVariable:M}=Qo[S],D=d.transform==="none"?y[S]:T(y[S],p);if(R){const $=R.length;for(let k=0;k<$;k++)d[R[k]]=D}else M?this.options.visualElement.renderState.vars[S]=D:d[S]=D}return this.options.layoutId&&(d.pointerEvents=p===this?nc(c==null?void 0:c.pointerEvents)||"":"none"),d}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(c=>{var d;return(d=c.currentAnimation)==null?void 0:d.stop(!1)}),this.root.nodes.forEach(lx),this.root.sharedNodes.clear()}}}function DU(e){e.updateLayout()}function NU(e){var n;const t=((n=e.resumeFrom)==null?void 0:n.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners("didUpdate")){const{layoutBox:s,measuredBox:a}=e.layout,{animationType:u}=e.options,c=t.source!==e.layout.source;u==="size"?kn(g=>{const v=c?t.measuredBox[g]:t.layoutBox[g],S=Yt(v);v.min=s[g].min,v.max=v.min+S}):vR(u,t.layoutBox,s)&&kn(g=>{const v=c?t.measuredBox[g]:t.layoutBox[g],S=Yt(s[g]);v.max=v.min+S,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[g].max=e.relativeTarget[g].min+S)});const d=sa();Ko(d,s,t.layoutBox);const h=sa();c?Ko(h,e.applyTransform(a,!0),t.measuredBox):Ko(h,s,t.layoutBox);const p=!pR(d);let y=!1;if(!e.resumeFrom){const g=e.getClosestProjectingParent();if(g&&!g.resumeFrom){const{snapshot:v,layout:S}=g;if(v&&S){const T=ct();Po(T,t.layoutBox,v.layoutBox);const R=ct();Po(R,s,S.layoutBox),mR(T,R)||(y=!0),g.options.layoutRoot&&(e.relativeTarget=R,e.relativeTargetOrigin=T,e.relativeParent=g)}}}e.notifyListeners("didUpdate",{layout:s,snapshot:t,delta:h,layoutDelta:d,hasLayoutChanged:p,hasRelativeLayoutChanged:y})}else if(e.isLead()){const{onExitComplete:s}=e.options;s&&s()}e.options.transition=void 0}function _U(e){e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function $U(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function BU(e){e.clearSnapshot()}function lx(e){e.clearMeasurements()}function LU(e){e.isLayoutDirty=!1}function VU(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function ux(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function jU(e){e.resolveTargetDelta()}function zU(e){e.calcProjection()}function UU(e){e.resetSkewAndRotation()}function qU(e){e.removeLeadSnapshot()}function cx(e,t,n){e.translate=nt(t.translate,0,n),e.scale=nt(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function fx(e,t,n,s){e.min=nt(t.min,n.min,s),e.max=nt(t.max,n.max,s)}function KU(e,t,n,s){fx(e.x,t.x,n.x,s),fx(e.y,t.y,n.y,s)}function PU(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const IU={duration:.45,ease:[.4,0,.1,1]},dx=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),hx=dx("applewebkit/")&&!dx("chrome/")?Math.round:_n;function px(e){e.min=hx(e.min),e.max=hx(e.max)}function HU(e){px(e.x),px(e.y)}function vR(e,t,n){return e==="position"||e==="preserve-aspect"&&!Hz(ax(t),ax(n),.2)}function GU(e){var t;return e!==e.root&&((t=e.scroll)==null?void 0:t.wasRoot)}const FU=bR({attachResizeListener:(e,t)=>il(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),np={current:void 0},SR=bR({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!np.current){const e=new FU({});e.mount(window),e.setOptions({layoutScroll:!0}),np.current=e}return np.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),YU={pan:{Feature:uU},drag:{Feature:lU,ProjectionNode:SR,MeasureLayout:fR}};function XU(e,t,n){if(e instanceof EventTarget)return[e];if(typeof e=="string"){let s=document;const a=(n==null?void 0:n[e])??s.querySelectorAll(e);return a?Array.from(a):[]}return Array.from(e)}function xR(e,t){const n=XU(e),s=new AbortController,a={passive:!0,...t,signal:s.signal};return[n,a,()=>s.abort()]}function mx(e){return!(e.pointerType==="touch"||cR())}function ZU(e,t,n={}){const[s,a,u]=xR(e,n),c=d=>{if(!mx(d))return;const{target:h}=d,p=t(h,d);if(typeof p!="function"||!h)return;const y=g=>{mx(g)&&(p(g),h.removeEventListener("pointerleave",y))};h.addEventListener("pointerleave",y,a)};return s.forEach(d=>{d.addEventListener("pointerenter",c,a)}),u}function yx(e,t,n){const{props:s}=e;e.animationState&&s.whileHover&&e.animationState.setActive("whileHover",n==="Start");const a="onHover"+n,u=s[a];u&&it.postRender(()=>u(t,vl(t)))}class JU extends Ts{mount(){const{current:t}=this.node;t&&(this.unmount=ZU(t,(n,s)=>(yx(this.node,s,"Start"),a=>yx(this.node,a,"End"))))}unmount(){}}class QU extends Ts{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=gl(il(this.node.current,"focus",()=>this.onFocus()),il(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const wR=(e,t)=>t?e===t?!0:wR(e,t.parentElement):!1,WU=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function eq(e){return WU.has(e.tagName)||e.tabIndex!==-1}const rc=new WeakSet;function gx(e){return t=>{t.key==="Enter"&&e(t)}}function ip(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const tq=(e,t)=>{const n=e.currentTarget;if(!n)return;const s=gx(()=>{if(rc.has(n))return;ip(n,"down");const a=gx(()=>{ip(n,"up")}),u=()=>ip(n,"cancel");n.addEventListener("keyup",a,t),n.addEventListener("blur",u,t)});n.addEventListener("keydown",s,t),n.addEventListener("blur",()=>n.removeEventListener("keydown",s),t)};function bx(e){return Cy(e)&&!cR()}function nq(e,t,n={}){const[s,a,u]=xR(e,n),c=d=>{const h=d.currentTarget;if(!bx(d))return;rc.add(h);const p=t(h,d),y=(S,T)=>{window.removeEventListener("pointerup",g),window.removeEventListener("pointercancel",v),rc.has(h)&&rc.delete(h),bx(S)&&typeof p=="function"&&p(S,{success:T})},g=S=>{y(S,h===window||h===document||n.useGlobalTarget||wR(h,S.target))},v=S=>{y(S,!1)};window.addEventListener("pointerup",g,a),window.addEventListener("pointercancel",v,a)};return s.forEach(d=>{(n.useGlobalTarget?window:d).addEventListener("pointerdown",c,a),aE(d)&&(d.addEventListener("focus",p=>tq(p,a)),!eq(d)&&!d.hasAttribute("tabindex")&&(d.tabIndex=0))}),u}function vx(e,t,n){const{props:s}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&s.whileTap&&e.animationState.setActive("whileTap",n==="Start");const a="onTap"+(n==="End"?"":n),u=s[a];u&&it.postRender(()=>u(t,vl(t)))}class iq extends Ts{mount(){const{current:t}=this.node;t&&(this.unmount=nq(t,(n,s)=>(vx(this.node,s,"Start"),(a,{success:u})=>vx(this.node,a,u?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const am=new WeakMap,sp=new WeakMap,sq=e=>{const t=am.get(e.target);t&&t(e)},rq=e=>{e.forEach(sq)};function aq({root:e,...t}){const n=e||document;sp.has(n)||sp.set(n,{});const s=sp.get(n),a=JSON.stringify(t);return s[a]||(s[a]=new IntersectionObserver(rq,{root:e,...t})),s[a]}function oq(e,t,n){const s=aq(t);return am.set(e,n),s.observe(e),()=>{am.delete(e),s.unobserve(e)}}const lq={some:0,all:1};class uq extends Ts{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:n,margin:s,amount:a="some",once:u}=t,c={root:n?n.current:void 0,rootMargin:s,threshold:typeof a=="number"?a:lq[a]},d=h=>{const{isIntersecting:p}=h;if(this.isInView===p||(this.isInView=p,u&&!p&&this.hasEnteredView))return;p&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",p);const{onViewportEnter:y,onViewportLeave:g}=this.node.getProps(),v=p?y:g;v&&v(h)};return oq(this.node.current,c,d)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:n}=this.node;["amount","margin","root"].some(cq(t,n))&&this.startObserver()}unmount(){}}function cq({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const fq={inView:{Feature:uq},tap:{Feature:iq},focus:{Feature:QU},hover:{Feature:JU}},dq={layout:{ProjectionNode:SR,MeasureLayout:fR}},om={current:null},AR={current:!1};function hq(){if(AR.current=!0,!!Qm)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>om.current=e.matches;e.addListener(t),t()}else om.current=!1}const pq=new WeakMap;function mq(e,t,n){for(const s in t){const a=t[s],u=n[s];if(qt(a))e.addValue(s,a);else if(qt(u))e.addValue(s,Aa(a,{owner:e}));else if(u!==a)if(e.hasValue(s)){const c=e.getValue(s);c.liveStyle===!0?c.jump(a):c.hasAnimated||c.set(a)}else{const c=e.getStaticValue(s);e.addValue(s,Aa(c!==void 0?c:a,{owner:e}))}}for(const s in n)t[s]===void 0&&e.removeValue(s);return t}const TR=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),ER=e=>/^0[^.\s]+$/u.test(e),yq={test:e=>e==="auto",parse:e=>e},RR=e=>t=>t.test(e),OR=[ka,he,ti,ds,E4,T4,yq],Sx=e=>OR.find(RR(e)),gq=[...OR,Ut,xs],bq=e=>gq.find(RR(e)),vq=new Set(["brightness","contrast","saturate","opacity"]);function Sq(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[s]=n.match(gy)||[];if(!s)return e;const a=n.replace(s,"");let u=vq.has(t)?1:0;return s!==n&&(u*=100),t+"("+u+a+")"}const xq=/\b([a-z-]*)\(.*?\)/gu,lm={...xs,getAnimatableNone:e=>{const t=e.match(xq);return t?t.map(Sq).join(" "):e}},wq={...oy,color:Ut,backgroundColor:Ut,outlineColor:Ut,fill:Ut,stroke:Ut,borderColor:Ut,borderTopColor:Ut,borderRightColor:Ut,borderBottomColor:Ut,borderLeftColor:Ut,filter:lm,WebkitFilter:lm},MR=e=>wq[e];function CR(e,t){let n=MR(e);return n!==lm&&(n=xs),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const xx=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class Aq{scrapeMotionValuesFromProps(t,n,s){return{}}constructor({parent:t,props:n,presenceContext:s,reducedMotionConfig:a,blockInitialAnimation:u,visualState:c},d={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=Ry,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const v=sn.now();this.renderScheduledAt<v&&(this.renderScheduledAt=v,it.render(this.render,!1,!0))};const{latestValues:h,renderState:p}=c;this.latestValues=h,this.baseTarget={...h},this.initialValues=n.initial?{...h}:{},this.renderState=p,this.parent=t,this.props=n,this.presenceContext=s,this.depth=t?t.depth+1:0,this.reducedMotionConfig=a,this.options=d,this.blockInitialAnimation=!!u,this.isControllingVariants=sf(n),this.isVariantNode=cE(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);const{willChange:y,...g}=this.scrapeMotionValuesFromProps(n,{},this);for(const v in g){const S=g[v];h[v]!==void 0&&qt(S)&&S.set(h[v],!1)}}mount(t){this.current=t,pq.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((n,s)=>this.bindToMotionValue(s,n)),AR.current||hq(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:om.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){this.projection&&this.projection.unmount(),Ss(this.notifyUpdate),Ss(this.render),this.valueSubscriptions.forEach(t=>t()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const n=this.features[t];n&&(n.unmount(),n.isMounted=!1)}this.current=null}bindToMotionValue(t,n){this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)();const s=Ca.has(t);s&&this.onBindTransform&&this.onBindTransform();const a=n.on("change",d=>{this.latestValues[t]=d,this.props.onUpdate&&it.preRender(this.notifyUpdate),s&&this.projection&&(this.projection.isTransformDirty=!0)}),u=n.on("renderRequest",this.scheduleRender);let c;window.MotionCheckAppearSync&&(c=window.MotionCheckAppearSync(this,t,n)),this.valueSubscriptions.set(t,()=>{a(),u(),c&&c(),n.owner&&n.stop()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}updateFeatures(){let t="animation";for(t in wa){const n=wa[t];if(!n)continue;const{isEnabled:s,Feature:a}=n;if(!this.features[t]&&a&&s(this.props)&&(this.features[t]=new a(this)),this.features[t]){const u=this.features[t];u.isMounted?u.update():(u.mount(),u.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):ct()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,n){this.latestValues[t]=n}update(t,n){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let s=0;s<xx.length;s++){const a=xx[s];this.propEventSubscriptions[a]&&(this.propEventSubscriptions[a](),delete this.propEventSubscriptions[a]);const u="on"+a,c=t[u];c&&(this.propEventSubscriptions[a]=this.on(a,c))}this.prevMotionValues=mq(this,this.scrapeMotionValuesFromProps(t,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(t){const n=this.getClosestVariantNode();if(n)return n.variantChildren&&n.variantChildren.add(t),()=>n.variantChildren.delete(t)}addValue(t,n){const s=this.values.get(t);n!==s&&(s&&this.removeValue(t),this.bindToMotionValue(t,n),this.values.set(t,n),this.latestValues[t]=n.get())}removeValue(t){this.values.delete(t);const n=this.valueSubscriptions.get(t);n&&(n(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,n){if(this.props.values&&this.props.values[t])return this.props.values[t];let s=this.values.get(t);return s===void 0&&n!==void 0&&(s=Aa(n===null?void 0:n,{owner:this}),this.addValue(t,s)),s}readValue(t,n){let s=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:this.getBaseTargetFromProps(this.props,t)??this.readValueFromInstance(this.current,t,this.options);return s!=null&&(typeof s=="string"&&(TR(s)||ER(s))?s=parseFloat(s):!bq(s)&&xs.test(n)&&(s=CR(t,n)),this.setBaseTarget(t,qt(s)?s.get():s)),qt(s)?s.get():s}setBaseTarget(t,n){this.baseTarget[t]=n}getBaseTarget(t){var u;const{initial:n}=this.props;let s;if(typeof n=="string"||typeof n=="object"){const c=fy(this.props,n,(u=this.presenceContext)==null?void 0:u.custom);c&&(s=c[t])}if(n&&s!==void 0)return s;const a=this.getBaseTargetFromProps(this.props,t);return a!==void 0&&!qt(a)?a:this.initialValues[t]!==void 0&&s===void 0?void 0:this.baseTarget[t]}on(t,n){return this.events[t]||(this.events[t]=new my),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}}const Tq=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function Eq(e){const t=Tq.exec(e);if(!t)return[,];const[,n,s,a]=t;return[`--${n??s}`,a]}function kR(e,t,n=1){const[s,a]=Eq(e);if(!s)return;const u=window.getComputedStyle(t).getPropertyValue(s);if(u){const c=u.trim();return TR(c)?parseFloat(c):c}return ay(a)?kR(a,t,n+1):a}function Rq(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||ER(e):!0}const Oq=new Set(["auto","none","0"]);function Mq(e,t,n){let s=0,a;for(;s<e.length&&!a;){const u=e[s];typeof u=="string"&&!Oq.has(u)&&tl(u).values.length&&(a=e[s]),s++}if(a&&n)for(const u of t)e[u]=CR(n,a)}class Cq extends Ry{constructor(t,n,s,a,u){super(t,n,s,a,u,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:n,name:s}=this;if(!n||!n.current)return;super.readKeyframes();for(let h=0;h<t.length;h++){let p=t[h];if(typeof p=="string"&&(p=p.trim(),ay(p))){const y=kR(p,n.current);y!==void 0&&(t[h]=y),h===t.length-1&&(this.finalKeyframe=p)}}if(this.resolveNoneKeyframes(),!JE.has(s)||t.length!==2)return;const[a,u]=t,c=Sx(a),d=Sx(u);if(c!==d)if(R1(c)&&R1(d))for(let h=0;h<t.length;h++){const p=t[h];typeof p=="string"&&(t[h]=parseFloat(p))}else nr[s]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:n}=this,s=[];for(let a=0;a<t.length;a++)(t[a]===null||Rq(t[a]))&&s.push(a);s.length&&Mq(t,s,n)}measureInitialState(){const{element:t,unresolvedKeyframes:n,name:s}=this;if(!t||!t.current)return;s==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=nr[s](t.measureViewportBox(),window.getComputedStyle(t.current)),n[0]=this.measuredOrigin;const a=n[n.length-1];a!==void 0&&t.getValue(s,a).jump(a,!1)}measureEndState(){var d;const{element:t,name:n,unresolvedKeyframes:s}=this;if(!t||!t.current)return;const a=t.getValue(n);a&&a.jump(this.measuredOrigin,!1);const u=s.length-1,c=s[u];s[u]=nr[n](t.measureViewportBox(),window.getComputedStyle(t.current)),c!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=c),(d=this.removedTransforms)!=null&&d.length&&this.removedTransforms.forEach(([h,p])=>{t.getValue(h).set(p)}),this.resolveNoneKeyframes()}}class DR extends Aq{constructor(){super(...arguments),this.KeyframeResolver=Cq}sortInstanceNodePosition(t,n){return t.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(t,n){return t.style?t.style[n]:void 0}removeValueFromRenderState(t,{vars:n,style:s}){delete n[t],delete s[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;qt(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}function NR(e,{style:t,vars:n},s,a){Object.assign(e.style,t,a&&a.getProjectionStyles(s));for(const u in n)e.style.setProperty(u,n[u])}function kq(e){return window.getComputedStyle(e)}class Dq extends DR{constructor(){super(...arguments),this.type="html",this.renderInstance=NR}readValueFromInstance(t,n){var s;if(Ca.has(n))return(s=this.projection)!=null&&s.isProjecting?Jp(n):ez(t,n);{const a=kq(t),u=(ry(n)?a.getPropertyValue(n):a[n])||0;return typeof u=="string"?u.trim():u}}measureInstanceViewportBox(t,{transformPagePoint:n}){return aR(t,n)}build(t,n,s){ly(t,n,s.transformTemplate)}scrapeMotionValuesFromProps(t,n,s){return dy(t,n,s)}}const _R=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function Nq(e,t,n,s){NR(e,t,void 0,s);for(const a in t.attrs)e.setAttribute(_R.has(a)?a:ny(a),t.attrs[a])}class _q extends DR{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=ct}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(Ca.has(n)){const s=MR(n);return s&&s.default||0}return n=_R.has(n)?n:ny(n),t.getAttribute(n)}scrapeMotionValuesFromProps(t,n,s){return wE(t,n,s)}build(t,n,s){bE(t,n,this.isSVGTag,s.transformTemplate,s.style)}renderInstance(t,n,s,a){Nq(t,n,s,a)}mount(t){this.isSVGTag=SE(t.tagName),super.mount(t)}}const $q=(e,t)=>cy(e)?new _q(t):new Dq(t,{allowProjection:e!==j.Fragment}),Bq=P4({...Vz,...fq,...YU,...dq},$q),Lq=u4(Bq);function Vq(){const e=Ri(Xo),t=Ri(xa),n=Ri(Zo),s=mt(Xo),a=mt(xa),u=mt(Zo),[c,d]=j.useState(null),[h,p]=j.useState(null),[y,g]=j.useState("email");return K.jsx("form",{onSubmit:async v=>{v.preventDefault();try{switch(y){case"email":{const{nextStep:S,userKey:T}=await ms.authStage1.query({email:s});switch(p(T),S){case"otp_login":case"otp_verify":{g("otp");break}case"password_login":{g("email");break}}break}case"otp":{if(!h){console.error("somehow userKey is null");return}const S=await ms.verifyAccountAction.mutate({oneTimeCode:u,userKey:h});Qn(Bt,S),Ci.once("connect",()=>{bs("/game"),e(""),n("")});break}case"password":{const S=await ms.openSession.mutate({email:s,password:a});Qn(Bt,S),Ci.once("connect",()=>{bs("/game"),e(""),t("")});break}default:{const S=await ms.openSession.mutate({email:s,password:a});e(""),t(""),Qn(Bt,S),Ci.once("connect",()=>{console.log("โจ connected"),bs("/game")})}}}catch(S){S instanceof ei&&d(S.message)}},children:K.jsxs("main",{children:[c?K.jsx("aside",{children:c}):null,K.jsxs(Lq.label,{htmlFor:"email",children:[K.jsx("span",{children:"Email"}),K.jsx("input",{id:"email",type:"text",value:s,onChange:v=>{e(v.target.value)},autoComplete:"email",autoCapitalize:"none",disabled:y!=="email"})]}),y==="password"?K.jsxs("label",{htmlFor:"password",children:[K.jsx("span",{children:"Password"}),K.jsx("input",{id:"password",type:"password",value:a,onChange:v=>{t(v.target.value)},autoComplete:"current-password",autoCapitalize:"none",autoFocus:y==="password"})]}):null,y==="otp"?K.jsxs("label",{htmlFor:"otp",children:[K.jsx("span",{children:"One-time Code"}),K.jsx("input",{id:"otp",type:"otp",value:u,onChange:v=>{n(v.target.value)},autoComplete:"one-time-code",autoCapitalize:"none",autoFocus:y==="otp"})]}):null,K.jsx("button",{type:"submit",disabled:!s&&y==="email"||!a&&y==="password",children:">>->"})]})})}function jq({route:[,e]}){const t=mt(Bt),n=mt(Zo),s=Ri(Zo);zn.useState(!1);const[a,u]=zn.useState(null);if(ac(()=>{e&&s(e)}),!t)return K.jsx("p",{children:"You must be logged in to verify your account."});const{verification:c}=t;return ac(()=>{n&&console.log("verifying token",n)}),K.jsx("form",{onSubmit:async d=>{d.preventDefault();try{const h=await ms.verifyAccountAction.mutate({oneTimeCode:n,userKey:"CHANGEME"});Qn(Bt,h),h.action==="resetPassword"?bs("/account"):bs("/game")}catch(h){h instanceof ei&&u(h.message)}},children:K.jsxs("main",{children:[K.jsx("p",{children:"Check your email for a verification code."}),K.jsxs("label",{htmlFor:"code",children:[K.jsx("span",{children:"Verification code"}),K.jsx("input",{id:"code",type:"text",value:n,onChange:d=>{s(d.target.value)},placeholder:"Verification code",autoComplete:"one-time-code",autoCapitalize:"none"})]})]})})}function zq(){const e=mt(tE),t=mt(Bt),[n,s]=j.useState(!1),{refs:a,floatingStyles:u,context:c}=iN({open:n,onOpenChange:s,placement:"bottom-end",middleware:[CD(5),DD(),kD()],whileElementsMounted:AD}),d=QD(c),h=tN(c),p=aN(c),{getReferenceProps:y,getFloatingProps:g}=sN([d,h,p]),v=mt(_L);return K.jsxs("main",{className:IB.class,children:[K.jsxs("header",{children:[K.jsxs("main",{children:[K.jsx(PB,{}),K.jsxs("span",{children:["v",v instanceof Promise?"loading version":v.version]})]}),K.jsx("button",{"data-css":"profile",ref:a.setReference,...y(),children:t!=null&&t.username?t.username.slice(0,2):""}),n&&t&&K.jsx(ZD,{context:c,modal:!1,children:K.jsxs("div",{"data-css":"profile-actions",ref:a.setFloating,style:u,...g(),children:[K.jsx("span",{children:t.username}),K.jsx("button",{type:"button",onClick:()=>{bs("/account")},children:"Account"}),K.jsx("button",{type:"button",onClick:async()=>{t&&(await ms.closeSession.mutate({username:t.username,sessionKey:t.sessionKey}),Ci.once("disconnect",()=>{Qn(Bt,null),bs("/")}),Ci.disconnect())},children:"Sign out"})]})})]}),K.jsx("main",{children:typeof e=="number"?K.jsxs("article",{children:[K.jsx("h1",{children:e}),K.jsx("h2",{children:JSON.parse(OT[e])}),K.jsx(MT,{href:"/",children:"Return to Home Page"})]}):(()=>{switch(e[0]){case void 0:return K.jsx(Vq,{});case"admin":return K.jsx(FV,{});case"game":return K.jsx(JV,{route:e});case"verify":return K.jsx(jq,{route:e});case"account":return K.jsx(GV,{})}})()})]})}yk.createRoot(document.getElementById("root")).render(K.jsx(j.StrictMode,{children:K.jsx(lk,{socket:Ci,children:K.jsx(zq,{})})}));
|