tempest.games 0.2.17 โ 0.2.19
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 +15 -0
- package/app/assets/index-DikmBhXT.js +109 -0
- package/app/index.html +1 -1
- package/bin/backend.bun.js +234 -234
- package/bin/backend.worker.game.bun.js +14 -3
- package/bin/backend.worker.tribunal.bun.js +123 -110
- package/bin/frontend.bun.js +61 -50
- package/bin/setup-db.bun.js +55 -55
- package/package.json +20 -20
- package/app/assets/index-DV2ldfnq.js +0 -109
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
function iM(t,e){for(var n=0;n<e.length;n++){const r=e[n];if(typeof r!="string"&&!Array.isArray(r)){for(const o in r)if(o!=="default"&&!(o in t)){const u=Object.getOwnPropertyDescriptor(r,o);u&&Object.defineProperty(t,o,u.get?u:{enumerable:!0,get:()=>r[o]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const u of o)if(u.type==="childList")for(const c of u.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&r(c)}).observe(document,{childList:!0,subtree:!0});function n(o){const u={};return o.integrity&&(u.integrity=o.integrity),o.referrerPolicy&&(u.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?u.credentials="include":o.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function r(o){if(o.ep)return;o.ep=!0;const u=n(o);fetch(o.href,u)}})();function rM(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Rh={exports:{}},Ba={};/**
|
|
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 D0;function sM(){if(D0)return Ba;D0=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function n(r,o,u){var c=null;if(u!==void 0&&(c=""+u),o.key!==void 0&&(c=""+o.key),"key"in o){u={};for(var d in o)d!=="key"&&(u[d]=o[d])}else u=o;return o=u.ref,{$$typeof:t,type:r,key:c,ref:o!==void 0?o:null,props:u}}return Ba.Fragment=e,Ba.jsx=n,Ba.jsxs=n,Ba}var N0;function oM(){return N0||(N0=1,Rh.exports=sM()),Rh.exports}var F=oM(),Oh={exports:{}},ge={};/**
|
|
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 $0;function aM(){if($0)return ge;$0=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),o=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"),m=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),g=Symbol.iterator;function b(E){return E===null||typeof E!="object"?null:(E=g&&E[g]||E["@@iterator"],typeof E=="function"?E:null)}var x={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},A=Object.assign,w={};function k(E,U,H){this.props=E,this.context=U,this.refs=w,this.updater=H||x}k.prototype.isReactComponent={},k.prototype.setState=function(E,U){if(typeof E!="object"&&typeof E!="function"&&E!=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,E,U,"setState")},k.prototype.forceUpdate=function(E){this.updater.enqueueForceUpdate(this,E,"forceUpdate")};function $(){}$.prototype=k.prototype;function M(E,U,H){this.props=E,this.context=U,this.refs=w,this.updater=H||x}var O=M.prototype=new $;O.constructor=M,A(O,k.prototype),O.isPureReactComponent=!0;var G=Array.isArray,V={H:null,A:null,T:null,S:null,V:null},W=Object.prototype.hasOwnProperty;function ne(E,U,H,Z,re,Te){return H=Te.ref,{$$typeof:t,type:E,key:U,ref:H!==void 0?H:null,props:Te}}function ee(E,U){return ne(E.type,U,void 0,void 0,void 0,E.props)}function ce(E){return typeof E=="object"&&E!==null&&E.$$typeof===t}function me(E){var U={"=":"=0",":":"=2"};return"$"+E.replace(/[=:]/g,function(H){return U[H]})}var be=/\/+/g;function Me(E,U){return typeof E=="object"&&E!==null&&E.key!=null?me(""+E.key):U.toString(36)}function Se(){}function he(E){switch(E.status){case"fulfilled":return E.value;case"rejected":throw E.reason;default:switch(typeof E.status=="string"?E.then(Se,Se):(E.status="pending",E.then(function(U){E.status==="pending"&&(E.status="fulfilled",E.value=U)},function(U){E.status==="pending"&&(E.status="rejected",E.reason=U)})),E.status){case"fulfilled":return E.value;case"rejected":throw E.reason}}throw E}function X(E,U,H,Z,re){var Te=typeof E;(Te==="undefined"||Te==="boolean")&&(E=null);var ie=!1;if(E===null)ie=!0;else switch(Te){case"bigint":case"string":case"number":ie=!0;break;case"object":switch(E.$$typeof){case t:case e:ie=!0;break;case y:return ie=E._init,X(ie(E._payload),U,H,Z,re)}}if(ie)return re=re(E),ie=Z===""?"."+Me(E,0):Z,G(re)?(H="",ie!=null&&(H=ie.replace(be,"$&/")+"/"),X(re,U,H,"",function(ln){return ln})):re!=null&&(ce(re)&&(re=ee(re,H+(re.key==null||E&&E.key===re.key?"":(""+re.key).replace(be,"$&/")+"/")+ie)),U.push(re)),1;ie=0;var Ye=Z===""?".":Z+":";if(G(E))for(var Ne=0;Ne<E.length;Ne++)Z=E[Ne],Te=Ye+Me(Z,Ne),ie+=X(Z,U,H,Te,re);else if(Ne=b(E),typeof Ne=="function")for(E=Ne.call(E),Ne=0;!(Z=E.next()).done;)Z=Z.value,Te=Ye+Me(Z,Ne++),ie+=X(Z,U,H,Te,re);else if(Te==="object"){if(typeof E.then=="function")return X(he(E),U,H,Z,re);throw U=String(E),Error("Objects are not valid as a React child (found: "+(U==="[object Object]"?"object with keys {"+Object.keys(E).join(", ")+"}":U)+"). If you meant to render a collection of children, use an array instead.")}return ie}function N(E,U,H){if(E==null)return E;var Z=[],re=0;return X(E,Z,"","",function(Te){return U.call(H,Te,re++)}),Z}function P(E){if(E._status===-1){var U=E._result;U=U(),U.then(function(H){(E._status===0||E._status===-1)&&(E._status=1,E._result=H)},function(H){(E._status===0||E._status===-1)&&(E._status=2,E._result=H)}),E._status===-1&&(E._status=0,E._result=U)}if(E._status===1)return E._result.default;throw E._result}var K=typeof reportError=="function"?reportError:function(E){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var U=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof E=="object"&&E!==null&&typeof E.message=="string"?String(E.message):String(E),error:E});if(!window.dispatchEvent(U))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",E);return}console.error(E)};function J(){}return ge.Children={map:N,forEach:function(E,U,H){N(E,function(){U.apply(this,arguments)},H)},count:function(E){var U=0;return N(E,function(){U++}),U},toArray:function(E){return N(E,function(U){return U})||[]},only:function(E){if(!ce(E))throw Error("React.Children.only expected to receive a single React element child.");return E}},ge.Component=k,ge.Fragment=n,ge.Profiler=o,ge.PureComponent=M,ge.StrictMode=r,ge.Suspense=h,ge.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=V,ge.__COMPILER_RUNTIME={__proto__:null,c:function(E){return V.H.useMemoCache(E)}},ge.cache=function(E){return function(){return E.apply(null,arguments)}},ge.cloneElement=function(E,U,H){if(E==null)throw Error("The argument must be a React element, but you passed "+E+".");var Z=A({},E.props),re=E.key,Te=void 0;if(U!=null)for(ie in U.ref!==void 0&&(Te=void 0),U.key!==void 0&&(re=""+U.key),U)!W.call(U,ie)||ie==="key"||ie==="__self"||ie==="__source"||ie==="ref"&&U.ref===void 0||(Z[ie]=U[ie]);var ie=arguments.length-2;if(ie===1)Z.children=H;else if(1<ie){for(var Ye=Array(ie),Ne=0;Ne<ie;Ne++)Ye[Ne]=arguments[Ne+2];Z.children=Ye}return ne(E.type,re,void 0,void 0,Te,Z)},ge.createContext=function(E){return E={$$typeof:c,_currentValue:E,_currentValue2:E,_threadCount:0,Provider:null,Consumer:null},E.Provider=E,E.Consumer={$$typeof:u,_context:E},E},ge.createElement=function(E,U,H){var Z,re={},Te=null;if(U!=null)for(Z in U.key!==void 0&&(Te=""+U.key),U)W.call(U,Z)&&Z!=="key"&&Z!=="__self"&&Z!=="__source"&&(re[Z]=U[Z]);var ie=arguments.length-2;if(ie===1)re.children=H;else if(1<ie){for(var Ye=Array(ie),Ne=0;Ne<ie;Ne++)Ye[Ne]=arguments[Ne+2];re.children=Ye}if(E&&E.defaultProps)for(Z in ie=E.defaultProps,ie)re[Z]===void 0&&(re[Z]=ie[Z]);return ne(E,Te,void 0,void 0,null,re)},ge.createRef=function(){return{current:null}},ge.forwardRef=function(E){return{$$typeof:d,render:E}},ge.isValidElement=ce,ge.lazy=function(E){return{$$typeof:y,_payload:{_status:-1,_result:E},_init:P}},ge.memo=function(E,U){return{$$typeof:m,type:E,compare:U===void 0?null:U}},ge.startTransition=function(E){var U=V.T,H={};V.T=H;try{var Z=E(),re=V.S;re!==null&&re(H,Z),typeof Z=="object"&&Z!==null&&typeof Z.then=="function"&&Z.then(J,K)}catch(Te){K(Te)}finally{V.T=U}},ge.unstable_useCacheRefresh=function(){return V.H.useCacheRefresh()},ge.use=function(E){return V.H.use(E)},ge.useActionState=function(E,U,H){return V.H.useActionState(E,U,H)},ge.useCallback=function(E,U){return V.H.useCallback(E,U)},ge.useContext=function(E){return V.H.useContext(E)},ge.useDebugValue=function(){},ge.useDeferredValue=function(E,U){return V.H.useDeferredValue(E,U)},ge.useEffect=function(E,U,H){var Z=V.H;if(typeof H=="function")throw Error("useEffect CRUD overload is not enabled in this build of React.");return Z.useEffect(E,U)},ge.useId=function(){return V.H.useId()},ge.useImperativeHandle=function(E,U,H){return V.H.useImperativeHandle(E,U,H)},ge.useInsertionEffect=function(E,U){return V.H.useInsertionEffect(E,U)},ge.useLayoutEffect=function(E,U){return V.H.useLayoutEffect(E,U)},ge.useMemo=function(E,U){return V.H.useMemo(E,U)},ge.useOptimistic=function(E,U){return V.H.useOptimistic(E,U)},ge.useReducer=function(E,U,H){return V.H.useReducer(E,U,H)},ge.useRef=function(E){return V.H.useRef(E)},ge.useState=function(E){return V.H.useState(E)},ge.useSyncExternalStore=function(E,U,H){return V.H.useSyncExternalStore(E,U,H)},ge.useTransition=function(){return V.H.useTransition()},ge.version="19.1.0",ge}var j0;function Sm(){return j0||(j0=1,Oh.exports=aM()),Oh.exports}var B=Sm();const mp=rM(B),j1=iM({__proto__:null,default:mp},[B]),{NODE_ENV:lM}=globalThis.env??{},uM=lM==="development";function Vu(){}function cM(t,e){if(uM){const n=B.useRef(Vu);B.useEffect(()=>{let r=n.current;if(r===Vu)r=t()??Vu,n.current=r;else return()=>{r(),n.current=Vu}},e)}else B.useEffect(t,e)}function hc(t){cM(t,[])}function Vc(t=Math.random){return t().toString(36).slice(2)}class yp extends Promise{fate;resolve;reject;done=!1;constructor(e){let n,r;super((o,u)=>{n=o,r=u}),this.resolve=n,this.reject=r,this.use(e instanceof Promise?e:new Promise(e))}pass(e,n){e===this.fate&&(this.resolve(n),this.done=!0)}fail(e,n){e===this.fate&&(this.reject(n),this.done=!0)}use(e){if(e instanceof Promise){const n=e;this.fate=n,n.then(r=>{this.pass(n,r)},r=>{this.fail(n,r)})}else this.resolve(e),this.fate=void 0}}function fM(t){return Object.entries(t)}const dM=(t,e,n=wn.STORE)=>K1(n,{key:`${t.key}:JSON`,get:({get:r})=>e.toJson(r(t)),set:({set:r},o)=>{r(t,e.fromJson(o))}}),ko=t=>JSON.parse(t),Ln=t=>JSON.stringify(t);function ve(t){for(;t.child!==null;)t=t.child;return t}class xm{_buffer;_index=0;constructor(e){let n;typeof e=="number"?n=e:n=e.length,this._buffer=Array.from({length:n})}get buffer(){return this._buffer}get index(){return this._index}add(e){this._buffer[this._index]=e,this._index=(this._index+1)%this._buffer.length}copy(){const e=new xm([...this._buffer]);return e._index=this._index,e}}const hM={atom_family:"atom",molecule_family:"molecule",mutable_atom_family:"mutable_atom",readonly_held_selector_family:"readonly_held_selector",readonly_pure_selector_family:"readonly_pure_selector",writable_held_selector_family:"writable_held_selector",writable_pure_selector_family:"writable_pure_selector"};function pM(t,e){const n=Ln(e),r=`${t.key}(${n})`,o=hM[t.type],u={key:r,type:o};return Object.assign(u,{family:{key:t.key,subKey:n}}),Object.assign(u,{counterfeit:!0}),u}function vo(t){const e={key:t.key,type:t.type};return"family"in t&&(e.family=t.family),e}function at(t){return iC(wn.STORE,t)}function We(...t){return t.length===2?Vi(wn.STORE,...t):Vi(wn.STORE,...t)}const _h=t=>(e,n,r,o,...u)=>{console[t](`${e} ${n} "${r}" ${o}`,...u)},mM={error:_h("error"),info:_h("info"),warn:_h("warn")};class yM{logLevel;filter;logger;constructor(e,n,r=mM){this.logLevel=e,this.filter=n,this.logger=r}error=(...e)=>{const n=this.filter?.(...e)??!0;this.logLevel!==null&&(n===!0?this.logger.error(...e):n!==!1&&this.logger.error(...n))};info=(...e)=>{const n=this.filter?.(...e)??!0;this.logLevel==="info"&&(n===!0?this.logger.info(...e):n!==!1&&this.logger.info(...n))};warn=(...e)=>{const n=this.filter?.(...e)??!0;this.logLevel!=="error"&&this.logLevel!==null&&(n===!0?this.logger.warn(...e):n!==!1&&this.logger.warn(...n))}}function di(t){return K1(wn.STORE,t)}function De(...t){t.length===2?Ct(wn.STORE,...t):Ct(wn.STORE,...t)}function gM(t,e,n=Vc()){return JM(wn.STORE,t,e,n)}function vM(t){return X1(wn.STORE,t)}function bM(t,e=Vc()){return Am(wn.STORE,t,e)}class sn{a;b;cardinality;relations=new Map;contents=new Map;isAType;isBType;isContent;makeContentKey=(e,n)=>`${e}:${n}`;warn;getRelatedKeys(e){return this.relations.get(e)}addRelation(e,n){let r=this.relations.get(e),o=this.relations.get(n);r?r.add(n):(r=new Set([n]),this.relations.set(e,r)),o?o.add(e):(o=new Set([e]),this.relations.set(n,o))}deleteRelation(e,n){const r=this.relations.get(e);if(r){r.delete(n),r.size===0&&this.relations.delete(e);const o=this.relations.get(n);o&&(o.delete(e),o.size===0&&this.relations.delete(n))}}replaceRelationsUnsafely(e,n){this.relations.set(e,new Set(n));for(const r of n){const o=new Set().add(e);this.relations.set(r,o)}}replaceRelationsSafely(e,n){const r=this.relations.get(e);let o=this.isAType?.(e)?e:void 0,u=o===void 0?e:void 0;if(r)for(const c of r){o??=c,u??=c;const d=this.relations.get(c);d&&(d.size===1?this.relations.delete(c):d.delete(e),this.contents.delete(this.makeContentKey(o,u)))}this.relations.set(e,new Set(n));for(const c of n){let d=this.relations.get(c);d?d.add(e):(d=new Set().add(e),this.relations.set(c,d))}}getContentInternal(e){return this.contents.get(e)}setContent(e,n){this.contents.set(e,n)}deleteContent(e){this.contents.delete(e)}constructor(e,n){if(this.a=e.between[0],this.b=e.between[1],this.cardinality=e.cardinality,n?.externalStore||(this.relations=new Map(e.relations?.map(([r,o])=>[r,new Set(o)])),this.contents=new Map(e.contents)),this.isAType=n?.isAType??null,this.isBType=n?.isBType??null,this.isContent=n?.isContent??null,n?.makeContentKey&&(this.makeContentKey=n.makeContentKey),n?.externalStore){const r=n.externalStore;this.has=(o,u)=>r.has(o,u),this.addRelation=(o,u)=>{r.addRelation(o,u)},this.deleteRelation=(o,u)=>{r.deleteRelation(o,u)},this.replaceRelationsSafely=(o,u)=>{r.replaceRelationsSafely(o,u)},this.replaceRelationsUnsafely=(o,u)=>{r.replaceRelationsUnsafely(o,u)},this.getRelatedKeys=o=>r.getRelatedKeys(o),r.getContent&&(this.getContentInternal=o=>r.getContent(o),this.setContent=(o,u)=>{r.setContent(o,u)},this.deleteContent=o=>{r.deleteContent(o)});for(const[o,u]of e.relations??[]){let c=this.isAType?.(o)?o:void 0,d=c===void 0?o:void 0;for(const h of u)c??=h,d??=h,this.addRelation(c,d)}for(const[o,u]of e.contents??[])this.setContent(o,u)}n?.warn&&(this.warn=n.warn)}toJSON(){return{between:[this.a,this.b],cardinality:this.cardinality,relations:[...this.relations.entries()].map(([e,n])=>[e,[...n]]),contents:[...this.contents.entries()]}}set(...e){let n,r,o;switch(e.length){case 1:{const u=e[0];n=u[this.a],r=u[this.b],o=void 0;break}case 2:{const u=e[0];typeof u=="string"?[n,r]=e:(n=u[this.a],r=u[this.b],o=e[1]);break}default:{n=e[0],r=e[1],o=e[2];break}}switch(this.cardinality){case"1:1":{const u=this.getRelatedKey(n);u&&u!==r&&this.delete(n,u)}case"1:n":{const u=this.getRelatedKey(r);u&&u!==n&&this.delete(u,r)}break}if(o){const u=this.makeContentKey(n,r);this.setContent(u,o)}return this.addRelation(n,r),this}delete(e,n){n=typeof n=="string"?n:e[this.b];const r=typeof e=="string"?e:e[this.a];if(r===void 0&&typeof n=="string"){const o=this.getRelatedKeys(n);if(o)for(const u of o)this.delete(u,n)}if(typeof r=="string"&&n===void 0){const o=this.getRelatedKeys(r);if(o)for(const u of o)this.delete(r,u)}if(typeof r=="string"&&typeof n=="string"){this.deleteRelation(r,n);const o=this.makeContentKey(r,n);this.deleteContent(o)}return this}getRelatedKey(e){const n=this.getRelatedKeys(e);if(n){n.size>1&&this.warn?.(`${n.size} related keys were found for key "${e}": (${[...n].map(o=>`"${o}"`).join(", ")}). Only one related key was expected.`);let r;for(const o of n){r=o;break}return r}}replaceRelations(e,n,r){const o=!Array.isArray(n),u=o?Object.keys(n):n;if(r?.reckless?this.replaceRelationsUnsafely(e,u):this.replaceRelationsSafely(e,u),o)for(const c of u){const d=this.makeContentKey(e,c),h=n[c];this.setContent(d,h)}return this}getContent(e,n){const r=this.makeContentKey(e,n);return this.getContentInternal(r)}getRelationEntries(e){const n=e[this.a],r=e[this.b];if(n!==void 0&&r===void 0){const o=this.getRelatedKeys(n);if(o)return[...o].map(u=>[u,this.getContent(n,u)])}if(n===void 0&&r!==void 0){const o=this.getRelatedKeys(r);if(o)return[...o].map(u=>[u,this.getContent(u,r)])}return[]}has(e,n){return n?this.getRelatedKeys(e)?.has(n)??!1:this.relations.has(e)}}class qt{Subscriber;subscribers=new Map;subscribe(e,n){return this.subscribers.set(e,n),()=>{this.unsubscribe(e)}}unsubscribe(e){this.subscribers.delete(e)}next(e){const n=this.subscribers.values();for(const r of n)r(e)}}class SM extends qt{state;constructor(e){super(),this.state=e}next(e){this.state=e,super.next(e)}}function hi(t){return"epoch"in t.transactionMeta}function Ft(t){return"phase"in t.transactionMeta}const xM=t=>{const e=ve(t);if(!Ft(e)){t.logger.warn("๐","transaction","???","abortTransaction called outside of a transaction. This is probably a bug in AtomIO.");return}t.logger.info("๐ช","transaction",e.transactionMeta.update.key,"Aborting transaction"),e.parent.child=null};function B1(t){return t[0].toUpperCase()+t.slice(1)}function wM(t){return t.type.split("_").map(B1).join(" ")}class wm extends Error{constructor(e,n){super(`${wM(e)} ${Ln(e.key)} not found in store "${n.config.name}".`)}}function Am(t,e,n){return(...r)=>{const o=_t(t,e);if(o)return o.run(r,n);throw new wm(e,t)}}const Tm=t=>e=>t instanceof Function?t(e):t,zc=(t,e)=>{if(t.valueMap.has(e.key))return t.logger.info("๐",e.type,e.key,"reading cached value"),WM(e,t);switch(e.type){case"readonly_held_selector":case"readonly_pure_selector":case"writable_held_selector":case"writable_pure_selector":return t.logger.info("๐งฎ",e.type,e.key,"computing value"),e.get();case"atom":case"mutable_atom":{const n=e.default;let r;return n instanceof Function?r=n():r=n,t.logger.info("๐","atom",e.key,"could not find cached value; using default",r),r}}},AM=(t,e)=>{if(t.operation.open){const n=performance.now();return t.logger.info("โ",e.type,e.key,`deferring setState at T-${n} until setState for "${t.operation.token.key}" is done`),n}t.operation={open:!0,done:new Set,prev:new Map,time:Date.now(),token:e},t.logger.info("โญ",e.type,e.key,`operation start in store "${t.config.name}"${Ft(t)?` ${t.transactionMeta.phase} "${t.transactionMeta.update.key}"`:""}`)},TM=t=>{t.operation.open&&t.logger.info("๐ด",t.operation.token.type,t.operation.token.key,`operation done in store "${t.config.name}"`),t.operation={open:!1},t.on.operationClose.next(t.operation)},EM=(t,e)=>t.operation.open?t.operation.done.has(e):(t.logger.error("๐","unknown",e,"isDone called outside of an operation. This is probably a bug in AtomIO."),!0),Uc=(t,e)=>{if(!t.operation.open){t.logger.error("๐","unknown",e,"markDone called outside of an operation. This is probably a bug in AtomIO.");return}t.operation.done.add(e)},RM=(t,e,n)=>{switch(e.type){case"mutable_atom":t.logger.info("๐ข",e.type,e.key,"is now (",n.newValue,") subscribers:",e.subject.subscribers);break;case"atom":case"writable_pure_selector":case"readonly_pure_selector":case"writable_held_selector":case"readonly_held_selector":t.logger.info("๐ข",e.type,e.key,"went (",n.oldValue,"->",n.newValue,") subscribers:",e.subject.subscribers)}e.subject.next(n)},B0=(t,e)=>{const n=ve(t),r=n.selectorAtoms.getRelatedKeys(e.key);if(n.logger.info("๐งน",e.type,e.key,r?`evicting ${r.size} states downstream:`:"no downstream states",r??"to evict"),r){n.operation.open&&n.logger.info("๐งน",e.type,e.key,`[ ${[...n.operation.done].join(", ")} ] already done`);for(const o of r)EM(n,o)||(eC(o,n),Uc(n,o))}},OM=(t,e,n)=>{const r=zc(t,e);let o=r;if(e.type==="mutable_atom"&&Ft(t)){const{parent:c}=t;o=vp(t,e,c)}o=Tm(n)(o),t.logger.info("๐","atom",e.key,"set to",o),o=ui(t,e.key,o,e.subject),tC(t,e.key)&&nC(t,e.key),Uc(t,e.key),B0(t,e);const u={oldValue:r,newValue:o};if(!Ft(t)){RM(t,e,u);return}if(t.on.transactionApplying.state===null){const{key:c}=e;if(QM(u.newValue))return;const d={type:"atom_update",key:c,...u};e.family&&(d.family=e.family),t.transactionMeta.update.updates.push(d),t.logger.info("๐","atom",c,"stowed (",u.oldValue,"->",u.newValue,")")}else if(e.key.startsWith("*")){const c=e.key.slice(1),d=t.atoms.get(c);let h=t.valueMap.get(c);if(d.type==="mutable_atom"&&Ft(t)){const{parent:y}=t;h=vp(t,d,y)}h.do(u.newValue)===null&&B0(t,d)}},L1=(t,e,n)=>{switch(e.type){case"atom":case"mutable_atom":OM(t,e,n);break;case"writable_pure_selector":case"writable_held_selector":e.set(n);break}},Em=(t,e)=>ve(t).atoms.has(e),_M=(t,e)=>ve(t).writableSelectors.has(e),MM=(t,e)=>ve(t).readonlySelectors.has(e),CM=(t,e)=>Em(t,e)||_M(t,e)||MM(t,e),gp=(t,e)=>ve(t).selectorGraph.getRelationEntries({downstreamSelectorKey:e}).filter(([r,{source:o}])=>o!==e).map(([r,{source:o}])=>o).filter(r=>CM(t,r)),V1=(t,e,n)=>{const r=[],o=gp(t,e);for(;o.length>0;){const u=o.shift();n.has(u)||(n.add(u),Em(t,u)?r.includes(u)||r.push(u):o.push(...gp(t,u)))}return r},kM=(t,e)=>{const n=t.key,r=gp(e,n),o=new Set;return r.flatMap(u=>Em(e,u)?u:V1(e,u,o))},DM=(t,e,n,r,o)=>{const u=ve(t),{type:c,key:d}=r;if(c==="atom"||c==="mutable_atom")u.selectorAtoms.set({selectorKey:n,atomKey:d}),t.logger.info("๐",e,n,`discovers root atom "${d}"`);else{const h=V1(t,d,o);t.logger.info("๐",e,n,`discovers root atoms: [ ${h.map(m=>`"${m}"`).join(", ")} ]`);for(const m of h)u.selectorAtoms=u.selectorAtoms.set({selectorKey:n,atomKey:m})}o.add(d)},qc=(t,e,n,r)=>({get:(...o)=>{const u=ve(t);let c;if(o.length===2){const[y,g]=o;c=Sn(t,y,g)}else[c]=o;const d=_t(t,c),h=zc(t,d),m=c.key;return t.logger.info("๐",e,n,`registers dependency ( "${m}" =`,h,")"),u.selectorGraph.set({upstreamSelectorKey:m,downstreamSelectorKey:n},{source:c.key}),DM(t,e,n,c,r),h},set:(...o)=>{let u,c;if(o.length===2)u=o[0],c=o[1];else{const m=o[0],y=o[1];c=o[2],u=Sn(t,m,y)}const d=ve(t),h=_t(d,u);L1(d,h,c)},find:(...o)=>Sn(t,...o),json:o=>Kc(t,o)}),z1=(t,e,n)=>{const r=ve(t),o=new qt,u=new Set,{key:c,const:d}=e,h="readonly_held_selector",{get:m,find:y,json:g}=qc(r,h,c,u),x={...e,type:h,subject:o,install:w=>z1(w,e,n),get:()=>(e.get({get:m,find:y,json:g},d),ui(ve(t),c,d,o),u.clear(),d),...n};return r.readonlySelectors.set(c,x),t.logger.info("โจ",h,c,"=",d),{key:c,type:h}},U1=(t,e,n)=>{const r=ve(t),o=new qt,u=new Set,c=e.key,d="readonly_pure_selector",{get:h,find:m,json:y}=qc(r,d,c,u),g=()=>{const w=e.get({get:h,find:m,json:y});return ui(ve(t),c,w,o),u.clear(),w},b={...e,type:d,subject:o,install:w=>U1(w,e,n),get:g,...n};r.readonlySelectors.set(c,b);const x=g();return t.logger.info("โจ",d,c,"=",x),{key:c,type:d}},q1=(t,e,n)=>{const r=ve(t),o=new qt,u=new Set,{key:c,const:d}=e,h="writable_held_selector",m=qc(r,h,c,u),{find:y,get:g,json:b}=m,x={find:y,get:g,json:b},A=(O=e.get,G=ve(t))=>(O(x,d),ui(G,c,d,o),u.clear(),d),k={...e,type:h,subject:o,install:O=>q1(O,e,n),get:A,set:O=>{const G=ve(t),V=A(e.get,G),W=Tm(O)(V);t.logger.info("๐",h,c,"set (",V,"->",W,")"),ui(G,c,W,o),Uc(G,c),hi(G)&&o.next({newValue:W,oldValue:V}),e.set(m,W)},...n};r.writableSelectors.set(c,k);const $=A();return t.logger.info("โจ",h,c,"=",$),{key:c,type:h}},P1=(t,e,n)=>{const r=ve(t),o=new qt,u=new Set,c=e.key,d="writable_pure_selector",h=qc(r,d,c,u),{find:m,get:y,json:g}=h,b={find:m,get:y,json:g},x=(M=e.get,O=ve(t))=>{const G=M(b);return ui(O,c,G,o),u.clear(),G},w={...e,type:d,subject:o,install:M=>P1(M,e,n),get:x,set:M=>{const O=ve(t),G=x(e.get,O),V=Tm(M)(G);t.logger.info("๐",d,c,"set (",G,"->",V,")"),ui(O,e.key,V,o),Uc(O,e.key),hi(O)&&o.next({newValue:V,oldValue:G}),e.set(h,V)},...n};r.writableSelectors.set(c,w);const k=x();return t.logger.info("โจ",w.type,w.key,"=",k),{key:c,type:d}};function K1(t,e){const n="set"in e,r="const"in e;if(r&&n){const u=q1(t,e,void 0);return t.on.selectorCreation.next(u),u}if(r){const u=z1(t,e,void 0);return t.on.selectorCreation.next(u),u}if(n){const u=P1(t,e,void 0);return t.on.selectorCreation.next(u),u}const o=U1(t,e,void 0);return t.on.selectorCreation.next(o),o}function NM(t,e){const n=ve(t),{key:r,type:o}=e,u=_t(n,e);if(!u.family)t.logger.error("โ",o,r,"Standalone selectors cannot be disposed.");else{n.molecules.get(u.family.subKey)&&n.moleculeData.delete(u.family.subKey,u.family.key);let d;switch(e.type){case"writable_held_selector":n.writableSelectors.delete(r),d={key:u.family.key,type:"writable_held_selector_family"},_t(t,d).subject.next({type:"state_disposal",subType:"selector",token:e});break;case"writable_pure_selector":n.writableSelectors.delete(r),d={key:u.family.key,type:"writable_pure_selector_family"},_t(t,d).subject.next({type:"state_disposal",subType:"selector",token:e});break;case"readonly_held_selector":n.readonlySelectors.delete(r),d={key:u.family.key,type:"readonly_held_selector_family"},_t(t,d).subject.next({type:"state_disposal",subType:"selector",token:e});break;case"readonly_pure_selector":n.readonlySelectors.delete(r),d={key:u.family.key,type:"readonly_pure_selector_family"},_t(t,d).subject.next({type:"state_disposal",subType:"selector",token:e});break}n.valueMap.delete(r),n.selectorAtoms.delete(r),n.selectorGraph.delete(r),t.logger.info("๐ฅ",e.type,r,"deleted"),Ft(n)&&n.transactionMeta.phase==="building"?n.transactionMeta.update.updates.push({type:"state_disposal",subType:"selector",token:e}):t.on.selectorDisposal.next(e)}}function $M(t,e,n){const r=t.families.get(e.key);if(r===void 0)throw new wm(e,t);const o=r(n),u=ve(t);if(o.family)if(hi(u))switch(o.type){case"atom":case"mutable_atom":t.on.atomCreation.next(o);break;case"writable_pure_selector":case"readonly_pure_selector":case"writable_held_selector":case"readonly_held_selector":t.on.selectorCreation.next(o);break}else Ft(u)&&u.on.transactionApplying.state===null&&u.transactionMeta.update.updates.push({type:"state_creation",token:o});return o}function jM(t,e,n){const r=Ln(n),o=`${e.key}(${r})`,u=ve(t);let c;switch(e.type){case"atom_family":case"mutable_atom_family":c=u.atoms.get(o);break;case"writable_held_selector_family":case"writable_pure_selector_family":c=u.writableSelectors.get(o);break;case"readonly_held_selector_family":case"readonly_pure_selector_family":c=u.readonlySelectors.get(o);break}return c&&vo(c)}function Sn(t,e,n){let r=jM(t,e,n);if(r)return r;const o=Ln(n),u=t.molecules.get(o);if(!u&&t.config.lifespan==="immortal"){const c=pM(e,n);return t.logger.error("โ",c.type,c.key,`was not found in store "${t.config.name}"; returned a counterfeit token.`),c}return r=$M(t,e,n),u&&ve(t).moleculeData.set(o,e.key),r}function Pc(t,...e){let n;if(e.length===1)n=e[0];else{const r=e[0],o=e[1];n=Sn(t,r,o)}try{_t(t,n)}catch{t.logger.error("โ",n.type,n.key,`could not be disposed because it was not found in the store "${t.config.name}".`);return}switch(n.type){case"atom":case"mutable_atom":Mm(t,n);break;case"writable_pure_selector":case"readonly_pure_selector":case"writable_held_selector":case"readonly_held_selector":NM(t,n);break}}function BM(t,e){if(e.family){const n=t.families.get(e.family.key);if(n)return n}}function Ct(t,...e){let n,r,o,u;if(e.length===2?(n=e[0],u=e[1],r=BM(t,n)??null,r&&(o=n.family?ko(n.family.subKey):null,n=Sn(t,r,o))):(r=e[0],o=e[1],u=e[2],n=Sn(t,r,o)),"counterfeit"in n&&"family"in n){const h=n.family.subKey,m=t.disposalTraces.buffer.find(y=>y?.key===h);t.logger.error("โ",n.type,n.key,`could not be set because it was not found in the store "${t.config.name}".`,m?`This state was previously disposed:
|
|
18
|
-
${m.trace}`:"No previous disposal trace was found.");return}const c=AM(t,n);if(c){const h=t.on.operationClose.subscribe(`waiting to set "${n.key}" at T-${c}`,()=>{h(),t.logger.info("๐ข",n.type,n.key,`resuming deferred setState from T-${c}`),Ct(t,n,u)});return}const d=_t(t,n);L1(t,d,u),TM(t)}function LM(t,e,n){const{key:r,newValue:o,oldValue:u}=e,c=t==="newValue"?o:u,d={key:r,type:"atom"};e.family&&Object.assign(d,{family:e.family}),Ct(n,d,c)}function VM(t){const{stack:e}=t;return e?`
|
|
19
|
-
`+e.split(`
|
|
20
|
-
`)?.slice(1)?.join(`
|
|
21
|
-
`):""}function I1(t,e,n,r="any"){const o=e,u=Ln(n),c=[],d=ve(t);if(Array.isArray(o))for(const y of o){const g=Ln(y);d.molecules.get(g)?t.moleculeGraph.set(g,u,{source:g}):c.push(g)}else{const y=Ln(o);d.molecules.get(y)?t.moleculeGraph.set(y,u,{source:y}):c.push(y)}c.length===0&&d.molecules.set(u,{key:n,stringKey:u,dependsOn:r});const h={type:"molecule_creation",key:n,provenance:o};Ft(d)&&d.transactionMeta.phase==="building"?d.transactionMeta.update.updates.push(h):d.on.moleculeCreation.next(h);for(const y of c){const g=t.disposalTraces.buffer.find(b=>b?.key===y);t.logger.error("โ","molecule",n,"allocation failed:",`Could not allocate to ${y} in store "${t.config.name}".`,g?`
|
|
22
|
-
${y} was most recently disposed
|
|
23
|
-
${g.trace}`:`No previous disposal trace for ${y} was found.`)}return n}function Rm(t,e){const n=Ln(e),r=t.molecules.get(n);if(!r){const x=t.disposalTraces.buffer.find(A=>A?.key===n);t.logger.error("โ","molecule",e,"deallocation failed:",`Could not find allocation for ${n} in store "${t.config.name}".`,x?`
|
|
24
|
-
This state was most recently deallocated
|
|
25
|
-
${x.trace}`:`No previous disposal trace for ${n} was found.`);return}const o=t.moleculeJoins.getRelatedKeys(r.key);if(o)for(const x of o){const A=t.joins.get(x);A&&(A.relations.delete(r.key),A.molecules.delete(r.stringKey))}t.moleculeJoins.delete(r.stringKey);const u=[],c=[],d={type:"molecule_disposal",key:r.key,values:c,provenance:u},h=ve(t);h.molecules.delete(n);const m=Ft(h)&&h.transactionMeta.phase==="building";m&&h.transactionMeta.update.updates.push(d);const y=t.moleculeGraph.getRelationEntries({downstreamMoleculeKey:r.stringKey});if(y)for(const[x,{source:A}]of y)if(A===r.stringKey){const w=ko(x);Rm(t,w)}else u.push(A);const g=h.moleculeData.getRelatedKeys(r.stringKey);if(g)for(const x of g){const A=h.families.get(x),w=Sn(t,A,r.key);c.push([A.key,w]),Pc(t,w)}h.moleculeGraph.delete(r.stringKey),h.moleculeJoins.delete(r.stringKey),h.moleculeData.delete(r.stringKey),m||h.on.moleculeDisposal.next(d),h.molecules.delete(r.stringKey);const b=VM(new Error);t.disposalTraces.add({key:n,trace:b})}function L0(t,e,n,r){const o=Ln(n),u=ve(t),c=u.molecules.get(o);if(!c){const b=t.disposalTraces.buffer.find(x=>x?.key===o);return t.logger.error("โ","molecule",n,"claim failed:",`Could not allocate to ${o} in store "${t.config.name}".`,b?`
|
|
26
|
-
${o} was most recently disposed
|
|
27
|
-
${b.trace}`:`No previous disposal trace for ${o} was found.`),n}const d=Ln(e),h=u.molecules.get(d);if(!h){const b=t.disposalTraces.buffer.find(x=>x?.key===d);return t.logger.error("โ","molecule",n,"claim failed:",`Could not allocate to ${d} in store "${t.config.name}".`,b?`
|
|
28
|
-
${d} was most recently disposed
|
|
29
|
-
${b.trace}`:`No previous disposal trace for ${d} was found.`),n}const m=t.moleculeGraph.getRelationEntries({downstreamMoleculeKey:c.stringKey}).filter(([,{source:b}])=>b!==o).map(([b])=>ko(b));u.moleculeGraph.delete(o),u.moleculeGraph.set({upstreamMoleculeKey:h.stringKey,downstreamMoleculeKey:c.stringKey},{source:h.stringKey});const y={type:"molecule_transfer",key:c.key,from:m,to:[h.key]};return Ft(u)&&u.transactionMeta.phase==="building"&&u.transactionMeta.update.updates.push(y),n}function zM(t,e,n){switch(e){case"newValue":{H1(t,n);break}case"oldValue":{Pc(n,t.token);break}}}function UM(t,e,n){switch(e){case"newValue":{Pc(n,t.token);break}case"oldValue":{H1(t,n),t.subType==="atom"&&n.valueMap.set(t.token.key,t.value);break}}}function H1(t,e){const{family:n}=t.token;if(n){const r=e.families.get(n.key);r&&Sn(e,r,ko(n.subKey))}}function qM(t,e,n){switch(e){case"newValue":I1(n,t.provenance,t.key);break;case"oldValue":Rm(n,t.key);break}}function PM(t,e,n){switch(e){case"newValue":Rm(n,t.key);break;case"oldValue":{const r=t.provenance.map(ko);I1(n,r,t.key);for(const[o,u]of t.values){const c=n.families.get(o);if(c){Sn(n,c,t.key);const d=`${o}(${Ln(t.key)})`;n.valueMap.set(d,u)}}}break}}function KM(t,e,n){switch(e){case"newValue":{const r=t.to.length===1?t.to[0]:t.to;L0(n,r,t.key)}break;case"oldValue":{const r=t.from.length===1?t.from[0]:t.from;L0(n,r,t.key)}break}}function ro(t,e,n){const r=t==="newValue"?e.updates:[...e.updates].reverse();for(const o of r)switch(o.type){case"atom_update":case"selector_update":LM(t,o,n);break;case"state_creation":zM(o,t,n);break;case"state_disposal":UM(o,t,n);break;case"molecule_creation":qM(o,t,n);break;case"molecule_disposal":PM(o,t,n);break;case"molecule_transfer":KM(o,t,n);break;case"transaction_update":ro(t,o,n);break}}function F1(t,e){return t.transactionMeta.actionContinuities.getRelatedKey(e)}function G1(t,e){return t.transactionMeta.epoch.get(e)}function IM(t,e){if(!hi(t))return;const r=F1(t,e);if(r!==void 0)return G1(t,r)}function Om(t,e,n){hi(t)&&e&&t.transactionMeta.epoch.set(e,n)}function HM(t,e,n){if(!hi(t))return;const o=F1(t,e);o!==void 0&&t.transactionMeta.epoch.set(o,n)}const FM=(t,e)=>{const n=ve(e),{parent:r}=n;if(r===null||!Ft(n)||n.transactionMeta?.phase!=="building"){e.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=t,r.child=null,r.on.transactionApplying.next(n.transactionMeta);const{updates:o}=n.transactionMeta.update;e.logger.info("๐","transaction",n.transactionMeta.update.key,`Applying transaction with ${o.length} updates:`,o),ro("newValue",n.transactionMeta.update,r),hi(r)?(HM(r,n.transactionMeta.update.key,n.transactionMeta.update.epoch),_t(e,{key:n.transactionMeta.update.key,type:"transaction"})?.subject.next(n.transactionMeta.update),e.logger.info("๐ฌ","transaction",n.transactionMeta.update.key,"Finished applying transaction.")):Ft(r)&&r.transactionMeta.update.updates.push(n.transactionMeta.update),r.on.transactionApplying.next(null)};function Y1(t,e,n){if(!hi(t))return;const{epoch:o,actionContinuities:u}=t.transactionMeta;u.set(e,n),o.has(e)||o.set(e,-1)}function GM(t){return{store:t}}function Vi(t,...e){let n,r,o;if(e.length===1?n=e[0]:(r=e[0],o=e[1],n=Sn(t,r,o)),"counterfeit"in n&&"family"in n){r=t.families.get(n.family.key);const u=n.family.subKey,c=t.disposalTraces.buffer.find(d=>d?.key===u);switch(t.logger.error("โ",n.type,n.key,`could not be retrieved because it was not found in the store "${t.config.name}".`,c?`This state was previously disposed:
|
|
30
|
-
${c.trace}`:"No previous disposal trace was found."),r.type){case"atom_family":case"mutable_atom_family":return t.defaults.get(r.key);case"readonly_pure_selector_family":case"writable_pure_selector_family":case"readonly_held_selector_family":case"writable_held_selector_family":{if(t.defaults.has(r.key))return t.defaults.get(n.family.key);const d=_t(t,r).default(u);return t.defaults.set(r.key,d),d}}}return zc(t,_t(t,n))}class ti extends Map{deleted=new Set;source;constructor(e){super(),this.source=e}get(e){if(super.has(e))return super.get(e);if(!this.deleted.has(e)&&this.source.has(e))return this.source.get(e)}set(e,n){return this.deleted.delete(e),super.set(e,n)}hasOwn(e){return super.has(e)}has(e){return!this.deleted.has(e)&&(super.has(e)||this.source.has(e))}delete(e){return this.deleted.add(e),super.delete(e)}}const YM=(t,e,n,r)=>{const o=ve(t),u={parent:o,child:null,on:o.on,loggers:o.loggers,logger:o.logger,config:o.config,atoms:new ti(o.atoms),atomsThatAreDefault:new Set(o.atomsThatAreDefault),families:new ti(o.families),joins:new ti(o.joins),operation:{open:!1},readonlySelectors:new ti(o.readonlySelectors),timelines:new ti(o.timelines),timelineTopics:new sn(o.timelineTopics.toJSON()),trackers:new Map,transactions:new ti(o.transactions),selectorAtoms:new sn(o.selectorAtoms.toJSON()),selectorGraph:new sn(o.selectorGraph.toJSON(),{makeContentKey:(...m)=>m.sort().join(":")}),writableSelectors:new ti(o.writableSelectors),valueMap:new ti(o.valueMap),defaults:o.defaults,disposalTraces:t.disposalTraces.copy(),molecules:new ti(o.molecules),moleculeGraph:new sn(o.moleculeGraph.toJSON(),{makeContentKey:o.moleculeGraph.makeContentKey}),moleculeData:new sn(o.moleculeData.toJSON(),{makeContentKey:o.moleculeData.makeContentKey}),moleculeJoins:new sn(o.moleculeJoins.toJSON(),{makeContentKey:o.moleculeJoins.makeContentKey}),miscResources:new ti(o.miscResources)},c=IM(t,e),d={phase:"building",update:{type:"transaction_update",key:e,id:r,epoch:c===void 0?Number.NaN:c+1,updates:[],params:n,output:void 0},toolkit:{get:(...m)=>Vi(h,...m),set:(...m)=>{Ct(h,...m)},run:(m,y=Vc())=>Am(h,m,y),find:(...m)=>Sn(t,...m),json:m=>Kc(h,m),dispose:(...m)=>{Pc(h,...m)},env:()=>GM(h)}},h=Object.assign(u,{transactionMeta:d});return o.child=h,t.logger.info("๐ซ","transaction",e,"Building transaction with params:",n),h};function X1(t,e){const n={key:e.key,type:"transaction",run:(u,c)=>{const d=YM(t,e.key,u,c);try{const h=ve(t),{toolkit:m}=d.transactionMeta,y=e.do(m,...u);return FM(y,h),y}catch(h){throw xM(r),t.logger.warn("๐ฅ","transaction",e.key,"caught:",h),h}},install:u=>X1(u,e),subject:new qt},r=ve(t);r.transactions.set(n.key,n);const o=vo(n);return t.on.transactionCreation.next(o),o}class XM{parent=null;child=null;valueMap=new Map;defaults=new Map;atoms=new Map;writableSelectors=new Map;readonlySelectors=new Map;atomsThatAreDefault=new Set;selectorAtoms=new sn({between:["selectorKey","atomKey"],cardinality:"n:n"});selectorGraph=new sn({between:["upstreamSelectorKey","downstreamSelectorKey"],cardinality:"n:n"},{makeContentKey:(...e)=>e.sort().join(":")});trackers=new Map;families=new Map;joins=new Map;transactions=new Map;transactionMeta={epoch:new Map,actionContinuities:new sn({between:["continuity","action"],cardinality:"1:n"})};timelines=new Map;timelineTopics=new sn({between:["timelineKey","topicKey"],cardinality:"1:n"});disposalTraces=new xm(100);molecules=new Map;moleculeJoins=new sn({between:["moleculeKey","joinKey"],cardinality:"n:n"},{makeContentKey:(...e)=>e.sort().join(":")});moleculeGraph=new sn({between:["upstreamMoleculeKey","downstreamMoleculeKey"],cardinality:"n:n"},{makeContentKey:(...e)=>e.sort().join(":")});moleculeData=new sn({between:["moleculeKey","stateFamilyKey"],cardinality:"n:n"},{makeContentKey:(...e)=>e.sort().join(":")});miscResources=new Map;on={atomCreation:new qt,atomDisposal:new qt,selectorCreation:new qt,selectorDisposal:new qt,timelineCreation:new qt,transactionCreation:new qt,transactionApplying:new SM(null),operationClose:new qt,moleculeCreation:new qt,moleculeDisposal:new qt};operation={open:!1};config={name:"IMPLICIT_STORE",lifespan:"ephemeral"};loggers=[new yM("warn",(e,n,r)=>!rC(r))];logger={error:(...e)=>{for(const n of this.loggers)n.error(...e)},info:(...e)=>{for(const n of this.loggers)n.info(...e)},warn:(...e)=>{for(const n of this.loggers)n.warn(...e)}};constructor(e,n=null){if(this.config={...n?.config,...e},n!==null){this.valueMap=new Map(n?.valueMap),this.operation={...n?.operation},hi(n)&&(this.transactionMeta={epoch:new Map(n?.transactionMeta.epoch),actionContinuities:new sn(n?.transactionMeta.actionContinuities.toJSON())});for(const[,o]of n.families)o.internalRoles?.includes("mutable")||o.internalRoles?.includes("join")||o.install(this);const r=new Set;for(const[,o]of n.atoms)if(!r.has(o.key)&&(o.install(this),o.type==="mutable_atom")){const u=Kc(n,o),c=ew(o);r.add(u.key),r.add(c.key)}for(const[,o]of n.readonlySelectors)o.install(this);for(const[,o]of n.writableSelectors)r.has(o.key)||o.install(this);for(const[,o]of n.transactions)o.install(this);for(const[,o]of n.timelines)o.install(this)}}}const wn={get STORE(){return globalThis.ATOM_IO_IMPLICIT_STORE??=new XM({name:"IMPLICIT_STORE",lifespan:"ephemeral"}),globalThis.ATOM_IO_IMPLICIT_STORE}};function _t(t,e){let n,r=t;for(;r!==null;){switch(e.type){case"atom":case"mutable_atom":n=r.atoms.get(e.key);break;case"writable_pure_selector":case"writable_held_selector":n=r.writableSelectors.get(e.key);break;case"readonly_pure_selector":case"readonly_held_selector":n=r.readonlySelectors.get(e.key);break;case"atom_family":case"mutable_atom_family":case"writable_pure_selector_family":case"readonly_pure_selector_family":case"writable_held_selector_family":case"readonly_held_selector_family":n=r.families.get(e.key);break;case"timeline":n=r.timelines.get(e.key);break;case"transaction":n=r.transactions.get(e.key);break}if(n)return n;r=r.child}throw new wm(e,t)}const ZM=(t,e)=>{const n=ve(t);return n.operation.open?n.operation.prev.get(e.key):n.valueMap.get(e.key)};function JM(t,e,n,r=Vc()){switch(e.type){case"atom":case"mutable_atom":case"readonly_pure_selector":case"readonly_held_selector":case"writable_pure_selector":case"writable_held_selector":return bo(t,e,r,n);case"transaction":return J1(t,e,r,n);case"timeline":return Z1(t,e,r,n)}}const V0=(t,e)=>{const n=ve(t);return kM(e,t).map(o=>{const u=n.atoms.get(o);if(u===void 0)throw new Error(`Atom "${o}", a dependency of selector "${e.key}", not found in store "${t.config.name}".`);return u.subject.subscribe(`${e.type}:${e.key}`,c=>{t.logger.info("๐ข",e.type,e.key,"root",o,"went",c.oldValue,"->",c.newValue);const d=ZM(n,e),h=zc(n,e);t.logger.info("โจ",e.type,e.key,"went",d,"->",h),e.subject.next({newValue:h,oldValue:d})})})};function bo(t,e,n,r){function o(g){if(t.operation.open){const b=t.on.operationClose.subscribe(`state subscription ${n}`,()=>{b(),r(g)})}else r(g)}const u=_t(t,e);t.logger.info("๐",u.type,u.key,`Adding subscription "${n}"`);const c=u.type==="writable_pure_selector"||u.type==="readonly_pure_selector";let d=null,h=o;c&&(d=V0(t,u),h=g=>{d&&(d.length=0,d.push(...V0(t,u))),o(g)});const m=u.subject.subscribe(n,h);return()=>{if(t.logger.info("๐",u.type,u.key,`Removing subscription "${n}"`),m(),d)for(const g of d)g()}}const Z1=(t,e,n,r)=>{const o=_t(t,e);t.logger.info("๐","timeline",e.key,`Adding subscription "${n}"`);const u=o.subject.subscribe(n,r);return()=>{t.logger.info("๐","timeline",e.key,`Removing subscription "${n}" from timeline`),u()}},J1=(t,e,n,r)=>{const o=_t(t,e);t.logger.info("๐","transaction",e.key,`Adding subscription "${n}"`);const u=o.subject.subscribe(n,r);return()=>{t.logger.info("๐","transaction",e.key,`Removing subscription "${n}"`),u()}};class Q1{initializeState(e,n){const r=`*${e.key}`;n.atoms.delete(r),n.valueMap.delete(r);const o=e.family?{key:`*${e.family.key}`,subKey:e.family.subKey}:void 0,u=_m(n,{key:r,default:null},o);if(n.parent?.valueMap.has(r)){const c=n.parent.valueMap.get(r);n.valueMap.set(r,c)}return u}unsubscribeFromInnerValue;unsubscribeFromState;observeCore(e,n,r){const o=`tracker:${r.config.name}:${Ft(r)?r.transactionMeta.update.key:"main"}:${e.key}`,u=Vi(r,e);this.unsubscribeFromInnerValue=u.subscribe(o,c=>{Ct(r,n,c)}),this.unsubscribeFromState=bo(r,e,o,c=>{c.newValue!==c.oldValue&&(this.unsubscribeFromInnerValue(),this.unsubscribeFromInnerValue=c.newValue.subscribe(o,d=>{Ct(r,n,d)}))})}updateCore(e,n,r){const o=`tracker:${r.config.name}:${Ft(r)?r.transactionMeta.update.key:"main"}:${e.key}`;bo(r,n,o,({newValue:u,oldValue:c})=>{const d=r.timelineTopics.getRelatedKey(n.key);if(d&&r.timelines.get(d)?.timeTraveling){const y=Z1(r,{key:d,type:"timeline"},o,g=>{y(),Ct(r,e,b=>(g==="redo"&&u?b.do(u):g==="undo"&&c&&b.undo(c),b))});return}const h=r.on.operationClose.subscribe(o,()=>{h();const m=Vi(r,e),y=u===null?-1:m.getUpdateNumber(u),g=y-m.cacheUpdateNumber;u&&g===1?Ct(r,e,b=>(b.do(u),b)):r.logger.info("โ","mutable_atom",e.key,`could not be updated. Expected update number ${m.cacheUpdateNumber+1}, but got ${y}`)})})}mutableState;latestUpdateState;[Symbol.dispose];constructor(e,n){this.mutableState=e;const r=ve(n);this.latestUpdateState=this.initializeState(e,r),this.observeCore(e,this.latestUpdateState,r),this.updateCore(e,this.latestUpdateState,r),r.trackers.set(e.key,this),this[Symbol.dispose]=()=>{this.unsubscribeFromInnerValue(),this.unsubscribeFromState(),r.trackers.delete(e.key)}}}function W1(t,e,n){t.logger.info("๐จ","atom",e.key,`creating in store "${t.config.name}"`);const r=ve(t),{key:o,default:u}=e,c=r.atoms.get(o),d="mutable_atom";if(c&&c.type===d)return t.logger.error("โ",d,o,"Tried to create atom, but it already exists in the store."),vo(c);const h=new qt,m={...e,type:d,install:b=>(b.logger.info("๐ ๏ธ","atom",o,`installing in store "${b.config.name}"`),W1(b,e)),subject:h},y=u();r.atoms.set(m.key,m),tw(t,o),ui(r,o,y,h);const g=vo(m);if(e.effects){let b=0;const x=[];for(const A of e.effects){const w=A({setSelf:k=>{Ct(t,g,k)},onSet:k=>bo(t,g,`effect[${b}]`,k)});w&&x.push(w),++b}m.cleanup=()=>{for(const A of x)A()}}return new Q1(g,t),dM(g,e,t),g}const Kc=(t,e)=>{if(e.family){const r=ve(t),u={key:`${e.family.key}:JSON`,type:"writable_pure_selector_family"},c=_t(r,u),d=JSON.parse(e.family.subKey);return Sn(t,c,d)}return{type:"writable_pure_selector",key:`${e.key}:JSON`}},ew=t=>{const n={type:"atom",key:`*${t.key}`};return t.family&&(n.family={key:`*${t.family.key}`,subKey:t.family.subKey}),n};function QM(t){return typeof t=="object"&&t!==null&&"do"in t&&"undo"in t&&"subscribe"in t}function vp(t,e,n){const r=n.valueMap.get(e.key),o=t.valueMap.get(e.key);if(r!==o)return o;if(r===void 0)return e.default();n.logger.info("๐","atom",e.key,"copying");const u=e.toJson(r),c=e.fromJson(u);return t.valueMap.set(e.key,c),new Q1(e,n),c}function ui(t,e,n,r){const o=t.valueMap.get(e);if(o instanceof yp&&o.use(n),n instanceof Promise){const u=new yp(n);return t.valueMap.set(e,u),u.then(c=>{ui(t,e,c,r),r.next({newValue:c,oldValue:u})}).catch(c=>{t.logger.error("๐ฅ","state",e,"rejected:",c)}),u}return t.valueMap.set(e,n),n}const WM=(t,e)=>{let n=e.valueMap.get(t.key);if(t.type==="mutable_atom"&&Ft(e)){const{parent:r}=e;n=vp(e,t,r)}return n},eC=(t,e)=>{const n=e.valueMap.get(t);if(n instanceof yp){const r=n,o=e.writableSelectors.get(t)??e.readonlySelectors.get(t);o&&r.use(o.get());return}e.operation.open&&e.operation.prev.set(t,n),e.valueMap.delete(t),e.logger.info("๐","state",t,"evicted")},tC=(t,e)=>ve(t).atomsThatAreDefault.has(e),tw=(t,e)=>{const n=ve(t);n.atomsThatAreDefault=new Set(n.atomsThatAreDefault).add(e)},nC=(t,e)=>{const n=ve(t);n.atomsThatAreDefault=new Set(ve(t).atomsThatAreDefault),n.atomsThatAreDefault.delete(e)};function _m(t,e,n){const r="atom",{key:o,default:u}=e;t.logger.info("๐จ","atom",o,`creating in store "${t.config.name}"`);const c=ve(t),d=c.atoms.get(o);if(d&&d.type===r)return t.logger.error("โ","atom",o,"Tried to create atom, but it already exists in the store."),vo(d);const h=new qt,m={...e,type:r,install:b=>(b.logger.info("๐ ๏ธ",r,o,`installing in store "${b.config.name}"`),_m(b,e,n)),subject:h};n&&(m.family=n);let y=u;u instanceof Function&&(y=u()),c.atoms.set(o,m),tw(t,o),ui(c,o,y,h);const g=vo(m);if(e.effects){let b=0;const x=[];for(const A of e.effects){const w=A({setSelf:k=>{Ct(t,g,k)},onSet:k=>bo(t,g,`effect[${b}]`,k)});w&&x.push(w),++b}m.cleanup=()=>{for(const A of x)A()}}return g}function iC(t,e){if("mutable"in e){const o=W1(t,e);return t.on.atomCreation.next(o),o}const r=_m(t,e,void 0);return t.on.atomCreation.next(r),r}function Mm(t,e){const n=ve(t),{key:r,family:o}=e,u=_t(n,e);if(!o)t.logger.error("โ","atom",r,"Standalone atoms cannot be disposed.");else{u.cleanup?.();const c=t.valueMap.get(u.key),d=_t(t,{key:o.key,type:"atom_family"}),h={type:"state_disposal",subType:"atom",token:e,value:c};d.subject.next(h);const m=Ft(n);if(n.atoms.delete(r),n.valueMap.delete(r),n.selectorAtoms.delete(r),n.atomsThatAreDefault.delete(r),t.timelineTopics.delete(r),e.type==="mutable_atom"){const y=ew(e);Mm(t,y),t.trackers.delete(r)}if(t.logger.info("๐ฅ","atom",r,"deleted"),m&&n.transactionMeta.phase==="building"){const y=n.transactionMeta.update.updates.at(-1);y?.type==="molecule_disposal"&&y.values.some(([x])=>x===u.family?.key)||n.transactionMeta.update.updates.push(h)}else t.on.atomDisposal.next(e)}}function rC(t){return t.startsWith("๐ ")}const Cm=B.createContext(wn.STORE);function nw(t,...e){let n;if(e.length===2){const r=e[0],o=e[1];n=Sn(t,r,o)}else n=e[0];return n}function Fn(...t){const e=B.useContext(Cm),n=nw(e,...t),r=B.useRef(null);return r.current??=o=>{Ct(e,n,o)},r.current}function bt(...t){const e=B.useContext(Cm),n=nw(e,...t),r=B.useId();return B.useSyncExternalStore(o=>bo(e,n,`use-o:${r}`,o),()=>Vi(e,n),()=>Vi(e,n))}const sC=(t,e,n,r,o)=>u=>{function c(h,m){if(t.logger.info("๐งโโ๏ธ","continuity",e,"reconciling updates"),Ct(t,Wu,g=>(g.shift(),g)),h.id===m.id){const g=JSON.stringify(h.updates),b=JSON.stringify(m.updates);if(g===b){t.logger.info("โ
","continuity",e,`results for ${h.id} match between client and server`),n.emit(`ack:${e}`,m.epoch);return}}else t.logger.info("โ","continuity",e,`thought update #${m.epoch} was ${h.key}:${h.id}, but it was actually ${m.key}:${m.id}`);t.logger.info("๐งโโ๏ธ","continuity",e,"updates do not match",h,m);const y=r.toReversed();for(const g of y)ro("oldValue",g,t);t.logger.info("โช","continuity",e,"undid optimistic updates:",y),ro("oldValue",h,t),t.logger.info("โช","continuity",e,"undid zeroth optimistic update",h),ro("newValue",m,t),t.logger.info("โฉ","continuity",e,"applied confirmed update",m),n.emit(`ack:${e}`,m.epoch);for(const g of r){const b={type:"transaction",key:g.key},{id:x,params:A}=g;Am(t,b,x)(...A)}t.logger.info("โฉ","continuity",e,"reapplied subsequent optimistic updates:",r)}t.logger.info("๐งโโ๏ธ","continuity",e,"integrating confirmed update",{confirmedUpdate:u,confirmedUpdates:o,optimisticUpdates:r});const d=r[0];if(d)if(t.logger.info("๐งโโ๏ธ","continuity",e,"has optimistic updates to reconcile"),u.epoch===d.epoch){t.logger.info("๐งโโ๏ธ","continuity",e,`epoch of confirmed update #${u.epoch} matches zeroth optimistic update`),c(d,u);for(const h of o){const m=r[0];if(h.epoch===m?.epoch)c(m,h);else break}}else t.logger.info("๐งโโ๏ธ","continuity",e,`epoch of confirmed update #${u.epoch} does not match zeroth optimistic update #${d.epoch}`),o.some(m=>m.epoch===u.epoch)||(t.logger.info("๐","continuity",e,"pushing confirmed update to queue",u),Ct(t,bp,m=>(m.push(u),m.sort((y,g)=>y.epoch-g.epoch),m)));else{t.logger.info("๐งโโ๏ธ","continuity",e,"has no optimistic updates to deal with");const h=hi(t);let m;h&&(m=G1(t,e)),m===u.epoch-1?(t.logger.info("โ
","continuity",e,`integrating update #${u.epoch} (${u.key} ${u.id})`),ro("newValue",u,t),n.emit(`ack:${e}`,u.epoch),Om(t,e,u.epoch)):h&&m!==void 0&&(t.logger.info("๐งโโ๏ธ","continuity",e,`received update #${u.epoch} but still waiting for update #${m+1}`,{clientEpoch:m,serverEpoch:u.epoch}),o.some(g=>g.epoch===u.epoch)?t.logger.info("๐","continuity",e,`confirmed update #${u.epoch} is already enqueued`):(t.logger.info("๐","continuity",e,`pushing confirmed update #${u.epoch} to queue`),Ct(t,bp,g=>(g.push(u),g.sort((b,x)=>b.epoch-x.epoch),g))))}};function oC(t){return e=>{for(const n of e)Mm(t,n)}}function aC(t){return e=>{let n=0,r,o;for(const u of e)n%2===0?r=u:(o=u,Ct(t,r,o)),n++}}const iw=(t,{stringify:e,parse:n},r)=>({setSelf:o,onSet:u})=>{const c=t.getItem(r);c!=null&&o(n(c)),u(({newValue:d})=>{if(d==null){t.removeItem(r);return}t.setItem(r,e(d))})},rw=at({key:"mySocketId__INTERNAL",default:void 0});di({key:"mySocketId",get:({get:t})=>t(rw)});at({key:"myName",default:null,effects:typeof window>"u"?[]:[iw(window.localStorage,JSON,"myUsername")]});const Wu=at({key:"updateQueue",default:[]}),bp=at({key:"serverConfirmedUpdateQueue",default:[]});function lC(t,e,n){const r=n.key,o=Vi(t,Wu),u=Vi(t,bp),c=(g,b)=>{e.off(`continuity-init:${r}`,c);let x=0,A,w;for(const k of b)x%2===0?A=k:(w=k,"type"in A&&A.type==="mutable_atom"&&(A=Kc(t,A)),Ct(t,A,w)),x++;Om(t,r,g)};e.off(`continuity-init:${r}`),e.on(`continuity-init:${r}`,c);const d=sC(t,r,e,o,u);e.off(`tx-new:${r}`),e.on(`tx-new:${r}`,d);const h=n.actions.map(g=>(Y1(t,r,g.key),J1(t,g,`tx-run:${r}`,x=>{t.logger.info("๐ค","continuity",r,"enqueuing optimistic update");const A=o.findIndex(w=>w.id===x.id);A===-1?(t.logger.info("๐ค","continuity",r,"enqueuing new optimistic update"),Ct(t,Wu,w=>(w.push(x),w.sort((k,$)=>k.epoch-$.epoch),w))):(t.logger.info("๐ค","continuity",r,`replacing existing optimistic update at index ${A}`),Ct(t,Wu,w=>(w[A]=x,w))),e.emit(`tx-run:${r}`,{id:x.id,key:g.key,params:x.params})}))),m=aC(t),y=oC(t);return e.on(`reveal:${r}`,m),e.on(`conceal:${r}`,y),e.emit(`get:${r}`),()=>{e.off(`continuity-init:${r}`),e.off(`tx-new:${r}`);for(const g of h)g()}}const sw=B.createContext({socket:null,services:null}),uC=({children:t,socket:e})=>{const n=B.useRef(new Map).current,r=Fn(rw);return B.useEffect(()=>{r(e?.id),e?.on("connect",()=>{r(e.id)}),e?.on("disconnect",()=>{r(void 0)})},[e,r]),F.jsx(sw.Provider,{value:{socket:e,services:n},children:t})};function cC(t,e){const{socket:n,services:r}=B.useContext(sw);hc(()=>{let o=r?.get(t);return o?o[0]++:(o=[1,n?e(n):void 0],r?.set(t,o)),()=>{o&&(o[0]--,o[0]===0&&(o[1]?.(),r?.delete(t)))}})}function fC(t){const e=B.useContext(Cm);cC(`tx-sync:${t.key}`,n=>lC(e,n,t))}var Mh={exports:{}},La={},Ch={exports:{}},kh={};/**
|
|
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 z0;function dC(){return z0||(z0=1,function(t){function e(N,P){var K=N.length;N.push(P);e:for(;0<K;){var J=K-1>>>1,E=N[J];if(0<o(E,P))N[J]=P,N[K]=E,K=J;else break e}}function n(N){return N.length===0?null:N[0]}function r(N){if(N.length===0)return null;var P=N[0],K=N.pop();if(K!==P){N[0]=K;e:for(var J=0,E=N.length,U=E>>>1;J<U;){var H=2*(J+1)-1,Z=N[H],re=H+1,Te=N[re];if(0>o(Z,K))re<E&&0>o(Te,Z)?(N[J]=Te,N[re]=K,J=re):(N[J]=Z,N[H]=K,J=H);else if(re<E&&0>o(Te,K))N[J]=Te,N[re]=K,J=re;else break e}}return P}function o(N,P){var K=N.sortIndex-P.sortIndex;return K!==0?K:N.id-P.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var u=performance;t.unstable_now=function(){return u.now()}}else{var c=Date,d=c.now();t.unstable_now=function(){return c.now()-d}}var h=[],m=[],y=1,g=null,b=3,x=!1,A=!1,w=!1,k=!1,$=typeof setTimeout=="function"?setTimeout:null,M=typeof clearTimeout=="function"?clearTimeout:null,O=typeof setImmediate<"u"?setImmediate:null;function G(N){for(var P=n(m);P!==null;){if(P.callback===null)r(m);else if(P.startTime<=N)r(m),P.sortIndex=P.expirationTime,e(h,P);else break;P=n(m)}}function V(N){if(w=!1,G(N),!A)if(n(h)!==null)A=!0,W||(W=!0,Me());else{var P=n(m);P!==null&&X(V,P.startTime-N)}}var W=!1,ne=-1,ee=5,ce=-1;function me(){return k?!0:!(t.unstable_now()-ce<ee)}function be(){if(k=!1,W){var N=t.unstable_now();ce=N;var P=!0;try{e:{A=!1,w&&(w=!1,M(ne),ne=-1),x=!0;var K=b;try{t:{for(G(N),g=n(h);g!==null&&!(g.expirationTime>N&&me());){var J=g.callback;if(typeof J=="function"){g.callback=null,b=g.priorityLevel;var E=J(g.expirationTime<=N);if(N=t.unstable_now(),typeof E=="function"){g.callback=E,G(N),P=!0;break t}g===n(h)&&r(h),G(N)}else r(h);g=n(h)}if(g!==null)P=!0;else{var U=n(m);U!==null&&X(V,U.startTime-N),P=!1}}break e}finally{g=null,b=K,x=!1}P=void 0}}finally{P?Me():W=!1}}}var Me;if(typeof O=="function")Me=function(){O(be)};else if(typeof MessageChannel<"u"){var Se=new MessageChannel,he=Se.port2;Se.port1.onmessage=be,Me=function(){he.postMessage(null)}}else Me=function(){$(be,0)};function X(N,P){ne=$(function(){N(t.unstable_now())},P)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(N){N.callback=null},t.unstable_forceFrameRate=function(N){0>N||125<N?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):ee=0<N?Math.floor(1e3/N):5},t.unstable_getCurrentPriorityLevel=function(){return b},t.unstable_next=function(N){switch(b){case 1:case 2:case 3:var P=3;break;default:P=b}var K=b;b=P;try{return N()}finally{b=K}},t.unstable_requestPaint=function(){k=!0},t.unstable_runWithPriority=function(N,P){switch(N){case 1:case 2:case 3:case 4:case 5:break;default:N=3}var K=b;b=N;try{return P()}finally{b=K}},t.unstable_scheduleCallback=function(N,P,K){var J=t.unstable_now();switch(typeof K=="object"&&K!==null?(K=K.delay,K=typeof K=="number"&&0<K?J+K:J):K=J,N){case 1:var E=-1;break;case 2:E=250;break;case 5:E=1073741823;break;case 4:E=1e4;break;default:E=5e3}return E=K+E,N={id:y++,callback:P,priorityLevel:N,startTime:K,expirationTime:E,sortIndex:-1},K>J?(N.sortIndex=K,e(m,N),n(h)===null&&N===n(m)&&(w?(M(ne),ne=-1):w=!0,X(V,K-J))):(N.sortIndex=E,e(h,N),A||x||(A=!0,W||(W=!0,Me()))),N},t.unstable_shouldYield=me,t.unstable_wrapCallback=function(N){var P=b;return function(){var K=b;b=P;try{return N.apply(this,arguments)}finally{b=K}}}}(kh)),kh}var U0;function hC(){return U0||(U0=1,Ch.exports=dC()),Ch.exports}var Dh={exports:{}},It={};/**
|
|
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 q0;function pC(){if(q0)return It;q0=1;var t=Sm();function e(h){var m="https://react.dev/errors/"+h;if(1<arguments.length){m+="?args[]="+encodeURIComponent(arguments[1]);for(var y=2;y<arguments.length;y++)m+="&args[]="+encodeURIComponent(arguments[y])}return"Minified React error #"+h+"; visit "+m+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var r={d:{f:n,r:function(){throw Error(e(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},o=Symbol.for("react.portal");function u(h,m,y){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:g==null?null:""+g,children:h,containerInfo:m,implementation:y}}var c=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function d(h,m){if(h==="font")return"";if(typeof m=="string")return m==="use-credentials"?m:""}return It.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,It.createPortal=function(h,m){var y=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!m||m.nodeType!==1&&m.nodeType!==9&&m.nodeType!==11)throw Error(e(299));return u(h,m,null,y)},It.flushSync=function(h){var m=c.T,y=r.p;try{if(c.T=null,r.p=2,h)return h()}finally{c.T=m,r.p=y,r.d.f()}},It.preconnect=function(h,m){typeof h=="string"&&(m?(m=m.crossOrigin,m=typeof m=="string"?m==="use-credentials"?m:"":void 0):m=null,r.d.C(h,m))},It.prefetchDNS=function(h){typeof h=="string"&&r.d.D(h)},It.preinit=function(h,m){if(typeof h=="string"&&m&&typeof m.as=="string"){var y=m.as,g=d(y,m.crossOrigin),b=typeof m.integrity=="string"?m.integrity:void 0,x=typeof m.fetchPriority=="string"?m.fetchPriority:void 0;y==="style"?r.d.S(h,typeof m.precedence=="string"?m.precedence:void 0,{crossOrigin:g,integrity:b,fetchPriority:x}):y==="script"&&r.d.X(h,{crossOrigin:g,integrity:b,fetchPriority:x,nonce:typeof m.nonce=="string"?m.nonce:void 0})}},It.preinitModule=function(h,m){if(typeof h=="string")if(typeof m=="object"&&m!==null){if(m.as==null||m.as==="script"){var y=d(m.as,m.crossOrigin);r.d.M(h,{crossOrigin:y,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0})}}else m==null&&r.d.M(h)},It.preload=function(h,m){if(typeof h=="string"&&typeof m=="object"&&m!==null&&typeof m.as=="string"){var y=m.as,g=d(y,m.crossOrigin);r.d.L(h,y,{crossOrigin:g,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0,type:typeof m.type=="string"?m.type:void 0,fetchPriority:typeof m.fetchPriority=="string"?m.fetchPriority:void 0,referrerPolicy:typeof m.referrerPolicy=="string"?m.referrerPolicy:void 0,imageSrcSet:typeof m.imageSrcSet=="string"?m.imageSrcSet:void 0,imageSizes:typeof m.imageSizes=="string"?m.imageSizes:void 0,media:typeof m.media=="string"?m.media:void 0})}},It.preloadModule=function(h,m){if(typeof h=="string")if(m){var y=d(m.as,m.crossOrigin);r.d.m(h,{as:typeof m.as=="string"&&m.as!=="script"?m.as:void 0,crossOrigin:y,integrity:typeof m.integrity=="string"?m.integrity:void 0})}else r.d.m(h)},It.requestFormReset=function(h){r.d.r(h)},It.unstable_batchedUpdates=function(h,m){return h(m)},It.useFormState=function(h,m,y){return c.H.useFormState(h,m,y)},It.useFormStatus=function(){return c.H.useHostTransitionStatus()},It.version="19.1.0",It}var P0;function ow(){if(P0)return Dh.exports;P0=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),Dh.exports=pC(),Dh.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 K0;function mC(){if(K0)return La;K0=1;var t=hC(),e=Sm(),n=ow();function r(i){var s="https://react.dev/errors/"+i;if(1<arguments.length){s+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)s+="&args[]="+encodeURIComponent(arguments[a])}return"Minified React error #"+i+"; visit "+s+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(i){return!(!i||i.nodeType!==1&&i.nodeType!==9&&i.nodeType!==11)}function u(i){var s=i,a=i;if(i.alternate)for(;s.return;)s=s.return;else{i=s;do s=i,(s.flags&4098)!==0&&(a=s.return),i=s.return;while(i)}return s.tag===3?a:null}function c(i){if(i.tag===13){var s=i.memoizedState;if(s===null&&(i=i.alternate,i!==null&&(s=i.memoizedState)),s!==null)return s.dehydrated}return null}function d(i){if(u(i)!==i)throw Error(r(188))}function h(i){var s=i.alternate;if(!s){if(s=u(i),s===null)throw Error(r(188));return s!==i?null:i}for(var a=i,l=s;;){var f=a.return;if(f===null)break;var p=f.alternate;if(p===null){if(l=f.return,l!==null){a=l;continue}break}if(f.child===p.child){for(p=f.child;p;){if(p===a)return d(f),i;if(p===l)return d(f),s;p=p.sibling}throw Error(r(188))}if(a.return!==l.return)a=f,l=p;else{for(var v=!1,S=f.child;S;){if(S===a){v=!0,a=f,l=p;break}if(S===l){v=!0,l=f,a=p;break}S=S.sibling}if(!v){for(S=p.child;S;){if(S===a){v=!0,a=p,l=f;break}if(S===l){v=!0,l=p,a=f;break}S=S.sibling}if(!v)throw Error(r(189))}}if(a.alternate!==l)throw Error(r(190))}if(a.tag!==3)throw Error(r(188));return a.stateNode.current===a?i:s}function m(i){var s=i.tag;if(s===5||s===26||s===27||s===6)return i;for(i=i.child;i!==null;){if(s=m(i),s!==null)return s;i=i.sibling}return null}var y=Object.assign,g=Symbol.for("react.element"),b=Symbol.for("react.transitional.element"),x=Symbol.for("react.portal"),A=Symbol.for("react.fragment"),w=Symbol.for("react.strict_mode"),k=Symbol.for("react.profiler"),$=Symbol.for("react.provider"),M=Symbol.for("react.consumer"),O=Symbol.for("react.context"),G=Symbol.for("react.forward_ref"),V=Symbol.for("react.suspense"),W=Symbol.for("react.suspense_list"),ne=Symbol.for("react.memo"),ee=Symbol.for("react.lazy"),ce=Symbol.for("react.activity"),me=Symbol.for("react.memo_cache_sentinel"),be=Symbol.iterator;function Me(i){return i===null||typeof i!="object"?null:(i=be&&i[be]||i["@@iterator"],typeof i=="function"?i:null)}var Se=Symbol.for("react.client.reference");function he(i){if(i==null)return null;if(typeof i=="function")return i.$$typeof===Se?null:i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case A:return"Fragment";case k:return"Profiler";case w:return"StrictMode";case V:return"Suspense";case W:return"SuspenseList";case ce:return"Activity"}if(typeof i=="object")switch(i.$$typeof){case x:return"Portal";case O:return(i.displayName||"Context")+".Provider";case M:return(i._context.displayName||"Context")+".Consumer";case G:var s=i.render;return i=i.displayName,i||(i=s.displayName||s.name||"",i=i!==""?"ForwardRef("+i+")":"ForwardRef"),i;case ne:return s=i.displayName||null,s!==null?s:he(i.type)||"Memo";case ee:s=i._payload,i=i._init;try{return he(i(s))}catch{}}return null}var X=Array.isArray,N=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,P=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,K={pending:!1,data:null,method:null,action:null},J=[],E=-1;function U(i){return{current:i}}function H(i){0>E||(i.current=J[E],J[E]=null,E--)}function Z(i,s){E++,J[E]=i.current,i.current=s}var re=U(null),Te=U(null),ie=U(null),Ye=U(null);function Ne(i,s){switch(Z(ie,s),Z(Te,i),Z(re,null),s.nodeType){case 9:case 11:i=(i=s.documentElement)&&(i=i.namespaceURI)?o0(i):0;break;default:if(i=s.tagName,s=s.namespaceURI)s=o0(s),i=a0(s,i);else switch(i){case"svg":i=1;break;case"math":i=2;break;default:i=0}}H(re),Z(re,i)}function ln(){H(re),H(Te),H(ie)}function Gi(i){i.memoizedState!==null&&Z(Ye,i);var s=re.current,a=a0(s,i.type);s!==a&&(Z(Te,i),Z(re,a))}function ye(i){Te.current===i&&(H(re),H(Te)),Ye.current===i&&(H(Ye),ka._currentValue=K)}var Ce=Object.prototype.hasOwnProperty,xe=t.unstable_scheduleCallback,we=t.unstable_cancelCallback,At=t.unstable_shouldYield,Tt=t.unstable_requestPaint,ut=t.unstable_now,Un=t.unstable_getCurrentPriorityLevel,Xe=t.unstable_ImmediatePriority,Je=t.unstable_UserBlockingPriority,un=t.unstable_NormalPriority,Tl=t.unstable_LowPriority,Py=t.unstable_IdlePriority,zR=t.log,UR=t.unstable_setDisableYieldValue,zo=null,cn=null;function Yi(i){if(typeof zR=="function"&&UR(i),cn&&typeof cn.setStrictMode=="function")try{cn.setStrictMode(zo,i)}catch{}}var fn=Math.clz32?Math.clz32:KR,qR=Math.log,PR=Math.LN2;function KR(i){return i>>>=0,i===0?32:31-(qR(i)/PR|0)|0}var El=256,Rl=4194304;function kr(i){var s=i&42;if(s!==0)return s;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 Ol(i,s,a){var l=i.pendingLanes;if(l===0)return 0;var f=0,p=i.suspendedLanes,v=i.pingedLanes;i=i.warmLanes;var S=l&134217727;return S!==0?(l=S&~p,l!==0?f=kr(l):(v&=S,v!==0?f=kr(v):a||(a=S&~i,a!==0&&(f=kr(a))))):(S=l&~p,S!==0?f=kr(S):v!==0?f=kr(v):a||(a=l&~i,a!==0&&(f=kr(a)))),f===0?0:s!==0&&s!==f&&(s&p)===0&&(p=f&-f,a=s&-s,p>=a||p===32&&(a&4194048)!==0)?s:f}function Uo(i,s){return(i.pendingLanes&~(i.suspendedLanes&~i.pingedLanes)&s)===0}function IR(i,s){switch(i){case 1:case 2:case 4:case 8:case 64:return s+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 s+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 Ky(){var i=El;return El<<=1,(El&4194048)===0&&(El=256),i}function Iy(){var i=Rl;return Rl<<=1,(Rl&62914560)===0&&(Rl=4194304),i}function mf(i){for(var s=[],a=0;31>a;a++)s.push(i);return s}function qo(i,s){i.pendingLanes|=s,s!==268435456&&(i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0)}function HR(i,s,a,l,f,p){var v=i.pendingLanes;i.pendingLanes=a,i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0,i.expiredLanes&=a,i.entangledLanes&=a,i.errorRecoveryDisabledLanes&=a,i.shellSuspendCounter=0;var S=i.entanglements,T=i.expirationTimes,D=i.hiddenUpdates;for(a=v&~a;0<a;){var z=31-fn(a),I=1<<z;S[z]=0,T[z]=-1;var j=D[z];if(j!==null)for(D[z]=null,z=0;z<j.length;z++){var L=j[z];L!==null&&(L.lane&=-536870913)}a&=~I}l!==0&&Hy(i,l,0),p!==0&&f===0&&i.tag!==0&&(i.suspendedLanes|=p&~(v&~s))}function Hy(i,s,a){i.pendingLanes|=s,i.suspendedLanes&=~s;var l=31-fn(s);i.entangledLanes|=s,i.entanglements[l]=i.entanglements[l]|1073741824|a&4194090}function Fy(i,s){var a=i.entangledLanes|=s;for(i=i.entanglements;a;){var l=31-fn(a),f=1<<l;f&s|i[l]&s&&(i[l]|=s),a&=~f}}function yf(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 gf(i){return i&=-i,2<i?8<i?(i&134217727)!==0?32:268435456:8:2}function Gy(){var i=P.p;return i!==0?i:(i=window.event,i===void 0?32:R0(i.type))}function FR(i,s){var a=P.p;try{return P.p=i,s()}finally{P.p=a}}var Xi=Math.random().toString(36).slice(2),Pt="__reactFiber$"+Xi,Qt="__reactProps$"+Xi,ps="__reactContainer$"+Xi,vf="__reactEvents$"+Xi,GR="__reactListeners$"+Xi,YR="__reactHandles$"+Xi,Yy="__reactResources$"+Xi,Po="__reactMarker$"+Xi;function bf(i){delete i[Pt],delete i[Qt],delete i[vf],delete i[GR],delete i[YR]}function ms(i){var s=i[Pt];if(s)return s;for(var a=i.parentNode;a;){if(s=a[ps]||a[Pt]){if(a=s.alternate,s.child!==null||a!==null&&a.child!==null)for(i=f0(i);i!==null;){if(a=i[Pt])return a;i=f0(i)}return s}i=a,a=i.parentNode}return null}function ys(i){if(i=i[Pt]||i[ps]){var s=i.tag;if(s===5||s===6||s===13||s===26||s===27||s===3)return i}return null}function Ko(i){var s=i.tag;if(s===5||s===26||s===27||s===6)return i.stateNode;throw Error(r(33))}function gs(i){var s=i[Yy];return s||(s=i[Yy]={hoistableStyles:new Map,hoistableScripts:new Map}),s}function kt(i){i[Po]=!0}var Xy=new Set,Zy={};function Dr(i,s){vs(i,s),vs(i+"Capture",s)}function vs(i,s){for(Zy[i]=s,i=0;i<s.length;i++)Xy.add(s[i])}var XR=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]*$"),Jy={},Qy={};function ZR(i){return Ce.call(Qy,i)?!0:Ce.call(Jy,i)?!1:XR.test(i)?Qy[i]=!0:(Jy[i]=!0,!1)}function _l(i,s,a){if(ZR(s))if(a===null)i.removeAttribute(s);else{switch(typeof a){case"undefined":case"function":case"symbol":i.removeAttribute(s);return;case"boolean":var l=s.toLowerCase().slice(0,5);if(l!=="data-"&&l!=="aria-"){i.removeAttribute(s);return}}i.setAttribute(s,""+a)}}function Ml(i,s,a){if(a===null)i.removeAttribute(s);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(s);return}i.setAttribute(s,""+a)}}function vi(i,s,a,l){if(l===null)i.removeAttribute(a);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(a);return}i.setAttributeNS(s,a,""+l)}}var Sf,Wy;function bs(i){if(Sf===void 0)try{throw Error()}catch(a){var s=a.stack.trim().match(/\n( *(at )?)/);Sf=s&&s[1]||"",Wy=-1<a.stack.indexOf(`
|
|
55
|
-
at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
56
|
-
`+Sf+i+Wy}var xf=!1;function wf(i,s){if(!i||xf)return"";xf=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var l={DetermineComponentFrameRoot:function(){try{if(s){var I=function(){throw Error()};if(Object.defineProperty(I.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(I,[])}catch(L){var j=L}Reflect.construct(i,[],I)}else{try{I.call()}catch(L){j=L}i.call(I.prototype)}}else{try{throw Error()}catch(L){j=L}(I=i())&&typeof I.catch=="function"&&I.catch(function(){})}}catch(L){if(L&&j&&typeof L.stack=="string")return[L.stack,j.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 p=l.DetermineComponentFrameRoot(),v=p[0],S=p[1];if(v&&S){var T=v.split(`
|
|
57
|
-
`),D=S.split(`
|
|
58
|
-
`);for(f=l=0;l<T.length&&!T[l].includes("DetermineComponentFrameRoot");)l++;for(;f<D.length&&!D[f].includes("DetermineComponentFrameRoot");)f++;if(l===T.length||f===D.length)for(l=T.length-1,f=D.length-1;1<=l&&0<=f&&T[l]!==D[f];)f--;for(;1<=l&&0<=f;l--,f--)if(T[l]!==D[f]){if(l!==1||f!==1)do if(l--,f--,0>f||T[l]!==D[f]){var z=`
|
|
59
|
-
`+T[l].replace(" at new "," at ");return i.displayName&&z.includes("<anonymous>")&&(z=z.replace("<anonymous>",i.displayName)),z}while(1<=l&&0<=f);break}}}finally{xf=!1,Error.prepareStackTrace=a}return(a=i?i.displayName||i.name:"")?bs(a):""}function JR(i){switch(i.tag){case 26:case 27:case 5:return bs(i.type);case 16:return bs("Lazy");case 13:return bs("Suspense");case 19:return bs("SuspenseList");case 0:case 15:return wf(i.type,!1);case 11:return wf(i.type.render,!1);case 1:return wf(i.type,!0);case 31:return bs("Activity");default:return""}}function eg(i){try{var s="";do s+=JR(i),i=i.return;while(i);return s}catch(a){return`
|
|
60
|
-
Error generating stack: `+a.message+`
|
|
61
|
-
`+a.stack}}function An(i){switch(typeof i){case"bigint":case"boolean":case"number":case"string":case"undefined":return i;case"object":return i;default:return""}}function tg(i){var s=i.type;return(i=i.nodeName)&&i.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function QR(i){var s=tg(i)?"checked":"value",a=Object.getOwnPropertyDescriptor(i.constructor.prototype,s),l=""+i[s];if(!i.hasOwnProperty(s)&&typeof a<"u"&&typeof a.get=="function"&&typeof a.set=="function"){var f=a.get,p=a.set;return Object.defineProperty(i,s,{configurable:!0,get:function(){return f.call(this)},set:function(v){l=""+v,p.call(this,v)}}),Object.defineProperty(i,s,{enumerable:a.enumerable}),{getValue:function(){return l},setValue:function(v){l=""+v},stopTracking:function(){i._valueTracker=null,delete i[s]}}}}function Cl(i){i._valueTracker||(i._valueTracker=QR(i))}function ng(i){if(!i)return!1;var s=i._valueTracker;if(!s)return!0;var a=s.getValue(),l="";return i&&(l=tg(i)?i.checked?"true":"false":i.value),i=l,i!==a?(s.setValue(i),!0):!1}function kl(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 WR=/[\n"\\]/g;function Tn(i){return i.replace(WR,function(s){return"\\"+s.charCodeAt(0).toString(16)+" "})}function Af(i,s,a,l,f,p,v,S){i.name="",v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"?i.type=v:i.removeAttribute("type"),s!=null?v==="number"?(s===0&&i.value===""||i.value!=s)&&(i.value=""+An(s)):i.value!==""+An(s)&&(i.value=""+An(s)):v!=="submit"&&v!=="reset"||i.removeAttribute("value"),s!=null?Tf(i,v,An(s)):a!=null?Tf(i,v,An(a)):l!=null&&i.removeAttribute("value"),f==null&&p!=null&&(i.defaultChecked=!!p),f!=null&&(i.checked=f&&typeof f!="function"&&typeof f!="symbol"),S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"?i.name=""+An(S):i.removeAttribute("name")}function ig(i,s,a,l,f,p,v,S){if(p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"&&(i.type=p),s!=null||a!=null){if(!(p!=="submit"&&p!=="reset"||s!=null))return;a=a!=null?""+An(a):"",s=s!=null?""+An(s):a,S||s===i.value||(i.value=s),i.defaultValue=s}l=l??f,l=typeof l!="function"&&typeof l!="symbol"&&!!l,i.checked=S?i.checked:!!l,i.defaultChecked=!!l,v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"&&(i.name=v)}function Tf(i,s,a){s==="number"&&kl(i.ownerDocument)===i||i.defaultValue===""+a||(i.defaultValue=""+a)}function Ss(i,s,a,l){if(i=i.options,s){s={};for(var f=0;f<a.length;f++)s["$"+a[f]]=!0;for(a=0;a<i.length;a++)f=s.hasOwnProperty("$"+i[a].value),i[a].selected!==f&&(i[a].selected=f),f&&l&&(i[a].defaultSelected=!0)}else{for(a=""+An(a),s=null,f=0;f<i.length;f++){if(i[f].value===a){i[f].selected=!0,l&&(i[f].defaultSelected=!0);return}s!==null||i[f].disabled||(s=i[f])}s!==null&&(s.selected=!0)}}function rg(i,s,a){if(s!=null&&(s=""+An(s),s!==i.value&&(i.value=s),a==null)){i.defaultValue!==s&&(i.defaultValue=s);return}i.defaultValue=a!=null?""+An(a):""}function sg(i,s,a,l){if(s==null){if(l!=null){if(a!=null)throw Error(r(92));if(X(l)){if(1<l.length)throw Error(r(93));l=l[0]}a=l}a==null&&(a=""),s=a}a=An(s),i.defaultValue=a,l=i.textContent,l===a&&l!==""&&l!==null&&(i.value=l)}function xs(i,s){if(s){var a=i.firstChild;if(a&&a===i.lastChild&&a.nodeType===3){a.nodeValue=s;return}}i.textContent=s}var eO=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 og(i,s,a){var l=s.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?l?i.setProperty(s,""):s==="float"?i.cssFloat="":i[s]="":l?i.setProperty(s,a):typeof a!="number"||a===0||eO.has(s)?s==="float"?i.cssFloat=a:i[s]=(""+a).trim():i[s]=a+"px"}function ag(i,s,a){if(s!=null&&typeof s!="object")throw Error(r(62));if(i=i.style,a!=null){for(var l in a)!a.hasOwnProperty(l)||s!=null&&s.hasOwnProperty(l)||(l.indexOf("--")===0?i.setProperty(l,""):l==="float"?i.cssFloat="":i[l]="");for(var f in s)l=s[f],s.hasOwnProperty(f)&&a[f]!==l&&og(i,f,l)}else for(var p in s)s.hasOwnProperty(p)&&og(i,p,s[p])}function Ef(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 tO=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"]]),nO=/^[\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 Dl(i){return nO.test(""+i)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":i}var Rf=null;function Of(i){return i=i.target||i.srcElement||window,i.correspondingUseElement&&(i=i.correspondingUseElement),i.nodeType===3?i.parentNode:i}var ws=null,As=null;function lg(i){var s=ys(i);if(s&&(i=s.stateNode)){var a=i[Qt]||null;e:switch(i=s.stateNode,s.type){case"input":if(Af(i,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name),s=a.name,a.type==="radio"&&s!=null){for(a=i;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll('input[name="'+Tn(""+s)+'"][type="radio"]'),s=0;s<a.length;s++){var l=a[s];if(l!==i&&l.form===i.form){var f=l[Qt]||null;if(!f)throw Error(r(90));Af(l,f.value,f.defaultValue,f.defaultValue,f.checked,f.defaultChecked,f.type,f.name)}}for(s=0;s<a.length;s++)l=a[s],l.form===i.form&&ng(l)}break e;case"textarea":rg(i,a.value,a.defaultValue);break e;case"select":s=a.value,s!=null&&Ss(i,!!a.multiple,s,!1)}}}var _f=!1;function ug(i,s,a){if(_f)return i(s,a);_f=!0;try{var l=i(s);return l}finally{if(_f=!1,(ws!==null||As!==null)&&(gu(),ws&&(s=ws,i=As,As=ws=null,lg(s),i)))for(s=0;s<i.length;s++)lg(i[s])}}function Io(i,s){var a=i.stateNode;if(a===null)return null;var l=a[Qt]||null;if(l===null)return null;a=l[s];e:switch(s){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(a&&typeof a!="function")throw Error(r(231,s,typeof a));return a}var bi=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Mf=!1;if(bi)try{var Ho={};Object.defineProperty(Ho,"passive",{get:function(){Mf=!0}}),window.addEventListener("test",Ho,Ho),window.removeEventListener("test",Ho,Ho)}catch{Mf=!1}var Zi=null,Cf=null,Nl=null;function cg(){if(Nl)return Nl;var i,s=Cf,a=s.length,l,f="value"in Zi?Zi.value:Zi.textContent,p=f.length;for(i=0;i<a&&s[i]===f[i];i++);var v=a-i;for(l=1;l<=v&&s[a-l]===f[p-l];l++);return Nl=f.slice(i,1<l?1-l:void 0)}function $l(i){var s=i.keyCode;return"charCode"in i?(i=i.charCode,i===0&&s===13&&(i=13)):i=s,i===10&&(i=13),32<=i||i===13?i:0}function jl(){return!0}function fg(){return!1}function Wt(i){function s(a,l,f,p,v){this._reactName=a,this._targetInst=f,this.type=l,this.nativeEvent=p,this.target=v,this.currentTarget=null;for(var S in i)i.hasOwnProperty(S)&&(a=i[S],this[S]=a?a(p):p[S]);return this.isDefaultPrevented=(p.defaultPrevented!=null?p.defaultPrevented:p.returnValue===!1)?jl:fg,this.isPropagationStopped=fg,this}return y(s.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=jl)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=jl)},persist:function(){},isPersistent:jl}),s}var Nr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(i){return i.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Bl=Wt(Nr),Fo=y({},Nr,{view:0,detail:0}),iO=Wt(Fo),kf,Df,Go,Ll=y({},Fo,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:$f,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!==Go&&(Go&&i.type==="mousemove"?(kf=i.screenX-Go.screenX,Df=i.screenY-Go.screenY):Df=kf=0,Go=i),kf)},movementY:function(i){return"movementY"in i?i.movementY:Df}}),dg=Wt(Ll),rO=y({},Ll,{dataTransfer:0}),sO=Wt(rO),oO=y({},Fo,{relatedTarget:0}),Nf=Wt(oO),aO=y({},Nr,{animationName:0,elapsedTime:0,pseudoElement:0}),lO=Wt(aO),uO=y({},Nr,{clipboardData:function(i){return"clipboardData"in i?i.clipboardData:window.clipboardData}}),cO=Wt(uO),fO=y({},Nr,{data:0}),hg=Wt(fO),dO={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},hO={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"},pO={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function mO(i){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(i):(i=pO[i])?!!s[i]:!1}function $f(){return mO}var yO=y({},Fo,{key:function(i){if(i.key){var s=dO[i.key]||i.key;if(s!=="Unidentified")return s}return i.type==="keypress"?(i=$l(i),i===13?"Enter":String.fromCharCode(i)):i.type==="keydown"||i.type==="keyup"?hO[i.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:$f,charCode:function(i){return i.type==="keypress"?$l(i):0},keyCode:function(i){return i.type==="keydown"||i.type==="keyup"?i.keyCode:0},which:function(i){return i.type==="keypress"?$l(i):i.type==="keydown"||i.type==="keyup"?i.keyCode:0}}),gO=Wt(yO),vO=y({},Ll,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),pg=Wt(vO),bO=y({},Fo,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:$f}),SO=Wt(bO),xO=y({},Nr,{propertyName:0,elapsedTime:0,pseudoElement:0}),wO=Wt(xO),AO=y({},Ll,{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}),TO=Wt(AO),EO=y({},Nr,{newState:0,oldState:0}),RO=Wt(EO),OO=[9,13,27,32],jf=bi&&"CompositionEvent"in window,Yo=null;bi&&"documentMode"in document&&(Yo=document.documentMode);var _O=bi&&"TextEvent"in window&&!Yo,mg=bi&&(!jf||Yo&&8<Yo&&11>=Yo),yg=" ",gg=!1;function vg(i,s){switch(i){case"keyup":return OO.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function bg(i){return i=i.detail,typeof i=="object"&&"data"in i?i.data:null}var Ts=!1;function MO(i,s){switch(i){case"compositionend":return bg(s);case"keypress":return s.which!==32?null:(gg=!0,yg);case"textInput":return i=s.data,i===yg&&gg?null:i;default:return null}}function CO(i,s){if(Ts)return i==="compositionend"||!jf&&vg(i,s)?(i=cg(),Nl=Cf=Zi=null,Ts=!1,i):null;switch(i){case"paste":return null;case"keypress":if(!(s.ctrlKey||s.altKey||s.metaKey)||s.ctrlKey&&s.altKey){if(s.char&&1<s.char.length)return s.char;if(s.which)return String.fromCharCode(s.which)}return null;case"compositionend":return mg&&s.locale!=="ko"?null:s.data;default:return null}}var kO={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 Sg(i){var s=i&&i.nodeName&&i.nodeName.toLowerCase();return s==="input"?!!kO[i.type]:s==="textarea"}function xg(i,s,a,l){ws?As?As.push(l):As=[l]:ws=l,s=Au(s,"onChange"),0<s.length&&(a=new Bl("onChange","change",null,a,l),i.push({event:a,listeners:s}))}var Xo=null,Zo=null;function DO(i){t0(i,0)}function Vl(i){var s=Ko(i);if(ng(s))return i}function wg(i,s){if(i==="change")return s}var Ag=!1;if(bi){var Bf;if(bi){var Lf="oninput"in document;if(!Lf){var Tg=document.createElement("div");Tg.setAttribute("oninput","return;"),Lf=typeof Tg.oninput=="function"}Bf=Lf}else Bf=!1;Ag=Bf&&(!document.documentMode||9<document.documentMode)}function Eg(){Xo&&(Xo.detachEvent("onpropertychange",Rg),Zo=Xo=null)}function Rg(i){if(i.propertyName==="value"&&Vl(Zo)){var s=[];xg(s,Zo,i,Of(i)),ug(DO,s)}}function NO(i,s,a){i==="focusin"?(Eg(),Xo=s,Zo=a,Xo.attachEvent("onpropertychange",Rg)):i==="focusout"&&Eg()}function $O(i){if(i==="selectionchange"||i==="keyup"||i==="keydown")return Vl(Zo)}function jO(i,s){if(i==="click")return Vl(s)}function BO(i,s){if(i==="input"||i==="change")return Vl(s)}function LO(i,s){return i===s&&(i!==0||1/i===1/s)||i!==i&&s!==s}var dn=typeof Object.is=="function"?Object.is:LO;function Jo(i,s){if(dn(i,s))return!0;if(typeof i!="object"||i===null||typeof s!="object"||s===null)return!1;var a=Object.keys(i),l=Object.keys(s);if(a.length!==l.length)return!1;for(l=0;l<a.length;l++){var f=a[l];if(!Ce.call(s,f)||!dn(i[f],s[f]))return!1}return!0}function Og(i){for(;i&&i.firstChild;)i=i.firstChild;return i}function _g(i,s){var a=Og(i);i=0;for(var l;a;){if(a.nodeType===3){if(l=i+a.textContent.length,i<=s&&l>=s)return{node:a,offset:s-i};i=l}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=Og(a)}}function Mg(i,s){return i&&s?i===s?!0:i&&i.nodeType===3?!1:s&&s.nodeType===3?Mg(i,s.parentNode):"contains"in i?i.contains(s):i.compareDocumentPosition?!!(i.compareDocumentPosition(s)&16):!1:!1}function Cg(i){i=i!=null&&i.ownerDocument!=null&&i.ownerDocument.defaultView!=null?i.ownerDocument.defaultView:window;for(var s=kl(i.document);s instanceof i.HTMLIFrameElement;){try{var a=typeof s.contentWindow.location.href=="string"}catch{a=!1}if(a)i=s.contentWindow;else break;s=kl(i.document)}return s}function Vf(i){var s=i&&i.nodeName&&i.nodeName.toLowerCase();return s&&(s==="input"&&(i.type==="text"||i.type==="search"||i.type==="tel"||i.type==="url"||i.type==="password")||s==="textarea"||i.contentEditable==="true")}var VO=bi&&"documentMode"in document&&11>=document.documentMode,Es=null,zf=null,Qo=null,Uf=!1;function kg(i,s,a){var l=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;Uf||Es==null||Es!==kl(l)||(l=Es,"selectionStart"in l&&Vf(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}),Qo&&Jo(Qo,l)||(Qo=l,l=Au(zf,"onSelect"),0<l.length&&(s=new Bl("onSelect","select",null,s,a),i.push({event:s,listeners:l}),s.target=Es)))}function $r(i,s){var a={};return a[i.toLowerCase()]=s.toLowerCase(),a["Webkit"+i]="webkit"+s,a["Moz"+i]="moz"+s,a}var Rs={animationend:$r("Animation","AnimationEnd"),animationiteration:$r("Animation","AnimationIteration"),animationstart:$r("Animation","AnimationStart"),transitionrun:$r("Transition","TransitionRun"),transitionstart:$r("Transition","TransitionStart"),transitioncancel:$r("Transition","TransitionCancel"),transitionend:$r("Transition","TransitionEnd")},qf={},Dg={};bi&&(Dg=document.createElement("div").style,"AnimationEvent"in window||(delete Rs.animationend.animation,delete Rs.animationiteration.animation,delete Rs.animationstart.animation),"TransitionEvent"in window||delete Rs.transitionend.transition);function jr(i){if(qf[i])return qf[i];if(!Rs[i])return i;var s=Rs[i],a;for(a in s)if(s.hasOwnProperty(a)&&a in Dg)return qf[i]=s[a];return i}var Ng=jr("animationend"),$g=jr("animationiteration"),jg=jr("animationstart"),zO=jr("transitionrun"),UO=jr("transitionstart"),qO=jr("transitioncancel"),Bg=jr("transitionend"),Lg=new Map,Pf="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(" ");Pf.push("scrollEnd");function qn(i,s){Lg.set(i,s),Dr(s,[i])}var Vg=new WeakMap;function En(i,s){if(typeof i=="object"&&i!==null){var a=Vg.get(i);return a!==void 0?a:(s={value:i,source:s,stack:eg(s)},Vg.set(i,s),s)}return{value:i,source:s,stack:eg(s)}}var Rn=[],Os=0,Kf=0;function zl(){for(var i=Os,s=Kf=Os=0;s<i;){var a=Rn[s];Rn[s++]=null;var l=Rn[s];Rn[s++]=null;var f=Rn[s];Rn[s++]=null;var p=Rn[s];if(Rn[s++]=null,l!==null&&f!==null){var v=l.pending;v===null?f.next=f:(f.next=v.next,v.next=f),l.pending=f}p!==0&&zg(a,f,p)}}function Ul(i,s,a,l){Rn[Os++]=i,Rn[Os++]=s,Rn[Os++]=a,Rn[Os++]=l,Kf|=l,i.lanes|=l,i=i.alternate,i!==null&&(i.lanes|=l)}function If(i,s,a,l){return Ul(i,s,a,l),ql(i)}function _s(i,s){return Ul(i,null,null,s),ql(i)}function zg(i,s,a){i.lanes|=a;var l=i.alternate;l!==null&&(l.lanes|=a);for(var f=!1,p=i.return;p!==null;)p.childLanes|=a,l=p.alternate,l!==null&&(l.childLanes|=a),p.tag===22&&(i=p.stateNode,i===null||i._visibility&1||(f=!0)),i=p,p=p.return;return i.tag===3?(p=i.stateNode,f&&s!==null&&(f=31-fn(a),i=p.hiddenUpdates,l=i[f],l===null?i[f]=[s]:l.push(s),s.lane=a|536870912),p):null}function ql(i){if(50<Aa)throw Aa=0,Zd=null,Error(r(185));for(var s=i.return;s!==null;)i=s,s=i.return;return i.tag===3?i.stateNode:null}var Ms={};function PO(i,s,a,l){this.tag=i,this.key=a,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=s,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 hn(i,s,a,l){return new PO(i,s,a,l)}function Hf(i){return i=i.prototype,!(!i||!i.isReactComponent)}function Si(i,s){var a=i.alternate;return a===null?(a=hn(i.tag,s,i.key,i.mode),a.elementType=i.elementType,a.type=i.type,a.stateNode=i.stateNode,a.alternate=i,i.alternate=a):(a.pendingProps=s,a.type=i.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=i.flags&65011712,a.childLanes=i.childLanes,a.lanes=i.lanes,a.child=i.child,a.memoizedProps=i.memoizedProps,a.memoizedState=i.memoizedState,a.updateQueue=i.updateQueue,s=i.dependencies,a.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext},a.sibling=i.sibling,a.index=i.index,a.ref=i.ref,a.refCleanup=i.refCleanup,a}function Ug(i,s){i.flags&=65011714;var a=i.alternate;return a===null?(i.childLanes=0,i.lanes=s,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=a.childLanes,i.lanes=a.lanes,i.child=a.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=a.memoizedProps,i.memoizedState=a.memoizedState,i.updateQueue=a.updateQueue,i.type=a.type,s=a.dependencies,i.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext}),i}function Pl(i,s,a,l,f,p){var v=0;if(l=i,typeof i=="function")Hf(i)&&(v=1);else if(typeof i=="string")v=I_(i,a,re.current)?26:i==="html"||i==="head"||i==="body"?27:5;else e:switch(i){case ce:return i=hn(31,a,s,f),i.elementType=ce,i.lanes=p,i;case A:return Br(a.children,f,p,s);case w:v=8,f|=24;break;case k:return i=hn(12,a,s,f|2),i.elementType=k,i.lanes=p,i;case V:return i=hn(13,a,s,f),i.elementType=V,i.lanes=p,i;case W:return i=hn(19,a,s,f),i.elementType=W,i.lanes=p,i;default:if(typeof i=="object"&&i!==null)switch(i.$$typeof){case $:case O:v=10;break e;case M:v=9;break e;case G:v=11;break e;case ne:v=14;break e;case ee:v=16,l=null;break e}v=29,a=Error(r(130,i===null?"null":typeof i,"")),l=null}return s=hn(v,a,s,f),s.elementType=i,s.type=l,s.lanes=p,s}function Br(i,s,a,l){return i=hn(7,i,l,s),i.lanes=a,i}function Ff(i,s,a){return i=hn(6,i,null,s),i.lanes=a,i}function Gf(i,s,a){return s=hn(4,i.children!==null?i.children:[],i.key,s),s.lanes=a,s.stateNode={containerInfo:i.containerInfo,pendingChildren:null,implementation:i.implementation},s}var Cs=[],ks=0,Kl=null,Il=0,On=[],_n=0,Lr=null,xi=1,wi="";function Vr(i,s){Cs[ks++]=Il,Cs[ks++]=Kl,Kl=i,Il=s}function qg(i,s,a){On[_n++]=xi,On[_n++]=wi,On[_n++]=Lr,Lr=i;var l=xi;i=wi;var f=32-fn(l)-1;l&=~(1<<f),a+=1;var p=32-fn(s)+f;if(30<p){var v=f-f%5;p=(l&(1<<v)-1).toString(32),l>>=v,f-=v,xi=1<<32-fn(s)+f|a<<f|l,wi=p+i}else xi=1<<p|a<<f|l,wi=i}function Yf(i){i.return!==null&&(Vr(i,1),qg(i,1,0))}function Xf(i){for(;i===Kl;)Kl=Cs[--ks],Cs[ks]=null,Il=Cs[--ks],Cs[ks]=null;for(;i===Lr;)Lr=On[--_n],On[_n]=null,wi=On[--_n],On[_n]=null,xi=On[--_n],On[_n]=null}var Yt=null,it=null,je=!1,zr=null,Zn=!1,Zf=Error(r(519));function Ur(i){var s=Error(r(418,""));throw ta(En(s,i)),Zf}function Pg(i){var s=i.stateNode,a=i.type,l=i.memoizedProps;switch(s[Pt]=i,s[Qt]=l,a){case"dialog":Oe("cancel",s),Oe("close",s);break;case"iframe":case"object":case"embed":Oe("load",s);break;case"video":case"audio":for(a=0;a<Ea.length;a++)Oe(Ea[a],s);break;case"source":Oe("error",s);break;case"img":case"image":case"link":Oe("error",s),Oe("load",s);break;case"details":Oe("toggle",s);break;case"input":Oe("invalid",s),ig(s,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0),Cl(s);break;case"select":Oe("invalid",s);break;case"textarea":Oe("invalid",s),sg(s,l.value,l.defaultValue,l.children),Cl(s)}a=l.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||s.textContent===""+a||l.suppressHydrationWarning===!0||s0(s.textContent,a)?(l.popover!=null&&(Oe("beforetoggle",s),Oe("toggle",s)),l.onScroll!=null&&Oe("scroll",s),l.onScrollEnd!=null&&Oe("scrollend",s),l.onClick!=null&&(s.onclick=Tu),s=!0):s=!1,s||Ur(i)}function Kg(i){for(Yt=i.return;Yt;)switch(Yt.tag){case 5:case 13:Zn=!1;return;case 27:case 3:Zn=!0;return;default:Yt=Yt.return}}function Wo(i){if(i!==Yt)return!1;if(!je)return Kg(i),je=!0,!1;var s=i.tag,a;if((a=s!==3&&s!==27)&&((a=s===5)&&(a=i.type,a=!(a!=="form"&&a!=="button")||dh(i.type,i.memoizedProps)),a=!a),a&&it&&Ur(i),Kg(i),s===13){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(r(317));e:{for(i=i.nextSibling,s=0;i;){if(i.nodeType===8)if(a=i.data,a==="/$"){if(s===0){it=Kn(i.nextSibling);break e}s--}else a!=="$"&&a!=="$!"&&a!=="$?"||s++;i=i.nextSibling}it=null}}else s===27?(s=it,dr(i.type)?(i=yh,yh=null,it=i):it=s):it=Yt?Kn(i.stateNode.nextSibling):null;return!0}function ea(){it=Yt=null,je=!1}function Ig(){var i=zr;return i!==null&&(nn===null?nn=i:nn.push.apply(nn,i),zr=null),i}function ta(i){zr===null?zr=[i]:zr.push(i)}var Jf=U(null),qr=null,Ai=null;function Ji(i,s,a){Z(Jf,s._currentValue),s._currentValue=a}function Ti(i){i._currentValue=Jf.current,H(Jf)}function Qf(i,s,a){for(;i!==null;){var l=i.alternate;if((i.childLanes&s)!==s?(i.childLanes|=s,l!==null&&(l.childLanes|=s)):l!==null&&(l.childLanes&s)!==s&&(l.childLanes|=s),i===a)break;i=i.return}}function Wf(i,s,a,l){var f=i.child;for(f!==null&&(f.return=i);f!==null;){var p=f.dependencies;if(p!==null){var v=f.child;p=p.firstContext;e:for(;p!==null;){var S=p;p=f;for(var T=0;T<s.length;T++)if(S.context===s[T]){p.lanes|=a,S=p.alternate,S!==null&&(S.lanes|=a),Qf(p.return,a,i),l||(v=null);break e}p=S.next}}else if(f.tag===18){if(v=f.return,v===null)throw Error(r(341));v.lanes|=a,p=v.alternate,p!==null&&(p.lanes|=a),Qf(v,a,i),v=null}else v=f.child;if(v!==null)v.return=f;else for(v=f;v!==null;){if(v===i){v=null;break}if(f=v.sibling,f!==null){f.return=v.return,v=f;break}v=v.return}f=v}}function na(i,s,a,l){i=null;for(var f=s,p=!1;f!==null;){if(!p){if((f.flags&524288)!==0)p=!0;else if((f.flags&262144)!==0)break}if(f.tag===10){var v=f.alternate;if(v===null)throw Error(r(387));if(v=v.memoizedProps,v!==null){var S=f.type;dn(f.pendingProps.value,v.value)||(i!==null?i.push(S):i=[S])}}else if(f===Ye.current){if(v=f.alternate,v===null)throw Error(r(387));v.memoizedState.memoizedState!==f.memoizedState.memoizedState&&(i!==null?i.push(ka):i=[ka])}f=f.return}i!==null&&Wf(s,i,a,l),s.flags|=262144}function Hl(i){for(i=i.firstContext;i!==null;){if(!dn(i.context._currentValue,i.memoizedValue))return!0;i=i.next}return!1}function Pr(i){qr=i,Ai=null,i=i.dependencies,i!==null&&(i.firstContext=null)}function Kt(i){return Hg(qr,i)}function Fl(i,s){return qr===null&&Pr(i),Hg(i,s)}function Hg(i,s){var a=s._currentValue;if(s={context:s,memoizedValue:a,next:null},Ai===null){if(i===null)throw Error(r(308));Ai=s,i.dependencies={lanes:0,firstContext:s},i.flags|=524288}else Ai=Ai.next=s;return a}var KO=typeof AbortController<"u"?AbortController:function(){var i=[],s=this.signal={aborted:!1,addEventListener:function(a,l){i.push(l)}};this.abort=function(){s.aborted=!0,i.forEach(function(a){return a()})}},IO=t.unstable_scheduleCallback,HO=t.unstable_NormalPriority,Et={$$typeof:O,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function ed(){return{controller:new KO,data:new Map,refCount:0}}function ia(i){i.refCount--,i.refCount===0&&IO(HO,function(){i.controller.abort()})}var ra=null,td=0,Ds=0,Ns=null;function FO(i,s){if(ra===null){var a=ra=[];td=0,Ds=ih(),Ns={status:"pending",value:void 0,then:function(l){a.push(l)}}}return td++,s.then(Fg,Fg),s}function Fg(){if(--td===0&&ra!==null){Ns!==null&&(Ns.status="fulfilled");var i=ra;ra=null,Ds=0,Ns=null;for(var s=0;s<i.length;s++)(0,i[s])()}}function GO(i,s){var a=[],l={status:"pending",value:null,reason:null,then:function(f){a.push(f)}};return i.then(function(){l.status="fulfilled",l.value=s;for(var f=0;f<a.length;f++)(0,a[f])(s)},function(f){for(l.status="rejected",l.reason=f,f=0;f<a.length;f++)(0,a[f])(void 0)}),l}var Gg=N.S;N.S=function(i,s){typeof s=="object"&&s!==null&&typeof s.then=="function"&&FO(i,s),Gg!==null&&Gg(i,s)};var Kr=U(null);function nd(){var i=Kr.current;return i!==null?i:Fe.pooledCache}function Gl(i,s){s===null?Z(Kr,Kr.current):Z(Kr,s.pool)}function Yg(){var i=nd();return i===null?null:{parent:Et._currentValue,pool:i}}var sa=Error(r(460)),Xg=Error(r(474)),Yl=Error(r(542)),id={then:function(){}};function Zg(i){return i=i.status,i==="fulfilled"||i==="rejected"}function Xl(){}function Jg(i,s,a){switch(a=i[a],a===void 0?i.push(s):a!==s&&(s.then(Xl,Xl),s=a),s.status){case"fulfilled":return s.value;case"rejected":throw i=s.reason,Wg(i),i;default:if(typeof s.status=="string")s.then(Xl,Xl);else{if(i=Fe,i!==null&&100<i.shellSuspendCounter)throw Error(r(482));i=s,i.status="pending",i.then(function(l){if(s.status==="pending"){var f=s;f.status="fulfilled",f.value=l}},function(l){if(s.status==="pending"){var f=s;f.status="rejected",f.reason=l}})}switch(s.status){case"fulfilled":return s.value;case"rejected":throw i=s.reason,Wg(i),i}throw oa=s,sa}}var oa=null;function Qg(){if(oa===null)throw Error(r(459));var i=oa;return oa=null,i}function Wg(i){if(i===sa||i===Yl)throw Error(r(483))}var Qi=!1;function rd(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function sd(i,s){i=i.updateQueue,s.updateQueue===i&&(s.updateQueue={baseState:i.baseState,firstBaseUpdate:i.firstBaseUpdate,lastBaseUpdate:i.lastBaseUpdate,shared:i.shared,callbacks:null})}function Wi(i){return{lane:i,tag:0,payload:null,callback:null,next:null}}function er(i,s,a){var l=i.updateQueue;if(l===null)return null;if(l=l.shared,(Le&2)!==0){var f=l.pending;return f===null?s.next=s:(s.next=f.next,f.next=s),l.pending=s,s=ql(i),zg(i,null,a),s}return Ul(i,l,s,a),ql(i)}function aa(i,s,a){if(s=s.updateQueue,s!==null&&(s=s.shared,(a&4194048)!==0)){var l=s.lanes;l&=i.pendingLanes,a|=l,s.lanes=a,Fy(i,a)}}function od(i,s){var a=i.updateQueue,l=i.alternate;if(l!==null&&(l=l.updateQueue,a===l)){var f=null,p=null;if(a=a.firstBaseUpdate,a!==null){do{var v={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};p===null?f=p=v:p=p.next=v,a=a.next}while(a!==null);p===null?f=p=s:p=p.next=s}else f=p=s;a={baseState:l.baseState,firstBaseUpdate:f,lastBaseUpdate:p,shared:l.shared,callbacks:l.callbacks},i.updateQueue=a;return}i=a.lastBaseUpdate,i===null?a.firstBaseUpdate=s:i.next=s,a.lastBaseUpdate=s}var ad=!1;function la(){if(ad){var i=Ns;if(i!==null)throw i}}function ua(i,s,a,l){ad=!1;var f=i.updateQueue;Qi=!1;var p=f.firstBaseUpdate,v=f.lastBaseUpdate,S=f.shared.pending;if(S!==null){f.shared.pending=null;var T=S,D=T.next;T.next=null,v===null?p=D:v.next=D,v=T;var z=i.alternate;z!==null&&(z=z.updateQueue,S=z.lastBaseUpdate,S!==v&&(S===null?z.firstBaseUpdate=D:S.next=D,z.lastBaseUpdate=T))}if(p!==null){var I=f.baseState;v=0,z=D=T=null,S=p;do{var j=S.lane&-536870913,L=j!==S.lane;if(L?(ke&j)===j:(l&j)===j){j!==0&&j===Ds&&(ad=!0),z!==null&&(z=z.next={lane:0,tag:S.tag,payload:S.payload,callback:null,next:null});e:{var fe=i,ae=S;j=s;var qe=a;switch(ae.tag){case 1:if(fe=ae.payload,typeof fe=="function"){I=fe.call(qe,I,j);break e}I=fe;break e;case 3:fe.flags=fe.flags&-65537|128;case 0:if(fe=ae.payload,j=typeof fe=="function"?fe.call(qe,I,j):fe,j==null)break e;I=y({},I,j);break e;case 2:Qi=!0}}j=S.callback,j!==null&&(i.flags|=64,L&&(i.flags|=8192),L=f.callbacks,L===null?f.callbacks=[j]:L.push(j))}else L={lane:j,tag:S.tag,payload:S.payload,callback:S.callback,next:null},z===null?(D=z=L,T=I):z=z.next=L,v|=j;if(S=S.next,S===null){if(S=f.shared.pending,S===null)break;L=S,S=L.next,L.next=null,f.lastBaseUpdate=L,f.shared.pending=null}}while(!0);z===null&&(T=I),f.baseState=T,f.firstBaseUpdate=D,f.lastBaseUpdate=z,p===null&&(f.shared.lanes=0),lr|=v,i.lanes=v,i.memoizedState=I}}function ev(i,s){if(typeof i!="function")throw Error(r(191,i));i.call(s)}function tv(i,s){var a=i.callbacks;if(a!==null)for(i.callbacks=null,i=0;i<a.length;i++)ev(a[i],s)}var $s=U(null),Zl=U(0);function nv(i,s){i=ki,Z(Zl,i),Z($s,s),ki=i|s.baseLanes}function ld(){Z(Zl,ki),Z($s,$s.current)}function ud(){ki=Zl.current,H($s),H(Zl)}var tr=0,Ae=null,ze=null,mt=null,Jl=!1,js=!1,Ir=!1,Ql=0,ca=0,Bs=null,YO=0;function ct(){throw Error(r(321))}function cd(i,s){if(s===null)return!1;for(var a=0;a<s.length&&a<i.length;a++)if(!dn(i[a],s[a]))return!1;return!0}function fd(i,s,a,l,f,p){return tr=p,Ae=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,N.H=i===null||i.memoizedState===null?zv:Uv,Ir=!1,p=a(l,f),Ir=!1,js&&(p=rv(s,a,l,f)),iv(i),p}function iv(i){N.H=ru;var s=ze!==null&&ze.next!==null;if(tr=0,mt=ze=Ae=null,Jl=!1,ca=0,Bs=null,s)throw Error(r(300));i===null||Dt||(i=i.dependencies,i!==null&&Hl(i)&&(Dt=!0))}function rv(i,s,a,l){Ae=i;var f=0;do{if(js&&(Bs=null),ca=0,js=!1,25<=f)throw Error(r(301));if(f+=1,mt=ze=null,i.updateQueue!=null){var p=i.updateQueue;p.lastEffect=null,p.events=null,p.stores=null,p.memoCache!=null&&(p.memoCache.index=0)}N.H=t_,p=s(a,l)}while(js);return p}function XO(){var i=N.H,s=i.useState()[0];return s=typeof s.then=="function"?fa(s):s,i=i.useState()[0],(ze!==null?ze.memoizedState:null)!==i&&(Ae.flags|=1024),s}function dd(){var i=Ql!==0;return Ql=0,i}function hd(i,s,a){s.updateQueue=i.updateQueue,s.flags&=-2053,i.lanes&=~a}function pd(i){if(Jl){for(i=i.memoizedState;i!==null;){var s=i.queue;s!==null&&(s.pending=null),i=i.next}Jl=!1}tr=0,mt=ze=Ae=null,js=!1,ca=Ql=0,Bs=null}function en(){var i={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return mt===null?Ae.memoizedState=mt=i:mt=mt.next=i,mt}function yt(){if(ze===null){var i=Ae.alternate;i=i!==null?i.memoizedState:null}else i=ze.next;var s=mt===null?Ae.memoizedState:mt.next;if(s!==null)mt=s,ze=i;else{if(i===null)throw Ae.alternate===null?Error(r(467)):Error(r(310));ze=i,i={memoizedState:ze.memoizedState,baseState:ze.baseState,baseQueue:ze.baseQueue,queue:ze.queue,next:null},mt===null?Ae.memoizedState=mt=i:mt=mt.next=i}return mt}function md(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function fa(i){var s=ca;return ca+=1,Bs===null&&(Bs=[]),i=Jg(Bs,i,s),s=Ae,(mt===null?s.memoizedState:mt.next)===null&&(s=s.alternate,N.H=s===null||s.memoizedState===null?zv:Uv),i}function Wl(i){if(i!==null&&typeof i=="object"){if(typeof i.then=="function")return fa(i);if(i.$$typeof===O)return Kt(i)}throw Error(r(438,String(i)))}function yd(i){var s=null,a=Ae.updateQueue;if(a!==null&&(s=a.memoCache),s==null){var l=Ae.alternate;l!==null&&(l=l.updateQueue,l!==null&&(l=l.memoCache,l!=null&&(s={data:l.data.map(function(f){return f.slice()}),index:0})))}if(s==null&&(s={data:[],index:0}),a===null&&(a=md(),Ae.updateQueue=a),a.memoCache=s,a=s.data[s.index],a===void 0)for(a=s.data[s.index]=Array(i),l=0;l<i;l++)a[l]=me;return s.index++,a}function Ei(i,s){return typeof s=="function"?s(i):s}function eu(i){var s=yt();return gd(s,ze,i)}function gd(i,s,a){var l=i.queue;if(l===null)throw Error(r(311));l.lastRenderedReducer=a;var f=i.baseQueue,p=l.pending;if(p!==null){if(f!==null){var v=f.next;f.next=p.next,p.next=v}s.baseQueue=f=p,l.pending=null}if(p=i.baseState,f===null)i.memoizedState=p;else{s=f.next;var S=v=null,T=null,D=s,z=!1;do{var I=D.lane&-536870913;if(I!==D.lane?(ke&I)===I:(tr&I)===I){var j=D.revertLane;if(j===0)T!==null&&(T=T.next={lane:0,revertLane:0,action:D.action,hasEagerState:D.hasEagerState,eagerState:D.eagerState,next:null}),I===Ds&&(z=!0);else if((tr&j)===j){D=D.next,j===Ds&&(z=!0);continue}else I={lane:0,revertLane:D.revertLane,action:D.action,hasEagerState:D.hasEagerState,eagerState:D.eagerState,next:null},T===null?(S=T=I,v=p):T=T.next=I,Ae.lanes|=j,lr|=j;I=D.action,Ir&&a(p,I),p=D.hasEagerState?D.eagerState:a(p,I)}else j={lane:I,revertLane:D.revertLane,action:D.action,hasEagerState:D.hasEagerState,eagerState:D.eagerState,next:null},T===null?(S=T=j,v=p):T=T.next=j,Ae.lanes|=I,lr|=I;D=D.next}while(D!==null&&D!==s);if(T===null?v=p:T.next=S,!dn(p,i.memoizedState)&&(Dt=!0,z&&(a=Ns,a!==null)))throw a;i.memoizedState=p,i.baseState=v,i.baseQueue=T,l.lastRenderedState=p}return f===null&&(l.lanes=0),[i.memoizedState,l.dispatch]}function vd(i){var s=yt(),a=s.queue;if(a===null)throw Error(r(311));a.lastRenderedReducer=i;var l=a.dispatch,f=a.pending,p=s.memoizedState;if(f!==null){a.pending=null;var v=f=f.next;do p=i(p,v.action),v=v.next;while(v!==f);dn(p,s.memoizedState)||(Dt=!0),s.memoizedState=p,s.baseQueue===null&&(s.baseState=p),a.lastRenderedState=p}return[p,l]}function sv(i,s,a){var l=Ae,f=yt(),p=je;if(p){if(a===void 0)throw Error(r(407));a=a()}else a=s();var v=!dn((ze||f).memoizedState,a);v&&(f.memoizedState=a,Dt=!0),f=f.queue;var S=lv.bind(null,l,f,i);if(da(2048,8,S,[i]),f.getSnapshot!==s||v||mt!==null&&mt.memoizedState.tag&1){if(l.flags|=2048,Ls(9,tu(),av.bind(null,l,f,a,s),null),Fe===null)throw Error(r(349));p||(tr&124)!==0||ov(l,s,a)}return a}function ov(i,s,a){i.flags|=16384,i={getSnapshot:s,value:a},s=Ae.updateQueue,s===null?(s=md(),Ae.updateQueue=s,s.stores=[i]):(a=s.stores,a===null?s.stores=[i]:a.push(i))}function av(i,s,a,l){s.value=a,s.getSnapshot=l,uv(s)&&cv(i)}function lv(i,s,a){return a(function(){uv(s)&&cv(i)})}function uv(i){var s=i.getSnapshot;i=i.value;try{var a=s();return!dn(i,a)}catch{return!0}}function cv(i){var s=_s(i,2);s!==null&&vn(s,i,2)}function bd(i){var s=en();if(typeof i=="function"){var a=i;if(i=a(),Ir){Yi(!0);try{a()}finally{Yi(!1)}}}return s.memoizedState=s.baseState=i,s.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ei,lastRenderedState:i},s}function fv(i,s,a,l){return i.baseState=a,gd(i,ze,typeof l=="function"?l:Ei)}function ZO(i,s,a,l,f){if(iu(i))throw Error(r(485));if(i=s.action,i!==null){var p={payload:f,action:i,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(v){p.listeners.push(v)}};N.T!==null?a(!0):p.isTransition=!1,l(p),a=s.pending,a===null?(p.next=s.pending=p,dv(s,p)):(p.next=a.next,s.pending=a.next=p)}}function dv(i,s){var a=s.action,l=s.payload,f=i.state;if(s.isTransition){var p=N.T,v={};N.T=v;try{var S=a(f,l),T=N.S;T!==null&&T(v,S),hv(i,s,S)}catch(D){Sd(i,s,D)}finally{N.T=p}}else try{p=a(f,l),hv(i,s,p)}catch(D){Sd(i,s,D)}}function hv(i,s,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(l){pv(i,s,l)},function(l){return Sd(i,s,l)}):pv(i,s,a)}function pv(i,s,a){s.status="fulfilled",s.value=a,mv(s),i.state=a,s=i.pending,s!==null&&(a=s.next,a===s?i.pending=null:(a=a.next,s.next=a,dv(i,a)))}function Sd(i,s,a){var l=i.pending;if(i.pending=null,l!==null){l=l.next;do s.status="rejected",s.reason=a,mv(s),s=s.next;while(s!==l)}i.action=null}function mv(i){i=i.listeners;for(var s=0;s<i.length;s++)(0,i[s])()}function yv(i,s){return s}function gv(i,s){if(je){var a=Fe.formState;if(a!==null){e:{var l=Ae;if(je){if(it){t:{for(var f=it,p=Zn;f.nodeType!==8;){if(!p){f=null;break t}if(f=Kn(f.nextSibling),f===null){f=null;break t}}p=f.data,f=p==="F!"||p==="F"?f:null}if(f){it=Kn(f.nextSibling),l=f.data==="F!";break e}}Ur(l)}l=!1}l&&(s=a[0])}}return a=en(),a.memoizedState=a.baseState=s,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:yv,lastRenderedState:s},a.queue=l,a=Bv.bind(null,Ae,l),l.dispatch=a,l=bd(!1),p=Ed.bind(null,Ae,!1,l.queue),l=en(),f={state:s,dispatch:null,action:i,pending:null},l.queue=f,a=ZO.bind(null,Ae,f,p,a),f.dispatch=a,l.memoizedState=i,[s,a,!1]}function vv(i){var s=yt();return bv(s,ze,i)}function bv(i,s,a){if(s=gd(i,s,yv)[0],i=eu(Ei)[0],typeof s=="object"&&s!==null&&typeof s.then=="function")try{var l=fa(s)}catch(v){throw v===sa?Yl:v}else l=s;s=yt();var f=s.queue,p=f.dispatch;return a!==s.memoizedState&&(Ae.flags|=2048,Ls(9,tu(),JO.bind(null,f,a),null)),[l,p,i]}function JO(i,s){i.action=s}function Sv(i){var s=yt(),a=ze;if(a!==null)return bv(s,a,i);yt(),s=s.memoizedState,a=yt();var l=a.queue.dispatch;return a.memoizedState=i,[s,l,!1]}function Ls(i,s,a,l){return i={tag:i,create:a,deps:l,inst:s,next:null},s=Ae.updateQueue,s===null&&(s=md(),Ae.updateQueue=s),a=s.lastEffect,a===null?s.lastEffect=i.next=i:(l=a.next,a.next=i,i.next=l,s.lastEffect=i),i}function tu(){return{destroy:void 0,resource:void 0}}function xv(){return yt().memoizedState}function nu(i,s,a,l){var f=en();l=l===void 0?null:l,Ae.flags|=i,f.memoizedState=Ls(1|s,tu(),a,l)}function da(i,s,a,l){var f=yt();l=l===void 0?null:l;var p=f.memoizedState.inst;ze!==null&&l!==null&&cd(l,ze.memoizedState.deps)?f.memoizedState=Ls(s,p,a,l):(Ae.flags|=i,f.memoizedState=Ls(1|s,p,a,l))}function wv(i,s){nu(8390656,8,i,s)}function Av(i,s){da(2048,8,i,s)}function Tv(i,s){return da(4,2,i,s)}function Ev(i,s){return da(4,4,i,s)}function Rv(i,s){if(typeof s=="function"){i=i();var a=s(i);return function(){typeof a=="function"?a():s(null)}}if(s!=null)return i=i(),s.current=i,function(){s.current=null}}function Ov(i,s,a){a=a!=null?a.concat([i]):null,da(4,4,Rv.bind(null,s,i),a)}function xd(){}function _v(i,s){var a=yt();s=s===void 0?null:s;var l=a.memoizedState;return s!==null&&cd(s,l[1])?l[0]:(a.memoizedState=[i,s],i)}function Mv(i,s){var a=yt();s=s===void 0?null:s;var l=a.memoizedState;if(s!==null&&cd(s,l[1]))return l[0];if(l=i(),Ir){Yi(!0);try{i()}finally{Yi(!1)}}return a.memoizedState=[l,s],l}function wd(i,s,a){return a===void 0||(tr&1073741824)!==0?i.memoizedState=s:(i.memoizedState=a,i=Db(),Ae.lanes|=i,lr|=i,a)}function Cv(i,s,a,l){return dn(a,s)?a:$s.current!==null?(i=wd(i,a,l),dn(i,s)||(Dt=!0),i):(tr&42)===0?(Dt=!0,i.memoizedState=a):(i=Db(),Ae.lanes|=i,lr|=i,s)}function kv(i,s,a,l,f){var p=P.p;P.p=p!==0&&8>p?p:8;var v=N.T,S={};N.T=S,Ed(i,!1,s,a);try{var T=f(),D=N.S;if(D!==null&&D(S,T),T!==null&&typeof T=="object"&&typeof T.then=="function"){var z=GO(T,l);ha(i,s,z,gn(i))}else ha(i,s,l,gn(i))}catch(I){ha(i,s,{then:function(){},status:"rejected",reason:I},gn())}finally{P.p=p,N.T=v}}function QO(){}function Ad(i,s,a,l){if(i.tag!==5)throw Error(r(476));var f=Dv(i).queue;kv(i,f,s,K,a===null?QO:function(){return Nv(i),a(l)})}function Dv(i){var s=i.memoizedState;if(s!==null)return s;s={memoizedState:K,baseState:K,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ei,lastRenderedState:K},next:null};var a={};return s.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ei,lastRenderedState:a},next:null},i.memoizedState=s,i=i.alternate,i!==null&&(i.memoizedState=s),s}function Nv(i){var s=Dv(i).next.queue;ha(i,s,{},gn())}function Td(){return Kt(ka)}function $v(){return yt().memoizedState}function jv(){return yt().memoizedState}function WO(i){for(var s=i.return;s!==null;){switch(s.tag){case 24:case 3:var a=gn();i=Wi(a);var l=er(s,i,a);l!==null&&(vn(l,s,a),aa(l,s,a)),s={cache:ed()},i.payload=s;return}s=s.return}}function e_(i,s,a){var l=gn();a={lane:l,revertLane:0,action:a,hasEagerState:!1,eagerState:null,next:null},iu(i)?Lv(s,a):(a=If(i,s,a,l),a!==null&&(vn(a,i,l),Vv(a,s,l)))}function Bv(i,s,a){var l=gn();ha(i,s,a,l)}function ha(i,s,a,l){var f={lane:l,revertLane:0,action:a,hasEagerState:!1,eagerState:null,next:null};if(iu(i))Lv(s,f);else{var p=i.alternate;if(i.lanes===0&&(p===null||p.lanes===0)&&(p=s.lastRenderedReducer,p!==null))try{var v=s.lastRenderedState,S=p(v,a);if(f.hasEagerState=!0,f.eagerState=S,dn(S,v))return Ul(i,s,f,0),Fe===null&&zl(),!1}catch{}finally{}if(a=If(i,s,f,l),a!==null)return vn(a,i,l),Vv(a,s,l),!0}return!1}function Ed(i,s,a,l){if(l={lane:2,revertLane:ih(),action:l,hasEagerState:!1,eagerState:null,next:null},iu(i)){if(s)throw Error(r(479))}else s=If(i,a,l,2),s!==null&&vn(s,i,2)}function iu(i){var s=i.alternate;return i===Ae||s!==null&&s===Ae}function Lv(i,s){js=Jl=!0;var a=i.pending;a===null?s.next=s:(s.next=a.next,a.next=s),i.pending=s}function Vv(i,s,a){if((a&4194048)!==0){var l=s.lanes;l&=i.pendingLanes,a|=l,s.lanes=a,Fy(i,a)}}var ru={readContext:Kt,use:Wl,useCallback:ct,useContext:ct,useEffect:ct,useImperativeHandle:ct,useLayoutEffect:ct,useInsertionEffect:ct,useMemo:ct,useReducer:ct,useRef:ct,useState:ct,useDebugValue:ct,useDeferredValue:ct,useTransition:ct,useSyncExternalStore:ct,useId:ct,useHostTransitionStatus:ct,useFormState:ct,useActionState:ct,useOptimistic:ct,useMemoCache:ct,useCacheRefresh:ct},zv={readContext:Kt,use:Wl,useCallback:function(i,s){return en().memoizedState=[i,s===void 0?null:s],i},useContext:Kt,useEffect:wv,useImperativeHandle:function(i,s,a){a=a!=null?a.concat([i]):null,nu(4194308,4,Rv.bind(null,s,i),a)},useLayoutEffect:function(i,s){return nu(4194308,4,i,s)},useInsertionEffect:function(i,s){nu(4,2,i,s)},useMemo:function(i,s){var a=en();s=s===void 0?null:s;var l=i();if(Ir){Yi(!0);try{i()}finally{Yi(!1)}}return a.memoizedState=[l,s],l},useReducer:function(i,s,a){var l=en();if(a!==void 0){var f=a(s);if(Ir){Yi(!0);try{a(s)}finally{Yi(!1)}}}else f=s;return l.memoizedState=l.baseState=f,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:i,lastRenderedState:f},l.queue=i,i=i.dispatch=e_.bind(null,Ae,i),[l.memoizedState,i]},useRef:function(i){var s=en();return i={current:i},s.memoizedState=i},useState:function(i){i=bd(i);var s=i.queue,a=Bv.bind(null,Ae,s);return s.dispatch=a,[i.memoizedState,a]},useDebugValue:xd,useDeferredValue:function(i,s){var a=en();return wd(a,i,s)},useTransition:function(){var i=bd(!1);return i=kv.bind(null,Ae,i.queue,!0,!1),en().memoizedState=i,[!1,i]},useSyncExternalStore:function(i,s,a){var l=Ae,f=en();if(je){if(a===void 0)throw Error(r(407));a=a()}else{if(a=s(),Fe===null)throw Error(r(349));(ke&124)!==0||ov(l,s,a)}f.memoizedState=a;var p={value:a,getSnapshot:s};return f.queue=p,wv(lv.bind(null,l,p,i),[i]),l.flags|=2048,Ls(9,tu(),av.bind(null,l,p,a,s),null),a},useId:function(){var i=en(),s=Fe.identifierPrefix;if(je){var a=wi,l=xi;a=(l&~(1<<32-fn(l)-1)).toString(32)+a,s="ยซ"+s+"R"+a,a=Ql++,0<a&&(s+="H"+a.toString(32)),s+="ยป"}else a=YO++,s="ยซ"+s+"r"+a.toString(32)+"ยป";return i.memoizedState=s},useHostTransitionStatus:Td,useFormState:gv,useActionState:gv,useOptimistic:function(i){var s=en();s.memoizedState=s.baseState=i;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return s.queue=a,s=Ed.bind(null,Ae,!0,a),a.dispatch=s,[i,s]},useMemoCache:yd,useCacheRefresh:function(){return en().memoizedState=WO.bind(null,Ae)}},Uv={readContext:Kt,use:Wl,useCallback:_v,useContext:Kt,useEffect:Av,useImperativeHandle:Ov,useInsertionEffect:Tv,useLayoutEffect:Ev,useMemo:Mv,useReducer:eu,useRef:xv,useState:function(){return eu(Ei)},useDebugValue:xd,useDeferredValue:function(i,s){var a=yt();return Cv(a,ze.memoizedState,i,s)},useTransition:function(){var i=eu(Ei)[0],s=yt().memoizedState;return[typeof i=="boolean"?i:fa(i),s]},useSyncExternalStore:sv,useId:$v,useHostTransitionStatus:Td,useFormState:vv,useActionState:vv,useOptimistic:function(i,s){var a=yt();return fv(a,ze,i,s)},useMemoCache:yd,useCacheRefresh:jv},t_={readContext:Kt,use:Wl,useCallback:_v,useContext:Kt,useEffect:Av,useImperativeHandle:Ov,useInsertionEffect:Tv,useLayoutEffect:Ev,useMemo:Mv,useReducer:vd,useRef:xv,useState:function(){return vd(Ei)},useDebugValue:xd,useDeferredValue:function(i,s){var a=yt();return ze===null?wd(a,i,s):Cv(a,ze.memoizedState,i,s)},useTransition:function(){var i=vd(Ei)[0],s=yt().memoizedState;return[typeof i=="boolean"?i:fa(i),s]},useSyncExternalStore:sv,useId:$v,useHostTransitionStatus:Td,useFormState:Sv,useActionState:Sv,useOptimistic:function(i,s){var a=yt();return ze!==null?fv(a,ze,i,s):(a.baseState=i,[i,a.queue.dispatch])},useMemoCache:yd,useCacheRefresh:jv},Vs=null,pa=0;function su(i){var s=pa;return pa+=1,Vs===null&&(Vs=[]),Jg(Vs,i,s)}function ma(i,s){s=s.props.ref,i.ref=s!==void 0?s:null}function ou(i,s){throw s.$$typeof===g?Error(r(525)):(i=Object.prototype.toString.call(s),Error(r(31,i==="[object Object]"?"object with keys {"+Object.keys(s).join(", ")+"}":i)))}function qv(i){var s=i._init;return s(i._payload)}function Pv(i){function s(_,R){if(i){var C=_.deletions;C===null?(_.deletions=[R],_.flags|=16):C.push(R)}}function a(_,R){if(!i)return null;for(;R!==null;)s(_,R),R=R.sibling;return null}function l(_){for(var R=new Map;_!==null;)_.key!==null?R.set(_.key,_):R.set(_.index,_),_=_.sibling;return R}function f(_,R){return _=Si(_,R),_.index=0,_.sibling=null,_}function p(_,R,C){return _.index=C,i?(C=_.alternate,C!==null?(C=C.index,C<R?(_.flags|=67108866,R):C):(_.flags|=67108866,R)):(_.flags|=1048576,R)}function v(_){return i&&_.alternate===null&&(_.flags|=67108866),_}function S(_,R,C,q){return R===null||R.tag!==6?(R=Ff(C,_.mode,q),R.return=_,R):(R=f(R,C),R.return=_,R)}function T(_,R,C,q){var te=C.type;return te===A?z(_,R,C.props.children,q,C.key):R!==null&&(R.elementType===te||typeof te=="object"&&te!==null&&te.$$typeof===ee&&qv(te)===R.type)?(R=f(R,C.props),ma(R,C),R.return=_,R):(R=Pl(C.type,C.key,C.props,null,_.mode,q),ma(R,C),R.return=_,R)}function D(_,R,C,q){return R===null||R.tag!==4||R.stateNode.containerInfo!==C.containerInfo||R.stateNode.implementation!==C.implementation?(R=Gf(C,_.mode,q),R.return=_,R):(R=f(R,C.children||[]),R.return=_,R)}function z(_,R,C,q,te){return R===null||R.tag!==7?(R=Br(C,_.mode,q,te),R.return=_,R):(R=f(R,C),R.return=_,R)}function I(_,R,C){if(typeof R=="string"&&R!==""||typeof R=="number"||typeof R=="bigint")return R=Ff(""+R,_.mode,C),R.return=_,R;if(typeof R=="object"&&R!==null){switch(R.$$typeof){case b:return C=Pl(R.type,R.key,R.props,null,_.mode,C),ma(C,R),C.return=_,C;case x:return R=Gf(R,_.mode,C),R.return=_,R;case ee:var q=R._init;return R=q(R._payload),I(_,R,C)}if(X(R)||Me(R))return R=Br(R,_.mode,C,null),R.return=_,R;if(typeof R.then=="function")return I(_,su(R),C);if(R.$$typeof===O)return I(_,Fl(_,R),C);ou(_,R)}return null}function j(_,R,C,q){var te=R!==null?R.key:null;if(typeof C=="string"&&C!==""||typeof C=="number"||typeof C=="bigint")return te!==null?null:S(_,R,""+C,q);if(typeof C=="object"&&C!==null){switch(C.$$typeof){case b:return C.key===te?T(_,R,C,q):null;case x:return C.key===te?D(_,R,C,q):null;case ee:return te=C._init,C=te(C._payload),j(_,R,C,q)}if(X(C)||Me(C))return te!==null?null:z(_,R,C,q,null);if(typeof C.then=="function")return j(_,R,su(C),q);if(C.$$typeof===O)return j(_,R,Fl(_,C),q);ou(_,C)}return null}function L(_,R,C,q,te){if(typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint")return _=_.get(C)||null,S(R,_,""+q,te);if(typeof q=="object"&&q!==null){switch(q.$$typeof){case b:return _=_.get(q.key===null?C:q.key)||null,T(R,_,q,te);case x:return _=_.get(q.key===null?C:q.key)||null,D(R,_,q,te);case ee:var Ee=q._init;return q=Ee(q._payload),L(_,R,C,q,te)}if(X(q)||Me(q))return _=_.get(C)||null,z(R,_,q,te,null);if(typeof q.then=="function")return L(_,R,C,su(q),te);if(q.$$typeof===O)return L(_,R,C,Fl(R,q),te);ou(R,q)}return null}function fe(_,R,C,q){for(var te=null,Ee=null,oe=R,le=R=0,$t=null;oe!==null&&le<C.length;le++){oe.index>le?($t=oe,oe=null):$t=oe.sibling;var $e=j(_,oe,C[le],q);if($e===null){oe===null&&(oe=$t);break}i&&oe&&$e.alternate===null&&s(_,oe),R=p($e,R,le),Ee===null?te=$e:Ee.sibling=$e,Ee=$e,oe=$t}if(le===C.length)return a(_,oe),je&&Vr(_,le),te;if(oe===null){for(;le<C.length;le++)oe=I(_,C[le],q),oe!==null&&(R=p(oe,R,le),Ee===null?te=oe:Ee.sibling=oe,Ee=oe);return je&&Vr(_,le),te}for(oe=l(oe);le<C.length;le++)$t=L(oe,_,le,C[le],q),$t!==null&&(i&&$t.alternate!==null&&oe.delete($t.key===null?le:$t.key),R=p($t,R,le),Ee===null?te=$t:Ee.sibling=$t,Ee=$t);return i&&oe.forEach(function(gr){return s(_,gr)}),je&&Vr(_,le),te}function ae(_,R,C,q){if(C==null)throw Error(r(151));for(var te=null,Ee=null,oe=R,le=R=0,$t=null,$e=C.next();oe!==null&&!$e.done;le++,$e=C.next()){oe.index>le?($t=oe,oe=null):$t=oe.sibling;var gr=j(_,oe,$e.value,q);if(gr===null){oe===null&&(oe=$t);break}i&&oe&&gr.alternate===null&&s(_,oe),R=p(gr,R,le),Ee===null?te=gr:Ee.sibling=gr,Ee=gr,oe=$t}if($e.done)return a(_,oe),je&&Vr(_,le),te;if(oe===null){for(;!$e.done;le++,$e=C.next())$e=I(_,$e.value,q),$e!==null&&(R=p($e,R,le),Ee===null?te=$e:Ee.sibling=$e,Ee=$e);return je&&Vr(_,le),te}for(oe=l(oe);!$e.done;le++,$e=C.next())$e=L(oe,_,le,$e.value,q),$e!==null&&(i&&$e.alternate!==null&&oe.delete($e.key===null?le:$e.key),R=p($e,R,le),Ee===null?te=$e:Ee.sibling=$e,Ee=$e);return i&&oe.forEach(function(nM){return s(_,nM)}),je&&Vr(_,le),te}function qe(_,R,C,q){if(typeof C=="object"&&C!==null&&C.type===A&&C.key===null&&(C=C.props.children),typeof C=="object"&&C!==null){switch(C.$$typeof){case b:e:{for(var te=C.key;R!==null;){if(R.key===te){if(te=C.type,te===A){if(R.tag===7){a(_,R.sibling),q=f(R,C.props.children),q.return=_,_=q;break e}}else if(R.elementType===te||typeof te=="object"&&te!==null&&te.$$typeof===ee&&qv(te)===R.type){a(_,R.sibling),q=f(R,C.props),ma(q,C),q.return=_,_=q;break e}a(_,R);break}else s(_,R);R=R.sibling}C.type===A?(q=Br(C.props.children,_.mode,q,C.key),q.return=_,_=q):(q=Pl(C.type,C.key,C.props,null,_.mode,q),ma(q,C),q.return=_,_=q)}return v(_);case x:e:{for(te=C.key;R!==null;){if(R.key===te)if(R.tag===4&&R.stateNode.containerInfo===C.containerInfo&&R.stateNode.implementation===C.implementation){a(_,R.sibling),q=f(R,C.children||[]),q.return=_,_=q;break e}else{a(_,R);break}else s(_,R);R=R.sibling}q=Gf(C,_.mode,q),q.return=_,_=q}return v(_);case ee:return te=C._init,C=te(C._payload),qe(_,R,C,q)}if(X(C))return fe(_,R,C,q);if(Me(C)){if(te=Me(C),typeof te!="function")throw Error(r(150));return C=te.call(C),ae(_,R,C,q)}if(typeof C.then=="function")return qe(_,R,su(C),q);if(C.$$typeof===O)return qe(_,R,Fl(_,C),q);ou(_,C)}return typeof C=="string"&&C!==""||typeof C=="number"||typeof C=="bigint"?(C=""+C,R!==null&&R.tag===6?(a(_,R.sibling),q=f(R,C),q.return=_,_=q):(a(_,R),q=Ff(C,_.mode,q),q.return=_,_=q),v(_)):a(_,R)}return function(_,R,C,q){try{pa=0;var te=qe(_,R,C,q);return Vs=null,te}catch(oe){if(oe===sa||oe===Yl)throw oe;var Ee=hn(29,oe,null,_.mode);return Ee.lanes=q,Ee.return=_,Ee}finally{}}}var zs=Pv(!0),Kv=Pv(!1),Mn=U(null),Jn=null;function nr(i){var s=i.alternate;Z(Rt,Rt.current&1),Z(Mn,i),Jn===null&&(s===null||$s.current!==null||s.memoizedState!==null)&&(Jn=i)}function Iv(i){if(i.tag===22){if(Z(Rt,Rt.current),Z(Mn,i),Jn===null){var s=i.alternate;s!==null&&s.memoizedState!==null&&(Jn=i)}}else ir()}function ir(){Z(Rt,Rt.current),Z(Mn,Mn.current)}function Ri(i){H(Mn),Jn===i&&(Jn=null),H(Rt)}var Rt=U(0);function au(i){for(var s=i;s!==null;){if(s.tag===13){var a=s.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||a.data==="$?"||mh(a)))return s}else if(s.tag===19&&s.memoizedProps.revealOrder!==void 0){if((s.flags&128)!==0)return s}else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===i)break;for(;s.sibling===null;){if(s.return===null||s.return===i)return null;s=s.return}s.sibling.return=s.return,s=s.sibling}return null}function Rd(i,s,a,l){s=i.memoizedState,a=a(l,s),a=a==null?s:y({},s,a),i.memoizedState=a,i.lanes===0&&(i.updateQueue.baseState=a)}var Od={enqueueSetState:function(i,s,a){i=i._reactInternals;var l=gn(),f=Wi(l);f.payload=s,a!=null&&(f.callback=a),s=er(i,f,l),s!==null&&(vn(s,i,l),aa(s,i,l))},enqueueReplaceState:function(i,s,a){i=i._reactInternals;var l=gn(),f=Wi(l);f.tag=1,f.payload=s,a!=null&&(f.callback=a),s=er(i,f,l),s!==null&&(vn(s,i,l),aa(s,i,l))},enqueueForceUpdate:function(i,s){i=i._reactInternals;var a=gn(),l=Wi(a);l.tag=2,s!=null&&(l.callback=s),s=er(i,l,a),s!==null&&(vn(s,i,a),aa(s,i,a))}};function Hv(i,s,a,l,f,p,v){return i=i.stateNode,typeof i.shouldComponentUpdate=="function"?i.shouldComponentUpdate(l,p,v):s.prototype&&s.prototype.isPureReactComponent?!Jo(a,l)||!Jo(f,p):!0}function Fv(i,s,a,l){i=s.state,typeof s.componentWillReceiveProps=="function"&&s.componentWillReceiveProps(a,l),typeof s.UNSAFE_componentWillReceiveProps=="function"&&s.UNSAFE_componentWillReceiveProps(a,l),s.state!==i&&Od.enqueueReplaceState(s,s.state,null)}function Hr(i,s){var a=s;if("ref"in s){a={};for(var l in s)l!=="ref"&&(a[l]=s[l])}if(i=i.defaultProps){a===s&&(a=y({},a));for(var f in i)a[f]===void 0&&(a[f]=i[f])}return a}var lu=typeof reportError=="function"?reportError:function(i){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var s=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(s))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",i);return}console.error(i)};function Gv(i){lu(i)}function Yv(i){console.error(i)}function Xv(i){lu(i)}function uu(i,s){try{var a=i.onUncaughtError;a(s.value,{componentStack:s.stack})}catch(l){setTimeout(function(){throw l})}}function Zv(i,s,a){try{var l=i.onCaughtError;l(a.value,{componentStack:a.stack,errorBoundary:s.tag===1?s.stateNode:null})}catch(f){setTimeout(function(){throw f})}}function _d(i,s,a){return a=Wi(a),a.tag=3,a.payload={element:null},a.callback=function(){uu(i,s)},a}function Jv(i){return i=Wi(i),i.tag=3,i}function Qv(i,s,a,l){var f=a.type.getDerivedStateFromError;if(typeof f=="function"){var p=l.value;i.payload=function(){return f(p)},i.callback=function(){Zv(s,a,l)}}var v=a.stateNode;v!==null&&typeof v.componentDidCatch=="function"&&(i.callback=function(){Zv(s,a,l),typeof f!="function"&&(ur===null?ur=new Set([this]):ur.add(this));var S=l.stack;this.componentDidCatch(l.value,{componentStack:S!==null?S:""})})}function n_(i,s,a,l,f){if(a.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(s=a.alternate,s!==null&&na(s,a,f,!0),a=Mn.current,a!==null){switch(a.tag){case 13:return Jn===null?Qd():a.alternate===null&&rt===0&&(rt=3),a.flags&=-257,a.flags|=65536,a.lanes=f,l===id?a.flags|=16384:(s=a.updateQueue,s===null?a.updateQueue=new Set([l]):s.add(l),eh(i,l,f)),!1;case 22:return a.flags|=65536,l===id?a.flags|=16384:(s=a.updateQueue,s===null?(s={transitions:null,markerInstances:null,retryQueue:new Set([l])},a.updateQueue=s):(a=s.retryQueue,a===null?s.retryQueue=new Set([l]):a.add(l)),eh(i,l,f)),!1}throw Error(r(435,a.tag))}return eh(i,l,f),Qd(),!1}if(je)return s=Mn.current,s!==null?((s.flags&65536)===0&&(s.flags|=256),s.flags|=65536,s.lanes=f,l!==Zf&&(i=Error(r(422),{cause:l}),ta(En(i,a)))):(l!==Zf&&(s=Error(r(423),{cause:l}),ta(En(s,a))),i=i.current.alternate,i.flags|=65536,f&=-f,i.lanes|=f,l=En(l,a),f=_d(i.stateNode,l,f),od(i,f),rt!==4&&(rt=2)),!1;var p=Error(r(520),{cause:l});if(p=En(p,a),wa===null?wa=[p]:wa.push(p),rt!==4&&(rt=2),s===null)return!0;l=En(l,a),a=s;do{switch(a.tag){case 3:return a.flags|=65536,i=f&-f,a.lanes|=i,i=_d(a.stateNode,l,i),od(a,i),!1;case 1:if(s=a.type,p=a.stateNode,(a.flags&128)===0&&(typeof s.getDerivedStateFromError=="function"||p!==null&&typeof p.componentDidCatch=="function"&&(ur===null||!ur.has(p))))return a.flags|=65536,f&=-f,a.lanes|=f,f=Jv(f),Qv(f,i,a,l),od(a,f),!1}a=a.return}while(a!==null);return!1}var Wv=Error(r(461)),Dt=!1;function Lt(i,s,a,l){s.child=i===null?Kv(s,null,a,l):zs(s,i.child,a,l)}function eb(i,s,a,l,f){a=a.render;var p=s.ref;if("ref"in l){var v={};for(var S in l)S!=="ref"&&(v[S]=l[S])}else v=l;return Pr(s),l=fd(i,s,a,v,p,f),S=dd(),i!==null&&!Dt?(hd(i,s,f),Oi(i,s,f)):(je&&S&&Yf(s),s.flags|=1,Lt(i,s,l,f),s.child)}function tb(i,s,a,l,f){if(i===null){var p=a.type;return typeof p=="function"&&!Hf(p)&&p.defaultProps===void 0&&a.compare===null?(s.tag=15,s.type=p,nb(i,s,p,l,f)):(i=Pl(a.type,null,l,s,s.mode,f),i.ref=s.ref,i.return=s,s.child=i)}if(p=i.child,!Bd(i,f)){var v=p.memoizedProps;if(a=a.compare,a=a!==null?a:Jo,a(v,l)&&i.ref===s.ref)return Oi(i,s,f)}return s.flags|=1,i=Si(p,l),i.ref=s.ref,i.return=s,s.child=i}function nb(i,s,a,l,f){if(i!==null){var p=i.memoizedProps;if(Jo(p,l)&&i.ref===s.ref)if(Dt=!1,s.pendingProps=l=p,Bd(i,f))(i.flags&131072)!==0&&(Dt=!0);else return s.lanes=i.lanes,Oi(i,s,f)}return Md(i,s,a,l,f)}function ib(i,s,a){var l=s.pendingProps,f=l.children,p=i!==null?i.memoizedState:null;if(l.mode==="hidden"){if((s.flags&128)!==0){if(l=p!==null?p.baseLanes|a:a,i!==null){for(f=s.child=i.child,p=0;f!==null;)p=p|f.lanes|f.childLanes,f=f.sibling;s.childLanes=p&~l}else s.childLanes=0,s.child=null;return rb(i,s,l,a)}if((a&536870912)!==0)s.memoizedState={baseLanes:0,cachePool:null},i!==null&&Gl(s,p!==null?p.cachePool:null),p!==null?nv(s,p):ld(),Iv(s);else return s.lanes=s.childLanes=536870912,rb(i,s,p!==null?p.baseLanes|a:a,a)}else p!==null?(Gl(s,p.cachePool),nv(s,p),ir(),s.memoizedState=null):(i!==null&&Gl(s,null),ld(),ir());return Lt(i,s,f,a),s.child}function rb(i,s,a,l){var f=nd();return f=f===null?null:{parent:Et._currentValue,pool:f},s.memoizedState={baseLanes:a,cachePool:f},i!==null&&Gl(s,null),ld(),Iv(s),i!==null&&na(i,s,l,!0),null}function cu(i,s){var a=s.ref;if(a===null)i!==null&&i.ref!==null&&(s.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(r(284));(i===null||i.ref!==a)&&(s.flags|=4194816)}}function Md(i,s,a,l,f){return Pr(s),a=fd(i,s,a,l,void 0,f),l=dd(),i!==null&&!Dt?(hd(i,s,f),Oi(i,s,f)):(je&&l&&Yf(s),s.flags|=1,Lt(i,s,a,f),s.child)}function sb(i,s,a,l,f,p){return Pr(s),s.updateQueue=null,a=rv(s,l,a,f),iv(i),l=dd(),i!==null&&!Dt?(hd(i,s,p),Oi(i,s,p)):(je&&l&&Yf(s),s.flags|=1,Lt(i,s,a,p),s.child)}function ob(i,s,a,l,f){if(Pr(s),s.stateNode===null){var p=Ms,v=a.contextType;typeof v=="object"&&v!==null&&(p=Kt(v)),p=new a(l,p),s.memoizedState=p.state!==null&&p.state!==void 0?p.state:null,p.updater=Od,s.stateNode=p,p._reactInternals=s,p=s.stateNode,p.props=l,p.state=s.memoizedState,p.refs={},rd(s),v=a.contextType,p.context=typeof v=="object"&&v!==null?Kt(v):Ms,p.state=s.memoizedState,v=a.getDerivedStateFromProps,typeof v=="function"&&(Rd(s,a,v,l),p.state=s.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof p.getSnapshotBeforeUpdate=="function"||typeof p.UNSAFE_componentWillMount!="function"&&typeof p.componentWillMount!="function"||(v=p.state,typeof p.componentWillMount=="function"&&p.componentWillMount(),typeof p.UNSAFE_componentWillMount=="function"&&p.UNSAFE_componentWillMount(),v!==p.state&&Od.enqueueReplaceState(p,p.state,null),ua(s,l,p,f),la(),p.state=s.memoizedState),typeof p.componentDidMount=="function"&&(s.flags|=4194308),l=!0}else if(i===null){p=s.stateNode;var S=s.memoizedProps,T=Hr(a,S);p.props=T;var D=p.context,z=a.contextType;v=Ms,typeof z=="object"&&z!==null&&(v=Kt(z));var I=a.getDerivedStateFromProps;z=typeof I=="function"||typeof p.getSnapshotBeforeUpdate=="function",S=s.pendingProps!==S,z||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(S||D!==v)&&Fv(s,p,l,v),Qi=!1;var j=s.memoizedState;p.state=j,ua(s,l,p,f),la(),D=s.memoizedState,S||j!==D||Qi?(typeof I=="function"&&(Rd(s,a,I,l),D=s.memoizedState),(T=Qi||Hv(s,a,T,l,j,D,v))?(z||typeof p.UNSAFE_componentWillMount!="function"&&typeof p.componentWillMount!="function"||(typeof p.componentWillMount=="function"&&p.componentWillMount(),typeof p.UNSAFE_componentWillMount=="function"&&p.UNSAFE_componentWillMount()),typeof p.componentDidMount=="function"&&(s.flags|=4194308)):(typeof p.componentDidMount=="function"&&(s.flags|=4194308),s.memoizedProps=l,s.memoizedState=D),p.props=l,p.state=D,p.context=v,l=T):(typeof p.componentDidMount=="function"&&(s.flags|=4194308),l=!1)}else{p=s.stateNode,sd(i,s),v=s.memoizedProps,z=Hr(a,v),p.props=z,I=s.pendingProps,j=p.context,D=a.contextType,T=Ms,typeof D=="object"&&D!==null&&(T=Kt(D)),S=a.getDerivedStateFromProps,(D=typeof S=="function"||typeof p.getSnapshotBeforeUpdate=="function")||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(v!==I||j!==T)&&Fv(s,p,l,T),Qi=!1,j=s.memoizedState,p.state=j,ua(s,l,p,f),la();var L=s.memoizedState;v!==I||j!==L||Qi||i!==null&&i.dependencies!==null&&Hl(i.dependencies)?(typeof S=="function"&&(Rd(s,a,S,l),L=s.memoizedState),(z=Qi||Hv(s,a,z,l,j,L,T)||i!==null&&i.dependencies!==null&&Hl(i.dependencies))?(D||typeof p.UNSAFE_componentWillUpdate!="function"&&typeof p.componentWillUpdate!="function"||(typeof p.componentWillUpdate=="function"&&p.componentWillUpdate(l,L,T),typeof p.UNSAFE_componentWillUpdate=="function"&&p.UNSAFE_componentWillUpdate(l,L,T)),typeof p.componentDidUpdate=="function"&&(s.flags|=4),typeof p.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof p.componentDidUpdate!="function"||v===i.memoizedProps&&j===i.memoizedState||(s.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||v===i.memoizedProps&&j===i.memoizedState||(s.flags|=1024),s.memoizedProps=l,s.memoizedState=L),p.props=l,p.state=L,p.context=T,l=z):(typeof p.componentDidUpdate!="function"||v===i.memoizedProps&&j===i.memoizedState||(s.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||v===i.memoizedProps&&j===i.memoizedState||(s.flags|=1024),l=!1)}return p=l,cu(i,s),l=(s.flags&128)!==0,p||l?(p=s.stateNode,a=l&&typeof a.getDerivedStateFromError!="function"?null:p.render(),s.flags|=1,i!==null&&l?(s.child=zs(s,i.child,null,f),s.child=zs(s,null,a,f)):Lt(i,s,a,f),s.memoizedState=p.state,i=s.child):i=Oi(i,s,f),i}function ab(i,s,a,l){return ea(),s.flags|=256,Lt(i,s,a,l),s.child}var Cd={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function kd(i){return{baseLanes:i,cachePool:Yg()}}function Dd(i,s,a){return i=i!==null?i.childLanes&~a:0,s&&(i|=Cn),i}function lb(i,s,a){var l=s.pendingProps,f=!1,p=(s.flags&128)!==0,v;if((v=p)||(v=i!==null&&i.memoizedState===null?!1:(Rt.current&2)!==0),v&&(f=!0,s.flags&=-129),v=(s.flags&32)!==0,s.flags&=-33,i===null){if(je){if(f?nr(s):ir(),je){var S=it,T;if(T=S){e:{for(T=S,S=Zn;T.nodeType!==8;){if(!S){S=null;break e}if(T=Kn(T.nextSibling),T===null){S=null;break e}}S=T}S!==null?(s.memoizedState={dehydrated:S,treeContext:Lr!==null?{id:xi,overflow:wi}:null,retryLane:536870912,hydrationErrors:null},T=hn(18,null,null,0),T.stateNode=S,T.return=s,s.child=T,Yt=s,it=null,T=!0):T=!1}T||Ur(s)}if(S=s.memoizedState,S!==null&&(S=S.dehydrated,S!==null))return mh(S)?s.lanes=32:s.lanes=536870912,null;Ri(s)}return S=l.children,l=l.fallback,f?(ir(),f=s.mode,S=fu({mode:"hidden",children:S},f),l=Br(l,f,a,null),S.return=s,l.return=s,S.sibling=l,s.child=S,f=s.child,f.memoizedState=kd(a),f.childLanes=Dd(i,v,a),s.memoizedState=Cd,l):(nr(s),Nd(s,S))}if(T=i.memoizedState,T!==null&&(S=T.dehydrated,S!==null)){if(p)s.flags&256?(nr(s),s.flags&=-257,s=$d(i,s,a)):s.memoizedState!==null?(ir(),s.child=i.child,s.flags|=128,s=null):(ir(),f=l.fallback,S=s.mode,l=fu({mode:"visible",children:l.children},S),f=Br(f,S,a,null),f.flags|=2,l.return=s,f.return=s,l.sibling=f,s.child=l,zs(s,i.child,null,a),l=s.child,l.memoizedState=kd(a),l.childLanes=Dd(i,v,a),s.memoizedState=Cd,s=f);else if(nr(s),mh(S)){if(v=S.nextSibling&&S.nextSibling.dataset,v)var D=v.dgst;v=D,l=Error(r(419)),l.stack="",l.digest=v,ta({value:l,source:null,stack:null}),s=$d(i,s,a)}else if(Dt||na(i,s,a,!1),v=(a&i.childLanes)!==0,Dt||v){if(v=Fe,v!==null&&(l=a&-a,l=(l&42)!==0?1:yf(l),l=(l&(v.suspendedLanes|a))!==0?0:l,l!==0&&l!==T.retryLane))throw T.retryLane=l,_s(i,l),vn(v,i,l),Wv;S.data==="$?"||Qd(),s=$d(i,s,a)}else S.data==="$?"?(s.flags|=192,s.child=i.child,s=null):(i=T.treeContext,it=Kn(S.nextSibling),Yt=s,je=!0,zr=null,Zn=!1,i!==null&&(On[_n++]=xi,On[_n++]=wi,On[_n++]=Lr,xi=i.id,wi=i.overflow,Lr=s),s=Nd(s,l.children),s.flags|=4096);return s}return f?(ir(),f=l.fallback,S=s.mode,T=i.child,D=T.sibling,l=Si(T,{mode:"hidden",children:l.children}),l.subtreeFlags=T.subtreeFlags&65011712,D!==null?f=Si(D,f):(f=Br(f,S,a,null),f.flags|=2),f.return=s,l.return=s,l.sibling=f,s.child=l,l=f,f=s.child,S=i.child.memoizedState,S===null?S=kd(a):(T=S.cachePool,T!==null?(D=Et._currentValue,T=T.parent!==D?{parent:D,pool:D}:T):T=Yg(),S={baseLanes:S.baseLanes|a,cachePool:T}),f.memoizedState=S,f.childLanes=Dd(i,v,a),s.memoizedState=Cd,l):(nr(s),a=i.child,i=a.sibling,a=Si(a,{mode:"visible",children:l.children}),a.return=s,a.sibling=null,i!==null&&(v=s.deletions,v===null?(s.deletions=[i],s.flags|=16):v.push(i)),s.child=a,s.memoizedState=null,a)}function Nd(i,s){return s=fu({mode:"visible",children:s},i.mode),s.return=i,i.child=s}function fu(i,s){return i=hn(22,i,null,s),i.lanes=0,i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null},i}function $d(i,s,a){return zs(s,i.child,null,a),i=Nd(s,s.pendingProps.children),i.flags|=2,s.memoizedState=null,i}function ub(i,s,a){i.lanes|=s;var l=i.alternate;l!==null&&(l.lanes|=s),Qf(i.return,s,a)}function jd(i,s,a,l,f){var p=i.memoizedState;p===null?i.memoizedState={isBackwards:s,rendering:null,renderingStartTime:0,last:l,tail:a,tailMode:f}:(p.isBackwards=s,p.rendering=null,p.renderingStartTime=0,p.last=l,p.tail=a,p.tailMode=f)}function cb(i,s,a){var l=s.pendingProps,f=l.revealOrder,p=l.tail;if(Lt(i,s,l.children,a),l=Rt.current,(l&2)!==0)l=l&1|2,s.flags|=128;else{if(i!==null&&(i.flags&128)!==0)e:for(i=s.child;i!==null;){if(i.tag===13)i.memoizedState!==null&&ub(i,a,s);else if(i.tag===19)ub(i,a,s);else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===s)break e;for(;i.sibling===null;){if(i.return===null||i.return===s)break e;i=i.return}i.sibling.return=i.return,i=i.sibling}l&=1}switch(Z(Rt,l),f){case"forwards":for(a=s.child,f=null;a!==null;)i=a.alternate,i!==null&&au(i)===null&&(f=a),a=a.sibling;a=f,a===null?(f=s.child,s.child=null):(f=a.sibling,a.sibling=null),jd(s,!1,f,a,p);break;case"backwards":for(a=null,f=s.child,s.child=null;f!==null;){if(i=f.alternate,i!==null&&au(i)===null){s.child=f;break}i=f.sibling,f.sibling=a,a=f,f=i}jd(s,!0,a,null,p);break;case"together":jd(s,!1,null,null,void 0);break;default:s.memoizedState=null}return s.child}function Oi(i,s,a){if(i!==null&&(s.dependencies=i.dependencies),lr|=s.lanes,(a&s.childLanes)===0)if(i!==null){if(na(i,s,a,!1),(a&s.childLanes)===0)return null}else return null;if(i!==null&&s.child!==i.child)throw Error(r(153));if(s.child!==null){for(i=s.child,a=Si(i,i.pendingProps),s.child=a,a.return=s;i.sibling!==null;)i=i.sibling,a=a.sibling=Si(i,i.pendingProps),a.return=s;a.sibling=null}return s.child}function Bd(i,s){return(i.lanes&s)!==0?!0:(i=i.dependencies,!!(i!==null&&Hl(i)))}function i_(i,s,a){switch(s.tag){case 3:Ne(s,s.stateNode.containerInfo),Ji(s,Et,i.memoizedState.cache),ea();break;case 27:case 5:Gi(s);break;case 4:Ne(s,s.stateNode.containerInfo);break;case 10:Ji(s,s.type,s.memoizedProps.value);break;case 13:var l=s.memoizedState;if(l!==null)return l.dehydrated!==null?(nr(s),s.flags|=128,null):(a&s.child.childLanes)!==0?lb(i,s,a):(nr(s),i=Oi(i,s,a),i!==null?i.sibling:null);nr(s);break;case 19:var f=(i.flags&128)!==0;if(l=(a&s.childLanes)!==0,l||(na(i,s,a,!1),l=(a&s.childLanes)!==0),f){if(l)return cb(i,s,a);s.flags|=128}if(f=s.memoizedState,f!==null&&(f.rendering=null,f.tail=null,f.lastEffect=null),Z(Rt,Rt.current),l)break;return null;case 22:case 23:return s.lanes=0,ib(i,s,a);case 24:Ji(s,Et,i.memoizedState.cache)}return Oi(i,s,a)}function fb(i,s,a){if(i!==null)if(i.memoizedProps!==s.pendingProps)Dt=!0;else{if(!Bd(i,a)&&(s.flags&128)===0)return Dt=!1,i_(i,s,a);Dt=(i.flags&131072)!==0}else Dt=!1,je&&(s.flags&1048576)!==0&&qg(s,Il,s.index);switch(s.lanes=0,s.tag){case 16:e:{i=s.pendingProps;var l=s.elementType,f=l._init;if(l=f(l._payload),s.type=l,typeof l=="function")Hf(l)?(i=Hr(l,i),s.tag=1,s=ob(null,s,l,i,a)):(s.tag=0,s=Md(null,s,l,i,a));else{if(l!=null){if(f=l.$$typeof,f===G){s.tag=11,s=eb(null,s,l,i,a);break e}else if(f===ne){s.tag=14,s=tb(null,s,l,i,a);break e}}throw s=he(l)||l,Error(r(306,s,""))}}return s;case 0:return Md(i,s,s.type,s.pendingProps,a);case 1:return l=s.type,f=Hr(l,s.pendingProps),ob(i,s,l,f,a);case 3:e:{if(Ne(s,s.stateNode.containerInfo),i===null)throw Error(r(387));l=s.pendingProps;var p=s.memoizedState;f=p.element,sd(i,s),ua(s,l,null,a);var v=s.memoizedState;if(l=v.cache,Ji(s,Et,l),l!==p.cache&&Wf(s,[Et],a,!0),la(),l=v.element,p.isDehydrated)if(p={element:l,isDehydrated:!1,cache:v.cache},s.updateQueue.baseState=p,s.memoizedState=p,s.flags&256){s=ab(i,s,l,a);break e}else if(l!==f){f=En(Error(r(424)),s),ta(f),s=ab(i,s,l,a);break e}else{switch(i=s.stateNode.containerInfo,i.nodeType){case 9:i=i.body;break;default:i=i.nodeName==="HTML"?i.ownerDocument.body:i}for(it=Kn(i.firstChild),Yt=s,je=!0,zr=null,Zn=!0,a=Kv(s,null,l,a),s.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if(ea(),l===f){s=Oi(i,s,a);break e}Lt(i,s,l,a)}s=s.child}return s;case 26:return cu(i,s),i===null?(a=m0(s.type,null,s.pendingProps,null))?s.memoizedState=a:je||(a=s.type,i=s.pendingProps,l=Eu(ie.current).createElement(a),l[Pt]=s,l[Qt]=i,zt(l,a,i),kt(l),s.stateNode=l):s.memoizedState=m0(s.type,i.memoizedProps,s.pendingProps,i.memoizedState),null;case 27:return Gi(s),i===null&&je&&(l=s.stateNode=d0(s.type,s.pendingProps,ie.current),Yt=s,Zn=!0,f=it,dr(s.type)?(yh=f,it=Kn(l.firstChild)):it=f),Lt(i,s,s.pendingProps.children,a),cu(i,s),i===null&&(s.flags|=4194304),s.child;case 5:return i===null&&je&&((f=l=it)&&(l=k_(l,s.type,s.pendingProps,Zn),l!==null?(s.stateNode=l,Yt=s,it=Kn(l.firstChild),Zn=!1,f=!0):f=!1),f||Ur(s)),Gi(s),f=s.type,p=s.pendingProps,v=i!==null?i.memoizedProps:null,l=p.children,dh(f,p)?l=null:v!==null&&dh(f,v)&&(s.flags|=32),s.memoizedState!==null&&(f=fd(i,s,XO,null,null,a),ka._currentValue=f),cu(i,s),Lt(i,s,l,a),s.child;case 6:return i===null&&je&&((i=a=it)&&(a=D_(a,s.pendingProps,Zn),a!==null?(s.stateNode=a,Yt=s,it=null,i=!0):i=!1),i||Ur(s)),null;case 13:return lb(i,s,a);case 4:return Ne(s,s.stateNode.containerInfo),l=s.pendingProps,i===null?s.child=zs(s,null,l,a):Lt(i,s,l,a),s.child;case 11:return eb(i,s,s.type,s.pendingProps,a);case 7:return Lt(i,s,s.pendingProps,a),s.child;case 8:return Lt(i,s,s.pendingProps.children,a),s.child;case 12:return Lt(i,s,s.pendingProps.children,a),s.child;case 10:return l=s.pendingProps,Ji(s,s.type,l.value),Lt(i,s,l.children,a),s.child;case 9:return f=s.type._context,l=s.pendingProps.children,Pr(s),f=Kt(f),l=l(f),s.flags|=1,Lt(i,s,l,a),s.child;case 14:return tb(i,s,s.type,s.pendingProps,a);case 15:return nb(i,s,s.type,s.pendingProps,a);case 19:return cb(i,s,a);case 31:return l=s.pendingProps,a=s.mode,l={mode:l.mode,children:l.children},i===null?(a=fu(l,a),a.ref=s.ref,s.child=a,a.return=s,s=a):(a=Si(i.child,l),a.ref=s.ref,s.child=a,a.return=s,s=a),s;case 22:return ib(i,s,a);case 24:return Pr(s),l=Kt(Et),i===null?(f=nd(),f===null&&(f=Fe,p=ed(),f.pooledCache=p,p.refCount++,p!==null&&(f.pooledCacheLanes|=a),f=p),s.memoizedState={parent:l,cache:f},rd(s),Ji(s,Et,f)):((i.lanes&a)!==0&&(sd(i,s),ua(s,null,null,a),la()),f=i.memoizedState,p=s.memoizedState,f.parent!==l?(f={parent:l,cache:l},s.memoizedState=f,s.lanes===0&&(s.memoizedState=s.updateQueue.baseState=f),Ji(s,Et,l)):(l=p.cache,Ji(s,Et,l),l!==f.cache&&Wf(s,[Et],a,!0))),Lt(i,s,s.pendingProps.children,a),s.child;case 29:throw s.pendingProps}throw Error(r(156,s.tag))}function _i(i){i.flags|=4}function db(i,s){if(s.type!=="stylesheet"||(s.state.loading&4)!==0)i.flags&=-16777217;else if(i.flags|=16777216,!S0(s)){if(s=Mn.current,s!==null&&((ke&4194048)===ke?Jn!==null:(ke&62914560)!==ke&&(ke&536870912)===0||s!==Jn))throw oa=id,Xg;i.flags|=8192}}function du(i,s){s!==null&&(i.flags|=4),i.flags&16384&&(s=i.tag!==22?Iy():536870912,i.lanes|=s,Ks|=s)}function ya(i,s){if(!je)switch(i.tailMode){case"hidden":s=i.tail;for(var a=null;s!==null;)s.alternate!==null&&(a=s),s=s.sibling;a===null?i.tail=null:a.sibling=null;break;case"collapsed":a=i.tail;for(var l=null;a!==null;)a.alternate!==null&&(l=a),a=a.sibling;l===null?s||i.tail===null?i.tail=null:i.tail.sibling=null:l.sibling=null}}function et(i){var s=i.alternate!==null&&i.alternate.child===i.child,a=0,l=0;if(s)for(var f=i.child;f!==null;)a|=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;)a|=f.lanes|f.childLanes,l|=f.subtreeFlags,l|=f.flags,f.return=i,f=f.sibling;return i.subtreeFlags|=l,i.childLanes=a,s}function r_(i,s,a){var l=s.pendingProps;switch(Xf(s),s.tag){case 31:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return et(s),null;case 1:return et(s),null;case 3:return a=s.stateNode,l=null,i!==null&&(l=i.memoizedState.cache),s.memoizedState.cache!==l&&(s.flags|=2048),Ti(Et),ln(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(i===null||i.child===null)&&(Wo(s)?_i(s):i===null||i.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,Ig())),et(s),null;case 26:return a=s.memoizedState,i===null?(_i(s),a!==null?(et(s),db(s,a)):(et(s),s.flags&=-16777217)):a?a!==i.memoizedState?(_i(s),et(s),db(s,a)):(et(s),s.flags&=-16777217):(i.memoizedProps!==l&&_i(s),et(s),s.flags&=-16777217),null;case 27:ye(s),a=ie.current;var f=s.type;if(i!==null&&s.stateNode!=null)i.memoizedProps!==l&&_i(s);else{if(!l){if(s.stateNode===null)throw Error(r(166));return et(s),null}i=re.current,Wo(s)?Pg(s):(i=d0(f,l,a),s.stateNode=i,_i(s))}return et(s),null;case 5:if(ye(s),a=s.type,i!==null&&s.stateNode!=null)i.memoizedProps!==l&&_i(s);else{if(!l){if(s.stateNode===null)throw Error(r(166));return et(s),null}if(i=re.current,Wo(s))Pg(s);else{switch(f=Eu(ie.current),i){case 1:i=f.createElementNS("http://www.w3.org/2000/svg",a);break;case 2:i=f.createElementNS("http://www.w3.org/1998/Math/MathML",a);break;default:switch(a){case"svg":i=f.createElementNS("http://www.w3.org/2000/svg",a);break;case"math":i=f.createElementNS("http://www.w3.org/1998/Math/MathML",a);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(a,{is:l.is}):f.createElement(a)}}i[Pt]=s,i[Qt]=l;e:for(f=s.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===s)break e;for(;f.sibling===null;){if(f.return===null||f.return===s)break e;f=f.return}f.sibling.return=f.return,f=f.sibling}s.stateNode=i;e:switch(zt(i,a,l),a){case"button":case"input":case"select":case"textarea":i=!!l.autoFocus;break e;case"img":i=!0;break e;default:i=!1}i&&_i(s)}}return et(s),s.flags&=-16777217,null;case 6:if(i&&s.stateNode!=null)i.memoizedProps!==l&&_i(s);else{if(typeof l!="string"&&s.stateNode===null)throw Error(r(166));if(i=ie.current,Wo(s)){if(i=s.stateNode,a=s.memoizedProps,l=null,f=Yt,f!==null)switch(f.tag){case 27:case 5:l=f.memoizedProps}i[Pt]=s,i=!!(i.nodeValue===a||l!==null&&l.suppressHydrationWarning===!0||s0(i.nodeValue,a)),i||Ur(s)}else i=Eu(i).createTextNode(l),i[Pt]=s,s.stateNode=i}return et(s),null;case 13:if(l=s.memoizedState,i===null||i.memoizedState!==null&&i.memoizedState.dehydrated!==null){if(f=Wo(s),l!==null&&l.dehydrated!==null){if(i===null){if(!f)throw Error(r(318));if(f=s.memoizedState,f=f!==null?f.dehydrated:null,!f)throw Error(r(317));f[Pt]=s}else ea(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;et(s),f=!1}else f=Ig(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=f),f=!0;if(!f)return s.flags&256?(Ri(s),s):(Ri(s),null)}if(Ri(s),(s.flags&128)!==0)return s.lanes=a,s;if(a=l!==null,i=i!==null&&i.memoizedState!==null,a){l=s.child,f=null,l.alternate!==null&&l.alternate.memoizedState!==null&&l.alternate.memoizedState.cachePool!==null&&(f=l.alternate.memoizedState.cachePool.pool);var p=null;l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(p=l.memoizedState.cachePool.pool),p!==f&&(l.flags|=2048)}return a!==i&&a&&(s.child.flags|=8192),du(s,s.updateQueue),et(s),null;case 4:return ln(),i===null&&ah(s.stateNode.containerInfo),et(s),null;case 10:return Ti(s.type),et(s),null;case 19:if(H(Rt),f=s.memoizedState,f===null)return et(s),null;if(l=(s.flags&128)!==0,p=f.rendering,p===null)if(l)ya(f,!1);else{if(rt!==0||i!==null&&(i.flags&128)!==0)for(i=s.child;i!==null;){if(p=au(i),p!==null){for(s.flags|=128,ya(f,!1),i=p.updateQueue,s.updateQueue=i,du(s,i),s.subtreeFlags=0,i=a,a=s.child;a!==null;)Ug(a,i),a=a.sibling;return Z(Rt,Rt.current&1|2),s.child}i=i.sibling}f.tail!==null&&ut()>mu&&(s.flags|=128,l=!0,ya(f,!1),s.lanes=4194304)}else{if(!l)if(i=au(p),i!==null){if(s.flags|=128,l=!0,i=i.updateQueue,s.updateQueue=i,du(s,i),ya(f,!0),f.tail===null&&f.tailMode==="hidden"&&!p.alternate&&!je)return et(s),null}else 2*ut()-f.renderingStartTime>mu&&a!==536870912&&(s.flags|=128,l=!0,ya(f,!1),s.lanes=4194304);f.isBackwards?(p.sibling=s.child,s.child=p):(i=f.last,i!==null?i.sibling=p:s.child=p,f.last=p)}return f.tail!==null?(s=f.tail,f.rendering=s,f.tail=s.sibling,f.renderingStartTime=ut(),s.sibling=null,i=Rt.current,Z(Rt,l?i&1|2:i&1),s):(et(s),null);case 22:case 23:return Ri(s),ud(),l=s.memoizedState!==null,i!==null?i.memoizedState!==null!==l&&(s.flags|=8192):l&&(s.flags|=8192),l?(a&536870912)!==0&&(s.flags&128)===0&&(et(s),s.subtreeFlags&6&&(s.flags|=8192)):et(s),a=s.updateQueue,a!==null&&du(s,a.retryQueue),a=null,i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(a=i.memoizedState.cachePool.pool),l=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(l=s.memoizedState.cachePool.pool),l!==a&&(s.flags|=2048),i!==null&&H(Kr),null;case 24:return a=null,i!==null&&(a=i.memoizedState.cache),s.memoizedState.cache!==a&&(s.flags|=2048),Ti(Et),et(s),null;case 25:return null;case 30:return null}throw Error(r(156,s.tag))}function s_(i,s){switch(Xf(s),s.tag){case 1:return i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 3:return Ti(Et),ln(),i=s.flags,(i&65536)!==0&&(i&128)===0?(s.flags=i&-65537|128,s):null;case 26:case 27:case 5:return ye(s),null;case 13:if(Ri(s),i=s.memoizedState,i!==null&&i.dehydrated!==null){if(s.alternate===null)throw Error(r(340));ea()}return i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 19:return H(Rt),null;case 4:return ln(),null;case 10:return Ti(s.type),null;case 22:case 23:return Ri(s),ud(),i!==null&&H(Kr),i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 24:return Ti(Et),null;case 25:return null;default:return null}}function hb(i,s){switch(Xf(s),s.tag){case 3:Ti(Et),ln();break;case 26:case 27:case 5:ye(s);break;case 4:ln();break;case 13:Ri(s);break;case 19:H(Rt);break;case 10:Ti(s.type);break;case 22:case 23:Ri(s),ud(),i!==null&&H(Kr);break;case 24:Ti(Et)}}function ga(i,s){try{var a=s.updateQueue,l=a!==null?a.lastEffect:null;if(l!==null){var f=l.next;a=f;do{if((a.tag&i)===i){l=void 0;var p=a.create,v=a.inst;l=p(),v.destroy=l}a=a.next}while(a!==f)}}catch(S){Ke(s,s.return,S)}}function rr(i,s,a){try{var l=s.updateQueue,f=l!==null?l.lastEffect:null;if(f!==null){var p=f.next;l=p;do{if((l.tag&i)===i){var v=l.inst,S=v.destroy;if(S!==void 0){v.destroy=void 0,f=s;var T=a,D=S;try{D()}catch(z){Ke(f,T,z)}}}l=l.next}while(l!==p)}}catch(z){Ke(s,s.return,z)}}function pb(i){var s=i.updateQueue;if(s!==null){var a=i.stateNode;try{tv(s,a)}catch(l){Ke(i,i.return,l)}}}function mb(i,s,a){a.props=Hr(i.type,i.memoizedProps),a.state=i.memoizedState;try{a.componentWillUnmount()}catch(l){Ke(i,s,l)}}function va(i,s){try{var a=i.ref;if(a!==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 a=="function"?i.refCleanup=a(l):a.current=l}}catch(f){Ke(i,s,f)}}function Qn(i,s){var a=i.ref,l=i.refCleanup;if(a!==null)if(typeof l=="function")try{l()}catch(f){Ke(i,s,f)}finally{i.refCleanup=null,i=i.alternate,i!=null&&(i.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(f){Ke(i,s,f)}else a.current=null}function yb(i){var s=i.type,a=i.memoizedProps,l=i.stateNode;try{e:switch(s){case"button":case"input":case"select":case"textarea":a.autoFocus&&l.focus();break e;case"img":a.src?l.src=a.src:a.srcSet&&(l.srcset=a.srcSet)}}catch(f){Ke(i,i.return,f)}}function Ld(i,s,a){try{var l=i.stateNode;R_(l,i.type,a,s),l[Qt]=s}catch(f){Ke(i,i.return,f)}}function gb(i){return i.tag===5||i.tag===3||i.tag===26||i.tag===27&&dr(i.type)||i.tag===4}function Vd(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||gb(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&&dr(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 zd(i,s,a){var l=i.tag;if(l===5||l===6)i=i.stateNode,s?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(i,s):(s=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,s.appendChild(i),a=a._reactRootContainer,a!=null||s.onclick!==null||(s.onclick=Tu));else if(l!==4&&(l===27&&dr(i.type)&&(a=i.stateNode,s=null),i=i.child,i!==null))for(zd(i,s,a),i=i.sibling;i!==null;)zd(i,s,a),i=i.sibling}function hu(i,s,a){var l=i.tag;if(l===5||l===6)i=i.stateNode,s?a.insertBefore(i,s):a.appendChild(i);else if(l!==4&&(l===27&&dr(i.type)&&(a=i.stateNode),i=i.child,i!==null))for(hu(i,s,a),i=i.sibling;i!==null;)hu(i,s,a),i=i.sibling}function vb(i){var s=i.stateNode,a=i.memoizedProps;try{for(var l=i.type,f=s.attributes;f.length;)s.removeAttributeNode(f[0]);zt(s,l,a),s[Pt]=i,s[Qt]=a}catch(p){Ke(i,i.return,p)}}var Mi=!1,ft=!1,Ud=!1,bb=typeof WeakSet=="function"?WeakSet:Set,Nt=null;function o_(i,s){if(i=i.containerInfo,ch=ku,i=Cg(i),Vf(i)){if("selectionStart"in i)var a={start:i.selectionStart,end:i.selectionEnd};else e:{a=(a=i.ownerDocument)&&a.defaultView||window;var l=a.getSelection&&a.getSelection();if(l&&l.rangeCount!==0){a=l.anchorNode;var f=l.anchorOffset,p=l.focusNode;l=l.focusOffset;try{a.nodeType,p.nodeType}catch{a=null;break e}var v=0,S=-1,T=-1,D=0,z=0,I=i,j=null;t:for(;;){for(var L;I!==a||f!==0&&I.nodeType!==3||(S=v+f),I!==p||l!==0&&I.nodeType!==3||(T=v+l),I.nodeType===3&&(v+=I.nodeValue.length),(L=I.firstChild)!==null;)j=I,I=L;for(;;){if(I===i)break t;if(j===a&&++D===f&&(S=v),j===p&&++z===l&&(T=v),(L=I.nextSibling)!==null)break;I=j,j=I.parentNode}I=L}a=S===-1||T===-1?null:{start:S,end:T}}else a=null}a=a||{start:0,end:0}}else a=null;for(fh={focusedElem:i,selectionRange:a},ku=!1,Nt=s;Nt!==null;)if(s=Nt,i=s.child,(s.subtreeFlags&1024)!==0&&i!==null)i.return=s,Nt=i;else for(;Nt!==null;){switch(s=Nt,p=s.alternate,i=s.flags,s.tag){case 0:break;case 11:case 15:break;case 1:if((i&1024)!==0&&p!==null){i=void 0,a=s,f=p.memoizedProps,p=p.memoizedState,l=a.stateNode;try{var fe=Hr(a.type,f,a.elementType===a.type);i=l.getSnapshotBeforeUpdate(fe,p),l.__reactInternalSnapshotBeforeUpdate=i}catch(ae){Ke(a,a.return,ae)}}break;case 3:if((i&1024)!==0){if(i=s.stateNode.containerInfo,a=i.nodeType,a===9)ph(i);else if(a===1)switch(i.nodeName){case"HEAD":case"HTML":case"BODY":ph(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(r(163))}if(i=s.sibling,i!==null){i.return=s.return,Nt=i;break}Nt=s.return}}function Sb(i,s,a){var l=a.flags;switch(a.tag){case 0:case 11:case 15:sr(i,a),l&4&&ga(5,a);break;case 1:if(sr(i,a),l&4)if(i=a.stateNode,s===null)try{i.componentDidMount()}catch(v){Ke(a,a.return,v)}else{var f=Hr(a.type,s.memoizedProps);s=s.memoizedState;try{i.componentDidUpdate(f,s,i.__reactInternalSnapshotBeforeUpdate)}catch(v){Ke(a,a.return,v)}}l&64&&pb(a),l&512&&va(a,a.return);break;case 3:if(sr(i,a),l&64&&(i=a.updateQueue,i!==null)){if(s=null,a.child!==null)switch(a.child.tag){case 27:case 5:s=a.child.stateNode;break;case 1:s=a.child.stateNode}try{tv(i,s)}catch(v){Ke(a,a.return,v)}}break;case 27:s===null&&l&4&&vb(a);case 26:case 5:sr(i,a),s===null&&l&4&&yb(a),l&512&&va(a,a.return);break;case 12:sr(i,a);break;case 13:sr(i,a),l&4&&Ab(i,a),l&64&&(i=a.memoizedState,i!==null&&(i=i.dehydrated,i!==null&&(a=m_.bind(null,a),N_(i,a))));break;case 22:if(l=a.memoizedState!==null||Mi,!l){s=s!==null&&s.memoizedState!==null||ft,f=Mi;var p=ft;Mi=l,(ft=s)&&!p?or(i,a,(a.subtreeFlags&8772)!==0):sr(i,a),Mi=f,ft=p}break;case 30:break;default:sr(i,a)}}function xb(i){var s=i.alternate;s!==null&&(i.alternate=null,xb(s)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(s=i.stateNode,s!==null&&bf(s)),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 Qe=null,tn=!1;function Ci(i,s,a){for(a=a.child;a!==null;)wb(i,s,a),a=a.sibling}function wb(i,s,a){if(cn&&typeof cn.onCommitFiberUnmount=="function")try{cn.onCommitFiberUnmount(zo,a)}catch{}switch(a.tag){case 26:ft||Qn(a,s),Ci(i,s,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:ft||Qn(a,s);var l=Qe,f=tn;dr(a.type)&&(Qe=a.stateNode,tn=!1),Ci(i,s,a),Oa(a.stateNode),Qe=l,tn=f;break;case 5:ft||Qn(a,s);case 6:if(l=Qe,f=tn,Qe=null,Ci(i,s,a),Qe=l,tn=f,Qe!==null)if(tn)try{(Qe.nodeType===9?Qe.body:Qe.nodeName==="HTML"?Qe.ownerDocument.body:Qe).removeChild(a.stateNode)}catch(p){Ke(a,s,p)}else try{Qe.removeChild(a.stateNode)}catch(p){Ke(a,s,p)}break;case 18:Qe!==null&&(tn?(i=Qe,c0(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,a.stateNode),ja(i)):c0(Qe,a.stateNode));break;case 4:l=Qe,f=tn,Qe=a.stateNode.containerInfo,tn=!0,Ci(i,s,a),Qe=l,tn=f;break;case 0:case 11:case 14:case 15:ft||rr(2,a,s),ft||rr(4,a,s),Ci(i,s,a);break;case 1:ft||(Qn(a,s),l=a.stateNode,typeof l.componentWillUnmount=="function"&&mb(a,s,l)),Ci(i,s,a);break;case 21:Ci(i,s,a);break;case 22:ft=(l=ft)||a.memoizedState!==null,Ci(i,s,a),ft=l;break;default:Ci(i,s,a)}}function Ab(i,s){if(s.memoizedState===null&&(i=s.alternate,i!==null&&(i=i.memoizedState,i!==null&&(i=i.dehydrated,i!==null))))try{ja(i)}catch(a){Ke(s,s.return,a)}}function a_(i){switch(i.tag){case 13:case 19:var s=i.stateNode;return s===null&&(s=i.stateNode=new bb),s;case 22:return i=i.stateNode,s=i._retryCache,s===null&&(s=i._retryCache=new bb),s;default:throw Error(r(435,i.tag))}}function qd(i,s){var a=a_(i);s.forEach(function(l){var f=y_.bind(null,i,l);a.has(l)||(a.add(l),l.then(f,f))})}function pn(i,s){var a=s.deletions;if(a!==null)for(var l=0;l<a.length;l++){var f=a[l],p=i,v=s,S=v;e:for(;S!==null;){switch(S.tag){case 27:if(dr(S.type)){Qe=S.stateNode,tn=!1;break e}break;case 5:Qe=S.stateNode,tn=!1;break e;case 3:case 4:Qe=S.stateNode.containerInfo,tn=!0;break e}S=S.return}if(Qe===null)throw Error(r(160));wb(p,v,f),Qe=null,tn=!1,p=f.alternate,p!==null&&(p.return=null),f.return=null}if(s.subtreeFlags&13878)for(s=s.child;s!==null;)Tb(s,i),s=s.sibling}var Pn=null;function Tb(i,s){var a=i.alternate,l=i.flags;switch(i.tag){case 0:case 11:case 14:case 15:pn(s,i),mn(i),l&4&&(rr(3,i,i.return),ga(3,i),rr(5,i,i.return));break;case 1:pn(s,i),mn(i),l&512&&(ft||a===null||Qn(a,a.return)),l&64&&Mi&&(i=i.updateQueue,i!==null&&(l=i.callbacks,l!==null&&(a=i.shared.hiddenCallbacks,i.shared.hiddenCallbacks=a===null?l:a.concat(l))));break;case 26:var f=Pn;if(pn(s,i),mn(i),l&512&&(ft||a===null||Qn(a,a.return)),l&4){var p=a!==null?a.memoizedState:null;if(l=i.memoizedState,a===null)if(l===null)if(i.stateNode===null){e:{l=i.type,a=i.memoizedProps,f=f.ownerDocument||f;t:switch(l){case"title":p=f.getElementsByTagName("title")[0],(!p||p[Po]||p[Pt]||p.namespaceURI==="http://www.w3.org/2000/svg"||p.hasAttribute("itemprop"))&&(p=f.createElement(l),f.head.insertBefore(p,f.querySelector("head > title"))),zt(p,l,a),p[Pt]=i,kt(p),l=p;break e;case"link":var v=v0("link","href",f).get(l+(a.href||""));if(v){for(var S=0;S<v.length;S++)if(p=v[S],p.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&p.getAttribute("rel")===(a.rel==null?null:a.rel)&&p.getAttribute("title")===(a.title==null?null:a.title)&&p.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){v.splice(S,1);break t}}p=f.createElement(l),zt(p,l,a),f.head.appendChild(p);break;case"meta":if(v=v0("meta","content",f).get(l+(a.content||""))){for(S=0;S<v.length;S++)if(p=v[S],p.getAttribute("content")===(a.content==null?null:""+a.content)&&p.getAttribute("name")===(a.name==null?null:a.name)&&p.getAttribute("property")===(a.property==null?null:a.property)&&p.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&p.getAttribute("charset")===(a.charSet==null?null:a.charSet)){v.splice(S,1);break t}}p=f.createElement(l),zt(p,l,a),f.head.appendChild(p);break;default:throw Error(r(468,l))}p[Pt]=i,kt(p),l=p}i.stateNode=l}else b0(f,i.type,i.stateNode);else i.stateNode=g0(f,l,i.memoizedProps);else p!==l?(p===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):p.count--,l===null?b0(f,i.type,i.stateNode):g0(f,l,i.memoizedProps)):l===null&&i.stateNode!==null&&Ld(i,i.memoizedProps,a.memoizedProps)}break;case 27:pn(s,i),mn(i),l&512&&(ft||a===null||Qn(a,a.return)),a!==null&&l&4&&Ld(i,i.memoizedProps,a.memoizedProps);break;case 5:if(pn(s,i),mn(i),l&512&&(ft||a===null||Qn(a,a.return)),i.flags&32){f=i.stateNode;try{xs(f,"")}catch(L){Ke(i,i.return,L)}}l&4&&i.stateNode!=null&&(f=i.memoizedProps,Ld(i,f,a!==null?a.memoizedProps:f)),l&1024&&(Ud=!0);break;case 6:if(pn(s,i),mn(i),l&4){if(i.stateNode===null)throw Error(r(162));l=i.memoizedProps,a=i.stateNode;try{a.nodeValue=l}catch(L){Ke(i,i.return,L)}}break;case 3:if(_u=null,f=Pn,Pn=Ru(s.containerInfo),pn(s,i),Pn=f,mn(i),l&4&&a!==null&&a.memoizedState.isDehydrated)try{ja(s.containerInfo)}catch(L){Ke(i,i.return,L)}Ud&&(Ud=!1,Eb(i));break;case 4:l=Pn,Pn=Ru(i.stateNode.containerInfo),pn(s,i),mn(i),Pn=l;break;case 12:pn(s,i),mn(i);break;case 13:pn(s,i),mn(i),i.child.flags&8192&&i.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(Gd=ut()),l&4&&(l=i.updateQueue,l!==null&&(i.updateQueue=null,qd(i,l)));break;case 22:f=i.memoizedState!==null;var T=a!==null&&a.memoizedState!==null,D=Mi,z=ft;if(Mi=D||f,ft=z||T,pn(s,i),ft=z,Mi=D,mn(i),l&8192)e:for(s=i.stateNode,s._visibility=f?s._visibility&-2:s._visibility|1,f&&(a===null||T||Mi||ft||Fr(i)),a=null,s=i;;){if(s.tag===5||s.tag===26){if(a===null){T=a=s;try{if(p=T.stateNode,f)v=p.style,typeof v.setProperty=="function"?v.setProperty("display","none","important"):v.display="none";else{S=T.stateNode;var I=T.memoizedProps.style,j=I!=null&&I.hasOwnProperty("display")?I.display:null;S.style.display=j==null||typeof j=="boolean"?"":(""+j).trim()}}catch(L){Ke(T,T.return,L)}}}else if(s.tag===6){if(a===null){T=s;try{T.stateNode.nodeValue=f?"":T.memoizedProps}catch(L){Ke(T,T.return,L)}}}else if((s.tag!==22&&s.tag!==23||s.memoizedState===null||s===i)&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===i)break e;for(;s.sibling===null;){if(s.return===null||s.return===i)break e;a===s&&(a=null),s=s.return}a===s&&(a=null),s.sibling.return=s.return,s=s.sibling}l&4&&(l=i.updateQueue,l!==null&&(a=l.retryQueue,a!==null&&(l.retryQueue=null,qd(i,a))));break;case 19:pn(s,i),mn(i),l&4&&(l=i.updateQueue,l!==null&&(i.updateQueue=null,qd(i,l)));break;case 30:break;case 21:break;default:pn(s,i),mn(i)}}function mn(i){var s=i.flags;if(s&2){try{for(var a,l=i.return;l!==null;){if(gb(l)){a=l;break}l=l.return}if(a==null)throw Error(r(160));switch(a.tag){case 27:var f=a.stateNode,p=Vd(i);hu(i,p,f);break;case 5:var v=a.stateNode;a.flags&32&&(xs(v,""),a.flags&=-33);var S=Vd(i);hu(i,S,v);break;case 3:case 4:var T=a.stateNode.containerInfo,D=Vd(i);zd(i,D,T);break;default:throw Error(r(161))}}catch(z){Ke(i,i.return,z)}i.flags&=-3}s&4096&&(i.flags&=-4097)}function Eb(i){if(i.subtreeFlags&1024)for(i=i.child;i!==null;){var s=i;Eb(s),s.tag===5&&s.flags&1024&&s.stateNode.reset(),i=i.sibling}}function sr(i,s){if(s.subtreeFlags&8772)for(s=s.child;s!==null;)Sb(i,s.alternate,s),s=s.sibling}function Fr(i){for(i=i.child;i!==null;){var s=i;switch(s.tag){case 0:case 11:case 14:case 15:rr(4,s,s.return),Fr(s);break;case 1:Qn(s,s.return);var a=s.stateNode;typeof a.componentWillUnmount=="function"&&mb(s,s.return,a),Fr(s);break;case 27:Oa(s.stateNode);case 26:case 5:Qn(s,s.return),Fr(s);break;case 22:s.memoizedState===null&&Fr(s);break;case 30:Fr(s);break;default:Fr(s)}i=i.sibling}}function or(i,s,a){for(a=a&&(s.subtreeFlags&8772)!==0,s=s.child;s!==null;){var l=s.alternate,f=i,p=s,v=p.flags;switch(p.tag){case 0:case 11:case 15:or(f,p,a),ga(4,p);break;case 1:if(or(f,p,a),l=p,f=l.stateNode,typeof f.componentDidMount=="function")try{f.componentDidMount()}catch(D){Ke(l,l.return,D)}if(l=p,f=l.updateQueue,f!==null){var S=l.stateNode;try{var T=f.shared.hiddenCallbacks;if(T!==null)for(f.shared.hiddenCallbacks=null,f=0;f<T.length;f++)ev(T[f],S)}catch(D){Ke(l,l.return,D)}}a&&v&64&&pb(p),va(p,p.return);break;case 27:vb(p);case 26:case 5:or(f,p,a),a&&l===null&&v&4&&yb(p),va(p,p.return);break;case 12:or(f,p,a);break;case 13:or(f,p,a),a&&v&4&&Ab(f,p);break;case 22:p.memoizedState===null&&or(f,p,a),va(p,p.return);break;case 30:break;default:or(f,p,a)}s=s.sibling}}function Pd(i,s){var a=null;i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(a=i.memoizedState.cachePool.pool),i=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(i=s.memoizedState.cachePool.pool),i!==a&&(i!=null&&i.refCount++,a!=null&&ia(a))}function Kd(i,s){i=null,s.alternate!==null&&(i=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==i&&(s.refCount++,i!=null&&ia(i))}function Wn(i,s,a,l){if(s.subtreeFlags&10256)for(s=s.child;s!==null;)Rb(i,s,a,l),s=s.sibling}function Rb(i,s,a,l){var f=s.flags;switch(s.tag){case 0:case 11:case 15:Wn(i,s,a,l),f&2048&&ga(9,s);break;case 1:Wn(i,s,a,l);break;case 3:Wn(i,s,a,l),f&2048&&(i=null,s.alternate!==null&&(i=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==i&&(s.refCount++,i!=null&&ia(i)));break;case 12:if(f&2048){Wn(i,s,a,l),i=s.stateNode;try{var p=s.memoizedProps,v=p.id,S=p.onPostCommit;typeof S=="function"&&S(v,s.alternate===null?"mount":"update",i.passiveEffectDuration,-0)}catch(T){Ke(s,s.return,T)}}else Wn(i,s,a,l);break;case 13:Wn(i,s,a,l);break;case 23:break;case 22:p=s.stateNode,v=s.alternate,s.memoizedState!==null?p._visibility&2?Wn(i,s,a,l):ba(i,s):p._visibility&2?Wn(i,s,a,l):(p._visibility|=2,Us(i,s,a,l,(s.subtreeFlags&10256)!==0)),f&2048&&Pd(v,s);break;case 24:Wn(i,s,a,l),f&2048&&Kd(s.alternate,s);break;default:Wn(i,s,a,l)}}function Us(i,s,a,l,f){for(f=f&&(s.subtreeFlags&10256)!==0,s=s.child;s!==null;){var p=i,v=s,S=a,T=l,D=v.flags;switch(v.tag){case 0:case 11:case 15:Us(p,v,S,T,f),ga(8,v);break;case 23:break;case 22:var z=v.stateNode;v.memoizedState!==null?z._visibility&2?Us(p,v,S,T,f):ba(p,v):(z._visibility|=2,Us(p,v,S,T,f)),f&&D&2048&&Pd(v.alternate,v);break;case 24:Us(p,v,S,T,f),f&&D&2048&&Kd(v.alternate,v);break;default:Us(p,v,S,T,f)}s=s.sibling}}function ba(i,s){if(s.subtreeFlags&10256)for(s=s.child;s!==null;){var a=i,l=s,f=l.flags;switch(l.tag){case 22:ba(a,l),f&2048&&Pd(l.alternate,l);break;case 24:ba(a,l),f&2048&&Kd(l.alternate,l);break;default:ba(a,l)}s=s.sibling}}var Sa=8192;function qs(i){if(i.subtreeFlags&Sa)for(i=i.child;i!==null;)Ob(i),i=i.sibling}function Ob(i){switch(i.tag){case 26:qs(i),i.flags&Sa&&i.memoizedState!==null&&F_(Pn,i.memoizedState,i.memoizedProps);break;case 5:qs(i);break;case 3:case 4:var s=Pn;Pn=Ru(i.stateNode.containerInfo),qs(i),Pn=s;break;case 22:i.memoizedState===null&&(s=i.alternate,s!==null&&s.memoizedState!==null?(s=Sa,Sa=16777216,qs(i),Sa=s):qs(i));break;default:qs(i)}}function _b(i){var s=i.alternate;if(s!==null&&(i=s.child,i!==null)){s.child=null;do s=i.sibling,i.sibling=null,i=s;while(i!==null)}}function xa(i){var s=i.deletions;if((i.flags&16)!==0){if(s!==null)for(var a=0;a<s.length;a++){var l=s[a];Nt=l,Cb(l,i)}_b(i)}if(i.subtreeFlags&10256)for(i=i.child;i!==null;)Mb(i),i=i.sibling}function Mb(i){switch(i.tag){case 0:case 11:case 15:xa(i),i.flags&2048&&rr(9,i,i.return);break;case 3:xa(i);break;case 12:xa(i);break;case 22:var s=i.stateNode;i.memoizedState!==null&&s._visibility&2&&(i.return===null||i.return.tag!==13)?(s._visibility&=-3,pu(i)):xa(i);break;default:xa(i)}}function pu(i){var s=i.deletions;if((i.flags&16)!==0){if(s!==null)for(var a=0;a<s.length;a++){var l=s[a];Nt=l,Cb(l,i)}_b(i)}for(i=i.child;i!==null;){switch(s=i,s.tag){case 0:case 11:case 15:rr(8,s,s.return),pu(s);break;case 22:a=s.stateNode,a._visibility&2&&(a._visibility&=-3,pu(s));break;default:pu(s)}i=i.sibling}}function Cb(i,s){for(;Nt!==null;){var a=Nt;switch(a.tag){case 0:case 11:case 15:rr(8,a,s);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var l=a.memoizedState.cachePool.pool;l!=null&&l.refCount++}break;case 24:ia(a.memoizedState.cache)}if(l=a.child,l!==null)l.return=a,Nt=l;else e:for(a=i;Nt!==null;){l=Nt;var f=l.sibling,p=l.return;if(xb(l),l===a){Nt=null;break e}if(f!==null){f.return=p,Nt=f;break e}Nt=p}}}var l_={getCacheForType:function(i){var s=Kt(Et),a=s.data.get(i);return a===void 0&&(a=i(),s.data.set(i,a)),a}},u_=typeof WeakMap=="function"?WeakMap:Map,Le=0,Fe=null,Re=null,ke=0,Ve=0,yn=null,ar=!1,Ps=!1,Id=!1,ki=0,rt=0,lr=0,Gr=0,Hd=0,Cn=0,Ks=0,wa=null,nn=null,Fd=!1,Gd=0,mu=1/0,yu=null,ur=null,Vt=0,cr=null,Is=null,Hs=0,Yd=0,Xd=null,kb=null,Aa=0,Zd=null;function gn(){if((Le&2)!==0&&ke!==0)return ke&-ke;if(N.T!==null){var i=Ds;return i!==0?i:ih()}return Gy()}function Db(){Cn===0&&(Cn=(ke&536870912)===0||je?Ky():536870912);var i=Mn.current;return i!==null&&(i.flags|=32),Cn}function vn(i,s,a){(i===Fe&&(Ve===2||Ve===9)||i.cancelPendingCommit!==null)&&(Fs(i,0),fr(i,ke,Cn,!1)),qo(i,a),((Le&2)===0||i!==Fe)&&(i===Fe&&((Le&2)===0&&(Gr|=a),rt===4&&fr(i,ke,Cn,!1)),ei(i))}function Nb(i,s,a){if((Le&6)!==0)throw Error(r(327));var l=!a&&(s&124)===0&&(s&i.expiredLanes)===0||Uo(i,s),f=l?d_(i,s):Wd(i,s,!0),p=l;do{if(f===0){Ps&&!l&&fr(i,s,0,!1);break}else{if(a=i.current.alternate,p&&!c_(a)){f=Wd(i,s,!1),p=!1;continue}if(f===2){if(p=s,i.errorRecoveryDisabledLanes&p)var v=0;else v=i.pendingLanes&-536870913,v=v!==0?v:v&536870912?536870912:0;if(v!==0){s=v;e:{var S=i;f=wa;var T=S.current.memoizedState.isDehydrated;if(T&&(Fs(S,v).flags|=256),v=Wd(S,v,!1),v!==2){if(Id&&!T){S.errorRecoveryDisabledLanes|=p,Gr|=p,f=4;break e}p=nn,nn=f,p!==null&&(nn===null?nn=p:nn.push.apply(nn,p))}f=v}if(p=!1,f!==2)continue}}if(f===1){Fs(i,0),fr(i,s,0,!0);break}e:{switch(l=i,p=f,p){case 0:case 1:throw Error(r(345));case 4:if((s&4194048)!==s)break;case 6:fr(l,s,Cn,!ar);break e;case 2:nn=null;break;case 3:case 5:break;default:throw Error(r(329))}if((s&62914560)===s&&(f=Gd+300-ut(),10<f)){if(fr(l,s,Cn,!ar),Ol(l,0,!0)!==0)break e;l.timeoutHandle=l0($b.bind(null,l,a,nn,yu,Fd,s,Cn,Gr,Ks,ar,p,2,-0,0),f);break e}$b(l,a,nn,yu,Fd,s,Cn,Gr,Ks,ar,p,0,-0,0)}}break}while(!0);ei(i)}function $b(i,s,a,l,f,p,v,S,T,D,z,I,j,L){if(i.timeoutHandle=-1,I=s.subtreeFlags,(I&8192||(I&16785408)===16785408)&&(Ca={stylesheets:null,count:0,unsuspend:H_},Ob(s),I=G_(),I!==null)){i.cancelPendingCommit=I(qb.bind(null,i,s,p,a,l,f,v,S,T,z,1,j,L)),fr(i,p,v,!D);return}qb(i,s,p,a,l,f,v,S,T)}function c_(i){for(var s=i;;){var a=s.tag;if((a===0||a===11||a===15)&&s.flags&16384&&(a=s.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var l=0;l<a.length;l++){var f=a[l],p=f.getSnapshot;f=f.value;try{if(!dn(p(),f))return!1}catch{return!1}}if(a=s.child,s.subtreeFlags&16384&&a!==null)a.return=s,s=a;else{if(s===i)break;for(;s.sibling===null;){if(s.return===null||s.return===i)return!0;s=s.return}s.sibling.return=s.return,s=s.sibling}}return!0}function fr(i,s,a,l){s&=~Hd,s&=~Gr,i.suspendedLanes|=s,i.pingedLanes&=~s,l&&(i.warmLanes|=s),l=i.expirationTimes;for(var f=s;0<f;){var p=31-fn(f),v=1<<p;l[p]=-1,f&=~v}a!==0&&Hy(i,a,s)}function gu(){return(Le&6)===0?(Ta(0),!1):!0}function Jd(){if(Re!==null){if(Ve===0)var i=Re.return;else i=Re,Ai=qr=null,pd(i),Vs=null,pa=0,i=Re;for(;i!==null;)hb(i.alternate,i),i=i.return;Re=null}}function Fs(i,s){var a=i.timeoutHandle;a!==-1&&(i.timeoutHandle=-1,__(a)),a=i.cancelPendingCommit,a!==null&&(i.cancelPendingCommit=null,a()),Jd(),Fe=i,Re=a=Si(i.current,null),ke=s,Ve=0,yn=null,ar=!1,Ps=Uo(i,s),Id=!1,Ks=Cn=Hd=Gr=lr=rt=0,nn=wa=null,Fd=!1,(s&8)!==0&&(s|=s&32);var l=i.entangledLanes;if(l!==0)for(i=i.entanglements,l&=s;0<l;){var f=31-fn(l),p=1<<f;s|=i[f],l&=~p}return ki=s,zl(),a}function jb(i,s){Ae=null,N.H=ru,s===sa||s===Yl?(s=Qg(),Ve=3):s===Xg?(s=Qg(),Ve=4):Ve=s===Wv?8:s!==null&&typeof s=="object"&&typeof s.then=="function"?6:1,yn=s,Re===null&&(rt=1,uu(i,En(s,i.current)))}function Bb(){var i=N.H;return N.H=ru,i===null?ru:i}function Lb(){var i=N.A;return N.A=l_,i}function Qd(){rt=4,ar||(ke&4194048)!==ke&&Mn.current!==null||(Ps=!0),(lr&134217727)===0&&(Gr&134217727)===0||Fe===null||fr(Fe,ke,Cn,!1)}function Wd(i,s,a){var l=Le;Le|=2;var f=Bb(),p=Lb();(Fe!==i||ke!==s)&&(yu=null,Fs(i,s)),s=!1;var v=rt;e:do try{if(Ve!==0&&Re!==null){var S=Re,T=yn;switch(Ve){case 8:Jd(),v=6;break e;case 3:case 2:case 9:case 6:Mn.current===null&&(s=!0);var D=Ve;if(Ve=0,yn=null,Gs(i,S,T,D),a&&Ps){v=0;break e}break;default:D=Ve,Ve=0,yn=null,Gs(i,S,T,D)}}f_(),v=rt;break}catch(z){jb(i,z)}while(!0);return s&&i.shellSuspendCounter++,Ai=qr=null,Le=l,N.H=f,N.A=p,Re===null&&(Fe=null,ke=0,zl()),v}function f_(){for(;Re!==null;)Vb(Re)}function d_(i,s){var a=Le;Le|=2;var l=Bb(),f=Lb();Fe!==i||ke!==s?(yu=null,mu=ut()+500,Fs(i,s)):Ps=Uo(i,s);e:do try{if(Ve!==0&&Re!==null){s=Re;var p=yn;t:switch(Ve){case 1:Ve=0,yn=null,Gs(i,s,p,1);break;case 2:case 9:if(Zg(p)){Ve=0,yn=null,zb(s);break}s=function(){Ve!==2&&Ve!==9||Fe!==i||(Ve=7),ei(i)},p.then(s,s);break e;case 3:Ve=7;break e;case 4:Ve=5;break e;case 7:Zg(p)?(Ve=0,yn=null,zb(s)):(Ve=0,yn=null,Gs(i,s,p,7));break;case 5:var v=null;switch(Re.tag){case 26:v=Re.memoizedState;case 5:case 27:var S=Re;if(!v||S0(v)){Ve=0,yn=null;var T=S.sibling;if(T!==null)Re=T;else{var D=S.return;D!==null?(Re=D,vu(D)):Re=null}break t}}Ve=0,yn=null,Gs(i,s,p,5);break;case 6:Ve=0,yn=null,Gs(i,s,p,6);break;case 8:Jd(),rt=6;break e;default:throw Error(r(462))}}h_();break}catch(z){jb(i,z)}while(!0);return Ai=qr=null,N.H=l,N.A=f,Le=a,Re!==null?0:(Fe=null,ke=0,zl(),rt)}function h_(){for(;Re!==null&&!At();)Vb(Re)}function Vb(i){var s=fb(i.alternate,i,ki);i.memoizedProps=i.pendingProps,s===null?vu(i):Re=s}function zb(i){var s=i,a=s.alternate;switch(s.tag){case 15:case 0:s=sb(a,s,s.pendingProps,s.type,void 0,ke);break;case 11:s=sb(a,s,s.pendingProps,s.type.render,s.ref,ke);break;case 5:pd(s);default:hb(a,s),s=Re=Ug(s,ki),s=fb(a,s,ki)}i.memoizedProps=i.pendingProps,s===null?vu(i):Re=s}function Gs(i,s,a,l){Ai=qr=null,pd(s),Vs=null,pa=0;var f=s.return;try{if(n_(i,f,s,a,ke)){rt=1,uu(i,En(a,i.current)),Re=null;return}}catch(p){if(f!==null)throw Re=f,p;rt=1,uu(i,En(a,i.current)),Re=null;return}s.flags&32768?(je||l===1?i=!0:Ps||(ke&536870912)!==0?i=!1:(ar=i=!0,(l===2||l===9||l===3||l===6)&&(l=Mn.current,l!==null&&l.tag===13&&(l.flags|=16384))),Ub(s,i)):vu(s)}function vu(i){var s=i;do{if((s.flags&32768)!==0){Ub(s,ar);return}i=s.return;var a=r_(s.alternate,s,ki);if(a!==null){Re=a;return}if(s=s.sibling,s!==null){Re=s;return}Re=s=i}while(s!==null);rt===0&&(rt=5)}function Ub(i,s){do{var a=s_(i.alternate,i);if(a!==null){a.flags&=32767,Re=a;return}if(a=i.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!s&&(i=i.sibling,i!==null)){Re=i;return}Re=i=a}while(i!==null);rt=6,Re=null}function qb(i,s,a,l,f,p,v,S,T){i.cancelPendingCommit=null;do bu();while(Vt!==0);if((Le&6)!==0)throw Error(r(327));if(s!==null){if(s===i.current)throw Error(r(177));if(p=s.lanes|s.childLanes,p|=Kf,HR(i,a,p,v,S,T),i===Fe&&(Re=Fe=null,ke=0),Is=s,cr=i,Hs=a,Yd=p,Xd=f,kb=l,(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?(i.callbackNode=null,i.callbackPriority=0,g_(un,function(){return Fb(),null})):(i.callbackNode=null,i.callbackPriority=0),l=(s.flags&13878)!==0,(s.subtreeFlags&13878)!==0||l){l=N.T,N.T=null,f=P.p,P.p=2,v=Le,Le|=4;try{o_(i,s,a)}finally{Le=v,P.p=f,N.T=l}}Vt=1,Pb(),Kb(),Ib()}}function Pb(){if(Vt===1){Vt=0;var i=cr,s=Is,a=(s.flags&13878)!==0;if((s.subtreeFlags&13878)!==0||a){a=N.T,N.T=null;var l=P.p;P.p=2;var f=Le;Le|=4;try{Tb(s,i);var p=fh,v=Cg(i.containerInfo),S=p.focusedElem,T=p.selectionRange;if(v!==S&&S&&S.ownerDocument&&Mg(S.ownerDocument.documentElement,S)){if(T!==null&&Vf(S)){var D=T.start,z=T.end;if(z===void 0&&(z=D),"selectionStart"in S)S.selectionStart=D,S.selectionEnd=Math.min(z,S.value.length);else{var I=S.ownerDocument||document,j=I&&I.defaultView||window;if(j.getSelection){var L=j.getSelection(),fe=S.textContent.length,ae=Math.min(T.start,fe),qe=T.end===void 0?ae:Math.min(T.end,fe);!L.extend&&ae>qe&&(v=qe,qe=ae,ae=v);var _=_g(S,ae),R=_g(S,qe);if(_&&R&&(L.rangeCount!==1||L.anchorNode!==_.node||L.anchorOffset!==_.offset||L.focusNode!==R.node||L.focusOffset!==R.offset)){var C=I.createRange();C.setStart(_.node,_.offset),L.removeAllRanges(),ae>qe?(L.addRange(C),L.extend(R.node,R.offset)):(C.setEnd(R.node,R.offset),L.addRange(C))}}}}for(I=[],L=S;L=L.parentNode;)L.nodeType===1&&I.push({element:L,left:L.scrollLeft,top:L.scrollTop});for(typeof S.focus=="function"&&S.focus(),S=0;S<I.length;S++){var q=I[S];q.element.scrollLeft=q.left,q.element.scrollTop=q.top}}ku=!!ch,fh=ch=null}finally{Le=f,P.p=l,N.T=a}}i.current=s,Vt=2}}function Kb(){if(Vt===2){Vt=0;var i=cr,s=Is,a=(s.flags&8772)!==0;if((s.subtreeFlags&8772)!==0||a){a=N.T,N.T=null;var l=P.p;P.p=2;var f=Le;Le|=4;try{Sb(i,s.alternate,s)}finally{Le=f,P.p=l,N.T=a}}Vt=3}}function Ib(){if(Vt===4||Vt===3){Vt=0,Tt();var i=cr,s=Is,a=Hs,l=kb;(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?Vt=5:(Vt=0,Is=cr=null,Hb(i,i.pendingLanes));var f=i.pendingLanes;if(f===0&&(ur=null),gf(a),s=s.stateNode,cn&&typeof cn.onCommitFiberRoot=="function")try{cn.onCommitFiberRoot(zo,s,void 0,(s.current.flags&128)===128)}catch{}if(l!==null){s=N.T,f=P.p,P.p=2,N.T=null;try{for(var p=i.onRecoverableError,v=0;v<l.length;v++){var S=l[v];p(S.value,{componentStack:S.stack})}}finally{N.T=s,P.p=f}}(Hs&3)!==0&&bu(),ei(i),f=i.pendingLanes,(a&4194090)!==0&&(f&42)!==0?i===Zd?Aa++:(Aa=0,Zd=i):Aa=0,Ta(0)}}function Hb(i,s){(i.pooledCacheLanes&=s)===0&&(s=i.pooledCache,s!=null&&(i.pooledCache=null,ia(s)))}function bu(i){return Pb(),Kb(),Ib(),Fb()}function Fb(){if(Vt!==5)return!1;var i=cr,s=Yd;Yd=0;var a=gf(Hs),l=N.T,f=P.p;try{P.p=32>a?32:a,N.T=null,a=Xd,Xd=null;var p=cr,v=Hs;if(Vt=0,Is=cr=null,Hs=0,(Le&6)!==0)throw Error(r(331));var S=Le;if(Le|=4,Mb(p.current),Rb(p,p.current,v,a),Le=S,Ta(0,!1),cn&&typeof cn.onPostCommitFiberRoot=="function")try{cn.onPostCommitFiberRoot(zo,p)}catch{}return!0}finally{P.p=f,N.T=l,Hb(i,s)}}function Gb(i,s,a){s=En(a,s),s=_d(i.stateNode,s,2),i=er(i,s,2),i!==null&&(qo(i,2),ei(i))}function Ke(i,s,a){if(i.tag===3)Gb(i,i,a);else for(;s!==null;){if(s.tag===3){Gb(s,i,a);break}else if(s.tag===1){var l=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(ur===null||!ur.has(l))){i=En(a,i),a=Jv(2),l=er(s,a,2),l!==null&&(Qv(a,l,s,i),qo(l,2),ei(l));break}}s=s.return}}function eh(i,s,a){var l=i.pingCache;if(l===null){l=i.pingCache=new u_;var f=new Set;l.set(s,f)}else f=l.get(s),f===void 0&&(f=new Set,l.set(s,f));f.has(a)||(Id=!0,f.add(a),i=p_.bind(null,i,s,a),s.then(i,i))}function p_(i,s,a){var l=i.pingCache;l!==null&&l.delete(s),i.pingedLanes|=i.suspendedLanes&a,i.warmLanes&=~a,Fe===i&&(ke&a)===a&&(rt===4||rt===3&&(ke&62914560)===ke&&300>ut()-Gd?(Le&2)===0&&Fs(i,0):Hd|=a,Ks===ke&&(Ks=0)),ei(i)}function Yb(i,s){s===0&&(s=Iy()),i=_s(i,s),i!==null&&(qo(i,s),ei(i))}function m_(i){var s=i.memoizedState,a=0;s!==null&&(a=s.retryLane),Yb(i,a)}function y_(i,s){var a=0;switch(i.tag){case 13:var l=i.stateNode,f=i.memoizedState;f!==null&&(a=f.retryLane);break;case 19:l=i.stateNode;break;case 22:l=i.stateNode._retryCache;break;default:throw Error(r(314))}l!==null&&l.delete(s),Yb(i,a)}function g_(i,s){return xe(i,s)}var Su=null,Ys=null,th=!1,xu=!1,nh=!1,Yr=0;function ei(i){i!==Ys&&i.next===null&&(Ys===null?Su=Ys=i:Ys=Ys.next=i),xu=!0,th||(th=!0,b_())}function Ta(i,s){if(!nh&&xu){nh=!0;do for(var a=!1,l=Su;l!==null;){if(i!==0){var f=l.pendingLanes;if(f===0)var p=0;else{var v=l.suspendedLanes,S=l.pingedLanes;p=(1<<31-fn(42|i)+1)-1,p&=f&~(v&~S),p=p&201326741?p&201326741|1:p?p|2:0}p!==0&&(a=!0,Qb(l,p))}else p=ke,p=Ol(l,l===Fe?p:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(p&3)===0||Uo(l,p)||(a=!0,Qb(l,p));l=l.next}while(a);nh=!1}}function v_(){Xb()}function Xb(){xu=th=!1;var i=0;Yr!==0&&(O_()&&(i=Yr),Yr=0);for(var s=ut(),a=null,l=Su;l!==null;){var f=l.next,p=Zb(l,s);p===0?(l.next=null,a===null?Su=f:a.next=f,f===null&&(Ys=a)):(a=l,(i!==0||(p&3)!==0)&&(xu=!0)),l=f}Ta(i)}function Zb(i,s){for(var a=i.suspendedLanes,l=i.pingedLanes,f=i.expirationTimes,p=i.pendingLanes&-62914561;0<p;){var v=31-fn(p),S=1<<v,T=f[v];T===-1?((S&a)===0||(S&l)!==0)&&(f[v]=IR(S,s)):T<=s&&(i.expiredLanes|=S),p&=~S}if(s=Fe,a=ke,a=Ol(i,i===s?a:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),l=i.callbackNode,a===0||i===s&&(Ve===2||Ve===9)||i.cancelPendingCommit!==null)return l!==null&&l!==null&&we(l),i.callbackNode=null,i.callbackPriority=0;if((a&3)===0||Uo(i,a)){if(s=a&-a,s===i.callbackPriority)return s;switch(l!==null&&we(l),gf(a)){case 2:case 8:a=Je;break;case 32:a=un;break;case 268435456:a=Py;break;default:a=un}return l=Jb.bind(null,i),a=xe(a,l),i.callbackPriority=s,i.callbackNode=a,s}return l!==null&&l!==null&&we(l),i.callbackPriority=2,i.callbackNode=null,2}function Jb(i,s){if(Vt!==0&&Vt!==5)return i.callbackNode=null,i.callbackPriority=0,null;var a=i.callbackNode;if(bu()&&i.callbackNode!==a)return null;var l=ke;return l=Ol(i,i===Fe?l:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),l===0?null:(Nb(i,l,s),Zb(i,ut()),i.callbackNode!=null&&i.callbackNode===a?Jb.bind(null,i):null)}function Qb(i,s){if(bu())return null;Nb(i,s,!0)}function b_(){M_(function(){(Le&6)!==0?xe(Xe,v_):Xb()})}function ih(){return Yr===0&&(Yr=Ky()),Yr}function Wb(i){return i==null||typeof i=="symbol"||typeof i=="boolean"?null:typeof i=="function"?i:Dl(""+i)}function e0(i,s){var a=s.ownerDocument.createElement("input");return a.name=s.name,a.value=s.value,i.id&&a.setAttribute("form",i.id),s.parentNode.insertBefore(a,s),i=new FormData(i),a.parentNode.removeChild(a),i}function S_(i,s,a,l,f){if(s==="submit"&&a&&a.stateNode===f){var p=Wb((f[Qt]||null).action),v=l.submitter;v&&(s=(s=v[Qt]||null)?Wb(s.formAction):v.getAttribute("formAction"),s!==null&&(p=s,v=null));var S=new Bl("action","action",null,l,f);i.push({event:S,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(Yr!==0){var T=v?e0(f,v):new FormData(f);Ad(a,{pending:!0,data:T,method:f.method,action:p},null,T)}}else typeof p=="function"&&(S.preventDefault(),T=v?e0(f,v):new FormData(f),Ad(a,{pending:!0,data:T,method:f.method,action:p},p,T))},currentTarget:f}]})}}for(var rh=0;rh<Pf.length;rh++){var sh=Pf[rh],x_=sh.toLowerCase(),w_=sh[0].toUpperCase()+sh.slice(1);qn(x_,"on"+w_)}qn(Ng,"onAnimationEnd"),qn($g,"onAnimationIteration"),qn(jg,"onAnimationStart"),qn("dblclick","onDoubleClick"),qn("focusin","onFocus"),qn("focusout","onBlur"),qn(zO,"onTransitionRun"),qn(UO,"onTransitionStart"),qn(qO,"onTransitionCancel"),qn(Bg,"onTransitionEnd"),vs("onMouseEnter",["mouseout","mouseover"]),vs("onMouseLeave",["mouseout","mouseover"]),vs("onPointerEnter",["pointerout","pointerover"]),vs("onPointerLeave",["pointerout","pointerover"]),Dr("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Dr("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Dr("onBeforeInput",["compositionend","keypress","textInput","paste"]),Dr("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Dr("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Dr("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ea="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(" "),A_=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Ea));function t0(i,s){s=(s&4)!==0;for(var a=0;a<i.length;a++){var l=i[a],f=l.event;l=l.listeners;e:{var p=void 0;if(s)for(var v=l.length-1;0<=v;v--){var S=l[v],T=S.instance,D=S.currentTarget;if(S=S.listener,T!==p&&f.isPropagationStopped())break e;p=S,f.currentTarget=D;try{p(f)}catch(z){lu(z)}f.currentTarget=null,p=T}else for(v=0;v<l.length;v++){if(S=l[v],T=S.instance,D=S.currentTarget,S=S.listener,T!==p&&f.isPropagationStopped())break e;p=S,f.currentTarget=D;try{p(f)}catch(z){lu(z)}f.currentTarget=null,p=T}}}}function Oe(i,s){var a=s[vf];a===void 0&&(a=s[vf]=new Set);var l=i+"__bubble";a.has(l)||(n0(s,i,2,!1),a.add(l))}function oh(i,s,a){var l=0;s&&(l|=4),n0(a,i,l,s)}var wu="_reactListening"+Math.random().toString(36).slice(2);function ah(i){if(!i[wu]){i[wu]=!0,Xy.forEach(function(a){a!=="selectionchange"&&(A_.has(a)||oh(a,!1,i),oh(a,!0,i))});var s=i.nodeType===9?i:i.ownerDocument;s===null||s[wu]||(s[wu]=!0,oh("selectionchange",!1,s))}}function n0(i,s,a,l){switch(R0(s)){case 2:var f=Z_;break;case 8:f=J_;break;default:f=xh}a=f.bind(null,s,a,i),f=void 0,!Mf||s!=="touchstart"&&s!=="touchmove"&&s!=="wheel"||(f=!0),l?f!==void 0?i.addEventListener(s,a,{capture:!0,passive:f}):i.addEventListener(s,a,!0):f!==void 0?i.addEventListener(s,a,{passive:f}):i.addEventListener(s,a,!1)}function lh(i,s,a,l,f){var p=l;if((s&1)===0&&(s&2)===0&&l!==null)e:for(;;){if(l===null)return;var v=l.tag;if(v===3||v===4){var S=l.stateNode.containerInfo;if(S===f)break;if(v===4)for(v=l.return;v!==null;){var T=v.tag;if((T===3||T===4)&&v.stateNode.containerInfo===f)return;v=v.return}for(;S!==null;){if(v=ms(S),v===null)return;if(T=v.tag,T===5||T===6||T===26||T===27){l=p=v;continue e}S=S.parentNode}}l=l.return}ug(function(){var D=p,z=Of(a),I=[];e:{var j=Lg.get(i);if(j!==void 0){var L=Bl,fe=i;switch(i){case"keypress":if($l(a)===0)break e;case"keydown":case"keyup":L=gO;break;case"focusin":fe="focus",L=Nf;break;case"focusout":fe="blur",L=Nf;break;case"beforeblur":case"afterblur":L=Nf;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":L=dg;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":L=sO;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":L=SO;break;case Ng:case $g:case jg:L=lO;break;case Bg:L=wO;break;case"scroll":case"scrollend":L=iO;break;case"wheel":L=TO;break;case"copy":case"cut":case"paste":L=cO;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":L=pg;break;case"toggle":case"beforetoggle":L=RO}var ae=(s&4)!==0,qe=!ae&&(i==="scroll"||i==="scrollend"),_=ae?j!==null?j+"Capture":null:j;ae=[];for(var R=D,C;R!==null;){var q=R;if(C=q.stateNode,q=q.tag,q!==5&&q!==26&&q!==27||C===null||_===null||(q=Io(R,_),q!=null&&ae.push(Ra(R,q,C))),qe)break;R=R.return}0<ae.length&&(j=new L(j,fe,null,a,z),I.push({event:j,listeners:ae}))}}if((s&7)===0){e:{if(j=i==="mouseover"||i==="pointerover",L=i==="mouseout"||i==="pointerout",j&&a!==Rf&&(fe=a.relatedTarget||a.fromElement)&&(ms(fe)||fe[ps]))break e;if((L||j)&&(j=z.window===z?z:(j=z.ownerDocument)?j.defaultView||j.parentWindow:window,L?(fe=a.relatedTarget||a.toElement,L=D,fe=fe?ms(fe):null,fe!==null&&(qe=u(fe),ae=fe.tag,fe!==qe||ae!==5&&ae!==27&&ae!==6)&&(fe=null)):(L=null,fe=D),L!==fe)){if(ae=dg,q="onMouseLeave",_="onMouseEnter",R="mouse",(i==="pointerout"||i==="pointerover")&&(ae=pg,q="onPointerLeave",_="onPointerEnter",R="pointer"),qe=L==null?j:Ko(L),C=fe==null?j:Ko(fe),j=new ae(q,R+"leave",L,a,z),j.target=qe,j.relatedTarget=C,q=null,ms(z)===D&&(ae=new ae(_,R+"enter",fe,a,z),ae.target=C,ae.relatedTarget=qe,q=ae),qe=q,L&&fe)t:{for(ae=L,_=fe,R=0,C=ae;C;C=Xs(C))R++;for(C=0,q=_;q;q=Xs(q))C++;for(;0<R-C;)ae=Xs(ae),R--;for(;0<C-R;)_=Xs(_),C--;for(;R--;){if(ae===_||_!==null&&ae===_.alternate)break t;ae=Xs(ae),_=Xs(_)}ae=null}else ae=null;L!==null&&i0(I,j,L,ae,!1),fe!==null&&qe!==null&&i0(I,qe,fe,ae,!0)}}e:{if(j=D?Ko(D):window,L=j.nodeName&&j.nodeName.toLowerCase(),L==="select"||L==="input"&&j.type==="file")var te=wg;else if(Sg(j))if(Ag)te=BO;else{te=$O;var Ee=NO}else L=j.nodeName,!L||L.toLowerCase()!=="input"||j.type!=="checkbox"&&j.type!=="radio"?D&&Ef(D.elementType)&&(te=wg):te=jO;if(te&&(te=te(i,D))){xg(I,te,a,z);break e}Ee&&Ee(i,j,D),i==="focusout"&&D&&j.type==="number"&&D.memoizedProps.value!=null&&Tf(j,"number",j.value)}switch(Ee=D?Ko(D):window,i){case"focusin":(Sg(Ee)||Ee.contentEditable==="true")&&(Es=Ee,zf=D,Qo=null);break;case"focusout":Qo=zf=Es=null;break;case"mousedown":Uf=!0;break;case"contextmenu":case"mouseup":case"dragend":Uf=!1,kg(I,a,z);break;case"selectionchange":if(VO)break;case"keydown":case"keyup":kg(I,a,z)}var oe;if(jf)e:{switch(i){case"compositionstart":var le="onCompositionStart";break e;case"compositionend":le="onCompositionEnd";break e;case"compositionupdate":le="onCompositionUpdate";break e}le=void 0}else Ts?vg(i,a)&&(le="onCompositionEnd"):i==="keydown"&&a.keyCode===229&&(le="onCompositionStart");le&&(mg&&a.locale!=="ko"&&(Ts||le!=="onCompositionStart"?le==="onCompositionEnd"&&Ts&&(oe=cg()):(Zi=z,Cf="value"in Zi?Zi.value:Zi.textContent,Ts=!0)),Ee=Au(D,le),0<Ee.length&&(le=new hg(le,i,null,a,z),I.push({event:le,listeners:Ee}),oe?le.data=oe:(oe=bg(a),oe!==null&&(le.data=oe)))),(oe=_O?MO(i,a):CO(i,a))&&(le=Au(D,"onBeforeInput"),0<le.length&&(Ee=new hg("onBeforeInput","beforeinput",null,a,z),I.push({event:Ee,listeners:le}),Ee.data=oe)),S_(I,i,D,a,z)}t0(I,s)})}function Ra(i,s,a){return{instance:i,listener:s,currentTarget:a}}function Au(i,s){for(var a=s+"Capture",l=[];i!==null;){var f=i,p=f.stateNode;if(f=f.tag,f!==5&&f!==26&&f!==27||p===null||(f=Io(i,a),f!=null&&l.unshift(Ra(i,f,p)),f=Io(i,s),f!=null&&l.push(Ra(i,f,p))),i.tag===3)return l;i=i.return}return[]}function Xs(i){if(i===null)return null;do i=i.return;while(i&&i.tag!==5&&i.tag!==27);return i||null}function i0(i,s,a,l,f){for(var p=s._reactName,v=[];a!==null&&a!==l;){var S=a,T=S.alternate,D=S.stateNode;if(S=S.tag,T!==null&&T===l)break;S!==5&&S!==26&&S!==27||D===null||(T=D,f?(D=Io(a,p),D!=null&&v.unshift(Ra(a,D,T))):f||(D=Io(a,p),D!=null&&v.push(Ra(a,D,T)))),a=a.return}v.length!==0&&i.push({event:s,listeners:v})}var T_=/\r\n?/g,E_=/\u0000|\uFFFD/g;function r0(i){return(typeof i=="string"?i:""+i).replace(T_,`
|
|
62
|
-
`).replace(E_,"")}function s0(i,s){return s=r0(s),r0(i)===s}function Tu(){}function Ue(i,s,a,l,f,p){switch(a){case"children":typeof l=="string"?s==="body"||s==="textarea"&&l===""||xs(i,l):(typeof l=="number"||typeof l=="bigint")&&s!=="body"&&xs(i,""+l);break;case"className":Ml(i,"class",l);break;case"tabIndex":Ml(i,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":Ml(i,a,l);break;case"style":ag(i,l,p);break;case"data":if(s!=="object"){Ml(i,"data",l);break}case"src":case"href":if(l===""&&(s!=="a"||a!=="href")){i.removeAttribute(a);break}if(l==null||typeof l=="function"||typeof l=="symbol"||typeof l=="boolean"){i.removeAttribute(a);break}l=Dl(""+l),i.setAttribute(a,l);break;case"action":case"formAction":if(typeof l=="function"){i.setAttribute(a,"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 p=="function"&&(a==="formAction"?(s!=="input"&&Ue(i,s,"name",f.name,f,null),Ue(i,s,"formEncType",f.formEncType,f,null),Ue(i,s,"formMethod",f.formMethod,f,null),Ue(i,s,"formTarget",f.formTarget,f,null)):(Ue(i,s,"encType",f.encType,f,null),Ue(i,s,"method",f.method,f,null),Ue(i,s,"target",f.target,f,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){i.removeAttribute(a);break}l=Dl(""+l),i.setAttribute(a,l);break;case"onClick":l!=null&&(i.onclick=Tu);break;case"onScroll":l!=null&&Oe("scroll",i);break;case"onScrollEnd":l!=null&&Oe("scrollend",i);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(r(61));if(a=l.__html,a!=null){if(f.children!=null)throw Error(r(60));i.innerHTML=a}}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}a=Dl(""+l),i.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a);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(a,""+l):i.removeAttribute(a);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(a,""):i.removeAttribute(a);break;case"capture":case"download":l===!0?i.setAttribute(a,""):l!==!1&&l!=null&&typeof l!="function"&&typeof l!="symbol"?i.setAttribute(a,l):i.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":l!=null&&typeof l!="function"&&typeof l!="symbol"&&!isNaN(l)&&1<=l?i.setAttribute(a,l):i.removeAttribute(a);break;case"rowSpan":case"start":l==null||typeof l=="function"||typeof l=="symbol"||isNaN(l)?i.removeAttribute(a):i.setAttribute(a,l);break;case"popover":Oe("beforetoggle",i),Oe("toggle",i),_l(i,"popover",l);break;case"xlinkActuate":vi(i,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":vi(i,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":vi(i,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":vi(i,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":vi(i,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":vi(i,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":vi(i,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":vi(i,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":vi(i,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":_l(i,"is",l);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=tO.get(a)||a,_l(i,a,l))}}function uh(i,s,a,l,f,p){switch(a){case"style":ag(i,l,p);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(r(61));if(a=l.__html,a!=null){if(f.children!=null)throw Error(r(60));i.innerHTML=a}}break;case"children":typeof l=="string"?xs(i,l):(typeof l=="number"||typeof l=="bigint")&&xs(i,""+l);break;case"onScroll":l!=null&&Oe("scroll",i);break;case"onScrollEnd":l!=null&&Oe("scrollend",i);break;case"onClick":l!=null&&(i.onclick=Tu);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Zy.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(f=a.endsWith("Capture"),s=a.slice(2,f?a.length-7:void 0),p=i[Qt]||null,p=p!=null?p[a]:null,typeof p=="function"&&i.removeEventListener(s,p,f),typeof l=="function")){typeof p!="function"&&p!==null&&(a in i?i[a]=null:i.hasAttribute(a)&&i.removeAttribute(a)),i.addEventListener(s,l,f);break e}a in i?i[a]=l:l===!0?i.setAttribute(a,""):_l(i,a,l)}}}function zt(i,s,a){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Oe("error",i),Oe("load",i);var l=!1,f=!1,p;for(p in a)if(a.hasOwnProperty(p)){var v=a[p];if(v!=null)switch(p){case"src":l=!0;break;case"srcSet":f=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,s));default:Ue(i,s,p,v,a,null)}}f&&Ue(i,s,"srcSet",a.srcSet,a,null),l&&Ue(i,s,"src",a.src,a,null);return;case"input":Oe("invalid",i);var S=p=v=f=null,T=null,D=null;for(l in a)if(a.hasOwnProperty(l)){var z=a[l];if(z!=null)switch(l){case"name":f=z;break;case"type":v=z;break;case"checked":T=z;break;case"defaultChecked":D=z;break;case"value":p=z;break;case"defaultValue":S=z;break;case"children":case"dangerouslySetInnerHTML":if(z!=null)throw Error(r(137,s));break;default:Ue(i,s,l,z,a,null)}}ig(i,p,S,T,D,v,f,!1),Cl(i);return;case"select":Oe("invalid",i),l=v=p=null;for(f in a)if(a.hasOwnProperty(f)&&(S=a[f],S!=null))switch(f){case"value":p=S;break;case"defaultValue":v=S;break;case"multiple":l=S;default:Ue(i,s,f,S,a,null)}s=p,a=v,i.multiple=!!l,s!=null?Ss(i,!!l,s,!1):a!=null&&Ss(i,!!l,a,!0);return;case"textarea":Oe("invalid",i),p=f=l=null;for(v in a)if(a.hasOwnProperty(v)&&(S=a[v],S!=null))switch(v){case"value":l=S;break;case"defaultValue":f=S;break;case"children":p=S;break;case"dangerouslySetInnerHTML":if(S!=null)throw Error(r(91));break;default:Ue(i,s,v,S,a,null)}sg(i,l,f,p),Cl(i);return;case"option":for(T in a)if(a.hasOwnProperty(T)&&(l=a[T],l!=null))switch(T){case"selected":i.selected=l&&typeof l!="function"&&typeof l!="symbol";break;default:Ue(i,s,T,l,a,null)}return;case"dialog":Oe("beforetoggle",i),Oe("toggle",i),Oe("cancel",i),Oe("close",i);break;case"iframe":case"object":Oe("load",i);break;case"video":case"audio":for(l=0;l<Ea.length;l++)Oe(Ea[l],i);break;case"image":Oe("error",i),Oe("load",i);break;case"details":Oe("toggle",i);break;case"embed":case"source":case"link":Oe("error",i),Oe("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(D in a)if(a.hasOwnProperty(D)&&(l=a[D],l!=null))switch(D){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,s));default:Ue(i,s,D,l,a,null)}return;default:if(Ef(s)){for(z in a)a.hasOwnProperty(z)&&(l=a[z],l!==void 0&&uh(i,s,z,l,a,void 0));return}}for(S in a)a.hasOwnProperty(S)&&(l=a[S],l!=null&&Ue(i,s,S,l,a,null))}function R_(i,s,a,l){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var f=null,p=null,v=null,S=null,T=null,D=null,z=null;for(L in a){var I=a[L];if(a.hasOwnProperty(L)&&I!=null)switch(L){case"checked":break;case"value":break;case"defaultValue":T=I;default:l.hasOwnProperty(L)||Ue(i,s,L,null,l,I)}}for(var j in l){var L=l[j];if(I=a[j],l.hasOwnProperty(j)&&(L!=null||I!=null))switch(j){case"type":p=L;break;case"name":f=L;break;case"checked":D=L;break;case"defaultChecked":z=L;break;case"value":v=L;break;case"defaultValue":S=L;break;case"children":case"dangerouslySetInnerHTML":if(L!=null)throw Error(r(137,s));break;default:L!==I&&Ue(i,s,j,L,l,I)}}Af(i,v,S,T,D,z,p,f);return;case"select":L=v=S=j=null;for(p in a)if(T=a[p],a.hasOwnProperty(p)&&T!=null)switch(p){case"value":break;case"multiple":L=T;default:l.hasOwnProperty(p)||Ue(i,s,p,null,l,T)}for(f in l)if(p=l[f],T=a[f],l.hasOwnProperty(f)&&(p!=null||T!=null))switch(f){case"value":j=p;break;case"defaultValue":S=p;break;case"multiple":v=p;default:p!==T&&Ue(i,s,f,p,l,T)}s=S,a=v,l=L,j!=null?Ss(i,!!a,j,!1):!!l!=!!a&&(s!=null?Ss(i,!!a,s,!0):Ss(i,!!a,a?[]:"",!1));return;case"textarea":L=j=null;for(S in a)if(f=a[S],a.hasOwnProperty(S)&&f!=null&&!l.hasOwnProperty(S))switch(S){case"value":break;case"children":break;default:Ue(i,s,S,null,l,f)}for(v in l)if(f=l[v],p=a[v],l.hasOwnProperty(v)&&(f!=null||p!=null))switch(v){case"value":j=f;break;case"defaultValue":L=f;break;case"children":break;case"dangerouslySetInnerHTML":if(f!=null)throw Error(r(91));break;default:f!==p&&Ue(i,s,v,f,l,p)}rg(i,j,L);return;case"option":for(var fe in a)if(j=a[fe],a.hasOwnProperty(fe)&&j!=null&&!l.hasOwnProperty(fe))switch(fe){case"selected":i.selected=!1;break;default:Ue(i,s,fe,null,l,j)}for(T in l)if(j=l[T],L=a[T],l.hasOwnProperty(T)&&j!==L&&(j!=null||L!=null))switch(T){case"selected":i.selected=j&&typeof j!="function"&&typeof j!="symbol";break;default:Ue(i,s,T,j,l,L)}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 ae in a)j=a[ae],a.hasOwnProperty(ae)&&j!=null&&!l.hasOwnProperty(ae)&&Ue(i,s,ae,null,l,j);for(D in l)if(j=l[D],L=a[D],l.hasOwnProperty(D)&&j!==L&&(j!=null||L!=null))switch(D){case"children":case"dangerouslySetInnerHTML":if(j!=null)throw Error(r(137,s));break;default:Ue(i,s,D,j,l,L)}return;default:if(Ef(s)){for(var qe in a)j=a[qe],a.hasOwnProperty(qe)&&j!==void 0&&!l.hasOwnProperty(qe)&&uh(i,s,qe,void 0,l,j);for(z in l)j=l[z],L=a[z],!l.hasOwnProperty(z)||j===L||j===void 0&&L===void 0||uh(i,s,z,j,l,L);return}}for(var _ in a)j=a[_],a.hasOwnProperty(_)&&j!=null&&!l.hasOwnProperty(_)&&Ue(i,s,_,null,l,j);for(I in l)j=l[I],L=a[I],!l.hasOwnProperty(I)||j===L||j==null&&L==null||Ue(i,s,I,j,l,L)}var ch=null,fh=null;function Eu(i){return i.nodeType===9?i:i.ownerDocument}function o0(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 a0(i,s){if(i===0)switch(s){case"svg":return 1;case"math":return 2;default:return 0}return i===1&&s==="foreignObject"?0:i}function dh(i,s){return i==="textarea"||i==="noscript"||typeof s.children=="string"||typeof s.children=="number"||typeof s.children=="bigint"||typeof s.dangerouslySetInnerHTML=="object"&&s.dangerouslySetInnerHTML!==null&&s.dangerouslySetInnerHTML.__html!=null}var hh=null;function O_(){var i=window.event;return i&&i.type==="popstate"?i===hh?!1:(hh=i,!0):(hh=null,!1)}var l0=typeof setTimeout=="function"?setTimeout:void 0,__=typeof clearTimeout=="function"?clearTimeout:void 0,u0=typeof Promise=="function"?Promise:void 0,M_=typeof queueMicrotask=="function"?queueMicrotask:typeof u0<"u"?function(i){return u0.resolve(null).then(i).catch(C_)}:l0;function C_(i){setTimeout(function(){throw i})}function dr(i){return i==="head"}function c0(i,s){var a=s,l=0,f=0;do{var p=a.nextSibling;if(i.removeChild(a),p&&p.nodeType===8)if(a=p.data,a==="/$"){if(0<l&&8>l){a=l;var v=i.ownerDocument;if(a&1&&Oa(v.documentElement),a&2&&Oa(v.body),a&4)for(a=v.head,Oa(a),v=a.firstChild;v;){var S=v.nextSibling,T=v.nodeName;v[Po]||T==="SCRIPT"||T==="STYLE"||T==="LINK"&&v.rel.toLowerCase()==="stylesheet"||a.removeChild(v),v=S}}if(f===0){i.removeChild(p),ja(s);return}f--}else a==="$"||a==="$?"||a==="$!"?f++:l=a.charCodeAt(0)-48;else l=0;a=p}while(a);ja(s)}function ph(i){var s=i.firstChild;for(s&&s.nodeType===10&&(s=s.nextSibling);s;){var a=s;switch(s=s.nextSibling,a.nodeName){case"HTML":case"HEAD":case"BODY":ph(a),bf(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}i.removeChild(a)}}function k_(i,s,a,l){for(;i.nodeType===1;){var f=a;if(i.nodeName.toLowerCase()!==s.toLowerCase()){if(!l&&(i.nodeName!=="INPUT"||i.type!=="hidden"))break}else if(l){if(!i[Po])switch(s){case"meta":if(!i.hasAttribute("itemprop"))break;return i;case"link":if(p=i.getAttribute("rel"),p==="stylesheet"&&i.hasAttribute("data-precedence"))break;if(p!==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(p=i.getAttribute("src"),(p!==(f.src==null?null:f.src)||i.getAttribute("type")!==(f.type==null?null:f.type)||i.getAttribute("crossorigin")!==(f.crossOrigin==null?null:f.crossOrigin))&&p&&i.hasAttribute("async")&&!i.hasAttribute("itemprop"))break;return i;default:return i}}else if(s==="input"&&i.type==="hidden"){var p=f.name==null?null:""+f.name;if(f.type==="hidden"&&i.getAttribute("name")===p)return i}else return i;if(i=Kn(i.nextSibling),i===null)break}return null}function D_(i,s,a){if(s==="")return null;for(;i.nodeType!==3;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!a||(i=Kn(i.nextSibling),i===null))return null;return i}function mh(i){return i.data==="$!"||i.data==="$?"&&i.ownerDocument.readyState==="complete"}function N_(i,s){var a=i.ownerDocument;if(i.data!=="$?"||a.readyState==="complete")s();else{var l=function(){s(),a.removeEventListener("DOMContentLoaded",l)};a.addEventListener("DOMContentLoaded",l),i._reactRetry=l}}function Kn(i){for(;i!=null;i=i.nextSibling){var s=i.nodeType;if(s===1||s===3)break;if(s===8){if(s=i.data,s==="$"||s==="$!"||s==="$?"||s==="F!"||s==="F")break;if(s==="/$")return null}}return i}var yh=null;function f0(i){i=i.previousSibling;for(var s=0;i;){if(i.nodeType===8){var a=i.data;if(a==="$"||a==="$!"||a==="$?"){if(s===0)return i;s--}else a==="/$"&&s++}i=i.previousSibling}return null}function d0(i,s,a){switch(s=Eu(a),i){case"html":if(i=s.documentElement,!i)throw Error(r(452));return i;case"head":if(i=s.head,!i)throw Error(r(453));return i;case"body":if(i=s.body,!i)throw Error(r(454));return i;default:throw Error(r(451))}}function Oa(i){for(var s=i.attributes;s.length;)i.removeAttributeNode(s[0]);bf(i)}var kn=new Map,h0=new Set;function Ru(i){return typeof i.getRootNode=="function"?i.getRootNode():i.nodeType===9?i:i.ownerDocument}var Di=P.d;P.d={f:$_,r:j_,D:B_,C:L_,L:V_,m:z_,X:q_,S:U_,M:P_};function $_(){var i=Di.f(),s=gu();return i||s}function j_(i){var s=ys(i);s!==null&&s.tag===5&&s.type==="form"?Nv(s):Di.r(i)}var Zs=typeof document>"u"?null:document;function p0(i,s,a){var l=Zs;if(l&&typeof s=="string"&&s){var f=Tn(s);f='link[rel="'+i+'"][href="'+f+'"]',typeof a=="string"&&(f+='[crossorigin="'+a+'"]'),h0.has(f)||(h0.add(f),i={rel:i,crossOrigin:a,href:s},l.querySelector(f)===null&&(s=l.createElement("link"),zt(s,"link",i),kt(s),l.head.appendChild(s)))}}function B_(i){Di.D(i),p0("dns-prefetch",i,null)}function L_(i,s){Di.C(i,s),p0("preconnect",i,s)}function V_(i,s,a){Di.L(i,s,a);var l=Zs;if(l&&i&&s){var f='link[rel="preload"][as="'+Tn(s)+'"]';s==="image"&&a&&a.imageSrcSet?(f+='[imagesrcset="'+Tn(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(f+='[imagesizes="'+Tn(a.imageSizes)+'"]')):f+='[href="'+Tn(i)+'"]';var p=f;switch(s){case"style":p=Js(i);break;case"script":p=Qs(i)}kn.has(p)||(i=y({rel:"preload",href:s==="image"&&a&&a.imageSrcSet?void 0:i,as:s},a),kn.set(p,i),l.querySelector(f)!==null||s==="style"&&l.querySelector(_a(p))||s==="script"&&l.querySelector(Ma(p))||(s=l.createElement("link"),zt(s,"link",i),kt(s),l.head.appendChild(s)))}}function z_(i,s){Di.m(i,s);var a=Zs;if(a&&i){var l=s&&typeof s.as=="string"?s.as:"script",f='link[rel="modulepreload"][as="'+Tn(l)+'"][href="'+Tn(i)+'"]',p=f;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":p=Qs(i)}if(!kn.has(p)&&(i=y({rel:"modulepreload",href:i},s),kn.set(p,i),a.querySelector(f)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(Ma(p)))return}l=a.createElement("link"),zt(l,"link",i),kt(l),a.head.appendChild(l)}}}function U_(i,s,a){Di.S(i,s,a);var l=Zs;if(l&&i){var f=gs(l).hoistableStyles,p=Js(i);s=s||"default";var v=f.get(p);if(!v){var S={loading:0,preload:null};if(v=l.querySelector(_a(p)))S.loading=5;else{i=y({rel:"stylesheet",href:i,"data-precedence":s},a),(a=kn.get(p))&&gh(i,a);var T=v=l.createElement("link");kt(T),zt(T,"link",i),T._p=new Promise(function(D,z){T.onload=D,T.onerror=z}),T.addEventListener("load",function(){S.loading|=1}),T.addEventListener("error",function(){S.loading|=2}),S.loading|=4,Ou(v,s,l)}v={type:"stylesheet",instance:v,count:1,state:S},f.set(p,v)}}}function q_(i,s){Di.X(i,s);var a=Zs;if(a&&i){var l=gs(a).hoistableScripts,f=Qs(i),p=l.get(f);p||(p=a.querySelector(Ma(f)),p||(i=y({src:i,async:!0},s),(s=kn.get(f))&&vh(i,s),p=a.createElement("script"),kt(p),zt(p,"link",i),a.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},l.set(f,p))}}function P_(i,s){Di.M(i,s);var a=Zs;if(a&&i){var l=gs(a).hoistableScripts,f=Qs(i),p=l.get(f);p||(p=a.querySelector(Ma(f)),p||(i=y({src:i,async:!0,type:"module"},s),(s=kn.get(f))&&vh(i,s),p=a.createElement("script"),kt(p),zt(p,"link",i),a.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},l.set(f,p))}}function m0(i,s,a,l){var f=(f=ie.current)?Ru(f):null;if(!f)throw Error(r(446));switch(i){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(s=Js(a.href),a=gs(f).hoistableStyles,l=a.get(s),l||(l={type:"style",instance:null,count:0,state:null},a.set(s,l)),l):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){i=Js(a.href);var p=gs(f).hoistableStyles,v=p.get(i);if(v||(f=f.ownerDocument||f,v={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},p.set(i,v),(p=f.querySelector(_a(i)))&&!p._p&&(v.instance=p,v.state.loading=5),kn.has(i)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},kn.set(i,a),p||K_(f,i,a,v.state))),s&&l===null)throw Error(r(528,""));return v}if(s&&l!==null)throw Error(r(529,""));return null;case"script":return s=a.async,a=a.src,typeof a=="string"&&s&&typeof s!="function"&&typeof s!="symbol"?(s=Qs(a),a=gs(f).hoistableScripts,l=a.get(s),l||(l={type:"script",instance:null,count:0,state:null},a.set(s,l)),l):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,i))}}function Js(i){return'href="'+Tn(i)+'"'}function _a(i){return'link[rel="stylesheet"]['+i+"]"}function y0(i){return y({},i,{"data-precedence":i.precedence,precedence:null})}function K_(i,s,a,l){i.querySelector('link[rel="preload"][as="style"]['+s+"]")?l.loading=1:(s=i.createElement("link"),l.preload=s,s.addEventListener("load",function(){return l.loading|=1}),s.addEventListener("error",function(){return l.loading|=2}),zt(s,"link",a),kt(s),i.head.appendChild(s))}function Qs(i){return'[src="'+Tn(i)+'"]'}function Ma(i){return"script[async]"+i}function g0(i,s,a){if(s.count++,s.instance===null)switch(s.type){case"style":var l=i.querySelector('style[data-href~="'+Tn(a.href)+'"]');if(l)return s.instance=l,kt(l),l;var f=y({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return l=(i.ownerDocument||i).createElement("style"),kt(l),zt(l,"style",f),Ou(l,a.precedence,i),s.instance=l;case"stylesheet":f=Js(a.href);var p=i.querySelector(_a(f));if(p)return s.state.loading|=4,s.instance=p,kt(p),p;l=y0(a),(f=kn.get(f))&&gh(l,f),p=(i.ownerDocument||i).createElement("link"),kt(p);var v=p;return v._p=new Promise(function(S,T){v.onload=S,v.onerror=T}),zt(p,"link",l),s.state.loading|=4,Ou(p,a.precedence,i),s.instance=p;case"script":return p=Qs(a.src),(f=i.querySelector(Ma(p)))?(s.instance=f,kt(f),f):(l=a,(f=kn.get(p))&&(l=y({},a),vh(l,f)),i=i.ownerDocument||i,f=i.createElement("script"),kt(f),zt(f,"link",l),i.head.appendChild(f),s.instance=f);case"void":return null;default:throw Error(r(443,s.type))}else s.type==="stylesheet"&&(s.state.loading&4)===0&&(l=s.instance,s.state.loading|=4,Ou(l,a.precedence,i));return s.instance}function Ou(i,s,a){for(var l=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),f=l.length?l[l.length-1]:null,p=f,v=0;v<l.length;v++){var S=l[v];if(S.dataset.precedence===s)p=S;else if(p!==f)break}p?p.parentNode.insertBefore(i,p.nextSibling):(s=a.nodeType===9?a.head:a,s.insertBefore(i,s.firstChild))}function gh(i,s){i.crossOrigin==null&&(i.crossOrigin=s.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=s.referrerPolicy),i.title==null&&(i.title=s.title)}function vh(i,s){i.crossOrigin==null&&(i.crossOrigin=s.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=s.referrerPolicy),i.integrity==null&&(i.integrity=s.integrity)}var _u=null;function v0(i,s,a){if(_u===null){var l=new Map,f=_u=new Map;f.set(a,l)}else f=_u,l=f.get(a),l||(l=new Map,f.set(a,l));if(l.has(i))return l;for(l.set(i,null),a=a.getElementsByTagName(i),f=0;f<a.length;f++){var p=a[f];if(!(p[Po]||p[Pt]||i==="link"&&p.getAttribute("rel")==="stylesheet")&&p.namespaceURI!=="http://www.w3.org/2000/svg"){var v=p.getAttribute(s)||"";v=i+v;var S=l.get(v);S?S.push(p):l.set(v,[p])}}return l}function b0(i,s,a){i=i.ownerDocument||i,i.head.insertBefore(a,s==="title"?i.querySelector("head > title"):null)}function I_(i,s,a){if(a===1||s.itemProp!=null)return!1;switch(i){case"meta":case"title":return!0;case"style":if(typeof s.precedence!="string"||typeof s.href!="string"||s.href==="")break;return!0;case"link":if(typeof s.rel!="string"||typeof s.href!="string"||s.href===""||s.onLoad||s.onError)break;switch(s.rel){case"stylesheet":return i=s.disabled,typeof s.precedence=="string"&&i==null;default:return!0}case"script":if(s.async&&typeof s.async!="function"&&typeof s.async!="symbol"&&!s.onLoad&&!s.onError&&s.src&&typeof s.src=="string")return!0}return!1}function S0(i){return!(i.type==="stylesheet"&&(i.state.loading&3)===0)}var Ca=null;function H_(){}function F_(i,s,a){if(Ca===null)throw Error(r(475));var l=Ca;if(s.type==="stylesheet"&&(typeof a.media!="string"||matchMedia(a.media).matches!==!1)&&(s.state.loading&4)===0){if(s.instance===null){var f=Js(a.href),p=i.querySelector(_a(f));if(p){i=p._p,i!==null&&typeof i=="object"&&typeof i.then=="function"&&(l.count++,l=Mu.bind(l),i.then(l,l)),s.state.loading|=4,s.instance=p,kt(p);return}p=i.ownerDocument||i,a=y0(a),(f=kn.get(f))&&gh(a,f),p=p.createElement("link"),kt(p);var v=p;v._p=new Promise(function(S,T){v.onload=S,v.onerror=T}),zt(p,"link",a),s.instance=p}l.stylesheets===null&&(l.stylesheets=new Map),l.stylesheets.set(s,i),(i=s.state.preload)&&(s.state.loading&3)===0&&(l.count++,s=Mu.bind(l),i.addEventListener("load",s),i.addEventListener("error",s))}}function G_(){if(Ca===null)throw Error(r(475));var i=Ca;return i.stylesheets&&i.count===0&&bh(i,i.stylesheets),0<i.count?function(s){var a=setTimeout(function(){if(i.stylesheets&&bh(i,i.stylesheets),i.unsuspend){var l=i.unsuspend;i.unsuspend=null,l()}},6e4);return i.unsuspend=s,function(){i.unsuspend=null,clearTimeout(a)}}:null}function Mu(){if(this.count--,this.count===0){if(this.stylesheets)bh(this,this.stylesheets);else if(this.unsuspend){var i=this.unsuspend;this.unsuspend=null,i()}}}var Cu=null;function bh(i,s){i.stylesheets=null,i.unsuspend!==null&&(i.count++,Cu=new Map,s.forEach(Y_,i),Cu=null,Mu.call(i))}function Y_(i,s){if(!(s.state.loading&4)){var a=Cu.get(i);if(a)var l=a.get(null);else{a=new Map,Cu.set(i,a);for(var f=i.querySelectorAll("link[data-precedence],style[data-precedence]"),p=0;p<f.length;p++){var v=f[p];(v.nodeName==="LINK"||v.getAttribute("media")!=="not all")&&(a.set(v.dataset.precedence,v),l=v)}l&&a.set(null,l)}f=s.instance,v=f.getAttribute("data-precedence"),p=a.get(v)||l,p===l&&a.set(null,f),a.set(v,f),this.count++,l=Mu.bind(this),f.addEventListener("load",l),f.addEventListener("error",l),p?p.parentNode.insertBefore(f,p.nextSibling):(i=i.nodeType===9?i.head:i,i.insertBefore(f,i.firstChild)),s.state.loading|=4}}var ka={$$typeof:O,Provider:null,Consumer:null,_currentValue:K,_currentValue2:K,_threadCount:0};function X_(i,s,a,l,f,p,v,S){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=mf(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=mf(0),this.hiddenUpdates=mf(null),this.identifierPrefix=l,this.onUncaughtError=f,this.onCaughtError=p,this.onRecoverableError=v,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=S,this.incompleteTransitions=new Map}function x0(i,s,a,l,f,p,v,S,T,D,z,I){return i=new X_(i,s,a,v,S,T,D,I),s=1,p===!0&&(s|=24),p=hn(3,null,null,s),i.current=p,p.stateNode=i,s=ed(),s.refCount++,i.pooledCache=s,s.refCount++,p.memoizedState={element:l,isDehydrated:a,cache:s},rd(p),i}function w0(i){return i?(i=Ms,i):Ms}function A0(i,s,a,l,f,p){f=w0(f),l.context===null?l.context=f:l.pendingContext=f,l=Wi(s),l.payload={element:a},p=p===void 0?null:p,p!==null&&(l.callback=p),a=er(i,l,s),a!==null&&(vn(a,i,s),aa(a,i,s))}function T0(i,s){if(i=i.memoizedState,i!==null&&i.dehydrated!==null){var a=i.retryLane;i.retryLane=a!==0&&a<s?a:s}}function Sh(i,s){T0(i,s),(i=i.alternate)&&T0(i,s)}function E0(i){if(i.tag===13){var s=_s(i,67108864);s!==null&&vn(s,i,67108864),Sh(i,67108864)}}var ku=!0;function Z_(i,s,a,l){var f=N.T;N.T=null;var p=P.p;try{P.p=2,xh(i,s,a,l)}finally{P.p=p,N.T=f}}function J_(i,s,a,l){var f=N.T;N.T=null;var p=P.p;try{P.p=8,xh(i,s,a,l)}finally{P.p=p,N.T=f}}function xh(i,s,a,l){if(ku){var f=wh(l);if(f===null)lh(i,s,l,Du,a),O0(i,l);else if(W_(f,i,s,a,l))l.stopPropagation();else if(O0(i,l),s&4&&-1<Q_.indexOf(i)){for(;f!==null;){var p=ys(f);if(p!==null)switch(p.tag){case 3:if(p=p.stateNode,p.current.memoizedState.isDehydrated){var v=kr(p.pendingLanes);if(v!==0){var S=p;for(S.pendingLanes|=2,S.entangledLanes|=2;v;){var T=1<<31-fn(v);S.entanglements[1]|=T,v&=~T}ei(p),(Le&6)===0&&(mu=ut()+500,Ta(0))}}break;case 13:S=_s(p,2),S!==null&&vn(S,p,2),gu(),Sh(p,2)}if(p=wh(l),p===null&&lh(i,s,l,Du,a),p===f)break;f=p}f!==null&&l.stopPropagation()}else lh(i,s,l,null,a)}}function wh(i){return i=Of(i),Ah(i)}var Du=null;function Ah(i){if(Du=null,i=ms(i),i!==null){var s=u(i);if(s===null)i=null;else{var a=s.tag;if(a===13){if(i=c(s),i!==null)return i;i=null}else if(a===3){if(s.stateNode.current.memoizedState.isDehydrated)return s.tag===3?s.stateNode.containerInfo:null;i=null}else s!==i&&(i=null)}}return Du=i,null}function R0(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(Un()){case Xe:return 2;case Je:return 8;case un:case Tl:return 32;case Py:return 268435456;default:return 32}default:return 32}}var Th=!1,hr=null,pr=null,mr=null,Da=new Map,Na=new Map,yr=[],Q_="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 O0(i,s){switch(i){case"focusin":case"focusout":hr=null;break;case"dragenter":case"dragleave":pr=null;break;case"mouseover":case"mouseout":mr=null;break;case"pointerover":case"pointerout":Da.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":Na.delete(s.pointerId)}}function $a(i,s,a,l,f,p){return i===null||i.nativeEvent!==p?(i={blockedOn:s,domEventName:a,eventSystemFlags:l,nativeEvent:p,targetContainers:[f]},s!==null&&(s=ys(s),s!==null&&E0(s)),i):(i.eventSystemFlags|=l,s=i.targetContainers,f!==null&&s.indexOf(f)===-1&&s.push(f),i)}function W_(i,s,a,l,f){switch(s){case"focusin":return hr=$a(hr,i,s,a,l,f),!0;case"dragenter":return pr=$a(pr,i,s,a,l,f),!0;case"mouseover":return mr=$a(mr,i,s,a,l,f),!0;case"pointerover":var p=f.pointerId;return Da.set(p,$a(Da.get(p)||null,i,s,a,l,f)),!0;case"gotpointercapture":return p=f.pointerId,Na.set(p,$a(Na.get(p)||null,i,s,a,l,f)),!0}return!1}function _0(i){var s=ms(i.target);if(s!==null){var a=u(s);if(a!==null){if(s=a.tag,s===13){if(s=c(a),s!==null){i.blockedOn=s,FR(i.priority,function(){if(a.tag===13){var l=gn();l=yf(l);var f=_s(a,l);f!==null&&vn(f,a,l),Sh(a,l)}});return}}else if(s===3&&a.stateNode.current.memoizedState.isDehydrated){i.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}i.blockedOn=null}function Nu(i){if(i.blockedOn!==null)return!1;for(var s=i.targetContainers;0<s.length;){var a=wh(i.nativeEvent);if(a===null){a=i.nativeEvent;var l=new a.constructor(a.type,a);Rf=l,a.target.dispatchEvent(l),Rf=null}else return s=ys(a),s!==null&&E0(s),i.blockedOn=a,!1;s.shift()}return!0}function M0(i,s,a){Nu(i)&&a.delete(s)}function eM(){Th=!1,hr!==null&&Nu(hr)&&(hr=null),pr!==null&&Nu(pr)&&(pr=null),mr!==null&&Nu(mr)&&(mr=null),Da.forEach(M0),Na.forEach(M0)}function $u(i,s){i.blockedOn===s&&(i.blockedOn=null,Th||(Th=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,eM)))}var ju=null;function C0(i){ju!==i&&(ju=i,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){ju===i&&(ju=null);for(var s=0;s<i.length;s+=3){var a=i[s],l=i[s+1],f=i[s+2];if(typeof l!="function"){if(Ah(l||a)===null)continue;break}var p=ys(a);p!==null&&(i.splice(s,3),s-=3,Ad(p,{pending:!0,data:f,method:a.method,action:l},l,f))}}))}function ja(i){function s(T){return $u(T,i)}hr!==null&&$u(hr,i),pr!==null&&$u(pr,i),mr!==null&&$u(mr,i),Da.forEach(s),Na.forEach(s);for(var a=0;a<yr.length;a++){var l=yr[a];l.blockedOn===i&&(l.blockedOn=null)}for(;0<yr.length&&(a=yr[0],a.blockedOn===null);)_0(a),a.blockedOn===null&&yr.shift();if(a=(i.ownerDocument||i).$$reactFormReplay,a!=null)for(l=0;l<a.length;l+=3){var f=a[l],p=a[l+1],v=f[Qt]||null;if(typeof p=="function")v||C0(a);else if(v){var S=null;if(p&&p.hasAttribute("formAction")){if(f=p,v=p[Qt]||null)S=v.formAction;else if(Ah(f)!==null)continue}else S=v.action;typeof S=="function"?a[l+1]=S:(a.splice(l,3),l-=3),C0(a)}}}function Eh(i){this._internalRoot=i}Bu.prototype.render=Eh.prototype.render=function(i){var s=this._internalRoot;if(s===null)throw Error(r(409));var a=s.current,l=gn();A0(a,l,i,s,null,null)},Bu.prototype.unmount=Eh.prototype.unmount=function(){var i=this._internalRoot;if(i!==null){this._internalRoot=null;var s=i.containerInfo;A0(i.current,2,null,i,null,null),gu(),s[ps]=null}};function Bu(i){this._internalRoot=i}Bu.prototype.unstable_scheduleHydration=function(i){if(i){var s=Gy();i={blockedOn:null,target:i,priority:s};for(var a=0;a<yr.length&&s!==0&&s<yr[a].priority;a++);yr.splice(a,0,i),a===0&&_0(i)}};var k0=e.version;if(k0!=="19.1.0")throw Error(r(527,k0,"19.1.0"));P.findDOMNode=function(i){var s=i._reactInternals;if(s===void 0)throw typeof i.render=="function"?Error(r(188)):(i=Object.keys(i).join(","),Error(r(268,i)));return i=h(s),i=i!==null?m(i):null,i=i===null?null:i.stateNode,i};var tM={bundleType:0,version:"19.1.0",rendererPackageName:"react-dom",currentDispatcherRef:N,reconcilerVersion:"19.1.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Lu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Lu.isDisabled&&Lu.supportsFiber)try{zo=Lu.inject(tM),cn=Lu}catch{}}return La.createRoot=function(i,s){if(!o(i))throw Error(r(299));var a=!1,l="",f=Gv,p=Yv,v=Xv,S=null;return s!=null&&(s.unstable_strictMode===!0&&(a=!0),s.identifierPrefix!==void 0&&(l=s.identifierPrefix),s.onUncaughtError!==void 0&&(f=s.onUncaughtError),s.onCaughtError!==void 0&&(p=s.onCaughtError),s.onRecoverableError!==void 0&&(v=s.onRecoverableError),s.unstable_transitionCallbacks!==void 0&&(S=s.unstable_transitionCallbacks)),s=x0(i,1,!1,null,null,a,l,f,p,v,S,null),i[ps]=s.current,ah(i),new Eh(s)},La.hydrateRoot=function(i,s,a){if(!o(i))throw Error(r(299));var l=!1,f="",p=Gv,v=Yv,S=Xv,T=null,D=null;return a!=null&&(a.unstable_strictMode===!0&&(l=!0),a.identifierPrefix!==void 0&&(f=a.identifierPrefix),a.onUncaughtError!==void 0&&(p=a.onUncaughtError),a.onCaughtError!==void 0&&(v=a.onCaughtError),a.onRecoverableError!==void 0&&(S=a.onRecoverableError),a.unstable_transitionCallbacks!==void 0&&(T=a.unstable_transitionCallbacks),a.formState!==void 0&&(D=a.formState)),s=x0(i,1,!0,s,a??null,l,f,p,v,S,T,D),s.context=w0(null),a=s.current,l=gn(),l=yf(l),f=Wi(l),f.callback=null,er(a,f,l),a=l,s.current.lanes=a,qo(s,a),ei(s),i[ps]=s.current,ah(i),new Bu(s)},La.version="19.1.0",La}var I0;function yC(){if(I0)return Mh.exports;I0=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),Mh.exports=mC(),Mh.exports}var gC=yC();function Ic(){return typeof window<"u"}function Mr(t){return aw(t)?(t.nodeName||"").toLowerCase():"#document"}function xn(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function pi(t){var e;return(e=(aw(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function aw(t){return Ic()?t instanceof Node||t instanceof xn(t).Node:!1}function ht(t){return Ic()?t instanceof Element||t instanceof xn(t).Element:!1}function Mt(t){return Ic()?t instanceof HTMLElement||t instanceof xn(t).HTMLElement:!1}function Sp(t){return!Ic()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof xn(t).ShadowRoot}function ll(t){const{overflow:e,overflowX:n,overflowY:r,display:o}=zn(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!["inline","contents"].includes(o)}function vC(t){return["table","td","th"].includes(Mr(t))}function Hc(t){return[":popover-open",":modal"].some(e=>{try{return t.matches(e)}catch{return!1}})}function km(t){const e=Fc(),n=ht(t)?zn(t):t;return["transform","translate","scale","rotate","perspective"].some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||["transform","translate","scale","rotate","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function bC(t){let e=zi(t);for(;Mt(e)&&!Bi(e);){if(km(e))return e;if(Hc(e))return null;e=zi(e)}return null}function Fc(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Bi(t){return["html","body","#document"].includes(Mr(t))}function zn(t){return xn(t).getComputedStyle(t)}function Gc(t){return ht(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function zi(t){if(Mr(t)==="html")return t;const e=t.assignedSlot||t.parentNode||Sp(t)&&t.host||pi(t);return Sp(e)?e.host:e}function lw(t){const e=zi(t);return Bi(e)?t.ownerDocument?t.ownerDocument.body:t.body:Mt(e)&&ll(e)?e:lw(e)}function Tr(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const o=lw(t),u=o===((r=t.ownerDocument)==null?void 0:r.body),c=xn(o);if(u){const d=xp(c);return e.concat(c,c.visualViewport||[],ll(o)?o:[],d&&n?Tr(d):[])}return e.concat(o,Tr(o,[],n))}function xp(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}const pc=Math.min,is=Math.max,mc=Math.round,zu=Math.floor,si=t=>({x:t,y:t}),SC={left:"right",right:"left",bottom:"top",top:"bottom"},xC={start:"end",end:"start"};function H0(t,e,n){return is(t,pc(e,n))}function Yc(t,e){return typeof t=="function"?t(e):t}function as(t){return t.split("-")[0]}function Xc(t){return t.split("-")[1]}function uw(t){return t==="x"?"y":"x"}function cw(t){return t==="y"?"height":"width"}function wr(t){return["top","bottom"].includes(as(t))?"y":"x"}function fw(t){return uw(wr(t))}function wC(t,e,n){n===void 0&&(n=!1);const r=Xc(t),o=fw(t),u=cw(o);let c=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[u]>e.floating[u]&&(c=yc(c)),[c,yc(c)]}function AC(t){const e=yc(t);return[wp(t),e,wp(e)]}function wp(t){return t.replace(/start|end/g,e=>xC[e])}function TC(t,e,n){const r=["left","right"],o=["right","left"],u=["top","bottom"],c=["bottom","top"];switch(t){case"top":case"bottom":return n?e?o:r:e?r:o;case"left":case"right":return e?u:c;default:return[]}}function EC(t,e,n,r){const o=Xc(t);let u=TC(as(t),n==="start",r);return o&&(u=u.map(c=>c+"-"+o),e&&(u=u.concat(u.map(wp)))),u}function yc(t){return t.replace(/left|right|bottom|top/g,e=>SC[e])}function RC(t){return{top:0,right:0,bottom:0,left:0,...t}}function OC(t){return typeof t!="number"?RC(t):{top:t,right:t,bottom:t,left:t}}function gc(t){const{x:e,y:n,width:r,height:o}=t;return{width:r,height:o,top:n,left:e,right:e+r,bottom:n+o,x:e,y:n}}/*!
|
|
63
|
-
* tabbable 6.2.0
|
|
64
|
-
* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
|
|
65
|
-
*/var _C=["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])"],vc=_C.join(","),dw=typeof Element>"u",So=dw?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,bc=!dw&&Element.prototype.getRootNode?function(t){var e;return t==null||(e=t.getRootNode)===null||e===void 0?void 0:e.call(t)}:function(t){return t?.ownerDocument},Sc=function t(e,n){var r;n===void 0&&(n=!0);var o=e==null||(r=e.getAttribute)===null||r===void 0?void 0:r.call(e,"inert"),u=o===""||o==="true",c=u||n&&e&&t(e.parentNode);return c},MC=function(e){var n,r=e==null||(n=e.getAttribute)===null||n===void 0?void 0:n.call(e,"contenteditable");return r===""||r==="true"},hw=function(e,n,r){if(Sc(e))return[];var o=Array.prototype.slice.apply(e.querySelectorAll(vc));return n&&So.call(e,vc)&&o.unshift(e),o=o.filter(r),o},pw=function t(e,n,r){for(var o=[],u=Array.from(e);u.length;){var c=u.shift();if(!Sc(c,!1))if(c.tagName==="SLOT"){var d=c.assignedElements(),h=d.length?d:c.children,m=t(h,!0,r);r.flatten?o.push.apply(o,m):o.push({scopeParent:c,candidates:m})}else{var y=So.call(c,vc);y&&r.filter(c)&&(n||!e.includes(c))&&o.push(c);var g=c.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(c),b=!Sc(g,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(c));if(g&&b){var x=t(g===!0?c.children:g.children,!0,r);r.flatten?o.push.apply(o,x):o.push({scopeParent:c,candidates:x})}else u.unshift.apply(u,c.children)}}return o},mw=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},yw=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||MC(e))&&!mw(e)?0:e.tabIndex},CC=function(e,n){var r=yw(e);return r<0&&n&&!mw(e)?0:r},kC=function(e,n){return e.tabIndex===n.tabIndex?e.documentOrder-n.documentOrder:e.tabIndex-n.tabIndex},gw=function(e){return e.tagName==="INPUT"},DC=function(e){return gw(e)&&e.type==="hidden"},NC=function(e){var n=e.tagName==="DETAILS"&&Array.prototype.slice.apply(e.children).some(function(r){return r.tagName==="SUMMARY"});return n},$C=function(e,n){for(var r=0;r<e.length;r++)if(e[r].checked&&e[r].form===n)return e[r]},jC=function(e){if(!e.name)return!0;var n=e.form||bc(e),r=function(d){return n.querySelectorAll('input[type="radio"][name="'+d+'"]')},o;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")o=r(window.CSS.escape(e.name));else try{o=r(e.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=$C(o,e.form);return!u||u===e},BC=function(e){return gw(e)&&e.type==="radio"},LC=function(e){return BC(e)&&!jC(e)},VC=function(e){var n,r=e&&bc(e),o=(n=r)===null||n===void 0?void 0:n.host,u=!1;if(r&&r!==e){var c,d,h;for(u=!!((c=o)!==null&&c!==void 0&&(d=c.ownerDocument)!==null&&d!==void 0&&d.contains(o)||e!=null&&(h=e.ownerDocument)!==null&&h!==void 0&&h.contains(e));!u&&o;){var m,y,g;r=bc(o),o=(m=r)===null||m===void 0?void 0:m.host,u=!!((y=o)!==null&&y!==void 0&&(g=y.ownerDocument)!==null&&g!==void 0&&g.contains(o))}}return u},F0=function(e){var n=e.getBoundingClientRect(),r=n.width,o=n.height;return r===0&&o===0},zC=function(e,n){var r=n.displayCheck,o=n.getShadowRoot;if(getComputedStyle(e).visibility==="hidden")return!0;var u=So.call(e,"details>summary:first-of-type"),c=u?e.parentElement:e;if(So.call(c,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="legacy-full"){if(typeof o=="function"){for(var d=e;e;){var h=e.parentElement,m=bc(e);if(h&&!h.shadowRoot&&o(h)===!0)return F0(e);e.assignedSlot?e=e.assignedSlot:!h&&m!==e.ownerDocument?e=m.host:e=h}e=d}if(VC(e))return!e.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return F0(e);return!1},UC=function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var n=e.parentElement;n;){if(n.tagName==="FIELDSET"&&n.disabled){for(var r=0;r<n.children.length;r++){var o=n.children.item(r);if(o.tagName==="LEGEND")return So.call(n,"fieldset[disabled] *")?!0:!o.contains(e)}return!0}n=n.parentElement}return!1},Ap=function(e,n){return!(n.disabled||Sc(n)||DC(n)||zC(n,e)||NC(n)||UC(n))},Tp=function(e,n){return!(LC(n)||yw(n)<0||!Ap(e,n))},qC=function(e){var n=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},PC=function t(e){var n=[],r=[];return e.forEach(function(o,u){var c=!!o.scopeParent,d=c?o.scopeParent:o,h=CC(d,c),m=c?t(o.candidates):d;h===0?c?n.push.apply(n,m):n.push(d):r.push({documentOrder:u,tabIndex:h,item:o,isScope:c,content:m})}),r.sort(kC).reduce(function(o,u){return u.isScope?o.push.apply(o,u.content):o.push(u.content),o},[]).concat(n)},Dm=function(e,n){n=n||{};var r;return n.getShadowRoot?r=pw([e],n.includeContainer,{filter:Tp.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:qC}):r=hw(e,n.includeContainer,Tp.bind(null,n)),PC(r)},KC=function(e,n){n=n||{};var r;return n.getShadowRoot?r=pw([e],n.includeContainer,{filter:Ap.bind(null,n),flatten:!0,getShadowRoot:n.getShadowRoot}):r=hw(e,n.includeContainer,Ap.bind(null,n)),r},vw=function(e,n){if(n=n||{},!e)throw new Error("No node provided");return So.call(e,vc)===!1?!1:Tp(n,e)};function IC(){const t=navigator.userAgentData;return t!=null&&t.platform?t.platform:navigator.platform}function bw(){const t=navigator.userAgentData;return t&&Array.isArray(t.brands)?t.brands.map(e=>{let{brand:n,version:r}=e;return n+"/"+r}).join(" "):navigator.userAgent}function HC(){return/apple/i.test(navigator.vendor)}function Ep(){const t=/android/i;return t.test(IC())||t.test(bw())}function FC(){return bw().includes("jsdom/")}const G0="data-floating-ui-focusable",GC="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function io(t){let e=t.activeElement;for(;((n=e)==null||(n=n.shadowRoot)==null?void 0:n.activeElement)!=null;){var n;e=e.shadowRoot.activeElement}return e}function bn(t,e){if(!t||!e)return!1;const n=e.getRootNode==null?void 0:e.getRootNode();if(t.contains(e))return!0;if(n&&Sp(n)){let r=e;for(;r;){if(t===r)return!0;r=r.parentNode||r.host}}return!1}function Sr(t){return"composedPath"in t?t.composedPath()[0]:t.target}function Nh(t,e){if(e==null)return!1;if("composedPath"in t)return t.composedPath().includes(e);const n=t;return n.target!=null&&e.contains(n.target)}function YC(t){return t.matches("html,body")}function Gn(t){return t?.ownerDocument||document}function Sw(t){return Mt(t)&&t.matches(GC)}function Y0(t){return t?t.getAttribute("role")==="combobox"&&Sw(t):!1}function Rp(t){return t?t.hasAttribute(G0)?t:t.querySelector("["+G0+"]")||t:null}function Ia(t,e){let n=t.filter(o=>{var u;return o.parentId===e&&((u=o.context)==null?void 0:u.open)}),r=n;for(;r.length;)r=t.filter(o=>{var u;return(u=r)==null?void 0:u.some(c=>{var d;return o.parentId===c.id&&((d=o.context)==null?void 0:d.open)})}),n=n.concat(r);return n}function X0(t,e){var n;let r=[],o=(n=t.find(u=>u.id===e))==null?void 0:n.parentId;for(;o;){const u=t.find(c=>c.id===o);o=u?.parentId,u&&(r=r.concat(u))}return r}function $h(t){t.preventDefault(),t.stopPropagation()}function XC(t){return"nativeEvent"in t}function ZC(t){return t.mozInputSource===0&&t.isTrusted?!0:Ep()&&t.pointerType?t.type==="click"&&t.buttons===1:t.detail===0&&!t.pointerType}function JC(t){return FC()?!1:!Ep()&&t.width===0&&t.height===0||Ep()&&t.width===1&&t.height===1&&t.pressure===0&&t.detail===0&&t.pointerType==="mouse"||t.width<1&&t.height<1&&t.pressure===0&&t.detail===0&&t.pointerType==="touch"}function Z0(t,e){return["mouse","pen"].includes(t)}var QC=typeof document<"u",WC=function(){},ji=QC?B.useLayoutEffect:WC;const ek={...j1};function jh(t){const e=B.useRef(t);return ji(()=>{e.current=t}),e}const tk=ek.useInsertionEffect,nk=tk||(t=>t());function ii(t){const e=B.useRef(()=>{});return nk(()=>{e.current=t}),B.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return e.current==null?void 0:e.current(...r)},[])}const Zc=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function xw(t,e){const n=Dm(t,Zc()),r=n.length;if(r===0)return;const o=io(Gn(t)),u=n.indexOf(o),c=u===-1?e===1?0:r-1:u+e;return n[c]}function ik(t){return xw(Gn(t).body,1)||t}function rk(t){return xw(Gn(t).body,-1)||t}function J0(t,e){const n=e||t.currentTarget,r=t.relatedTarget;return!r||!bn(n,r)}var sk=ow();function Q0(t,e,n){let{reference:r,floating:o}=t;const u=wr(e),c=fw(e),d=cw(c),h=as(e),m=u==="y",y=r.x+r.width/2-o.width/2,g=r.y+r.height/2-o.height/2,b=r[d]/2-o[d]/2;let x;switch(h){case"top":x={x:y,y:r.y-o.height};break;case"bottom":x={x:y,y:r.y+r.height};break;case"right":x={x:r.x+r.width,y:g};break;case"left":x={x:r.x-o.width,y:g};break;default:x={x:r.x,y:r.y}}switch(Xc(e)){case"start":x[c]-=b*(n&&m?-1:1);break;case"end":x[c]+=b*(n&&m?-1:1);break}return x}const ok=async(t,e,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:u=[],platform:c}=n,d=u.filter(Boolean),h=await(c.isRTL==null?void 0:c.isRTL(e));let m=await c.getElementRects({reference:t,floating:e,strategy:o}),{x:y,y:g}=Q0(m,r,h),b=r,x={},A=0;for(let w=0;w<d.length;w++){const{name:k,fn:$}=d[w],{x:M,y:O,data:G,reset:V}=await $({x:y,y:g,initialPlacement:r,placement:b,strategy:o,middlewareData:x,rects:m,platform:c,elements:{reference:t,floating:e}});y=M??y,g=O??g,x={...x,[k]:{...x[k],...G}},V&&A<=50&&(A++,typeof V=="object"&&(V.placement&&(b=V.placement),V.rects&&(m=V.rects===!0?await c.getElementRects({reference:t,floating:e,strategy:o}):V.rects),{x:y,y:g}=Q0(m,b,h)),w=-1)}return{x:y,y:g,placement:b,strategy:o,middlewareData:x}};async function ww(t,e){var n;e===void 0&&(e={});const{x:r,y:o,platform:u,rects:c,elements:d,strategy:h}=t,{boundary:m="clippingAncestors",rootBoundary:y="viewport",elementContext:g="floating",altBoundary:b=!1,padding:x=0}=Yc(e,t),A=OC(x),k=d[b?g==="floating"?"reference":"floating":g],$=gc(await u.getClippingRect({element:(n=await(u.isElement==null?void 0:u.isElement(k)))==null||n?k:k.contextElement||await(u.getDocumentElement==null?void 0:u.getDocumentElement(d.floating)),boundary:m,rootBoundary:y,strategy:h})),M=g==="floating"?{x:r,y:o,width:c.floating.width,height:c.floating.height}:c.reference,O=await(u.getOffsetParent==null?void 0:u.getOffsetParent(d.floating)),G=await(u.isElement==null?void 0:u.isElement(O))?await(u.getScale==null?void 0:u.getScale(O))||{x:1,y:1}:{x:1,y:1},V=gc(u.convertOffsetParentRelativeRectToViewportRelativeRect?await u.convertOffsetParentRelativeRectToViewportRelativeRect({elements:d,rect:M,offsetParent:O,strategy:h}):M);return{top:($.top-V.top+A.top)/G.y,bottom:(V.bottom-$.bottom+A.bottom)/G.y,left:($.left-V.left+A.left)/G.x,right:(V.right-$.right+A.right)/G.x}}const ak=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,r;const{placement:o,middlewareData:u,rects:c,initialPlacement:d,platform:h,elements:m}=e,{mainAxis:y=!0,crossAxis:g=!0,fallbackPlacements:b,fallbackStrategy:x="bestFit",fallbackAxisSideDirection:A="none",flipAlignment:w=!0,...k}=Yc(t,e);if((n=u.arrow)!=null&&n.alignmentOffset)return{};const $=as(o),M=wr(d),O=as(d)===d,G=await(h.isRTL==null?void 0:h.isRTL(m.floating)),V=b||(O||!w?[yc(d)]:AC(d)),W=A!=="none";!b&&W&&V.push(...EC(d,w,A,G));const ne=[d,...V],ee=await ww(e,k),ce=[];let me=((r=u.flip)==null?void 0:r.overflows)||[];if(y&&ce.push(ee[$]),g){const he=wC(o,c,G);ce.push(ee[he[0]],ee[he[1]])}if(me=[...me,{placement:o,overflows:ce}],!ce.every(he=>he<=0)){var be,Me;const he=(((be=u.flip)==null?void 0:be.index)||0)+1,X=ne[he];if(X&&(!(g==="alignment"?M!==wr(X):!1)||me.every(K=>K.overflows[0]>0&&wr(K.placement)===M)))return{data:{index:he,overflows:me},reset:{placement:X}};let N=(Me=me.filter(P=>P.overflows[0]<=0).sort((P,K)=>P.overflows[1]-K.overflows[1])[0])==null?void 0:Me.placement;if(!N)switch(x){case"bestFit":{var Se;const P=(Se=me.filter(K=>{if(W){const J=wr(K.placement);return J===M||J==="y"}return!0}).map(K=>[K.placement,K.overflows.filter(J=>J>0).reduce((J,E)=>J+E,0)]).sort((K,J)=>K[1]-J[1])[0])==null?void 0:Se[0];P&&(N=P);break}case"initialPlacement":N=d;break}if(o!==N)return{reset:{placement:N}}}return{}}}};async function lk(t,e){const{placement:n,platform:r,elements:o}=t,u=await(r.isRTL==null?void 0:r.isRTL(o.floating)),c=as(n),d=Xc(n),h=wr(n)==="y",m=["left","top"].includes(c)?-1:1,y=u&&h?-1:1,g=Yc(e,t);let{mainAxis:b,crossAxis:x,alignmentAxis:A}=typeof g=="number"?{mainAxis:g,crossAxis:0,alignmentAxis:null}:{mainAxis:g.mainAxis||0,crossAxis:g.crossAxis||0,alignmentAxis:g.alignmentAxis};return d&&typeof A=="number"&&(x=d==="end"?A*-1:A),h?{x:x*y,y:b*m}:{x:b*m,y:x*y}}const uk=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;const{x:o,y:u,placement:c,middlewareData:d}=e,h=await lk(e,t);return c===((n=d.offset)==null?void 0:n.placement)&&(r=d.arrow)!=null&&r.alignmentOffset?{}:{x:o+h.x,y:u+h.y,data:{...h,placement:c}}}}},ck=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:o}=e,{mainAxis:u=!0,crossAxis:c=!1,limiter:d={fn:k=>{let{x:$,y:M}=k;return{x:$,y:M}}},...h}=Yc(t,e),m={x:n,y:r},y=await ww(e,h),g=wr(as(o)),b=uw(g);let x=m[b],A=m[g];if(u){const k=b==="y"?"top":"left",$=b==="y"?"bottom":"right",M=x+y[k],O=x-y[$];x=H0(M,x,O)}if(c){const k=g==="y"?"top":"left",$=g==="y"?"bottom":"right",M=A+y[k],O=A-y[$];A=H0(M,A,O)}const w=d.fn({...e,[b]:x,[g]:A});return{...w,data:{x:w.x-n,y:w.y-r,enabled:{[b]:u,[g]:c}}}}}};function Aw(t){const e=zn(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const o=Mt(t),u=o?t.offsetWidth:n,c=o?t.offsetHeight:r,d=mc(n)!==u||mc(r)!==c;return d&&(n=u,r=c),{width:n,height:r,$:d}}function Nm(t){return ht(t)?t:t.contextElement}function fo(t){const e=Nm(t);if(!Mt(e))return si(1);const n=e.getBoundingClientRect(),{width:r,height:o,$:u}=Aw(e);let c=(u?mc(n.width):n.width)/r,d=(u?mc(n.height):n.height)/o;return(!c||!Number.isFinite(c))&&(c=1),(!d||!Number.isFinite(d))&&(d=1),{x:c,y:d}}const fk=si(0);function Tw(t){const e=xn(t);return!Fc()||!e.visualViewport?fk:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function dk(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==xn(t)?!1:e}function ls(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const o=t.getBoundingClientRect(),u=Nm(t);let c=si(1);e&&(r?ht(r)&&(c=fo(r)):c=fo(t));const d=dk(u,n,r)?Tw(u):si(0);let h=(o.left+d.x)/c.x,m=(o.top+d.y)/c.y,y=o.width/c.x,g=o.height/c.y;if(u){const b=xn(u),x=r&&ht(r)?xn(r):r;let A=b,w=xp(A);for(;w&&r&&x!==A;){const k=fo(w),$=w.getBoundingClientRect(),M=zn(w),O=$.left+(w.clientLeft+parseFloat(M.paddingLeft))*k.x,G=$.top+(w.clientTop+parseFloat(M.paddingTop))*k.y;h*=k.x,m*=k.y,y*=k.x,g*=k.y,h+=O,m+=G,A=xn(w),w=xp(A)}}return gc({width:y,height:g,x:h,y:m})}function $m(t,e){const n=Gc(t).scrollLeft;return e?e.left+n:ls(pi(t)).left+n}function Ew(t,e,n){n===void 0&&(n=!1);const r=t.getBoundingClientRect(),o=r.left+e.scrollLeft-(n?0:$m(t,r)),u=r.top+e.scrollTop;return{x:o,y:u}}function hk(t){let{elements:e,rect:n,offsetParent:r,strategy:o}=t;const u=o==="fixed",c=pi(r),d=e?Hc(e.floating):!1;if(r===c||d&&u)return n;let h={scrollLeft:0,scrollTop:0},m=si(1);const y=si(0),g=Mt(r);if((g||!g&&!u)&&((Mr(r)!=="body"||ll(c))&&(h=Gc(r)),Mt(r))){const x=ls(r);m=fo(r),y.x=x.x+r.clientLeft,y.y=x.y+r.clientTop}const b=c&&!g&&!u?Ew(c,h,!0):si(0);return{width:n.width*m.x,height:n.height*m.y,x:n.x*m.x-h.scrollLeft*m.x+y.x+b.x,y:n.y*m.y-h.scrollTop*m.y+y.y+b.y}}function pk(t){return Array.from(t.getClientRects())}function mk(t){const e=pi(t),n=Gc(t),r=t.ownerDocument.body,o=is(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),u=is(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let c=-n.scrollLeft+$m(t);const d=-n.scrollTop;return zn(r).direction==="rtl"&&(c+=is(e.clientWidth,r.clientWidth)-o),{width:o,height:u,x:c,y:d}}function yk(t,e){const n=xn(t),r=pi(t),o=n.visualViewport;let u=r.clientWidth,c=r.clientHeight,d=0,h=0;if(o){u=o.width,c=o.height;const m=Fc();(!m||m&&e==="fixed")&&(d=o.offsetLeft,h=o.offsetTop)}return{width:u,height:c,x:d,y:h}}function gk(t,e){const n=ls(t,!0,e==="fixed"),r=n.top+t.clientTop,o=n.left+t.clientLeft,u=Mt(t)?fo(t):si(1),c=t.clientWidth*u.x,d=t.clientHeight*u.y,h=o*u.x,m=r*u.y;return{width:c,height:d,x:h,y:m}}function W0(t,e,n){let r;if(e==="viewport")r=yk(t,n);else if(e==="document")r=mk(pi(t));else if(ht(e))r=gk(e,n);else{const o=Tw(t);r={x:e.x-o.x,y:e.y-o.y,width:e.width,height:e.height}}return gc(r)}function Rw(t,e){const n=zi(t);return n===e||!ht(n)||Bi(n)?!1:zn(n).position==="fixed"||Rw(n,e)}function vk(t,e){const n=e.get(t);if(n)return n;let r=Tr(t,[],!1).filter(d=>ht(d)&&Mr(d)!=="body"),o=null;const u=zn(t).position==="fixed";let c=u?zi(t):t;for(;ht(c)&&!Bi(c);){const d=zn(c),h=km(c);!h&&d.position==="fixed"&&(o=null),(u?!h&&!o:!h&&d.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||ll(c)&&!h&&Rw(t,c))?r=r.filter(y=>y!==c):o=d,c=zi(c)}return e.set(t,r),r}function bk(t){let{element:e,boundary:n,rootBoundary:r,strategy:o}=t;const c=[...n==="clippingAncestors"?Hc(e)?[]:vk(e,this._c):[].concat(n),r],d=c[0],h=c.reduce((m,y)=>{const g=W0(e,y,o);return m.top=is(g.top,m.top),m.right=pc(g.right,m.right),m.bottom=pc(g.bottom,m.bottom),m.left=is(g.left,m.left),m},W0(e,d,o));return{width:h.right-h.left,height:h.bottom-h.top,x:h.left,y:h.top}}function Sk(t){const{width:e,height:n}=Aw(t);return{width:e,height:n}}function xk(t,e,n){const r=Mt(e),o=pi(e),u=n==="fixed",c=ls(t,!0,u,e);let d={scrollLeft:0,scrollTop:0};const h=si(0);function m(){h.x=$m(o)}if(r||!r&&!u)if((Mr(e)!=="body"||ll(o))&&(d=Gc(e)),r){const x=ls(e,!0,u,e);h.x=x.x+e.clientLeft,h.y=x.y+e.clientTop}else o&&m();u&&!r&&o&&m();const y=o&&!r&&!u?Ew(o,d):si(0),g=c.left+d.scrollLeft-h.x-y.x,b=c.top+d.scrollTop-h.y-y.y;return{x:g,y:b,width:c.width,height:c.height}}function Bh(t){return zn(t).position==="static"}function eS(t,e){if(!Mt(t)||zn(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return pi(t)===n&&(n=n.ownerDocument.body),n}function Ow(t,e){const n=xn(t);if(Hc(t))return n;if(!Mt(t)){let o=zi(t);for(;o&&!Bi(o);){if(ht(o)&&!Bh(o))return o;o=zi(o)}return n}let r=eS(t,e);for(;r&&vC(r)&&Bh(r);)r=eS(r,e);return r&&Bi(r)&&Bh(r)&&!km(r)?n:r||bC(t)||n}const wk=async function(t){const e=this.getOffsetParent||Ow,n=this.getDimensions,r=await n(t.floating);return{reference:xk(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Ak(t){return zn(t).direction==="rtl"}const Tk={convertOffsetParentRelativeRectToViewportRelativeRect:hk,getDocumentElement:pi,getClippingRect:bk,getOffsetParent:Ow,getElementRects:wk,getClientRects:pk,getDimensions:Sk,getScale:fo,isElement:ht,isRTL:Ak};function _w(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function Ek(t,e){let n=null,r;const o=pi(t);function u(){var d;clearTimeout(r),(d=n)==null||d.disconnect(),n=null}function c(d,h){d===void 0&&(d=!1),h===void 0&&(h=1),u();const m=t.getBoundingClientRect(),{left:y,top:g,width:b,height:x}=m;if(d||e(),!b||!x)return;const A=zu(g),w=zu(o.clientWidth-(y+b)),k=zu(o.clientHeight-(g+x)),$=zu(y),O={rootMargin:-A+"px "+-w+"px "+-k+"px "+-$+"px",threshold:is(0,pc(1,h))||1};let G=!0;function V(W){const ne=W[0].intersectionRatio;if(ne!==h){if(!G)return c();ne?c(!1,ne):r=setTimeout(()=>{c(!1,1e-7)},1e3)}ne===1&&!_w(m,t.getBoundingClientRect())&&c(),G=!1}try{n=new IntersectionObserver(V,{...O,root:o.ownerDocument})}catch{n=new IntersectionObserver(V,O)}n.observe(t)}return c(!0),u}function Rk(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:u=!0,elementResize:c=typeof ResizeObserver=="function",layoutShift:d=typeof IntersectionObserver=="function",animationFrame:h=!1}=r,m=Nm(t),y=o||u?[...m?Tr(m):[],...Tr(e)]:[];y.forEach($=>{o&&$.addEventListener("scroll",n,{passive:!0}),u&&$.addEventListener("resize",n)});const g=m&&d?Ek(m,n):null;let b=-1,x=null;c&&(x=new ResizeObserver($=>{let[M]=$;M&&M.target===m&&x&&(x.unobserve(e),cancelAnimationFrame(b),b=requestAnimationFrame(()=>{var O;(O=x)==null||O.observe(e)})),n()}),m&&!h&&x.observe(m),x.observe(e));let A,w=h?ls(t):null;h&&k();function k(){const $=ls(t);w&&!_w(w,$)&&n(),w=$,A=requestAnimationFrame(k)}return n(),()=>{var $;y.forEach(M=>{o&&M.removeEventListener("scroll",n),u&&M.removeEventListener("resize",n)}),g?.(),($=x)==null||$.disconnect(),x=null,h&&cancelAnimationFrame(A)}}const Ok=uk,_k=ck,Mk=ak,Ck=(t,e,n)=>{const r=new Map,o={platform:Tk,...n},u={...o.platform,_c:r};return ok(t,e,{...o,platform:u})};var kk=typeof document<"u",Dk=function(){},ec=kk?B.useLayoutEffect:Dk;function xc(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,r,o;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(r=n;r--!==0;)if(!xc(t[r],e[r]))return!1;return!0}if(o=Object.keys(t),n=o.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(e,o[r]))return!1;for(r=n;r--!==0;){const u=o[r];if(!(u==="_owner"&&t.$$typeof)&&!xc(t[u],e[u]))return!1}return!0}return t!==t&&e!==e}function Mw(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function tS(t,e){const n=Mw(t);return Math.round(e*n)/n}function Lh(t){const e=B.useRef(t);return ec(()=>{e.current=t}),e}function Nk(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:u,floating:c}={},transform:d=!0,whileElementsMounted:h,open:m}=t,[y,g]=B.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[b,x]=B.useState(r);xc(b,r)||x(r);const[A,w]=B.useState(null),[k,$]=B.useState(null),M=B.useCallback(K=>{K!==W.current&&(W.current=K,w(K))},[]),O=B.useCallback(K=>{K!==ne.current&&(ne.current=K,$(K))},[]),G=u||A,V=c||k,W=B.useRef(null),ne=B.useRef(null),ee=B.useRef(y),ce=h!=null,me=Lh(h),be=Lh(o),Me=Lh(m),Se=B.useCallback(()=>{if(!W.current||!ne.current)return;const K={placement:e,strategy:n,middleware:b};be.current&&(K.platform=be.current),Ck(W.current,ne.current,K).then(J=>{const E={...J,isPositioned:Me.current!==!1};he.current&&!xc(ee.current,E)&&(ee.current=E,sk.flushSync(()=>{g(E)}))})},[b,e,n,be,Me]);ec(()=>{m===!1&&ee.current.isPositioned&&(ee.current.isPositioned=!1,g(K=>({...K,isPositioned:!1})))},[m]);const he=B.useRef(!1);ec(()=>(he.current=!0,()=>{he.current=!1}),[]),ec(()=>{if(G&&(W.current=G),V&&(ne.current=V),G&&V){if(me.current)return me.current(G,V,Se);Se()}},[G,V,Se,me,ce]);const X=B.useMemo(()=>({reference:W,floating:ne,setReference:M,setFloating:O}),[M,O]),N=B.useMemo(()=>({reference:G,floating:V}),[G,V]),P=B.useMemo(()=>{const K={position:n,left:0,top:0};if(!N.floating)return K;const J=tS(N.floating,y.x),E=tS(N.floating,y.y);return d?{...K,transform:"translate("+J+"px, "+E+"px)",...Mw(N.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:J,top:E}},[n,d,N.floating,y.x,y.y]);return B.useMemo(()=>({...y,update:Se,refs:X,elements:N,floatingStyles:P}),[y,Se,X,N,P])}const $k=(t,e)=>({...Ok(t),options:[t,e]}),jk=(t,e)=>({..._k(t),options:[t,e]}),Bk=(t,e)=>({...Mk(t),options:[t,e]}),Lk="data-floating-ui-focusable",nS="active",iS="selected",Vk={...j1};let rS=!1,zk=0;const sS=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+zk++;function Uk(){const[t,e]=B.useState(()=>rS?sS():void 0);return ji(()=>{t==null&&e(sS())},[]),B.useEffect(()=>{rS=!0},[]),t}const qk=Vk.useId,Cw=qk||Uk;function Pk(){const t=new Map;return{emit(e,n){var r;(r=t.get(e))==null||r.forEach(o=>o(n))},on(e,n){t.has(e)||t.set(e,new Set),t.get(e).add(n)},off(e,n){var r;(r=t.get(e))==null||r.delete(n)}}}const Kk=B.createContext(null),Ik=B.createContext(null),kw=()=>{var t;return((t=B.useContext(Kk))==null?void 0:t.id)||null},jm=()=>B.useContext(Ik);function wc(t){return"data-floating-ui-"+t}function Hk(t){t.current!==-1&&(clearTimeout(t.current),t.current=-1)}let oS=0;function Ws(t,e){e===void 0&&(e={});const{preventScroll:n=!1,cancelPrevious:r=!0,sync:o=!1}=e;r&&cancelAnimationFrame(oS);const u=()=>t?.focus({preventScroll:n});o?u():oS=requestAnimationFrame(u)}function Fk(t){return t?.ownerDocument||document}const ho={inert:new WeakMap,"aria-hidden":new WeakMap,none:new WeakMap};function aS(t){return t==="inert"?ho.inert:t==="aria-hidden"?ho["aria-hidden"]:ho.none}let Uu=new WeakSet,qu={},Vh=0;const Gk=()=>typeof HTMLElement<"u"&&"inert"in HTMLElement.prototype,Dw=t=>t&&(t.host||Dw(t.parentNode)),Yk=(t,e)=>e.map(n=>{if(t.contains(n))return n;const r=Dw(n);return t.contains(r)?r:null}).filter(n=>n!=null);function Xk(t,e,n,r){const o="data-floating-ui-inert",u=r?"inert":n?"aria-hidden":null,c=Yk(e,t),d=new Set,h=new Set(c),m=[];qu[o]||(qu[o]=new WeakMap);const y=qu[o];c.forEach(g),b(e),d.clear();function g(x){!x||d.has(x)||(d.add(x),x.parentNode&&g(x.parentNode))}function b(x){!x||h.has(x)||[].forEach.call(x.children,A=>{if(Mr(A)!=="script")if(d.has(A))b(A);else{const w=u?A.getAttribute(u):null,k=w!==null&&w!=="false",$=aS(u),M=($.get(A)||0)+1,O=(y.get(A)||0)+1;$.set(A,M),y.set(A,O),m.push(A),M===1&&k&&Uu.add(A),O===1&&A.setAttribute(o,""),!k&&u&&A.setAttribute(u,u==="inert"?"":"true")}})}return Vh++,()=>{m.forEach(x=>{const A=aS(u),k=(A.get(x)||0)-1,$=(y.get(x)||0)-1;A.set(x,k),y.set(x,$),k||(!Uu.has(x)&&u&&x.removeAttribute(u),Uu.delete(x)),$||x.removeAttribute(o)}),Vh--,Vh||(ho.inert=new WeakMap,ho["aria-hidden"]=new WeakMap,ho.none=new WeakMap,Uu=new WeakSet,qu={})}}function lS(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!1);const r=Fk(t[0]).body;return Xk(t.concat(Array.from(r.querySelectorAll("[aria-live]"))),r,e,n)}const Bm={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},uS=B.forwardRef(function(e,n){const[r,o]=B.useState();ji(()=>{HC()&&o("button")},[]);const u={ref:n,tabIndex:0,role:r,"aria-hidden":r?void 0:!0,[wc("focus-guard")]:"",style:Bm};return F.jsx("span",{...e,...u})}),Zk=B.createContext(null),Jk=()=>B.useContext(Zk);function cS(t){return B.useMemo(()=>e=>{t.forEach(n=>{n&&(n.current=e)})},t)}const Qk=20;let Zr=[];function Wk(t){Zr=Zr.filter(e=>e.isConnected),t&&Mr(t)!=="body"&&(Zr.push(t),Zr.length>Qk&&(Zr=Zr.slice(-20)))}function fS(){return Zr.slice().reverse().find(t=>t.isConnected)}function eD(t){const e=Zc();return vw(t,e)?t:Dm(t,e)[0]||t}function dS(t,e){var n;if(!e.current.includes("floating")&&!((n=t.getAttribute("role"))!=null&&n.includes("dialog")))return;const r=Zc(),u=KC(t,r).filter(d=>{const h=d.getAttribute("data-tabindex")||"";return vw(d,r)||d.hasAttribute("data-tabindex")&&!h.startsWith("-")}),c=t.getAttribute("tabindex");e.current.includes("floating")||u.length===0?c!=="0"&&t.setAttribute("tabindex","0"):(c!=="-1"||t.hasAttribute("data-tabindex")&&t.getAttribute("data-tabindex")!=="-1")&&(t.setAttribute("tabindex","-1"),t.setAttribute("data-tabindex","-1"))}const tD=B.forwardRef(function(e,n){return F.jsx("button",{...e,type:"button",ref:n,tabIndex:-1,style:Bm})});function nD(t){const{context:e,children:n,disabled:r=!1,order:o=["content"],guards:u=!0,initialFocus:c=0,returnFocus:d=!0,restoreFocus:h=!1,modal:m=!0,visuallyHiddenDismiss:y=!1,closeOnFocusOut:g=!0,outsideElementsInert:b=!1,getInsideElements:x=()=>[]}=t,{open:A,onOpenChange:w,events:k,dataRef:$,elements:{domReference:M,floating:O}}=e,G=ii(()=>{var ye;return(ye=$.current.floatingContext)==null?void 0:ye.nodeId}),V=ii(x),W=typeof c=="number"&&c<0,ne=Y0(M)&&W,ee=Gk(),ce=ee?u:!0,me=!ce||ee&&b,be=jh(o),Me=jh(c),Se=jh(d),he=jm(),X=Jk(),N=B.useRef(null),P=B.useRef(null),K=B.useRef(!1),J=B.useRef(!1),E=B.useRef(-1),U=X!=null,H=Rp(O),Z=ii(function(ye){return ye===void 0&&(ye=H),ye?Dm(ye,Zc()):[]}),re=ii(ye=>{const Ce=Z(ye);return be.current.map(xe=>M&&xe==="reference"?M:H&&xe==="floating"?H:Ce).filter(Boolean).flat()});B.useEffect(()=>{if(r||!m)return;function ye(xe){if(xe.key==="Tab"){bn(H,io(Gn(H)))&&Z().length===0&&!ne&&$h(xe);const we=re(),At=Sr(xe);be.current[0]==="reference"&&At===M&&($h(xe),xe.shiftKey?Ws(we[we.length-1]):Ws(we[1])),be.current[1]==="floating"&&At===H&&xe.shiftKey&&($h(xe),Ws(we[0]))}}const Ce=Gn(H);return Ce.addEventListener("keydown",ye),()=>{Ce.removeEventListener("keydown",ye)}},[r,M,H,m,be,ne,Z,re]),B.useEffect(()=>{if(r||!O)return;function ye(Ce){const xe=Sr(Ce),At=Z().indexOf(xe);At!==-1&&(E.current=At)}return O.addEventListener("focusin",ye),()=>{O.removeEventListener("focusin",ye)}},[r,O,Z]),B.useEffect(()=>{if(r||!g)return;function ye(){J.current=!0,setTimeout(()=>{J.current=!1})}function Ce(xe){const we=xe.relatedTarget,At=xe.currentTarget,Tt=Sr(xe);queueMicrotask(()=>{const ut=G(),Un=!(bn(M,we)||bn(O,we)||bn(we,O)||bn(X?.portalNode,we)||we!=null&&we.hasAttribute(wc("focus-guard"))||he&&(Ia(he.nodesRef.current,ut).find(Xe=>{var Je,un;return bn((Je=Xe.context)==null?void 0:Je.elements.floating,we)||bn((un=Xe.context)==null?void 0:un.elements.domReference,we)})||X0(he.nodesRef.current,ut).find(Xe=>{var Je,un,Tl;return[(Je=Xe.context)==null?void 0:Je.elements.floating,Rp((un=Xe.context)==null?void 0:un.elements.floating)].includes(we)||((Tl=Xe.context)==null?void 0:Tl.elements.domReference)===we})));if(At===M&&H&&dS(H,be),h&&At!==M&&!(Tt!=null&&Tt.isConnected)&&io(Gn(H))===Gn(H).body){Mt(H)&&H.focus();const Xe=E.current,Je=Z(),un=Je[Xe]||Je[Je.length-1]||H;Mt(un)&&un.focus()}if($.current.insideReactTree){$.current.insideReactTree=!1;return}(ne||!m)&&we&&Un&&!J.current&&we!==fS()&&(K.current=!0,w(!1,xe,"focus-out"))})}if(O&&Mt(M))return M.addEventListener("focusout",Ce),M.addEventListener("pointerdown",ye),O.addEventListener("focusout",Ce),()=>{M.removeEventListener("focusout",Ce),M.removeEventListener("pointerdown",ye),O.removeEventListener("focusout",Ce)}},[r,M,O,H,m,he,X,w,g,h,Z,ne,G,be,$]);const Te=B.useRef(null),ie=B.useRef(null),Ye=cS([Te,X?.beforeInsideRef]),Ne=cS([ie,X?.afterInsideRef]);B.useEffect(()=>{var ye,Ce;if(r||!O)return;const xe=Array.from((X==null||(ye=X.portalNode)==null?void 0:ye.querySelectorAll("["+wc("portal")+"]"))||[]),we=he?X0(he.nodesRef.current,G()):[],At=he&&!m?we.map(Xe=>{var Je;return(Je=Xe.context)==null?void 0:Je.elements.floating}):[],Tt=(Ce=we.find(Xe=>{var Je;return Y0(((Je=Xe.context)==null?void 0:Je.elements.domReference)||null)}))==null||(Ce=Ce.context)==null?void 0:Ce.elements.domReference,ut=[O,Tt,...xe,...At,...V(),N.current,P.current,Te.current,ie.current,X?.beforeOutsideRef.current,X?.afterOutsideRef.current,be.current.includes("reference")||ne?M:null].filter(Xe=>Xe!=null),Un=m||ne?lS(ut,!me,me):lS(ut);return()=>{Un()}},[r,M,O,m,be,X,ne,ce,me,he,G,V]),ji(()=>{if(r||!Mt(H))return;const ye=Gn(H),Ce=io(ye);queueMicrotask(()=>{const xe=re(H),we=Me.current,At=(typeof we=="number"?xe[we]:we.current)||H,Tt=bn(H,Ce);!W&&!Tt&&A&&Ws(At,{preventScroll:At===H})})},[r,A,H,W,re,Me]),ji(()=>{if(r||!H)return;const ye=Gn(H),Ce=io(ye);Wk(Ce);function xe(Tt){let{reason:ut,event:Un,nested:Xe}=Tt;if(["hover","safe-polygon"].includes(ut)&&Un.type==="mouseleave"&&(K.current=!0),ut==="outside-press")if(Xe)K.current=!1;else if(ZC(Un)||JC(Un))K.current=!1;else{let Je=!1;document.createElement("div").focus({get preventScroll(){return Je=!0,!1}}),Je?K.current=!1:K.current=!0}}k.on("openchange",xe);const we=ye.createElement("span");we.setAttribute("tabindex","-1"),we.setAttribute("aria-hidden","true"),Object.assign(we.style,Bm),U&&M&&M.insertAdjacentElement("afterend",we);function At(){if(typeof Se.current=="boolean"){const Tt=M||fS();return Tt&&Tt.isConnected?Tt:we}return Se.current.current||we}return()=>{k.off("openchange",xe);const Tt=io(ye),ut=bn(O,Tt)||he&&Ia(he.nodesRef.current,G()).some(Xe=>{var Je;return bn((Je=Xe.context)==null?void 0:Je.elements.floating,Tt)}),Un=At();queueMicrotask(()=>{const Xe=eD(Un);Se.current&&!K.current&&Mt(Xe)&&(!(Xe!==Tt&&Tt!==ye.body)||ut)&&Xe.focus({preventScroll:!0}),we.remove()})}},[r,O,H,Se,$,k,he,U,M,G]),B.useEffect(()=>{queueMicrotask(()=>{K.current=!1})},[r]),ji(()=>{if(!r&&X)return X.setFocusManagerState({modal:m,closeOnFocusOut:g,open:A,onOpenChange:w,domReference:M}),()=>{X.setFocusManagerState(null)}},[r,X,m,A,w,g,M]),ji(()=>{r||H&&dS(H,be)},[r,H,be]);function ln(ye){return r||!y||!m?null:F.jsx(tD,{ref:ye==="start"?N:P,onClick:Ce=>w(!1,Ce.nativeEvent),children:typeof y=="string"?y:"Dismiss"})}const Gi=!r&&ce&&(m?!ne:!0)&&(U||m);return F.jsxs(F.Fragment,{children:[Gi&&F.jsx(uS,{"data-type":"inside",ref:Ye,onFocus:ye=>{if(m){const xe=re();Ws(o[0]==="reference"?xe[0]:xe[xe.length-1])}else if(X!=null&&X.preserveTabOrder&&X.portalNode)if(K.current=!1,J0(ye,X.portalNode)){const xe=ik(M);xe?.focus()}else{var Ce;(Ce=X.beforeOutsideRef.current)==null||Ce.focus()}}}),!ne&&ln("start"),n,ln("end"),Gi&&F.jsx(uS,{"data-type":"inside",ref:Ne,onFocus:ye=>{if(m)Ws(re()[0]);else if(X!=null&&X.preserveTabOrder&&X.portalNode)if(g&&(K.current=!0),J0(ye,X.portalNode)){const xe=rk(M);xe?.focus()}else{var Ce;(Ce=X.afterOutsideRef.current)==null||Ce.focus()}}})]})}function hS(t){return Mt(t.target)&&t.target.tagName==="BUTTON"}function iD(t){return Mt(t.target)&&t.target.tagName==="A"}function pS(t){return Sw(t)}function rD(t,e){e===void 0&&(e={});const{open:n,onOpenChange:r,dataRef:o,elements:{domReference:u}}=t,{enabled:c=!0,event:d="click",toggle:h=!0,ignoreMouse:m=!1,keyboardHandlers:y=!0,stickIfOpen:g=!0}=e,b=B.useRef(),x=B.useRef(!1),A=B.useMemo(()=>({onPointerDown(w){b.current=w.pointerType},onMouseDown(w){const k=b.current;w.button===0&&d!=="click"&&(Z0(k)&&m||(n&&h&&(!(o.current.openEvent&&g)||o.current.openEvent.type==="mousedown")?r(!1,w.nativeEvent,"click"):(w.preventDefault(),r(!0,w.nativeEvent,"click"))))},onClick(w){const k=b.current;if(d==="mousedown"&&b.current){b.current=void 0;return}Z0(k)&&m||(n&&h&&(!(o.current.openEvent&&g)||o.current.openEvent.type==="click")?r(!1,w.nativeEvent,"click"):r(!0,w.nativeEvent,"click"))},onKeyDown(w){b.current=void 0,!(w.defaultPrevented||!y||hS(w))&&(w.key===" "&&!pS(u)&&(w.preventDefault(),x.current=!0),!iD(w)&&w.key==="Enter"&&r(!(n&&h),w.nativeEvent,"click"))},onKeyUp(w){w.defaultPrevented||!y||hS(w)||pS(u)||w.key===" "&&x.current&&(x.current=!1,r(!(n&&h),w.nativeEvent,"click"))}}),[o,u,d,m,y,r,n,g,h]);return B.useMemo(()=>c?{reference:A}:{},[c,A])}const sD={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},oD={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},mS=t=>{var e,n;return{escapeKey:typeof t=="boolean"?t:(e=t?.escapeKey)!=null?e:!1,outsidePress:typeof t=="boolean"?t:(n=t?.outsidePress)!=null?n:!0}};function aD(t,e){e===void 0&&(e={});const{open:n,onOpenChange:r,elements:o,dataRef:u}=t,{enabled:c=!0,escapeKey:d=!0,outsidePress:h=!0,outsidePressEvent:m="pointerdown",referencePress:y=!1,referencePressEvent:g="pointerdown",ancestorScroll:b=!1,bubbles:x,capture:A}=e,w=jm(),k=ii(typeof h=="function"?h:()=>!1),$=typeof h=="function"?k:h,M=B.useRef(!1),{escapeKey:O,outsidePress:G}=mS(x),{escapeKey:V,outsidePress:W}=mS(A),ne=B.useRef(!1),ee=B.useRef(-1),ce=ii(X=>{var N;if(!n||!c||!d||X.key!=="Escape"||ne.current)return;const P=(N=u.current.floatingContext)==null?void 0:N.nodeId,K=w?Ia(w.nodesRef.current,P):[];if(!O&&(X.stopPropagation(),K.length>0)){let J=!0;if(K.forEach(E=>{var U;if((U=E.context)!=null&&U.open&&!E.context.dataRef.current.__escapeKeyBubbles){J=!1;return}}),!J)return}r(!1,XC(X)?X.nativeEvent:X,"escape-key")}),me=ii(X=>{var N;const P=()=>{var K;ce(X),(K=Sr(X))==null||K.removeEventListener("keydown",P)};(N=Sr(X))==null||N.addEventListener("keydown",P)}),be=ii(X=>{var N;const P=u.current.insideReactTree;u.current.insideReactTree=!1;const K=M.current;if(M.current=!1,m==="click"&&K||P||typeof $=="function"&&!$(X))return;const J=Sr(X),E="["+wc("inert")+"]",U=Gn(o.floating).querySelectorAll(E);let H=ht(J)?J:null;for(;H&&!Bi(H);){const ie=zi(H);if(Bi(ie)||!ht(ie))break;H=ie}if(U.length&&ht(J)&&!YC(J)&&!bn(J,o.floating)&&Array.from(U).every(ie=>!bn(H,ie)))return;if(Mt(J)&&he){const ie=Bi(J),Ye=zn(J),Ne=/auto|scroll/,ln=ie||Ne.test(Ye.overflowX),Gi=ie||Ne.test(Ye.overflowY),ye=ln&&J.clientWidth>0&&J.scrollWidth>J.clientWidth,Ce=Gi&&J.clientHeight>0&&J.scrollHeight>J.clientHeight,xe=Ye.direction==="rtl",we=Ce&&(xe?X.offsetX<=J.offsetWidth-J.clientWidth:X.offsetX>J.clientWidth),At=ye&&X.offsetY>J.clientHeight;if(we||At)return}const Z=(N=u.current.floatingContext)==null?void 0:N.nodeId,re=w&&Ia(w.nodesRef.current,Z).some(ie=>{var Ye;return Nh(X,(Ye=ie.context)==null?void 0:Ye.elements.floating)});if(Nh(X,o.floating)||Nh(X,o.domReference)||re)return;const Te=w?Ia(w.nodesRef.current,Z):[];if(Te.length>0){let ie=!0;if(Te.forEach(Ye=>{var Ne;if((Ne=Ye.context)!=null&&Ne.open&&!Ye.context.dataRef.current.__outsidePressBubbles){ie=!1;return}}),!ie)return}r(!1,X,"outside-press")}),Me=ii(X=>{var N;const P=()=>{var K;be(X),(K=Sr(X))==null||K.removeEventListener(m,P)};(N=Sr(X))==null||N.addEventListener(m,P)});B.useEffect(()=>{if(!n||!c)return;u.current.__escapeKeyBubbles=O,u.current.__outsidePressBubbles=G;let X=-1;function N(U){r(!1,U,"ancestor-scroll")}function P(){window.clearTimeout(X),ne.current=!0}function K(){X=window.setTimeout(()=>{ne.current=!1},Fc()?5:0)}const J=Gn(o.floating);d&&(J.addEventListener("keydown",V?me:ce,V),J.addEventListener("compositionstart",P),J.addEventListener("compositionend",K)),$&&J.addEventListener(m,W?Me:be,W);let E=[];return b&&(ht(o.domReference)&&(E=Tr(o.domReference)),ht(o.floating)&&(E=E.concat(Tr(o.floating))),!ht(o.reference)&&o.reference&&o.reference.contextElement&&(E=E.concat(Tr(o.reference.contextElement)))),E=E.filter(U=>{var H;return U!==((H=J.defaultView)==null?void 0:H.visualViewport)}),E.forEach(U=>{U.addEventListener("scroll",N,{passive:!0})}),()=>{d&&(J.removeEventListener("keydown",V?me:ce,V),J.removeEventListener("compositionstart",P),J.removeEventListener("compositionend",K)),$&&J.removeEventListener(m,W?Me:be,W),E.forEach(U=>{U.removeEventListener("scroll",N)}),window.clearTimeout(X)}},[u,o,d,$,m,n,r,b,c,O,G,ce,V,me,be,W,Me]),B.useEffect(()=>{u.current.insideReactTree=!1},[u,$,m]);const Se=B.useMemo(()=>({onKeyDown:ce,...y&&{[sD[g]]:X=>{r(!1,X.nativeEvent,"reference-press")},...g!=="click"&&{onClick(X){r(!1,X.nativeEvent,"reference-press")}}}}),[ce,r,y,g]),he=B.useMemo(()=>({onKeyDown:ce,onMouseDown(){M.current=!0},onMouseUp(){M.current=!0},[oD[m]]:()=>{u.current.insideReactTree=!0},onBlurCapture(){w||(Hk(ee),u.current.insideReactTree=!0,ee.current=window.setTimeout(()=>{u.current.insideReactTree=!1}))}}),[ce,m,u,w]);return B.useMemo(()=>c?{reference:Se,floating:he}:{},[c,Se,he])}function lD(t){const{open:e=!1,onOpenChange:n,elements:r}=t,o=Cw(),u=B.useRef({}),[c]=B.useState(()=>Pk()),d=kw()!=null,[h,m]=B.useState(r.reference),y=ii((x,A,w)=>{u.current.openEvent=x?A:void 0,c.emit("openchange",{open:x,event:A,reason:w,nested:d}),n?.(x,A,w)}),g=B.useMemo(()=>({setPositionReference:m}),[]),b=B.useMemo(()=>({reference:h||r.reference||null,floating:r.floating||null,domReference:r.reference}),[h,r.reference,r.floating]);return B.useMemo(()=>({dataRef:u,open:e,onOpenChange:y,elements:b,events:c,floatingId:o,refs:g}),[e,y,b,c,o,g])}function uD(t){t===void 0&&(t={});const{nodeId:e}=t,n=lD({...t,elements:{reference:null,floating:null,...t.elements}}),r=t.rootContext||n,o=r.elements,[u,c]=B.useState(null),[d,h]=B.useState(null),y=o?.domReference||u,g=B.useRef(null),b=jm();ji(()=>{y&&(g.current=y)},[y]);const x=Nk({...t,elements:{...o,...d&&{reference:d}}}),A=B.useCallback(O=>{const G=ht(O)?{getBoundingClientRect:()=>O.getBoundingClientRect(),getClientRects:()=>O.getClientRects(),contextElement:O}:O;h(G),x.refs.setReference(G)},[x.refs]),w=B.useCallback(O=>{(ht(O)||O===null)&&(g.current=O,c(O)),(ht(x.refs.reference.current)||x.refs.reference.current===null||O!==null&&!ht(O))&&x.refs.setReference(O)},[x.refs]),k=B.useMemo(()=>({...x.refs,setReference:w,setPositionReference:A,domReference:g}),[x.refs,w,A]),$=B.useMemo(()=>({...x.elements,domReference:y}),[x.elements,y]),M=B.useMemo(()=>({...x,...r,refs:k,elements:$,nodeId:e}),[x,k,$,e,r]);return ji(()=>{r.dataRef.current.floatingContext=M;const O=b?.nodesRef.current.find(G=>G.id===e);O&&(O.context=M)}),B.useMemo(()=>({...x,context:M,refs:k,elements:$}),[x,k,$,M])}function zh(t,e,n){const r=new Map,o=n==="item";let u=t;if(o&&t){const{[nS]:c,[iS]:d,...h}=t;u=h}return{...n==="floating"&&{tabIndex:-1,[Lk]:""},...u,...e.map(c=>{const d=c?c[n]:null;return typeof d=="function"?t?d(t):null:d}).concat(t).reduce((c,d)=>(d&&Object.entries(d).forEach(h=>{let[m,y]=h;if(!(o&&[nS,iS].includes(m)))if(m.indexOf("on")===0){if(r.has(m)||r.set(m,[]),typeof y=="function"){var g;(g=r.get(m))==null||g.push(y),c[m]=function(){for(var b,x=arguments.length,A=new Array(x),w=0;w<x;w++)A[w]=arguments[w];return(b=r.get(m))==null?void 0:b.map(k=>k(...A)).find(k=>k!==void 0)}}}else c[m]=y}),c),{})}}function cD(t){t===void 0&&(t=[]);const e=t.map(d=>d?.reference),n=t.map(d=>d?.floating),r=t.map(d=>d?.item),o=B.useCallback(d=>zh(d,t,"reference"),e),u=B.useCallback(d=>zh(d,t,"floating"),n),c=B.useCallback(d=>zh(d,t,"item"),r);return B.useMemo(()=>({getReferenceProps:o,getFloatingProps:u,getItemProps:c}),[o,u,c])}const fD=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function dD(t,e){var n,r;e===void 0&&(e={});const{open:o,elements:u,floatingId:c}=t,{enabled:d=!0,role:h="dialog"}=e,m=Cw(),y=((n=u.domReference)==null?void 0:n.id)||m,g=B.useMemo(()=>{var M;return((M=Rp(u.floating))==null?void 0:M.id)||c},[u.floating,c]),b=(r=fD.get(h))!=null?r:h,A=kw()!=null,w=B.useMemo(()=>b==="tooltip"||h==="label"?{["aria-"+(h==="label"?"labelledby":"describedby")]:o?g:void 0}:{"aria-expanded":o?"true":"false","aria-haspopup":b==="alertdialog"?"dialog":b,"aria-controls":o?g:void 0,...b==="listbox"&&{role:"combobox"},...b==="menu"&&{id:y},...b==="menu"&&A&&{role:"menuitem"},...h==="select"&&{"aria-autocomplete":"none"},...h==="combobox"&&{"aria-autocomplete":"list"}},[b,g,A,o,y,h]),k=B.useMemo(()=>{const M={id:g,...b&&{role:b}};return b==="tooltip"||h==="label"?M:{...M,...b==="menu"&&{"aria-labelledby":y}}},[b,g,y,h]),$=B.useCallback(M=>{let{active:O,selected:G}=M;const V={role:"option",...O&&{id:g+"-fui-option"}};switch(h){case"select":return{...V,"aria-selected":O&&G};case"combobox":return{...V,"aria-selected":G}}return{}},[g,h]);return B.useMemo(()=>d?{reference:w,floating:k,item:$}:{},[d,w,k,$])}const ul=t=>Array.isArray(t)?t:[t],hD=(t,e)=>{const n=[[],[]];for(const r of t)e(r)?n[0].push(r):n[1].push(r);return n},Nw=Array,Jr=(t,e)=>t.includes(e),pD=(t,e=0)=>[...new Array(t)].map((n,r)=>r+e),Ie=(t,e,n)=>t===void 0?e===void 0?[]:Array.isArray(e)?e:[e]:(Array.isArray(e)?t.push(...e):t.push(e),t),es=(t,e)=>e==null?t??[]:t==null?ul(e):t.concat(e),mD=(...t)=>t.reduce(es,[]),rs=(t,e,n)=>{if(t===void 0)return Array.isArray(e)?e:[e];const r=n?.isEqual??((o,u)=>o===u);for(const o of ul(e))t.some(u=>r(u,o))||t.push(o);return t},yD=(t,e)=>t.reduce((n,r)=>{const o=r[e];return n[o]=Ie(n[o],r),n},{}),xo=(t,e,n)=>t.length===e.length&&t.every(n?.isEqual?(r,o)=>n.isEqual(r,e[o]):(r,o)=>r===e[o]),fs=(t,e)=>Yn(t)===e,Yn=t=>{const e=typeof t;return e==="object"?t===null?"null":"object":e==="function"?"object":e},Ui={boolean:"boolean",null:"null",undefined:"undefined",bigint:"a bigint",number:"a number",object:"an object",string:"a string",symbol:"a symbol"},gD={...Ui,function:"a function"};class vD extends Error{}const wt=t=>wo(t,vD),wo=(t,e=Error)=>{throw new e(t)};class bD extends Error{name="ParseError"}const Y=t=>wo(t,bD),$w=t=>` ${t}`,He=(t,e)=>{const n={},r=Array.isArray(t);let o=!1;for(const[u,c]of Object.entries(t).entries()){const d=r?e(u,c[1]):e(...c,u);o||=typeof d[0]=="number";const h=Array.isArray(d[0])||d.length===0?d:[d];for(const[m,y]of h)typeof m=="object"?n[m.group]=Ie(n[m.group],y):n[m]=y}return o?Object.values(n):n},jw=Object.entries,mi=(t,e)=>t in e,Lm=(t,e)=>e in t;class SD{constructor(e){Object.assign(this,e)}}const xD=class{};class Bw extends xD{}const wD=(t,e)=>{const n={},r={};let o;for(o in t)o in e?n[o]=t[o]:r[o]=t[o];return[n,r]},AD=(t,e)=>wD(t,e)[1],cl=t=>Object.keys(t).length===0,Ac=t=>[...Object.entries(t),...Object.getOwnPropertySymbols(t).map(e=>[e,t[e]])],TD=(t,e)=>Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)),ED=t=>{const e=Object.keys(t).sort(),n={};for(let r=0;r<e.length;r++)n[e[r]]=t[e[r]];return n},$i=$w("represents an uninitialized value"),RD=t=>Object.values(t).filter(e=>typeof e=="number"?!0:typeof t[e]!="number"),Lw={Array,Boolean,Date,Error,Function,Map,Number,Promise,RegExp,Set,String,WeakMap,WeakSet},Vw=globalThis.File??Blob,zw={ArrayBuffer,Blob,File:Vw,FormData,Headers,Request,Response,URL},OD={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array},Ao={...Lw,...zw,...OD,String,Number,Boolean},Vm=t=>{let e=Object.getPrototypeOf(t);for(;e?.constructor&&(!mi(e.constructor.name,Ao)||!(t instanceof Ao[e.constructor.name]));)e=Object.getPrototypeOf(e);const n=e?.constructor?.name;if(!(n===void 0||n==="Object"))return n},Op=t=>typeof t=="object"&&t!==null?Vm(t)??"object":Yn(t),Gt=Array.isArray,_D={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"},MD={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"},CD={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"},kD={..._D,...MD,...CD},zm=t=>{const e=Object(t).name??null;return e&&mi(e,Ao)&&Ao[e]===t?e:null},yS=(t,e)=>{let n=t.prototype;for(;n!==null;){if(n===e.prototype)return!0;n=Object.getPrototypeOf(n)}return!1},DD=t=>Uw(t,new Map),Uw=(t,e)=>{if(typeof t!="object"||t===null)return t;if(e?.has(t))return e.get(t);const n=zm(t.constructor);if(n==="Date")return new Date(t.getTime());if(n&&n!=="Array")return t;const r=Array.isArray(t)?t.slice():Object.create(Object.getPrototypeOf(t)),o=Object.getOwnPropertyDescriptors(t);if(e){e.set(t,r);for(const u in o){const c=o[u];"get"in c||"set"in c||(c.value=Uw(c.value,e))}}return Object.defineProperties(r,o),r},ND=t=>{let e=$i;return()=>e===$i?e=t():e},Jc=t=>typeof t=="function"&&t.length===0,$D=class extends Function{constructor(...t){const e=t.slice(0,-1),n=t.at(-1);try{super(...e,n)}catch(r){return wt(`Encountered an unexpected error while compiling your definition:
|
|
66
|
-
Message: ${r}
|
|
67
|
-
Source: (${t.slice(0,-1)}) => {
|
|
68
|
-
${t.at(-1)}
|
|
69
|
-
}`)}}};class Do{constructor(e,...[n]){return Object.assign(Object.setPrototypeOf(e.bind(n?.bind??this),this.constructor.prototype),n?.attach)}}const jD=ND(()=>{try{return new Function("return false")()}catch{return!0}});class yi{constructor(){}}const BD=()=>{try{return((new Error().stack?.split(`
|
|
70
|
-
`)[2]?.trim()||"").match(/\(?(.+?)(?::\d+:\d+)?\)?$/)?.[1]||"unknown").replace(/^file:\/\//,"")}catch{return"unknown"}},LD=globalThis.process?.env??{},VD={fileName:BD,env:LD},zD=t=>t[0].toUpperCase()+t.slice(1),qw=t=>new RegExp(UD(t),typeof t=="string"?"":t.flags),UD=t=>`^(?:${typeof t=="string"?t:t.source})$`,xr={negativeLookahead:t=>`(?!${t})`,nonCapturingGroup:t=>`(?:${t})`},_p="\\",Qc={" ":1,"\n":1," ":1},qD=/^-0\.?0*$/.source,Pw=/[1-9]\d*/.source,PD=/\.\d+/.source,KD=/\.\d*[1-9]/.source,Kw=t=>qw(xr.negativeLookahead(qD)+xr.nonCapturingGroup("-?"+xr.nonCapturingGroup(xr.nonCapturingGroup("0|"+Pw)+xr.nonCapturingGroup(t.decimalPattern)+"?")+(t.allowDecimalOnly?"|"+t.decimalPattern:"")+"?")),gS=Kw({decimalPattern:KD,allowDecimalOnly:!1}),ID=gS.test.bind(gS),Mp=Kw({decimalPattern:PD,allowDecimalOnly:!0});Mp.test.bind(Mp);const HD=/^-?\d*\.?\d*$/,FD=t=>t.length!==0&&HD.test(t),Tc=qw(xr.negativeLookahead("^-0$")+"-?"+xr.nonCapturingGroup(xr.nonCapturingGroup("0|"+Pw))),GD=Tc.test.bind(Tc),Cp=/^-?\d+$/,YD=Cp.test.bind(Cp),Iw={number:"a number",bigint:"a bigint",integer:"an integer"},Hw=(t,e)=>`'${t}' was parsed as ${Iw[e]} but could not be narrowed to a literal value. Avoid unnecessary leading or trailing zeros and other abnormal notation`,XD=(t,e)=>e==="number"?ID(t):GD(t),ZD=(t,e)=>e==="number"?Number(t):Number.parseInt(t),JD=(t,e)=>e==="number"?FD(t):YD(t),QD=(t,e)=>Um(t,"number",e),WD=(t,e)=>Um(t,"number",{...e,strict:!0}),e2=(t,e)=>Um(t,"integer",e),Um=(t,e,n)=>{const r=ZD(t,e);return!Number.isNaN(r)&&JD(t,e)?n?.strict?XD(t,e)?r:Y(Hw(t,e)):r:n?.errorOnFail?Y(n?.errorOnFail===!0?`Failed to parse ${Iw[e]} from '${t}'`:n?.errorOnFail):void 0},t2=t=>{if(t[t.length-1]!=="n")return;const e=t.slice(0,-1);let n;try{n=BigInt(e)}catch{return}if(Tc.test(e))return n;if(Cp.test(e))return Y(Hw(t,"bigint"))},n2="0.46.0",i2={version:n2,filename:VD.fileName(),FileConstructor:Vw},fl=i2,vS=new Map,Uh=Object.create(null),kp=t=>{const e=vS.get(t);if(e)return e;let n=r2(t);return Uh[n]?n=`${n}${Uh[n]++}`:Uh[n]=1,fl[n]=t,vS.set(t,n),n},Qa=t=>/^[$A-Z_a-z][\w$]*$/.test(t),r2=t=>{switch(typeof t){case"object":{if(t===null)break;const e=Vm(t)??"object";return e[0].toLowerCase()+e.slice(1)}case"function":return Qa(t.name)?t.name:"fn";case"symbol":return t.description&&Qa(t.description)?t.description:"symbol"}return wt(`Unexpected attempt to register serializable value of type ${Yn(t)}`)},qm=t=>typeof t=="string"?JSON.stringify(t):typeof t=="bigint"?`${t}n`:`${t}`,s2=(t,e={})=>Ha(t,{onUndefined:"$ark.undefined",onBigInt:n=>`$ark.bigint-${n}`,...e},[]),Pe=(t,e)=>{switch(Yn(t)){case"object":const n=t,r=n.constructor.name;return r==="Object"||r==="Array"?e?.quoteKeys===!1?Ec(n,e?.indent??0,""):JSON.stringify(Ha(n,To,[]),null,e?.indent):Ec(n,e?.indent??0,"");case"symbol":return To.onSymbol(t);default:return qm(t)}},Ec=(t,e,n)=>{if(typeof t=="function")return To.onFunction(t);if(typeof t!="object"||t===null)return qm(t);const r=n+" ".repeat(e);if(Array.isArray(t)){if(t.length===0)return"[]";const u=t.map(c=>Ec(c,e,r)).join(`,
|
|
71
|
-
`+r);return e?`[
|
|
72
|
-
${r}${u}
|
|
73
|
-
${n}]`:`[${u}]`}const o=t.constructor.name;if(o==="Object"){const u=Ac(t).map(([c,d])=>{const h=typeof c=="symbol"?To.onSymbol(c):Qa(c)?c:JSON.stringify(c),m=Ec(d,e,r);return`${r}${h}: ${m}`});return u.length===0?"{}":e?`{
|
|
74
|
-
${u.join(`,
|
|
75
|
-
`)}
|
|
76
|
-
${n}}`:`{${u.join(", ")}}`}return t instanceof Date?dl(t):"expression"in t&&typeof t.expression=="string"?t.expression:o},To={onCycle:()=>"(cycle)",onSymbol:t=>`Symbol(${kp(t)})`,onFunction:t=>`Function(${kp(t)})`},Ha=(t,e,n)=>{switch(Yn(t)){case"object":{const r=t;if("toJSON"in r&&typeof r.toJSON=="function")return r.toJSON();if(typeof r=="function")return To.onFunction(r);if(n.includes(r))return"(cycle)";const o=[...n,r];if(Array.isArray(r))return r.map(c=>Ha(c,e,o));if(r instanceof Date)return r.toDateString();const u={};for(const c in r)u[c]=Ha(r[c],e,o);for(const c of Object.getOwnPropertySymbols(r))u[e.onSymbol?.(c)??c.toString()]=Ha(r[c],e,o);return u}case"symbol":return To.onSymbol(t);case"bigint":return e.onBigInt?.(t)??`${t}n`;case"undefined":return e.onUndefined??"undefined";case"string":return t.replaceAll("\\","\\\\");default:return t}},dl=t=>{const e=t.getFullYear(),n=t.getMonth(),r=t.getDate(),o=t.getHours(),u=t.getMinutes(),c=t.getSeconds(),d=t.getMilliseconds();if(n===0&&r===1&&o===0&&u===0&&c===0&&d===0)return`${e}`;const h=`${o2[n]} ${r}, ${e}`;if(o===0&&u===0&&c===0&&d===0)return h;let m=t.toLocaleTimeString();const y=m.endsWith(" AM")||m.endsWith(" PM")?m.slice(-3):"";return y&&(m=m.slice(0,-y.length)),d?m+=`.${l2(d,3)}`:a2.test(m)&&(m=m.slice(0,-3)),`${m+y}, ${h}`},o2=["January","February","March","April","May","June","July","August","September","October","November","December"],a2=/:\d\d:00$/,l2=(t,e)=>String(t).padStart(e,"0"),Fw=(t,e,...[n])=>{const r=n?.stringifySymbol??Pe;let o=t;switch(typeof e){case"string":o=Qa(e)?t===""?e:`${t}.${e}`:`${t}[${JSON.stringify(e)}]`;break;case"number":o=`${t}[${e}]`;break;case"symbol":o=`${t}[${r(e)}]`;break;default:n?.stringifyNonKey?o=`${t}[${n.stringifyNonKey(e)}]`:Y(`${Pe(e)} must be a PropertyKey or stringifyNonKey must be passed to options`)}return o},hl=(t,...e)=>t.reduce((n,r)=>Fw(n,r,...e),"");class Gw extends Nw{cache={};constructor(...e){super(),this.push(...e)}toJSON(){if(this.cache.json)return this.cache.json;this.cache.json=[];for(let e=0;e<this.length;e++)this.cache.json.push(typeof this[e]=="symbol"?Pe(this[e]):this[e]);return this.cache.json}stringify(){return this.cache.stringify?this.cache.stringify:this.cache.stringify=hl(this)}stringifyAncestors(){if(this.cache.stringifyAncestors)return this.cache.stringifyAncestors;let e="";const n=[e];for(const r of this)e=Fw(e,r),n.push(e);return this.cache.stringifyAncestors=n}}class u2{chars;i;def;constructor(e){this.def=e,this.chars=[...e],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(e){let n="";for(;this.lookahead;){if(e(this,n))if(n[n.length-1]===_p)n=n.slice(0,-1);else break;n+=this.shift()}return n}shiftUntilLookahead(e){return typeof e=="string"?this.shiftUntil(n=>n.lookahead===e):this.shiftUntil(n=>n.lookahead in e)}shiftUntilNonWhitespace(){return this.shiftUntil(()=>!(this.lookahead in Qc))}jumpToIndex(e){this.i=e<0?this.length+e:e}jumpForward(e){this.i+=e}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(e,n){return this.chars.slice(e,n).join("")}lookaheadIs(e){return this.lookahead===e}lookaheadIsIn(e){return this.lookahead in e}}let Dp="$ark",c2=2;for(;Dp in globalThis;)Dp=`$ark${c2++}`;const Yw=Dp;globalThis[Yw]=fl;const Q=fl,f2=t=>`${Yw}.${t}`,Jt=t=>f2(kp(t));class Xw extends Bw{argNames;body="";constructor(...e){super(),this.argNames=e;for(const n of e){if(n in this)throw new Error(`Arg name '${n}' would overwrite an existing property on FunctionBody`);this[n]=n}}indentation=0;indent(){return this.indentation+=4,this}dedent(){return this.indentation-=4,this}prop(e,n=!1){return Zw(e,n)}index(e,n=!1){return Jw(`${e}`,n)}line(e){return this.body+=`${" ".repeat(this.indentation)}${e}
|
|
77
|
-
`,this}const(e,n){return this.line(`const ${e} = ${n}`),this}let(e,n){return this.line(`let ${e} = ${n}`)}set(e,n){return this.line(`${e} = ${n}`)}if(e,n){return this.block(`if (${e})`,n)}elseIf(e,n){return this.block(`else if (${e})`,n)}else(e){return this.block("else",e)}for(e,n,r=0){return this.block(`for (let i = ${r}; ${e}; i++)`,n)}forIn(e,n){return this.block(`for (const k in ${e})`,n)}block(e,n,r=""){return this.line(`${e} {`),this.indent(),n(this),this.dedent(),this.line(`}${r}`)}return(e=""){return this.line(`return ${e}`)}write(e="anonymous",n=0){return`${e}(${this.argNames.join(", ")}) { ${n?this.body.split(`
|
|
78
|
-
`).map(r=>" ".repeat(n)+`${r}`).join(`
|
|
79
|
-
`):this.body} }`}compile(){return new $D(...this.argNames,this.body)}}const pl=t=>fs(t,"object")||typeof t=="symbol"?Jt(t):qm(t),Zw=(t,e=!1)=>typeof t=="string"&&Qa(t)?`${e?"?":""}.${t}`:Jw(d2(t),e),d2=t=>typeof t=="symbol"?Jt(t):JSON.stringify(t),Jw=(t,e=!1)=>`${e?"?.":""}[${t}]`;class qh extends Xw{traversalKind;optimistic;constructor(e){super("data","ctx"),this.traversalKind=e.kind,this.optimistic=e.optimistic===!0}invoke(e,n){const r=n?.arg??this.data,o=typeof e=="string"?!0:this.requiresContextFor(e),u=typeof e=="string"?e:e.id;return o?`${this.referenceToId(u,n)}(${r}, ${this.ctx})`:`${this.referenceToId(u,n)}(${r})`}referenceToId(e,n){const r=n?.kind??this.traversalKind,o=`this.${e}${r}`;return n?.bind?`${o}.bind(${n?.bind})`:o}requiresContextFor(e){return this.traversalKind==="Apply"||e.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(e,n,r){const o=this.requiresContextFor(r);return o&&this.line(`${this.ctx}.path.push(${e})`),this.check(r,{arg:n}),o&&this.line(`${this.ctx}.path.pop()`),this}check(e,n){return this.traversalKind==="Allows"?this.if(`!${this.invoke(e,n)}`,()=>this.return(!1)):this.line(this.invoke(e,n))}}const Qw=t=>He(t,(e,n)=>[e,Gt(n)?[...n]:n]),qi=$w("arkKind"),ue=(t,e)=>t?.[qi]===e,Xt=t=>ue(t,"root")||ue(t,"constraint"),h2=["unit","proto","domain"],Wc=["required","optional","index","sequence"],Ww=["pattern","divisor","exactLength","max","min","maxLength","minLength","before","after"],Pm=[...Ww,...Wc,"structure","predicate"],ef=["alias","union","morph","unit","intersection","proto","domain"],p2=[...ef,...Pm],eA=He(Pm,(t,e)=>[e,1]),m2=He([...Wc,"undeclared"],(t,e)=>[e,1]),tA=He(p2,(t,e)=>[e,t]),tc=t=>typeof t=="string"&&t in tA,Rc=t=>tA[t],Km=t=>ef.slice(Rc(t)+1);[...Km("union")];[...Km("morph")];const us=t=>typeof t=="string"||typeof t=="boolean"||t===null?t:typeof t=="number"?Number.isNaN(t)?"NaN":t===Number.POSITIVE_INFINITY?"Infinity":t===Number.NEGATIVE_INFINITY?"-Infinity":t:pl(t),tf=t=>{let e="{ ";for(const[n,r]of Object.entries(t))e+=`${n}: ${pl(r)}, `;return e+" }"},lt=t=>{const e=t;return e.hasAssociatedError&&(e.defaults.expected??=n=>"description"in n?n.description:e.defaults.description(n),e.defaults.actual??=n=>Pe(n),e.defaults.problem??=n=>`must be ${n.expected}${n.actual?` (was ${n.actual})`:""}`,e.defaults.message??=n=>{if(n.path.length===0)return n.problem;const r=`${n.propString} ${n.problem}`;return r[0]==="["?`value at ${r}`:r}),e};class y2 extends Error{name="ToJsonSchemaError";code;context;constructor(e,n){super(Pe(n,{quoteKeys:!1,indent:4})),this.code=e,this.context=n}hasCode(e){return this.code===e}}const g2={dialect:"https://json-schema.org/draft/2020-12/schema",useRefs:!1,fallback:{arrayObject:t=>Ot.throw("arrayObject",t),arrayPostfix:t=>Ot.throw("arrayPostfix",t),defaultValue:t=>Ot.throw("defaultValue",t),domain:t=>Ot.throw("domain",t),morph:t=>Ot.throw("morph",t),patternIntersection:t=>Ot.throw("patternIntersection",t),predicate:t=>Ot.throw("predicate",t),proto:t=>Ot.throw("proto",t),symbolKey:t=>Ot.throw("symbolKey",t),unit:t=>Ot.throw("unit",t),date:t=>Ot.throw("date",t)}},Ot={Error:y2,throw:(...t)=>{throw new Ot.Error(...t)},throwInternalOperandError:(t,e)=>wt(`Unexpected JSON Schema input for ${t}: ${Pe(e)}`),defaultConfig:g2};Q.config??={};const Np=(t,e)=>{if(!e)return t;const n={...t};let r;for(r in e){const o={...t.keywords};if(r==="keywords"){for(const u in e[r]){const c=e.keywords[u];c!==void 0&&(o[u]=typeof c=="string"?{description:c}:c)}n.keywords=o}else r==="toJsonSchema"?n[r]=nA(t.toJsonSchema,e.toJsonSchema):tc(r)?n[r]={...t[r],...e[r]}:n[r]=e[r]}return n},nA=(t,e)=>{if(!t)return e??{};if(!e)return t;const n={...t};let r;for(r in e)r==="fallback"?n.fallback=v2(t.fallback,e.fallback):n[r]=e[r];return n},v2=(t,e)=>{t=bS(t),e=bS(e);const n={};let r;for(r in Ot.defaultConfig.fallback)n[r]=e[r]??e.default??t[r]??t.default??Ot.defaultConfig.fallback[r];return n},bS=t=>typeof t=="function"?{default:t}:t??{};class Eo extends Bw{[qi]="error";path;data;nodeConfig;input;ctx;constructor({prefixPath:e,relativePath:n,...r},o){super(),this.input=r,this.ctx=o,TD(this,r);const u=o.data;r.code==="union"&&(r.errors=r.errors.flatMap(d=>{const h=d.hasCode("union")?d.errors:[d];return!e&&!n?h:h.map(m=>m.transform(y=>({...y,path:mD(e,y.path,n)})))})),this.nodeConfig=o.config[this.code];const c=[...r.path??o.path];n&&c.push(...n),e&&c.unshift(...e),this.path=new Gw(...c),this.data="data"in r?r.data:u}transform(e){return new Eo(e({data:this.data,path:this.path,...this.input}),this.ctx)}hasCode(e){return this.code===e}get propString(){return hl(this.path)}get expected(){if(this.input.expected)return this.input.expected;const e=this.meta?.expected??this.nodeConfig.expected;return typeof e=="function"?e(this.input):e}get actual(){if(this.input.actual)return this.input.actual;const e=this.meta?.actual??this.nodeConfig.actual;return typeof e=="function"?e(this.data):e}get problem(){if(this.input.problem)return this.input.problem;const e=this.meta?.problem??this.nodeConfig.problem;return typeof e=="function"?e(this):e}get message(){if(this.input.message)return this.input.message;const e=this.meta?.message??this.nodeConfig.message;return typeof e=="function"?e(this):e}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}}class Rr extends Nw{[qi]="errors";ctx;constructor(e){super(),this.ctx=e}byPath=Object.create(null);get flatByPath(){return He(this.byPath,(e,n)=>[e,n.flat])}get flatProblemsByPath(){return He(this.byPath,(e,n)=>[e,n.flat.map(r=>r.problem)])}byAncestorPath=Object.create(null);count=0;mutable=this;throw(){throw this.toTraversalError()}toTraversalError(){return new b2(this)}add(e){this.includes(e)||this._add(e)}transform(e){const n=new Rr(this.ctx);for(const r of this)n.add(e(r));return n}merge(e){for(const n of e)this.includes(n)||this._add(new Eo({...n,path:[...this.ctx.path,...n.path]},this.ctx))}affectsPath(e){return this.length===0?!1:e.stringifyAncestors().some(n=>n in this.byPath)||e.stringify()in this.byAncestorPath}get summary(){return this.toString()}get issues(){return this}toJSON(){return[...this.map(e=>e.toJSON())]}toString(){return this.join(`
|
|
80
|
-
`)}_add(e){const n=this.byPath[e.propString];if(n){if(n.hasCode("union")&&n.errors.length===0)return;const r=e.hasCode("union")&&e.errors.length===0?e:new Eo({code:"intersection",errors:n.hasCode("intersection")?[...n.errors,e]:[n,e]},this.ctx),o=this.indexOf(n);this.mutable[o===-1?this.length:o]=r,this.byPath[e.propString]=r,this.addAncestorPaths(e)}else this.byPath[e.propString]=e,this.addAncestorPaths(e),this.mutable.push(e);this.count++}addAncestorPaths(e){for(const n of e.path.stringifyAncestors())this.byAncestorPath[n]=Ie(this.byAncestorPath[n],e)}}class b2 extends Error{name="TraversalError";constructor(e){e.length===1?super(e.summary):super(`
|
|
81
|
-
`+e.map(n=>` โข ${S2(n)}`).join(`
|
|
82
|
-
`)),Object.defineProperty(this,"arkErrors",{value:e,enumerable:!1})}}const S2=t=>t.toString().split(`
|
|
83
|
-
`).join(`
|
|
84
|
-
`);class so{path=[];errors=new Rr(this);root;config;queuedMorphs=[];branches=[];seen={};constructor(e,n){this.root=e,this.config=n}get data(){let e=this.root;for(const n of this.path)e=e?.[n];return e}get propString(){return hl(this.path)}reject(e){return this.error(e),!1}mustBe(e){return this.error(e),!1}error(e){const n=typeof e=="object"?e.code?e:{...e,code:"predicate"}:{code:"predicate",expected:e};return this.errorFromContext(n)}hasError(){return this.currentErrorCount!==0}get currentBranch(){return this.branches.at(-1)}queueMorphs(e){const n={path:new Gw(...this.path),morphs:e};this.currentBranch?this.currentBranch.queuedMorphs.push(n):this.queuedMorphs.push(n)}finalize(e){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()?e?e(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(e){return this.errorFromContext(e)}errorFromContext(e){const n=new Eo(e,this);return this.currentBranch?this.currentBranch.error=n:this.errors.add(n),n}applyQueuedMorphs(){for(;this.queuedMorphs.length;){const e=this.queuedMorphs;this.queuedMorphs=[];for(const{path:n,morphs:r}of e)this.errors.affectsPath(n)||this.applyMorphsAtPath(n,r)}}applyMorphsAtPath(e,n){const r=e.at(-1);let o;if(r!==void 0){o=this.root;for(let u=0;u<e.length-1;u++)o=o[e[u]]}this.path=[...e];for(const u of n){const c=Xt(u),d=u(o===void 0?this.root:o[r],this);if(d instanceof Eo){this.errors.add(d);break}if(d instanceof Rr){c||this.errors.merge(d);break}o===void 0?this.root=d:o[r]=d,this.applyQueuedMorphs()}}}const Pi=(t,e,n)=>{if(!n)return e();n.path.push(t);const r=e();return n.path.pop(),r};class iA extends Do{attachments;$;onFail;includesTransform;includesContextualPredicate;isCyclic;allowsRequiresContext;rootApplyStrategy;contextFreeMorph;rootApply;referencesById;shallowReferences;flatRefs;flatMorphs;allows;get shallowMorphs(){return[]}constructor(e,n){super((o,u,c=this.onFail)=>u?(this.traverseApply(o,u),u.hasError()?u.errors:u.data):this.rootApply(o,c),{attach:e}),this.attachments=e,this.$=n,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((o,u)=>T2(o,u.shallowReferences),[this]);const r=this.isStructural();this.flatRefs=[],this.flatMorphs=[];for(let o=0;o<this.children.length;o++){if(this.includesTransform||=this.children[o].includesTransform,this.includesContextualPredicate||=this.children[o].includesContextualPredicate,this.isCyclic||=this.children[o].isCyclic,!r){const u=this.children[o].flatRefs;for(let c=0;c<u.length;c++){const d=u[c];if(!this.flatRefs.some(h=>rA(h,d))){this.flatRefs.push(d);for(const h of d.node.branches)(h.hasKind("morph")||h.hasKind("intersection")&&h.structure?.structuralMorph!==void 0)&&this.flatMorphs.push({path:d.path,propString:d.propString,node:h})}}}Object.assign(this.referencesById,this.children[o].referencesById)}this.flatRefs.sort((o,u)=>o.path.length>u.path.length?1:o.path.length<u.path.length?-1:o.propString>u.propString?1:o.propString<u.propString||o.node.expression<u.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(o=>o.length===1||o.name==="$arkStructuralMorph")?this.hasKind("union")?this.branches.some(o=>o.shallowMorphs.length>1)?"contextual":"branchedOptimistic":this.shallowMorphs.length>1?"contextual":"optimistic":"contextual":"contextual",this.rootApply=this.createRootApply(),this.allows=this.allowsRequiresContext?o=>this.traverseAllows(o,new so(o,this.$.resolvedConfig)):o=>this.traverseAllows(o)}createRootApply(){switch(this.rootApplyStrategy){case"allows":return(n,r)=>{if(this.allows(n))return n;const o=new so(n,this.$.resolvedConfig);return this.traverseApply(n,o),o.finalize(r)};case"contextual":return(n,r)=>{const o=new so(n,this.$.resolvedConfig);return this.traverseApply(n,o),o.finalize(r)};case"optimistic":this.contextFreeMorph=this.shallowMorphs[0];const e=this.$.resolvedConfig.clone;return(n,r)=>{if(this.allows(n))return this.contextFreeMorph(e&&(typeof n=="object"&&n!==null||typeof n=="function")?e(n):n);const o=new so(n,this.$.resolvedConfig);return this.traverseApply(n,o),o.finalize(r)};case"branchedOptimistic":return this.createBranchedOptimisticRootApply();default:return this.rootApplyStrategy,wt(`Unexpected rootApplyStrategy ${this.rootApplyStrategy}`)}}compiledMeta=A2(this.metaJson);cacheGetter(e,n){return Object.defineProperty(this,e,{value:n}),n}get description(){return this.cacheGetter("description",this.meta?.description??this.$.resolvedConfig[this.kind].description(this))}get references(){return Object.values(this.referencesById)}precedence=Rc(this.kind);precompilation;assert=(e,n)=>this(e,n,r=>r.throw());traverse(e,n){return this(e,n,null)}get in(){return this.cacheGetter("in",this.getIo("in"))}get out(){return this.cacheGetter("out",this.getIo("out"))}getIo(e){if(!this.includesTransform)return this;const n={};for(const[r,o]of this.innerEntries){const u=this.impl.keys[r];if(u.reduceIo)u.reduceIo(e,n,o);else if(u.child){const c=o;n[r]=Gt(c)?c.map(d=>d[e]):c[e]}else n[r]=o}return this.$.node(this.kind,n)}toJSON(){return this.json}toString(){return`Type<${this.expression}>`}equals(e){const n=Xt(e)?e:this.$.parseDefinition(e);return this.innerHash===n.innerHash}ifEquals(e){return this.equals(e)?this:void 0}hasKind(e){return this.kind===e}assertHasKind(e){return this.kind!==e&&wo(`${this.kind} node was not of asserted kind ${e}`),this}hasKindIn(...e){return e.includes(this.kind)}assertHasKindIn(...e){return Jr(e,this.kind)||wo(`${this.kind} node was not one of asserted kinds ${e}`),this}isBasis(){return Jr(h2,this.kind)}isConstraint(){return Jr(Pm,this.kind)}isStructural(){return Jr(Wc,this.kind)}isRefinement(){return Jr(Ww,this.kind)}isRoot(){return Jr(ef,this.kind)}isUnknown(){return this.hasKind("intersection")&&this.children.length===0}isNever(){return this.hasKind("union")&&this.children.length===0}hasUnit(e){return this.hasKind("unit")&&this.allows(e)}hasOpenIntersection(){return this.impl.intersectionIsOpen}get nestableExpression(){return this.expression}select(e){const n=Ua.normalize(e);return this._select(n)}_select(e){let n=Ua.applyBoundary[e.boundary??"references"](this);return e.kind&&(n=n.filter(r=>r.kind===e.kind)),e.where&&(n=n.filter(e.where)),Ua.applyMethod[e.method??"filter"](n,this,e)}transform(e,n){return this._transform(e,this._createTransformContext(n))}_createTransformContext(e){return{root:this,selected:void 0,seen:{},path:[],parseOptions:{prereduced:e?.prereduced??!1},undeclaredKeyHandling:void 0,...e}}_transform(e,n){const r=n.bindScope??this.$;if(n.seen[this.id])return this.$.lazilyResolve(n.seen[this.id]);if(n.shouldTransform?.(this,n)===!1)return this;let o;n.seen[this.id]=()=>o,this.hasKind("structure")&&this.undeclared!==n.undeclaredKeyHandling&&(n={...n,undeclaredKeyHandling:this.undeclared});const u=He(this.inner,(y,g)=>{if(!this.impl.keys[y].child)return[y,g];const b=g;if(!Gt(b)){const A=b._transform(e,n);return A?[y,A]:[]}if(b.length===0)return[y,g];const x=b.flatMap(A=>A._transform(e,n)??[]);return x.length?[y,x]:[]});delete n.seen[this.id];const c=Object.assign(u,{meta:this.meta}),d=n.selected&&!n.selected.includes(this)?c:e(this.kind,c,n);if(d===null)return null;if(Xt(d))return o=d;const h=Object.keys(d);return(h.length===0||h.length===1&&h[0]==="meta")&&!cl(this.inner)?null:(this.kind==="required"||this.kind==="optional"||this.kind==="index")&&!("value"in d)?n.undeclaredKeyHandling?{...d,value:Q.intrinsic.unknown}:null:(this.kind==="morph"&&(d.in??=Q.intrinsic.unknown),o=r.node(this.kind,d,n.parseOptions))}configureReferences(e,n="references"){const r=Ua.normalize(n),o=typeof e=="string"?(h,m)=>({...m,meta:{...m.meta,description:e}}):typeof e=="function"?(h,m)=>({...m,meta:e(m.meta)}):(h,m)=>({...m,meta:{...m.meta,...e}});if(r.boundary==="self")return this.$.node(this.kind,o(this.kind,{...this.inner,meta:this.meta}));const u=this._select(r),c=u&&ul(u),d=r.boundary==="child"?(h,m)=>m.root.children.includes(h):r.boundary==="shallow"?h=>h.kind!=="structure":()=>!0;return this.$.finalize(this.transform(o,{shouldTransform:d,selected:c}))}}const Ua={applyBoundary:{self:t=>[t],child:t=>[...t.children],shallow:t=>[...t.shallowReferences],references:t=>[...t.references]},applyMethod:{filter:t=>t,assertFilter:(t,e,n)=>(t.length===0&&wo(SS(e,n)),t),find:t=>t[0],assertFind:(t,e,n)=>(t.length===0&&wo(SS(e,n)),t[0])},normalize:t=>typeof t=="function"?{boundary:"references",method:"filter",where:t}:typeof t=="string"?mi(t,Ua.applyBoundary)?{method:"filter",boundary:t}:{boundary:"references",method:"filter",kind:t}:{boundary:"references",method:"filter",...t}},SS=(t,e)=>`${t} had no references matching ${Pe(e)}.`,x2=t=>hl(t,{stringifyNonKey:e=>e.expression}),w2=/"(\$ark\.[^"]+)"/g,A2=t=>JSON.stringify(t).replaceAll(w2,"$1"),Ar=(t,e)=>({path:t,node:e,propString:x2(t)}),rA=(t,e)=>t.propString===e.propString&&t.node.equals(e.node),xS=(t,e)=>rs(t,e,{isEqual:rA}),T2=(t,e)=>rs(t,e,{isEqual:(n,r)=>n.equals(r)});class se extends Array{static init(e,n,r,o){return new se({kind:e,l:n,r,path:o?.path??[],optional:o?.optional??!1})}add(e,n,r,o){return this.push({kind:e,l:n,r,path:o?.path??[],optional:o?.optional??!1}),this}get summary(){return this.describeReasons()}describeReasons(){if(this.length===1){const{path:e,l:n,r}=this[0],o=hl(e);return sA(`Intersection${o&&` at ${o}`} of ${wS(n,r)}`)}return`The following intersections result in unsatisfiable types:
|
|
85
|
-
โข ${this.map(({path:e,l:n,r})=>`${e}: ${wS(n,r)}`).join(`
|
|
86
|
-
โข `)}`}throw(){return Y(this.describeReasons())}invert(){const e=this.map(n=>({...n,l:n.r,r:n.l}));return e instanceof se?e:new se(...e)}withPrefixKey(e,n){return this.map(r=>({...r,path:[e,...r.path],optional:r.optional||n==="optional"}))}toNeverIfDisjoint(){return Q.intrinsic.never}}const wS=(t,e)=>`${$p(t)} and ${$p(e)}`,$p=t=>Xt(t)?t.expression:Gt(t)?t.map($p).join(" | ")||"never":String(t),sA=t=>`${t} results in an unsatisfiable type`,eo={},Ki=(t,e,n)=>Bt(t,e,{$:n,invert:!1,pipe:!1}),jp=(t,e,n)=>Bt(t,e,{$:n,invert:!1,pipe:!0}),Bt=(t,e,n)=>{const r=n.pipe?"|>":"&",o=`${t.hash}${r}${e.hash}`;if(eo[o]!==void 0)return eo[o];if(!n.pipe){const d=`${e.hash}${r}${t.hash}`;if(eo[d]!==void 0){const h=eo[d],m=h instanceof se?h.invert():h;return eo[o]=m,m}}const u=!n.pipe||!t.includesTransform&&!e.includesTransform;if(u&&t.equals(e))return t;let c=u?Bp(t,e,n):t.hasKindIn(...ef)?E2(t,e,n):Bp(t,e,n);return Xt(c)&&(t.equals(c)?c=t:e.equals(c)&&(c=e)),eo[o]=c,c},Bp=(t,e,n)=>{const r=t.precedence<e.precedence?t.kind:e.kind,o=t.impl.intersections[e.kind]??e.impl.intersections[t.kind];if(o===void 0)return null;if(r===t.kind)return o(t,e,n);{let u=o(e,t,{...n,invert:!n.invert});return u instanceof se&&(u=u.invert()),u}},E2=(t,e,n)=>t.includesTransform||e.includesTransform?n.invert?AS(e,t,n):AS(t,e,n):Bp(t,e,n),AS=(t,e,n)=>t.distribute(r=>R2(r,e,n),r=>{const o=r.filter(Xt);if(o.length===0)return se.init("union",t.branches,e.branches);if(o.length<t.branches.length||!t.branches.every((c,d)=>c.in.equals(o[d].in)))return n.$.parseSchema(o);if(o.length===1)return o[0];const u={branches:o};return n.$.parseSchema(u)}),R2=(t,e,n)=>{if(t.hasKind("morph")){const o=[...t.morphs];if(t.lastMorphIfNode){const u=Bt(t.lastMorphIfNode,e,n);if(u instanceof se)return u;o[o.length-1]=u}else o.push(e);return n.$.node("morph",{morphs:o,in:t.inner.in})}if(e.hasKind("morph")){const o=Bt(t,e.in,n);return o instanceof se?o:n.$.node("morph",{morphs:[e],in:o})}return n.$.node("morph",{morphs:[e],in:t})};class No extends iA{constructor(e,n){super(e,n),Object.defineProperty(this,qi,{value:"constraint",enumerable:!1})}impliedSiblings;intersect(e){return Ki(this,e,this.$)}}class nf extends No{traverseApply=(e,n)=>{this.traverseAllows(e,n)||n.errorFromNodeContext(this.errorContext)};compile(e){e.traversalKind==="Allows"?e.return(this.compiledCondition):e.if(this.compiledNegation,()=>e.line(`${e.ctx}.errorFromNodeContext(${this.compiledErrorContext})`))}get errorContext(){return{code:this.kind,description:this.description,meta:this.meta,...this.inner}}get compiledErrorContext(){return tf(this.errorContext)}}const rn=t=>(e,n)=>{if(Gt(e)){if(e.length===0)return;const o=e.map(u=>n.$.node(t,u));return t==="predicate"?o:o.sort((u,c)=>u.hash<c.hash?-1:1)}const r=n.$.node(t,e);return r.hasOpenIntersection()?[r]:r},Oc=t=>{const e=t.r.shift();if(!e){let r=t.l.length===0&&t.kind==="structure"?Q.intrinsic.unknown.internal:t.ctx.$.node(t.kind,Object.assign(t.baseInner,O2(t.l)),{prereduced:!0});for(const o of t.roots){if(r instanceof se)return r;r=Bt(o,r,t.ctx)}return r}let n=!1;for(let r=0;r<t.l.length;r++){const o=Bt(t.l[r],e,t.ctx);if(o!==null){if(o instanceof se)return o;if(n){if(!t.l.includes(o))return wt(`Unexpectedly encountered multiple distinct intersection results for refinement ${o}`)}else{if(o.isRoot())return t.roots.push(o),t.l.splice(r),Oc(t);t.l[r]=o,n=!0}}}if(n||t.l.push(e),t.kind==="intersection"&&e.impliedSiblings)for(const r of e.impliedSiblings)rs(t.r,r);return Oc(t)},_c=t=>Object.entries(t).flatMap(([n,r])=>n in eA?r:[]).sort((n,r)=>n.precedence<r.precedence?-1:n.precedence>r.precedence?1:n.kind==="predicate"&&r.kind==="predicate"?0:n.hash<r.hash?-1:1),O2=t=>{const e={};for(const n of t)if(n.hasOpenIntersection())e[n.kind]=Ie(e[n.kind],n);else{if(e[n.kind])return wt(`Unexpected intersection of closed refinements of kind ${n.kind}`);e[n.kind]=n}return e},_2=(...t)=>Y(M2(...t)),M2=(t,e,n)=>{const r=n.hasKind("morph")?"a morph":n.isUnknown()?"unknown":n.exclude(e).defaultShortDescription;return`${zD(t)} operand must be ${e.description} (was ${r})`},C2=(t,e,n)=>new Mc(t,e,n,n,null);class oA extends Do{}class Mc extends Do{[qi]="generic";paramDefs;bodyDef;$;arg$;baseInstantiation;hkt;description;constructor(e,n,r,o,u){super((...c)=>{const d=He(this.names,(h,m)=>{const y=this.arg$.parse(c[h]);return y.extends(this.constraints[h])||Y(k2(m,this.constraints[h].expression,y.expression)),[m,y]});if(this.defIsLazy()){const h=this.bodyDef(d);return this.$.parse(h)}return this.$.parse(n,{args:d})}),this.paramDefs=e,this.bodyDef=n,this.$=r,this.arg$=o,this.hkt=u,this.description=u?new u().description??`a generic type for ${u.constructor.name}`:"a generic type",this.baseInstantiation=this(...this.constraints)}defIsLazy(){return this.bodyDef instanceof oA}cacheGetter(e,n){return Object.defineProperty(this,e,{value:n}),n}get json(){return this.cacheGetter("json",{params:this.params.map(e=>e[1].isUnknown()?e[0]:[e[0],e[1].json]),body:s2(this.bodyDef)})}get params(){return this.cacheGetter("params",this.paramDefs.map(e=>typeof e=="string"?[e,Q.intrinsic.unknown]:[e[0],this.$.parse(e[1])]))}get names(){return this.cacheGetter("names",this.params.map(e=>e[0]))}get constraints(){return this.cacheGetter("constraints",this.params.map(e=>e[1]))}get internal(){return this}get referencesById(){return this.baseInstantiation.internal.referencesById}get references(){return this.baseInstantiation.internal.references}}const k2=(t,e,n)=>`${t} must be assignable to ${e} (was ${n})`,D2=lt({kind:"predicate",hasAssociatedError:!0,collapsibleKey:"predicate",keys:{predicate:{}},normalize:t=>typeof t=="function"?{predicate:t}:t,defaults:{description:t=>`valid according to ${t.predicate.name||"an anonymous predicate"}`},intersectionIsOpen:!0,intersections:{predicate:()=>null}});class N2 extends No{serializedPredicate=Jt(this.predicate);compiledCondition=`${this.serializedPredicate}(data, ctx)`;compiledNegation=`!${this.compiledCondition}`;impliedBasis=null;expression=this.serializedPredicate;traverseAllows=this.predicate;errorContext={code:"predicate",description:this.description,meta:this.meta};compiledErrorContext=tf(this.errorContext);traverseApply=(e,n)=>{!this.predicate(e,n.external)&&!n.hasError()&&n.errorFromNodeContext(this.errorContext)};compile(e){if(e.traversalKind==="Allows"){e.return(this.compiledCondition);return}e.if(`${this.compiledNegation} && !ctx.hasError()`,()=>e.line(`ctx.errorFromNodeContext(${this.compiledErrorContext})`))}reduceJsonSchema(e,n){return n.fallback.predicate({code:"predicate",base:e,predicate:this.predicate})}}const aA={implementation:D2,Node:N2},$2=lt({kind:"divisor",collapsibleKey:"rule",keys:{rule:{parse:t=>Number.isInteger(t)?t:Y(B2(t))}},normalize:t=>typeof t=="number"?{rule:t}:t,hasAssociatedError:!0,defaults:{description:t=>t.rule===1?"an integer":t.rule===2?"even":`a multiple of ${t.rule}`},intersections:{divisor:(t,e,n)=>n.$.node("divisor",{rule:Math.abs(t.rule*e.rule/L2(t.rule,e.rule))})},obviatesBasisDescription:!0});class j2 extends nf{traverseAllows=e=>e%this.rule===0;compiledCondition=`data % ${this.rule} === 0`;compiledNegation=`data % ${this.rule} !== 0`;impliedBasis=Q.intrinsic.number.internal;expression=`% ${this.rule}`;reduceJsonSchema(e){return e.type="integer",this.rule===1||(e.multipleOf=this.rule),e}}const lA={implementation:$2,Node:j2},B2=t=>`divisor must be an integer (was ${t})`,L2=(t,e)=>{let n,r=t,o=e;for(;o!==0;)n=o,o=r%o,r=n;return r};class $o extends nf{boundOperandKind=q2[this.kind];compiledActual=this.boundOperandKind==="value"?"data":this.boundOperandKind==="length"?"data.length":"data.valueOf()";comparator=P2(this.kind,this.exclusive);numericLimit=this.rule.valueOf();expression=`${this.comparator} ${this.rule}`;compiledCondition=`${this.compiledActual} ${this.comparator} ${this.numericLimit}`;compiledNegation=`${this.compiledActual} ${V2[this.comparator]} ${this.numericLimit}`;stringLimit=this.boundOperandKind==="date"?K2(this.numericLimit):`${this.numericLimit}`;limitKind=this.comparator[0]==="<"?"upper":"lower";isStricterThan(e){return(this.limitKind==="upper"?this.numericLimit<e.numericLimit:this.numericLimit>e.numericLimit)||this.numericLimit===e.numericLimit&&this.exclusive===!0&&!e.exclusive}overlapsRange(e){return!(this.isStricterThan(e)||this.numericLimit===e.numericLimit&&(this.exclusive||e.exclusive))}overlapIsUnit(e){return this.numericLimit===e.numericLimit&&!this.exclusive&&!e.exclusive}}const V2={"<":">=","<=":">",">":"<=",">=":"<"},z2={min:"max",minLength:"maxLength",after:"before"},uA={parse:t=>t||void 0},cA=t=>e=>{if(typeof e=="number")return{rule:e};const{exclusive:n,...r}=e;return n?{...r,rule:t==="minLength"?r.rule+1:r.rule-1}:r},fA=t=>e=>{if(typeof e=="number"||typeof e=="string"||e instanceof Date)return{rule:e};const{exclusive:n,...r}=e;if(!n)return r;const o=typeof r.rule=="number"?r.rule:typeof r.rule=="string"?new Date(r.rule).valueOf():r.rule.valueOf();return n?{...r,rule:t==="after"?o+1:o-1}:r},dA=t=>typeof t=="string"||typeof t=="number"?new Date(t):t,U2=(t,e)=>`${t} bound must be a positive integer (was ${e})`,Im=t=>e=>((!Number.isInteger(e)||e<0)&&Y(U2(t,e)),e),q2={min:"value",max:"value",minLength:"length",maxLength:"length",after:"date",before:"date"},P2=(t,e)=>`${mi(t,z2)?">":"<"}${e?"":"="}`,K2=t=>typeof t=="string"?t:new Date(t).toLocaleString(),I2=t=>`Bounded expression ${t} must be exactly one of number, string, Array, or Date`,H2=lt({kind:"after",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{parse:dA,serialize:t=>t.toISOString()}},normalize:fA("after"),defaults:{description:t=>`${t.collapsibleLimitString} or later`,actual:dl},intersections:{after:(t,e)=>t.isStricterThan(e)?t:e}});class F2 extends $o{impliedBasis=Q.intrinsic.Date.internal;collapsibleLimitString=dl(this.rule);traverseAllows=e=>e>=this.rule;reduceJsonSchema(e,n){return n.fallback.date({code:"date",base:e,after:this.rule})}}const hA={implementation:H2,Node:F2},G2=lt({kind:"before",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{parse:dA,serialize:t=>t.toISOString()}},normalize:fA("before"),defaults:{description:t=>`${t.collapsibleLimitString} or earlier`,actual:dl},intersections:{before:(t,e)=>t.isStricterThan(e)?t:e,after:(t,e,n)=>t.overlapsRange(e)?t.overlapIsUnit(e)?n.$.node("unit",{unit:t.rule}):null:se.init("range",t,e)}});class Y2 extends $o{collapsibleLimitString=dl(this.rule);traverseAllows=e=>e<=this.rule;impliedBasis=Q.intrinsic.Date.internal;reduceJsonSchema(e,n){return n.fallback.date({code:"date",base:e,before:this.rule})}}const pA={implementation:G2,Node:Y2},X2=lt({kind:"exactLength",collapsibleKey:"rule",keys:{rule:{parse:Im("exactLength")}},normalize:t=>typeof t=="number"?{rule:t}:t,hasAssociatedError:!0,defaults:{description:t=>`exactly length ${t.rule}`,actual:t=>`${t.length}`},intersections:{exactLength:(t,e,n)=>se.init("unit",n.$.node("unit",{unit:t.rule}),n.$.node("unit",{unit:e.rule}),{path:["length"]}),minLength:(t,e)=>t.rule>=e.rule?t:se.init("range",t,e),maxLength:(t,e)=>t.rule<=e.rule?t:se.init("range",t,e)}});class Z2 extends nf{traverseAllows=e=>e.length===this.rule;compiledCondition=`data.length === ${this.rule}`;compiledNegation=`data.length !== ${this.rule}`;impliedBasis=Q.intrinsic.lengthBoundable.internal;expression=`== ${this.rule}`;reduceJsonSchema(e){switch(e.type){case"string":return e.minLength=this.rule,e.maxLength=this.rule,e;case"array":return e.minItems=this.rule,e.maxItems=this.rule,e;default:return Ot.throwInternalOperandError("exactLength",e)}}}const mA={implementation:X2,Node:Z2},J2=lt({kind:"max",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{},exclusive:uA},normalize:t=>typeof t=="number"?{rule:t}:t,defaults:{description:t=>t.rule===0?t.exclusive?"negative":"non-positive":`${t.exclusive?"less than":"at most"} ${t.rule}`},intersections:{max:(t,e)=>t.isStricterThan(e)?t:e,min:(t,e,n)=>t.overlapsRange(e)?t.overlapIsUnit(e)?n.$.node("unit",{unit:t.rule}):null:se.init("range",t,e)},obviatesBasisDescription:!0});class Q2 extends $o{impliedBasis=Q.intrinsic.number.internal;traverseAllows=this.exclusive?e=>e<this.rule:e=>e<=this.rule;reduceJsonSchema(e){return this.exclusive?e.exclusiveMaximum=this.rule:e.maximum=this.rule,e}}const yA={implementation:J2,Node:Q2},W2=lt({kind:"maxLength",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{parse:Im("maxLength")}},reduce:(t,e)=>t.rule===0?e.node("exactLength",t):void 0,normalize:cA("maxLength"),defaults:{description:t=>`at most length ${t.rule}`,actual:t=>`${t.length}`},intersections:{maxLength:(t,e)=>t.isStricterThan(e)?t:e,minLength:(t,e,n)=>t.overlapsRange(e)?t.overlapIsUnit(e)?n.$.node("exactLength",{rule:t.rule}):null:se.init("range",t,e)}});class eN extends $o{impliedBasis=Q.intrinsic.lengthBoundable.internal;traverseAllows=e=>e.length<=this.rule;reduceJsonSchema(e){switch(e.type){case"string":return e.maxLength=this.rule,e;case"array":return e.maxItems=this.rule,e;default:return Ot.throwInternalOperandError("maxLength",e)}}}const gA={implementation:W2,Node:eN},tN=lt({kind:"min",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{},exclusive:uA},normalize:t=>typeof t=="number"?{rule:t}:t,defaults:{description:t=>t.rule===0?t.exclusive?"positive":"non-negative":`${t.exclusive?"more than":"at least"} ${t.rule}`},intersections:{min:(t,e)=>t.isStricterThan(e)?t:e},obviatesBasisDescription:!0});class nN extends $o{impliedBasis=Q.intrinsic.number.internal;traverseAllows=this.exclusive?e=>e>this.rule:e=>e>=this.rule;reduceJsonSchema(e){return this.exclusive?e.exclusiveMinimum=this.rule:e.minimum=this.rule,e}}const vA={implementation:tN,Node:nN},iN=lt({kind:"minLength",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{parse:Im("minLength")}},reduce:t=>t.rule===0?Q.intrinsic.unknown:void 0,normalize:cA("minLength"),defaults:{description:t=>t.rule===1?"non-empty":`at least length ${t.rule}`,actual:t=>t.length===0?"":`${t.length}`},intersections:{minLength:(t,e)=>t.isStricterThan(e)?t:e}});class rN extends $o{impliedBasis=Q.intrinsic.lengthBoundable.internal;traverseAllows=e=>e.length>=this.rule;reduceJsonSchema(e){switch(e.type){case"string":return e.minLength=this.rule,e;case"array":return e.minItems=this.rule,e;default:return Ot.throwInternalOperandError("minLength",e)}}}const bA={implementation:iN,Node:rN},sN={min:vA.implementation,max:yA.implementation,minLength:bA.implementation,maxLength:gA.implementation,exactLength:mA.implementation,after:hA.implementation,before:pA.implementation},oN={min:vA.Node,max:yA.Node,minLength:bA.Node,maxLength:gA.Node,exactLength:mA.Node,after:hA.Node,before:pA.Node},aN=lt({kind:"pattern",collapsibleKey:"rule",keys:{rule:{},flags:{}},normalize:t=>typeof t=="string"?{rule:t}:t instanceof RegExp?t.flags?{rule:t.source,flags:t.flags}:{rule:t.source}:t,obviatesBasisDescription:!0,obviatesBasisExpression:!0,hasAssociatedError:!0,intersectionIsOpen:!0,defaults:{description:t=>`matched by ${t.rule}`},intersections:{pattern:()=>null}});class lN extends nf{instance=new RegExp(this.rule,this.flags);expression=`${this.instance}`;traverseAllows=this.instance.test.bind(this.instance);compiledCondition=`${this.expression}.test(data)`;compiledNegation=`!${this.compiledCondition}`;impliedBasis=Q.intrinsic.string.internal;reduceJsonSchema(e,n){return e.pattern?n.fallback.patternIntersection({code:"patternIntersection",base:e,pattern:this.rule}):(e.pattern=this.rule,e)}}const SA={implementation:aN,Node:lN},nc=(t,e)=>{const n=uN(t);return e&&!e.includes(n)?Y(`Root of kind ${n} should be one of ${e}`):n},uN=t=>{if(ue(t,"root"))return t.kind;if(typeof t=="string")return t[0]==="$"?"alias":t in Ui?"domain":"proto";if(typeof t=="function")return"proto";if(typeof t!="object"||t===null)return Y(TS(t));if("morphs"in t)return"morph";if("branches"in t||Gt(t))return"union";if("unit"in t)return"unit";if("reference"in t)return"alias";const e=Object.keys(t);return e.length===0||e.some(n=>n in eA)?"intersection":"proto"in t?"proto":"domain"in t?"domain":Y(TS(t))},TS=t=>`${Pe(t)} is not a valid type schema`,ES={},cN=t=>Gt(t)?t.map(e=>e.collapsibleJson):t.collapsibleJson,jn={};Q.nodesByRegisteredId=jn;const xA=t=>(ES[t]??=0,`${t}${++ES[t]}`),wA=t=>{const e=rf[t.kind],n=e.applyConfig?.(t.def,t.$.resolvedConfig)??t.def,r={},{meta:o,...u}=n,c=o===void 0?{}:typeof o=="string"?{description:o}:o,d=jw(u).sort(([m],[y])=>tc(m)?tc(y)?Rc(m)-Rc(y):1:tc(y)||m<y?-1:1).filter(([m,y])=>{if(m.startsWith("meta.")){const g=m.slice(5);return c[g]=y,!1}return!0});for(const m of d){const y=m[0],g=e.keys[y];if(!g)return Y(`Key ${y} is not valid on ${t.kind} schema`);const b=g.parse?g.parse(m[1],t):m[1];b!==$i&&(b!==void 0||g.preserveUndefined)&&(r[y]=b)}if(e.reduce&&!t.prereduced){const m=e.reduce(r,t.$);if(m)return m instanceof se?m.throw():dN(m,c)}return Hm({id:t.id,kind:t.kind,inner:r,meta:c,$:t.$})},Hm=({id:t,kind:e,inner:n,meta:r,$:o,ignoreCache:u})=>{const c=rf[e],d=jw(n),h=[];let m={};for(const[$,M]of d){const O=c.keys[$],G=O.serialize??(O.child?cN:us);if(m[$]=G(M),O.child===!0){const V=M;Gt(V)?h.push(...V):h.push(V)}else typeof O.child=="function"&&h.push(...O.child(M))}c.finalizeInnerJson&&(m=c.finalizeInnerJson(m));let y={...m},g={};cl(r)||(g=He(r,($,M)=>[$,$==="examples"?M:us(M)]),y.meta=Pu(g,"description",!0)),m=Pu(m,c.collapsibleKey,!1);const b=JSON.stringify({kind:e,...m});y=Pu(y,c.collapsibleKey,!1);const x=Pu(y,c.collapsibleKey,!0),A=JSON.stringify({kind:e,...y});if(o.nodesByHash[A]&&!u)return o.nodesByHash[A];const w={id:t,kind:e,impl:c,inner:n,innerEntries:d,innerJson:m,innerHash:b,meta:r,metaJson:g,json:y,hash:A,collapsibleJson:x,children:h};if(e!=="intersection")for(const $ in n)$!=="in"&&$!=="out"&&(w[$]=n[$]);const k=new v$[e](w,o);return o.nodesByHash[A]=k},fN=(t,e)=>t.id===e?t:(Xt(jn[e])&&wt(`Unexpected attempt to overwrite node id ${e}`),Hm({id:e,kind:t.kind,inner:t.inner,meta:t.meta,$:t.$,ignoreCache:!0})),dN=(t,e,n)=>Hm({id:xA(e.alias??t.kind),kind:t.kind,inner:t.inner,meta:e,$:t.$}),Pu=(t,e,n)=>{const r=Object.keys(t);if(r.length===1&&r[0]===e){const o=t[e];if(n||fs(o,"object")&&(Object.keys(o).length===1||Array.isArray(o)))return o}return t},Lp=(t,e,n)=>{if(t.key!==e.key)return null;const r=t.key;let o=Bt(t.value,e.value,n);const u=t.required||e.required?"required":"optional";if(o instanceof se)if(u==="optional")o=Q.intrinsic.never.internal;else return o.withPrefixKey(t.key,t.required&&e.required?"required":"optional");if(u==="required")return n.$.node("required",{key:r,value:o});const c=t.hasDefault()?e.hasDefault()?t.default===e.default?t.default:Y(TA(t.default,e.default)):t.default:e.hasDefault()?e.default:$i;return n.$.node("optional",{key:r,value:o,default:c})};class AA extends No{required=this.kind==="required";optional=this.kind==="optional";impliedBasis=Q.intrinsic.object.internal;serializedKey=pl(this.key);compiledKey=typeof this.key=="string"?this.key:this.serializedKey;flatRefs=Ie(this.value.flatRefs.map(e=>Ar([this.key,...e.path],e.node)),Ar([this.key],this.value));_transform(e,n){n.path.push(this.key);const r=super._transform(e,n);return n.path.pop(),r}hasDefault(){return"default"in this.inner}traverseAllows=(e,n)=>this.key in e?Pi(this.key,()=>this.value.traverseAllows(e[this.key],n),n):this.optional;traverseApply=(e,n)=>{this.key in e?Pi(this.key,()=>this.value.traverseApply(e[this.key],n),n):this.hasKind("required")&&n.errorFromNodeContext(this.errorContext)};compile(e){e.if(`${this.serializedKey} in data`,()=>e.traverseKey(this.serializedKey,`data${e.prop(this.key)}`,this.value)),this.hasKind("required")&&e.else(()=>e.traversalKind==="Apply"?e.line(`ctx.errorFromNodeContext(${this.compiledErrorContext})`):e.return(!1)),e.traversalKind==="Allows"&&e.return(!0)}}const TA=(t,e)=>`Invalid intersection of default values ${Pe(t)} & ${Pe(e)}`,hN=lt({kind:"optional",hasAssociatedError:!1,intersectionIsOpen:!0,keys:{key:{},value:{child:!0,parse:(t,e)=>e.$.parseSchema(t)},default:{preserveUndefined:!0}},normalize:t=>t,reduce:(t,e)=>{if(e.resolvedConfig.exactOptionalPropertyTypes===!1&&!t.value.allows(void 0))return e.node("optional",{...t,value:t.value.or(pe.undefined)},{prereduced:!0})},defaults:{description:t=>`${t.compiledKey}?: ${t.value.description}`},intersections:{optional:Lp}});class pN extends AA{constructor(...e){super(...e),"default"in this.inner&&Gm(this.value,this.inner.default,this.key)}get outProp(){if(!this.hasDefault())return this;const{default:e,...n}=this.inner;return this.cacheGetter("outProp",this.$.node("required",n,{prereduced:!0}))}expression=this.hasDefault()?`${this.compiledKey}: ${this.value.expression} = ${Pe(this.inner.default)}`:`${this.compiledKey}?: ${this.value.expression}`;defaultValueMorph=yN(this);defaultValueMorphRef=this.defaultValueMorph&&Jt(this.defaultValueMorph)}const Fm={implementation:hN,Node:pN},mN={},yN=t=>{if(!t.hasDefault())return;const e=`{${t.compiledKey}: ${t.value.id} = ${us(t.default)}}`;return mN[e]??=EA(t.key,t.value,t.default)},EA=(t,e,n)=>{if(typeof n=="function")return e.includesTransform?(o,u)=>(Pi(t,()=>e(o[t]=n(),u),u),o):o=>(o[t]=n(),o);const r=e.includesTransform?e.assert(n):n;return fs(r,"object")?(o,u)=>(Pi(t,()=>e(o[t]=n,u),u),o):o=>(o[t]=r,o)},Gm=(t,e,n)=>{const r=Jc(e);fs(e,"object")&&!r&&Y(gN(n));const o=t.in(r?e():e);if(o instanceof Rr){n===null&&Y(`Default ${o.summary}`);const u=o.transform(c=>c.transform(d=>({...d,prefixPath:[n]})));Y(`Default for ${u.summary}`)}return e},gN=t=>`Non-primitive default ${t===null?"":typeof t=="number"?`for value at [${t}] `:`for ${pl(t)} `}must be specified as a function like () => ({my: 'object'})`;class ml extends iA{constructor(e,n){super(e,n),Object.defineProperty(this,qi,{value:"root",enumerable:!1})}get internal(){return this}get"~standard"(){return{vendor:"arktype",version:1,validate:e=>{const n=this(e);return n instanceof Rr?n:{value:n}}}}as(){return this}brand(e){return e===""?Y(vN):this}readonly(){return this}branches=this.hasKind("union")?this.inner.branches:[this];distribute(e,n){const r=this.branches.map(e);return n?.(r)??r}get shortDescription(){return this.meta.description??this.defaultShortDescription}toJsonSchema(e={}){const n=nA(this.$.resolvedConfig.toJsonSchema,e);n.useRefs||=this.isCyclic;const r=typeof n.dialect=="string"?{$schema:n.dialect}:{};return Object.assign(r,this.toJsonSchemaRecurse(n)),n.useRefs&&(r.$defs=He(this.references,(o,u)=>u.isRoot()&&!u.alwaysExpandJsonSchema?[u.id,u.toResolvedJsonSchema(n)]:[])),r}toJsonSchemaRecurse(e){return e.useRefs&&!this.alwaysExpandJsonSchema?{$ref:`#/$defs/${this.id}`}:this.toResolvedJsonSchema(e)}get alwaysExpandJsonSchema(){return this.isBasis()||this.kind==="alias"||this.hasKind("union")&&this.isBoolean}toResolvedJsonSchema(e){const n=this.innerToJsonSchema(e);return Object.assign(n,this.metaJson)}intersect(e){const n=this.$.parseDefinition(e),r=this.rawIntersect(n);return r instanceof se?r:this.$.finalize(r)}rawIntersect(e){return Ki(this,e,this.$)}toNeverIfDisjoint(){return this}and(e){const n=this.intersect(e);return n instanceof se?n.throw():n}rawAnd(e){const n=this.rawIntersect(e);return n instanceof se?n.throw():n}or(e){const n=this.$.parseDefinition(e);return this.$.finalize(this.rawOr(n))}rawOr(e){const n=[...this.branches,...e.branches];return this.$.node("union",n)}map(e){return this.$.schema(this.applyStructuralOperation("map",[e]))}pick(...e){return this.$.schema(this.applyStructuralOperation("pick",e))}omit(...e){return this.$.schema(this.applyStructuralOperation("omit",e))}required(){return this.$.schema(this.applyStructuralOperation("required",[]))}partial(){return this.$.schema(this.applyStructuralOperation("partial",[]))}_keyof;keyof(){if(this._keyof)return this._keyof;const e=this.applyStructuralOperation("keyof",[]).reduce((n,r)=>n.intersect(r).toNeverIfDisjoint(),Q.intrinsic.unknown.internal);return e.branches.length===0&&Y(sA(`keyof ${this.expression}`)),this._keyof=this.$.finalize(e)}get props(){return this.branches.length!==1?Y(bN(this.expression)):[...this.applyStructuralOperation("props",[])[0]]}merge(e){const n=this.$.parseDefinition(e);return this.$.schema(n.distribute(r=>this.applyStructuralOperation("merge",[RS(r)??Y(OS("merge",r.expression))])))}applyStructuralOperation(e,n){return this.distribute(r=>{if(r.equals(Q.intrinsic.object)&&e!=="merge")return r;const o=RS(r);if(o||Y(OS(e,r.expression)),e==="keyof")return o.keyof();if(e==="get")return o.get(...n);if(e==="props")return o.props;const u=e==="required"?"require":e==="partial"?"optionalize":e;return this.$.node("intersection",{...r.inner,structure:o[u](...n)})})}get(...e){return e[0]===void 0?this:this.$.schema(this.applyStructuralOperation("get",e))}extract(e){const n=this.$.parseDefinition(e);return this.$.schema(this.branches.filter(r=>r.extends(n)))}exclude(e){const n=this.$.parseDefinition(e);return this.$.schema(this.branches.filter(r=>!r.extends(n)))}array(){return this.$.schema(this.isUnknown()?{proto:Array}:{proto:Array,sequence:this},{prereduced:!0})}overlaps(e){return!(this.intersect(e)instanceof se)}extends(e){const n=this.intersect(e);return!(n instanceof se)&&this.equals(n)}ifExtends(e){return this.extends(e)?this:void 0}subsumes(e){return this.$.parseDefinition(e).extends(this)}configure(e,n="shallow"){return this.configureReferences(e,n)}describe(e,n="shallow"){return this.configure({description:e},n)}optional(){return[this,"?"]}default(e){return Gm(this,e,null),[this,"=",e]}from(e){return this.assert(e)}_pipe(...e){const n=e.reduce((r,o)=>r.rawPipeOnce(o),this);return this.$.finalize(n)}tryPipe(...e){const n=e.reduce((r,o)=>r.rawPipeOnce(ue(o,"root")?o:(u,c)=>{try{return o(u,c)}catch(d){return c.error({code:"predicate",predicate:o,actual:`aborted due to error:
|
|
87
|
-
${d}
|
|
88
|
-
`})}}),this);return this.$.finalize(n)}pipe=Object.assign(this._pipe.bind(this),{try:this.tryPipe.bind(this)});to(e){return this.$.finalize(this.toNode(this.$.parseDefinition(e)))}toNode(e){const n=jp(this,e,this.$);return n instanceof se?n.throw():n}rawPipeOnce(e){return ue(e,"root")?this.toNode(e):this.distribute(n=>n.hasKind("morph")?this.$.node("morph",{in:n.inner.in,morphs:[...n.morphs,e]}):this.$.node("morph",{in:n,morphs:[e]}),this.$.parseSchema)}narrow(e){return this.constrainOut("predicate",e)}constrain(e,n){return this._constrain("root",e,n)}constrainIn(e,n){return this._constrain("in",e,n)}constrainOut(e,n){return this._constrain("out",e,n)}_constrain(e,n,r){const o=this.$.node(n,r);if(o.isRoot())return o.isUnknown()?this:wt(`Unexpected constraint node ${o}`);const u=e==="root"?this:this[e];if(u.hasKind("morph")||o.impliedBasis&&!u.extends(o.impliedBasis))return _2(n,o.impliedBasis,this);const c=this.$.node("intersection",{[o.kind]:o}),d=e==="out"?jp(this,c,this.$):Ki(this,c,this.$);return d instanceof se&&d.throw(),this.$.finalize(d)}onUndeclaredKey(e){const n=typeof e=="string"?e:e.rule,r=typeof e=="string"?!1:e.deep;return this.$.finalize(this.transform((o,u)=>o==="structure"?n==="ignore"?AD(u,{undeclared:1}):{...u,undeclared:n}:u,r?void 0:{shouldTransform:o=>!Jr(Wc,o.kind)}))}hasEqualMorphs(e){return!this.includesTransform&&!e.includesTransform?!0:!(!xo(this.shallowMorphs,e.shallowMorphs)||!xo(this.flatMorphs,e.flatMorphs,{isEqual:(n,r)=>n.propString===r.propString&&(n.node.hasKind("morph")&&r.node.hasKind("morph")?n.node.hasEqualMorphs(r.node):n.node.hasKind("intersection")&&r.node.hasKind("intersection")?n.node.structure?.structuralMorphRef===r.node.structure?.structuralMorphRef:!1)}))}onDeepUndeclaredKey(e){return this.onUndeclaredKey({rule:e,deep:!0})}filter(e){return this.constrainIn("predicate",e)}divisibleBy(e){return this.constrain("divisor",e)}matching(e){return this.constrain("pattern",e)}atLeast(e){return this.constrain("min",e)}atMost(e){return this.constrain("max",e)}moreThan(e){return this.constrain("min",to(e))}lessThan(e){return this.constrain("max",to(e))}atLeastLength(e){return this.constrain("minLength",e)}atMostLength(e){return this.constrain("maxLength",e)}moreThanLength(e){return this.constrain("minLength",to(e))}lessThanLength(e){return this.constrain("maxLength",to(e))}exactlyLength(e){return this.constrain("exactLength",e)}atOrAfter(e){return this.constrain("after",e)}atOrBefore(e){return this.constrain("before",e)}laterThan(e){return this.constrain("after",to(e))}earlierThan(e){return this.constrain("before",to(e))}}const vN="Expected a non-empty brand name after #",to=t=>typeof t=="object"&&!(t instanceof Date)?{...t,exclusive:!0}:{rule:t,exclusive:!0},Ku=(t,e)=>ue(e,"root")?ue(t,"root")?t.extends(e):e.allows(t):ue(t,"root")?t.hasUnit(e):e===t,RS=t=>t.hasKind("morph")?null:t.hasKind("intersection")?t.inner.structure??(t.basis?.domain==="object"?t.$.bindReference(Q.intrinsic.emptyStructure):null):t.isBasis()&&t.domain==="object"?t.$.bindReference(Q.intrinsic.emptyStructure):null,bN=t=>`Props cannot be extracted from a union. Use .distribute to extract props from each branch instead. Received:
|
|
89
|
-
${t}`,OS=(t,e)=>`${t} operand must be an object (was ${e})`,yl=(t,e)=>He(Km(t),(n,r)=>[r,e]),SN=t=>typeof t=="string"?{reference:t}:t,_S=t=>t instanceof se?Q.intrinsic.never.internal:t,xN=lt({kind:"alias",hasAssociatedError:!1,collapsibleKey:"reference",keys:{reference:{serialize:t=>t.startsWith("$")?t:`$ark.${t}`},resolve:{}},normalize:SN,defaults:{description:t=>t.reference},intersections:{alias:(t,e,n)=>n.$.lazilyResolve(()=>_S(Bt(t.resolution,e.resolution,n)),`${t.reference}${n.pipe?"=>":"&"}${e.reference}`),...yl("alias",(t,e,n)=>e.isUnknown()?t:e.isNever()?e:e.isBasis()&&!e.overlaps(Q.intrinsic.object)?se.init("assignability",Q.intrinsic.object,e):n.$.lazilyResolve(()=>_S(Bt(t.resolution,e,n)),`${t.reference}${n.pipe?"=>":"&"}${e.id}`))}});class wN extends ml{expression=this.reference;structure=void 0;get resolution(){const e=this._resolve();return jn[this.id]=e}_resolve(){if(this.resolve)return this.resolve();if(this.reference[0]==="$")return this.$.resolveRoot(this.reference.slice(1));const e=this.reference;let n=jn[e];const r=[];for(;ue(n,"context");){if(r.includes(n.id))return Y(AN(n.id,r));r.push(n.id),n=jn[n.id]}return ue(n,"root")?n:wt(`Unexpected resolution for reference ${this.reference}
|
|
90
|
-
Seen: [${r.join("->")}]
|
|
91
|
-
Resolution: ${Pe(n)}`)}get resolutionId(){if(this.reference.includes("&")||this.reference.includes("=>"))return this.resolution.id;if(this.reference[0]!=="$")return this.reference;const e=this.reference.slice(1),n=this.$.resolutions[e];return typeof n=="string"?n:ue(n,"root")?n.id:wt(`Unexpected resolution for reference ${this.reference}: ${Pe(n)}`)}get defaultShortDescription(){return Ui.object}innerToJsonSchema(e){return this.resolution.toJsonSchemaRecurse(e)}traverseAllows=(e,n)=>{const r=n.seen[this.reference];return r?.includes(e)?!0:(n.seen[this.reference]=Ie(r,e),this.resolution.traverseAllows(e,n))};traverseApply=(e,n)=>{const r=n.seen[this.reference];r?.includes(e)||(n.seen[this.reference]=Ie(r,e),this.resolution.traverseApply(e,n))};compile(e){const n=this.resolutionId;e.if(`ctx.seen.${n} && ctx.seen.${n}.includes(data)`,()=>e.return(!0)),e.if(`!ctx.seen.${n}`,()=>e.line(`ctx.seen.${n} = []`)),e.line(`ctx.seen.${n}.push(data)`),e.return(e.invoke(n))}}const AN=(t,e)=>`Alias '${t}' has a shallow resolution cycle: ${[...e,t].join("->")}`,Ym={implementation:xN,Node:wN};class Xm extends ml{traverseApply=(e,n)=>{this.traverseAllows(e,n)||n.errorFromNodeContext(this.errorContext)};get errorContext(){return{code:this.kind,description:this.description,meta:this.meta,...this.inner}}get compiledErrorContext(){return tf(this.errorContext)}compile(e){e.traversalKind==="Allows"?e.return(this.compiledCondition):e.if(this.compiledNegation,()=>e.line(`${e.ctx}.errorFromNodeContext(${this.compiledErrorContext})`))}}const TN=lt({kind:"domain",hasAssociatedError:!0,collapsibleKey:"domain",keys:{domain:{},numberAllowsNaN:{}},normalize:t=>typeof t=="string"?{domain:t}:Lm(t,"numberAllowsNaN")&&t.domain!=="number"?Y(Zm.writeBadAllowNanMessage(t.domain)):t,applyConfig:(t,e)=>t.numberAllowsNaN===void 0&&t.domain==="number"&&e.numberAllowsNaN?{...t,numberAllowsNaN:!0}:t,defaults:{description:t=>Ui[t.domain],actual:t=>Number.isNaN(t)?"NaN":Ui[Yn(t)]},intersections:{domain:(t,e)=>t.domain==="number"&&e.domain==="number"?t.numberAllowsNaN?e:t:se.init("domain",t,e)}});class EN extends Xm{requiresNaNCheck=this.domain==="number"&&!this.numberAllowsNaN;traverseAllows=this.requiresNaNCheck?e=>typeof e=="number"&&!Number.isNaN(e):e=>Yn(e)===this.domain;compiledCondition=this.domain==="object"?'((typeof data === "object" && data !== null) || typeof data === "function")':`typeof data === "${this.domain}"${this.requiresNaNCheck?" && !Number.isNaN(data)":""}`;compiledNegation=this.domain==="object"?'((typeof data !== "object" || data === null) && typeof data !== "function")':`typeof data !== "${this.domain}"${this.requiresNaNCheck?" || Number.isNaN(data)":""}`;expression=this.numberAllowsNaN?"number | NaN":this.domain;get nestableExpression(){return this.numberAllowsNaN?`(${this.expression})`:this.expression}get defaultShortDescription(){return Ui[this.domain]}innerToJsonSchema(e){return this.domain==="bigint"||this.domain==="symbol"?e.fallback.domain({code:"domain",base:{},domain:this.domain}):{type:this.domain}}}const Zm={implementation:TN,Node:EN,writeBadAllowNanMessage:t=>`numberAllowsNaN may only be specified with domain "number" (was ${t})`},RN=lt({kind:"intersection",hasAssociatedError:!0,normalize:t=>{if(Xt(t))return t;const{structure:e,...n}=t,r=!!e,o=e??{},u=He(n,(c,d)=>mi(c,m2)?(r&&Y(`Flattened structure key ${c} cannot be specified alongside a root 'structure' key.`),o[c]=d,[]):[c,d]);return(ue(o,"constraint")||!cl(o))&&(u.structure=o),u},finalizeInnerJson:({structure:t,...e})=>fs(t,"object")?{...t,...e}:e,keys:{domain:{child:!0,parse:(t,e)=>e.$.node("domain",t)},proto:{child:!0,parse:(t,e)=>e.$.node("proto",t)},structure:{child:!0,parse:(t,e)=>e.$.node("structure",t),serialize:t=>{if(!t.sequence?.minLength)return t.collapsibleJson;const{sequence:e,...n}=t.collapsibleJson,{minVariadicLength:r,...o}=e,u=o.variadic&&Object.keys(o).length===1?o.variadic:o;return{...n,sequence:u}}},divisor:{child:!0,parse:rn("divisor")},max:{child:!0,parse:rn("max")},min:{child:!0,parse:rn("min")},maxLength:{child:!0,parse:rn("maxLength")},minLength:{child:!0,parse:rn("minLength")},exactLength:{child:!0,parse:rn("exactLength")},before:{child:!0,parse:rn("before")},after:{child:!0,parse:rn("after")},pattern:{child:!0,parse:rn("pattern")},predicate:{child:!0,parse:rn("predicate")}},reduce:(t,e)=>MS({},t,{$:e,invert:!1,pipe:!1}),defaults:{description:t=>{if(t.children.length===0)return"unknown";if(t.structure)return t.structure.description;const e=[];if(t.basis&&!t.refinements.some(n=>n.impl.obviatesBasisDescription)&&e.push(t.basis.description),t.refinements.length){const n=t.refinements.toSorted((r,o)=>r.kind==="min"&&o.kind==="max"?-1:0).map(r=>r.description);e.push(...n)}return t.inner.predicate&&e.push(...t.inner.predicate.map(n=>n.description)),e.join(" and ")},expected:t=>` โฆ ${t.errors.map(e=>e.expected).join(`
|
|
92
|
-
โฆ `)}`,problem:t=>`(${t.actual}) must be...
|
|
93
|
-
${t.expected}`},intersections:{intersection:(t,e,n)=>MS(t.inner,e.inner,n),...yl("intersection",(t,e,n)=>{if(t.children.length===0)return e;const{domain:r,proto:o,...u}=t.inner,c=o??r,d=c?Bt(c,e,n):e;return d instanceof se?d:t?.basis?.equals(d)?t:t.$.node("intersection",{...u,[d.kind]:d},{prereduced:!0})})}});class ON extends ml{basis=this.inner.domain??this.inner.proto??null;refinements=this.children.filter(e=>e.isRefinement());structure=this.inner.structure;expression=_N(this);get shallowMorphs(){return this.inner.structure?.structuralMorph?[this.inner.structure.structuralMorph]:[]}get defaultShortDescription(){return this.basis?.defaultShortDescription??"present"}innerToJsonSchema(e){return this.children.reduce((n,r)=>r.isBasis()?r.toJsonSchemaRecurse(e):r.reduceJsonSchema(n,e),{})}traverseAllows=(e,n)=>this.children.every(r=>r.traverseAllows(e,n));traverseApply=(e,n)=>{const r=n.currentErrorCount;if(!(this.basis&&(this.basis.traverseApply(e,n),n.currentErrorCount>r))){if(this.refinements.length){for(let o=0;o<this.refinements.length-1;o++)if(this.refinements[o].traverseApply(e,n),n.failFast&&n.currentErrorCount>r)return;if(this.refinements.at(-1).traverseApply(e,n),n.currentErrorCount>r)return}if(!(this.structure&&(this.structure.traverseApply(e,n),n.currentErrorCount>r))&&this.inner.predicate){for(let o=0;o<this.inner.predicate.length-1;o++)if(this.inner.predicate[o].traverseApply(e,n),n.failFast&&n.currentErrorCount>r)return;this.inner.predicate.at(-1).traverseApply(e,n)}}};compile(e){if(e.traversalKind==="Allows"){for(const n of this.children)e.check(n);e.return(!0);return}if(e.initializeErrorCount(),this.basis&&(e.check(this.basis),this.children.length>1&&e.returnIfFail()),this.refinements.length){for(let n=0;n<this.refinements.length-1;n++)e.check(this.refinements[n]),e.returnIfFailFast();e.check(this.refinements.at(-1)),(this.structure||this.inner.predicate)&&e.returnIfFail()}if(this.structure&&(e.check(this.structure),this.inner.predicate&&e.returnIfFail()),this.inner.predicate){for(let n=0;n<this.inner.predicate.length-1;n++)e.check(this.inner.predicate[n]),e.returnIfFail();e.check(this.inner.predicate.at(-1))}}}const RA={implementation:RN,Node:ON},_N=t=>{let e=t.structure?.expression||`${t.basis&&!t.refinements.some(n=>n.impl.obviatesBasisExpression)?t.basis.nestableExpression+" ":""}${t.refinements.map(n=>n.expression).join(" & ")}`||"unknown";return e==="Array == 0"&&(e="[]"),e},MS=(t,e,n)=>{const r={},o=t.proto??t.domain,u=e.proto??e.domain,c=o?u?Bt(o,u,n):o:u;return c instanceof se?c:(c&&(r[c.kind]=c),Oc({kind:"intersection",baseInner:r,l:_c(t),r:_c(e),roots:[],ctx:n}))},MN=lt({kind:"morph",hasAssociatedError:!1,keys:{in:{child:!0,parse:(t,e)=>e.$.parseSchema(t)},morphs:{parse:ul,serialize:t=>t.map(e=>ue(e,"root")?e.json:Jt(e))},declaredIn:{child:!1,serialize:t=>t.json},declaredOut:{child:!1,serialize:t=>t.json}},normalize:t=>t,defaults:{description:t=>`a morph from ${t.in.description} to ${t.out?.description??"unknown"}`},intersections:{morph:(t,e,n)=>{if(!t.hasEqualMorphs(e))return Y(kN(t.expression,e.expression));const r=Bt(t.in,e.in,n);if(r instanceof se)return r;const o={morphs:t.morphs};if(t.declaredIn||e.declaredIn){const u=Bt(t.in,e.in,n);if(u instanceof se)return u.throw();o.declaredIn=u}if(t.declaredOut||e.declaredOut){const u=Bt(t.out,e.out,n);if(u instanceof se)return u.throw();o.declaredOut=u}return r.distribute(u=>n.$.node("morph",{...o,in:u}),n.$.parseSchema)},...yl("morph",(t,e,n)=>{const r=t.inner.in?Bt(t.inner.in,e,n):e;return r instanceof se?r:r.equals(t.inner.in)?t:n.$.node("morph",{...t.inner,in:r})})}});class CN extends ml{serializedMorphs=this.morphs.map(Jt);compiledMorphs=`[${this.serializedMorphs}]`;lastMorph=this.inner.morphs.at(-1);lastMorphIfNode=ue(this.lastMorph,"root")?this.lastMorph:void 0;introspectableIn=this.inner.in;introspectableOut=this.lastMorphIfNode?Object.assign(this.referencesById,this.lastMorphIfNode.referencesById)&&this.lastMorphIfNode.out:void 0;get shallowMorphs(){return Array.isArray(this.inner.in?.shallowMorphs)?[...this.inner.in.shallowMorphs,...this.morphs]:this.morphs}get in(){return this.declaredIn??this.inner.in?.in??Q.intrinsic.unknown.internal}get out(){return this.declaredOut??this.introspectableOut??Q.intrinsic.unknown.internal}declareIn(e){return this.$.node("morph",{...this.inner,declaredIn:e})}declareOut(e){return this.$.node("morph",{...this.inner,declaredOut:e})}expression=`(In: ${this.in.expression}) => ${this.lastMorphIfNode?"To":"Out"}<${this.out.expression}>`;get defaultShortDescription(){return this.in.meta.description??this.in.defaultShortDescription}innerToJsonSchema(e){return e.fallback.morph({code:"morph",base:this.in.toJsonSchemaRecurse(e),out:this.introspectableOut?.toJsonSchemaRecurse(e)??null})}compile(e){if(e.traversalKind==="Allows"){if(!this.introspectableIn)return;e.return(e.invoke(this.introspectableIn));return}this.introspectableIn&&e.line(e.invoke(this.introspectableIn)),e.line(`ctx.queueMorphs(${this.compiledMorphs})`)}traverseAllows=(e,n)=>!this.introspectableIn||this.introspectableIn.traverseAllows(e,n);traverseApply=(e,n)=>{this.introspectableIn&&this.introspectableIn.traverseApply(e,n),n.queueMorphs(this.morphs)};hasEqualMorphs(e){return xo(this.morphs,e.morphs,{isEqual:(n,r)=>n===r||ue(n,"root")&&ue(r,"root")&&n.equals(r)})}}const OA={implementation:MN,Node:CN},kN=(t,e)=>`The intersection of distinct morphs at a single path is indeterminate:
|
|
94
|
-
Left: ${t}
|
|
95
|
-
Right: ${e}`,DN=lt({kind:"proto",hasAssociatedError:!0,collapsibleKey:"proto",keys:{proto:{serialize:t=>zm(t)??us(t)},dateAllowsInvalid:{}},normalize:t=>{const e=typeof t=="string"?{proto:Ao[t]}:typeof t=="function"?Xt(t)?t:{proto:t}:typeof t.proto=="string"?{...t,proto:Ao[t.proto]}:t;return typeof e.proto!="function"&&Y(Cc.writeInvalidSchemaMessage(e.proto)),Lm(e,"dateAllowsInvalid")&&e.proto!==Date&&Y(Cc.writeBadInvalidDateMessage(e.proto)),e},applyConfig:(t,e)=>t.dateAllowsInvalid===void 0&&t.proto===Date&&e.dateAllowsInvalid?{...t,dateAllowsInvalid:!0}:t,defaults:{description:t=>t.builtinName?kD[t.builtinName]:`an instance of ${t.proto.name}`,actual:t=>t instanceof Date&&t.toString()==="Invalid Date"?"an invalid Date":Op(t)},intersections:{proto:(t,e)=>t.proto===Date&&e.proto===Date?t.dateAllowsInvalid?e:t:yS(t.proto,e.proto)?t:yS(e.proto,t.proto)?e:se.init("proto",t,e),domain:(t,e)=>e.domain==="object"?t:se.init("domain",Q.intrinsic.object.internal,e)}});class NN extends Xm{builtinName=zm(this.proto);serializedConstructor=this.json.proto;requiresInvalidDateCheck=this.proto===Date&&!this.dateAllowsInvalid;traverseAllows=this.requiresInvalidDateCheck?e=>e instanceof Date&&e.toString()!=="Invalid Date":e=>e instanceof this.proto;compiledCondition=`data instanceof ${this.serializedConstructor}${this.requiresInvalidDateCheck?' && data.toString() !== "Invalid Date"':""}`;compiledNegation=`!(${this.compiledCondition})`;innerToJsonSchema(e){switch(this.builtinName){case"Array":return{type:"array"};case"Date":return e.fallback.date?.({code:"date",base:{}})??e.fallback.proto({code:"proto",base:{},proto:this.proto});default:return e.fallback.proto({code:"proto",base:{},proto:this.proto})}}expression=this.dateAllowsInvalid?"Date | InvalidDate":this.proto.name;get nestableExpression(){return this.dateAllowsInvalid?`(${this.expression})`:this.expression}domain="object";get defaultShortDescription(){return this.description}}const Cc={implementation:DN,Node:NN,writeBadInvalidDateMessage:t=>`dateAllowsInvalid may only be specified with constructor Date (was ${t.name})`,writeInvalidSchemaMessage:t=>`instanceOf operand must be a function (was ${Yn(t)})`},$N=lt({kind:"union",hasAssociatedError:!0,collapsibleKey:"branches",keys:{ordered:{},branches:{child:!0,parse:(t,e)=>{const n=[];for(const r of t){const o=ue(r,"root")?r.branches:e.$.parseSchema(r).branches;for(const u of o)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]=e.$.node("morph",{...d.inner,in:d.in.rawOr(u.in)})}}else n.push(u)}return e.def.ordered||n.sort((r,o)=>r.hash<o.hash?-1:1),n}}},normalize:t=>Gt(t)?{branches:t}:t,reduce:(t,e)=>{const n=HN(t);if(n.length===1)return n[0];if(n.length!==t.branches.length)return e.node("union",{...t,branches:n},{prereduced:!0})},defaults:{description:t=>t.distribute(e=>e.description,po),expected:t=>{const e=yD(t.errors,"propString"),n=Object.entries(e).map(([r,o])=>{const u=[];for(const h of o)rs(u,h.expected);const c=po(u),d=o.every(h=>h.actual===o[0].actual)?o[0].actual:Pe(o[0].data);return`${r&&`${r} `}must be ${c}${d&&` (was ${d})`}`});return po(n)},problem:t=>t.expected,message:t=>t.problem},intersections:{union:(t,e,n)=>{if(t.isNever!==e.isNever)return se.init("presence",t,e);let r;return t.ordered?(e.ordered&&Y(GN(t.expression,e.expression)),r=Ph(e.branches,t.branches,n),r instanceof se&&r.invert()):r=Ph(t.branches,e.branches,n),r instanceof se?r:n.$.parseSchema(t.ordered||e.ordered?{branches:r,ordered:!0}:{branches:r})},...yl("union",(t,e,n)=>{const r=Ph(t.branches,[e],n);return r instanceof se?r:r.length===1?r[0]:n.$.parseSchema(t.ordered?{branches:r,ordered:!0}:{branches:r})})}});class jN extends ml{isBoolean=this.branches.length===2&&this.branches[0].hasUnit(!1)&&this.branches[1].hasUnit(!0);get branchGroups(){const e=[];let n=-1;for(const r of this.branches){if(r.hasKind("unit")&&r.domain==="boolean"){n===-1?(n=e.length,e.push(r)):e[n]=Q.intrinsic.boolean;continue}e.push(r)}return e}unitBranches=this.branches.filter(e=>e.in.hasKind("unit"));discriminant=this.discriminate();discriminantJson=this.discriminant?PN(this.discriminant):null;expression=this.distribute(e=>e.nestableExpression,IN);createBranchedOptimisticRootApply(){return(e,n)=>{const r=this.traverseOptimistic(e);if(r!==$i)return r;const o=new so(e,this.$.resolvedConfig);return this.traverseApply(e,o),o.finalize(n)}}get shallowMorphs(){return this.branches.reduce((e,n)=>rs(e,n.shallowMorphs),[])}get defaultShortDescription(){return this.distribute(e=>e.defaultShortDescription,po)}innerToJsonSchema(e){if(this.branchGroups.length===1&&this.branchGroups[0].equals(Q.intrinsic.boolean))return{type:"boolean"};const n=this.branchGroups.map(r=>r.toJsonSchemaRecurse(e));return n.every(r=>Object.keys(r).length===1&&Lm(r,"const"))?{enum:n.map(r=>r.const)}:{anyOf:n}}traverseAllows=(e,n)=>this.branches.some(r=>r.traverseAllows(e,n));traverseApply=(e,n)=>{const r=[];for(let o=0;o<this.branches.length;o++){if(n.pushBranch(),this.branches[o].traverseApply(e,n),!n.hasError())return this.branches[o].includesTransform?n.queuedMorphs.push(...n.popBranch().queuedMorphs):n.popBranch();r.push(n.popBranch().error)}n.errorFromNodeContext({code:"union",errors:r,meta:this.meta})};traverseOptimistic=e=>{for(let n=0;n<this.branches.length;n++){const r=this.branches[n];if(r.traverseAllows(e))return r.contextFreeMorph?r.contextFreeMorph(e):e}return $i};compile(e){if(!this.discriminant||this.unitBranches.length===this.branches.length&&this.branches.length===2)return this.compileIndiscriminable(e);let n=this.discriminant.optionallyChainedPropString;this.discriminant.kind==="domain"&&(n=`typeof ${n} === "object" ? ${n} === null ? "null" : "object" : typeof ${n} === "function" ? "object" : typeof ${n}`);const r=this.discriminant.cases,o=Object.keys(r),{optimistic:u}=e;if(e.optimistic=!1,e.block(`switch(${n})`,()=>{for(const y in r){const g=r[y],b=y==="default"?y:`case ${y}`;e.line(`${b}: return ${g===!0?u?e.data:g:u?`${e.invoke(g)} ? ${g.contextFreeMorph?`${Jt(g.contextFreeMorph)}(${e.data})`:e.data} : "${$i}"`:e.invoke(g)}`)}return e}),e.traversalKind==="Allows"){e.return(u?`"${$i}"`:!1);return}const c=po(this.discriminant.kind==="domain"?o.map(y=>{const g=y.slice(1,-1);return g==="function"?Ui.object:Ui[g]}):o),d=this.discriminant.path.map(y=>typeof y=="symbol"?Jt(y):JSON.stringify(y)),h=JSON.stringify(c),m=this.discriminant.kind==="domain"?`${UN}[${n}]`:`${qN}(${n})`;e.line(`ctx.errorFromNodeContext({
|
|
96
|
-
code: "predicate",
|
|
97
|
-
expected: ${h},
|
|
98
|
-
actual: ${m},
|
|
99
|
-
relativePath: [${d}],
|
|
100
|
-
meta: ${this.compiledMeta}
|
|
101
|
-
})`)}compileIndiscriminable(e){if(e.traversalKind==="Apply"){e.const("errors","[]");for(const n of this.branches)e.line("ctx.pushBranch()").line(e.invoke(n)).if("!ctx.hasError()",()=>e.return(n.includesTransform?"ctx.queuedMorphs.push(...ctx.popBranch().queuedMorphs)":"ctx.popBranch()")).line("errors.push(ctx.popBranch().error)");e.line(`ctx.errorFromNodeContext({ code: "union", errors, meta: ${this.compiledMeta} })`)}else{const{optimistic:n}=e;e.optimistic=!1;for(const r of this.branches)e.if(`${e.invoke(r)}`,()=>e.return(n?r.contextFreeMorph?`${Jt(r.contextFreeMorph)}(${e.data})`:e.data:!0));e.return(n?`"${$i}"`:!1)}}get nestableExpression(){return this.isBoolean?"boolean":`(${this.expression})`}discriminate(){if(this.branches.length<2||this.isCyclic)return null;if(this.unitBranches.length===this.branches.length){const u=He(this.unitBranches,(c,d)=>[`${d.in.serializedValue}`,d.hasKind("morph")?d:!0]);return{kind:"unit",path:[],optionallyChainedPropString:"data",cases:u}}const e=[];for(let u=0;u<this.branches.length-1;u++){const c=this.branches[u];for(let d=u+1;d<this.branches.length;d++){const h=this.branches[d],m=Ki(c.in,h.in,c.$);if(m instanceof se)for(const y of m){if(!y.kind||y.optional)continue;let g,b;if(y.kind==="domain"){const A=y.l,w=y.r;g=`"${typeof A=="string"?A:A.domain}"`,b=`"${typeof w=="string"?w:w.domain}"`}else if(y.kind==="unit")g=y.l.serializedValue,b=y.r.serializedValue;else continue;const x=e.find(A=>xo(A.path,y.path)&&A.kind===y.kind);x?(x.cases[g]?x.cases[g].branchIndices=rs(x.cases[g].branchIndices,u):x.cases[g]??={branchIndices:[u],condition:y.l},x.cases[b]?x.cases[b].branchIndices=rs(x.cases[b].branchIndices,d):x.cases[b]??={branchIndices:[d],condition:y.r}):e.push({kind:y.kind,cases:{[g]:{branchIndices:[u],condition:y.l},[b]:{branchIndices:[d],condition:y.r}},path:y.path})}}}const n=this.ordered?VN(e,this.branches):e;if(!n.length)return null;const r=BN(n,this),o={};for(const u in r.best.cases){const c=LN(r,u);if(c===null){o[u]=!0;continue}if(c.length===this.branches.length)return null;this.ordered&&c.sort((m,y)=>m.originalIndex-y.originalIndex);const d=c.map(m=>m.branch),h=d.length===1?d[0]:this.$.node("union",this.ordered?{branches:d,ordered:!0}:d);Object.assign(this.referencesById,h.referencesById),o[u]=h}if(r.defaultEntries.length){const u=r.defaultEntries.map(c=>c.branch);o.default=this.$.node("union",this.ordered?{branches:u,ordered:!0}:u,{prereduced:!0}),Object.assign(this.referencesById,o.default.referencesById)}return Object.assign(r.location,{cases:o})}}const BN=(t,e)=>{const n=t.sort((u,c)=>Object.keys(c.cases).length-Object.keys(u.cases).length)[0],r={kind:n.kind,path:n.path,optionallyChainedPropString:_A(n.path)},o=e.branches.map((u,c)=>({originalIndex:c,branch:u}));return{best:n,location:r,defaultEntries:o,node:e}},LN=(t,e)=>{const n=t.best.cases[e],r=zN(n.condition,t.location.path,t.node.$);let o=[];const u=[];for(let c=0;c<t.defaultEntries.length;c++){const d=t.defaultEntries[c];if(n.branchIndices.includes(d.originalIndex)){const h=CS(t.node.branches[d.originalIndex],t.location);h===null?o=null:o?.push({originalIndex:d.originalIndex,branch:h})}else if(d.branch.hasKind("alias")&&r.hasKind("domain")&&r.domain==="object")o?.push(d);else{if(d.branch.in.overlaps(r)){const h=CS(d.branch,t.location);o?.push({originalIndex:d.originalIndex,branch:h})}u.push(d)}}return t.defaultEntries=u,o},VN=(t,e)=>t.filter(r=>{const o=Object.values(r.cases).map(u=>u.branchIndices);for(let u=0;u<o.length-1;u++){const c=o[u];for(let d=u+1;d<o.length;d++){const h=o[d];for(const m of c)for(const y of h)if(m>y&&e[m].overlaps(e[y]))return!1}}return!0}),zN=(t,e,n)=>{let r=t==="undefined"?n.node("unit",{unit:void 0}):t==="null"?n.node("unit",{unit:null}):t==="boolean"?n.units([!0,!1]):t;for(let o=e.length-1;o>=0;o--){const u=e[o];r=n.node("intersection",typeof u=="number"?{proto:"Array",sequence:[...pD(u).map(c=>({})),r]}:{domain:"object",required:[{key:u,value:r}]})}return r},_A=t=>t.reduce((e,n)=>e+Zw(n,!0),"data"),UN=Jt(gD),qN=Jt(Pe),MA={implementation:$N,Node:jN},PN=t=>({kind:t.kind,path:t.path.map(e=>typeof e=="string"?e:pl(e)),cases:He(t.cases,(e,n)=>[e,n===!0?n:n.hasKind("union")&&n.discriminantJson?n.discriminantJson:n.json])}),KN={delimiter:" | ",finalDelimiter:" | "},IN=t=>po(t,KN),po=(t,e)=>{const n=e?.delimiter??", ",r=e?.finalDelimiter??" or ";if(t.length===0)return"never";if(t.length===1)return t[0];if(t.length===2&&t[0]==="false"&&t[1]==="true"||t[0]==="true"&&t[1]==="false")return"boolean";const o={},u=t.filter(d=>o[d]?!1:o[d]=!0),c=u.pop();return`${u.join(n)}${u.length?r:""}${c}`},Ph=(t,e,n)=>{const r=e.map(()=>[]);for(let u=0;u<t.length;u++){let c={};for(let d=0;d<e.length;d++){if(r[d]===null)continue;if(t[u].equals(e[d])){r[d]=null,c={};break}const h=Bt(t[u],e[d],n);if(!(h instanceof se)){if(h.equals(t[u])){r[d].push(t[u]),c={};break}h.equals(e[d])?r[d]=null:c[d]=h}}for(const d in c)r[d][u]=c[d]}const o=r.flatMap((u,c)=>u?.flatMap(d=>d.branches)??e[c]);return o.length===0?se.init("union",t,e):o},HN=({branches:t,ordered:e})=>{if(t.length<2)return t;const n=t.map(()=>!0);for(let r=0;r<t.length;r++)for(let o=r+1;o<t.length&&n[r]&&n[o];o++){if(t[r].equals(t[o])){n[o]=!1;continue}const u=Ki(t[r].in,t[o].in,t[0].$);u instanceof se||(e||FN(t[r],t[o]),u.equals(t[r].in)?n[r]=!!e:u.equals(t[o].in)&&(n[o]=!1))}return t.filter((r,o)=>n[o])},FN=(t,e)=>{!t.includesTransform&&!e.includesTransform||(xo(t.shallowMorphs,e.shallowMorphs)||Y(kS(t.expression,e.expression)),xo(t.flatMorphs,e.flatMorphs,{isEqual:(n,r)=>n.propString===r.propString&&(n.node.hasKind("morph")&&r.node.hasKind("morph")?n.node.hasEqualMorphs(r.node):n.node.hasKind("intersection")&&r.node.hasKind("intersection")?n.node.structure?.structuralMorphRef===r.node.structure?.structuralMorphRef:!1)})||Y(kS(t.expression,e.expression)))},CS=(t,e)=>t.transform((n,r)=>n==="domain"||n==="unit"?null:r,{shouldTransform:(n,r)=>{const o=_A(r.path);return e.optionallyChainedPropString.startsWith(o)?n.hasKind("domain")&&n.domain==="object"||(n.hasKind("domain")||e.kind==="unit")&&o===e.optionallyChainedPropString?!0:n.children.length!==0&&n.kind!=="index":!1}}),kS=(t,e)=>`An unordered union of a type including a morph and a type with overlapping input is indeterminate:
|
|
102
|
-
Left: ${t}
|
|
103
|
-
Right: ${e}`,GN=(t,e)=>`The intersection of two ordered unions is indeterminate:
|
|
104
|
-
Left: ${t}
|
|
105
|
-
Right: ${e}`,YN=lt({kind:"unit",hasAssociatedError:!0,keys:{unit:{preserveUndefined:!0,serialize:t=>t instanceof Date?t.toISOString():us(t)}},normalize:t=>t,defaults:{description:t=>Pe(t.unit),problem:({expected:t,actual:e})=>`${t===e?`must be reference equal to ${t} (serialized to the same value)`:`must be ${t} (was ${e})`}`},intersections:{unit:(t,e)=>se.init("unit",t,e),...yl("unit",(t,e)=>{if(e.allows(t.unit))return t;const n=e.hasKind("intersection")?e.basis:e;if(n){const r=n.hasKind("domain")?n:Q.intrinsic.object;if(t.domain!==r.domain){const o=t.domain==="undefined"||t.domain==="null"||t.domain==="boolean"?t.domain:Q.intrinsic[t.domain];return se.init("domain",o,r)}}return se.init("assignability",t,e.hasKind("intersection")?e.children.find(r=>!r.allows(t.unit)):e)})}});class XN extends Xm{compiledValue=this.json.unit;serializedValue=typeof this.unit=="string"||this.unit instanceof Date?JSON.stringify(this.compiledValue):`${this.compiledValue}`;compiledCondition=DS(this.unit,this.serializedValue);compiledNegation=DS(this.unit,this.serializedValue,"negated");expression=Pe(this.unit);domain=Yn(this.unit);get defaultShortDescription(){return this.domain==="object"?Ui.object:this.description}innerToJsonSchema(e){return this.unit===null?{type:"null"}:Q.intrinsic.jsonPrimitive.allows(this.unit)?{const:this.unit}:e.fallback.unit({code:"unit",base:{},unit:this.unit})}traverseAllows=this.unit instanceof Date?e=>e instanceof Date&&e.toISOString()===this.compiledValue:Number.isNaN(this.unit)?e=>Number.isNaN(e):e=>e===this.unit}const CA={implementation:YN,Node:XN},DS=(t,e,n)=>{if(t instanceof Date){const r=`data instanceof Date && data.toISOString() === ${e}`;return n?`!(${r})`:r}return Number.isNaN(t)?`${n?"!":""}Number.isNaN(data)`:`data ${n?"!":"="}== ${e}`},ZN=lt({kind:"index",hasAssociatedError:!1,intersectionIsOpen:!0,keys:{signature:{child:!0,parse:(t,e)=>{const n=e.$.parseSchema(t);if(!n.extends(Q.intrinsic.key))return Y(WN(n.expression));const r=n.branches.filter(o=>o.hasKind("unit"));return r.length?Y(QN(r.map(o=>Pe(o.unit)))):n}},value:{child:!0,parse:(t,e)=>e.$.parseSchema(t)}},normalize:t=>t,defaults:{description:t=>`[${t.signature.expression}]: ${t.value.description}`},intersections:{index:(t,e,n)=>{if(t.signature.equals(e.signature)){const r=Bt(t.value,e.value,n),o=r instanceof se?Q.intrinsic.never.internal:r;return n.$.node("index",{signature:t.signature,value:o})}return t.signature.extends(e.signature)&&t.value.subsumes(e.value)?e:e.signature.extends(t.signature)&&e.value.subsumes(t.value)?t:null}}});class JN extends No{impliedBasis=Q.intrinsic.object.internal;expression=`[${this.signature.expression}]: ${this.value.expression}`;flatRefs=Ie(this.value.flatRefs.map(e=>Ar([this.signature,...e.path],e.node)),Ar([this.signature],this.value));traverseAllows=(e,n)=>Ac(e).every(r=>this.signature.traverseAllows(r[0],n)?Pi(r[0],()=>this.value.traverseAllows(r[1],n),n):!0);traverseApply=(e,n)=>{for(const r of Ac(e))this.signature.traverseAllows(r[0],n)&&Pi(r[0],()=>this.value.traverseApply(r[1],n),n)};_transform(e,n){n.path.push(this.signature);const r=super._transform(e,n);return n.path.pop(),r}compile(){}}const kA={implementation:ZN,Node:JN},QN=t=>`Index keys ${t.join(", ")} should be specified as named props.`,WN=t=>`Indexed key definition '${t}' must be a string or symbol`,e$=lt({kind:"required",hasAssociatedError:!0,intersectionIsOpen:!0,keys:{key:{},value:{child:!0,parse:(t,e)=>e.$.parseSchema(t)}},normalize:t=>t,defaults:{description:t=>`${t.compiledKey}: ${t.value.description}`,expected:t=>t.missingValueDescription,actual:()=>"missing"},intersections:{required:Lp,optional:Lp}});class t$ extends AA{expression=`${this.compiledKey}: ${this.value.expression}`;errorContext=Object.freeze({code:"required",missingValueDescription:this.value.defaultShortDescription,relativePath:[this.key],meta:this.meta});compiledErrorContext=tf(this.errorContext)}const DA={implementation:e$,Node:t$},n$=lt({kind:"sequence",hasAssociatedError:!1,collapsibleKey:"variadic",keys:{prefix:{child:!0,parse:(t,e)=>{if(t.length!==0)return t.map(n=>e.$.parseSchema(n))}},optionals:{child:!0,parse:(t,e)=>{if(t.length!==0)return t.map(n=>e.$.parseSchema(n))}},defaultables:{child:t=>t.map(e=>e[0]),parse:(t,e)=>{if(t.length!==0)return t.map(n=>{const r=e.$.parseSchema(n[0]);return Gm(r,n[1],null),[r,n[1]]})},serialize:t=>t.map(e=>[e[0].collapsibleJson,us(e[1])])},variadic:{child:!0,parse:(t,e)=>e.$.parseSchema(t,e)},minVariadicLength:{parse:t=>t===0?void 0:t},postfix:{child:!0,parse:(t,e)=>{if(t.length!==0)return t.map(n=>e.$.parseSchema(n))}}},normalize:t=>{if(typeof t=="string")return{variadic:t};if("variadic"in t||"prefix"in t||"defaultables"in t||"optionals"in t||"postfix"in t||"minVariadicLength"in t){if(t.postfix?.length){if(!t.variadic)return Y(a$);if(t.optionals?.length||t.defaultables?.length)return Y($A)}return t.minVariadicLength&&!t.variadic?Y("minVariadicLength may not be specified without a variadic element"):t}return{variadic:t}},reduce:(t,e)=>{let n=t.minVariadicLength??0;const r=t.prefix?.slice()??[],o=t.defaultables?.slice()??[],u=t.optionals?.slice()??[],c=t.postfix?.slice()??[];if(t.variadic){for(;u.at(-1)?.equals(t.variadic);)u.pop();if(u.length===0&&o.length===0)for(;r.at(-1)?.equals(t.variadic);)r.pop(),n++;for(;c[0]?.equals(t.variadic);)c.shift(),n++}else u.length===0&&o.length===0&&r.push(...c.splice(0));if(n!==t.minVariadicLength||t.prefix&&t.prefix.length!==r.length)return e.node("sequence",{...t,prefix:r,defaultables:o,optionals:u,postfix:c,minVariadicLength:n},{prereduced:!0})},defaults:{description:t=>t.isVariadicOnly?`${t.variadic.nestableExpression}[]`:`[${t.tuple.map(n=>n.kind==="defaultables"?`${n.node.nestableExpression} = ${Pe(n.default)}`:n.kind==="optionals"?`${n.node.nestableExpression}?`:n.kind==="variadic"?`...${n.node.nestableExpression}[]`:n.node.expression).join(", ")}]`},intersections:{sequence:(t,e,n)=>{const r=qa({l:t.tuple,r:e.tuple,disjoint:new se,result:[],fixedVariants:[],ctx:n}),o=r.disjoint.length===0?[r,...r.fixedVariants]:r.fixedVariants;return o.length===0?r.disjoint:o.length===1?n.$.node("sequence",NS(o[0].result)):n.$.node("union",o.map(u=>({proto:Array,sequence:NS(u.result)})))}}});class i$ extends No{impliedBasis=Q.intrinsic.Array.internal;tuple=o$(this.inner);prefixLength=this.prefix?.length??0;defaultablesLength=this.defaultables?.length??0;optionalsLength=this.optionals?.length??0;postfixLength=this.postfix?.length??0;defaultablesAndOptionals=[];prevariadic=this.tuple.filter(e=>e.kind==="defaultables"||e.kind==="optionals"?(this.defaultablesAndOptionals.push(e.node),!0):e.kind==="prefix");variadicOrPostfix=es(this.variadic&&[this.variadic],this.postfix);flatRefs=this.addFlatRefs();addFlatRefs(){return xS(this.flatRefs,this.prevariadic.flatMap((e,n)=>Ie(e.node.flatRefs.map(r=>Ar([`${n}`,...r.path],r.node)),Ar([`${n}`],e.node)))),xS(this.flatRefs,this.variadicOrPostfix.flatMap(e=>Ie(e.flatRefs.map(n=>Ar([Q.intrinsic.nonNegativeIntegerString.internal,...n.path],n.node)),Ar([Q.intrinsic.nonNegativeIntegerString.internal],e)))),this.flatRefs}isVariadicOnly=this.prevariadic.length+this.postfixLength===0;minVariadicLength=this.inner.minVariadicLength??0;minLength=this.prefixLength+this.minVariadicLength+this.postfixLength;minLengthNode=this.minLength===0?null:this.$.node("minLength",this.minLength);maxLength=this.variadic?null:this.tuple.length;maxLengthNode=this.maxLength===null?null:this.$.node("maxLength",this.maxLength);impliedSiblings=this.minLengthNode?this.maxLengthNode?[this.minLengthNode,this.maxLengthNode]:[this.minLengthNode]:this.maxLengthNode?[this.maxLengthNode]:[];defaultValueMorphs=s$(this);defaultValueMorphsReference=this.defaultValueMorphs.length?Jt(this.defaultValueMorphs):void 0;elementAtIndex(e,n){if(n<this.prevariadic.length)return this.tuple[n];const r=e.length-this.postfixLength;return n>=r?{kind:"postfix",node:this.postfix[n-r]}:{kind:"variadic",node:this.variadic??wt(`Unexpected attempt to access index ${n} on ${this}`)}}traverseAllows=(e,n)=>{for(let r=0;r<e.length;r++)if(!this.elementAtIndex(e,r).node.traverseAllows(e[r],n))return!1;return!0};traverseApply=(e,n)=>{let r=0;for(;r<e.length;r++)Pi(r,()=>this.elementAtIndex(e,r).node.traverseApply(e[r],n),n)};get element(){return this.cacheGetter("element",this.$.node("union",this.children))}compile(e){if(this.prefix)for(const[n,r]of this.prefix.entries())e.traverseKey(`${n}`,`data[${n}]`,r);for(const[n,r]of this.defaultablesAndOptionals.entries()){const o=`${n+this.prefixLength}`;e.if(`${o} >= ${e.data}.length`,()=>e.traversalKind==="Allows"?e.return(!0):e.return()),e.traverseKey(o,`data[${o}]`,r)}if(this.variadic&&(this.postfix&&e.const("firstPostfixIndex",`${e.data}.length${this.postfix?`- ${this.postfix.length}`:""}`),e.for(`i < ${this.postfix?"firstPostfixIndex":"data.length"}`,()=>e.traverseKey("i","data[i]",this.variadic),this.prevariadic.length),this.postfix))for(const[n,r]of this.postfix.entries()){const o=`firstPostfixIndex + ${n}`;e.traverseKey(o,`data[${o}]`,r)}e.traversalKind==="Allows"&&e.return(!0)}_transform(e,n){n.path.push(Q.intrinsic.nonNegativeIntegerString.internal);const r=super._transform(e,n);return n.path.pop(),r}expression=this.description;reduceJsonSchema(e,n){if(this.prevariadic.length&&(e.prefixItems=this.prevariadic.map(r=>{const o=r.node.toJsonSchemaRecurse(n);if(r.kind==="defaultables"){const u=typeof r.default=="function"?r.default():r.default;o.default=Q.intrinsic.jsonData.allows(u)?u:n.fallback.defaultValue({code:"defaultValue",base:o,value:u})}return o})),this.minLength&&(e.minItems=this.minLength),this.variadic){const r=Object.assign(e,{items:this.variadic.toJsonSchemaRecurse(n)});if(this.maxLength&&(r.maxItems=this.maxLength),this.postfix){const o=this.postfix.map(u=>u.toJsonSchemaRecurse(n));e=n.fallback.arrayPostfix({code:"arrayPostfix",base:r,elements:o})}}else e.items=!1,delete e.maxItems;return e}}const r$={},s$=t=>{if(!t.defaultables)return[];const e=[];let n="[";const r=t.prefixLength+t.defaultablesLength-1;for(let o=t.prefixLength;o<=r;o++){const[u,c]=t.defaultables[o-t.prefixLength];e.push(EA(o,u,c)),n+=`${o}: ${u.id} = ${us(c)}, `}return n+="]",r$[n]??=e},NA={implementation:n$,Node:i$},o$=t=>{const e=[];if(t.prefix)for(const n of t.prefix)e.push({kind:"prefix",node:n});if(t.defaultables)for(const[n,r]of t.defaultables)e.push({kind:"defaultables",node:n,default:r});if(t.optionals)for(const n of t.optionals)e.push({kind:"optionals",node:n});if(t.variadic&&e.push({kind:"variadic",node:t.variadic}),t.postfix)for(const n of t.postfix)e.push({kind:"postfix",node:n});return e},NS=t=>t.reduce((e,n)=>(n.kind==="variadic"?e.variadic=n.node:n.kind==="defaultables"?e.defaultables=Ie(e.defaultables,[[n.node,n.default]]):e[n.kind]=Ie(e[n.kind],n.node),e),{}),$A="A postfix required element cannot follow an optional or defaultable element",a$="A postfix element requires a variadic element",qa=t=>{const[e,...n]=t.l,[r,...o]=t.r;if(!e||!r)return t;const u=n.at(-1)?.kind==="postfix",c=o.at(-1)?.kind==="postfix",d=e.kind==="prefix"||r.kind==="prefix"?"prefix":e.kind==="postfix"||r.kind==="postfix"?"postfix":e.kind==="variadic"&&r.kind==="variadic"?"variadic":u||c?"prefix":e.kind==="defaultables"||r.kind==="defaultables"?"defaultables":"optionals";if(e.kind==="prefix"&&r.kind==="variadic"&&c){const g=qa({...t,fixedVariants:[],r:o.map(b=>({...b,kind:"prefix"}))});g.disjoint.length===0&&t.fixedVariants.push(g)}else if(r.kind==="prefix"&&e.kind==="variadic"&&u){const g=qa({...t,fixedVariants:[],l:n.map(b=>({...b,kind:"prefix"}))});g.disjoint.length===0&&t.fixedVariants.push(g)}const h=Bt(e.node,r.node,t.ctx);if(h instanceof se)if(d==="prefix"||d==="postfix")t.disjoint.push(...h.withPrefixKey(d==="prefix"?t.result.length:`-${n.length+1}`,"required")),t.result=[...t.result,{kind:d,node:Q.intrinsic.never.internal}];else return d==="optionals"||d==="defaultables"?t:qa({...t,fixedVariants:[],l:n.map(g=>({...g,kind:"prefix"})),r:n.map(g=>({...g,kind:"prefix"}))});else d==="defaultables"?(e.kind==="defaultables"&&r.kind==="defaultables"&&e.default!==r.default&&Y(TA(e.default,r.default)),t.result=[...t.result,{kind:d,node:h,default:e.kind==="defaultables"?e.default:r.kind==="defaultables"?r.default:wt(`Unexpected defaultable intersection from ${e.kind} and ${r.kind} elements.`)}]):t.result=[...t.result,{kind:d,node:h}];const m=t.l.length,y=t.r.length;return(e.kind!=="variadic"||m>=y&&(r.kind==="variadic"||y===1))&&(t.l=n),(r.kind!=="variadic"||y>=m&&(e.kind==="variadic"||m===1))&&(t.r=o),qa(t)},jA=t=>e=>{if(e.props.length||e.index){const n=e.index?.map(o=>o[t])??[];for(const o of e.props)n.push(o[t]);e.undeclared&&n.push(`+ (undeclared): ${e.undeclared}`);const r=`{ ${n.join(", ")} }`;return e.sequence?`${r} & ${e.sequence.description}`:r}return e.sequence?.description??"{}"},l$=jA("description"),u$=jA("expression"),$S=(t,e,n)=>{const r=t.required?"required":"optional";if(!e.signature.allows(t.key))return null;const o=Ki(t.value,e.value,n);return o instanceof se?r==="optional"?n.node("optional",{key:t.key,value:Q.intrinsic.never.internal}):o.withPrefixKey(t.key,t.kind):null},c$=lt({kind:"structure",hasAssociatedError:!1,normalize:t=>t,applyConfig:(t,e)=>!t.undeclared&&e.onUndeclaredKey!=="ignore"?{...t,undeclared:e.onUndeclaredKey}:t,keys:{required:{child:!0,parse:rn("required"),reduceIo:(t,e,n)=>{e.required=Ie(e.required,n.map(r=>r[t]))}},optional:{child:!0,parse:rn("optional"),reduceIo:(t,e,n)=>{if(t==="in"){e.optional=n.map(r=>r.in);return}for(const r of n)e[r.outProp.kind]=Ie(e[r.outProp.kind],r.outProp.out)}},index:{child:!0,parse:rn("index")},sequence:{child:!0,parse:rn("sequence")},undeclared:{parse:t=>t==="ignore"?void 0:t,reduceIo:(t,e,n)=>{n==="delete"&&(t==="in"?delete e.undeclared:e.undeclared="reject")}}},defaults:{description:l$},intersections:{structure:(t,e,n)=>{const r={...t.inner},o={...e.inner},u=new se;if(t.undeclared){const h=t.keyof();for(const m of e.requiredKeys)h.allows(m)||u.add("presence",Q.intrinsic.never.internal,e.propsByKey[m].value,{path:[m]});o.optional&&(o.optional=o.optional.filter(m=>h.allows(m.key))),o.index&&(o.index=o.index.flatMap(m=>{if(m.signature.extends(h))return m;const y=Ki(h,m.signature,n.$);if(y instanceof se)return[];const g=Vp(y,m.value,n.$);return g.required&&(o.required=es(o.required,g.required)),g.optional&&(o.optional=es(o.optional,g.optional)),g.index??[]}))}if(e.undeclared){const h=e.keyof();for(const m of t.requiredKeys)h.allows(m)||u.add("presence",t.propsByKey[m].value,Q.intrinsic.never.internal,{path:[m]});r.optional&&(r.optional=r.optional.filter(m=>h.allows(m.key))),r.index&&(r.index=r.index.flatMap(m=>{if(m.signature.extends(h))return m;const y=Ki(h,m.signature,n.$);if(y instanceof se)return[];const g=Vp(y,m.value,n.$);return g.required&&(r.required=es(r.required,g.required)),g.optional&&(r.optional=es(r.optional,g.optional)),g.index??[]}))}const c={};(t.undeclared||e.undeclared)&&(c.undeclared=t.undeclared==="reject"||e.undeclared==="reject"?"reject":"delete");const d=Oc({kind:"structure",baseInner:c,l:_c(r),r:_c(o),roots:[],ctx:n});return d instanceof se&&u.push(...d),u.length?u:d}},reduce:(t,e)=>{if(t.index){if(!(t.required||t.optional))return;let n=!1;const r=t.required??[],o=t.optional??[],u=[...o];for(const c of t.index){for(const d of r){const h=$S(d,c,e);if(h instanceof se)return h}for(const[d,h]of o.entries()){const m=$S(h,c,e);if(m instanceof se)return m;m!==null&&(u[d]=m,n=!0)}}if(n)return e.node("structure",{...t,optional:u},{prereduced:!0})}}});class f$ extends No{impliedBasis=Q.intrinsic.object.internal;impliedSiblings=this.children.flatMap(e=>e.impliedSiblings??[]);props=es(this.required,this.optional);propsByKey=He(this.props,(e,n)=>[n.key,n]);propsByKeyReference=Jt(this.propsByKey);expression=u$(this);requiredKeys=this.required?.map(e=>e.key)??[];optionalKeys=this.optional?.map(e=>e.key)??[];literalKeys=[...this.requiredKeys,...this.optionalKeys];_keyof;keyof(){if(this._keyof)return this._keyof;let e=this.$.units(this.literalKeys).branches;if(this.index)for(const{signature:n}of this.index)e=e.concat(n.branches);return this._keyof=this.$.node("union",e)}map(e){return this.$.node("structure",this.props.flatMap(e).reduce((n,r)=>{const o=this.propsByKey[r.key];if(Xt(r))return r.kind!=="required"&&r.kind!=="optional"?Y(`Map result must have kind "required" or "optional" (was ${r.kind})`):(n[r.kind]=Ie(n[r.kind],r),n);const u=r.kind??o?.kind??"required",c=He(r,(d,h)=>d in Fm.implementation.keys?[d,h]:[]);return n[u]=Ie(n[u],this.$.node(u,c)),n},{}))}assertHasKeys(e){const n=e.filter(r=>!Ku(r,this.keyof()));if(n.length)return Y(jS(this.expression,n))}get(e,...n){let r,o=!1;const u=m$(e);if((typeof u=="string"||typeof u=="symbol")&&this.propsByKey[u]&&(r=this.propsByKey[u].value,o=this.propsByKey[u].required),this.index)for(const d of this.index)Ku(u,d.signature)&&(r=r?.and(d.value)??d.value);if(this.sequence&&Ku(u,Q.intrinsic.nonNegativeIntegerString))if(ue(u,"root"))this.sequence.variadic&&(r=r?.and(this.sequence.element)??this.sequence.element);else{const d=Number.parseInt(u);if(d<this.sequence.prevariadic.length){const h=this.sequence.prevariadic[d].node;r=r?.and(h)??h,o||=d<this.sequence.prefixLength}else if(this.sequence.variadic){const h=this.$.node("union",this.sequence.variadicOrPostfix);r=r?.and(h)??h}}if(!r)return this.sequence?.variadic&&ue(u,"root")&&u.extends(Q.intrinsic.number)?Y(y$(u.expression,this.sequence.expression)):Y(jS(this.expression,[u]));const c=r.get(...n);return o?c:c.or(Q.intrinsic.undefined)}pick(...e){return this.assertHasKeys(e),this.$.node("structure",this.filterKeys("pick",e))}omit(...e){return this.assertHasKeys(e),this.$.node("structure",this.filterKeys("omit",e))}optionalize(){const{required:e,...n}=this.inner;return this.$.node("structure",{...n,optional:this.props.map(r=>r.hasKind("required")?this.$.node("optional",r.inner):r)})}require(){const{optional:e,...n}=this.inner;return this.$.node("structure",{...n,required:this.props.map(r=>r.hasKind("optional")?{key:r.key,value:r.value}:r)})}merge(e){const n=this.filterKeys("omit",[e.keyof()]);return e.required&&(n.required=Ie(n.required,e.required)),e.optional&&(n.optional=Ie(n.optional,e.optional)),e.index&&(n.index=Ie(n.index,e.index)),e.sequence&&(n.sequence=e.sequence),e.undeclared?n.undeclared=e.undeclared:delete n.undeclared,this.$.node("structure",n)}filterKeys(e,n){const r=Qw(this.inner),o=u=>{const c=n.some(d=>Ku(u,d));return e==="pick"?c:!c};return r.required&&(r.required=r.required.filter(u=>o(u.key))),r.optional&&(r.optional=r.optional.filter(u=>o(u.key))),r.index&&(r.index=r.index.filter(u=>o(u.signature))),r}traverseAllows=(e,n)=>this._traverse("Allows",e,n);traverseApply=(e,n)=>this._traverse("Apply",e,n);_traverse=(e,n,r)=>{const o=r?.currentErrorCount??0;for(let u=0;u<this.props.length;u++)if(e==="Allows"){if(!this.props[u].traverseAllows(n,r))return!1}else if(this.props[u].traverseApply(n,r),r.failFast&&r.currentErrorCount>o)return!1;if(this.sequence){if(e==="Allows"){if(!this.sequence.traverseAllows(n,r))return!1}else if(this.sequence.traverseApply(n,r),r.failFast&&r.currentErrorCount>o)return!1}if(this.index||this.undeclared==="reject"){const u=Object.keys(n);u.push(...Object.getOwnPropertySymbols(n));for(let c=0;c<u.length;c++){const d=u[c];if(this.index){for(const h of this.index)if(h.signature.traverseAllows(d,r)){if(e==="Allows"){if(!Pi(d,()=>h.value.traverseAllows(n[d],r),r))return!1}else if(Pi(d,()=>h.value.traverseApply(n[d],r),r),r.failFast&&r.currentErrorCount>o)return!1}}if(this.undeclared==="reject"&&!this.declaresKey(d)&&(e==="Allows"||(r.errorFromNodeContext({code:"predicate",expected:"removed",actual:"",relativePath:[d],meta:this.meta}),r.failFast)))return!1}}return this.structuralMorph&&r&&!r.hasError()&&r.queueMorphs([this.structuralMorph]),!0};get defaultable(){return this.cacheGetter("defaultable",this.optional?.filter(e=>e.hasDefault())??[])}declaresKey=e=>e in this.propsByKey||this.index?.some(n=>n.signature.allows(e))||this.sequence!==void 0&&Q.intrinsic.nonNegativeIntegerString.allows(e);_compileDeclaresKey(e){const n=[];if(this.props.length&&n.push(`k in ${this.propsByKeyReference}`),this.index)for(const r of this.index)n.push(e.invoke(r.signature,{kind:"Allows",arg:"k"}));return this.sequence&&n.push("$ark.intrinsic.nonNegativeIntegerString.allows(k)"),n.join(" || ")||"false"}get structuralMorph(){return this.cacheGetter("structuralMorph",h$(this))}structuralMorphRef=this.structuralMorph&&Jt(this.structuralMorph);compile(e){e.traversalKind==="Apply"&&e.initializeErrorCount();for(const n of this.props)e.check(n),e.traversalKind==="Apply"&&e.returnIfFailFast();if(this.sequence&&(e.check(this.sequence),e.traversalKind==="Apply"&&e.returnIfFailFast()),(this.index||this.undeclared==="reject")&&(e.const("keys","Object.keys(data)"),e.line("keys.push(...Object.getOwnPropertySymbols(data))"),e.for("i < keys.length",()=>this.compileExhaustiveEntry(e))),e.traversalKind==="Allows")return e.return(!0);this.structuralMorphRef&&e.if("ctx && !ctx.hasError()",()=>(e.line("ctx.queueMorphs(["),p$(e,this),e.line("])")))}compileExhaustiveEntry(e){if(e.const("k","keys[i]"),this.index)for(const n of this.index)e.if(`${e.invoke(n.signature,{arg:"k",kind:"Allows"})}`,()=>e.traverseKey("k","data[k]",n.value));return this.undeclared==="reject"&&e.if(`!(${this._compileDeclaresKey(e)})`,()=>e.traversalKind==="Allows"?e.return(!1):e.line(`ctx.errorFromNodeContext({ code: "predicate", expected: "removed", actual: "", relativePath: [k], meta: ${this.compiledMeta} })`).if("ctx.failFast",()=>e.return())),e}reduceJsonSchema(e,n){switch(e.type){case"object":return this.reduceObjectJsonSchema(e,n);case"array":const r=this.sequence?.reduceJsonSchema(e,n)??e;return this.props.length||this.index?n.fallback.arrayObject({code:"arrayObject",base:r,object:this.reduceObjectJsonSchema({type:"object"},n)}):r;default:return Ot.throwInternalOperandError("structure",e)}}reduceObjectJsonSchema(e,n){if(this.props.length){e.properties={};for(const r of this.props){const o=r.value.toJsonSchemaRecurse(n);if(typeof r.key=="symbol"){n.fallback.symbolKey({code:"symbolKey",base:e,key:r.key,value:o,optional:r.optional});continue}if(r.hasDefault()){const u=typeof r.default=="function"?r.default():r.default;o.default=Q.intrinsic.jsonData.allows(u)?u:n.fallback.defaultValue({code:"defaultValue",base:o,value:u})}e.properties[r.key]=o}this.requiredKeys.length&&e.properties&&(e.required=this.requiredKeys.filter(r=>typeof r=="string"&&r in e.properties))}if(this.index)for(const r of this.index){const o=r.value.toJsonSchemaRecurse(n);if(r.signature.equals(Q.intrinsic.string)){e.additionalProperties=o;continue}for(const u of r.signature.branches){if(!u.extends(Q.intrinsic.string)){e=n.fallback.symbolKey({code:"symbolKey",base:e,key:null,value:o,optional:!1});continue}let c={type:"string"};if(u.hasKind("morph")&&(c=n.fallback.morph({code:"morph",base:u.in.toJsonSchemaRecurse(n),out:u.out.toJsonSchemaRecurse(n)})),!u.hasKind("intersection"))return wt(`Unexpected index branch kind ${u.kind}.`);const{pattern:d}=u.inner;if(d){const h=Object.assign(c,{pattern:d[0].rule});for(let m=1;m<d.length;m++)c=n.fallback.patternIntersection({code:"patternIntersection",base:h,pattern:d[m].rule});e.patternProperties??={},e.patternProperties[h.pattern]=o}}}return this.undeclared&&!e.additionalProperties&&(e.additionalProperties=!1),e}}const Kh={},d$=t=>{let e="";for(let n=0;n<t.defaultable.length;n++)e+=t.defaultable[n].defaultValueMorphRef;if(t.sequence?.defaultValueMorphsReference&&(e+=t.sequence?.defaultValueMorphsReference),t.undeclared==="delete"){if(e+="delete !(",t.required)for(const n of t.required)e+=n.compiledKey+" | ";if(t.optional)for(const n of t.optional)e+=n.compiledKey+" | ";if(t.index)for(const n of t.index)e+=n.signature.id+" | ";if(t.sequence)if(t.sequence.maxLength===null)e+=pe.nonNegativeIntegerString.id;else for(let n=0;n<t.sequence.tuple.length;n++)e+=n+" | ";e+=")"}return e},h$=t=>{const e=d$(t);if(!e)return;if(Kh[e])return Kh[e];const n=(r,o)=>{for(let u=0;u<t.defaultable.length;u++)t.defaultable[u].key in r||t.defaultable[u].defaultValueMorph(r,o);if(t.sequence?.defaultables)for(let u=r.length-t.sequence.prefixLength;u<t.sequence.defaultables.length;u++)t.sequence.defaultValueMorphs[u](r,o);if(t.undeclared==="delete")for(const u in r)t.declaresKey(u)||delete r[u];return r};return Kh[e]=n},p$=(t,e)=>{const r=`(data${e.defaultable.some(o=>o.defaultValueMorph.length===2)||e.sequence?.defaultValueMorphs.some(o=>o.length===2)?", ctx":""})`;return t.block(`${r} => `,o=>{for(let u=0;u<e.defaultable.length;u++){const{serializedKey:c,defaultValueMorphRef:d}=e.defaultable[u];o.if(`!(${c} in data)`,h=>h.line(`${d}${r}`))}return e.sequence?.defaultables&&o.for(`i < ${e.sequence.defaultables.length}`,u=>u.set("data[i]",5),`data.length - ${e.sequence.prefixLength}`),e.undeclared==="delete"&&o.forIn("data",u=>u.if(`!(${e._compileDeclaresKey(u)})`,c=>c.line("delete data[k]"))),o.return("data")})},BA={implementation:c$,Node:f$},m$=t=>(ue(t,"root")&&t.hasKind("unit")&&(t=t.unit),typeof t=="number"&&(t=`${t}`),t),y$=(t,e)=>`${t} is not allowed as an array index on ${e}. Use the 'nonNegativeIntegerString' keyword instead.`,Vp=(t,e,n)=>{const[r,o]=hD(t.branches,c=>c.hasKind("unit"));if(!r.length)return{index:n.node("index",{signature:t,value:e})};const u={};for(const c of r){const d=n.node("required",{key:c.unit,value:e});u[d.kind]=Ie(u[d.kind],d)}return o.length&&(u.index=n.node("index",{signature:o,value:e})),u},g$=t=>ue(t,"root")?t.expression:Pe(t),jS=(t,e)=>`Key${e.length===1?"":"s"} ${e.map(g$).join(", ")} ${e.length===1?"does":"do"} not exist on ${t}`,rf={...sN,alias:Ym.implementation,domain:Zm.implementation,unit:CA.implementation,proto:Cc.implementation,union:MA.implementation,morph:OA.implementation,intersection:RA.implementation,divisor:lA.implementation,pattern:SA.implementation,predicate:aA.implementation,required:DA.implementation,optional:Fm.implementation,index:kA.implementation,sequence:NA.implementation,structure:BA.implementation};Q.defaultConfig=ED(Object.assign(He(rf,(t,e)=>[t,e.defaults]),{jitless:jD(),clone:DD,onUndeclaredKey:"ignore",exactOptionalPropertyTypes:!0,numberAllowsNaN:!1,dateAllowsInvalid:!1,onFail:null,keywords:{},toJsonSchema:Ot.defaultConfig}));Q.resolvedConfig=Np(Q.defaultConfig,Q.config);const v$={...oN,alias:Ym.Node,domain:Zm.Node,unit:CA.Node,proto:Cc.Node,union:MA.Node,morph:OA.Node,intersection:RA.Node,divisor:lA.Node,pattern:SA.Node,predicate:aA.Node,required:DA.Node,optional:Fm.Node,index:kA.Node,sequence:NA.Node,structure:BA.Node};class zp extends SD{get[qi](){return"module"}}const LA=(t,e)=>new zp(He(t,(n,r)=>[n,ue(r,"module")?LA(r,e):e.bindReference(r)])),b$=t=>Gt(t)?t:"branches"in t&&Gt(t.branches)?t.branches:void 0,S$=(t,e)=>Y(`Node of kind ${e} is not valid as a ${t} definition`),BS=t=>`#${t} duplicates public alias ${t}`,Ih={};Q.ambient??={};let LS;const VA="function $",x$=t=>zA(t,UA(t)),zA=(t,e)=>{const n=e.write(VA,4),r=e.compile()();for(const o of t)o.precompilation||(o.traverseAllows=r[`${o.id}Allows`].bind(r),o.isRoot()&&!o.allowsRequiresContext&&(o.allows=o.traverseAllows),o.traverseApply=r[`${o.id}Apply`].bind(r),r[`${o.id}Optimistic`]&&(o.traverseOptimistic=r[`${o.id}Optimistic`].bind(r)),o.precompilation=n)},UA=t=>new Xw().return(t.reduce((e,n)=>{const r=new qh({kind:"Allows"}).indent();n.compile(r);const o=r.write(`${n.id}Allows`),u=new qh({kind:"Apply"}).indent();n.compile(u);const c=u.write(`${n.id}Apply`),d=`${e}${o},
|
|
106
|
-
${c},
|
|
107
|
-
`;if(!n.hasKind("union"))return d;const h=new qh({kind:"Allows",optimistic:!0}).indent();n.compile(h);const m=h.write(`${n.id}Optimistic`);return`${d}${m},
|
|
108
|
-
`},`{
|
|
109
|
-
`)+"}");class qA{config;resolvedConfig;name;get[qi](){return"scope"}referencesById={};references=[];resolutions={};exportedNames=[];aliases={};resolved=!1;nodesByHash={};intrinsic;constructor(e,n){this.config=Np(Q.config,n),this.resolvedConfig=Np(Q.resolvedConfig,n),this.name=this.resolvedConfig.name??`anonymousScope${Object.keys(Ih).length}`,this.name in Ih&&Y(`A Scope already named ${this.name} already exists`),Ih[this.name]=this;const r=Object.entries(e).map(o=>this.preparseOwnAliasEntry(...o));for(const[o,u]of r){let c=o;if(o[0]==="#"?(c=o.slice(1),c in this.aliases&&Y(BS(c)),this.aliases[c]=u):(c in this.aliases&&Y(BS(o)),this.aliases[c]=u,this.exportedNames.push(c)),!ue(u,"module")&&!ue(u,"generic")&&!Jc(u)){const d=this.preparseOwnDefinitionFormat(u,{alias:c});this.resolutions[c]=ue(d,"root")?this.bindReference(d):this.createParseContext(d).id}}LS??=this.node("union",{branches:["string","number","object","bigint","symbol",{unit:!0},{unit:!1},{unit:void 0},{unit:null}]},{prereduced:!0}),this.nodesByHash[LS.hash]=this.node("intersection",{},{prereduced:!0}),this.intrinsic=Q.intrinsic?He(Q.intrinsic,(o,u)=>o.startsWith("json")?[]:[o,this.bindReference(u)]):{}}cacheGetter(e,n){return Object.defineProperty(this,e,{value:n}),n}get internal(){return this}_json;get json(){return this._json||this.export(),this._json}defineSchema(e){return e}generic=(...e)=>{const n=this;return(r,o)=>new Mc(e,o?new oA(r):r,n,n,o??null)};units=(e,n)=>{const r=[];for(const u of e)r.includes(u)||r.push(u);const o=r.map(u=>this.node("unit",{unit:u},n));return this.node("union",o,{...n,prereduced:!0})};lazyResolutions=[];lazilyResolve(e,n){const r=this.node("alias",{reference:n??"synthetic",resolve:e},{prereduced:!0});return this.resolved||this.lazyResolutions.push(r),r}schema=(e,n)=>this.finalize(this.parseSchema(e,n));parseSchema=(e,n)=>this.node(nc(e),e,n);preparseNode(e,n,r){let o=typeof e=="string"?e:nc(n,e);if(Xt(n)&&n.kind===o)return n;if(o==="alias"&&!r?.prereduced){const{reference:d}=Ym.implementation.normalize(n,this);if(d.startsWith("$")){const h=this.resolveRoot(d.slice(1));n=h,o=h.kind}}else if(o==="union"&&fs(n,"object")){const d=b$(n);d?.length===1&&(n=d[0],o=nc(n))}if(Xt(n)&&n.kind===o)return n;const c=rf[o].normalize?.(n,this)??n;return Xt(c)?c.kind===o?c:S$(o,c.kind):{...r,$:this,kind:o,def:c,prefix:r.alias??o}}bindReference(e){let n;return Xt(e)?n=e.$===this?e:new e.constructor(e.attachments,this):n=e.$===this?e:new Mc(e.params,e.bodyDef,e.$,this,e.hkt),this.resolved||Object.assign(this.referencesById,n.referencesById),n}resolveRoot(e){return this.maybeResolveRoot(e)??Y(HA(e))}maybeResolveRoot(e){const n=this.maybeResolve(e);if(!ue(n,"generic"))return n}maybeResolveSubalias(e){return Up(this.aliases,e)??Up(this.ambient,e)}get ambient(){return Q.ambient}maybeResolve(e){const n=this.resolutions[e];if(n){if(typeof n!="string")return this.bindReference(n);const o=jn[n];if(ue(o,"root"))return this.resolutions[e]=o;if(ue(o,"context")){if(o.phase==="resolving")return this.node("alias",{reference:`$${e}`},{prereduced:!0});if(o.phase==="resolved")return wt(`Unexpected resolved context for was uncached by its scope: ${Pe(o)}`);o.phase="resolving";const u=this.bindReference(this.parseOwnDefinitionFormat(o.def,o));return o.phase="resolved",jn[u.id]=u,jn[o.id]=u,this.resolutions[e]=u}return wt(`Unexpected nodesById entry for ${n}: ${Pe(o)}`)}let r=this.aliases[e]??this.ambient?.[e];return r?(r=this.normalizeRootScopeValue(r),ue(r,"generic")?this.resolutions[e]=this.bindReference(r):ue(r,"module")?(r.root||Y(FA(e)),this.resolutions[e]=this.bindReference(r.root)):this.resolutions[e]=this.parse(r,{alias:e})):this.maybeResolveSubalias(e)}createParseContext(e){const n=e.id??xA(e.prefix);return jn[n]=Object.assign(e,{[qi]:"context",$:this,id:n,phase:"unresolved"})}traversal(e){return new so(e,this.resolvedConfig)}import(...e){return new zp(He(this.export(...e),(n,r)=>[`#${n}`,r]))}precompilation;_exportedResolutions;_exports;export(...e){if(!this._exports){this._exports={};for(const r of this.exportedNames){const o=this.aliases[r];this._exports[r]=ue(o,"module")?LA(o,this):VS(this.maybeResolve(r))}for(const r of this.lazyResolutions)r.resolution;if(this._exportedResolutions=IA(this,this._exports),this._json=KA(this._exportedResolutions),Object.assign(this.resolutions,this._exportedResolutions),this.references=Object.values(this.referencesById),!this.resolvedConfig.jitless){const r=UA(this.references);this.precompilation=r.write(VA,4),zA(this.references,r)}this.resolved=!0}const n=e.length?e:this.exportedNames;return new zp(He(n,(r,o)=>[o,this._exports[o]]))}resolve(e){return this.export()[e]}node=(e,n,r={})=>{const o=this.preparseNode(e,n,r);if(Xt(o))return this.bindReference(o);const u=this.createParseContext(o),c=wA(u),d=this.bindReference(c);return jn[u.id]=d};parse=(e,n={})=>this.finalize(this.parseDefinition(e,n));parseDefinition(e,n={}){if(ue(e,"root"))return this.bindReference(e);const r=this.preparseOwnDefinitionFormat(e,n);if(ue(r,"root"))return this.bindReference(r);const o=this.createParseContext(r);jn[o.id]=o;let u=this.bindReference(this.parseOwnDefinitionFormat(e,o));return u.isCyclic&&(u=fN(u,o.id)),jn[o.id]=u,u}finalize(e){return VS(e),!e.precompilation&&!this.resolvedConfig.jitless&&x$(e.references),e}}class PA extends qA{parseOwnDefinitionFormat(e,n){return wA(n)}preparseOwnDefinitionFormat(e,n){return this.preparseNode(nc(e),e,n)}preparseOwnAliasEntry(e,n){return[e,n]}normalizeRootScopeValue(e){return e}}const VS=t=>{const e=t.references.filter(n=>n.hasKind("alias"));for(const n of e){Object.assign(n.referencesById,n.resolution.referencesById);for(const r of t.references)n.id in r.referencesById&&Object.assign(r.referencesById,n.referencesById)}return t},KA=t=>He(t,(e,n)=>[e,ue(n,"root")||ue(n,"generic")?n.json:ue(n,"module")?KA(n):wt(`Unexpected resolution ${Pe(n)}`)]),Up=(t,e)=>{const n=e.indexOf(".");if(n===-1)return;const r=e.slice(0,n),o=t[r];if(o===void 0)return;if(!ue(o,"module"))return Y(w$(r));const u=e.slice(n+1),c=o[u];if(c===void 0)return Up(o,u);if(ue(c,"root")||ue(c,"generic"))return c;if(ue(c,"module"))return c.root??Y(FA(e));wt(`Unexpected resolution for alias '${e}': ${Pe(c)}`)},Jm=(t,e)=>new PA(t,e),gl=new PA({}),IA=(t,e)=>{const n={};for(const r in e){const o=e[r];if(ue(o,"module")){const u=IA(t,o),c=He(u,(d,h)=>[`${r}.${d}`,h]);Object.assign(n,c)}else ue(o,"root")||ue(o,"generic")?n[r]=o:wt(`Unexpected scope resolution ${Pe(o)}`)}return n},HA=t=>`'${t}' is unresolvable`,w$=t=>`'${t}' must reference a module to be accessed using dot syntax`,FA=t=>`Reference to submodule '${t}' must specify an alias`;gl.export();const Ge=gl.schema,Qm=gl.node;gl.defineSchema;const Fi=gl.generic,GA="^(?:0|[1-9]\\d*)$",A$=new RegExp(GA);Jt(A$);const YA=Jm({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();Q.intrinsic={...YA};const XA=Jm({integer:{domain:"number",divisor:1},lengthBoundable:["string",Array],key:["string","symbol"],nonNegativeIntegerString:{domain:"string",pattern:GA}},{prereducedAliases:!0}).export();Object.assign(Q.intrinsic,XA);const T$=Jm({jsonPrimitive:["string","number",{unit:!0},{unit:!1},{unit:null}],jsonObject:{domain:"object",index:{signature:"string",value:"$jsonData"}},jsonData:["$jsonPrimitive","$jsonObject"]},{prereducedAliases:!0}).export(),pe={...YA,...XA,...T$,emptyStructure:Qm("structure",{},{prereduced:!0})};Q.intrinsic={...pe};const E$=t=>typeof t=="string"&&t[0]==="d"&&(t[1]==="'"||t[1]==='"')&&t.at(-1)===t[1],zS=t=>t.toString()!=="Invalid Date",R$=t=>t.slice(2,-1),ZA=t=>`'${t}' could not be parsed by the Date constructor`,O$=(t,e)=>_$(t,e),_$=(t,e)=>{const n=new Date(t);if(zS(n))return n;const r=QD(t);if(r!==void 0){const o=new Date(r);if(zS(o))return o}return e?Y(e===!0?ZA(t):e):void 0},US=(t,e)=>{const n=t.scanner.shiftUntil(C$[QA[e]]);if(t.scanner.lookahead==="")return t.error(D$(n,e));if(t.scanner.shift(),e==="/"){try{new RegExp(n)}catch(r){Y(String(r))}t.root=t.ctx.$.node("intersection",{domain:"string",pattern:n},{prereduced:!0})}else if(mi(e,JA))t.root=t.ctx.$.node("unit",{unit:n});else{const r=O$(n,ZA(n));t.root=t.ctx.$.node("unit",{meta:n,unit:r})}},JA={"'":1,'"':1},M$={"/":1,"'":1,'"':1},QA={"d'":"'",'d"':'"',"'":"'",'"':'"',"/":"/"},C$={"'":t=>t.lookahead==="'",'"':t=>t.lookahead==='"',"/":t=>t.lookahead==="/"},k$={'"':"double-quote","'":"single-quote","/":"forward slash"},D$=(t,e)=>`${e}${t} requires a closing ${k$[QA[e]]}`,N$=t=>`Private type references should not include '#'. Use '${t}' instead.`,WA="Optional definitions like 'string?' are only valid as properties in an object or tuple",eT="Defaultable definitions like 'number = 0' are only valid as properties in an object or tuple",$$={">":!0,">=":!0},j$={"<":!0,"<=":!0},kc={"<":">",">":"<","<=":">=",">=":"<=","==":"=="},B$=t=>`Unmatched )${t===""?"":` before ${t}`}`,tT=t=>`Missing ${t}`,L$=(t,e)=>`Left bounds are only valid when paired with right bounds (try ...${e}${t})`,nT=t=>`Left-bounded expressions must specify their limits using < or <= (was ${t})`,V$=(t,e,n,r)=>`An expression may have at most one left bound (parsed ${t}${kc[e]}, ${n}${kc[r]})`,z$=(t,e,n)=>iT(t,e,n,[]),iT=(t,e,n,r)=>{const o=n.parseUntilFinalizer();return r.push(o.root),o.finalizer===">"?r.length!==e.params.length?n.error(rT(t,e.names,r.map(u=>u.expression))):r:o.finalizer===","?iT(t,e,n,r):o.error(tT(">"))},rT=(t,e,n)=>`${t}<${e.join(", ")}> requires exactly ${e.length} args (got ${n.length}${n.length===0?"":`: ${n.join(", ")}`})`,qS=t=>{const e=t.scanner.shiftUntilNextTerminator();e==="keyof"?t.addPrefix("keyof"):t.root=q$(t,e)},U$=(t,e,n)=>{if(n.scanner.shiftUntilNonWhitespace(),n.scanner.shift()!=="<")return n.error(rT(t,e.names,[]));const o=z$(t,e,n);return e(...o)},q$=(t,e)=>P$(t,e)??K$(t,e)??t.error(e===""?t.scanner.lookahead==="#"?N$(t.shiftedByOne().scanner.shiftUntilNextTerminator()):sT(t):HA(e)),P$=(t,e)=>{if(t.ctx.args?.[e]){const r=t.ctx.args[e];return typeof r!="string"?r:t.ctx.$.node("alias",{reference:r},{prereduced:!0})}const n=t.ctx.$.maybeResolve(e);if(ue(n,"root"))return n;if(n!==void 0)return ue(n,"generic")?U$(e,n,t):Y(`Unexpected resolution ${Pe(n)}`)},K$=(t,e)=>{const n=WD(e);if(n!==void 0)return t.ctx.$.node("unit",{unit:n});const r=t2(e);if(r!==void 0)return t.ctx.$.node("unit",{unit:r})},sT=t=>{const e=t.previousOperator();return e?oT(e,t.scanner.unscanned):I$(t.scanner.unscanned)},oT=(t,e="")=>`Token '${t}' requires a right operand${e?` before '${e}'`:""}`,I$=t=>`Expected an expression${t?` before '${t}'`:""}`,aT=t=>t.scanner.lookahead===""?t.error(sT(t)):t.scanner.lookahead==="("?t.shiftedByOne().reduceGroupOpen():t.scanner.lookaheadIsIn(M$)?US(t,t.scanner.shift()):t.scanner.lookaheadIsIn(Qc)?aT(t.shiftedByOne()):t.scanner.lookahead==="d"&&t.scanner.nextLookahead in JA?US(t,`${t.scanner.shift()}${t.scanner.shift()}`):qS(t);class Ro extends u2{shiftUntilNextTerminator(){return this.shiftUntilNonWhitespace(),this.shiftUntil(()=>this.lookahead in Ro.terminatingChars)}static terminatingChars={"<":1,">":1,"=":1,"|":1,"&":1,")":1,"[":1,"%":1,",":1,":":1,"?":1,"#":1,...Qc};static finalizingLookaheads={">":1,",":1,"":1,"=":1,"?":1};static lookaheadIsFinalizing=(e,n)=>e===">"?n[0]==="="?n[1]==="=":n.trimStart()===""||mi(n.trimStart()[0],Ro.terminatingChars):e==="="?n[0]!=="=":e===","||e==="?"}const H$=(t,e)=>{const n=G$(t,e);if(t.root.hasKind("unit")){if(typeof t.root.unit=="number"){t.reduceLeftBound(t.root.unit,n),t.unsetRoot();return}if(t.root.unit instanceof Date){const r=`d'${t.root.description??t.root.unit.toISOString()}'`;t.unsetRoot(),t.reduceLeftBound(r,n);return}}return X$(t,n)},F$={"<":1,">":1,"=":1},G$=(t,e)=>t.scanner.lookaheadIs("=")?`${e}${t.scanner.shift()}`:e,PS=(t,e,n,r)=>n.extends(Q.intrinsic.number)?typeof e!="number"?Y(qp(t,e,r)):t==="=="?["min","max"]:t[0]===">"?["min"]:["max"]:n.extends(Q.intrinsic.lengthBoundable)?typeof e!="number"?Y(qp(t,e,r)):t==="=="?["exactLength"]:t[0]===">"?["minLength"]:["maxLength"]:n.extends(Q.intrinsic.Date)?t==="=="?["after","before"]:t[0]===">"?["after"]:["before"]:Y(I2(n.expression)),Y$=t=>({rule:E$(t.limit)?R$(t.limit):t.limit,exclusive:t.comparator.length===1}),X$=(t,e)=>{const n=t.unsetRoot(),r=t.scanner.location;t.parseOperand();const o=t.unsetRoot(),u=t.scanner.sliceChars(r,t.scanner.location);if(t.root=n,!o.hasKind("unit")||typeof o.unit!="number"&&!(o.unit instanceof Date))return t.error(qp(e,u,"right"));const c=o.unit,d=e.length===1,h=PS(e,typeof c=="number"?c:u,n,"right");for(const y of h)t.constrainRoot(y,e==="=="?{rule:c}:{rule:c,exclusive:d});if(!t.branches.leftBound)return;if(!mi(e,j$))return t.error(nT(e));const m=PS(t.branches.leftBound.comparator,t.branches.leftBound.limit,n,"left");t.constrainRoot(m[0],Y$(t.branches.leftBound)),t.branches.leftBound=null},qp=(t,e,n)=>`Comparator ${n==="left"?kc[t]:t} must be ${n==="left"?"preceded":"followed"} by a corresponding literal (was ${e})`,Z$=t=>{t.scanner.shiftUntilNonWhitespace();const e=t.scanner.shiftUntilNextTerminator();t.root=t.root.brand(e)},J$=t=>{const e=t.scanner.shiftUntilNextTerminator(),n=e2(e,{errorOnFail:KS(e)});n===0&&t.error(KS(0)),t.root=t.root.constrain("divisor",n)},KS=t=>`% operator must be followed by a non-zero integer literal (was ${t})`,lT=t=>{const e=t.scanner.shift();return e===""?t.finalize(""):e==="["?t.scanner.shift()==="]"?t.setRoot(t.root.array()):t.error(Q$):e==="|"?t.scanner.lookahead===">"?t.shiftedByOne().pushRootToBranch("|>"):t.pushRootToBranch(e):e==="&"?t.pushRootToBranch(e):e===")"?t.finalizeGroup():Ro.lookaheadIsFinalizing(e,t.scanner.unscanned)?t.finalize(e):mi(e,F$)?H$(t,e):e==="%"?J$(t):e==="#"?Z$(t):e in Qc?lT(t):t.error(Wm(e))},Wm=(t,e="")=>`'${t}' is not allowed here${e&&` (should be ${e})`}`,Q$="Missing expected ']'",W$=t=>{const e=t.unsetRoot();t.parseOperand();const n=t.unsetRoot();if(!n.hasKind("unit"))return t.error(ej(n.expression));const r=n.unit instanceof Date?()=>new Date(n.unit):n.unit;return[e,"=",r]},ej=t=>`Default value '${t}' must a literal value`,IS=(t,e)=>{const n=e.$.maybeResolveRoot(t);if(n)return n;if(t.endsWith("[]")){const u=e.$.maybeResolveRoot(t.slice(0,-2));if(u)return u.array()}const r=new sf(new Ro(t),e),o=tj(r);return r.finalizer===">"&&Y(Wm(">")),o},tj=t=>{t.parseOperand();let e=ey(t).root;return e?(t.finalizer==="="?e=W$(t):t.finalizer==="?"&&(e=[e,"?"]),t.scanner.shiftUntilNonWhitespace(),t.scanner.lookahead&&Y(Wm(t.scanner.lookahead)),e):wt(`Root was unexpectedly unset after parsing string '${t.scanner.scanned}'`)},ey=t=>{for(;t.finalizer===void 0;)nj(t);return t},nj=t=>t.hasRoot()?t.parseOperator():t.parseOperand();class sf{root;branches={prefixes:[],leftBound:null,intersection:null,union:null,pipe:null};finalizer;groups=[];scanner;ctx;constructor(e,n){this.scanner=e,this.ctx=n}error(e){return Y(e)}hasRoot(){return this.root!==void 0}setRoot(e){this.root=e}unsetRoot(){const e=this.root;return this.root=void 0,e}constrainRoot(...e){this.root=this.root.constrain(e[0],e[1])}finalize(e){if(this.groups.length)return this.error(tT(")"));this.finalizeBranches(),this.finalizer=e}reduceLeftBound(e,n){const r=kc[n];if(!mi(r,$$))return this.error(nT(n));if(this.branches.leftBound)return this.error(V$(this.branches.leftBound.limit,this.branches.leftBound.comparator,e,r));this.branches.leftBound={comparator:r,limit:e}}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 e=this.groups.pop();if(!e)return this.error(B$(this.scanner.unscanned));this.branches=e}addPrefix(e){this.branches.prefixes.push(e)}applyPrefixes(){for(;this.branches.prefixes.length;){const e=this.branches.prefixes.pop();this.root=e==="keyof"?this.root.keyof():wt(`Unexpected prefix '${e}'`)}}pushRootToBranch(e){this.assertRangeUnset(),this.applyPrefixes();const n=this.root;this.root=void 0,this.branches.intersection=this.branches.intersection?.rawAnd(n)??n,e!=="&"&&(this.branches.union=this.branches.union?.rawOr(this.branches.intersection)??this.branches.intersection,this.branches.intersection=null,e!=="|"&&(this.branches.pipe=this.branches.pipe?.rawPipeOnce(this.branches.union)??this.branches.union,this.branches.union=null))}parseUntilFinalizer(){return ey(new sf(this.scanner,this.ctx))}parseOperator(){return lT(this)}parseOperand(){return aT(this)}assertRangeUnset(){if(this.branches.leftBound)return this.error(L$(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(){return this.branches.leftBound?.comparator??this.branches.prefixes.at(-1)??(this.branches.intersection?"&":this.branches.union?"|":this.branches.pipe?"|>":void 0)}shiftedByOne(){return this.scanner.shift(),this}}const ij="An empty string is not a valid generic parameter name",Pp=(t,e,n)=>{t.shiftUntilNonWhitespace();const r=t.shiftUntilNextTerminator();return r===""?t.lookahead===""&&e.length?e:Y(ij):(t.shiftUntilNonWhitespace(),rj(t,r,e,n))},HS="extends ",rj=(t,e,n,r)=>{if(t.shiftUntilNonWhitespace(),t.unscanned.startsWith(HS))t.jumpForward(HS.length);else return t.lookahead===","&&t.shift(),n.push(e),Pp(t,n,r);const o=ey(new sf(t,r));return n.push([e,o.root]),Pp(t,n,r)};class sj extends Do{$;constructor(e){super((...n)=>new Iu(e)(...n),{bind:e}),this.$=e}in(e){return new Iu(this.$,e===void 0?void 0:this.$.parse(e))}at(e,n){return new Iu(this.$).at(e,n)}case(e,n){return new Iu(this.$).case(e,n)}}class Iu extends Do{$;in;key;branches=[];constructor(e,n){super(r=>this.caseEntries(Object.entries(r).map(([o,u])=>o==="default"?[o,u]:[this.$.parse(o),u]))),this.$=e,this.in=n}at(e,n){return this.key&&Y(aj),this.branches.length&&Y(oj),this.key=e,n?this.match(n):this}case(e,n){return this.caseEntry(this.$.parse(e),n)}caseEntry(e,n){const o=(this.key?this.$.parse({[this.key]:e}):e).pipe(n);return this.branches.push(o),this}match(e){return this(e)}strings(e){return this.caseEntries(Object.entries(e).map(([n,r])=>n==="default"?[n,r]:[this.$.node("unit",{unit:n}),r]))}caseEntries(e){for(let n=0;n<e.length;n++){const[r,o]=e[n];if(r==="default")return n!==e.length-1&&Y("default may only be specified as the last key of a switch definition"),this.default(o);if(typeof o!="function")return Y(`Value for case "${r}" must be a function (was ${Yn(o)})`);this.caseEntry(r,o)}return this}default(e){typeof e=="function"&&this.case(pe.unknown,e);const n={branches:this.branches,ordered:!0};(e==="never"||e==="assert")&&(n.meta={onFail:FS});const r=this.$.node("union",n);if(!this.in)return this.$.finalize(r);let o=this.in.pipe(r);return(e==="never"||e==="assert")&&(o=o.configureReferences({onFail:FS},"self")),this.$.finalize(o)}}const FS=t=>t.throw(),oj="A key matcher must be specified before the first case i.e. match.at('foo') or match.in<object>().at('bar')",aj="At most one key matcher may be specified per expression",uT=(t,e)=>{if(Gt(t)){if(t[1]==="=")return[e.$.parseOwnDefinitionFormat(t[0],e),"=",t[2]];if(t[1]==="?")return[e.$.parseOwnDefinitionFormat(t[0],e),"?"]}return yT(t,e)},lj="Only required keys may make their values optional, e.g. { [mySymbol]: ['number', '?'] }",uj="Only required keys may specify default values, e.g. { value: 'number = 0' }",cj=(t,e)=>{let n;const r={},o=Ac(t);for(const[c,d]of o){const h=hj(c);if(h.kind==="spread"){if(!cl(r))return Y(dj);const x=e.$.parseOwnDefinitionFormat(d,e);if(x.equals(pe.object))continue;if(!x.hasKind("intersection")||!x.basis?.equals(pe.object))return Y(pj(x.expression));n=x.structure;continue}if(h.kind==="undeclared"){d!=="reject"&&d!=="delete"&&d!=="ignore"&&Y(fj(d)),r.undeclared=d;continue}const m=uT(d,e),y=h;if(h.kind==="required"){Gt(m)?Hh(r,"optional",m[1]==="="?{key:h.normalized,value:m[0],default:m[2]}:{key:h.normalized,value:m[0]},e):Hh(r,"required",{key:h.normalized,value:m},e);continue}if(Gt(m)&&(m[1]==="?"&&Y(lj),m[1]==="="&&Y(uj)),h.kind==="optional"){Hh(r,"optional",{key:h.normalized,value:m},e);continue}const g=e.$.parseOwnDefinitionFormat(y.normalized,e),b=Vp(g,m,e.$);b.index&&(r.index=Ie(r.index,b.index)),b.required&&(r.required=Ie(r.required,b.required))}const u=e.$.node("structure",r);return e.$.parseSchema({domain:"object",structure:n?.merge(u)??u})},Hh=(t,e,n,r)=>{t[e]=Ie(t[e],r.$.node(e,n))},fj=t=>`Value of '+' key must be 'reject', 'delete', or 'ignore' (was ${Pe(t)})`,dj="Spread operator may only be used as the first key in an object",hj=t=>typeof t=="symbol"?{kind:"required",normalized:t}:t.at(-1)==="?"?t.at(-2)===_p?{kind:"required",normalized:`${t.slice(0,-2)}?`}:{kind:"optional",normalized:t.slice(0,-1)}:t[0]==="["&&t.at(-1)==="]"?{kind:"index",normalized:t.slice(1,-1)}:t[0]===_p&&t[1]==="["&&t.at(-1)==="]"?{kind:"required",normalized:t.slice(1)}:t==="..."?{kind:"spread"}:t==="+"?{kind:"undeclared"}:{kind:"required",normalized:t==="\\..."?"...":t==="\\+"?"+":t},pj=t=>`Spread operand must resolve to an object literal type (was ${t})`,mj=(t,e)=>Ej(t)?hT[t[0]](t,e):Aj(t)?dT[t[1]](t,e):null,yj=(t,e)=>e.$.parseOwnDefinitionFormat(t[1],e).keyof(),Fh=(t,e)=>{if(t[2]===void 0)return Y(oT(t[1],""));const n=e.$.parseOwnDefinitionFormat(t[0],e),r=e.$.parseOwnDefinitionFormat(t[2],e);if(t[1]==="|")return e.$.node("union",{branches:[n,r]});const o=t[1]==="&"?Ki(n,r,e.$):jp(n,r,e.$);return o instanceof se?o.throw():o},gj=(t,e)=>e.$.parseOwnDefinitionFormat(t[0],e).array(),vj=(t,e)=>typeof t[2]!="function"?Y(cT("=>",t[2])):e.$.parseOwnDefinitionFormat(t[0],e).pipe(t[2]),cT=(t,e)=>`${t===":"?"Narrow":"Morph"} expression requires a function following '${t}' (was ${typeof e})`,bj=(t,e)=>typeof t[2]!="function"?Y(cT(":",t[2])):e.$.parseOwnDefinitionFormat(t[0],e).constrain("predicate",t[2]),Sj=(t,e)=>e.$.parseOwnDefinitionFormat(t[0],e).configureReferences(t[2],"shallow"),fT=t=>t,xj=fT({"[]":gj,"?":()=>Y(WA)}),wj=fT({"|":Fh,"&":Fh,":":bj,"=>":vj,"|>":Fh,"@":Sj,"=":()=>Y(eT)}),dT={...xj,...wj},Aj=t=>dT[t[1]]!==void 0,Tj=t=>t,hT=Tj({keyof:yj,instanceof:(t,e)=>{if(typeof t[1]!="function")return Y(GS(Op(t[1])));const n=t.slice(1).map(r=>typeof r=="function"?e.$.node("proto",{proto:r}):Y(GS(Op(r))));return n.length===1?n[0]:e.$.node("union",{branches:n})},"===":(t,e)=>e.$.units(t.slice(1))}),Ej=t=>hT[t[0]]!==void 0,GS=t=>`Expected a constructor following 'instanceof' operator (was ${t})`,Rj=(t,e)=>{let n=[{}],r=0;for(;r<t.length;){let o=!1;t[r]==="..."&&r<t.length-1&&(o=!0,r++);const u=uT(t[r],e),[c,d,h]=Gt(u)?u:[u];if(r++,o){if(!c.extends(Q.intrinsic.Array))return Y(Mj(c.expression));n=n.flatMap(m=>c.distribute(y=>_j(Qw(m),y)))}else n=n.map(m=>d==="?"?pT(m,c):d==="="?Oj(m,c,h):Kp(m,c))}return e.$.parseSchema(n.map(o=>cl(o)?{proto:Array,exactLength:0}:{proto:Array,sequence:o}))},Kp=(t,e)=>t.defaultables||t.optionals?Y(t.variadic?$A:Cj):(t.variadic?t.postfix=Ie(t.postfix,e):t.prefix=Ie(t.prefix,e),t),pT=(t,e)=>t.variadic?Y(mT):(t.optionals=Ie(t.optionals,e),t),Oj=(t,e,n)=>t.variadic?Y(mT):t.optionals?Y(kj):(t.defaultables=Ie(t.defaultables,[[e,n]]),t),YS=(t,e)=>(t.postfix&&Y(XS),t.variadic?t.variadic.equals(e)||Y(XS):t.variadic=e.internal,t),_j=(t,e)=>{const n=e.select({method:"find",kind:"sequence"});if(!n)return YS(t,Q.intrinsic.unknown);if(n.prefix)for(const r of n.prefix)Kp(t,r);if(n.optionals)for(const r of n.optionals)pT(t,r);if(n.variadic&&YS(t,n.variadic),n.postfix)for(const r of n.postfix)Kp(t,r);return t},Mj=t=>`Spread element must be an array (was ${t})`,XS="A tuple may have at most one variadic element",Cj="A required element may not follow an optional element",mT="An optional element may not follow a variadic element",kj="A defaultable element may not follow an optional element without a default",Dj={},yT=(t,e)=>{if(typeof t=="string"){if(e.args&&Object.keys(e.args).some(r=>t.includes(r)))return IS(t,e);const n=Dj[e.$.name]??={};return n[t]??=IS(t,e)}return fs(t,"object")?Nj(t,e):Y(Ip(Yn(t)))},Nj=(t,e)=>{const n=Vm(t);switch(n){case void 0:return ue(t,"root")?t:cj(t,e);case"Array":return $j(t,e);case"RegExp":return e.$.node("intersection",{domain:"string",pattern:t},{prereduced:!0});case"Function":{const r=Jc(t)?t():t;return ue(r,"root")?r:Y(Ip("Function"))}default:return Y(Ip(n??Pe(t)))}},$j=(t,e)=>mj(t,e)??Rj(t,e),Ip=t=>`Type definitions must be strings or objects (was ${t})`;class jj extends Do{constructor(e){const n=Object.assign({errors:Rr,hkt:yi,$:e,raw:e.parse,module:e.constructor.module,scope:e.constructor.scope,define:e.define,match:e.match,generic:e.generic,schema:e.schema,keywords:e.ambient,unit:e.unit,enumerated:e.enumerated,instanceOf:e.instanceOf,valueOf:e.valueOf,or:e.or,and:e.and,merge:e.merge,pipe:e.pipe},e.ambientAttachments);super((...r)=>{if(r.length===1)return e.parse(r[0]);if(r.length===2&&typeof r[0]=="string"&&r[0][0]==="<"&&r[0].at(-1)===">"){const o=r[0].slice(1,-1),u=e.parseGenericParams(o,{});return new Mc(u,r[1],e,e,null)}return e.parse(r)},{bind:e,attach:n})}}const Wa=Q;class of extends qA{get ambientAttachments(){if(Wa.typeAttachments)return this.cacheGetter("ambientAttachments",He(Wa.typeAttachments,(e,n)=>[e,this.bindReference(n)]))}preparseOwnAliasEntry(e,n){const r=e.indexOf("<");if(r===-1){if(ue(n,"module")||ue(n,"generic"))return[e,n];const c=this.name==="ark"?e:e==="root"?this.name:`${this.name}.${e}`,d=this.resolvedConfig.keywords?.[c];return d&&(n=[n,"@",d]),[e,n]}e.at(-1)!==">"&&Y("'>' must be the last character of a generic declaration in a scope");const o=e.slice(0,r),u=e.slice(r+1,-1);return[o,()=>{const c=this.parseGenericParams(u,{alias:o});return C2(c,n,this)}]}parseGenericParams(e,n){return Pp(new Ro(e),[],this.createParseContext({...n,def:e,prefix:"generic"}))}normalizeRootScopeValue(e){return Jc(e)&&!ue(e,"generic")?e():e}preparseOwnDefinitionFormat(e,n){return{...n,def:e,prefix:n.alias??"type"}}parseOwnDefinitionFormat(e,n){!(n.alias&&n.alias in this.aliases)&&!n.args&&(n.args={this:n.id});const o=yT(e,n);if(Gt(o)){if(o[1]==="=")return Y(eT);if(o[1]==="?")return Y(WA)}return o}unit=e=>this.units([e]);valueOf=e=>this.units(RD(e));enumerated=(...e)=>this.units(e);instanceOf=e=>this.node("proto",{proto:e},{prereduced:!0});or=(...e)=>this.schema(e.map(n=>this.parse(n)));and=(...e)=>e.reduce((n,r)=>n.and(this.parse(r)),this.intrinsic.unknown);merge=(...e)=>e.reduce((n,r)=>n.merge(this.parse(r)),this.intrinsic.object);pipe=(...e)=>this.intrinsic.unknown.pipe(...e);match=new sj(this);declare=()=>({type:this.type});define(e){return e}type=new jj(this);static scope=(e,n={})=>new of(e,n);static module=(e,n={})=>this.scope(e,n).export()}const Bj=Object.assign(of.scope,{define:t=>t}),Be=of;class Lj extends yi{description='merge an object\'s properties onto another like `Merge(User, { isAdmin: "true" })`'}const Vj=Fi(["base",pe.object],["props",pe.object])(t=>t.base.merge(t.props),Lj),zj=Be.module({Key:pe.key,Merge:Vj});class Uj extends yi{}const qj=Fi("element")(t=>{const e=t.element.exclude(pe.Array),n=e.array();return e.rawOr(n).pipe(ul).distribute(r=>r.assertHasKind("morph").declareOut(n),Ge)},Uj),Pj=Be.module({root:pe.Array,readonly:"root",index:pe.nonNegativeIntegerString,liftFrom:qj},{name:"Array"}),Hp=Ge(["string",fl.FileConstructor]),Kj=Hp.rawOr(Hp.array()),ZS=Ge({meta:"an object representing parsed form data",domain:"object",index:{signature:"string",value:Kj}}),Ij=Be.module({root:["instanceof",FormData],value:Hp,parsed:ZS,parse:Ge({in:FormData,morphs:t=>{const e={};for(const[n,r]of t)if(n in e){const o=e[n];typeof o=="string"||o instanceof fl.FileConstructor?e[n]=[o,r]:o.push(r)}else e[n]=r;return e},declaredOut:ZS})},{name:"FormData"}),Hj=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"}),Fj={Boolean:1,Number:1,String:1},Gj=Be.module({...He({...Lw,...zw},(t,e)=>t in Fj?[]:[t,["instanceof",e]]),Array:Pj,TypedArray:Hj,FormData:Ij}),Yj=Ge({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"}),Xj=Ge({domain:"number",divisor:1}),gT=Be.module({root:pe.number,integer:Xj,epoch:Yj,safe:Ge({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"}),Ze=(t,e,n)=>{const r={domain:"string",pattern:{rule:t.source,flags:t.flags,meta:e}};return n&&(r.meta={format:n}),Qm("intersection",r)},JS=Ze(Tc,"a well-formed integer string"),vT=Be.module({root:JS,parse:Ge({in:JS,morphs:(t,e)=>{const n=Number.parseInt(t);return Number.isSafeInteger(n)?n:e.error("an integer in the range Number.MIN_SAFE_INTEGER to Number.MAX_SAFE_INTEGER")},declaredOut:pe.integer})},{name:"string.integer"}),Zj=Ze(/^[\dA-Fa-f]+$/,"hex characters only"),Jj=Be.module({root:Ze(/^(?:[\d+/A-Za-z]{4})*(?:[\d+/A-Za-z]{2}==|[\d+/A-Za-z]{3}=)?$/,"base64-encoded"),url:Ze(/^(?:[\w-]{4})*(?:[\w-]{2}(?:==|%3D%3D)?|[\w-]{3}(?:=|%3D)?)?$/,"base64url-encoded")},{name:"string.base64"}),QS=Ze(/^[A-Z].*$/,"capitalized"),Qj=Be.module({root:Ge({in:"string",morphs:t=>t.charAt(0).toUpperCase()+t.slice(1),declaredOut:QS}),preformatted:QS},{name:"string.capitalize"}),Wj=t=>{const e=t.replaceAll(/[ -]+/g,"");let n=0,r,o,u=!1;for(let c=e.length-1;c>=0;c--)r=e.substring(c,c+1),o=Number.parseInt(r,10),u?(o*=2,n+=o>=10?o%10+1:o):n+=o,u=!u;return!!(n%10===0&&e)},e3=/^(?: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}))$/,t3=Ge({domain:"string",pattern:{meta:"a credit card number",rule:e3.source},predicate:{meta:"a credit card number",predicate:Wj}}),n3=/^([+-]?\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)?)?)?)?$/,i3=t=>!Number.isNaN(new Date(t).valueOf()),WS=Ge({domain:"string",predicate:{meta:"a parsable date",predicate:i3}}).assertHasKind("intersection"),ex=vT.root.internal.narrow((t,e)=>{const n=Number.parseInt(t),r=gT.epoch(n);return r instanceof Rr?(e.errors.merge(r),!1):!0}).configure({description:"an integer string representing a safe Unix timestamp"},"self").assertHasKind("intersection"),r3=Be.module({root:ex,parse:Ge({in:ex,morphs:t=>new Date(t),declaredOut:pe.Date})},{name:"string.date.epoch"}),tx=Ze(n3,"an ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) date").internal.assertHasKind("intersection"),s3=Be.module({root:tx,parse:Ge({in:tx,morphs:t=>new Date(t),declaredOut:pe.Date})},{name:"string.date.iso"}),o3=Be.module({root:WS,parse:Ge({declaredIn:WS,in:"string",morphs:(t,e)=>{const n=new Date(t);return Number.isNaN(n.valueOf())?e.error("a parsable date"):n},declaredOut:pe.Date}),iso:s3,epoch:r3},{name:"string.date"}),a3=Ze(/^[\w%+.-]+@[\d.A-Za-z-]+\.[A-Za-z]{2,}$/,"an email address","email"),nx="(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])",vr=`(${nx}[.]){3}${nx}`,l3=new RegExp(`^${vr}$`),gt="(?:[0-9a-fA-F]{1,4})",u3=new RegExp(`^((?:${gt}:){7}(?:${gt}|:)|(?:${gt}:){6}(?:${vr}|:${gt}|:)|(?:${gt}:){5}(?::${vr}|(:${gt}){1,2}|:)|(?:${gt}:){4}(?:(:${gt}){0,1}:${vr}|(:${gt}){1,3}|:)|(?:${gt}:){3}(?:(:${gt}){0,2}:${vr}|(:${gt}){1,4}|:)|(?:${gt}:){2}(?:(:${gt}){0,3}:${vr}|(:${gt}){1,5}|:)|(?:${gt}:){1}(?:(:${gt}){0,4}:${vr}|(:${gt}){1,6}|:)|(?::((?::${gt}){0,5}:${vr}|(?::${gt}){1,7}|:)))(%[0-9a-zA-Z.]{1,})?$`),c3=Be.module({root:["v4 | v6","@","an IP address"],v4:Ze(l3,"an IPv4 address","ipv4"),v6:Ze(u3,"an IPv6 address","ipv6")},{name:"string.ip"}),mo="a JSON string",bT=t=>{if(!(t instanceof SyntaxError))throw t;return`must be ${mo} (${t})`},f3=Ge({meta:mo,domain:"string",predicate:{meta:mo,predicate:(t,e)=>{try{return JSON.parse(t),!0}catch(n){return e.reject({code:"predicate",expected:mo,problem:bT(n)})}}}}),d3=(t,e)=>{if(t.length===0)return e.error({code:"predicate",expected:mo,actual:"empty"});try{return JSON.parse(t)}catch(n){return e.error({code:"predicate",expected:mo,problem:bT(n)})}},h3=Be.module({root:f3,parse:Ge({meta:"safe JSON string parser",in:"string",morphs:d3,declaredOut:pe.jsonObject})},{name:"string.json"}),ix=Ze(/^[a-z]*$/,"only lowercase letters"),p3=Be.module({root:Ge({in:"string",morphs:t=>t.toLowerCase(),declaredOut:ix}),preformatted:ix},{name:"string.lower"}),ST=["NFC","NFD","NFKC","NFKD"],vl=He(ST,(t,e)=>[e,Ge({domain:"string",predicate:n=>n.normalize(e)===n,meta:`${e}-normalized unicode`})]),af=He(ST,(t,e)=>[e,Ge({in:"string",morphs:n=>n.normalize(e),declaredOut:vl[e]})]),m3=Be.module({root:af.NFC,preformatted:vl.NFC},{name:"string.normalize.NFC"}),y3=Be.module({root:af.NFD,preformatted:vl.NFD},{name:"string.normalize.NFD"}),g3=Be.module({root:af.NFKC,preformatted:vl.NFKC},{name:"string.normalize.NFKC"}),v3=Be.module({root:af.NFKD,preformatted:vl.NFKD},{name:"string.normalize.NFKD"}),b3=Be.module({root:"NFC",NFC:m3,NFD:y3,NFKC:g3,NFKD:v3},{name:"string.normalize"}),rx=Ze(Mp,"a well-formed numeric string"),S3=Be.module({root:rx,parse:Ge({in:rx,morphs:t=>Number.parseFloat(t),declaredOut:pe.number})},{name:"string.numeric"}),sx="a regex pattern",x3=Ge({domain:"string",predicate:{meta:sx,predicate:(t,e)=>{try{return new RegExp(t),!0}catch(n){return e.reject({code:"predicate",expected:sx,problem:String(n)})}}},meta:{format:"regex"}}),w3=/^(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-]+)*))?$/,A3=Ze(w3,"a semantic version (see https://semver.org/)"),ox=Ze(/^\S.*\S$|^\S?$/,"trimmed"),T3=Be.module({root:Ge({in:"string",morphs:t=>t.trim(),declaredOut:ox}),preformatted:ox},{name:"string.trim"}),ax=Ze(/^[A-Z]*$/,"only uppercase letters"),E3=Be.module({root:Ge({in:"string",morphs:t=>t.toUpperCase(),declaredOut:ax}),preformatted:ax},{name:"string.upper"}),R3=t=>{if(URL.canParse)return URL.canParse(t);try{return new URL(t),!0}catch{return!1}},lx=Ge({domain:"string",predicate:{meta:"a URL string",predicate:R3},meta:{format:"uri"}}),O3=Be.module({root:lx,parse:Ge({declaredIn:lx,in:"string",morphs:(t,e)=>{try{return new URL(t)}catch{return e.error("a URL string")}},declaredOut:Ge(URL)})},{name:"string.url"}),_3=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:Ze(/^[\da-f]{8}-[\da-f]{4}-1[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv1"),v2:Ze(/^[\da-f]{8}-[\da-f]{4}-2[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv2"),v3:Ze(/^[\da-f]{8}-[\da-f]{4}-3[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv3"),v4:Ze(/^[\da-f]{8}-[\da-f]{4}-4[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv4"),v5:Ze(/^[\da-f]{8}-[\da-f]{4}-5[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv5"),v6:Ze(/^[\da-f]{8}-[\da-f]{4}-6[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv6"),v7:Ze(/^[\da-f]{8}-[\da-f]{4}-7[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv7"),v8:Ze(/^[\da-f]{8}-[\da-f]{4}-8[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv8")},{name:"string.uuid"}),M3=Be.module({root:pe.string,alpha:Ze(/^[A-Za-z]*$/,"only letters"),alphanumeric:Ze(/^[\dA-Za-z]*$/,"only letters and digits 0-9"),hex:Zj,base64:Jj,capitalize:Qj,creditCard:t3,date:o3,digits:Ze(/^\d*$/,"only digits 0-9"),email:a3,integer:vT,ip:c3,json:h3,lower:p3,normalize:b3,numeric:S3,regex:x3,semver:A3,trim:T3,upper:E3,url:O3,uuid:_3},{name:"string"}),C3=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}),k3=Be.module({root:pe.unknown,any:pe.unknown},{name:"unknown"}),D3=Be.module({root:pe.jsonObject,stringify:Qm("morph",{in:pe.jsonObject,morphs:t=>JSON.stringify(t),declaredOut:pe.string})},{name:"object.json"}),N3=Be.module({root:pe.object,json:D3},{name:"object"});class $3 extends yi{description='instantiate an object from an index signature and corresponding value type like `Record("string", "number")`'}const j3=Fi(["K",pe.key],"V")(t=>({domain:"object",index:{signature:t.K,value:t.V}}),$3);class B3 extends yi{description='pick a set of properties from an object like `Pick(User, "name | age")`'}const L3=Fi(["T",pe.object],["K",pe.key])(t=>t.T.pick(t.K),B3);class V3 extends yi{description='omit a set of properties from an object like `Omit(User, "age")`'}const z3=Fi(["T",pe.object],["K",pe.key])(t=>t.T.omit(t.K),V3);class U3 extends yi{description="make all named properties of an object optional like `Partial(User)`"}const q3=Fi(["T",pe.object])(t=>t.T.partial(),U3);class P3 extends yi{description="make all named properties of an object required like `Required(User)`"}const K3=Fi(["T",pe.object])(t=>t.T.required(),P3);class I3 extends yi{description='exclude branches of a union like `Exclude("boolean", "true")`'}const H3=Fi("T","U")(t=>t.T.exclude(t.U),I3);class F3 extends yi{description='extract branches of a union like `Extract("0 | false | 1", "number")`'}const G3=Fi("T","U")(t=>t.T.extract(t.U),F3),Y3=Be.module({Exclude:H3,Extract:G3,Omit:z3,Partial:q3,Pick:L3,Record:j3,Required:K3}),ds=Bj({...C3,...Y3,...Gj,...zj,string:M3,number:gT,object:N3,unknown:k3},{prereducedAliases:!0,name:"ark"}),jt=ds.export();Object.assign(Wa.ambient,jt);Wa.typeAttachments={string:jt.string.root,number:jt.number.root,bigint:jt.bigint,boolean:jt.boolean,symbol:jt.symbol,undefined:jt.undefined,null:jt.null,object:jt.object.root,unknown:jt.unknown.root,false:jt.false,true:jt.true,never:jt.never,arrayIndex:jt.Array.index,Key:jt.Key,Record:jt.Record,Array:jt.Array.root,Date:jt.Date};const St=Object.assign(ds.type,Wa.typeAttachments);ds.match;ds.generic;ds.schema;ds.define;ds.declare;const xT={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 X3(t){return Number.parseInt(t,10)}const Z3=St(xT),J3=Z3.keyof().pipe(t=>X3(t));St([J3,"string"]);function Q3(t){return F.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 500 101",...t,children:[F.jsx("title",{children:"Tempest Games Logo"}),F.jsx("path",{d:"M155.76.93v59.89h-17.11V7.78h-13.69V.93h30.8Z",style:{fill:"var(--logo-color)",strokeWidth:0}}),F.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}}),F.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}}),F.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}}),F.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}}),F.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}}),F.jsx("path",{d:"M500,7.78h-13.69v53.04h-17.11V.93h30.8v6.84Z",style:{fill:"var(--logo-color)",strokeWidth:0}}),F.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}}),F.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}}),F.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}}),F.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}}),F.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}}),F.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 wT(t){return F.jsx("a",{...t})}const W3={class:"_class_1riwg_1"},Gh=["โ ","โ ","โ ธ","โ ด","โ ฆ","โ "];function eB({input:t}){const e=B.useRef(null),[n,r]=B.useState(typeof t=="string"?t:null);return B.useEffect(()=>{let o=!0,u;if(typeof t=="string")r(t);else{let c=0;u=setInterval(()=>{e.current&&(e.current.textContent=Gh[c],c=(c+1)%Gh.length)},100),t.then(d=>{o&&(clearInterval(u),r(d))})}return()=>{o=!1,u&&clearInterval(u)}},[t]),F.jsx("span",{ref:e,children:n??Gh[0]})}var tB=Object.create,AT=Object.defineProperty,nB=Object.getOwnPropertyDescriptor,TT=Object.getOwnPropertyNames,iB=Object.getPrototypeOf,rB=Object.prototype.hasOwnProperty,gi=(t,e)=>function(){return e||(0,t[TT(t)[0]])((e={exports:{}}).exports,e),e.exports},sB=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(var o=TT(e),u=0,c=o.length,d;u<c;u++)d=o[u],!rB.call(t,d)&&d!==n&&AT(t,d,{get:(h=>e[h]).bind(null,d),enumerable:!(r=nB(e,d))||r.enumerable});return t},pt=(t,e,n)=>(n=t!=null?tB(iB(t)):{},sB(AT(n,"default",{value:t,enumerable:!0}),t)),ET=gi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/typeof.js"(t,e){function n(r){"@babel/helpers - typeof";return e.exports=n=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(o){return typeof o}:function(o){return o&&typeof Symbol=="function"&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},e.exports.__esModule=!0,e.exports.default=e.exports,n(r)}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports}}),oB=gi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js"(t,e){var n=ET().default;function r(o,u){if(n(o)!="object"||!o)return o;var c=o[Symbol.toPrimitive];if(c!==void 0){var d=c.call(o,u||"default");if(n(d)!="object")return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return(u==="string"?String:Number)(o)}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}}),aB=gi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js"(t,e){var n=ET().default,r=oB();function o(u){var c=r(u,"string");return n(c)=="symbol"?c:c+""}e.exports=o,e.exports.__esModule=!0,e.exports.default=e.exports}}),hs=gi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(t,e){var n=aB();function r(o,u,c){return(u=n(u))in o?Object.defineProperty(o,u,{value:c,enumerable:!0,configurable:!0,writable:!0}):o[u]=c,o}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}}),Xn=gi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(t,e){var n=hs();function r(u,c){var d=Object.keys(u);if(Object.getOwnPropertySymbols){var h=Object.getOwnPropertySymbols(u);c&&(h=h.filter(function(m){return Object.getOwnPropertyDescriptor(u,m).enumerable})),d.push.apply(d,h)}return d}function o(u){for(var c=1;c<arguments.length;c++){var d=arguments[c]!=null?arguments[c]:{};c%2?r(Object(d),!0).forEach(function(h){n(u,h,d[h])}):Object.getOwnPropertyDescriptors?Object.defineProperties(u,Object.getOwnPropertyDescriptors(d)):r(Object(d)).forEach(function(h){Object.defineProperty(u,h,Object.getOwnPropertyDescriptor(d,h))})}return u}e.exports=o,e.exports.__esModule=!0,e.exports.default=e.exports}});function lf(t){const e={subscribe(n){let r=null,o=!1,u=!1,c=!1;function d(){if(r===null){c=!0;return}u||(u=!0,typeof r=="function"?r():r&&r.unsubscribe())}return r=t({next(h){var m;o||(m=n.next)===null||m===void 0||m.call(n,h)},error(h){var m;o||(o=!0,(m=n.error)===null||m===void 0||m.call(n,h),d())},complete(){var h;o||(o=!0,(h=n.complete)===null||h===void 0||h.call(n),d())}}),c&&d(),{unsubscribe:d}},pipe(...n){return n.reduce(lB,e)}};return e}function lB(t,e){return e(t)}function uB(t){const e=new AbortController;return new Promise((r,o)=>{let u=!1;function c(){u||(u=!0,d.unsubscribe())}e.signal.addEventListener("abort",()=>{o(e.signal.reason)});const d=t.subscribe({next(h){u=!0,r(h),c()},error(h){o(h)},complete(){e.abort(),c()}})})}function cB(t){return e=>{let n=0,r=null;const o=[];function u(){r||(r=e.subscribe({next(d){for(const m of o){var h;(h=m.next)===null||h===void 0||h.call(m,d)}},error(d){for(const m of o){var h;(h=m.error)===null||h===void 0||h.call(m,d)}},complete(){for(const h of o){var d;(d=h.complete)===null||d===void 0||d.call(h)}}}))}function c(){if(n===0&&r){const d=r;r=null,d.unsubscribe()}}return lf(d=>(n++,o.push(d),u(),{unsubscribe(){n--,c();const h=o.findIndex(m=>m===d);h>-1&&o.splice(h,1)}}))}}function fB(t){let e=t;const n=[],r=c=>{e!==void 0&&c.next(e),n.push(c)},o=c=>{n.splice(n.indexOf(c),1)},u=lf(c=>(r(c),()=>{o(c)}));return u.next=c=>{if(e!==c){e=c;for(const d of n)d.next(c)}},u.get=()=>e,u}function dB(t){return lf(e=>{function n(o=0,u=t.op){const c=t.links[o];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(o+1,h)}})}return n().subscribe(e)})}function el(t){return!!t&&!Array.isArray(t)&&typeof t=="object"}var hB=Object.create,RT=Object.defineProperty,pB=Object.getOwnPropertyDescriptor,OT=Object.getOwnPropertyNames,mB=Object.getPrototypeOf,yB=Object.prototype.hasOwnProperty,bl=(t,e)=>function(){return e||(0,t[OT(t)[0]])((e={exports:{}}).exports,e),e.exports},gB=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(var o=OT(e),u=0,c=o.length,d;u<c;u++)d=o[u],!yB.call(t,d)&&d!==n&&RT(t,d,{get:(h=>e[h]).bind(null,d),enumerable:!(r=pB(e,d))||r.enumerable});return t},uf=(t,e,n)=>(n=t!=null?hB(mB(t)):{},gB(RT(n,"default",{value:t,enumerable:!0}),t));const _T=()=>{},ux=t=>{Object.freeze&&Object.freeze(t)};function MT(t,e,n){var r;const o=e.join(".");return(r=n[o])!==null&&r!==void 0||(n[o]=new Proxy(_T,{get(u,c){if(!(typeof c!="string"||c==="then"))return MT(t,[...e,c],n)},apply(u,c,d){const h=e[e.length-1];let m={args:d,path:e};return h==="call"?m={args:d.length>=2?[d[1]]:[],path:e.slice(0,-1)}:h==="apply"&&(m={args:d.length>=2?d[1]:[],path:e.slice(0,-1)}),ux(m.args),ux(m.path),t(m)}})),n[o]}const vB=t=>MT(t,[],Object.create(null)),bB=t=>new Proxy(_T,{get(e,n){if(n!=="then")return t(n)}});var CT=bl({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/typeof.js"(t,e){function n(r){"@babel/helpers - typeof";return e.exports=n=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(o){return typeof o}:function(o){return o&&typeof Symbol=="function"&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},e.exports.__esModule=!0,e.exports.default=e.exports,n(r)}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports}}),SB=bl({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js"(t,e){var n=CT().default;function r(o,u){if(n(o)!="object"||!o)return o;var c=o[Symbol.toPrimitive];if(c!==void 0){var d=c.call(o,u||"default");if(n(d)!="object")return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return(u==="string"?String:Number)(o)}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}}),xB=bl({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js"(t,e){var n=CT().default,r=SB();function o(u){var c=r(u,"string");return n(c)=="symbol"?c:c+""}e.exports=o,e.exports.__esModule=!0,e.exports.default=e.exports}}),kT=bl({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(t,e){var n=xB();function r(o,u,c){return(u=n(u))in o?Object.defineProperty(o,u,{value:c,enumerable:!0,configurable:!0,writable:!0}):o[u]=c,o}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}}),ty=bl({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(t,e){var n=kT();function r(u,c){var d=Object.keys(u);if(Object.getOwnPropertySymbols){var h=Object.getOwnPropertySymbols(u);c&&(h=h.filter(function(m){return Object.getOwnPropertyDescriptor(u,m).enumerable})),d.push.apply(d,h)}return d}function o(u){for(var c=1;c<arguments.length;c++){var d=arguments[c]!=null?arguments[c]:{};c%2?r(Object(d),!0).forEach(function(h){n(u,h,d[h])}):Object.getOwnPropertyDescriptors?Object.defineProperties(u,Object.getOwnPropertyDescriptors(d)):r(Object(d)).forEach(function(h){Object.defineProperty(u,h,Object.getOwnPropertyDescriptor(d,h))})}return u}e.exports=o,e.exports.__esModule=!0,e.exports.default=e.exports}});uf(ty());uf(kT());var Hu=uf(ty());function wB(t,e){if("error"in t){const r=e.deserialize(t.error);return{ok:!1,error:(0,Hu.default)((0,Hu.default)({},t),{},{error:r})}}return{ok:!0,result:(0,Hu.default)((0,Hu.default)({},t.result),(!t.result.type||t.result.type==="data")&&{type:"data",data:e.deserialize(t.result.data)})}}var Yh=class extends Error{constructor(){super("Unable to transform response from server")}};function AB(t,e){let n;try{n=wB(t,e)}catch{throw new Yh}if(!n.ok&&(!el(n.error.error)||typeof n.error.error.code!="number"))throw new Yh;if(n.ok&&!el(n.result))throw new Yh;return n}uf(ty());var Fu=pt(hs()),no=pt(Xn());function TB(t){return t instanceof Oo}function EB(t){return el(t)&&el(t.error)&&typeof t.error.code=="number"&&typeof t.error.message=="string"}function RB(t,e){return typeof t=="string"?t:el(t)&&typeof t.message=="string"?t.message:e}var Oo=class ic extends Error{constructor(e,n){var r,o;const u=n?.cause;super(e,{cause:u}),(0,Fu.default)(this,"cause",void 0),(0,Fu.default)(this,"shape",void 0),(0,Fu.default)(this,"data",void 0),(0,Fu.default)(this,"meta",void 0),this.meta=n?.meta,this.cause=u,this.shape=n==null||(r=n.result)===null||r===void 0?void 0:r.error,this.data=n==null||(o=n.result)===null||o===void 0?void 0:o.error.data,this.name="TRPCClientError",Object.setPrototypeOf(this,ic.prototype)}static from(e,n={}){const r=e;return TB(r)?(n.meta&&(r.meta=(0,no.default)((0,no.default)({},r.meta),n.meta)),r):EB(r)?new ic(r.error.message,(0,no.default)((0,no.default)({},n),{},{result:r})):new ic(RB(r,"Unknown error"),(0,no.default)((0,no.default)({},n),{},{cause:r}))}};function OB(t){const e=t;return e?"input"in e?e:{input:e,output:e}:{input:{serialize:n=>n,deserialize:n=>n},output:{serialize:n=>n,deserialize:n=>n}}}const cx=t=>typeof t=="function";function _B(t){if(t)return t;if(typeof window<"u"&&cx(window.fetch))return window.fetch;if(typeof globalThis<"u"&&cx(globalThis.fetch))return globalThis.fetch;throw new Error("No fetch implementation found")}var Fa=pt(Xn());function MB(t){return{url:t.url.toString(),fetch:t.fetch,transformer:OB(t.transformer),methodOverride:t.methodOverride}}function CB(t){const e={};for(let n=0;n<t.length;n++){const r=t[n];e[n]=r}return e}const kB={query:"GET",mutation:"POST",subscription:"PATCH"};function DT(t){return"input"in t?t.transformer.input.serialize(t.input):CB(t.inputs.map(e=>t.transformer.input.serialize(e)))}const NT=t=>{const e=t.url.split("?");let r=e[0].replace(/\/$/,"")+"/"+t.path;const o=[];if(e[1]&&o.push(e[1]),"inputs"in t&&o.push("batch=1"),t.type==="query"||t.type==="subscription"){const u=DT(t);u!==void 0&&t.methodOverride!=="POST"&&o.push(`input=${encodeURIComponent(JSON.stringify(u))}`)}return o.length&&(r+="?"+o.join("&")),r},DB=t=>{if(t.type==="query"&&t.methodOverride!=="POST")return;const e=DT(t);return e!==void 0?JSON.stringify(e):void 0},NB=t=>LB((0,Fa.default)((0,Fa.default)({},t),{},{contentTypeHeader:"application/json",getUrl:NT,getBody:DB}));var $B=class extends Error{constructor(){const t="AbortError";super(t),this.name=t,this.message=t}};const jB=t=>{var e;if(t?.aborted)throw(e=t.throwIfAborted)===null||e===void 0||e.call(t),typeof DOMException<"u"?new DOMException("AbortError","AbortError"):new $B};async function BB(t){var e;jB(t.signal);const n=t.getUrl(t),r=t.getBody(t),{type:o}=t,u=await(async()=>{const d=await t.headers();return Symbol.iterator in d?Object.fromEntries(d):d})(),c=(0,Fa.default)((0,Fa.default)((0,Fa.default)({},t.contentTypeHeader?{"content-type":t.contentTypeHeader}:{}),t.trpcAcceptHeader?{"trpc-accept":t.trpcAcceptHeader}:void 0),u);return _B(t.fetch)(n,{method:(e=t.methodOverride)!==null&&e!==void 0?e:kB[o],signal:t.signal,body:r,headers:c})}async function LB(t){const e={},n=await BB(t);e.response=n;const r=await n.json();return e.responseJSON=r,{json:r,meta:e}}pt(Xn());const fx=()=>{throw new Error("Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new")};function dx(t){let e=null,n=null;const r=()=>{clearTimeout(n),n=null,e=null};function o(d){const h=[[]];let m=0;for(;;){const b=d[m];if(!b)break;const x=h[h.length-1];if(b.aborted){var y;(y=b.reject)===null||y===void 0||y.call(b,new Error("Aborted")),m++;continue}if(t.validate(x.concat(b).map(w=>w.key))){x.push(b),m++;continue}if(x.length===0){var g;(g=b.reject)===null||g===void 0||g.call(b,new Error("Input is too big for a single dispatch")),m++;continue}h.push([])}return h}function u(){const d=o(e);r();for(const h of d){if(!h.length)continue;const m={items:h};for(const g of h)g.batch=m;t.fetch(m.items.map(g=>g.key)).then(async g=>{await Promise.all(g.map(async(x,A)=>{const w=m.items[A];try{var k;const M=await Promise.resolve(x);(k=w.resolve)===null||k===void 0||k.call(w,M)}catch(M){var $;($=w.reject)===null||$===void 0||$.call(w,M)}w.batch=null,w.reject=null,w.resolve=null}));for(const x of m.items){var b;(b=x.reject)===null||b===void 0||b.call(x,new Error("Missing result")),x.batch=null}}).catch(g=>{for(const x of m.items){var b;(b=x.reject)===null||b===void 0||b.call(x,g),x.batch=null}})}}function c(d){var h;const m={aborted:!1,key:d,batch:null,resolve:fx,reject:fx},y=new Promise((g,b)=>{var x;m.reject=b,m.resolve=g,(x=e)!==null&&x!==void 0||(e=[]),e.push(m)});return(h=n)!==null&&h!==void 0||(n=setTimeout(u)),y}return{load:c}}function VB(...t){const e=new AbortController,n=t.length;let r=0;const o=()=>{++r===n&&e.abort()};for(const u of t)u?.aborted?o():u?.addEventListener("abort",o,{once:!0});return e.signal}var Gu=pt(Xn());function zB(t){var e,n;const r=MB(t),o=(e=t.maxURLLength)!==null&&e!==void 0?e:1/0,u=(n=t.maxItems)!==null&&n!==void 0?n:1/0;return()=>{const c=y=>({validate(g){if(o===1/0&&u===1/0)return!0;if(g.length>u)return!1;const b=g.map(w=>w.path).join(","),x=g.map(w=>w.input);return NT((0,Gu.default)((0,Gu.default)({},r),{},{type:y,path:b,inputs:x,signal:null})).length<=o},async fetch(g){const b=g.map(M=>M.path).join(","),x=g.map(M=>M.input),A=VB(...g.map(M=>M.signal)),w=await NB((0,Gu.default)((0,Gu.default)({},r),{},{path:b,inputs:x,type:y,headers(){return t.headers?typeof t.headers=="function"?t.headers({opList:g}):t.headers:{}},signal:A}));return(Array.isArray(w.json)?w.json:g.map(()=>w.json)).map(M=>({meta:w.meta,json:M}))}}),d=dx(c("query")),h=dx(c("mutation")),m={query:d,mutation:h};return({op:y})=>lf(g=>{/* istanbul ignore if -- @preserve */if(y.type==="subscription")throw new Error("Subscriptions are unsupported by `httpLink` - use `httpSubscriptionLink` or `wsLink`");const x=m[y.type].load(y);let A;return x.then(w=>{A=w;const k=AB(w.json,r.transformer.output);if(!k.ok){g.error(Oo.from(k.error,{meta:w.meta}));return}g.next({context:w.meta,result:k.result}),g.complete()}).catch(w=>{g.error(Oo.from(w,{meta:A?.meta}))}),()=>{}})}}pt(Xn());const $T=(t,...e)=>typeof t=="function"?t(...e):t;pt(hs());function UB(){let t,e;return{promise:new Promise((r,o)=>{t=r,e=o}),resolve:t,reject:e}}async function qB(t){const e=await $T(t.url);if(!t.connectionParams)return e;const r=`${e.includes("?")?"&":"?"}connectionParams=1`;return e+r}async function PB(t){const e={method:"connectionParams",data:await $T(t)};return JSON.stringify(e)}pt(hs());var Qr=pt(hs());function KB(t){const{promise:e,resolve:n,reject:r}=UB();return t.addEventListener("open",()=>{t.removeEventListener("error",r),n()}),t.addEventListener("error",r),e}function IB(t,{intervalMs:e,pongTimeoutMs:n}){let r,o;function u(){r=setTimeout(()=>{t.send("PING"),o=setTimeout(()=>{t.close()},n)},e)}function c(){clearTimeout(r),u()}function d(){clearTimeout(o),c()}t.addEventListener("open",u),t.addEventListener("message",({data:h})=>{clearTimeout(r),u(),h==="PONG"&&d()}),t.addEventListener("close",()=>{clearTimeout(r),clearTimeout(o)})}var HB=class Fp{constructor(e){var n;if((0,Qr.default)(this,"id",++Fp.connectCount),(0,Qr.default)(this,"WebSocketPonyfill",void 0),(0,Qr.default)(this,"urlOptions",void 0),(0,Qr.default)(this,"keepAliveOpts",void 0),(0,Qr.default)(this,"wsObservable",fB(null)),(0,Qr.default)(this,"openPromise",null),this.WebSocketPonyfill=(n=e.WebSocketPonyfill)!==null&&n!==void 0?n: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=e.urlOptions,this.keepAliveOpts=e.keepAlive}get ws(){return this.wsObservable.get()}set ws(e){this.wsObservable.next(e)}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(){var e=this;if(e.openPromise)return e.openPromise;e.id=++Fp.connectCount;const n=qB(e.urlOptions).then(r=>new e.WebSocketPonyfill(r));e.openPromise=n.then(async r=>{e.ws=r,r.addEventListener("message",function({data:o}){o==="PING"&&this.send("PONG")}),e.keepAliveOpts.enabled&&IB(r,e.keepAliveOpts),r.addEventListener("close",()=>{e.ws===r&&(e.ws=null)}),await KB(r),e.urlOptions.connectionParams&&r.send(await PB(e.urlOptions.connectionParams))});try{await e.openPromise}finally{e.openPromise=null}}async close(){var e=this;try{await e.openPromise}finally{var n;(n=e.ws)===null||n===void 0||n.close()}}};(0,Qr.default)(HB,"connectCount",0);pt(hs());pt(Xn());var Xh=pt(hs()),hx=pt(Xn()),FB=class{constructor(t){(0,Xh.default)(this,"links",void 0),(0,Xh.default)(this,"runtime",void 0),(0,Xh.default)(this,"requestId",void 0),this.requestId=0,this.runtime={},this.links=t.links.map(e=>e(this.runtime))}$request(t){var e;return dB({links:this.links,op:(0,hx.default)((0,hx.default)({},t),{},{context:(e=t.context)!==null&&e!==void 0?e:{},id:++this.requestId})}).pipe(cB())}async requestAsPromise(t){var e=this;try{const n=e.$request(t);return(await uB(n)).result.data}catch(n){throw Oo.from(n)}}query(t,e,n){return this.requestAsPromise({type:"query",path:t,input:e,context:n?.context,signal:n?.signal})}mutation(t,e,n){return this.requestAsPromise({type:"mutation",path:t,input:e,context:n?.context,signal:n?.signal})}subscription(t,e,n){return this.$request({type:"subscription",path:t,input:e,context:n.context,signal:n.signal}).subscribe({next(o){switch(o.result.type){case"state":{var u;(u=n.onConnectionStateChange)===null||u===void 0||u.call(n,o.result);break}case"started":{var c;(c=n.onStarted)===null||c===void 0||c.call(n,{context:o.context});break}case"stopped":{var d;(d=n.onStopped)===null||d===void 0||d.call(n);break}case"data":case void 0:{var h;(h=n.onData)===null||h===void 0||h.call(n,o.result.data);break}}},error(o){var u;(u=n.onError)===null||u===void 0||u.call(n,o)},complete(){var o;(o=n.onComplete)===null||o===void 0||o.call(n)}})}};const GB=Symbol.for("trpc_untypedClient"),YB={query:"query",mutate:"mutation",subscribe:"subscription"},XB=t=>YB[t];function ZB(t){const e=vB(({path:n,args:r})=>{const o=[...n],u=XB(o.pop()),c=o.join(".");return t[u](c,...r)});return bB(n=>n===GB?t:e[n])}function JB(t){const e=new FB(t);return ZB(e)}pt(Xn());pt(Xn());var QB=gi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/asyncIterator.js"(t,e){function n(o){var u,c,d,h=2;for(typeof Symbol<"u"&&(c=Symbol.asyncIterator,d=Symbol.iterator);h--;){if(c&&(u=o[c])!=null)return u.call(o);if(d&&(u=o[d])!=null)return new r(u.call(o));c="@@asyncIterator",d="@@iterator"}throw new TypeError("Object is not async iterable")}function r(o){function u(c){if(Object(c)!==c)return Promise.reject(new TypeError(c+" is not an object."));var d=c.done;return Promise.resolve(c.value).then(function(h){return{value:h,done:d}})}return r=function(d){this.s=d,this.n=d.next},r.prototype={s:null,n:null,next:function(){return u(this.n.apply(this.s,arguments))},return:function(d){var h=this.s.return;return h===void 0?Promise.resolve({value:d,done:!0}):u(h.apply(this.s,arguments))},throw:function(d){var h=this.s.return;return h===void 0?Promise.reject(d):u(h.apply(this.s,arguments))}},new r(o)}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports}});pt(QB());pt(Xn());var WB=gi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/usingCtx.js"(t,e){function n(){var r=typeof SuppressedError=="function"?SuppressedError:function(d,h){var m=Error();return m.name="SuppressedError",m.error=d,m.suppressed=h,m},o={},u=[];function c(d,h){if(h!=null){if(Object(h)!==h)throw new TypeError("using declarations can only be used with objects, functions, null, or undefined.");if(d)var m=h[Symbol.asyncDispose||Symbol.for("Symbol.asyncDispose")];if(m===void 0&&(m=h[Symbol.dispose||Symbol.for("Symbol.dispose")],d))var y=m;if(typeof m!="function")throw new TypeError("Object is not disposable.");y&&(m=function(){try{y.call(h)}catch(b){return Promise.reject(b)}}),u.push({v:h,d:m,a:d})}else d&&u.push({d:h,a:d});return h}return{e:o,u:c.bind(null,!1),a:c.bind(null,!0),d:function(){var h,m=this.e,y=0;function g(){for(;h=u.pop();)try{if(!h.a&&y===1)return y=0,u.push(h),Promise.resolve().then(g);if(h.d){var x=h.d.call(h.v);if(h.a)return y|=2,Promise.resolve(x).then(g,b)}else y|=1}catch(A){return b(A)}if(y===1)return m!==o?Promise.reject(m):Promise.resolve();if(m!==o)throw m}function b(x){return m=m!==o?new r(x,m):x,g()}return g()}}}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports}}),jT=gi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/OverloadYield.js"(t,e){function n(r,o){this.v=r,this.k=o}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports}}),eL=gi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/awaitAsyncGenerator.js"(t,e){var n=jT();function r(o){return new n(o,0)}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}}),tL=gi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/wrapAsyncGenerator.js"(t,e){var n=jT();function r(u){return function(){return new o(u.apply(this,arguments))}}function o(u){var c,d;function h(y,g){try{var b=u[y](g),x=b.value,A=x instanceof n;Promise.resolve(A?x.v:x).then(function(w){if(A){var k=y==="return"?"return":"next";if(!x.k||w.done)return h(k,w);w=u[k](w).value}m(b.done?"return":"normal",w)},function(w){h("throw",w)})}catch(w){m("throw",w)}}function m(y,g){switch(y){case"return":c.resolve({value:g,done:!0});break;case"throw":c.reject(g);break;default:c.resolve({value:g,done:!1})}(c=c.next)?h(c.key,c.arg):d=null}this._invoke=function(y,g){return new Promise(function(b,x){var A={key:y,arg:g,resolve:b,reject:x,next:null};d?d=d.next=A:(c=d=A,h(y,g))})},typeof u.return!="function"&&(this.return=void 0)}o.prototype[typeof Symbol=="function"&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},o.prototype.next=function(u){return this._invoke("next",u)},o.prototype.throw=function(u){return this._invoke("throw",u)},o.prototype.return=function(u){return this._invoke("return",u)},e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}});pt(WB());pt(eL());pt(tL());pt(Xn());var nL={};function BT(t,e){if(t instanceof Promise)throw new Error(e)}function iL(t,e){const n={},r=[];for(const o in t){const u=t[o]["~standard"].validate(e[o]);if(BT(u,`Validation must be synchronous, but ${o} returned a Promise.`),u.issues){r.push(...u.issues.map(c=>({...c,message:c.message,path:[o,...c.path??[]]})));continue}n[o]=u.value}return r.length?{issues:r}:{value:n}}function rL(t){const e=t.runtimeEnvStrict??t.runtimeEnv??nL;if(t.emptyStringAsUndefined??!1)for(const[M,O]of Object.entries(e))O===""&&delete e[M];if(!!t.skipValidation)return e;const o=typeof t.client=="object"?t.client:{},u=typeof t.server=="object"?t.server:{},c=typeof t.shared=="object"?t.shared:{},d=t.isServer??(typeof window>"u"||"Deno"in window),h=d?{...u,...c,...o}:{...o,...c},m=t.createFinalSchema?.(h,d)["~standard"].validate(e)??iL(h,e);BT(m,"Validation must be synchronous");const y=t.onValidationError??(M=>{throw console.error("โ Invalid environment variables:",M),new Error("Invalid environment variables")}),g=t.onInvalidAccess??(()=>{throw new Error("โ Attempted to access a server-side environment variable on the client")});if(m.issues)return y(m.issues);const b=M=>t.clientPrefix?!M.startsWith(t.clientPrefix)&&!(M in c):!0,x=M=>d||!b(M),A=M=>M==="__esModule"||M==="$$typeof",w=(t.extends??[]).reduce((M,O)=>Object.assign(M,O),{}),k=Object.assign(w,m.value);return new Proxy(k,{get(M,O){if(typeof O=="string"&&!A(O))return x(O)?Reflect.get(M,O):g(O)}})}const sL={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_BACKEND_ORIGIN:"https://realtime.tempest.games"},oL="__vite_start_time"in globalThis,aL=typeof window<"u",Ni=St("string"),px=St('"true" | "false" | undefined'),LT=rL({isServer:!oL&&!aL,server:{CI:St("string | undefined").pipe(Boolean),POSTGRES_USER:Ni,POSTGRES_PASSWORD:Ni,POSTGRES_DATABASE:Ni,POSTGRES_HOST:Ni,POSTGRES_PORT:Ni.pipe(t=>Number.parseInt(t,10)),BACKEND_PORT:Ni.pipe(t=>Number.parseInt(t,10)),RUN_WORKERS_FROM_SOURCE:px.pipe(t=>t==="true"),FRONTEND_PORT:Ni.pipe(t=>Number.parseInt(t,10)),FRONTEND_ORIGINS:Ni.pipe.try(t=>JSON.parse(t),St("string[]")),API_KEY_OPENAI:St("string | undefined"),API_KEY_RESEND:St("string | undefined")},clientPrefix:"VITE_",client:{VITE_BACKEND_ORIGIN:Ni,VITE_DEV_FRONTEND_HOST:St("string | undefined"),VITE_DEV_HTTPS:px.pipe(t=>t==="true")},runtimeEnv:sL,emptyStringAsUndefined:!0}),on=JB({links:[zB({url:LT.VITE_BACKEND_ORIGIN,fetch(t,e){return e?(Object.assign(e,{credentials:"include"}),fetch(t,e)):fetch(t)}})]}),lL=Object.freeze(Object.defineProperty({__proto__:null,trpcClient:on},Symbol.toStringTag,{value:"Module"})),uL=at({key:"appVersionQuery",default:on.version.query});at({key:"lastKnownVersion",default:null,effects:[iw(localStorage,JSON,"lastKnownVersion")]});const cL=di({key:"appVersion",get:async({get:t})=>{const e=t(uL);return e instanceof Promise?e.then(n=>n.version):e.version}});function Zh(t){return["optional",t]}function fL(t,e){let n=[t];for(const r of e){if(typeof r!="string")return!1;n=n.flatMap(o=>{if(o===null)return[];const u=[],c=o[1],d=c[r];d!==void 0&&u.push(d);const h=Object.keys(c).find(m=>m.startsWith("$"));if(h){const m=c[h];m&&u.push(m)}return u})}for(const r of n)if(r===null||r[0]==="optional")return!0;return!1}const dL="modulepreload",hL=function(t){return"/"+t},mx={},VT=function(e,n,r){let o=Promise.resolve();if(n&&n.length>0){let m=function(y){return Promise.all(y.map(g=>Promise.resolve(g).then(b=>({status:"fulfilled",value:b}),b=>({status:"rejected",reason:b}))))};var c=m;document.getElementsByTagName("link");const d=document.querySelector("meta[property=csp-nonce]"),h=d?.nonce||d?.getAttribute("nonce");o=m(n.map(y=>{if(y=hL(y),y in mx)return;mx[y]=!0;const g=y.endsWith(".css"),b=g?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${y}"]${b}`))return;const x=document.createElement("link");if(x.rel=g?"stylesheet":dL,g||(x.as="script"),x.crossOrigin="",x.href=y,h&&x.setAttribute("nonce",h),document.head.appendChild(x),g)return new Promise((A,w)=>{x.addEventListener("load",A),x.addEventListener("error",()=>w(new Error(`Unable to preload CSS for ${y}`)))})}))}function u(d){const h=new Event("vite:preloadError",{cancelable:!0});if(h.payload=d,window.dispatchEvent(h),!h.defaultPrevented)throw d}return o.then(d=>{for(const h of d||[])h.status==="rejected"&&u(h.reason);return e().catch(u)})},ci=Object.create(null);ci.open="0";ci.close="1";ci.ping="2";ci.pong="3";ci.message="4";ci.upgrade="5";ci.noop="6";const rc=Object.create(null);Object.keys(ci).forEach(t=>{rc[ci[t]]=t});const Gp={type:"error",data:"parser error"},zT=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",UT=typeof ArrayBuffer=="function",qT=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t&&t.buffer instanceof ArrayBuffer,ny=({type:t,data:e},n,r)=>zT&&e instanceof Blob?n?r(e):yx(e,r):UT&&(e instanceof ArrayBuffer||qT(e))?n?r(e):yx(new Blob([e]),r):r(ci[t]+(e||"")),yx=(t,e)=>{const n=new FileReader;return n.onload=function(){const r=n.result.split(",")[1];e("b"+(r||""))},n.readAsDataURL(t)};function gx(t){return t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}let Jh;function pL(t,e){if(zT&&t.data instanceof Blob)return t.data.arrayBuffer().then(gx).then(e);if(UT&&(t.data instanceof ArrayBuffer||qT(t.data)))return e(gx(t.data));ny(t,!1,n=>{Jh||(Jh=new TextEncoder),e(Jh.encode(n))})}const vx="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Pa=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let t=0;t<vx.length;t++)Pa[vx.charCodeAt(t)]=t;const mL=t=>{let e=t.length*.75,n=t.length,r,o=0,u,c,d,h;t[t.length-1]==="="&&(e--,t[t.length-2]==="="&&e--);const m=new ArrayBuffer(e),y=new Uint8Array(m);for(r=0;r<n;r+=4)u=Pa[t.charCodeAt(r)],c=Pa[t.charCodeAt(r+1)],d=Pa[t.charCodeAt(r+2)],h=Pa[t.charCodeAt(r+3)],y[o++]=u<<2|c>>4,y[o++]=(c&15)<<4|d>>2,y[o++]=(d&3)<<6|h&63;return m},yL=typeof ArrayBuffer=="function",iy=(t,e)=>{if(typeof t!="string")return{type:"message",data:PT(t,e)};const n=t.charAt(0);return n==="b"?{type:"message",data:gL(t.substring(1),e)}:rc[n]?t.length>1?{type:rc[n],data:t.substring(1)}:{type:rc[n]}:Gp},gL=(t,e)=>{if(yL){const n=mL(t);return PT(n,e)}else return{base64:!0,data:t}},PT=(t,e)=>{switch(e){case"blob":return t instanceof Blob?t:new Blob([t]);case"arraybuffer":default:return t instanceof ArrayBuffer?t:t.buffer}},KT="",vL=(t,e)=>{const n=t.length,r=new Array(n);let o=0;t.forEach((u,c)=>{ny(u,!1,d=>{r[c]=d,++o===n&&e(r.join(KT))})})},bL=(t,e)=>{const n=t.split(KT),r=[];for(let o=0;o<n.length;o++){const u=iy(n[o],e);if(r.push(u),u.type==="error")break}return r};function SL(){return new TransformStream({transform(t,e){pL(t,n=>{const r=n.length;let o;if(r<126)o=new Uint8Array(1),new DataView(o.buffer).setUint8(0,r);else if(r<65536){o=new Uint8Array(3);const u=new DataView(o.buffer);u.setUint8(0,126),u.setUint16(1,r)}else{o=new Uint8Array(9);const u=new DataView(o.buffer);u.setUint8(0,127),u.setBigUint64(1,BigInt(r))}t.data&&typeof t.data!="string"&&(o[0]|=128),e.enqueue(o),e.enqueue(n)})}})}let Qh;function Yu(t){return t.reduce((e,n)=>e+n.length,0)}function Xu(t,e){if(t[0].length===e)return t.shift();const n=new Uint8Array(e);let r=0;for(let o=0;o<e;o++)n[o]=t[0][r++],r===t[0].length&&(t.shift(),r=0);return t.length&&r<t[0].length&&(t[0]=t[0].slice(r)),n}function xL(t,e){Qh||(Qh=new TextDecoder);const n=[];let r=0,o=-1,u=!1;return new TransformStream({transform(c,d){for(n.push(c);;){if(r===0){if(Yu(n)<1)break;const h=Xu(n,1);u=(h[0]&128)===128,o=h[0]&127,o<126?r=3:o===126?r=1:r=2}else if(r===1){if(Yu(n)<2)break;const h=Xu(n,2);o=new DataView(h.buffer,h.byteOffset,h.length).getUint16(0),r=3}else if(r===2){if(Yu(n)<8)break;const h=Xu(n,8),m=new DataView(h.buffer,h.byteOffset,h.length),y=m.getUint32(0);if(y>Math.pow(2,21)-1){d.enqueue(Gp);break}o=y*Math.pow(2,32)+m.getUint32(4),r=3}else{if(Yu(n)<o)break;const h=Xu(n,o);d.enqueue(iy(u?h:Qh.decode(h),e)),r=0}if(o===0||o>t){d.enqueue(Gp);break}}}})}const IT=4;function xt(t){if(t)return wL(t)}function wL(t){for(var e in xt.prototype)t[e]=xt.prototype[e];return t}xt.prototype.on=xt.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this};xt.prototype.once=function(t,e){function n(){this.off(t,n),e.apply(this,arguments)}return n.fn=e,this.on(t,n),this};xt.prototype.off=xt.prototype.removeListener=xt.prototype.removeAllListeners=xt.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks["$"+t];if(!n)return this;if(arguments.length==1)return delete this._callbacks["$"+t],this;for(var r,o=0;o<n.length;o++)if(r=n[o],r===e||r.fn===e){n.splice(o,1);break}return n.length===0&&delete this._callbacks["$"+t],this};xt.prototype.emit=function(t){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),n=this._callbacks["$"+t],r=1;r<arguments.length;r++)e[r-1]=arguments[r];if(n){n=n.slice(0);for(var r=0,o=n.length;r<o;++r)n[r].apply(this,e)}return this};xt.prototype.emitReserved=xt.prototype.emit;xt.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]};xt.prototype.hasListeners=function(t){return!!this.listeners(t).length};const cf=typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,n)=>n(e,0),Bn=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),AL="arraybuffer";function HT(t,...e){return e.reduce((n,r)=>(t.hasOwnProperty(r)&&(n[r]=t[r]),n),{})}const TL=Bn.setTimeout,EL=Bn.clearTimeout;function ff(t,e){e.useNativeTimers?(t.setTimeoutFn=TL.bind(Bn),t.clearTimeoutFn=EL.bind(Bn)):(t.setTimeoutFn=Bn.setTimeout.bind(Bn),t.clearTimeoutFn=Bn.clearTimeout.bind(Bn))}const RL=1.33;function OL(t){return typeof t=="string"?_L(t):Math.ceil((t.byteLength||t.size)*RL)}function _L(t){let e=0,n=0;for(let r=0,o=t.length;r<o;r++)e=t.charCodeAt(r),e<128?n+=1:e<2048?n+=2:e<55296||e>=57344?n+=3:(r++,n+=4);return n}function FT(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function ML(t){let e="";for(let n in t)t.hasOwnProperty(n)&&(e.length&&(e+="&"),e+=encodeURIComponent(n)+"="+encodeURIComponent(t[n]));return e}function CL(t){let e={},n=t.split("&");for(let r=0,o=n.length;r<o;r++){let u=n[r].split("=");e[decodeURIComponent(u[0])]=decodeURIComponent(u[1])}return e}class kL extends Error{constructor(e,n,r){super(e),this.description=n,this.context=r,this.type="TransportError"}}class ry extends xt{constructor(e){super(),this.writable=!1,ff(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,n,r){return super.emitReserved("error",new kL(e,n,r)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(e){this.readyState==="open"&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const n=iy(e,this.socket.binaryType);this.onPacket(n)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,n={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(n)}_hostname(){const e=this.opts.hostname;return e.indexOf(":")===-1?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(e){const n=ML(e);return n.length?"?"+n:""}}class DL extends ry{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(e){this.readyState="pausing";const n=()=>{this.readyState="paused",e()};if(this._polling||!this.writable){let r=0;this._polling&&(r++,this.once("pollComplete",function(){--r||n()})),this.writable||(r++,this.once("drain",function(){--r||n()}))}else n()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){const n=r=>{if(this.readyState==="opening"&&r.type==="open"&&this.onOpen(),r.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(r)};bL(e,this.socket.binaryType).forEach(n),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const e=()=>{this.write([{type:"close"}])};this.readyState==="open"?e():this.once("open",e)}write(e){this.writable=!1,vL(e,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const e=this.opts.secure?"https":"http",n=this.query||{};return this.opts.timestampRequests!==!1&&(n[this.opts.timestampParam]=FT()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(e,n)}}let GT=!1;try{GT=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const NL=GT;function $L(){}class jL extends DL{constructor(e){if(super(e),typeof location<"u"){const n=location.protocol==="https:";let r=location.port;r||(r=n?"443":"80"),this.xd=typeof location<"u"&&e.hostname!==location.hostname||r!==e.port}}doWrite(e,n){const r=this.request({method:"POST",data:e});r.on("success",n),r.on("error",(o,u)=>{this.onError("xhr post error",o,u)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(n,r)=>{this.onError("xhr poll error",n,r)}),this.pollXhr=e}}let yo=class sc extends xt{constructor(e,n,r){super(),this.createRequest=e,ff(this,r),this._opts=r,this._method=r.method||"GET",this._uri=n,this._data=r.data!==void 0?r.data:null,this._create()}_create(){var e;const n=HT(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this._opts.xd;const r=this._xhr=this.createRequest(n);try{r.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let o in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(o)&&r.setRequestHeader(o,this._opts.extraHeaders[o])}}catch{}if(this._method==="POST")try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{r.setRequestHeader("Accept","*/*")}catch{}(e=this._opts.cookieJar)===null||e===void 0||e.addCookies(r),"withCredentials"in r&&(r.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(r.timeout=this._opts.requestTimeout),r.onreadystatechange=()=>{var o;r.readyState===3&&((o=this._opts.cookieJar)===null||o===void 0||o.parseCookies(r.getResponseHeader("set-cookie"))),r.readyState===4&&(r.status===200||r.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof r.status=="number"?r.status:0)},0))},r.send(this._data)}catch(o){this.setTimeoutFn(()=>{this._onError(o)},0);return}typeof document<"u"&&(this._index=sc.requestsCount++,sc.requests[this._index]=this)}_onError(e){this.emitReserved("error",e,this._xhr),this._cleanup(!0)}_cleanup(e){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=$L,e)try{this._xhr.abort()}catch{}typeof document<"u"&&delete sc.requests[this._index],this._xhr=null}}_onLoad(){const e=this._xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}};yo.requestsCount=0;yo.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",bx);else if(typeof addEventListener=="function"){const t="onpagehide"in Bn?"pagehide":"unload";addEventListener(t,bx,!1)}}function bx(){for(let t in yo.requests)yo.requests.hasOwnProperty(t)&&yo.requests[t].abort()}const BL=function(){const t=YT({xdomain:!1});return t&&t.responseType!==null}();class LL extends jL{constructor(e){super(e);const n=e&&e.forceBase64;this.supportsBinary=BL&&!n}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new yo(YT,this.uri(),e)}}function YT(t){const e=t.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||NL))return new XMLHttpRequest}catch{}if(!e)try{return new Bn[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const XT=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class VL extends ry{get name(){return"websocket"}doOpen(){const e=this.uri(),n=this.opts.protocols,r=XT?{}:HT(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,n,r)}catch(o){return this.emitReserved("error",o)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let n=0;n<e.length;n++){const r=e[n],o=n===e.length-1;ny(r,this.supportsBinary,u=>{try{this.doWrite(r,u)}catch{}o&&cf(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",n=this.query||{};return this.opts.timestampRequests&&(n[this.opts.timestampParam]=FT()),this.supportsBinary||(n.b64=1),this.createUri(e,n)}}const Wh=Bn.WebSocket||Bn.MozWebSocket;class zL extends VL{createSocket(e,n,r){return XT?new Wh(e,n,r):n?new Wh(e,n):new Wh(e)}doWrite(e,n){this.ws.send(n)}}class UL extends ry{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved("error",e)}this._transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{const n=xL(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=e.readable.pipeThrough(n).getReader(),o=SL();o.readable.pipeTo(e.writable),this._writer=o.writable.getWriter();const u=()=>{r.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(e){this.writable=!1;for(let n=0;n<e.length;n++){const r=e[n],o=n===e.length-1;this._writer.write(r).then(()=>{o&&cf(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)===null||e===void 0||e.close()}}const qL={websocket:zL,webtransport:UL,polling:LL},PL=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,KL=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Yp(t){if(t.length>8e3)throw"URI too long";const e=t,n=t.indexOf("["),r=t.indexOf("]");n!=-1&&r!=-1&&(t=t.substring(0,n)+t.substring(n,r).replace(/:/g,";")+t.substring(r,t.length));let o=PL.exec(t||""),u={},c=14;for(;c--;)u[KL[c]]=o[c]||"";return n!=-1&&r!=-1&&(u.source=e,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=IL(u,u.path),u.queryKey=HL(u,u.query),u}function IL(t,e){const n=/\/{2,9}/g,r=e.replace(n,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&r.splice(0,1),e.slice(-1)=="/"&&r.splice(r.length-1,1),r}function HL(t,e){const n={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,o,u){o&&(n[o]=u)}),n}const Xp=typeof addEventListener=="function"&&typeof removeEventListener=="function",oc=[];Xp&&addEventListener("offline",()=>{oc.forEach(t=>t())},!1);class Er extends xt{constructor(e,n){if(super(),this.binaryType=AL,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&typeof e=="object"&&(n=e,e=null),e){const r=Yp(e);n.hostname=r.host,n.secure=r.protocol==="https"||r.protocol==="wss",n.port=r.port,r.query&&(n.query=r.query)}else n.host&&(n.hostname=Yp(n.host).host);ff(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(r=>{const o=r.prototype.name;this.transports.push(o),this._transportsByName[o]=r}),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=CL(this.opts.query)),Xp&&(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"})},oc.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){const n=Object.assign({},this.opts.query);n.EIO=IT,n.transport=e,this.id&&(n.sid=this.id);const r=Object.assign({},this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](r)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const e=this.opts.rememberUpgrade&&Er.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const n=this.createTransport(e);n.open(),this.setTransport(n)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.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",Er.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.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=e.data,this._onError(n);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data);break}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},e),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 e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let n=1;for(let r=0;r<this.writeBuffer.length;r++){const o=this.writeBuffer[r].data;if(o&&(n+=OL(o)),r>0&&n>this._maxPayload)return this.writeBuffer.slice(0,r);n+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,cf(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}write(e,n,r){return this._sendPacket("message",e,n,r),this}send(e,n,r){return this._sendPacket("message",e,n,r),this}_sendPacket(e,n,r,o){if(typeof n=="function"&&(o=n,n=void 0),typeof r=="function"&&(o=r,r=null),this.readyState==="closing"||this.readyState==="closed")return;r=r||{},r.compress=r.compress!==!1;const u={type:e,data:n,options:r};this.emitReserved("packetCreate",u),this.writeBuffer.push(u),o&&this.once("flush",o),this.flush()}close(){const e=()=>{this._onClose("forced close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),e()},r=()=>{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?r():e()}):this.upgrading?r():e()),this}_onError(e){if(Er.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,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(),Xp&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const r=oc.indexOf(this._offlineEventListener);r!==-1&&oc.splice(r,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,n),this.writeBuffer=[],this._prevBufferLen=0}}}Er.protocol=IT;class FL extends Er{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let n=this.createTransport(e),r=!1;Er.priorWebsocketSuccess=!1;const o=()=>{r||(n.send([{type:"ping",data:"probe"}]),n.once("packet",g=>{if(!r)if(g.type==="pong"&&g.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;Er.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{r||this.readyState!=="closed"&&(y(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{const b=new Error("probe error");b.transport=n.name,this.emitReserved("upgradeError",b)}}))};function u(){r||(r=!0,y(),n.close(),n=null)}const c=g=>{const b=new Error("probe error: "+g);b.transport=n.name,u(),this.emitReserved("upgradeError",b)};function d(){c("transport closed")}function h(){c("socket closed")}function m(g){n&&g.name!==n.name&&u()}const y=()=>{n.removeListener("open",o),n.removeListener("error",c),n.removeListener("close",d),this.off("close",h),this.off("upgrading",m)};n.once("open",o),n.once("error",c),n.once("close",d),this.once("close",h),this.once("upgrading",m),this._upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{r||n.open()},200):n.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){const n=[];for(let r=0;r<e.length;r++)~this.transports.indexOf(e[r])&&n.push(e[r]);return n}}let GL=class extends FL{constructor(e,n={}){const r=typeof e=="object"?e:n;(!r.transports||r.transports&&typeof r.transports[0]=="string")&&(r.transports=(r.transports||["polling","websocket","webtransport"]).map(o=>qL[o]).filter(o=>!!o)),super(e,r)}};function YL(t,e="",n){let r=t;n=n||typeof location<"u"&&location,t==null&&(t=n.protocol+"//"+n.host),typeof t=="string"&&(t.charAt(0)==="/"&&(t.charAt(1)==="/"?t=n.protocol+t:t=n.host+t),/^(https?|wss?):\/\//.test(t)||(typeof n<"u"?t=n.protocol+"//"+t:t="https://"+t),r=Yp(t)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";const u=r.host.indexOf(":")!==-1?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+u+":"+r.port+e,r.href=r.protocol+"://"+u+(n&&n.port===r.port?"":":"+r.port),r}const XL=typeof ArrayBuffer=="function",ZL=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t.buffer instanceof ArrayBuffer,ZT=Object.prototype.toString,JL=typeof Blob=="function"||typeof Blob<"u"&&ZT.call(Blob)==="[object BlobConstructor]",QL=typeof File=="function"||typeof File<"u"&&ZT.call(File)==="[object FileConstructor]";function sy(t){return XL&&(t instanceof ArrayBuffer||ZL(t))||JL&&t instanceof Blob||QL&&t instanceof File}function ac(t,e){if(!t||typeof t!="object")return!1;if(Array.isArray(t)){for(let n=0,r=t.length;n<r;n++)if(ac(t[n]))return!0;return!1}if(sy(t))return!0;if(t.toJSON&&typeof t.toJSON=="function"&&arguments.length===1)return ac(t.toJSON(),!0);for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&ac(t[n]))return!0;return!1}function WL(t){const e=[],n=t.data,r=t;return r.data=Zp(n,e),r.attachments=e.length,{packet:r,buffers:e}}function Zp(t,e){if(!t)return t;if(sy(t)){const n={_placeholder:!0,num:e.length};return e.push(t),n}else if(Array.isArray(t)){const n=new Array(t.length);for(let r=0;r<t.length;r++)n[r]=Zp(t[r],e);return n}else if(typeof t=="object"&&!(t instanceof Date)){const n={};for(const r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=Zp(t[r],e));return n}return t}function eV(t,e){return t.data=Jp(t.data,e),delete t.attachments,t}function Jp(t,e){if(!t)return t;if(t&&t._placeholder===!0){if(typeof t.num=="number"&&t.num>=0&&t.num<e.length)return e[t.num];throw new Error("illegal attachments")}else if(Array.isArray(t))for(let n=0;n<t.length;n++)t[n]=Jp(t[n],e);else if(typeof t=="object")for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(t[n]=Jp(t[n],e));return t}const tV=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],nV=5;var _e;(function(t){t[t.CONNECT=0]="CONNECT",t[t.DISCONNECT=1]="DISCONNECT",t[t.EVENT=2]="EVENT",t[t.ACK=3]="ACK",t[t.CONNECT_ERROR=4]="CONNECT_ERROR",t[t.BINARY_EVENT=5]="BINARY_EVENT",t[t.BINARY_ACK=6]="BINARY_ACK"})(_e||(_e={}));class iV{constructor(e){this.replacer=e}encode(e){return(e.type===_e.EVENT||e.type===_e.ACK)&&ac(e)?this.encodeAsBinary({type:e.type===_e.EVENT?_e.BINARY_EVENT:_e.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let n=""+e.type;return(e.type===_e.BINARY_EVENT||e.type===_e.BINARY_ACK)&&(n+=e.attachments+"-"),e.nsp&&e.nsp!=="/"&&(n+=e.nsp+","),e.id!=null&&(n+=e.id),e.data!=null&&(n+=JSON.stringify(e.data,this.replacer)),n}encodeAsBinary(e){const n=WL(e),r=this.encodeAsString(n.packet),o=n.buffers;return o.unshift(r),o}}function Sx(t){return Object.prototype.toString.call(t)==="[object Object]"}class oy extends xt{constructor(e){super(),this.reviver=e}add(e){let n;if(typeof e=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");n=this.decodeString(e);const r=n.type===_e.BINARY_EVENT;r||n.type===_e.BINARY_ACK?(n.type=r?_e.EVENT:_e.ACK,this.reconstructor=new rV(n),n.attachments===0&&super.emitReserved("decoded",n)):super.emitReserved("decoded",n)}else if(sy(e)||e.base64)if(this.reconstructor)n=this.reconstructor.takeBinaryData(e),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: "+e)}decodeString(e){let n=0;const r={type:Number(e.charAt(0))};if(_e[r.type]===void 0)throw new Error("unknown packet type "+r.type);if(r.type===_e.BINARY_EVENT||r.type===_e.BINARY_ACK){const u=n+1;for(;e.charAt(++n)!=="-"&&n!=e.length;);const c=e.substring(u,n);if(c!=Number(c)||e.charAt(n)!=="-")throw new Error("Illegal attachments");r.attachments=Number(c)}if(e.charAt(n+1)==="/"){const u=n+1;for(;++n&&!(e.charAt(n)===","||n===e.length););r.nsp=e.substring(u,n)}else r.nsp="/";const o=e.charAt(n+1);if(o!==""&&Number(o)==o){const u=n+1;for(;++n;){const c=e.charAt(n);if(c==null||Number(c)!=c){--n;break}if(n===e.length)break}r.id=Number(e.substring(u,n+1))}if(e.charAt(++n)){const u=this.tryParse(e.substr(n));if(oy.isPayloadValid(r.type,u))r.data=u;else throw new Error("invalid payload")}return r}tryParse(e){try{return JSON.parse(e,this.reviver)}catch{return!1}}static isPayloadValid(e,n){switch(e){case _e.CONNECT:return Sx(n);case _e.DISCONNECT:return n===void 0;case _e.CONNECT_ERROR:return typeof n=="string"||Sx(n);case _e.EVENT:case _e.BINARY_EVENT:return Array.isArray(n)&&(typeof n[0]=="number"||typeof n[0]=="string"&&tV.indexOf(n[0])===-1);case _e.ACK:case _e.BINARY_ACK:return Array.isArray(n)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class rV{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const n=eV(this.reconPack,this.buffers);return this.finishedReconstruction(),n}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const sV=Object.freeze(Object.defineProperty({__proto__:null,Decoder:oy,Encoder:iV,get PacketType(){return _e},protocol:nV},Symbol.toStringTag,{value:"Module"}));function Hn(t,e,n){return t.on(e,n),function(){t.off(e,n)}}const oV=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class JT extends xt{constructor(e,n,r){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=e,this.nsp=n,r&&r.auth&&(this.auth=r.auth),this._opts=Object.assign({},r),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[Hn(e,"open",this.onopen.bind(this)),Hn(e,"packet",this.onpacket.bind(this)),Hn(e,"error",this.onerror.bind(this)),Hn(e,"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(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...n){var r,o,u;if(oV.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(n.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(n),this;const c={type:_e.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=(o=(r=this.io.engine)===null||r===void 0?void 0:r.transport)===null||o===void 0?void 0:o.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(e,n){var r;const o=(r=this.flags.timeout)!==null&&r!==void 0?r:this._opts.ackTimeout;if(o===void 0){this.acks[e]=n;return}const u=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let d=0;d<this.sendBuffer.length;d++)this.sendBuffer[d].id===e&&this.sendBuffer.splice(d,1);n.call(this,new Error("operation has timed out"))},o),c=(...d)=>{this.io.clearTimeoutFn(u),n.apply(this,d)};c.withError=!0,this.acks[e]=c}emitWithAck(e,...n){return new Promise((r,o)=>{const u=(c,d)=>c?o(c):r(d);u.withError=!0,n.push(u),this.emit(e,...n)})}_addToQueue(e){let n;typeof e[e.length-1]=="function"&&(n=e.pop());const r={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((o,...u)=>r!==this._queue[0]?void 0:(o!==null?r.tryCount>this._opts.retries&&(this._queue.shift(),n&&n(o)):(this._queue.shift(),n&&n(null,...u)),r.pending=!1,this._drainQueue())),this._queue.push(r),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;const n=this._queue[0];n.pending&&!e||(n.pending=!0,n.tryCount++,this.flags=n.flags,this.emit.apply(this,n.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:_e.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,n){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,n),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(r=>String(r.id)===e)){const r=this.acks[e];delete this.acks[e],r.withError&&r.call(this,new Error("socket has been disconnected"))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case _e.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.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 _e.EVENT:case _e.BINARY_EVENT:this.onevent(e);break;case _e.ACK:case _e.BINARY_ACK:this.onack(e);break;case _e.DISCONNECT:this.ondisconnect();break;case _e.CONNECT_ERROR:this.destroy();const r=new Error(e.data.message);r.data=e.data.data,this.emitReserved("connect_error",r);break}}onevent(e){const n=e.data||[];e.id!=null&&n.push(this.ack(e.id)),this.connected?this.emitEvent(n):this.receiveBuffer.push(Object.freeze(n))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const n=this._anyListeners.slice();for(const r of n)r.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]=="string"&&(this._lastOffset=e[e.length-1])}ack(e){const n=this;let r=!1;return function(...o){r||(r=!0,n.packet({type:_e.ACK,id:e,data:o}))}}onack(e){const n=this.acks[e.id];typeof n=="function"&&(delete this.acks[e.id],n.withError&&e.data.unshift(null),n.apply(this,e.data))}onconnect(e,n){this.id=e,this.recovered=n&&this._pid===n,this._pid=n,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:_e.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const n=this._anyListeners;for(let r=0;r<n.length;r++)if(e===n[r])return n.splice(r,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){const n=this._anyOutgoingListeners;for(let r=0;r<n.length;r++)if(e===n[r])return n.splice(r,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const n=this._anyOutgoingListeners.slice();for(const r of n)r.apply(this,e.data)}}}function jo(t){t=t||{},this.ms=t.min||100,this.max=t.max||1e4,this.factor=t.factor||2,this.jitter=t.jitter>0&&t.jitter<=1?t.jitter:0,this.attempts=0}jo.prototype.duration=function(){var t=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),n=Math.floor(e*this.jitter*t);t=(Math.floor(e*10)&1)==0?t-n:t+n}return Math.min(t,this.max)|0};jo.prototype.reset=function(){this.attempts=0};jo.prototype.setMin=function(t){this.ms=t};jo.prototype.setMax=function(t){this.max=t};jo.prototype.setJitter=function(t){this.jitter=t};class Qp extends xt{constructor(e,n){var r;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(n=e,e=void 0),n=n||{},n.path=n.path||"/socket.io",this.opts=n,ff(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((r=n.randomizationFactor)!==null&&r!==void 0?r:.5),this.backoff=new jo({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=e;const o=n.parser||sV;this.encoder=new o.Encoder,this.decoder=new o.Decoder,this._autoConnect=n.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var n;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(n=this.backoff)===null||n===void 0||n.setMin(e),this)}randomizationFactor(e){var n;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(n=this.backoff)===null||n===void 0||n.setJitter(e),this)}reconnectionDelayMax(e){var n;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(n=this.backoff)===null||n===void 0||n.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new GL(this.uri,this.opts);const n=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const o=Hn(n,"open",function(){r.onopen(),e&&e()}),u=d=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",d),e?e(d):this.maybeReconnectOnOpen()},c=Hn(n,"error",u);if(this._timeout!==!1){const d=this._timeout,h=this.setTimeoutFn(()=>{o(),u(new Error("timeout")),n.close()},d);this.opts.autoUnref&&h.unref(),this.subs.push(()=>{this.clearTimeoutFn(h)})}return this.subs.push(o),this.subs.push(c),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(Hn(e,"ping",this.onping.bind(this)),Hn(e,"data",this.ondata.bind(this)),Hn(e,"error",this.onerror.bind(this)),Hn(e,"close",this.onclose.bind(this)),Hn(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(n){this.onclose("parse error",n)}}ondecoded(e){cf(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,n){let r=this.nsps[e];return r?this._autoConnect&&!r.active&&r.connect():(r=new JT(this,e,n),this.nsps[e]=r),r}_destroy(e){const n=Object.keys(this.nsps);for(const r of n)if(this.nsps[r].active)return;this._close()}_packet(e){const n=this.encoder.encode(e);for(let r=0;r<n.length;r++)this.engine.write(n[r],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(e,n){var r;this.cleanup(),(r=this.engine)===null||r===void 0||r.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,n),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=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 r=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(o=>{o?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",o)):e.onreconnect()}))},n);this.opts.autoUnref&&r.unref(),this.subs.push(()=>{this.clearTimeoutFn(r)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const Va={};function lc(t,e){typeof t=="object"&&(e=t,t=void 0),e=e||{};const n=YL(t,e.path||"/socket.io"),r=n.source,o=n.id,u=n.path,c=Va[o]&&u in Va[o].nsps,d=e.forceNew||e["force new connection"]||e.multiplex===!1||c;let h;return d?h=new Qp(r,e):(Va[o]||(Va[o]=new Qp(r,e)),h=Va[o]),n.query&&!e.query&&(e.query=n.queryKey),h.socket(n.path,e)}Object.assign(lc,{Manager:Qp,Socket:JT,io:lc,connect:lc});const aV=["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"],lV=3,uV=15,cV=/^[a-zA-Z0-9_-]+$/,fV=St(cV).pipe(St(`string > ${lV} & string < ${uV}`)).brand("username"),xx=20,wx={0:"o",1:"l",3:"e",4:"a",5:"s",7:"t","@":"a",$:"s","!":"i"};function dV(t){let e="";for(const n of t)n in wx?e+=wx[n]:e+=n;return e}function hV(t){const e=t.toLocaleLowerCase(),n=dV(e);for(const r of aV)if(n.includes(r)||e.includes(r))return!0;return!1}function pV(t){const e=new Set(t).size;return t.length*Math.log2(e)}function mV(t){let e=0;return hV(t)&&(e-=100),e+=pV(t)*.5,Math.max(e,0)}const yV=St("string").narrow((t,e)=>{const n=mV(t);return n>=xx?!0:e.mustBe(`Of complexity ${xx} or more. Was ${n.toFixed(2)}.`)}).brand("password");St({"+":"delete",email:"string",password:"string"});const gV=St("string").brand("email");St({"+":"delete",username:"string",password:"string",email:"string"});const vV=St({email:"string",userId:"string",username:"string",password:"boolean",verification:"'unverified' | 'verified'"}),fi=lc(LT.VITE_BACKEND_ORIGIN,{auth:t=>{const e=We(ot);e&&t(e)},withCredentials:!0,autoConnect:!1});fi.on("connect",()=>{console.log("connected")}).on("connect_error",()=>{console.log("connect_error"),De(ot,null)}).on("usernameChanged",t=>{De(ot,e=>e===null?null:{...e,username:t})});const ot=at({key:"auth",default:function(){const e=localStorage.getItem("auth");if(e)try{const n=ko(e),r=vV(n);return r instanceof St.errors?(console.error("failed to parse auth data",r),null):(r.verification==="verified"&&(console.log("connecting..."),fi.connect()),r)}catch(n){return console.error("failed to parse auth data",n),null}return null},effects:[function({onSet:e}){e(async({newValue:n})=>{console.log("setting auth",n),n?(console.log("setting auth",n),De(go,n.username),localStorage.setItem("auth",Ln(n)),n.verification==="verified"?(console.log("connecting..."),fi.connect()):await VT(async()=>{const{navigate:r}=await Promise.resolve().then(()=>wV);return{navigate:r}},void 0).then(({navigate:r})=>{r("/verify")})):(console.log("clearing session..."),localStorage.removeItem("auth"))})}]}),go=at({key:"username",default:We(ot)?.username??""}),ep=at({key:"usernameDebounce",default:!0}),bV=at({key:"usernameDebounced100ms",default:window.localStorage.getItem("username")??"",effects:[({setSelf:t})=>{gM(go,()=>{We(ep)&&(t(We(go)),De(ep,!1),setTimeout(()=>{De(ep,!0),t(We(go))},2e3))})}]}),SV=di({key:"isUsernameTakenQuery",get:async({get:t})=>{const e=t(bV);if(!e)return!1;const n=We(ot);if(e===n?.username)return!1;const{trpcClient:r}=await VT(async()=>{const{trpcClient:o}=await Promise.resolve().then(()=>lL);return{trpcClient:o}},void 0);return r.isUsernameTaken.query({username:e})}}),QT=di({key:"usernameIssues",get:({get:t})=>{const e=t(go),n=fV(e);return n instanceof St.errors?n:null}}),ri=at({key:"password0",default:""}),WT=di({key:"password0Issues",get:({get:t})=>{const e=t(ri),n=yV(e);return n instanceof St.errors?n:null}}),_o=at({key:"email",default:""}),eE=di({key:"emailIssues",get:({get:t})=>{const e=t(_o),n=gV(e);return n instanceof St.errors?n:null}});di({key:"signupReady",get:({get:t})=>{const e=t(QT),n=t(WT),r=t(eE);return!(e??n??r)}});const Li=at({key:"oneTimeCode",default:""}),Wp=at({key:"oneTimeCodeNewEmail",default:""}),ni=at({key:"authTarget",default:null}),ay=Zh({verify:Zh({$token:null}),game:Zh({clicker:null}),account:null,admin:null});function tE(t){return fL(ay,t)}const nE=[[]];function xV(t){return nE.some(e=>e.join("/")===t.join("/"))}function cs(t){history.pushState(null,"",t),De(ly,t)}const ly=at({key:"pathName",default:window.location.pathname,effects:[({onSet:t,setSelf:e})=>{const n=o=>{history.replaceState(null,"",o),e(o)},r=o=>{switch(o){case"/":{const u=We(ot);switch(console.log("/","auth",u),u?.verification){case"verified":n("/game");break;case"unverified":n("/verify");break}break}case"/verify":{We(ot)?.verification==="verified"&&n("/game");break}case"/game":case"/game/clicker":{We(ot)?.verification==="unverified"&&n("/verify");break}case"/admin":break;case"/account":{const u=We(ot);if(!u){n("/");break}u.verification==="unverified"&&n("/verify");break}}};r(window.location.pathname),t(({newValue:o})=>{r(o)})},({setSelf:t})=>{document.addEventListener("click",e=>{const n=e.target.closest("a");if(n&&n instanceof HTMLAnchorElement){const r=n.getAttribute("href");r?.startsWith("/")&&(e.preventDefault(),history.pushState(null,"",r),t(r))}}),window.addEventListener("popstate",()=>{t(window.location.pathname)})}]}),iE=di({key:"route",get:({get:t})=>{const n=t(ly).split("/").slice(1).filter(Boolean);return tE(n)?xV(n)||t(ot)?n:401:404}}),wV=Object.freeze(Object.defineProperty({__proto__:null,PUBLIC_ROUTES:nE,ROUTES:ay,isRoute:tE,navigate:cs,pathnameAtom:ly,routeSelector:iE},Symbol.toStringTag,{value:"Module"})),Ax=at({key:"buttonBlockActive",default:!1}),Nn=at({key:"editing",default:[],effects:[({onSet:t})=>{t(({newValue:e})=>{switch(e[0]){case"email":{We(rE)?.focus();break}case"new-password":{We(sE)?.focus();break}case"username":{We(oE)?.focus();break}}})}]}),rE=at({key:"emailInputElement",default:null}),sE=at({key:"password0InputElement",default:null}),oE=at({key:"usernameInputElement",default:null});function AV(t){const e=B.useRef(null);return B.useEffect(()=>{De(t,e.current)},[t]),e}const TV=di({key:"otcLoginFieldLabel",get:({get:t})=>{const e=t(ot);return e?`Code sent to ${e.email}`:""}}),EV=di({key:"otcVerifyFieldLabel",get:({get:t})=>{const e=t(_o);return e?`Code sent to ${e}`:""}});function tp({label:t,inputToken:e,issuesToken:n,inputElementToken:r,initialState:o,onSubmit:u,onOpen:c,onCancel:d,extraIssues:h}){const m=bt(e),y=Fn(e),g=bt(Li),b=Fn(Li),x=bt(Wp),A=Fn(Wp),w=bt(ri),k=Fn(ri),$=bt(Ax),M=Fn(Ax),O=bt(Nn),G=Fn(Nn),V=bt(n),W=bt(TV),ne=bt(EV),ee=AV(r),ce=O[0]===t,me=O.at(-1),[be,...Me]=O;return F.jsxs("form",{onSubmit:async Se=>{if(Se.preventDefault(),$){M(!1);return}console.log(`submitted! changing ${t} to`,m);const he=await u(m);Error.isError(he)&&console.error(he)},children:[ce?F.jsx("button",{type:"button",onClick:async()=>{await d?.(),G([])},children:"x"}):null,F.jsxs("main",{children:[F.jsxs("label",{htmlFor:t,children:[V||h?F.jsxs("aside",{children:[h,V?.map(Se=>F.jsx("span",{children:Se.message},Se.path.join(".")))]}):null,F.jsx("span",{children:t==="new-password"?"Password":B1(t)}),F.jsx("input",{id:t,type:t==="new-password"?"password":"text",ref:ee,value:m,onChange:Se=>{y(Se.target.value)},autoComplete:t,autoCapitalize:"none",disabled:me!==t})]}),ce?Me.map(Se=>F.jsxs("label",{htmlFor:`${t}-${Se}`,children:[F.jsx("span",{children:(()=>{switch(Se){case"otcLogin":return W;case"otcVerify":return ne;case"passwordLogin":return"Password"}})()}),F.jsx("input",{id:`${t}-otc`,type:"text",ref:ee,value:(()=>{switch(Se){case"otcLogin":return g;case"otcVerify":return t==="email"?x:g;case"passwordLogin":return w}})(),onChange:he=>{switch(Se){case"otcLogin":b(he.target.value);break;case"otcVerify":if(t==="email"){A(he.target.value);break}b(he.target.value);break;case"passwordLogin":k(he.target.value)}},autoComplete:t.includes("otc")?"one-time-code":t.includes("password")?"password":"",autoCapitalize:"none",disabled:Se!==me})]},`${t}-${Se}`)):null]}),O[0]===t?F.jsx("button",{type:"submit",children:"->"}):F.jsx("button",{type:"button",onMouseDown:async()=>{M(!0),await c?.(),G(o)},onMouseUp:()=>{M(!1)},children:"/"})]})}function RV(){const t=bt(ot),e=bt(SV);return hc(()=>{t&&De(_o,t.email),t?.password&&De(ri,"โขโขโขโขโขโขโขโขโขโขโขโข")}),t?F.jsxs("article",{"data-css":"editor",children:[F.jsx(tp,{label:"username",inputToken:go,issuesToken:QT,inputElementToken:oE,initialState:["username"],onSubmit:async n=>(await new Promise(r=>{fi.once("usernameChanged",r),fi.emit("changeUsername",n)}),De(Nn,[]),n),extraIssues:e?F.jsx("span",{children:"This username is taken."}):null}),F.jsx(tp,{label:"email",inputToken:_o,issuesToken:eE,inputElementToken:rE,initialState:["email"],onSubmit:async n=>{const r=We(Nn);if(r[0]!=="email")return new Error("field not email");switch(r.length){case 1:{const{userKey:o,nextStep:u}=await on.offerNewEmail.mutate({emailOffered:n});switch(console.log({authTarget:o,nextStep:u}),u){case"otc_login":{De(ni,o),De(Nn,["email","otcLogin"]);break}case"password_login":{De(ni,o),De(Nn,["email","passwordLogin"]);break}case"otc_verify":{De(ni,o),De(Li,"not needed"),De(Nn,["email","otcLogin","otcVerify"]);break}}return o}case 2:switch(console.log("case 2"),r[1]){case"otcLogin":{console.log("case 2.1");const o=We(ni);if(!o)return new Error("No auth target");const u=We(Li),c=await on.verifyAccountAction.mutate({oneTimeCode:u,userKey:o});return De(ot,c),De(Nn,["email","otcLogin","otcVerify"]),o}case"passwordLogin":return new Error("not implemented")}break;case 3:{const o=We(ni);if(!o)return new Error("No auth target");const u=We(Wp),c=await on.verifyAccountAction.mutate({oneTimeCode:u,userKey:o});return De(ot,c),De(Nn,[]),c.email}}}}),F.jsx(tp,{label:"new-password",inputToken:ri,issuesToken:WT,inputElementToken:sE,initialState:t.password?["new-password","otcVerify"]:["new-password"],onSubmit:async n=>{const r=We(Nn);if(r[0]!=="new-password")return new Error("field not new-password");switch(r.length){case 1:return await on.setPassword.mutate({password:n}),De(ri,"โขโขโขโขโขโขโขโขโขโขโขโข"),De(ot,o=>o&&{...o,password:!0}),De(Nn,[]),"done";case 2:{const o=We(ni);return o?(await on.verifyAccountAction.mutate({oneTimeCode:We(Li),userKey:o}),De(ot,u=>u&&{...u,password:!1}),De(ri,""),De(Nn,["new-password"]),"done"):new Error("No userKey")}}},onCancel:()=>{t.password&&De(ri,"โขโขโขโขโขโขโขโขโขโขโขโข")},onOpen:async()=>{if(t.password){const n=We(ni);if(!n)return new Error("No userKey");await on.startPasswordReset.mutate({userKey:n})}}})]}):F.jsx("p",{children:"You must be logged in to verify your account."})}function OV(){return F.jsx("article",{children:F.jsx("h1",{children:"admin"})})}class _V extends Map{set(e,n){return this.has(e)?(console.warn("Tried to set a key that already exists in an InvariantMap",{key:e,value:n}),this):super.set(e,n)}clear(){throw new Error("Cannot clear an InvariantMap")}}class Dc{type="continuity";globals=[];actions=[];perspectives=[];key;constructor(e){this.key=e}static existing=new _V;static create(e,n){const r=new Dc(e),{type:o,globals:u,actions:c,perspectives:d}=n(r),h={type:o,key:e,globals:u,actions:c,perspectives:d};return Dc.existing.set(e,h),h}add(...e){switch(e[0].type){case"atom":case"mutable_atom":this.globals.push(...e);break;case"transaction":this.actions.push(...e);break;case"atom_family":case"mutable_atom_family":{const[r,o]=e;this.perspectives.push({type:"realtime_perspective",resourceAtoms:r,viewAtoms:o})}break}return this}}function MV(t){const{key:e,config:n}=t,r=Dc.create(e,n),{actions:o}=r;for(const u of o)Y1(wn.STORE,e,u.key);return Om(wn.STORE,e,-1),r}const uy=at({key:"count",default:0}),aE=vM({key:"incrementTX",do:({set:t})=>{t(uy,e=>e+1)}}),CV=MV({key:"countContinuity",config:t=>t.add(uy).add(aE)});function kV({route:[,t]}){return F.jsx("article",{children:t?F.jsx(NV,{gameId:t}):F.jsx(DV,{})})}function DV(){return F.jsx("nav",{children:F.jsx(wT,{href:"/game/clicker",children:"Clicker"})})}fM(ay[1].game[1]);function NV({gameId:t}){console.log(t);const e=bt(uy),n=bM(aE);return fC(CV),F.jsxs("article",{children:[F.jsxs("button",{type:"button",onClick:()=>{n()},children:["count is ",e]}),F.jsx("p",{children:"Let's see how high we can count!"})]})}const lE=B.createContext({});function $V(t){const e=B.useRef(null);return e.current===null&&(e.current=t()),e.current}const cy=typeof window<"u",jV=cy?B.useLayoutEffect:B.useEffect,fy=B.createContext(null);function dy(t,e){t.indexOf(e)===-1&&t.push(e)}function hy(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}const Ii=(t,e,n)=>n>e?e:n<t?t:n;let py=()=>{};const Hi={},uE=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t);function cE(t){return typeof t=="object"&&t!==null}const fE=t=>/^0[^.\s]+$/u.test(t);function my(t){let e;return()=>(e===void 0&&(e=t()),e)}const Vn=t=>t,BV=(t,e)=>n=>e(t(n)),Sl=(...t)=>t.reduce(BV),tl=(t,e,n)=>{const r=e-t;return r===0?1:(n-t)/r};class yy{constructor(){this.subscriptions=[]}add(e){return dy(this.subscriptions,e),()=>hy(this.subscriptions,e)}notify(e,n,r){const o=this.subscriptions.length;if(o)if(o===1)this.subscriptions[0](e,n,r);else for(let u=0;u<o;u++){const c=this.subscriptions[u];c&&c(e,n,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const oi=t=>t*1e3,ai=t=>t/1e3;function dE(t,e){return e?t*(1e3/e):0}const hE=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t,LV=1e-7,VV=12;function zV(t,e,n,r,o){let u,c,d=0;do c=e+(n-e)/2,u=hE(c,r,o)-t,u>0?n=c:e=c;while(Math.abs(u)>LV&&++d<VV);return c}function xl(t,e,n,r){if(t===e&&n===r)return Vn;const o=u=>zV(u,0,1,t,n);return u=>u===0||u===1?u:hE(o(u),e,r)}const pE=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,mE=t=>e=>1-t(1-e),yE=xl(.33,1.53,.69,.99),gy=mE(yE),gE=pE(gy),vE=t=>(t*=2)<1?.5*gy(t):.5*(2-Math.pow(2,-10*(t-1))),vy=t=>1-Math.sin(Math.acos(t)),bE=mE(vy),SE=pE(vy),UV=xl(.42,0,1,1),qV=xl(0,0,.58,1),xE=xl(.42,0,.58,1),PV=t=>Array.isArray(t)&&typeof t[0]!="number",wE=t=>Array.isArray(t)&&typeof t[0]=="number",KV={linear:Vn,easeIn:UV,easeInOut:xE,easeOut:qV,circIn:vy,circInOut:SE,circOut:bE,backIn:gy,backInOut:gE,backOut:yE,anticipate:vE},IV=t=>typeof t=="string",Tx=t=>{if(wE(t)){py(t.length===4);const[e,n,r,o]=t;return xl(e,n,r,o)}else if(IV(t))return KV[t];return t},Zu=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"],Ex={value:null};function HV(t,e){let n=new Set,r=new Set,o=!1,u=!1;const c=new WeakSet;let d={delta:0,timestamp:0,isProcessing:!1},h=0;function m(g){c.has(g)&&(y.schedule(g),t()),h++,g(d)}const y={schedule:(g,b=!1,x=!1)=>{const w=x&&o?n:r;return b&&c.add(g),w.has(g)||w.add(g),g},cancel:g=>{r.delete(g),c.delete(g)},process:g=>{if(d=g,o){u=!0;return}o=!0,[n,r]=[r,n],n.forEach(m),e&&Ex.value&&Ex.value.frameloop[e].push(h),h=0,n.clear(),o=!1,u&&(u=!1,y.process(g))}};return y}const FV=40;function AE(t,e){let n=!1,r=!0;const o={delta:0,timestamp:0,isProcessing:!1},u=()=>n=!0,c=Zu.reduce((O,G)=>(O[G]=HV(u,e?G:void 0),O),{}),{setup:d,read:h,resolveKeyframes:m,preUpdate:y,update:g,preRender:b,render:x,postRender:A}=c,w=()=>{const O=Hi.useManualTiming?o.timestamp:performance.now();n=!1,Hi.useManualTiming||(o.delta=r?1e3/60:Math.max(Math.min(O-o.timestamp,FV),1)),o.timestamp=O,o.isProcessing=!0,d.process(o),h.process(o),m.process(o),y.process(o),g.process(o),b.process(o),x.process(o),A.process(o),o.isProcessing=!1,n&&e&&(r=!1,t(w))},k=()=>{n=!0,r=!0,o.isProcessing||t(w)};return{schedule:Zu.reduce((O,G)=>{const V=c[G];return O[G]=(W,ne=!1,ee=!1)=>(n||k(),V.schedule(W,ne,ee)),O},{}),cancel:O=>{for(let G=0;G<Zu.length;G++)c[Zu[G]].cancel(O)},state:o,steps:c}}const{schedule:nt,cancel:Or,state:Ut,steps:np}=AE(typeof requestAnimationFrame<"u"?requestAnimationFrame:Vn,!0);let uc;function GV(){uc=void 0}const an={now:()=>(uc===void 0&&an.set(Ut.isProcessing||Hi.useManualTiming?Ut.timestamp:performance.now()),uc),set:t=>{uc=t,queueMicrotask(GV)}},TE=t=>e=>typeof e=="string"&&e.startsWith(t),by=TE("--"),YV=TE("var(--"),Sy=t=>YV(t)?XV.test(t.split("/*")[0].trim()):!1,XV=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,Bo={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},nl={...Bo,transform:t=>Ii(0,1,t)},Ju={...Bo,default:1},Ga=t=>Math.round(t*1e5)/1e5,xy=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function ZV(t){return t==null}const JV=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,wy=(t,e)=>n=>!!(typeof n=="string"&&JV.test(n)&&n.startsWith(t)||e&&!ZV(n)&&Object.prototype.hasOwnProperty.call(n,e)),EE=(t,e,n)=>r=>{if(typeof r!="string")return r;const[o,u,c,d]=r.match(xy);return{[t]:parseFloat(o),[e]:parseFloat(u),[n]:parseFloat(c),alpha:d!==void 0?parseFloat(d):1}},QV=t=>Ii(0,255,t),ip={...Bo,transform:t=>Math.round(QV(t))},ts={test:wy("rgb","red"),parse:EE("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:r=1})=>"rgba("+ip.transform(t)+", "+ip.transform(e)+", "+ip.transform(n)+", "+Ga(nl.transform(r))+")"};function WV(t){let e="",n="",r="",o="";return t.length>5?(e=t.substring(1,3),n=t.substring(3,5),r=t.substring(5,7),o=t.substring(7,9)):(e=t.substring(1,2),n=t.substring(2,3),r=t.substring(3,4),o=t.substring(4,5),e+=e,n+=n,r+=r,o+=o),{red:parseInt(e,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:o?parseInt(o,16)/255:1}}const em={test:wy("#"),parse:WV,transform:ts.transform},wl=t=>({test:e=>typeof e=="string"&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),br=wl("deg"),li=wl("%"),de=wl("px"),e4=wl("vh"),t4=wl("vw"),Rx={...li,parse:t=>li.parse(t)/100,transform:t=>li.transform(t*100)},oo={test:wy("hsl","hue"),parse:EE("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:r=1})=>"hsla("+Math.round(t)+", "+li.transform(Ga(e))+", "+li.transform(Ga(n))+", "+Ga(nl.transform(r))+")"},vt={test:t=>ts.test(t)||em.test(t)||oo.test(t),parse:t=>ts.test(t)?ts.parse(t):oo.test(t)?oo.parse(t):em.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?ts.transform(t):oo.transform(t),getAnimatableNone:t=>{const e=vt.parse(t);return e.alpha=0,vt.transform(e)}},n4=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function i4(t){return isNaN(t)&&typeof t=="string"&&(t.match(xy)?.length||0)+(t.match(n4)?.length||0)>0}const RE="number",OE="color",r4="var",s4="var(",Ox="${}",o4=/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 il(t){const e=t.toString(),n=[],r={color:[],number:[],var:[]},o=[];let u=0;const d=e.replace(o4,h=>(vt.test(h)?(r.color.push(u),o.push(OE),n.push(vt.parse(h))):h.startsWith(s4)?(r.var.push(u),o.push(r4),n.push(h)):(r.number.push(u),o.push(RE),n.push(parseFloat(h))),++u,Ox)).split(Ox);return{values:n,split:d,indexes:r,types:o}}function _E(t){return il(t).values}function ME(t){const{split:e,types:n}=il(t),r=e.length;return o=>{let u="";for(let c=0;c<r;c++)if(u+=e[c],o[c]!==void 0){const d=n[c];d===RE?u+=Ga(o[c]):d===OE?u+=vt.transform(o[c]):u+=o[c]}return u}}const a4=t=>typeof t=="number"?0:vt.test(t)?vt.getAnimatableNone(t):t;function l4(t){const e=_E(t);return ME(t)(e.map(a4))}const _r={test:i4,parse:_E,createTransformer:ME,getAnimatableNone:l4};function rp(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+(e-t)*6*n:n<1/2?e:n<2/3?t+(e-t)*(2/3-n)*6:t}function u4({hue:t,saturation:e,lightness:n,alpha:r}){t/=360,e/=100,n/=100;let o=0,u=0,c=0;if(!e)o=u=c=n;else{const d=n<.5?n*(1+e):n+e-n*e,h=2*n-d;o=rp(h,d,t+1/3),u=rp(h,d,t),c=rp(h,d,t-1/3)}return{red:Math.round(o*255),green:Math.round(u*255),blue:Math.round(c*255),alpha:r}}function Nc(t,e){return n=>n>0?e:t}const tt=(t,e,n)=>t+(e-t)*n,sp=(t,e,n)=>{const r=t*t,o=n*(e*e-r)+r;return o<0?0:Math.sqrt(o)},c4=[em,ts,oo],f4=t=>c4.find(e=>e.test(t));function _x(t){const e=f4(t);if(!e)return!1;let n=e.parse(t);return e===oo&&(n=u4(n)),n}const Mx=(t,e)=>{const n=_x(t),r=_x(e);if(!n||!r)return Nc(t,e);const o={...n};return u=>(o.red=sp(n.red,r.red,u),o.green=sp(n.green,r.green,u),o.blue=sp(n.blue,r.blue,u),o.alpha=tt(n.alpha,r.alpha,u),ts.transform(o))},tm=new Set(["none","hidden"]);function d4(t,e){return tm.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}function h4(t,e){return n=>tt(t,e,n)}function Ay(t){return typeof t=="number"?h4:typeof t=="string"?Sy(t)?Nc:vt.test(t)?Mx:y4:Array.isArray(t)?CE:typeof t=="object"?vt.test(t)?Mx:p4:Nc}function CE(t,e){const n=[...t],r=n.length,o=t.map((u,c)=>Ay(u)(u,e[c]));return u=>{for(let c=0;c<r;c++)n[c]=o[c](u);return n}}function p4(t,e){const n={...t,...e},r={};for(const o in n)t[o]!==void 0&&e[o]!==void 0&&(r[o]=Ay(t[o])(t[o],e[o]));return o=>{for(const u in r)n[u]=r[u](o);return n}}function m4(t,e){const n=[],r={color:0,var:0,number:0};for(let o=0;o<e.values.length;o++){const u=e.types[o],c=t.indexes[u][r[u]],d=t.values[c]??0;n[o]=d,r[u]++}return n}const y4=(t,e)=>{const n=_r.createTransformer(e),r=il(t),o=il(e);return r.indexes.var.length===o.indexes.var.length&&r.indexes.color.length===o.indexes.color.length&&r.indexes.number.length>=o.indexes.number.length?tm.has(t)&&!o.values.length||tm.has(e)&&!r.values.length?d4(t,e):Sl(CE(m4(r,o),o.values),n):Nc(t,e)};function kE(t,e,n){return typeof t=="number"&&typeof e=="number"&&typeof n=="number"?tt(t,e,n):Ay(t)(t,e)}const g4=t=>{const e=({timestamp:n})=>t(n);return{start:(n=!0)=>nt.update(e,n),stop:()=>Or(e),now:()=>Ut.isProcessing?Ut.timestamp:an.now()}},DE=(t,e,n=10)=>{let r="";const o=Math.max(Math.round(e/n),2);for(let u=0;u<o;u++)r+=Math.round(t(u/(o-1))*1e4)/1e4+", ";return`linear(${r.substring(0,r.length-2)})`},$c=2e4;function Ty(t){let e=0;const n=50;let r=t.next(e);for(;!r.done&&e<$c;)e+=n,r=t.next(e);return e>=$c?1/0:e}function v4(t,e=100,n){const r=n({...t,keyframes:[0,e]}),o=Math.min(Ty(r),$c);return{type:"keyframes",ease:u=>r.next(o*u).value/e,duration:ai(o)}}const b4=5;function NE(t,e,n){const r=Math.max(e-b4,0);return dE(n-t(r),e-r)}const st={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},op=.001;function S4({duration:t=st.duration,bounce:e=st.bounce,velocity:n=st.velocity,mass:r=st.mass}){let o,u,c=1-e;c=Ii(st.minDamping,st.maxDamping,c),t=Ii(st.minDuration,st.maxDuration,ai(t)),c<1?(o=m=>{const y=m*c,g=y*t,b=y-n,x=nm(m,c),A=Math.exp(-g);return op-b/x*A},u=m=>{const g=m*c*t,b=g*n+n,x=Math.pow(c,2)*Math.pow(m,2)*t,A=Math.exp(-g),w=nm(Math.pow(m,2),c);return(-o(m)+op>0?-1:1)*((b-x)*A)/w}):(o=m=>{const y=Math.exp(-m*t),g=(m-n)*t+1;return-op+y*g},u=m=>{const y=Math.exp(-m*t),g=(n-m)*(t*t);return y*g});const d=5/t,h=w4(o,u,d);if(t=oi(t),isNaN(h))return{stiffness:st.stiffness,damping:st.damping,duration:t};{const m=Math.pow(h,2)*r;return{stiffness:m,damping:c*2*Math.sqrt(r*m),duration:t}}}const x4=12;function w4(t,e,n){let r=n;for(let o=1;o<x4;o++)r=r-t(r)/e(r);return r}function nm(t,e){return t*Math.sqrt(1-e*e)}const A4=["duration","bounce"],T4=["stiffness","damping","mass"];function Cx(t,e){return e.some(n=>t[n]!==void 0)}function E4(t){let e={velocity:st.velocity,stiffness:st.stiffness,damping:st.damping,mass:st.mass,isResolvedFromDuration:!1,...t};if(!Cx(t,T4)&&Cx(t,A4))if(t.visualDuration){const n=t.visualDuration,r=2*Math.PI/(n*1.2),o=r*r,u=2*Ii(.05,1,1-(t.bounce||0))*Math.sqrt(o);e={...e,mass:st.mass,stiffness:o,damping:u}}else{const n=S4(t);e={...e,...n,mass:st.mass},e.isResolvedFromDuration=!0}return e}function jc(t=st.visualDuration,e=st.bounce){const n=typeof t!="object"?{visualDuration:t,keyframes:[0,1],bounce:e}:t;let{restSpeed:r,restDelta:o}=n;const u=n.keyframes[0],c=n.keyframes[n.keyframes.length-1],d={done:!1,value:u},{stiffness:h,damping:m,mass:y,duration:g,velocity:b,isResolvedFromDuration:x}=E4({...n,velocity:-ai(n.velocity||0)}),A=b||0,w=m/(2*Math.sqrt(h*y)),k=c-u,$=ai(Math.sqrt(h/y)),M=Math.abs(k)<5;r||(r=M?st.restSpeed.granular:st.restSpeed.default),o||(o=M?st.restDelta.granular:st.restDelta.default);let O;if(w<1){const V=nm($,w);O=W=>{const ne=Math.exp(-w*$*W);return c-ne*((A+w*$*k)/V*Math.sin(V*W)+k*Math.cos(V*W))}}else if(w===1)O=V=>c-Math.exp(-$*V)*(k+(A+$*k)*V);else{const V=$*Math.sqrt(w*w-1);O=W=>{const ne=Math.exp(-w*$*W),ee=Math.min(V*W,300);return c-ne*((A+w*$*k)*Math.sinh(ee)+V*k*Math.cosh(ee))/V}}const G={calculatedDuration:x&&g||null,next:V=>{const W=O(V);if(x)d.done=V>=g;else{let ne=V===0?A:0;w<1&&(ne=V===0?oi(A):NE(O,V,W));const ee=Math.abs(ne)<=r,ce=Math.abs(c-W)<=o;d.done=ee&&ce}return d.value=d.done?c:W,d},toString:()=>{const V=Math.min(Ty(G),$c),W=DE(ne=>G.next(V*ne).value,V,30);return V+"ms "+W},toTransition:()=>{}};return G}jc.applyToOptions=t=>{const e=v4(t,100,jc);return t.ease=e.ease,t.duration=oi(e.duration),t.type="keyframes",t};function im({keyframes:t,velocity:e=0,power:n=.8,timeConstant:r=325,bounceDamping:o=10,bounceStiffness:u=500,modifyTarget:c,min:d,max:h,restDelta:m=.5,restSpeed:y}){const g=t[0],b={done:!1,value:g},x=ee=>d!==void 0&&ee<d||h!==void 0&&ee>h,A=ee=>d===void 0?h:h===void 0||Math.abs(d-ee)<Math.abs(h-ee)?d:h;let w=n*e;const k=g+w,$=c===void 0?k:c(k);$!==k&&(w=$-g);const M=ee=>-w*Math.exp(-ee/r),O=ee=>$+M(ee),G=ee=>{const ce=M(ee),me=O(ee);b.done=Math.abs(ce)<=m,b.value=b.done?$:me};let V,W;const ne=ee=>{x(b.value)&&(V=ee,W=jc({keyframes:[b.value,A(b.value)],velocity:NE(O,ee,b.value),damping:o,stiffness:u,restDelta:m,restSpeed:y}))};return ne(0),{calculatedDuration:null,next:ee=>{let ce=!1;return!W&&V===void 0&&(ce=!0,G(ee),ne(ee)),V!==void 0&&ee>=V?W.next(ee-V):(!ce&&G(ee),b)}}}function R4(t,e,n){const r=[],o=n||Hi.mix||kE,u=t.length-1;for(let c=0;c<u;c++){let d=o(t[c],t[c+1]);if(e){const h=Array.isArray(e)?e[c]||Vn:e;d=Sl(h,d)}r.push(d)}return r}function O4(t,e,{clamp:n=!0,ease:r,mixer:o}={}){const u=t.length;if(py(u===e.length),u===1)return()=>e[0];if(u===2&&e[0]===e[1])return()=>e[1];const c=t[0]===t[1];t[0]>t[u-1]&&(t=[...t].reverse(),e=[...e].reverse());const d=R4(e,r,o),h=d.length,m=y=>{if(c&&y<t[0])return e[0];let g=0;if(h>1)for(;g<t.length-2&&!(y<t[g+1]);g++);const b=tl(t[g],t[g+1],y);return d[g](b)};return n?y=>m(Ii(t[0],t[u-1],y)):m}function _4(t,e){const n=t[t.length-1];for(let r=1;r<=e;r++){const o=tl(0,e,r);t.push(tt(n,1,o))}}function M4(t){const e=[0];return _4(e,t.length-1),e}function C4(t,e){return t.map(n=>n*e)}function k4(t,e){return t.map(()=>e||xE).splice(0,t.length-1)}function Ya({duration:t=300,keyframes:e,times:n,ease:r="easeInOut"}){const o=PV(r)?r.map(Tx):Tx(r),u={done:!1,value:e[0]},c=C4(n&&n.length===e.length?n:M4(e),t),d=O4(c,e,{ease:Array.isArray(o)?o:k4(e,o)});return{calculatedDuration:t,next:h=>(u.value=d(h),u.done=h>=t,u)}}const D4=t=>t!==null;function Ey(t,{repeat:e,repeatType:n="loop"},r,o=1){const u=t.filter(D4),d=o<0||e&&n!=="loop"&&e%2===1?0:u.length-1;return!d||r===void 0?u[d]:r}const N4={decay:im,inertia:im,tween:Ya,keyframes:Ya,spring:jc};function $E(t){typeof t.type=="string"&&(t.type=N4[t.type])}class Ry{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,n){return this.finished.then(e,n)}}const $4=t=>t/100;class Oy extends Ry{constructor(e){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{const{motionValue:n}=this.options;n&&n.updatedAt!==an.now()&&this.tick(an.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),this.options.onStop?.())},this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){const{options:e}=this;$E(e);const{type:n=Ya,repeat:r=0,repeatDelay:o=0,repeatType:u,velocity:c=0}=e;let{keyframes:d}=e;const h=n||Ya;h!==Ya&&typeof d[0]!="number"&&(this.mixKeyframes=Sl($4,kE(d[0],d[1])),d=[0,100]);const m=h({...e,keyframes:d});u==="mirror"&&(this.mirroredGenerator=h({...e,keyframes:[...d].reverse(),velocity:-c})),m.calculatedDuration===null&&(m.calculatedDuration=Ty(m));const{calculatedDuration:y}=m;this.calculatedDuration=y,this.resolvedDuration=y+o,this.totalDuration=this.resolvedDuration*(r+1)-o,this.generator=m}updateTime(e){const n=Math.round(e-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=n}tick(e,n=!1){const{generator:r,totalDuration:o,mixKeyframes:u,mirroredGenerator:c,resolvedDuration:d,calculatedDuration:h}=this;if(this.startTime===null)return r.next(0);const{delay:m=0,keyframes:y,repeat:g,repeatType:b,repeatDelay:x,type:A,onUpdate:w,finalKeyframe:k}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-o/this.speed,this.startTime)),n?this.currentTime=e:this.updateTime(e);const $=this.currentTime-m*(this.playbackSpeed>=0?1:-1),M=this.playbackSpeed>=0?$<0:$>o;this.currentTime=Math.max($,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=o);let O=this.currentTime,G=r;if(g){const ee=Math.min(this.currentTime,o)/d;let ce=Math.floor(ee),me=ee%1;!me&&ee>=1&&(me=1),me===1&&ce--,ce=Math.min(ce,g+1),!!(ce%2)&&(b==="reverse"?(me=1-me,x&&(me-=x/d)):b==="mirror"&&(G=c)),O=Ii(0,1,me)*d}const V=M?{done:!1,value:y[0]}:G.next(O);u&&(V.value=u(V.value));let{done:W}=V;!M&&h!==null&&(W=this.playbackSpeed>=0?this.currentTime>=o:this.currentTime<=0);const ne=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&W);return ne&&A!==im&&(V.value=Ey(y,this.options,k,this.speed)),w&&w(V.value),ne&&this.finish(),V}then(e,n){return this.finished.then(e,n)}get duration(){return ai(this.calculatedDuration)}get time(){return ai(this.currentTime)}set time(e){e=oi(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?.start(!1)}get speed(){return this.playbackSpeed}set speed(e){this.updateTime(an.now());const n=this.playbackSpeed!==e;this.playbackSpeed=e,n&&(this.time=ai(this.currentTime))}play(){if(this.isStopped)return;const{driver:e=g4,startTime:n}=this.options;this.driver||(this.driver=e(o=>this.tick(o))),this.options.onPlay?.();const r=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=r):this.holdTime!==null?this.startTime=r-this.holdTime:this.startTime||(this.startTime=n??r),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(an.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state="finished",this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),e.observe(this)}}function j4(t){for(let e=1;e<t.length;e++)t[e]??(t[e]=t[e-1])}const ns=t=>t*180/Math.PI,rm=t=>{const e=ns(Math.atan2(t[1],t[0]));return sm(e)},B4={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:t=>(Math.abs(t[0])+Math.abs(t[3]))/2,rotate:rm,rotateZ:rm,skewX:t=>ns(Math.atan(t[1])),skewY:t=>ns(Math.atan(t[2])),skew:t=>(Math.abs(t[1])+Math.abs(t[2]))/2},sm=t=>(t=t%360,t<0&&(t+=360),t),kx=rm,Dx=t=>Math.sqrt(t[0]*t[0]+t[1]*t[1]),Nx=t=>Math.sqrt(t[4]*t[4]+t[5]*t[5]),L4={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:Dx,scaleY:Nx,scale:t=>(Dx(t)+Nx(t))/2,rotateX:t=>sm(ns(Math.atan2(t[6],t[5]))),rotateY:t=>sm(ns(Math.atan2(-t[2],t[0]))),rotateZ:kx,rotate:kx,skewX:t=>ns(Math.atan(t[4])),skewY:t=>ns(Math.atan(t[1])),skew:t=>(Math.abs(t[1])+Math.abs(t[4]))/2};function om(t){return t.includes("scale")?1:0}function am(t,e){if(!t||t==="none")return om(e);const n=t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let r,o;if(n)r=L4,o=n;else{const d=t.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=B4,o=d}if(!o)return om(e);const u=r[e],c=o[1].split(",").map(z4);return typeof u=="function"?u(c):c[u]}const V4=(t,e)=>{const{transform:n="none"}=getComputedStyle(t);return am(n,e)};function z4(t){return parseFloat(t.trim())}const Lo=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Vo=new Set(Lo),$x=t=>t===Bo||t===de,U4=new Set(["x","y","z"]),q4=Lo.filter(t=>!U4.has(t));function P4(t){const e=[];return q4.forEach(n=>{const r=t.getValue(n);r!==void 0&&(e.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),e}const ss={width:({x:t},{paddingLeft:e="0",paddingRight:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),height:({y:t},{paddingTop:e="0",paddingBottom:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:(t,{transform:e})=>am(e,"x"),y:(t,{transform:e})=>am(e,"y")};ss.translateX=ss.x;ss.translateY=ss.y;const os=new Set;let lm=!1,um=!1,cm=!1;function jE(){if(um){const t=Array.from(os).filter(r=>r.needsMeasurement),e=new Set(t.map(r=>r.element)),n=new Map;e.forEach(r=>{const o=P4(r);o.length&&(n.set(r,o),r.render())}),t.forEach(r=>r.measureInitialState()),e.forEach(r=>{r.render();const o=n.get(r);o&&o.forEach(([u,c])=>{r.getValue(u)?.set(c)})}),t.forEach(r=>r.measureEndState()),t.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}um=!1,lm=!1,os.forEach(t=>t.complete(cm)),os.clear()}function BE(){os.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(um=!0)})}function K4(){cm=!0,BE(),jE(),cm=!1}class _y{constructor(e,n,r,o,u,c=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=n,this.name=r,this.motionValue=o,this.element=u,this.isAsync=c}scheduleResolve(){this.state="scheduled",this.isAsync?(os.add(this),lm||(lm=!0,nt.read(BE),nt.resolveKeyframes(jE))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:n,element:r,motionValue:o}=this;if(e[0]===null){const u=o?.get(),c=e[e.length-1];if(u!==void 0)e[0]=u;else if(r&&n){const d=r.readValue(n,c);d!=null&&(e[0]=d)}e[0]===void 0&&(e[0]=c),o&&u===void 0&&o.set(e[0])}j4(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),os.delete(this)}cancel(){this.state==="scheduled"&&(os.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const I4=t=>t.startsWith("--");function H4(t,e,n){I4(e)?t.style.setProperty(e,n):t.style[e]=n}const F4=my(()=>window.ScrollTimeline!==void 0),G4={};function Y4(t,e){const n=my(t);return()=>G4[e]??n()}const LE=Y4(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),Ka=([t,e,n,r])=>`cubic-bezier(${t}, ${e}, ${n}, ${r})`,jx={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Ka([0,.65,.55,1]),circOut:Ka([.55,0,1,.45]),backIn:Ka([.31,.01,.66,-.59]),backOut:Ka([.33,1.53,.69,.99])};function VE(t,e){if(t)return typeof t=="function"?LE()?DE(t,e):"ease-out":wE(t)?Ka(t):Array.isArray(t)?t.map(n=>VE(n,e)||jx.easeOut):jx[t]}function X4(t,e,n,{delay:r=0,duration:o=300,repeat:u=0,repeatType:c="loop",ease:d="easeOut",times:h}={},m=void 0){const y={[e]:n};h&&(y.offset=h);const g=VE(d,o);Array.isArray(g)&&(y.easing=g);const b={delay:r,duration:o,easing:Array.isArray(g)?"linear":g,fill:"both",iterations:u+1,direction:c==="reverse"?"alternate":"normal"};return m&&(b.pseudoElement=m),t.animate(y,b)}function zE(t){return typeof t=="function"&&"applyToOptions"in t}function Z4({type:t,...e}){return zE(t)&&LE()?t.applyToOptions(e):(e.duration??(e.duration=300),e.ease??(e.ease="easeOut"),e)}class J4 extends Ry{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,!e)return;const{element:n,name:r,keyframes:o,pseudoElement:u,allowFlatten:c=!1,finalKeyframe:d,onComplete:h}=e;this.isPseudoElement=!!u,this.allowFlatten=c,this.options=e,py(typeof e.type!="string");const m=Z4(e);this.animation=X4(n,r,o,m,u),m.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!u){const y=Ey(o,this.options,d,this.speed);this.updateMotionValue?this.updateMotionValue(y):H4(n,r,y),this.animation.cancel()}h?.(),this.notifyFinished()}}play(){this.isStopped||(this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:e}=this;e==="idle"||e==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){this.isPseudoElement||this.animation.commitStyles?.()}get duration(){const e=this.animation.effect?.getComputedTiming?.().duration||0;return ai(Number(e))}get time(){return ai(Number(this.animation.currentTime)||0)}set time(e){this.finishedTime=null,this.animation.currentTime=oi(e)}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return Number(this.animation.startTime)}set startTime(e){this.animation.startTime=e}attachTimeline({timeline:e,observe:n}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,e&&F4()?(this.animation.timeline=e,Vn):n(this)}}const UE={anticipate:vE,backInOut:gE,circInOut:SE};function Q4(t){return t in UE}function W4(t){typeof t.ease=="string"&&Q4(t.ease)&&(t.ease=UE[t.ease])}const Bx=10;class ez extends J4{constructor(e){W4(e),$E(e),super(e),e.startTime&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){const{motionValue:n,onUpdate:r,onComplete:o,element:u,...c}=this.options;if(!n)return;if(e!==void 0){n.set(e);return}const d=new Oy({...c,autoplay:!1}),h=oi(this.finishedTime??this.time);n.setWithVelocity(d.sample(h-Bx).value,d.sample(h).value,Bx),d.stop()}}const Lx=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(_r.test(t)||t==="0")&&!t.startsWith("url("));function tz(t){const e=t[0];if(t.length===1)return!0;for(let n=0;n<t.length;n++)if(t[n]!==e)return!0}function nz(t,e,n,r){const o=t[0];if(o===null)return!1;if(e==="display"||e==="visibility")return!0;const u=t[t.length-1],c=Lx(o,e),d=Lx(u,e);return!c||!d?!1:tz(t)||(n==="spring"||zE(n))&&r}function qE(t){return cE(t)&&"offsetHeight"in t}const iz=new Set(["opacity","clipPath","filter","transform"]),rz=my(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function sz(t){const{motionValue:e,name:n,repeatDelay:r,repeatType:o,damping:u,type:c}=t;if(!qE(e?.owner?.current))return!1;const{onUpdate:d,transformTemplate:h}=e.owner.getProps();return rz()&&n&&iz.has(n)&&(n!=="transform"||!h)&&!d&&!r&&o!=="mirror"&&u!==0&&c!=="inertia"}const oz=40;class az extends Ry{constructor({autoplay:e=!0,delay:n=0,type:r="keyframes",repeat:o=0,repeatDelay:u=0,repeatType:c="loop",keyframes:d,name:h,motionValue:m,element:y,...g}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=an.now();const b={autoplay:e,delay:n,type:r,repeat:o,repeatDelay:u,repeatType:c,name:h,motionValue:m,element:y,...g},x=y?.KeyframeResolver||_y;this.keyframeResolver=new x(d,(A,w,k)=>this.onKeyframesResolved(A,w,b,!k),h,m,y),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,n,r,o){this.keyframeResolver=void 0;const{name:u,type:c,velocity:d,delay:h,isHandoff:m,onUpdate:y}=r;this.resolvedAt=an.now(),nz(e,u,c,d)||((Hi.instantAnimations||!h)&&y?.(Ey(e,r,n)),e[0]=e[e.length-1],r.duration=0,r.repeat=0);const b={startTime:o?this.resolvedAt?this.resolvedAt-this.createdAt>oz?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:n,...r,keyframes:e},x=!m&&sz(b)?new ez({...b,element:b.motionValue.owner.current}):new Oy(b);x.finished.then(()=>this.notifyFinished()).catch(Vn),this.pendingTimeline&&(this.stopTimeline=x.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=x}get finished(){return this._animation?this.animation.finished:this._finished}then(e,n){return this.finished.finally(e).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),K4()),this._animation}get duration(){return this.animation.duration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}}const lz=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function uz(t){const e=lz.exec(t);if(!e)return[,];const[,n,r,o]=e;return[`--${n??r}`,o]}function PE(t,e,n=1){const[r,o]=uz(t);if(!r)return;const u=window.getComputedStyle(e).getPropertyValue(r);if(u){const c=u.trim();return uE(c)?parseFloat(c):c}return Sy(o)?PE(o,e,n+1):o}function My(t,e){return t?.[e]??t?.default??t}const KE=new Set(["width","height","top","left","right","bottom",...Lo]),cz={test:t=>t==="auto",parse:t=>t},IE=t=>e=>e.test(t),HE=[Bo,de,li,br,t4,e4,cz],Vx=t=>HE.find(IE(t));function fz(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||fE(t):!0}const dz=new Set(["brightness","contrast","saturate","opacity"]);function hz(t){const[e,n]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[r]=n.match(xy)||[];if(!r)return t;const o=n.replace(r,"");let u=dz.has(e)?1:0;return r!==n&&(u*=100),e+"("+u+o+")"}const pz=/\b([a-z-]*)\(.*?\)/gu,fm={..._r,getAnimatableNone:t=>{const e=t.match(pz);return e?e.map(hz).join(" "):t}},zx={...Bo,transform:Math.round},mz={rotate:br,rotateX:br,rotateY:br,rotateZ:br,scale:Ju,scaleX:Ju,scaleY:Ju,scaleZ:Ju,skew:br,skewX:br,skewY:br,distance:de,translateX:de,translateY:de,translateZ:de,x:de,y:de,z:de,perspective:de,transformPerspective:de,opacity:nl,originX:Rx,originY:Rx,originZ:de},Cy={borderWidth:de,borderTopWidth:de,borderRightWidth:de,borderBottomWidth:de,borderLeftWidth:de,borderRadius:de,radius:de,borderTopLeftRadius:de,borderTopRightRadius:de,borderBottomRightRadius:de,borderBottomLeftRadius:de,width:de,maxWidth:de,height:de,maxHeight:de,top:de,right:de,bottom:de,left:de,padding:de,paddingTop:de,paddingRight:de,paddingBottom:de,paddingLeft:de,margin:de,marginTop:de,marginRight:de,marginBottom:de,marginLeft:de,backgroundPositionX:de,backgroundPositionY:de,...mz,zIndex:zx,fillOpacity:nl,strokeOpacity:nl,numOctaves:zx},yz={...Cy,color:vt,backgroundColor:vt,outlineColor:vt,fill:vt,stroke:vt,borderColor:vt,borderTopColor:vt,borderRightColor:vt,borderBottomColor:vt,borderLeftColor:vt,filter:fm,WebkitFilter:fm},FE=t=>yz[t];function GE(t,e){let n=FE(t);return n!==fm&&(n=_r),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const gz=new Set(["auto","none","0"]);function vz(t,e,n){let r=0,o;for(;r<t.length&&!o;){const u=t[r];typeof u=="string"&&!gz.has(u)&&il(u).values.length&&(o=t[r]),r++}if(o&&n)for(const u of e)t[u]=GE(n,o)}class bz extends _y{constructor(e,n,r,o,u){super(e,n,r,o,u,!0)}readKeyframes(){const{unresolvedKeyframes:e,element:n,name:r}=this;if(!n||!n.current)return;super.readKeyframes();for(let h=0;h<e.length;h++){let m=e[h];if(typeof m=="string"&&(m=m.trim(),Sy(m))){const y=PE(m,n.current);y!==void 0&&(e[h]=y),h===e.length-1&&(this.finalKeyframe=m)}}if(this.resolveNoneKeyframes(),!KE.has(r)||e.length!==2)return;const[o,u]=e,c=Vx(o),d=Vx(u);if(c!==d)if($x(c)&&$x(d))for(let h=0;h<e.length;h++){const m=e[h];typeof m=="string"&&(e[h]=parseFloat(m))}else ss[r]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:n}=this,r=[];for(let o=0;o<e.length;o++)(e[o]===null||fz(e[o]))&&r.push(o);r.length&&vz(e,r,n)}measureInitialState(){const{element:e,unresolvedKeyframes:n,name:r}=this;if(!e||!e.current)return;r==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=ss[r](e.measureViewportBox(),window.getComputedStyle(e.current)),n[0]=this.measuredOrigin;const o=n[n.length-1];o!==void 0&&e.getValue(r,o).jump(o,!1)}measureEndState(){const{element:e,name:n,unresolvedKeyframes:r}=this;if(!e||!e.current)return;const o=e.getValue(n);o&&o.jump(this.measuredOrigin,!1);const u=r.length-1,c=r[u];r[u]=ss[n](e.measureViewportBox(),window.getComputedStyle(e.current)),c!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=c),this.removedTransforms?.length&&this.removedTransforms.forEach(([d,h])=>{e.getValue(d).set(h)}),this.resolveNoneKeyframes()}}function Sz(t,e,n){if(t instanceof EventTarget)return[t];if(typeof t=="string"){let r=document;const o=n?.[t]??r.querySelectorAll(t);return o?Array.from(o):[]}return Array.from(t)}const YE=(t,e)=>e&&typeof t=="number"?e.transform(t):t,Ux=30,xz=t=>!isNaN(parseFloat(t));class wz{constructor(e,n={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=(r,o=!0)=>{const u=an.now();if(this.updatedAt!==u&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(const c of this.dependents)c.dirty();o&&this.events.renderRequest?.notify(this.current)},this.hasAnimated=!1,this.setCurrent(e),this.owner=n.owner}setCurrent(e){this.current=e,this.updatedAt=an.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=xz(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on("change",e)}on(e,n){this.events[e]||(this.events[e]=new yy);const r=this.events[e].add(n);return e==="change"?()=>{r(),nt.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,n){this.passiveEffect=e,this.stopPassiveEffect=n}set(e,n=!0){!n||!this.passiveEffect?this.updateAndNotify(e,n):this.passiveEffect(e,this.updateAndNotify)}setWithVelocity(e,n,r){this.set(n),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-r}jump(e,n=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(e){this.dependents||(this.dependents=new Set),this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const e=an.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>Ux)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,Ux);return dE(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(e){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=e(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(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Mo(t,e){return new wz(t,e)}const{schedule:ky}=AE(queueMicrotask,!1),In={x:!1,y:!1};function XE(){return In.x||In.y}function Az(t){return t==="x"||t==="y"?In[t]?null:(In[t]=!0,()=>{In[t]=!1}):In.x||In.y?null:(In.x=In.y=!0,()=>{In.x=In.y=!1})}function ZE(t,e){const n=Sz(t),r=new AbortController,o={passive:!0,...e,signal:r.signal};return[n,o,()=>r.abort()]}function qx(t){return!(t.pointerType==="touch"||XE())}function Tz(t,e,n={}){const[r,o,u]=ZE(t,n),c=d=>{if(!qx(d))return;const{target:h}=d,m=e(h,d);if(typeof m!="function"||!h)return;const y=g=>{qx(g)&&(m(g),h.removeEventListener("pointerleave",y))};h.addEventListener("pointerleave",y,o)};return r.forEach(d=>{d.addEventListener("pointerenter",c,o)}),u}const JE=(t,e)=>e?t===e?!0:JE(t,e.parentElement):!1,Dy=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1,Ez=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function Rz(t){return Ez.has(t.tagName)||t.tabIndex!==-1}const cc=new WeakSet;function Px(t){return e=>{e.key==="Enter"&&t(e)}}function ap(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}const Oz=(t,e)=>{const n=t.currentTarget;if(!n)return;const r=Px(()=>{if(cc.has(n))return;ap(n,"down");const o=Px(()=>{ap(n,"up")}),u=()=>ap(n,"cancel");n.addEventListener("keyup",o,e),n.addEventListener("blur",u,e)});n.addEventListener("keydown",r,e),n.addEventListener("blur",()=>n.removeEventListener("keydown",r),e)};function Kx(t){return Dy(t)&&!XE()}function _z(t,e,n={}){const[r,o,u]=ZE(t,n),c=d=>{const h=d.currentTarget;if(!Kx(d))return;cc.add(h);const m=e(h,d),y=(x,A)=>{window.removeEventListener("pointerup",g),window.removeEventListener("pointercancel",b),cc.has(h)&&cc.delete(h),Kx(x)&&typeof m=="function"&&m(x,{success:A})},g=x=>{y(x,h===window||h===document||n.useGlobalTarget||JE(h,x.target))},b=x=>{y(x,!1)};window.addEventListener("pointerup",g,o),window.addEventListener("pointercancel",b,o)};return r.forEach(d=>{(n.useGlobalTarget?window:d).addEventListener("pointerdown",c,o),qE(d)&&(d.addEventListener("focus",m=>Oz(m,o)),!Rz(d)&&!d.hasAttribute("tabindex")&&(d.tabIndex=0))}),u}function QE(t){return cE(t)&&"ownerSVGElement"in t}function Mz(t){return QE(t)&&t.tagName==="svg"}const Ht=t=>!!(t&&t.getVelocity),Cz=[...HE,vt,_r],kz=t=>Cz.find(IE(t)),WE=B.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});function Dz(t=!0){const e=B.useContext(fy);if(e===null)return[!0,null];const{isPresent:n,onExitComplete:r,register:o}=e,u=B.useId();B.useEffect(()=>{if(t)return o(u)},[t]);const c=B.useCallback(()=>t&&r&&r(u),[u,r,t]);return!n&&r?[!1,c]:[!0]}const eR=B.createContext({strict:!1}),Ix={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"]},Co={};for(const t in Ix)Co[t]={isEnabled:e=>Ix[t].some(n=>!!e[n])};function Nz(t){for(const e in t)Co[e]={...Co[e],...t[e]}}const $z=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 Bc(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||$z.has(t)}let tR=t=>!Bc(t);function jz(t){typeof t=="function"&&(tR=e=>e.startsWith("on")?!Bc(e):t(e))}try{jz(require("@emotion/is-prop-valid").default)}catch{}function Bz(t,e,n){const r={};for(const o in t)o==="values"&&typeof t.values=="object"||(tR(o)||n===!0&&Bc(o)||!e&&!Bc(o)||t.draggable&&o.startsWith("onDrag"))&&(r[o]=t[o]);return r}function Lz(t){if(typeof Proxy>"u")return t;const e=new Map,n=(...r)=>t(...r);return new Proxy(n,{get:(r,o)=>o==="create"?t:(e.has(o)||e.set(o,t(o)),e.get(o))})}const df=B.createContext({});function hf(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}function rl(t){return typeof t=="string"||Array.isArray(t)}const Ny=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],$y=["initial",...Ny];function pf(t){return hf(t.animate)||$y.some(e=>rl(t[e]))}function nR(t){return!!(pf(t)||t.variants)}function Vz(t,e){if(pf(t)){const{initial:n,animate:r}=t;return{initial:n===!1||rl(n)?n:void 0,animate:rl(r)?r:void 0}}return t.inherit!==!1?e:{}}function zz(t){const{initial:e,animate:n}=Vz(t,B.useContext(df));return B.useMemo(()=>({initial:e,animate:n}),[Hx(e),Hx(n)])}function Hx(t){return Array.isArray(t)?t.join(" "):t}const Uz=Symbol.for("motionComponentSymbol");function ao(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function qz(t,e,n){return B.useCallback(r=>{r&&t.onMount&&t.onMount(r),e&&(r?e.mount(r):e.unmount()),n&&(typeof n=="function"?n(r):ao(n)&&(n.current=r))},[e])}const jy=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),Pz="framerAppearId",iR="data-"+jy(Pz),rR=B.createContext({});function Kz(t,e,n,r,o){const{visualElement:u}=B.useContext(df),c=B.useContext(eR),d=B.useContext(fy),h=B.useContext(WE).reducedMotion,m=B.useRef(null);r=r||c.renderer,!m.current&&r&&(m.current=r(t,{visualState:e,parent:u,props:n,presenceContext:d,blockInitialAnimation:d?d.initial===!1:!1,reducedMotionConfig:h}));const y=m.current,g=B.useContext(rR);y&&!y.projection&&o&&(y.type==="html"||y.type==="svg")&&Iz(m.current,n,o,g);const b=B.useRef(!1);B.useInsertionEffect(()=>{y&&b.current&&y.update(n,d)});const x=n[iR],A=B.useRef(!!x&&!window.MotionHandoffIsComplete?.(x)&&window.MotionHasOptimisedAnimation?.(x));return jV(()=>{y&&(b.current=!0,window.MotionIsMounted=!0,y.updateFeatures(),ky.render(y.render),A.current&&y.animationState&&y.animationState.animateChanges())}),B.useEffect(()=>{y&&(!A.current&&y.animationState&&y.animationState.animateChanges(),A.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(x)}),A.current=!1))}),y}function Iz(t,e,n,r){const{layoutId:o,layout:u,drag:c,dragConstraints:d,layoutScroll:h,layoutRoot:m,layoutCrossfade:y}=e;t.projection=new n(t.latestValues,e["data-framer-portal-id"]?void 0:sR(t.parent)),t.projection.setOptions({layoutId:o,layout:u,alwaysMeasureLayout:!!c||d&&ao(d),visualElement:t,animationType:typeof u=="string"?u:"both",initialPromotionConfig:r,crossfade:y,layoutScroll:h,layoutRoot:m})}function sR(t){if(t)return t.options.allowProjection!==!1?t.projection:sR(t.parent)}function Hz({preloadedFeatures:t,createVisualElement:e,useRender:n,useVisualState:r,Component:o}){t&&Nz(t);function u(d,h){let m;const y={...B.useContext(WE),...d,layoutId:Fz(d)},{isStatic:g}=y,b=zz(d),x=r(d,g);if(!g&&cy){Gz();const A=Yz(y);m=A.MeasureLayout,b.visualElement=Kz(o,x,y,e,A.ProjectionNode)}return F.jsxs(df.Provider,{value:b,children:[m&&b.visualElement?F.jsx(m,{visualElement:b.visualElement,...y}):null,n(o,d,qz(x,b.visualElement,h),x,g,b.visualElement)]})}u.displayName=`motion.${typeof o=="string"?o:`create(${o.displayName??o.name??""})`}`;const c=B.forwardRef(u);return c[Uz]=o,c}function Fz({layoutId:t}){const e=B.useContext(lE).id;return e&&t!==void 0?e+"-"+t:t}function Gz(t,e){B.useContext(eR).strict}function Yz(t){const{drag:e,layout:n}=Co;if(!e&&!n)return{};const r={...e,...n};return{MeasureLayout:e?.isEnabled(t)||n?.isEnabled(t)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}const sl={};function Xz(t){for(const e in t)sl[e]=t[e],by(e)&&(sl[e].isCSSVariable=!0)}function oR(t,{layout:e,layoutId:n}){return Vo.has(t)||t.startsWith("origin")||(e||n!==void 0)&&(!!sl[t]||t==="opacity")}const Zz={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},Jz=Lo.length;function Qz(t,e,n){let r="",o=!0;for(let u=0;u<Jz;u++){const c=Lo[u],d=t[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 m=YE(d,Cy[c]);if(!h){o=!1;const y=Zz[c]||c;r+=`${y}(${m}) `}n&&(e[c]=m)}}return r=r.trim(),n?r=n(e,o?"":r):o&&(r="none"),r}function By(t,e,n){const{style:r,vars:o,transformOrigin:u}=t;let c=!1,d=!1;for(const h in e){const m=e[h];if(Vo.has(h)){c=!0;continue}else if(by(h)){o[h]=m;continue}else{const y=YE(m,Cy[h]);h.startsWith("origin")?(d=!0,u[h]=y):r[h]=y}}if(e.transform||(c||n?r.transform=Qz(e,t.transform,n):r.transform&&(r.transform="none")),d){const{originX:h="50%",originY:m="50%",originZ:y=0}=u;r.transformOrigin=`${h} ${m} ${y}`}}const Ly=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function aR(t,e,n){for(const r in e)!Ht(e[r])&&!oR(r,n)&&(t[r]=e[r])}function Wz({transformTemplate:t},e){return B.useMemo(()=>{const n=Ly();return By(n,e,t),Object.assign({},n.vars,n.style)},[e])}function eU(t,e){const n=t.style||{},r={};return aR(r,n,t),Object.assign(r,Wz(t,e)),r}function tU(t,e){const n={},r=eU(t,e);return t.drag&&t.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(n.tabIndex=0),n.style=r,n}const nU={offset:"stroke-dashoffset",array:"stroke-dasharray"},iU={offset:"strokeDashoffset",array:"strokeDasharray"};function rU(t,e,n=1,r=0,o=!0){t.pathLength=1;const u=o?nU:iU;t[u.offset]=de.transform(-r);const c=de.transform(e),d=de.transform(n);t[u.array]=`${c} ${d}`}function lR(t,{attrX:e,attrY:n,attrScale:r,pathLength:o,pathSpacing:u=1,pathOffset:c=0,...d},h,m,y){if(By(t,d,m),h){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:g,style:b}=t;g.transform&&(b.transform=g.transform,delete g.transform),(b.transform||g.transformOrigin)&&(b.transformOrigin=g.transformOrigin??"50% 50%",delete g.transformOrigin),b.transform&&(b.transformBox=y?.transformBox??"fill-box",delete g.transformBox),e!==void 0&&(g.x=e),n!==void 0&&(g.y=n),r!==void 0&&(g.scale=r),o!==void 0&&rU(g,o,u,c,!1)}const uR=()=>({...Ly(),attrs:{}}),cR=t=>typeof t=="string"&&t.toLowerCase()==="svg";function sU(t,e,n,r){const o=B.useMemo(()=>{const u=uR();return lR(u,e,cR(r),t.transformTemplate,t.style),{...u.attrs,style:{...u.style}}},[e]);if(t.style){const u={};aR(u,t.style,t),o.style={...u,...o.style}}return o}const oU=["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 Vy(t){return typeof t!="string"||t.includes("-")?!1:!!(oU.indexOf(t)>-1||/[A-Z]/u.test(t))}function aU(t=!1){return(n,r,o,{latestValues:u},c)=>{const h=(Vy(n)?sU:tU)(r,u,c,n),m=Bz(r,typeof n=="string",t),y=n!==B.Fragment?{...m,...h,ref:o}:{},{children:g}=r,b=B.useMemo(()=>Ht(g)?g.get():g,[g]);return B.createElement(n,{...y,children:b})}}function Fx(t){const e=[{},{}];return t?.values.forEach((n,r)=>{e[0][r]=n.get(),e[1][r]=n.getVelocity()}),e}function zy(t,e,n,r){if(typeof e=="function"){const[o,u]=Fx(r);e=e(n!==void 0?n:t.custom,o,u)}if(typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"){const[o,u]=Fx(r);e=e(n!==void 0?n:t.custom,o,u)}return e}function fc(t){return Ht(t)?t.get():t}function lU({scrapeMotionValuesFromProps:t,createRenderState:e},n,r,o){return{latestValues:uU(n,r,o,t),renderState:e()}}const fR=t=>(e,n)=>{const r=B.useContext(df),o=B.useContext(fy),u=()=>lU(t,e,r,o);return n?u():$V(u)};function uU(t,e,n,r){const o={},u=r(t,{});for(const b in u)o[b]=fc(u[b]);let{initial:c,animate:d}=t;const h=pf(t),m=nR(t);e&&m&&!h&&t.inherit!==!1&&(c===void 0&&(c=e.initial),d===void 0&&(d=e.animate));let y=n?n.initial===!1:!1;y=y||c===!1;const g=y?d:c;if(g&&typeof g!="boolean"&&!hf(g)){const b=Array.isArray(g)?g:[g];for(let x=0;x<b.length;x++){const A=zy(t,b[x]);if(A){const{transitionEnd:w,transition:k,...$}=A;for(const M in $){let O=$[M];if(Array.isArray(O)){const G=y?O.length-1:0;O=O[G]}O!==null&&(o[M]=O)}for(const M in w)o[M]=w[M]}}}return o}function Uy(t,e,n){const{style:r}=t,o={};for(const u in r)(Ht(r[u])||e.style&&Ht(e.style[u])||oR(u,t)||n?.getValue(u)?.liveStyle!==void 0)&&(o[u]=r[u]);return o}const cU={useVisualState:fR({scrapeMotionValuesFromProps:Uy,createRenderState:Ly})};function dR(t,e,n){const r=Uy(t,e,n);for(const o in t)if(Ht(t[o])||Ht(e[o])){const u=Lo.indexOf(o)!==-1?"attr"+o.charAt(0).toUpperCase()+o.substring(1):o;r[u]=t[o]}return r}const fU={useVisualState:fR({scrapeMotionValuesFromProps:dR,createRenderState:uR})};function dU(t,e){return function(r,{forwardMotionProps:o}={forwardMotionProps:!1}){const c={...Vy(r)?fU:cU,preloadedFeatures:t,useRender:aU(o),createVisualElement:e,Component:r};return Hz(c)}}function ol(t,e,n){const r=t.getProps();return zy(r,e,n!==void 0?n:r.custom,t)}const dm=t=>Array.isArray(t);function hU(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,Mo(n))}function pU(t){return dm(t)?t[t.length-1]||0:t}function mU(t,e){const n=ol(t,e);let{transitionEnd:r={},transition:o={},...u}=n||{};u={...u,...r};for(const c in u){const d=pU(u[c]);hU(t,c,d)}}function yU(t){return!!(Ht(t)&&t.add)}function hm(t,e){const n=t.getValue("willChange");if(yU(n))return n.add(e);if(!n&&Hi.WillChange){const r=new Hi.WillChange("auto");t.addValue("willChange",r),r.add(e)}}function hR(t){return t.props[iR]}const gU=t=>t!==null;function vU(t,{repeat:e,repeatType:n="loop"},r){const o=t.filter(gU),u=e&&n!=="loop"&&e%2===1?0:o.length-1;return o[u]}const bU={type:"spring",stiffness:500,damping:25,restSpeed:10},SU=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),xU={type:"keyframes",duration:.8},wU={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},AU=(t,{keyframes:e})=>e.length>2?xU:Vo.has(t)?t.startsWith("scale")?SU(e[1]):bU:wU;function TU({when:t,delay:e,delayChildren:n,staggerChildren:r,staggerDirection:o,repeat:u,repeatType:c,repeatDelay:d,from:h,elapsed:m,...y}){return!!Object.keys(y).length}const qy=(t,e,n,r={},o,u)=>c=>{const d=My(r,t)||{},h=d.delay||r.delay||0;let{elapsed:m=0}=r;m=m-oi(h);const y={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:e.getVelocity(),...d,delay:-m,onUpdate:b=>{e.set(b),d.onUpdate&&d.onUpdate(b)},onComplete:()=>{c(),d.onComplete&&d.onComplete()},name:t,motionValue:e,element:u?void 0:o};TU(d)||Object.assign(y,AU(t,y)),y.duration&&(y.duration=oi(y.duration)),y.repeatDelay&&(y.repeatDelay=oi(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)),(Hi.instantAnimations||Hi.skipAnimations)&&(g=!0,y.duration=0,y.delay=0),y.allowFlatten=!d.type&&!d.ease,g&&!u&&e.get()!==void 0){const b=vU(y.keyframes,d);if(b!==void 0){nt.update(()=>{y.onUpdate(b),y.onComplete()});return}}return d.isSync?new Oy(y):new az(y)};function EU({protectedKeys:t,needsAnimating:e},n){const r=t.hasOwnProperty(n)&&e[n]!==!0;return e[n]=!1,r}function pR(t,e,{delay:n=0,transitionOverride:r,type:o}={}){let{transition:u=t.getDefaultTransition(),transitionEnd:c,...d}=e;r&&(u=r);const h=[],m=o&&t.animationState&&t.animationState.getState()[o];for(const y in d){const g=t.getValue(y,t.latestValues[y]??null),b=d[y];if(b===void 0||m&&EU(m,y))continue;const x={delay:n,...My(u||{},y)},A=g.get();if(A!==void 0&&!g.isAnimating&&!Array.isArray(b)&&b===A&&!x.velocity)continue;let w=!1;if(window.MotionHandoffAnimation){const $=hR(t);if($){const M=window.MotionHandoffAnimation($,y,nt);M!==null&&(x.startTime=M,w=!0)}}hm(t,y),g.start(qy(y,g,b,t.shouldReduceMotion&&KE.has(y)?{type:!1}:x,t,w));const k=g.animation;k&&h.push(k)}return c&&Promise.all(h).then(()=>{nt.update(()=>{c&&mU(t,c)})}),h}function pm(t,e,n={}){const r=ol(t,e,n.type==="exit"?t.presenceContext?.custom:void 0);let{transition:o=t.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(o=n.transitionOverride);const u=r?()=>Promise.all(pR(t,r,n)):()=>Promise.resolve(),c=t.variantChildren&&t.variantChildren.size?(h=0)=>{const{delayChildren:m=0,staggerChildren:y,staggerDirection:g}=o;return RU(t,e,m+h,y,g,n)}:()=>Promise.resolve(),{when:d}=o;if(d){const[h,m]=d==="beforeChildren"?[u,c]:[c,u];return h().then(()=>m())}else return Promise.all([u(),c(n.delay)])}function RU(t,e,n=0,r=0,o=1,u){const c=[],d=(t.variantChildren.size-1)*r,h=o===1?(m=0)=>m*r:(m=0)=>d-m*r;return Array.from(t.variantChildren).sort(OU).forEach((m,y)=>{m.notify("AnimationStart",e),c.push(pm(m,e,{...u,delay:n+h(y)}).then(()=>m.notify("AnimationComplete",e)))}),Promise.all(c)}function OU(t,e){return t.sortNodePosition(e)}function _U(t,e,n={}){t.notify("AnimationStart",e);let r;if(Array.isArray(e)){const o=e.map(u=>pm(t,u,n));r=Promise.all(o)}else if(typeof e=="string")r=pm(t,e,n);else{const o=typeof e=="function"?ol(t,e,n.custom):e;r=Promise.all(pR(t,o,n))}return r.then(()=>{t.notify("AnimationComplete",e)})}function mR(t,e){if(!Array.isArray(e))return!1;const n=e.length;if(n!==t.length)return!1;for(let r=0;r<n;r++)if(e[r]!==t[r])return!1;return!0}const MU=$y.length;function yR(t){if(!t)return;if(!t.isControllingVariants){const n=t.parent?yR(t.parent)||{}:{};return t.props.initial!==void 0&&(n.initial=t.props.initial),n}const e={};for(let n=0;n<MU;n++){const r=$y[n],o=t.props[r];(rl(o)||o===!1)&&(e[r]=o)}return e}const CU=[...Ny].reverse(),kU=Ny.length;function DU(t){return e=>Promise.all(e.map(({animation:n,options:r})=>_U(t,n,r)))}function NU(t){let e=DU(t),n=Gx(),r=!0;const o=h=>(m,y)=>{const g=ol(t,y,h==="exit"?t.presenceContext?.custom:void 0);if(g){const{transition:b,transitionEnd:x,...A}=g;m={...m,...A,...x}}return m};function u(h){e=h(t)}function c(h){const{props:m}=t,y=yR(t.parent)||{},g=[],b=new Set;let x={},A=1/0;for(let k=0;k<kU;k++){const $=CU[k],M=n[$],O=m[$]!==void 0?m[$]:y[$],G=rl(O),V=$===h?M.isActive:null;V===!1&&(A=k);let W=O===y[$]&&O!==m[$]&&G;if(W&&r&&t.manuallyAnimateOnMount&&(W=!1),M.protectedKeys={...x},!M.isActive&&V===null||!O&&!M.prevProp||hf(O)||typeof O=="boolean")continue;const ne=$U(M.prevProp,O);let ee=ne||$===h&&M.isActive&&!W&&G||k>A&&G,ce=!1;const me=Array.isArray(O)?O:[O];let be=me.reduce(o($),{});V===!1&&(be={});const{prevResolvedValues:Me={}}=M,Se={...Me,...be},he=P=>{ee=!0,b.has(P)&&(ce=!0,b.delete(P)),M.needsAnimating[P]=!0;const K=t.getValue(P);K&&(K.liveStyle=!1)};for(const P in Se){const K=be[P],J=Me[P];if(x.hasOwnProperty(P))continue;let E=!1;dm(K)&&dm(J)?E=!mR(K,J):E=K!==J,E?K!=null?he(P):b.add(P):K!==void 0&&b.has(P)?he(P):M.protectedKeys[P]=!0}M.prevProp=O,M.prevResolvedValues=be,M.isActive&&(x={...x,...be}),r&&t.blockInitialAnimation&&(ee=!1),ee&&(!(W&&ne)||ce)&&g.push(...me.map(P=>({animation:P,options:{type:$}})))}if(b.size){const k={};if(typeof m.initial!="boolean"){const $=ol(t,Array.isArray(m.initial)?m.initial[0]:m.initial);$&&$.transition&&(k.transition=$.transition)}b.forEach($=>{const M=t.getBaseTarget($),O=t.getValue($);O&&(O.liveStyle=!0),k[$]=M??null}),g.push({animation:k})}let w=!!g.length;return r&&(m.initial===!1||m.initial===m.animate)&&!t.manuallyAnimateOnMount&&(w=!1),r=!1,w?e(g):Promise.resolve()}function d(h,m){if(n[h].isActive===m)return Promise.resolve();t.variantChildren?.forEach(g=>g.animationState?.setActive(h,m)),n[h].isActive=m;const y=c(h);for(const g in n)n[g].protectedKeys={};return y}return{animateChanges:c,setActive:d,setAnimateFunction:u,getState:()=>n,reset:()=>{n=Gx(),r=!0}}}function $U(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!mR(e,t):!1}function Xr(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Gx(){return{animate:Xr(!0),whileInView:Xr(),whileHover:Xr(),whileTap:Xr(),whileDrag:Xr(),whileFocus:Xr(),exit:Xr()}}class Cr{constructor(e){this.isMounted=!1,this.node=e}update(){}}class jU extends Cr{constructor(e){super(e),e.animationState||(e.animationState=NU(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();hf(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:n}=this.node.prevProps||{};e!==n&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}}let BU=0;class LU extends Cr{constructor(){super(...arguments),this.id=BU++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:n}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===r)return;const o=this.node.animationState.setActive("exit",!e);n&&!e&&o.then(()=>{n(this.id)})}mount(){const{register:e,onExitComplete:n}=this.node.presenceContext||{};n&&n(this.id),e&&(this.unmount=e(this.id))}unmount(){}}const VU={animation:{Feature:jU},exit:{Feature:LU}};function al(t,e,n,r={passive:!0}){return t.addEventListener(e,n,r),()=>t.removeEventListener(e,n)}function Al(t){return{point:{x:t.pageX,y:t.pageY}}}const zU=t=>e=>Dy(e)&&t(e,Al(e));function Xa(t,e,n,r){return al(t,e,zU(n),r)}function gR({top:t,left:e,right:n,bottom:r}){return{x:{min:e,max:n},y:{min:t,max:r}}}function UU({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function qU(t,e){if(!e)return t;const n=e({x:t.left,y:t.top}),r=e({x:t.right,y:t.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}const vR=1e-4,PU=1-vR,KU=1+vR,bR=.01,IU=0-bR,HU=0+bR;function Zt(t){return t.max-t.min}function FU(t,e,n){return Math.abs(t-e)<=n}function Yx(t,e,n,r=.5){t.origin=r,t.originPoint=tt(e.min,e.max,t.origin),t.scale=Zt(n)/Zt(e),t.translate=tt(n.min,n.max,t.origin)-t.originPoint,(t.scale>=PU&&t.scale<=KU||isNaN(t.scale))&&(t.scale=1),(t.translate>=IU&&t.translate<=HU||isNaN(t.translate))&&(t.translate=0)}function Za(t,e,n,r){Yx(t.x,e.x,n.x,r?r.originX:void 0),Yx(t.y,e.y,n.y,r?r.originY:void 0)}function Xx(t,e,n){t.min=n.min+e.min,t.max=t.min+Zt(e)}function GU(t,e,n){Xx(t.x,e.x,n.x),Xx(t.y,e.y,n.y)}function Zx(t,e,n){t.min=e.min-n.min,t.max=t.min+Zt(e)}function Ja(t,e,n){Zx(t.x,e.x,n.x),Zx(t.y,e.y,n.y)}const Jx=()=>({translate:0,scale:1,origin:0,originPoint:0}),lo=()=>({x:Jx(),y:Jx()}),Qx=()=>({min:0,max:0}),dt=()=>({x:Qx(),y:Qx()});function $n(t){return[t("x"),t("y")]}function lp(t){return t===void 0||t===1}function mm({scale:t,scaleX:e,scaleY:n}){return!lp(t)||!lp(e)||!lp(n)}function Wr(t){return mm(t)||SR(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function SR(t){return Wx(t.x)||Wx(t.y)}function Wx(t){return t&&t!=="0%"}function Lc(t,e,n){const r=t-n,o=e*r;return n+o}function e1(t,e,n,r,o){return o!==void 0&&(t=Lc(t,o,r)),Lc(t,n,r)+e}function ym(t,e=0,n=1,r,o){t.min=e1(t.min,e,n,r,o),t.max=e1(t.max,e,n,r,o)}function xR(t,{x:e,y:n}){ym(t.x,e.translate,e.scale,e.originPoint),ym(t.y,n.translate,n.scale,n.originPoint)}const t1=.999999999999,n1=1.0000000000001;function YU(t,e,n,r=!1){const o=n.length;if(!o)return;e.x=e.y=1;let u,c;for(let d=0;d<o;d++){u=n[d],c=u.projectionDelta;const{visualElement:h}=u.options;h&&h.props.style&&h.props.style.display==="contents"||(r&&u.options.layoutScroll&&u.scroll&&u!==u.root&&co(t,{x:-u.scroll.offset.x,y:-u.scroll.offset.y}),c&&(e.x*=c.x.scale,e.y*=c.y.scale,xR(t,c)),r&&Wr(u.latestValues)&&co(t,u.latestValues))}e.x<n1&&e.x>t1&&(e.x=1),e.y<n1&&e.y>t1&&(e.y=1)}function uo(t,e){t.min=t.min+e,t.max=t.max+e}function i1(t,e,n,r,o=.5){const u=tt(t.min,t.max,o);ym(t,e,n,u,r)}function co(t,e){i1(t.x,e.x,e.scaleX,e.scale,e.originX),i1(t.y,e.y,e.scaleY,e.scale,e.originY)}function wR(t,e){return gR(qU(t.getBoundingClientRect(),e))}function XU(t,e,n){const r=wR(t,n),{scroll:o}=e;return o&&(uo(r.x,o.offset.x),uo(r.y,o.offset.y)),r}const AR=({current:t})=>t?t.ownerDocument.defaultView:null,r1=(t,e)=>Math.abs(t-e);function ZU(t,e){const n=r1(t.x,e.x),r=r1(t.y,e.y);return Math.sqrt(n**2+r**2)}class TR{constructor(e,n,{transformPagePoint:r,contextWindow:o,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=cp(this.lastMoveEventInfo,this.history),b=this.startEvent!==null,x=ZU(g.offset,{x:0,y:0})>=3;if(!b&&!x)return;const{point:A}=g,{timestamp:w}=Ut;this.history.push({...A,timestamp:w});const{onStart:k,onMove:$}=this.handlers;b||(k&&k(this.lastMoveEvent,g),this.startEvent=this.lastMoveEvent),$&&$(this.lastMoveEvent,g)},this.handlePointerMove=(g,b)=>{this.lastMoveEvent=g,this.lastMoveEventInfo=up(b,this.transformPagePoint),nt.update(this.updatePoint,!0)},this.handlePointerUp=(g,b)=>{this.end();const{onEnd:x,onSessionEnd:A,resumeAnimation:w}=this.handlers;if(this.dragSnapToOrigin&&w&&w(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const k=cp(g.type==="pointercancel"?this.lastMoveEventInfo:up(b,this.transformPagePoint),this.history);this.startEvent&&x&&x(g,k),A&&A(g,k)},!Dy(e))return;this.dragSnapToOrigin=u,this.handlers=n,this.transformPagePoint=r,this.contextWindow=o||window;const c=Al(e),d=up(c,this.transformPagePoint),{point:h}=d,{timestamp:m}=Ut;this.history=[{...h,timestamp:m}];const{onSessionStart:y}=n;y&&y(e,cp(d,this.history)),this.removeListeners=Sl(Xa(this.contextWindow,"pointermove",this.handlePointerMove),Xa(this.contextWindow,"pointerup",this.handlePointerUp),Xa(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),Or(this.updatePoint)}}function up(t,e){return e?{point:e(t.point)}:t}function s1(t,e){return{x:t.x-e.x,y:t.y-e.y}}function cp({point:t},e){return{point:t,delta:s1(t,ER(e)),offset:s1(t,JU(e)),velocity:QU(e,.1)}}function JU(t){return t[0]}function ER(t){return t[t.length-1]}function QU(t,e){if(t.length<2)return{x:0,y:0};let n=t.length-1,r=null;const o=ER(t);for(;n>=0&&(r=t[n],!(o.timestamp-r.timestamp>oi(e)));)n--;if(!r)return{x:0,y:0};const u=ai(o.timestamp-r.timestamp);if(u===0)return{x:0,y:0};const c={x:(o.x-r.x)/u,y:(o.y-r.y)/u};return c.x===1/0&&(c.x=0),c.y===1/0&&(c.y=0),c}function WU(t,{min:e,max:n},r){return e!==void 0&&t<e?t=r?tt(e,t,r.min):Math.max(t,e):n!==void 0&&t>n&&(t=r?tt(n,t,r.max):Math.min(t,n)),t}function o1(t,e,n){return{min:e!==void 0?t.min+e:void 0,max:n!==void 0?t.max+n-(t.max-t.min):void 0}}function eq(t,{top:e,left:n,bottom:r,right:o}){return{x:o1(t.x,n,o),y:o1(t.y,e,r)}}function a1(t,e){let n=e.min-t.min,r=e.max-t.max;return e.max-e.min<t.max-t.min&&([n,r]=[r,n]),{min:n,max:r}}function tq(t,e){return{x:a1(t.x,e.x),y:a1(t.y,e.y)}}function nq(t,e){let n=.5;const r=Zt(t),o=Zt(e);return o>r?n=tl(e.min,e.max-r,t.min):r>o&&(n=tl(t.min,t.max-o,e.min)),Ii(0,1,n)}function iq(t,e){const n={};return e.min!==void 0&&(n.min=e.min-t.min),e.max!==void 0&&(n.max=e.max-t.min),n}const gm=.35;function rq(t=gm){return t===!1?t=0:t===!0&&(t=gm),{x:l1(t,"left","right"),y:l1(t,"top","bottom")}}function l1(t,e,n){return{min:u1(t,e),max:u1(t,n)}}function u1(t,e){return typeof t=="number"?t:t[e]||0}const sq=new WeakMap;class oq{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=dt(),this.visualElement=e}start(e,{snapToCursor:n=!1}={}){const{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;const o=y=>{const{dragSnapToOrigin:g}=this.getProps();g?this.pauseAnimation():this.stopAnimation(),n&&this.snapToCursor(Al(y).point)},u=(y,g)=>{const{drag:b,dragPropagation:x,onDragStart:A}=this.getProps();if(b&&!x&&(this.openDragLock&&this.openDragLock(),this.openDragLock=Az(b),!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),$n(k=>{let $=this.getAxisMotionValue(k).get()||0;if(li.test($)){const{projection:M}=this.visualElement;if(M&&M.layout){const O=M.layout.layoutBox[k];O&&($=Zt(O)*(parseFloat($)/100))}}this.originPoint[k]=$}),A&&nt.postRender(()=>A(y,g)),hm(this.visualElement,"transform");const{animationState:w}=this.visualElement;w&&w.setActive("whileDrag",!0)},c=(y,g)=>{const{dragPropagation:b,dragDirectionLock:x,onDirectionLock:A,onDrag:w}=this.getProps();if(!b&&!this.openDragLock)return;const{offset:k}=g;if(x&&this.currentDirection===null){this.currentDirection=aq(k),this.currentDirection!==null&&A&&A(this.currentDirection);return}this.updateAxis("x",g.point,k),this.updateAxis("y",g.point,k),this.visualElement.render(),w&&w(y,g)},d=(y,g)=>this.stop(y,g),h=()=>$n(y=>this.getAnimationState(y)==="paused"&&this.getAxisMotionValue(y).animation?.play()),{dragSnapToOrigin:m}=this.getProps();this.panSession=new TR(e,{onSessionStart:o,onStart:u,onMove:c,onSessionEnd:d,resumeAnimation:h},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:m,contextWindow:AR(this.visualElement)})}stop(e,n){const r=this.isDragging;if(this.cancel(),!r)return;const{velocity:o}=n;this.startAnimation(o);const{onDragEnd:u}=this.getProps();u&&nt.postRender(()=>u(e,n))}cancel(){this.isDragging=!1;const{projection:e,animationState:n}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(e,n,r){const{drag:o}=this.getProps();if(!r||!Qu(e,o,this.currentDirection))return;const u=this.getAxisMotionValue(e);let c=this.originPoint[e]+r[e];this.constraints&&this.constraints[e]&&(c=WU(c,this.constraints[e],this.elastic[e])),u.set(c)}resolveConstraints(){const{dragConstraints:e,dragElastic:n}=this.getProps(),r=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,o=this.constraints;e&&ao(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&r?this.constraints=eq(r.layoutBox,e):this.constraints=!1,this.elastic=rq(n),o!==this.constraints&&r&&this.constraints&&!this.hasMutatedConstraints&&$n(u=>{this.constraints!==!1&&this.getAxisMotionValue(u)&&(this.constraints[u]=iq(r.layoutBox[u],this.constraints[u]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:n}=this.getProps();if(!e||!ao(e))return!1;const r=e.current,{projection:o}=this.visualElement;if(!o||!o.layout)return!1;const u=XU(r,o.root,this.visualElement.getTransformPagePoint());let c=tq(o.layout.layoutBox,u);if(n){const d=n(UU(c));this.hasMutatedConstraints=!!d,d&&(c=gR(d))}return c}startAnimation(e){const{drag:n,dragMomentum:r,dragElastic:o,dragTransition:u,dragSnapToOrigin:c,onDragTransitionEnd:d}=this.getProps(),h=this.constraints||{},m=$n(y=>{if(!Qu(y,n,this.currentDirection))return;let g=h&&h[y]||{};c&&(g={min:0,max:0});const b=o?200:1e6,x=o?40:1e7,A={type:"inertia",velocity:r?e[y]:0,bounceStiffness:b,bounceDamping:x,timeConstant:750,restDelta:1,restSpeed:10,...u,...g};return this.startAxisValueAnimation(y,A)});return Promise.all(m).then(d)}startAxisValueAnimation(e,n){const r=this.getAxisMotionValue(e);return hm(this.visualElement,e),r.start(qy(e,r,0,n,this.visualElement,!1))}stopAnimation(){$n(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){$n(e=>this.getAxisMotionValue(e).animation?.pause())}getAnimationState(e){return this.getAxisMotionValue(e).animation?.state}getAxisMotionValue(e){const n=`_drag${e.toUpperCase()}`,r=this.visualElement.getProps(),o=r[n];return o||this.visualElement.getValue(e,(r.initial?r.initial[e]:void 0)||0)}snapToCursor(e){$n(n=>{const{drag:r}=this.getProps();if(!Qu(n,r,this.currentDirection))return;const{projection:o}=this.visualElement,u=this.getAxisMotionValue(n);if(o&&o.layout){const{min:c,max:d}=o.layout.layoutBox[n];u.set(e[n]-tt(c,d,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!ao(n)||!r||!this.constraints)return;this.stopAnimation();const o={x:0,y:0};$n(c=>{const d=this.getAxisMotionValue(c);if(d&&this.constraints!==!1){const h=d.get();o[c]=nq({min:h,max:h},this.constraints[c])}});const{transformTemplate:u}=this.visualElement.getProps();this.visualElement.current.style.transform=u?u({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.resolveConstraints(),$n(c=>{if(!Qu(c,e,null))return;const d=this.getAxisMotionValue(c),{min:h,max:m}=this.constraints[c];d.set(tt(h,m,o[c]))})}addListeners(){if(!this.visualElement.current)return;sq.set(this.visualElement,this);const e=this.visualElement.current,n=Xa(e,"pointerdown",h=>{const{drag:m,dragListener:y=!0}=this.getProps();m&&y&&this.start(h)}),r=()=>{const{dragConstraints:h}=this.getProps();ao(h)&&h.current&&(this.constraints=this.resolveRefConstraints())},{projection:o}=this.visualElement,u=o.addEventListener("measure",r);o&&!o.layout&&(o.root&&o.root.updateScroll(),o.updateLayout()),nt.read(r);const c=al(window,"resize",()=>this.scalePositionWithinConstraints()),d=o.addEventListener("didUpdate",({delta:h,hasLayoutChanged:m})=>{this.isDragging&&m&&($n(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 e=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:r=!1,dragPropagation:o=!1,dragConstraints:u=!1,dragElastic:c=gm,dragMomentum:d=!0}=e;return{...e,drag:n,dragDirectionLock:r,dragPropagation:o,dragConstraints:u,dragElastic:c,dragMomentum:d}}}function Qu(t,e,n){return(e===!0||e===t)&&(n===null||n===t)}function aq(t,e=10){let n=null;return Math.abs(t.y)>e?n="y":Math.abs(t.x)>e&&(n="x"),n}class lq extends Cr{constructor(e){super(e),this.removeGroupControls=Vn,this.removeListeners=Vn,this.controls=new oq(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Vn}unmount(){this.removeGroupControls(),this.removeListeners()}}const c1=t=>(e,n)=>{t&&nt.postRender(()=>t(e,n))};class uq extends Cr{constructor(){super(...arguments),this.removePointerDownListener=Vn}onPointerDown(e){this.session=new TR(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:AR(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:n,onPan:r,onPanEnd:o}=this.node.getProps();return{onSessionStart:c1(e),onStart:c1(n),onMove:r,onEnd:(u,c)=>{delete this.session,o&&nt.postRender(()=>o(u,c))}}}mount(){this.removePointerDownListener=Xa(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const dc={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function f1(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const za={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(de.test(t))t=parseFloat(t);else return t;const n=f1(t,e.target.x),r=f1(t,e.target.y);return`${n}% ${r}%`}},cq={correct:(t,{treeScale:e,projectionDelta:n})=>{const r=t,o=_r.parse(t);if(o.length>5)return r;const u=_r.createTransformer(t),c=typeof o[0]!="number"?1:0,d=n.x.scale*e.x,h=n.y.scale*e.y;o[0+c]/=d,o[1+c]/=h;const m=tt(d,h,.5);return typeof o[2+c]=="number"&&(o[2+c]/=m),typeof o[3+c]=="number"&&(o[3+c]/=m),u(o)}};class fq extends B.Component{componentDidMount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:r,layoutId:o}=this.props,{projection:u}=e;Xz(dq),u&&(n.group&&n.group.add(u),r&&r.register&&o&&r.register(u),u.root.didUpdate(),u.addEventListener("animationComplete",()=>{this.safeToRemove()}),u.setOptions({...u.options,onExitComplete:()=>this.safeToRemove()})),dc.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:n,visualElement:r,drag:o,isPresent:u}=this.props,{projection:c}=r;return c&&(c.isPresent=u,o||e.layoutDependency!==n||n===void 0||e.isPresent!==u?c.willUpdate():this.safeToRemove(),e.isPresent!==u&&(u?c.promote():c.relegate()||nt.postRender(()=>{const d=c.getStack();(!d||!d.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),ky.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:o}=e;o&&(o.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(o),r&&r.deregister&&r.deregister(o))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function RR(t){const[e,n]=Dz(),r=B.useContext(lE);return F.jsx(fq,{...t,layoutGroup:r,switchLayoutGroup:B.useContext(rR),isPresent:e,safeToRemove:n})}const dq={borderRadius:{...za,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:za,borderTopRightRadius:za,borderBottomLeftRadius:za,borderBottomRightRadius:za,boxShadow:cq};function hq(t,e,n){const r=Ht(t)?t:Mo(t);return r.start(qy("",r,e,n)),r.animation}const pq=(t,e)=>t.depth-e.depth;class mq{constructor(){this.children=[],this.isDirty=!1}add(e){dy(this.children,e),this.isDirty=!0}remove(e){hy(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(pq),this.isDirty=!1,this.children.forEach(e)}}function yq(t,e){const n=an.now(),r=({timestamp:o})=>{const u=o-n;u>=e&&(Or(r),t(u-e))};return nt.setup(r,!0),()=>Or(r)}const OR=["TopLeft","TopRight","BottomLeft","BottomRight"],gq=OR.length,d1=t=>typeof t=="string"?parseFloat(t):t,h1=t=>typeof t=="number"||de.test(t);function vq(t,e,n,r,o,u){o?(t.opacity=tt(0,n.opacity??1,bq(r)),t.opacityExit=tt(e.opacity??1,0,Sq(r))):u&&(t.opacity=tt(e.opacity??1,n.opacity??1,r));for(let c=0;c<gq;c++){const d=`border${OR[c]}Radius`;let h=p1(e,d),m=p1(n,d);if(h===void 0&&m===void 0)continue;h||(h=0),m||(m=0),h===0||m===0||h1(h)===h1(m)?(t[d]=Math.max(tt(d1(h),d1(m),r),0),(li.test(m)||li.test(h))&&(t[d]+="%")):t[d]=m}(e.rotate||n.rotate)&&(t.rotate=tt(e.rotate||0,n.rotate||0,r))}function p1(t,e){return t[e]!==void 0?t[e]:t.borderRadius}const bq=_R(0,.5,bE),Sq=_R(.5,.95,Vn);function _R(t,e,n){return r=>r<t?0:r>e?1:n(tl(t,e,r))}function m1(t,e){t.min=e.min,t.max=e.max}function Dn(t,e){m1(t.x,e.x),m1(t.y,e.y)}function y1(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}function g1(t,e,n,r,o){return t-=e,t=Lc(t,1/n,r),o!==void 0&&(t=Lc(t,1/o,r)),t}function xq(t,e=0,n=1,r=.5,o,u=t,c=t){if(li.test(e)&&(e=parseFloat(e),e=tt(c.min,c.max,e/100)-c.min),typeof e!="number")return;let d=tt(u.min,u.max,r);t===u&&(d-=e),t.min=g1(t.min,e,n,d,o),t.max=g1(t.max,e,n,d,o)}function v1(t,e,[n,r,o],u,c){xq(t,e[n],e[r],e[o],e.scale,u,c)}const wq=["x","scaleX","originX"],Aq=["y","scaleY","originY"];function b1(t,e,n,r){v1(t.x,e,wq,n?n.x:void 0,r?r.x:void 0),v1(t.y,e,Aq,n?n.y:void 0,r?r.y:void 0)}function S1(t){return t.translate===0&&t.scale===1}function MR(t){return S1(t.x)&&S1(t.y)}function x1(t,e){return t.min===e.min&&t.max===e.max}function Tq(t,e){return x1(t.x,e.x)&&x1(t.y,e.y)}function w1(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function CR(t,e){return w1(t.x,e.x)&&w1(t.y,e.y)}function A1(t){return Zt(t.x)/Zt(t.y)}function T1(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}class Eq{constructor(){this.members=[]}add(e){dy(this.members,e),e.scheduleRender()}remove(e){if(hy(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(e){const n=this.members.findIndex(o=>e===o);if(n===0)return!1;let r;for(let o=n;o>=0;o--){const u=this.members[o];if(u.isPresent!==!1){r=u;break}}return r?(this.promote(r),!0):!1}promote(e,n){const r=this.lead;if(e!==r&&(this.prevLead=r,this.lead=e,e.show(),r)){r.instance&&r.scheduleRender(),e.scheduleRender(),e.resumeFrom=r,n&&(e.resumeFrom.preserveOpacity=!0),r.snapshot&&(e.snapshot=r.snapshot,e.snapshot.latestValues=r.animationValues||r.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);const{crossfade:o}=e.options;o===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const{options:n,resumingFrom:r}=e;n.onExitComplete&&n.onExitComplete(),r&&r.options.onExitComplete&&r.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function Rq(t,e,n){let r="";const o=t.x.translate/e.x,u=t.y.translate/e.y,c=n?.z||0;if((o||u||c)&&(r=`translate3d(${o}px, ${u}px, ${c}px) `),(e.x!==1||e.y!==1)&&(r+=`scale(${1/e.x}, ${1/e.y}) `),n){const{transformPerspective:m,rotate:y,rotateX:g,rotateY:b,skewX:x,skewY:A}=n;m&&(r=`perspective(${m}px) ${r}`),y&&(r+=`rotate(${y}deg) `),g&&(r+=`rotateX(${g}deg) `),b&&(r+=`rotateY(${b}deg) `),x&&(r+=`skewX(${x}deg) `),A&&(r+=`skewY(${A}deg) `)}const d=t.x.scale*e.x,h=t.y.scale*e.y;return(d!==1||h!==1)&&(r+=`scale(${d}, ${h})`),r||"none"}const fp=["","X","Y","Z"],Oq={visibility:"hidden"},_q=1e3;let Mq=0;function dp(t,e,n,r){const{latestValues:o}=e;o[t]&&(n[t]=o[t],e.setStaticValue(t,0),r&&(r[t]=0))}function kR(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const n=hR(e);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:o,layoutId:u}=t.options;window.MotionCancelOptimisedAnimation(n,"transform",nt,!(o||u))}const{parent:r}=t;r&&!r.hasCheckedOptimisedAppear&&kR(r)}function DR({attachResizeListener:t,defaultParent:e,measureScroll:n,checkIsScrollRoot:r,resetTransform:o}){return class{constructor(c={},d=e?.()){this.id=Mq++,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(Dq),this.nodes.forEach(Lq),this.nodes.forEach(Vq),this.nodes.forEach(Nq)},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 mq)}addEventListener(c,d){return this.eventHandlers.has(c)||this.eventHandlers.set(c,new yy),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=QE(c)&&!Mz(c),this.instance=c;const{layoutId:d,layout:h,visualElement:m}=this.options;if(m&&!m.current&&m.mount(c),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(h||d)&&(this.isLayoutDirty=!0),t){let y;const g=()=>this.root.updateBlockedByResize=!1;t(c,()=>{this.root.updateBlockedByResize=!0,y&&y(),y=yq(g,250),dc.hasAnimatedSinceResize&&(dc.hasAnimatedSinceResize=!1,this.nodes.forEach(R1))})}d&&this.root.registerSharedNode(d,this),this.options.animate!==!1&&m&&(d||h)&&this.addEventListener("didUpdate",({delta:y,hasLayoutChanged:g,hasRelativeLayoutChanged:b,layout:x})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const A=this.options.transition||m.getDefaultTransition()||Kq,{onLayoutAnimationStart:w,onLayoutAnimationComplete:k}=m.getProps(),$=!this.targetLayout||!CR(this.targetLayout,x),M=!g&&b;if(this.options.layoutRoot||this.resumeFrom||M||g&&($||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const O={...My(A,"layout"),onPlay:w,onComplete:k};(m.shouldReduceMotion||this.options.layoutRoot)&&(O.delay=0,O.type=!1),this.startAnimation(O),this.setAnimationOrigin(y,M)}else g||R1(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=x})}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(),Or(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(zq),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&&kR(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 m=this.getTransformTemplate();this.prevTransformTemplateValue=m?m(this.latestValues,""):void 0,this.updateSnapshot(),c&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(E1);return}this.isUpdating||this.nodes.forEach(jq),this.isUpdating=!1,this.nodes.forEach(Bq),this.nodes.forEach(Cq),this.nodes.forEach(kq),this.clearAllSnapshots();const d=an.now();Ut.delta=Ii(0,1e3/60,d-Ut.timestamp),Ut.timestamp=d,Ut.isProcessing=!0,np.update.process(Ut),np.preRender.process(Ut),np.render.process(Ut),Ut.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,ky.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach($q),this.sharedNodes.forEach(Uq)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,nt.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){nt.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!Zt(this.snapshot.measuredBox.x)&&!Zt(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=dt(),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=r(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(!o)return;const c=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,d=this.projectionDelta&&!MR(this.projectionDelta),h=this.getTransformTemplate(),m=h?h(this.latestValues,""):void 0,y=m!==this.prevTransformTemplateValue;c&&this.instance&&(d||Wr(this.latestValues)||y)&&(o(this.instance,m),this.shouldResetTransform=!1,this.scheduleRender())}measure(c=!0){const d=this.measurePageBox();let h=this.removeElementScroll(d);return c&&(h=this.removeTransform(h)),Iq(h),{animationId:this.root.animationId,measuredBox:d,layoutBox:h,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:c}=this.options;if(!c)return dt();const d=c.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(Hq))){const{scroll:m}=this.root;m&&(uo(d.x,m.offset.x),uo(d.y,m.offset.y))}return d}removeElementScroll(c){const d=dt();if(Dn(d,c),this.scroll?.wasRoot)return d;for(let h=0;h<this.path.length;h++){const m=this.path[h],{scroll:y,options:g}=m;m!==this.root&&y&&g.layoutScroll&&(y.wasRoot&&Dn(d,c),uo(d.x,y.offset.x),uo(d.y,y.offset.y))}return d}applyTransform(c,d=!1){const h=dt();Dn(h,c);for(let m=0;m<this.path.length;m++){const y=this.path[m];!d&&y.options.layoutScroll&&y.scroll&&y!==y.root&&co(h,{x:-y.scroll.offset.x,y:-y.scroll.offset.y}),Wr(y.latestValues)&&co(h,y.latestValues)}return Wr(this.latestValues)&&co(h,this.latestValues),h}removeTransform(c){const d=dt();Dn(d,c);for(let h=0;h<this.path.length;h++){const m=this.path[h];if(!m.instance||!Wr(m.latestValues))continue;mm(m.latestValues)&&m.updateSnapshot();const y=dt(),g=m.measurePageBox();Dn(y,g),b1(d,m.latestValues,m.snapshot?m.snapshot.layoutBox:void 0,y)}return Wr(this.latestValues)&&b1(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!==Ut.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(c=!1){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||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:y,layoutId:g}=this.options;if(!(!this.layout||!(y||g))){if(this.resolvedRelativeTargetAt=Ut.timestamp,!this.targetDelta&&!this.relativeTarget){const b=this.getClosestProjectingParent();b&&b.layout&&this.animationProgress!==1?(this.relativeParent=b,this.forceRelativeParentToResolveTarget(),this.relativeTarget=dt(),this.relativeTargetOrigin=dt(),Ja(this.relativeTargetOrigin,this.layout.layoutBox,b.layout.layoutBox),Dn(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=dt(),this.targetWithTransforms=dt()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),GU(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):Dn(this.target,this.layout.layoutBox),xR(this.target,this.targetDelta)):Dn(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget)){this.attemptToResolveRelativeTarget=!1;const b=this.getClosestProjectingParent();b&&!!b.resumingFrom==!!this.resumingFrom&&!b.options.layoutScroll&&b.target&&this.animationProgress!==1?(this.relativeParent=b,this.forceRelativeParentToResolveTarget(),this.relativeTarget=dt(),this.relativeTargetOrigin=dt(),Ja(this.relativeTargetOrigin,this.target,b.target),Dn(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}}}getClosestProjectingParent(){if(!(!this.parent||mm(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(){const c=this.getLead(),d=!!this.resumingFrom||this!==c;let h=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(h=!1),d&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(h=!1),this.resolvedRelativeTargetAt===Ut.timestamp&&(h=!1),h)return;const{layout:m,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||!(m||y))return;Dn(this.layoutCorrected,this.layout.layoutBox);const g=this.treeScale.x,b=this.treeScale.y;YU(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=dt());const{target:x}=c;if(!x){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(y1(this.prevProjectionDelta.x,this.projectionDelta.x),y1(this.prevProjectionDelta.y,this.projectionDelta.y)),Za(this.projectionDelta,this.layoutCorrected,x,this.latestValues),(this.treeScale.x!==g||this.treeScale.y!==b||!T1(this.projectionDelta.x,this.prevProjectionDelta.x)||!T1(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",x))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(c=!0){if(this.options.visualElement?.scheduleRender(),c){const d=this.getStack();d&&d.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=lo(),this.projectionDelta=lo(),this.projectionDeltaWithTransform=lo()}setAnimationOrigin(c,d=!1){const h=this.snapshot,m=h?h.latestValues:{},y={...this.latestValues},g=lo();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!d;const b=dt(),x=h?h.source:void 0,A=this.layout?this.layout.source:void 0,w=x!==A,k=this.getStack(),$=!k||k.members.length<=1,M=!!(w&&!$&&this.options.crossfade===!0&&!this.path.some(Pq));this.animationProgress=0;let O;this.mixTargetDelta=G=>{const V=G/1e3;O1(g.x,c.x,V),O1(g.y,c.y,V),this.setTargetDelta(g),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Ja(b,this.layout.layoutBox,this.relativeParent.layout.layoutBox),qq(this.relativeTarget,this.relativeTargetOrigin,b,V),O&&Tq(this.relativeTarget,O)&&(this.isProjectionDirty=!1),O||(O=dt()),Dn(O,this.relativeTarget)),w&&(this.animationValues=y,vq(y,m,this.latestValues,V,M,$)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=V},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(c){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(Or(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=nt.update(()=>{dc.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=Mo(0)),this.currentAnimation=hq(this.motionValue,[0,1e3],{...c,velocity:0,isSync:!0,onUpdate:d=>{this.mixTargetDelta(d),c.onUpdate&&c.onUpdate(d)},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(_q),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const c=this.getLead();let{targetWithTransforms:d,target:h,layout:m,latestValues:y}=c;if(!(!d||!h||!m)){if(this!==c&&this.layout&&m&&NR(this.options.animationType,this.layout.layoutBox,m.layoutBox)){h=this.target||dt();const g=Zt(this.layout.layoutBox.x);h.x.min=c.target.x.min,h.x.max=h.x.min+g;const b=Zt(this.layout.layoutBox.y);h.y.min=c.target.y.min,h.y.max=h.y.min+b}Dn(d,h),co(d,y),Za(this.projectionDeltaWithTransform,this.layoutCorrected,d,y)}}registerSharedNode(c,d){this.sharedNodes.has(c)||this.sharedNodes.set(c,new Eq),this.sharedNodes.get(c).add(d);const m=d.options.initialPromotionConfig;d.promote({transition:m?m.transition:void 0,preserveFollowOpacity:m&&m.shouldPreserveFollowOpacity?m.shouldPreserveFollowOpacity(d):void 0})}isLead(){const c=this.getStack();return c?c.lead===this:!0}getLead(){const{layoutId:c}=this.options;return c?this.getStack()?.lead||this:this}getPrevLead(){const{layoutId:c}=this.options;return c?this.getStack()?.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 m=this.getStack();m&&m.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 m={};h.z&&dp("z",c,m,this.animationValues);for(let y=0;y<fp.length;y++)dp(`rotate${fp[y]}`,c,m,this.animationValues),dp(`skew${fp[y]}`,c,m,this.animationValues);c.render();for(const y in m)c.setStaticValue(y,m[y]),this.animationValues&&(this.animationValues[y]=m[y]);c.scheduleRender()}getProjectionStyles(c){if(!this.instance||this.isSVG)return;if(!this.isVisible)return Oq;const d={visibility:""},h=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,d.opacity="",d.pointerEvents=fc(c?.pointerEvents)||"",d.transform=h?h(this.latestValues,""):"none",d;const m=this.getLead();if(!this.projectionDelta||!this.layout||!m.target){const x={};return this.options.layoutId&&(x.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,x.pointerEvents=fc(c?.pointerEvents)||""),this.hasProjected&&!Wr(this.latestValues)&&(x.transform=h?h({},""):"none",this.hasProjected=!1),x}const y=m.animationValues||m.latestValues;this.applyTransformsToTarget(),d.transform=Rq(this.projectionDeltaWithTransform,this.treeScale,y),h&&(d.transform=h(y,d.transform));const{x:g,y:b}=this.projectionDelta;d.transformOrigin=`${g.origin*100}% ${b.origin*100}% 0`,m.animationValues?d.opacity=m===this?y.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:y.opacityExit:d.opacity=m===this?y.opacity!==void 0?y.opacity:"":y.opacityExit!==void 0?y.opacityExit:0;for(const x in sl){if(y[x]===void 0)continue;const{correct:A,applyTo:w,isCSSVariable:k}=sl[x],$=d.transform==="none"?y[x]:A(y[x],m);if(w){const M=w.length;for(let O=0;O<M;O++)d[w[O]]=$}else k?this.options.visualElement.renderState.vars[x]=$:d[x]=$}return this.options.layoutId&&(d.pointerEvents=m===this?fc(c?.pointerEvents)||"":"none"),d}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(c=>c.currentAnimation?.stop()),this.root.nodes.forEach(E1),this.root.sharedNodes.clear()}}}function Cq(t){t.updateLayout()}function kq(t){const e=t.resumeFrom?.snapshot||t.snapshot;if(t.isLead()&&t.layout&&e&&t.hasListeners("didUpdate")){const{layoutBox:n,measuredBox:r}=t.layout,{animationType:o}=t.options,u=e.source!==t.layout.source;o==="size"?$n(y=>{const g=u?e.measuredBox[y]:e.layoutBox[y],b=Zt(g);g.min=n[y].min,g.max=g.min+b}):NR(o,e.layoutBox,n)&&$n(y=>{const g=u?e.measuredBox[y]:e.layoutBox[y],b=Zt(n[y]);g.max=g.min+b,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[y].max=t.relativeTarget[y].min+b)});const c=lo();Za(c,n,e.layoutBox);const d=lo();u?Za(d,t.applyTransform(r,!0),e.measuredBox):Za(d,n,e.layoutBox);const h=!MR(c);let m=!1;if(!t.resumeFrom){const y=t.getClosestProjectingParent();if(y&&!y.resumeFrom){const{snapshot:g,layout:b}=y;if(g&&b){const x=dt();Ja(x,e.layoutBox,g.layoutBox);const A=dt();Ja(A,n,b.layoutBox),CR(x,A)||(m=!0),y.options.layoutRoot&&(t.relativeTarget=A,t.relativeTargetOrigin=x,t.relativeParent=y)}}}t.notifyListeners("didUpdate",{layout:n,snapshot:e,delta:d,layoutDelta:c,hasLayoutChanged:h,hasRelativeLayoutChanged:m})}else if(t.isLead()){const{onExitComplete:n}=t.options;n&&n()}t.options.transition=void 0}function Dq(t){t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=!!(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function Nq(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function $q(t){t.clearSnapshot()}function E1(t){t.clearMeasurements()}function jq(t){t.isLayoutDirty=!1}function Bq(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function R1(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function Lq(t){t.resolveTargetDelta()}function Vq(t){t.calcProjection()}function zq(t){t.resetSkewAndRotation()}function Uq(t){t.removeLeadSnapshot()}function O1(t,e,n){t.translate=tt(e.translate,0,n),t.scale=tt(e.scale,1,n),t.origin=e.origin,t.originPoint=e.originPoint}function _1(t,e,n,r){t.min=tt(e.min,n.min,r),t.max=tt(e.max,n.max,r)}function qq(t,e,n,r){_1(t.x,e.x,n.x,r),_1(t.y,e.y,n.y,r)}function Pq(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const Kq={duration:.45,ease:[.4,0,.1,1]},M1=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),C1=M1("applewebkit/")&&!M1("chrome/")?Math.round:Vn;function k1(t){t.min=C1(t.min),t.max=C1(t.max)}function Iq(t){k1(t.x),k1(t.y)}function NR(t,e,n){return t==="position"||t==="preserve-aspect"&&!FU(A1(e),A1(n),.2)}function Hq(t){return t!==t.root&&t.scroll?.wasRoot}const Fq=DR({attachResizeListener:(t,e)=>al(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),hp={current:void 0},$R=DR({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!hp.current){const t=new Fq({});t.mount(window),t.setOptions({layoutScroll:!0}),hp.current=t}return hp.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),Gq={pan:{Feature:uq},drag:{Feature:lq,ProjectionNode:$R,MeasureLayout:RR}};function D1(t,e,n){const{props:r}=t;t.animationState&&r.whileHover&&t.animationState.setActive("whileHover",n==="Start");const o="onHover"+n,u=r[o];u&&nt.postRender(()=>u(e,Al(e)))}class Yq extends Cr{mount(){const{current:e}=this.node;e&&(this.unmount=Tz(e,(n,r)=>(D1(this.node,r,"Start"),o=>D1(this.node,o,"End"))))}unmount(){}}class Xq extends Cr{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!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=Sl(al(this.node.current,"focus",()=>this.onFocus()),al(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function N1(t,e,n){const{props:r}=t;if(t.current instanceof HTMLButtonElement&&t.current.disabled)return;t.animationState&&r.whileTap&&t.animationState.setActive("whileTap",n==="Start");const o="onTap"+(n==="End"?"":n),u=r[o];u&&nt.postRender(()=>u(e,Al(e)))}class Zq extends Cr{mount(){const{current:e}=this.node;e&&(this.unmount=_z(e,(n,r)=>(N1(this.node,r,"Start"),(o,{success:u})=>N1(this.node,o,u?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const vm=new WeakMap,pp=new WeakMap,Jq=t=>{const e=vm.get(t.target);e&&e(t)},Qq=t=>{t.forEach(Jq)};function Wq({root:t,...e}){const n=t||document;pp.has(n)||pp.set(n,{});const r=pp.get(n),o=JSON.stringify(e);return r[o]||(r[o]=new IntersectionObserver(Qq,{root:t,...e})),r[o]}function eP(t,e,n){const r=Wq(e);return vm.set(t,n),r.observe(t),()=>{vm.delete(t),r.unobserve(t)}}const tP={some:0,all:1};class nP extends Cr{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:n,margin:r,amount:o="some",once:u}=e,c={root:n?n.current:void 0,rootMargin:r,threshold:typeof o=="number"?o:tP[o]},d=h=>{const{isIntersecting:m}=h;if(this.isInView===m||(this.isInView=m,u&&!m&&this.hasEnteredView))return;m&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",m);const{onViewportEnter:y,onViewportLeave:g}=this.node.getProps(),b=m?y:g;b&&b(h)};return eP(this.node.current,c,d)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:n}=this.node;["amount","margin","root"].some(iP(e,n))&&this.startObserver()}unmount(){}}function iP({viewport:t={}},{viewport:e={}}={}){return n=>t[n]!==e[n]}const rP={inView:{Feature:nP},tap:{Feature:Zq},focus:{Feature:Xq},hover:{Feature:Yq}},sP={layout:{ProjectionNode:$R,MeasureLayout:RR}},bm={current:null},jR={current:!1};function oP(){if(jR.current=!0,!!cy)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>bm.current=t.matches;t.addListener(e),e()}else bm.current=!1}const aP=new WeakMap;function lP(t,e,n){for(const r in e){const o=e[r],u=n[r];if(Ht(o))t.addValue(r,o);else if(Ht(u))t.addValue(r,Mo(o,{owner:t}));else if(u!==o)if(t.hasValue(r)){const c=t.getValue(r);c.liveStyle===!0?c.jump(o):c.hasAnimated||c.set(o)}else{const c=t.getStaticValue(r);t.addValue(r,Mo(c!==void 0?c:o,{owner:t}))}}for(const r in n)e[r]===void 0&&t.removeValue(r);return e}const $1=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class uP{scrapeMotionValuesFromProps(e,n,r){return{}}constructor({parent:e,props:n,presenceContext:r,reducedMotionConfig:o,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=_y,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 b=an.now();this.renderScheduledAt<b&&(this.renderScheduledAt=b,nt.render(this.render,!1,!0))};const{latestValues:h,renderState:m}=c;this.latestValues=h,this.baseTarget={...h},this.initialValues=n.initial?{...h}:{},this.renderState=m,this.parent=e,this.props=n,this.presenceContext=r,this.depth=e?e.depth+1:0,this.reducedMotionConfig=o,this.options=d,this.blockInitialAnimation=!!u,this.isControllingVariants=pf(n),this.isVariantNode=nR(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:y,...g}=this.scrapeMotionValuesFromProps(n,{},this);for(const b in g){const x=g[b];h[b]!==void 0&&Ht(x)&&x.set(h[b],!1)}}mount(e){this.current=e,aP.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((n,r)=>this.bindToMotionValue(r,n)),jR.current||oP(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:bm.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){this.projection&&this.projection.unmount(),Or(this.notifyUpdate),Or(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const e in this.events)this.events[e].clear();for(const e in this.features){const n=this.features[e];n&&(n.unmount(),n.isMounted=!1)}this.current=null}bindToMotionValue(e,n){this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)();const r=Vo.has(e);r&&this.onBindTransform&&this.onBindTransform();const o=n.on("change",d=>{this.latestValues[e]=d,this.props.onUpdate&&nt.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0)}),u=n.on("renderRequest",this.scheduleRender);let c;window.MotionCheckAppearSync&&(c=window.MotionCheckAppearSync(this,e,n)),this.valueSubscriptions.set(e,()=>{o(),u(),c&&c(),n.owner&&n.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in Co){const n=Co[e];if(!n)continue;const{isEnabled:r,Feature:o}=n;if(!this.features[e]&&o&&r(this.props)&&(this.features[e]=new o(this)),this.features[e]){const u=this.features[e];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):dt()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,n){this.latestValues[e]=n}update(e,n){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let r=0;r<$1.length;r++){const o=$1[r];this.propEventSubscriptions[o]&&(this.propEventSubscriptions[o](),delete this.propEventSubscriptions[o]);const u="on"+o,c=e[u];c&&(this.propEventSubscriptions[o]=this.on(o,c))}this.prevMotionValues=lP(this,this.scrapeMotionValuesFromProps(e,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]: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(e){const n=this.getClosestVariantNode();if(n)return n.variantChildren&&n.variantChildren.add(e),()=>n.variantChildren.delete(e)}addValue(e,n){const r=this.values.get(e);n!==r&&(r&&this.removeValue(e),this.bindToMotionValue(e,n),this.values.set(e,n),this.latestValues[e]=n.get())}removeValue(e){this.values.delete(e);const n=this.valueSubscriptions.get(e);n&&(n(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,n){if(this.props.values&&this.props.values[e])return this.props.values[e];let r=this.values.get(e);return r===void 0&&n!==void 0&&(r=Mo(n===null?void 0:n,{owner:this}),this.addValue(e,r)),r}readValue(e,n){let r=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options);return r!=null&&(typeof r=="string"&&(uE(r)||fE(r))?r=parseFloat(r):!kz(r)&&_r.test(n)&&(r=GE(e,n)),this.setBaseTarget(e,Ht(r)?r.get():r)),Ht(r)?r.get():r}setBaseTarget(e,n){this.baseTarget[e]=n}getBaseTarget(e){const{initial:n}=this.props;let r;if(typeof n=="string"||typeof n=="object"){const u=zy(this.props,n,this.presenceContext?.custom);u&&(r=u[e])}if(n&&r!==void 0)return r;const o=this.getBaseTargetFromProps(this.props,e);return o!==void 0&&!Ht(o)?o:this.initialValues[e]!==void 0&&r===void 0?void 0:this.baseTarget[e]}on(e,n){return this.events[e]||(this.events[e]=new yy),this.events[e].add(n)}notify(e,...n){this.events[e]&&this.events[e].notify(...n)}}class BR extends uP{constructor(){super(...arguments),this.KeyframeResolver=bz}sortInstanceNodePosition(e,n){return e.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(e,n){return e.style?e.style[n]:void 0}removeValueFromRenderState(e,{vars:n,style:r}){delete n[e],delete r[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;Ht(e)&&(this.childSubscription=e.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}function LR(t,{style:e,vars:n},r,o){Object.assign(t.style,e,o&&o.getProjectionStyles(r));for(const u in n)t.style.setProperty(u,n[u])}function cP(t){return window.getComputedStyle(t)}class fP extends BR{constructor(){super(...arguments),this.type="html",this.renderInstance=LR}readValueFromInstance(e,n){if(Vo.has(n))return this.projection?.isProjecting?om(n):V4(e,n);{const r=cP(e),o=(by(n)?r.getPropertyValue(n):r[n])||0;return typeof o=="string"?o.trim():o}}measureInstanceViewportBox(e,{transformPagePoint:n}){return wR(e,n)}build(e,n,r){By(e,n,r.transformTemplate)}scrapeMotionValuesFromProps(e,n,r){return Uy(e,n,r)}}const VR=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 dP(t,e,n,r){LR(t,e,void 0,r);for(const o in e.attrs)t.setAttribute(VR.has(o)?o:jy(o),e.attrs[o])}class hP extends BR{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=dt}getBaseTargetFromProps(e,n){return e[n]}readValueFromInstance(e,n){if(Vo.has(n)){const r=FE(n);return r&&r.default||0}return n=VR.has(n)?n:jy(n),e.getAttribute(n)}scrapeMotionValuesFromProps(e,n,r){return dR(e,n,r)}build(e,n,r){lR(e,n,this.isSVGTag,r.transformTemplate,r.style)}renderInstance(e,n,r,o){dP(e,n,r,o)}mount(e){this.isSVGTag=cR(e.tagName),super.mount(e)}}const pP=(t,e)=>Vy(t)?new hP(e):new fP(e,{allowProjection:t!==B.Fragment}),mP=dU({...VU,...rP,...Gq,...sP},pP),yP=Lz(mP);function gP(){const t=Fn(_o),e=Fn(ri),n=Fn(Li),r=bt(_o),o=bt(ri),u=bt(Li),c=`email-${B.useId()}`,d=`password-${B.useId()}`,h=`one-time-code-${B.useId()}`,[m,y]=B.useState(null),[g,b]=B.useState("email");return F.jsx("form",{onSubmit:async x=>{x.preventDefault();const A=We(ni);try{switch(g){case"email":{const{nextStep:w,userKey:k}=await on.declareAuthTarget.query({email:r});switch(De(ni,k),w){case"otc_login":case"otc_verify":{b("otc");break}case"password_login":{b("password");break}}break}case"otc":{if(!A){console.error("somehow userKey is null");return}const w=await on.verifyAccountAction.mutate({oneTimeCode:u,userKey:A});De(ot,w),fi.once("connect",()=>{cs("/game"),t(""),n("")});break}case"password":{const w=await on.openSession.mutate({email:r,password:o});De(ot,w),fi.once("connect",()=>{cs("/game"),t(""),e("")});break}}}catch(w){w instanceof Oo&&y(w.message)}},children:F.jsxs("main",{children:[m?F.jsx("aside",{children:m}):null,F.jsxs(yP.label,{htmlFor:c,children:[F.jsx("span",{children:"Email"}),F.jsx("input",{id:c,type:"text",value:r,onChange:x=>{t(x.target.value)},autoComplete:"email",autoCapitalize:"none",disabled:g!=="email"})]}),g==="password"?F.jsxs("label",{htmlFor:d,children:[F.jsx("span",{children:"Password"}),F.jsx("input",{id:d,type:"password",value:o,onChange:x=>{e(x.target.value)},autoComplete:"current-password",autoCapitalize:"none",autoFocus:g==="password"})]}):null,g==="otc"?F.jsxs("label",{htmlFor:h,children:[F.jsx("span",{children:"One-time Code"}),F.jsx("input",{id:h,type:"otc",value:u,onChange:x=>{n(x.target.value)},autoComplete:"one-time-code",autoCapitalize:"none",autoFocus:g==="otc"})]}):null,F.jsxs("footer",{children:[g==="password"?F.jsx("button",{type:"button",onClick:async()=>{const x=We(ni);if(!x)return new Error("No userKey");await on.startPasswordReset.mutate({userKey:x}),b("otc")},children:"Forgot Password?"}):null,F.jsx("span",{}),F.jsx("button",{type:"submit",disabled:!r&&g==="email"||!o&&g==="password"||!u&&g==="otc",children:">>->"})]})]})})}function vP({route:[,t]}){const e=bt(ot),n=bt(Li),r=Fn(Li);mp.useState(!1);const[o,u]=mp.useState(null),c=`code-${B.useId()}`;if(hc(()=>{t&&r(t)}),!e)return F.jsx("p",{children:"You must be logged in to verify your account."});const{verification:d}=e;return hc(()=>{n&&console.log("verifying token",n)}),F.jsx("form",{onSubmit:async h=>{h.preventDefault();try{const m=await on.verifyAccountAction.mutate({oneTimeCode:n,userKey:"CHANGEME"});De(ot,m),m.action==="resetPassword"?cs("/account"):cs("/game")}catch(m){m instanceof Oo&&u(m.message)}},children:F.jsxs("main",{children:[F.jsx("p",{children:"Check your email for a verification code."}),F.jsxs("label",{htmlFor:c,children:[F.jsx("span",{children:"Verification code"}),F.jsx("input",{id:c,type:"text",value:n,onChange:h=>{r(h.target.value)},placeholder:"Verification code",autoComplete:"one-time-code",autoCapitalize:"none"})]})]})})}function bP(){const t=bt(iE),e=bt(ot),[n,r]=B.useState(!1),{refs:o,floatingStyles:u,context:c}=uD({open:n,onOpenChange:r,placement:"bottom-end",middleware:[$k(5),Bk(),jk()],whileElementsMounted:Rk}),d=rD(c),h=aD(c),m=dD(c),{getReferenceProps:y,getFloatingProps:g}=cD([d,h,m]),b=bt(cL);return F.jsxs("main",{className:W3.class,children:[F.jsxs("header",{children:[F.jsxs("main",{children:[F.jsx(Q3,{}),F.jsx("span",{children:F.jsx(eB,{input:b})})]}),F.jsx("button",{"data-css":"profile",ref:o.setReference,...y(),children:e?.username?e.username.slice(0,2):""}),n&&e&&F.jsx(nD,{context:c,modal:!1,children:F.jsxs("div",{"data-css":"profile-actions",ref:o.setFloating,style:u,...g(),children:[F.jsx("span",{children:e.username}),F.jsx("button",{type:"button",onClick:()=>{cs("/account")},children:"Account"}),F.jsx("button",{type:"button",onClick:async()=>{e&&(await on.closeSession.mutate({username:e.username}),fi.once("disconnect",()=>{De(ot,null),cs("/")}),fi.disconnect())},children:"Sign out"})]})})]}),F.jsx("main",{children:typeof t=="number"?F.jsxs("article",{children:[F.jsx("h1",{children:t}),F.jsx("h2",{children:JSON.parse(xT[t])}),F.jsx(wT,{href:"/",children:"Return to Home Page"})]}):(()=>{switch(t[0]){case void 0:return F.jsx(gP,{});case"admin":return F.jsx(OV,{});case"game":return F.jsx(kV,{route:t});case"verify":return F.jsx(vP,{route:t});case"account":return F.jsx(RV,{})}})()})]})}gC.createRoot(document.getElementById("root")).render(F.jsx(B.StrictMode,{children:F.jsx(uC,{socket:fi,children:F.jsx(bP,{})})}));
|