tempest.games 0.1.46 → 0.2.1

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.
@@ -1,106 +0,0 @@
1
- var FS=Object.defineProperty;var WS=(t,s,n)=>s in t?FS(t,s,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[s]=n;var g=(t,s,n)=>WS(t,typeof s!="symbol"?s+"":s,n);(function(){const s=document.createElement("link").relList;if(s&&s.supports&&s.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const c of o)if(c.type==="childList")for(const h of c.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&r(h)}).observe(document,{childList:!0,subtree:!0});function n(o){const c={};return o.integrity&&(c.integrity=o.integrity),o.referrerPolicy&&(c.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?c.credentials="include":o.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function r(o){if(o.ep)return;o.ep=!0;const c=n(o);fetch(o.href,c)}})();var Jc={exports:{}},na={};/**
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 _y;function PS(){if(_y)return na;_y=1;var t=Symbol.for("react.transitional.element"),s=Symbol.for("react.fragment");function n(r,o,c){var h=null;if(c!==void 0&&(h=""+c),o.key!==void 0&&(h=""+o.key),"key"in o){c={};for(var p in o)p!=="key"&&(c[p]=o[p])}else c=o;return o=c.ref,{$$typeof:t,type:r,key:h,ref:o!==void 0?o:null,props:c}}return na.Fragment=s,na.jsx=n,na.jsxs=n,na}var Ty;function eA(){return Ty||(Ty=1,Jc.exports=PS()),Jc.exports}var j=eA();function Pg(t=Math.random){return t().toString(36).slice(2)}class df extends Promise{constructor(n){let r,o;super((c,h)=>{r=c,o=h});g(this,"fate");g(this,"resolve");g(this,"reject");g(this,"done",!1);this.resolve=r,this.reject=o,this.use(n instanceof Promise?n:new Promise(n))}pass(n,r){n===this.fate&&(this.resolve(r),this.done=!0)}fail(n,r){n===this.fate&&(this.reject(r),this.done=!0)}use(n){if(n instanceof Promise){const r=n;this.fate=r,r.then(o=>{this.pass(r,o)},o=>{this.fail(r,o)})}else this.resolve(n),this.fate=void 0}}function tA(t){return Object.entries(t)}const nA=(t,s,n=nt.STORE)=>ub(n,{key:`${t.key}:JSON`,get:({get:r})=>s.toJson(r(t)),set:({set:r},o)=>{r(t,s.fromJson(o))}});function ce(t){for(;t.child!==null;)t=t.child;return t}class Pe{constructor(){g(this,"Subscriber");g(this,"subscribers",new Map)}subscribe(s,n){return this.subscribers.set(s,n),()=>{this.unsubscribe(s)}}unsubscribe(s){this.subscribers.delete(s)}next(s){const n=this.subscribers.values();for(const r of n)r(s)}}class iA extends Pe{constructor(n){super();g(this,"state");this.state=n}next(n){this.state=n,super.next(n)}}function Jf(t,s,n){const r={key:s.key,type:"atom_family"},o=t.families.get(s.key);o&&t.logger.error("❗","atom_family",s.key,`Overwriting an existing ${ma(o)} "${o.key}" in store "${t.config.name}". You can safely ignore this warning if it is due to hot module replacement.`);const c=new Pe,p=Object.assign(m=>{const y=Je(m),v={key:s.key,subKey:y},x=`${s.key}(${y})`,N=ce(t),k=s.default,B={key:x,default:k instanceof Function?k(m):k};s.effects&&(B.effects=s.effects(m));const K=bo(N,B,v);return c.next({type:"state_creation",token:K}),K},r,{subject:c,install:m=>Jf(m,s),internalRoles:n});return t.families.set(s.key,p),t.defaults.set(s.key,s.default),r}function Ks(t,s,n){const r={key:s.key,type:"readonly_selector_family"},o=t.families.get(s.key);o&&t.logger.error("❗","readonly_selector_family",s.key,`Overwriting an existing ${ma(o)} "${o.key}" in store "${t.config.name}". You can safely ignore this warning if it is due to hot module replacement.`);const c=new Pe,p=Object.assign(m=>{const y=Je(m),v={key:s.key,subKey:y},x=`${s.key}(${y})`,N=ce(t),k=eh(N,{key:x,get:s.get(m)},v);return c.next({type:"state_creation",token:k}),k},r,{internalRoles:n,subject:c,install:m=>Ks(m,s),default:m=>s.get(m)({get:(...v)=>ln(t,...v),find:(...v)=>Ot(t,...v),json:v=>Zi(t,v)})});return t.families.set(s.key,p),r}function sA(t,s){return"set"in s?nh(t,s):Ks(t,s)}class If{constructor(s){g(this,"_buffer");g(this,"_index",0);let n;typeof s=="number"?n=s:n=s.length,this._buffer=Array.from({length:n})}get buffer(){return this._buffer}get index(){return this._index}add(s){this._buffer[this._index]=s,this._index=(this._index+1)%this._buffer.length}copy(){const s=new If([...this._buffer]);return s._index=this._index,s}}const rA={atom_family:"atom",mutable_atom_family:"mutable_atom",selector_family:"selector",readonly_selector_family:"readonly_selector",molecule_family:"molecule"};function aA(t,s){const n=Je(s),r=`${t.key}(${n})`,o=rA[t.type],c={key:r,type:o};return Object.assign(c,{family:{key:t.key,subKey:n}}),Object.assign(c,{counterfeit:!0}),c}function Js(t){const s={key:t.key,type:t.type};return"family"in t&&(s.family=t.family),s}function Xt(t){return nw(nt.STORE,t)}function pf(...t){return t.length===2?ln(nt.STORE,...t):ln(nt.STORE,...t)}function lA(t,s,n=nt.STORE){return n.joins.set(t.key,new db(t,s,n)),{key:t.key,type:"join",a:t.between[0],b:t.between[1],cardinality:t.cardinality}}function oA(t){return sw(t,nt.STORE)}const Ic=t=>(s,n,r,o,...c)=>{console[t](`${s} ${n} "${r}" ${o}`,...c)},uA={error:Ic("error"),info:Ic("info"),warn:Ic("warn")};class cA{constructor(s,n,r=uA){g(this,"logLevel");g(this,"filter");g(this,"logger");g(this,"error",(...s)=>{var n;(((n=this.filter)==null?void 0:n.call(this,...s))??!0)&&this.logLevel!==null&&this.logger.error(...s)});g(this,"info",(...s)=>{var n;(((n=this.filter)==null?void 0:n.call(this,...s))??!0)&&this.logLevel==="info"&&this.logger.info(...s)});g(this,"warn",(...s)=>{var n;(((n=this.filter)==null?void 0:n.call(this,...s))??!0)&&this.logLevel!=="error"&&this.logLevel!==null&&this.logger.warn(...s)});this.logLevel=s,this.filter=n,this.logger=r}}class fA{constructor(s=nt.STORE){g(this,"store");this.store=s,xA("root",s)}allocate(s,n,r){return ya(this.store,s,n,r)}fuse(s,n,r){return OA(this.store,s,n,r)}deallocate(s){ga(this.store,s)}claim(s,n,r){return so(this.store,s,n,r)}}class hA{constructor(s=nt.STORE){g(this,"store");g(this,"realm");this.store=s,this.realm=new fA(s)}allocate(s,n,r){ya(this.store,s,n,r)}deallocate(s){ga(this.store,s)}claim(s,n,r){so(this.store,s,n,r)}}function Xi(t){return ub(nt.STORE,t)}function dA(t){return sA(nt.STORE,t)}function Xf(...t){t.length===2?et(nt.STORE,...t):et(nt.STORE,...t)}function Yn(t){return"epoch"in t.transactionMeta}function xt(t){return"phase"in t.transactionMeta}const pA=t=>{const s=ce(t);if(!xt(s)){t.logger.warn("🐞","transaction","???","abortTransaction called outside of a transaction. This is probably a bug in AtomIO.");return}t.logger.info("🪂","transaction",s.transactionMeta.update.key,"Aborting transaction"),s.parent.child=null};function Jt(t){return t[0].toUpperCase()+t.slice(1)}function ma(t){return t.type.split("_").map(Jt).join(" ")}class Zf extends Error{constructor(s,n){super(`${ma(s)} ${Je(s.key)} not found in store "${n.config.name}".`)}}function Qf(t,s,n){return(...r)=>{const o=dt(t,s);if(o)return o.run(r,n);throw new Zf(s,t)}}const eb=t=>s=>t instanceof Function?t(s):t,yo=(t,s)=>{if(t.valueMap.has(s.key))return t.logger.info("📖",s.type,s.key,"reading cached value"),WA(s,t);switch(s.type){case"selector":case"readonly_selector":return t.logger.info("🧮",s.type,s.key,"computing value"),s.get();case"atom":case"mutable_atom":{const n=s.default;let r;return n instanceof Function?r=n():r=n,t.logger.info("💁","atom",s.key,"could not find cached value; using default",r),r}}},mA=(t,s)=>{if(t.operation.open){const n=performance.now();return t.logger.info("❗",s.type,s.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:s},t.logger.info("⭕",s.type,s.key,`operation start in store "${t.config.name}"${xt(t)?` ${t.transactionMeta.phase} "${t.transactionMeta.update.key}"`:""}`)},yA=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)},gA=(t,s)=>t.operation.open?t.operation.done.has(s):(t.logger.error("🐞","unknown",s,"isDone called outside of an operation. This is probably a bug in AtomIO."),!0),Ff=(t,s)=>{if(!t.operation.open){t.logger.error("🐞","unknown",s,"markDone called outside of an operation. This is probably a bug in AtomIO.");return}t.operation.done.add(s)},bA=(t,s,n)=>{switch(s.type){case"mutable_atom":t.logger.info("📢",s.type,s.key,"is now (",n.newValue,") subscribers:",s.subject.subscribers);break;case"atom":case"selector":case"readonly_selector":t.logger.info("📢",s.type,s.key,"went (",n.oldValue,"->",n.newValue,") subscribers:",s.subject.subscribers)}s.subject.next(n)},Ry=(t,s)=>{const n=ce(t),r=n.selectorAtoms.getRelatedKeys(s.key);if(n.logger.info("🧹",s.type,s.key,r?`evicting ${r.size} states downstream:`:"no downstream states",r??"to evict"),r){n.operation.open&&n.logger.info("🧹",s.type,s.key,`[ ${[...n.operation.done].join(", ")} ] already done`);for(const o of r)gA(n,o)||(PA(o,n),Ff(n,o))}},vA=(t,s,n)=>{const r=yo(t,s);let o=r;if(s.type==="mutable_atom"&&xt(t)){const{parent:h}=t;o=yf(t,s,h)}o=eb(n)(o),t.logger.info("📝","atom",s.key,"set to",o),o=Ji(t,s.key,o,s.subject),ew(t,s.key)&&tw(t,s.key),Ff(t,s.key),Ry(t,s);const c={oldValue:r,newValue:o};if(!xt(t)){bA(t,s,c);return}if(t.on.transactionApplying.state===null){const{key:h}=s;if(FA(c.newValue))return;const p={type:"atom_update",key:h,...c};s.family&&(p.family=s.family),t.transactionMeta.update.updates.push(p),t.logger.info("📁","atom",h,"stowed (",c.oldValue,"->",c.newValue,")")}else if(s.key.startsWith("*")){const h=s.key.slice(1),p=t.atoms.get(h);let m=t.valueMap.get(h);if(p.type==="mutable_atom"&&xt(t)){const{parent:v}=t;m=yf(t,p,v)}m.do(c.newValue)===null&&Ry(t,p)}},tb=(t,s,n)=>{switch(s.type){case"atom":case"mutable_atom":vA(t,s,n);break;case"selector":s.set(n);break}};function SA(t,s){if(s.family){const n=t.families.get(s.family.key);if(n)return n}}function et(t,...s){let n,r,o,c;if(s.length===2?(n=s[0],c=s[1],r=SA(t,n)??null,r&&(o=n.family?er(n.family.subKey):null,n=Ot(t,r,o))):(r=s[0],o=s[1],c=s[2],n=Ot(t,r,o)),"counterfeit"in n&&"family"in n){const m=n.family.subKey,y=t.disposalTraces.buffer.find(v=>(v==null?void 0:v.key)===m);t.logger.error("❌",n.type,n.key,`could not be set because it was not found in the store "${t.config.name}".`,y?`This state was previously disposed:
10
- ${y.trace}`:"No previous disposal trace was found.");return}const h=mA(t,n);if(h){const m=t.on.operationClose.subscribe(`waiting to set "${n.key}" at T-${h}`,()=>{m(),t.logger.info("🟢",n.type,n.key,`resuming deferred setState from T-${h}`),et(t,n,c)});return}const p=dt(t,n);tb(t,p,c),yA(t)}function AA(t,s,n){const{key:r,newValue:o,oldValue:c}=s,h=t==="newValue"?o:c,p={key:r,type:"atom"};s.family&&Object.assign(p,{family:s.family}),et(n,p,h)}function wA(t){var n,r;const{stack:s}=t;return s?`
11
- `+((r=(n=s.split(`
12
- `))==null?void 0:n.slice(1))==null?void 0:r.join(`
13
- `)):""}function xA(t,s=nt.STORE){const n={key:t,stringKey:Je(t),dependsOn:"any"};return s.molecules.set(Je(t),n),t}function ya(t,s,n,r="any"){const o=s,c=Je(n),h=[],p=ce(t);if(Array.isArray(o))for(const v of o){const x=Je(v);p.molecules.get(x)?t.moleculeGraph.set(x,c,{source:x}):h.push(x)}else{const v=Je(o);p.molecules.get(v)?t.moleculeGraph.set(v,c,{source:v}):h.push(v)}h.length===0&&p.molecules.set(c,{key:n,stringKey:c,dependsOn:r});const m={type:"molecule_creation",key:n,provenance:o};xt(p)&&p.transactionMeta.phase==="building"?p.transactionMeta.update.updates.push(m):p.on.moleculeCreation.next(m);for(const v of h){const x=t.disposalTraces.buffer.find(N=>(N==null?void 0:N.key)===v);t.logger.error("❌","molecule",n,"allocation failed:",`Could not allocate to ${v} in store "${t.config.name}".`,x?`
14
- ${v} was most recently disposed
15
- ${x.trace}`:`No previous disposal trace for ${v} was found.`)}return n}function OA(t,s,n,r){const o=`T$--${s}==${n}++${r}`;return ya(t,[n,r],o,"all"),o}function ga(t,s){const n=Je(s),r=t.molecules.get(n);if(!r){const k=t.disposalTraces.buffer.find(B=>(B==null?void 0:B.key)===n);t.logger.error("❌","molecule",s,"deallocation failed:",`Could not find allocation for ${n} in store "${t.config.name}".`,k?`
16
- This state was most recently deallocated
17
- ${k.trace}`:`No previous disposal trace for ${n} was found.`);return}const o=t.moleculeJoins.getRelatedKeys(r.key);if(o)for(const k of o){const B=t.joins.get(k);B&&(B.relations.delete(r.key),B.molecules.delete(r.stringKey))}t.moleculeJoins.delete(r.stringKey);const c=[],h=[],p={type:"molecule_disposal",key:r.key,values:h,provenance:c},m=ce(t);m.molecules.delete(n);const y=xt(m)&&m.transactionMeta.phase==="building";y&&m.transactionMeta.update.updates.push(p);const v=t.moleculeGraph.getRelationEntries({downstreamMoleculeKey:r.stringKey});if(v)for(const[k,{source:B}]of v)if(B===r.stringKey){const K=er(k);ga(t,K)}else c.push(B);const x=m.moleculeData.getRelatedKeys(r.stringKey);if(x)for(const k of x){const B=m.families.get(k),K=Ot(t,B,r.key);h.push([B.key,K]),go(t,K)}m.moleculeGraph.delete(r.stringKey),m.moleculeJoins.delete(r.stringKey),m.moleculeData.delete(r.stringKey),y||m.on.moleculeDisposal.next(p),m.molecules.delete(r.stringKey);const N=wA(new Error);t.disposalTraces.add({key:n,trace:N})}function so(t,s,n,r){const o=Je(n),c=ce(t),h=c.molecules.get(o);if(!h){const N=t.disposalTraces.buffer.find(k=>(k==null?void 0:k.key)===o);return t.logger.error("❌","molecule",n,"claim failed:",`Could not allocate to ${o} in store "${t.config.name}".`,N?`
18
- ${o} was most recently disposed
19
- ${N.trace}`:`No previous disposal trace for ${o} was found.`),n}const p=Je(s),m=c.molecules.get(p);if(!m){const N=t.disposalTraces.buffer.find(k=>(k==null?void 0:k.key)===p);return t.logger.error("❌","molecule",n,"claim failed:",`Could not allocate to ${p} in store "${t.config.name}".`,N?`
20
- ${p} was most recently disposed
21
- ${N.trace}`:`No previous disposal trace for ${p} was found.`),n}const y=t.moleculeGraph.getRelationEntries({downstreamMoleculeKey:h.stringKey}).filter(([,{source:N}])=>N!==o).map(([N])=>er(N));r&&c.moleculeGraph.delete(o),c.moleculeGraph.set({upstreamMoleculeKey:m.stringKey,downstreamMoleculeKey:h.stringKey},{source:m.stringKey});const v={type:"molecule_transfer",key:h.key,from:y,to:[m.key]};return xt(c)&&c.transactionMeta.phase==="building"&&c.transactionMeta.update.updates.push(v),n}function EA(t,s,n){switch(s){case"newValue":{nb(t,n);break}case"oldValue":{go(n,t.token);break}}}function _A(t,s,n){switch(s){case"newValue":{go(n,t.token);break}case"oldValue":{nb(t,n),t.subType==="atom"&&n.valueMap.set(t.token.key,t.value);break}}}function nb(t,s){const{family:n}=t.token;if(n){const r=s.families.get(n.key);r&&Ot(s,r,er(n.subKey))}}function TA(t,s,n){switch(s){case"newValue":ya(n,t.provenance,t.key);break;case"oldValue":ga(n,t.key);break}}function RA(t,s,n){switch(s){case"newValue":ga(n,t.key);break;case"oldValue":{const r=t.provenance.map(er);ya(n,r,t.key);for(const[o,c]of t.values){const h=n.families.get(o);if(h){Ot(n,h,t.key);const p=`${o}(${Je(t.key)})`;n.valueMap.set(p,c)}}}break}}function kA(t,s,n){switch(s){case"newValue":{const r=t.to.length===1?t.to[0]:t.to;so(n,r,t.key,"exclusive")}break;case"oldValue":{const r=t.from.length===1?t.from[0]:t.from;so(n,r,t.key,"exclusive")}break}}function js(t,s,n){const r=t==="newValue"?s.updates:[...s.updates].reverse();for(const o of r)switch(o.type){case"atom_update":case"selector_update":AA(t,o,n);break;case"state_creation":EA(o,t,n);break;case"state_disposal":_A(o,t,n);break;case"molecule_creation":TA(o,t,n);break;case"molecule_disposal":RA(o,t,n);break;case"molecule_transfer":kA(o,t,n);break;case"transaction_update":js(t,o,n);break}}function ib(t,s){return t.transactionMeta.actionContinuities.getRelatedKey(s)}function sb(t,s){return t.transactionMeta.epoch.get(s)}function NA(t,s){if(!Yn(t))return;const r=ib(t,s);if(r!==void 0)return sb(t,r)}function Wf(t,s,n){Yn(t)&&s&&t.transactionMeta.epoch.set(s,n)}function MA(t,s,n){if(!Yn(t))return;const o=ib(t,s);o!==void 0&&t.transactionMeta.epoch.set(o,n)}const $A=(t,s)=>{var c;const n=ce(s),{parent:r}=n;if(r===null||!xt(n)||((c=n.transactionMeta)==null?void 0:c.phase)!=="building"){s.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;if(s.logger.info("🛄","transaction",n.transactionMeta.update.key,`Applying transaction with ${o.length} updates:`,o),js("newValue",n.transactionMeta.update,r),Yn(r)){MA(r,n.transactionMeta.update.key,n.transactionMeta.update.epoch);const h=dt(s,{key:n.transactionMeta.update.key,type:"transaction"});h==null||h.subject.next(n.transactionMeta.update),s.logger.info("🛬","transaction",n.transactionMeta.update.key,"Finished applying transaction.")}else xt(r)&&r.transactionMeta.update.updates.push(n.transactionMeta.update);r.on.transactionApplying.next(null)};function rb(t,s,n){if(!Yn(t))return;const{epoch:o,actionContinuities:c}=t.transactionMeta;c.set(s,n),o.has(s)||o.set(s,-1)}function DA(t){return{store:t}}function ln(t,...s){let n,r,o;if(s.length===1?n=s[0]:(r=s[0],o=s[1],n=Ot(t,r,o)),"counterfeit"in n&&"family"in n){r=t.families.get(n.family.key);const c=n.family.subKey,h=t.disposalTraces.buffer.find(p=>(p==null?void 0:p.key)===c);switch(t.logger.error("❌",n.type,n.key,`could not be retrieved because it was not found in the store "${t.config.name}".`,h?`This state was previously disposed:
22
- ${h.trace}`:"No previous disposal trace was found."),r.type){case"atom_family":case"mutable_atom_family":return t.defaults.get(r.key);case"selector_family":case"readonly_selector_family":{if(t.defaults.has(r.key))return t.defaults.get(n.family.key);const p=dt(t,r).default(c);return t.defaults.set(r.key,p),p}}}return yo(t,dt(t,n))}class Tt{constructor(s,n){g(this,"a");g(this,"b");g(this,"cardinality");g(this,"relations",new Map);g(this,"contents",new Map);g(this,"isAType");g(this,"isBType");g(this,"isContent");g(this,"makeContentKey",(s,n)=>`${s}:${n}`);g(this,"warn");var r,o;if(this.a=s.between[0],this.b=s.between[1],this.cardinality=s.cardinality,n!=null&&n.externalStore||(this.relations=new Map((r=s.relations)==null?void 0:r.map(([c,h])=>[c,new Set(h)])),this.contents=new Map(s.contents)),this.isAType=(n==null?void 0:n.isAType)??null,this.isBType=(n==null?void 0:n.isBType)??null,this.isContent=(n==null?void 0:n.isContent)??null,n!=null&&n.makeContentKey&&(this.makeContentKey=n.makeContentKey),n!=null&&n.externalStore){const c=n.externalStore;this.has=(h,p)=>c.has(h,p),this.addRelation=(h,p)=>{c.addRelation(h,p)},this.deleteRelation=(h,p)=>{c.deleteRelation(h,p)},this.replaceRelationsSafely=(h,p)=>{c.replaceRelationsSafely(h,p)},this.replaceRelationsUnsafely=(h,p)=>{c.replaceRelationsUnsafely(h,p)},this.getRelatedKeys=h=>c.getRelatedKeys(h),c.getContent&&(this.getContentInternal=h=>c.getContent(h),this.setContent=(h,p)=>{c.setContent(h,p)},this.deleteContent=h=>{c.deleteContent(h)});for(const[h,p]of s.relations??[]){let m=(o=this.isAType)!=null&&o.call(this,h)?h:void 0,y=m===void 0?h:void 0;for(const v of p)m??(m=v),y??(y=v),this.addRelation(m,y)}for(const[h,p]of s.contents??[])this.setContent(h,p)}n!=null&&n.warn&&(this.warn=n.warn)}getRelatedKeys(s){return this.relations.get(s)}addRelation(s,n){let r=this.relations.get(s),o=this.relations.get(n);r?r.add(n):(r=new Set([n]),this.relations.set(s,r)),o?o.add(s):(o=new Set([s]),this.relations.set(n,o))}deleteRelation(s,n){const r=this.relations.get(s);if(r){r.delete(n),r.size===0&&this.relations.delete(s);const o=this.relations.get(n);o&&(o.delete(s),o.size===0&&this.relations.delete(n))}}replaceRelationsUnsafely(s,n){this.relations.set(s,new Set(n));for(const r of n){const o=new Set().add(s);this.relations.set(r,o)}}replaceRelationsSafely(s,n){var h;const r=this.relations.get(s);let o=(h=this.isAType)!=null&&h.call(this,s)?s:void 0,c=o===void 0?s:void 0;if(r)for(const p of r){o??(o=p),c??(c=p);const m=this.relations.get(p);m&&(m.size===1?this.relations.delete(p):m.delete(s),this.contents.delete(this.makeContentKey(o,c)))}this.relations.set(s,new Set(n));for(const p of n){let m=this.relations.get(p);m?m.add(s):(m=new Set().add(s),this.relations.set(p,m))}}getContentInternal(s){return this.contents.get(s)}setContent(s,n){this.contents.set(s,n)}deleteContent(s){this.contents.delete(s)}toJSON(){return{between:[this.a,this.b],cardinality:this.cardinality,relations:[...this.relations.entries()].map(([s,n])=>[s,[...n]]),contents:[...this.contents.entries()]}}set(...s){let n,r,o;switch(s.length){case 1:{const c=s[0];n=c[this.a],r=c[this.b],o=void 0;break}case 2:{const c=s[0];typeof c=="string"?[n,r]=s:(n=c[this.a],r=c[this.b],o=s[1]);break}default:{n=s[0],r=s[1],o=s[2];break}}switch(this.cardinality){case"1:1":{const c=this.getRelatedKey(n);c&&c!==r&&this.delete(n,c)}case"1:n":{const c=this.getRelatedKey(r);c&&c!==n&&this.delete(c,r)}break}if(o){const c=this.makeContentKey(n,r);this.setContent(c,o)}return this.addRelation(n,r),this}delete(s,n){n=typeof n=="string"?n:s[this.b];const r=typeof s=="string"?s:s[this.a];if(r===void 0&&typeof n=="string"){const o=this.getRelatedKeys(n);if(o)for(const c of o)this.delete(c,n)}if(typeof r=="string"&&n===void 0){const o=this.getRelatedKeys(r);if(o)for(const c of o)this.delete(r,c)}if(typeof r=="string"&&typeof n=="string"){this.deleteRelation(r,n);const o=this.makeContentKey(r,n);this.deleteContent(o)}return this}getRelatedKey(s){var r;const n=this.getRelatedKeys(s);if(n){n.size>1&&((r=this.warn)==null||r.call(this,`${n.size} related keys were found for key "${s}": (${[...n].map(c=>`"${c}"`).join(", ")}). Only one related key was expected.`));let o;for(const c of n){o=c;break}return o}}replaceRelations(s,n,r){const o=!Array.isArray(n),c=o?Object.keys(n):n;if(r!=null&&r.reckless?this.replaceRelationsUnsafely(s,c):this.replaceRelationsSafely(s,c),o)for(const h of c){const p=this.makeContentKey(s,h),m=n[h];this.setContent(p,m)}return this}getContent(s,n){const r=this.makeContentKey(s,n);return this.getContentInternal(r)}getRelationEntries(s){const n=s[this.a],r=s[this.b];if(n!==void 0&&r===void 0){const o=this.getRelatedKeys(n);if(o)return[...o].map(c=>[c,this.getContent(n,c)])}if(n===void 0&&r!==void 0){const o=this.getRelatedKeys(r);if(o)return[...o].map(c=>[c,this.getContent(c,r)])}return[]}has(s,n){if(n){const r=this.getRelatedKeys(s);return(r==null?void 0:r.has(n))??!1}return this.relations.has(s)}}class vn extends Map{constructor(n){super();g(this,"deleted",new Set);g(this,"source");this.source=n}get(n){if(super.has(n))return super.get(n);if(!this.deleted.has(n)&&this.source.has(n))return this.source.get(n)}set(n,r){return this.deleted.delete(n),super.set(n,r)}hasOwn(n){return super.has(n)}has(n){return!this.deleted.has(n)&&(super.has(n)||this.source.has(n))}delete(n){return this.deleted.add(n),super.delete(n)}}const CA=(t,s,n,r)=>{const o=ce(t),c={parent:o,child:null,on:o.on,loggers:o.loggers,logger:o.logger,config:o.config,atoms:new vn(o.atoms),atomsThatAreDefault:new Set(o.atomsThatAreDefault),families:new vn(o.families),joins:new vn(o.joins),operation:{open:!1},readonlySelectors:new vn(o.readonlySelectors),timelines:new vn(o.timelines),timelineTopics:new Tt(o.timelineTopics.toJSON()),trackers:new Map,transactions:new vn(o.transactions),selectorAtoms:new Tt(o.selectorAtoms.toJSON()),selectorGraph:new Tt(o.selectorGraph.toJSON(),{makeContentKey:(...y)=>y.sort().join(":")}),selectors:new vn(o.selectors),valueMap:new vn(o.valueMap),defaults:o.defaults,disposalTraces:t.disposalTraces.copy(),molecules:new vn(o.molecules),moleculeGraph:new Tt(o.moleculeGraph.toJSON(),{makeContentKey:o.moleculeGraph.makeContentKey}),moleculeData:new Tt(o.moleculeData.toJSON(),{makeContentKey:o.moleculeData.makeContentKey}),moleculeJoins:new Tt(o.moleculeJoins.toJSON(),{makeContentKey:o.moleculeJoins.makeContentKey}),miscResources:new vn(o.miscResources)},h=NA(t,s),p={phase:"building",update:{type:"transaction_update",key:s,id:r,epoch:h===void 0?Number.NaN:h+1,updates:[],params:n,output:void 0},toolkit:{get:(...y)=>ln(m,...y),set:(...y)=>{et(m,...y)},run:(y,v=Pg())=>Qf(m,y,v),find:(...y)=>Ot(t,...y),json:y=>Zi(m,y),dispose:(...y)=>{go(m,...y)},env:()=>DA(m)}},m=Object.assign(c,{transactionMeta:p});return o.child=m,t.logger.info("🛫","transaction",s,"Building transaction with params:",n),m};function ab(t,s){const n={key:s.key,type:"transaction",run:(c,h)=>{const p=CA(t,s.key,c,h);try{const m=ce(t),{toolkit:y}=p.transactionMeta,v=s.do(y,...c);return $A(v,m),v}catch(m){throw pA(r),t.logger.warn("💥","transaction",s.key,"caught:",m),m}},install:c=>ab(c,s),subject:new Pe},r=ce(t);r.transactions.set(n.key,n);const o=Js(n);return t.on.transactionCreation.next(o),o}function zA(t){return ab(nt.STORE,t)}function UA(t,s=Pg()){return Qf(nt.STORE,t,s)}class BA{constructor(s,n=null){g(this,"parent",null);g(this,"child",null);g(this,"valueMap",new Map);g(this,"defaults",new Map);g(this,"atoms",new Map);g(this,"selectors",new Map);g(this,"readonlySelectors",new Map);g(this,"atomsThatAreDefault",new Set);g(this,"selectorAtoms",new Tt({between:["selectorKey","atomKey"],cardinality:"n:n"}));g(this,"selectorGraph",new Tt({between:["upstreamSelectorKey","downstreamSelectorKey"],cardinality:"n:n"},{makeContentKey:(...s)=>s.sort().join(":")}));g(this,"trackers",new Map);g(this,"families",new Map);g(this,"joins",new Map);g(this,"transactions",new Map);g(this,"transactionMeta",{epoch:new Map,actionContinuities:new Tt({between:["continuity","action"],cardinality:"1:n"})});g(this,"timelines",new Map);g(this,"timelineTopics",new Tt({between:["timelineKey","topicKey"],cardinality:"1:n"}));g(this,"disposalTraces",new If(100));g(this,"molecules",new Map);g(this,"moleculeJoins",new Tt({between:["moleculeKey","joinKey"],cardinality:"n:n"},{makeContentKey:(...s)=>s.sort().join(":")}));g(this,"moleculeGraph",new Tt({between:["upstreamMoleculeKey","downstreamMoleculeKey"],cardinality:"n:n"},{makeContentKey:(...s)=>s.sort().join(":")}));g(this,"moleculeData",new Tt({between:["moleculeKey","stateFamilyKey"],cardinality:"n:n"},{makeContentKey:(...s)=>s.sort().join(":")}));g(this,"miscResources",new Map);g(this,"on",{atomCreation:new Pe,atomDisposal:new Pe,selectorCreation:new Pe,selectorDisposal:new Pe,timelineCreation:new Pe,transactionCreation:new Pe,transactionApplying:new iA(null),operationClose:new Pe,moleculeCreation:new Pe,moleculeDisposal:new Pe});g(this,"operation",{open:!1});g(this,"config",{name:"IMPLICIT_STORE",lifespan:"ephemeral"});g(this,"loggers",[new cA("warn",(s,n,r)=>!rw(r))]);g(this,"logger",{error:(...s)=>{for(const n of this.loggers)n.error(...s)},info:(...s)=>{for(const n of this.loggers)n.info(...s)},warn:(...s)=>{for(const n of this.loggers)n.warn(...s)}});var r,o;if(this.config={...n==null?void 0:n.config,...s},n!==null){this.valueMap=new Map(n==null?void 0:n.valueMap),this.operation={...n==null?void 0:n.operation},Yn(n)&&(this.transactionMeta={epoch:new Map(n==null?void 0:n.transactionMeta.epoch),actionContinuities:new Tt(n==null?void 0:n.transactionMeta.actionContinuities.toJSON())});for(const[,h]of n.families)(r=h.internalRoles)!=null&&r.includes("mutable")||(o=h.internalRoles)!=null&&o.includes("join")||h.install(this);const c=new Set;for(const[,h]of n.atoms)if(!c.has(h.key)&&(h.install(this),h.type==="mutable_atom")){const p=Zi(n,h),m=fb(h);c.add(p.key),c.add(m.key)}for(const[,h]of n.readonlySelectors)h.install(this);for(const[,h]of n.selectors)c.has(h.key)||h.install(this);for(const[,h]of n.transactions)h.install(this);for(const[,h]of n.timelines)h.install(this)}}}const nt={get STORE(){return globalThis.ATOM_IO_IMPLICIT_STORE??(globalThis.ATOM_IO_IMPLICIT_STORE=new BA({name:"IMPLICIT_STORE",lifespan:"ephemeral"})),globalThis.ATOM_IO_IMPLICIT_STORE}};function dt(t,s){let n,r=t;for(;r!==null;){switch(s.type){case"atom":case"mutable_atom":n=r.atoms.get(s.key);break;case"selector":n=r.selectors.get(s.key);break;case"readonly_selector":n=r.readonlySelectors.get(s.key);break;case"atom_family":case"mutable_atom_family":case"selector_family":case"readonly_selector_family":n=r.families.get(s.key);break;case"timeline":n=r.timelines.get(s.key);break;case"transaction":n=r.transactions.get(s.key);break}if(n)return n;r=r.child}throw new Zf(s,t)}function qA(t,s,n){const r=t.families.get(s.key);if(r===void 0)throw new Zf(s,t);const o=r(n),c=ce(t);if(o.family)if(Yn(c))switch(o.type){case"atom":case"mutable_atom":t.on.atomCreation.next(o);break;case"selector":case"readonly_selector":t.on.selectorCreation.next(o);break}else xt(c)&&c.on.transactionApplying.state===null&&c.transactionMeta.update.updates.push({type:"state_creation",token:o});return o}function KA(t,s,n){const r=Je(n),o=`${s.key}(${r})`,c=ce(t);let h;switch(s.type){case"atom_family":case"mutable_atom_family":h=c.atoms.get(o);break;case"selector_family":h=c.selectors.get(o);break;case"readonly_selector_family":h=c.readonlySelectors.get(o);break}return h&&Js(h)}function Ot(t,s,n){let r=KA(t,s,n);if(r)return r;const o=Je(n),c=t.molecules.get(o);if(!c&&t.config.lifespan==="immortal"){const h=aA(s,n);return t.logger.error("❌",h.type,h.key,`was not found in store "${t.config.name}"; returned a counterfeit token.`),h}return r=qA(t,s,n),c&&ce(t).moleculeData.set(o,s.key),r}function go(t,...s){let n;if(s.length===1)n=s[0];else{const r=s[0],o=s[1];n=Ot(t,r,o)}try{dt(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":rh(t,n);break;case"selector":case"readonly_selector":YA(t,n);break}}const Pf=(t,s)=>ce(t).atoms.has(s),jA=(t,s)=>ce(t).selectors.has(s),LA=(t,s)=>ce(t).readonlySelectors.has(s),VA=(t,s)=>Pf(t,s)||jA(t,s)||LA(t,s),mf=(t,s)=>ce(s).selectorGraph.getRelationEntries({downstreamSelectorKey:t}).filter(([r,{source:o}])=>o!==t).map(([r,{source:o}])=>o).filter(r=>VA(s,r)),lb=(t,s,n)=>{const r=[],o=mf(t,n);for(;o.length>0;){const c=o.shift();s.has(c)||(s.add(c),Pf(n,c)?r.includes(c)||r.push(c):o.push(...mf(c,n)))}return r},HA=(t,s)=>{const n=t.key,r=mf(n,s),o=new Set;return r.flatMap(c=>Pf(s,c)?c:lb(c,o,s))},GA=(t,s,n,r)=>{const o=ce(r);if(s.type==="atom"||s.type==="mutable_atom")o.selectorAtoms.set({selectorKey:t,atomKey:s.key}),r.logger.info("🔍","selector",t,`discovers root atom "${s.key}"`);else{const c=lb(s.key,n,r);r.logger.info("🔍","selector",t,`discovers root atoms: [ ${c.map(h=>`"${h}"`).join(", ")} ]`);for(const h of c)o.selectorAtoms=o.selectorAtoms.set({selectorKey:t,atomKey:h})}n.add(s.key)},ob=(t,s,n)=>({get:(...r)=>{const o=ce(n);let c;if(r.length===2){const[m,y]=r;c=Ot(n,m,y)}else[c]=r;const h=dt(n,c),p=yo(n,h);return n.logger.info("🔌","selector",t,`registers dependency ( "${c.key}" =`,p,")"),o.selectorGraph.set({upstreamSelectorKey:c.key,downstreamSelectorKey:t},{source:c.key}),GA(t,c,s,n),p},set:(...r)=>{let o,c;if(r.length===2)o=r[0],c=r[1];else{const m=r[0],y=r[1];c=r[2],o=Ot(n,m,y)}const h=ce(n),p=dt(h,o);tb(h,p,c)},find:(...r)=>Ot(n,...r),json:r=>Zi(n,r)}),eh=(t,s,n)=>{const r=ce(t),o=new Pe,c=new Set,{get:h,find:p,json:m}=ob(s.key,c,r),y=()=>{const k=s.get({get:h,find:p,json:m});return Ji(ce(t),s.key,k,o),c.clear(),k},v={...s,subject:o,install:k=>eh(k,s,n),get:y,type:"readonly_selector",...n&&{family:n}};r.readonlySelectors.set(s.key,v);const x=y();t.logger.info("✨",v.type,v.key,"=",x);const N={key:s.key,type:"readonly_selector"};return n&&(N.family=n),N},th=(t,s,n)=>{const r=ce(t),o=new Pe,c=new Set,h=ob(s.key,c,r),{find:p,get:m,json:y}=h,v={find:p,get:m,json:y},x=(Z=s.get,oe=ce(t))=>{const de=Z(v);return Ji(oe,s.key,de,o),c.clear(),de},k={...s,subject:o,install:Z=>th(Z,s,n),get:x,set:Z=>{const oe=ce(t),de=x(s.get,oe),ne=eb(Z)(de);t.logger.info("📝","selector",s.key,"set (",de,"->",ne,")"),Ji(oe,s.key,ne,o),Ff(oe,s.key),Yn(oe)&&o.next({newValue:ne,oldValue:de}),s.set(h,ne)},type:"selector",...n&&{family:n}};r.selectors.set(s.key,k);const B=x();t.logger.info("✨",k.type,k.key,"=",B);const K={key:s.key,type:"selector"};return n&&(K.family=n),K};function ub(t,s){if("set"in s){const o=th(t,s,void 0);return t.on.selectorCreation.next(o),o}const r=eh(t,s,void 0);return t.on.selectorCreation.next(r),r}function YA(t,s){const n=ce(t),{key:r}=s,o=dt(n,s);if(!o.family)t.logger.error("❌","selector",r,"Standalone selectors cannot be disposed.");else{n.molecules.get(o.family.subKey)&&n.moleculeData.delete(o.family.subKey,o.family.key);let h;switch(s.type){case"selector":n.selectors.delete(r),h={key:o.family.key,type:"selector_family"},dt(t,h).subject.next({type:"state_disposal",subType:"selector",token:s});break;case"readonly_selector":n.readonlySelectors.delete(r),h={key:o.family.key,type:"readonly_selector_family"},dt(t,h).subject.next({type:"state_disposal",subType:"selector",token:s});break}n.valueMap.delete(r),n.selectorAtoms.delete(r),n.selectorGraph.delete(r),t.logger.info("🔥",s.type,r,"deleted"),xt(n)&&n.transactionMeta.phase==="building"?n.transactionMeta.update.updates.push({type:"state_disposal",subType:"selector",token:s}):t.on.selectorDisposal.next(s)}}function nh(t,s,n){const r={key:s.key,type:"selector_family"},o=t.families.get(s.key);o&&t.logger.error("❗","selector_family",s.key,`Overwriting an existing ${ma(o)} "${o.key}" in store "${t.config.name}". You can safely ignore this warning if it is due to hot module replacement.`);const c=new Pe,p=Object.assign(m=>{const y=Je(m),v={key:s.key,subKey:y},x=`${s.key}(${y})`,N=ce(t),k=th(N,{key:x,get:s.get(m),set:s.set(m)},v);return c.next({type:"state_creation",token:k}),k},r,{internalRoles:n,subject:c,install:m=>nh(m,s),default:m=>s.get(m)({get:(...v)=>ln(t,...v),find:(...v)=>Ot(t,...v),json:v=>Zi(t,v)})});return t.families.set(s.key,p),r}function JA(t,s,n){return nh(t,{key:`${s.key}:JSON`,get:o=>({get:c})=>{const h=c(s,o);return n.toJson(h)},set:o=>({set:c},h)=>{c(s,o,n.fromJson(h))}},["mutable","json"])}const er=t=>JSON.parse(t),Je=t=>JSON.stringify(t),IA=(t,s)=>{const n=ce(t);return n.operation.open?n.operation.prev.get(s.key):n.valueMap.get(s.key)},ky=(t,s)=>{const n=ce(t);return HA(s,t).map(o=>{const c=n.atoms.get(o);if(c===void 0)throw new Error(`Atom "${o}", a dependency of selector "${s.key}", not found in store "${t.config.name}".`);return c.subject.subscribe(`${s.type}:${s.key}`,h=>{t.logger.info("📢",s.type,s.key,"root",o,"went",h.oldValue,"->",h.newValue);const p=IA(n,s),m=yo(n,s);t.logger.info("✨",s.type,s.key,"went",p,"->",m),s.subject.next({newValue:m,oldValue:p})})})};function ca(t,s,n,r){function o(x){if(t.operation.open){const N=t.on.operationClose.subscribe(`state subscription ${n}`,()=>{N(),r(x)})}else r(x)}const c=dt(t,s);t.logger.info("👀",c.type,c.key,`Adding subscription "${n}"`);const h=c.type==="selector"||c.type==="readonly_selector";let p=null,m=o;h&&(p=ky(t,c),m=x=>{p&&(p.length=0,p.push(...ky(t,c))),o(x)});const y=c.subject.subscribe(n,m);return()=>{if(t.logger.info("🙈",c.type,c.key,`Removing subscription "${n}"`),y(),p)for(const x of p)x()}}const XA=(t,s,n,r)=>{const o=dt(t,s);t.logger.info("👀","timeline",s.key,`Adding subscription "${n}"`);const c=o.subject.subscribe(n,r);return()=>{t.logger.info("🙈","timeline",s.key,`Removing subscription "${n}" from timeline`),c()}},ZA=(t,s,n,r)=>{const o=dt(t,s);t.logger.info("👀","transaction",s.key,`Adding subscription "${n}"`);const c=o.subject.subscribe(n,r);return()=>{t.logger.info("🙈","transaction",s.key,`Removing subscription "${n}"`),c()}};var Kg;Kg=Symbol.dispose;class ih{constructor(s,n){g(this,"Update");g(this,"unsubscribeFromInnerValue");g(this,"unsubscribeFromState");g(this,"mutableState");g(this,"latestUpdateState");g(this,Kg);this.mutableState=s;const r=ce(n);this.latestUpdateState=this.initializeState(s,r),this.observeCore(s,this.latestUpdateState,r),this.updateCore(s,this.latestUpdateState,r),r.trackers.set(s.key,this),this[Symbol.dispose]=()=>{this.unsubscribeFromInnerValue(),this.unsubscribeFromState(),r.trackers.delete(s.key)}}initializeState(s,n){var h;const r=`*${s.key}`;n.atoms.delete(r),n.valueMap.delete(r);const o=s.family?{key:`*${s.family.key}`,subKey:s.family.subKey}:void 0,c=bo(n,{key:r,default:null},o);if((h=n.parent)!=null&&h.valueMap.has(r)){const p=n.parent.valueMap.get(r);n.valueMap.set(r,p)}return c}observeCore(s,n,r){const o=`tracker:${r.config.name}:${xt(r)?r.transactionMeta.update.key:"main"}:${s.key}`,c=ln(r,s);this.unsubscribeFromInnerValue=c.subscribe(o,h=>{et(r,n,h)}),this.unsubscribeFromState=ca(r,s,o,h=>{h.newValue!==h.oldValue&&(this.unsubscribeFromInnerValue(),this.unsubscribeFromInnerValue=h.newValue.subscribe(o,p=>{et(r,n,p)}))})}updateCore(s,n,r){const o=`tracker:${r.config.name}:${xt(r)?r.transactionMeta.update.key:"main"}:${s.key}`;ca(r,n,o,({newValue:c,oldValue:h})=>{const p=r.timelineTopics.getRelatedKey(n.key);if(p){const y=r.timelines.get(p);if(y!=null&&y.timeTraveling){const v=XA(r,{key:p,type:"timeline"},o,x=>{v(),et(r,s,N=>(x==="redo"&&c?N.do(c):x==="undo"&&h&&N.undo(h),N))});return}}const m=r.on.operationClose.subscribe(o,()=>{m();const y=ln(r,s),v=c===null?-1:y.getUpdateNumber(c),x=v-y.cacheUpdateNumber;c&&x===1?et(r,s,N=>(N.do(c),N)):r.logger.info("❌","mutable_atom",s.key,`could not be updated. Expected update number ${y.cacheUpdateNumber+1}, but got ${v}`)})})}}function sh(t,s,n){t.logger.info("🔨","atom",s.key,`creating in store "${t.config.name}"`);const r=ce(t),o=r.atoms.get(s.key);if(o&&o.type==="mutable_atom")return t.logger.error("❌","atom",s.key,"Tried to create atom, but it already exists in the store."),Js(o);const c=new Pe,h={...s,type:"mutable_atom",install:y=>(y.logger.info("🛠️","atom",s.key,`installing in store "${y.config.name}"`),sh(y,s,n)),subject:c};n&&(h.family=n);const p=s.default();r.atoms.set(h.key,h),hb(t,s.key),Ji(r,s.key,p,c);const m=Js(h);if(s.effects){let y=0;const v=[];for(const x of s.effects){const N=x({setSelf:k=>{et(t,m,k)},onSet:k=>ca(t,m,`effect[${y}]`,k)});N&&v.push(N),++y}h.cleanup=()=>{for(const x of v)x()}}return new ih(m,t),n||nA(m,s,t),m}class QA{constructor(s,n){g(this,"trackers",new Map);g(this,"Update");g(this,"latestUpdateAtoms");g(this,"mutableAtoms");const r=Jf(n,{key:`*${s.key}`,default:null},["mutable","updates"]);this.latestUpdateAtoms=dt(n,r),this.mutableAtoms=s,this.mutableAtoms.subject.subscribe(`store=${n.config.name}::tracker-atom-family`,o=>{const{type:c,token:h}=o;if(h.family){const p=er(h.family.subKey);switch(c){case"state_creation":this.trackers.set(p,new ih(h,n));break;case"state_disposal":{const m=this.trackers.get(p);m&&(m[Symbol.dispose](),this.trackers.delete(p))}break}}})}}function cb(t,s,n){const r={key:s.key,type:"mutable_atom_family"},o=t.families.get(s.key);o&&t.logger.error("❗","mutable_atom_family",s.key,`Overwriting an existing ${ma(o)} "${o.key}" in store "${t.config.name}". You can safely ignore this warning if it is due to hot module replacement.`);const c=new Pe,p=Object.assign(m=>{const y=Je(m),v={key:s.key,subKey:y},x=`${s.key}(${y})`,N=ce(t),k={key:x,default:()=>s.default(m),toJson:s.toJson,fromJson:s.fromJson,mutable:!0};s.effects&&(k.effects=s.effects(m));const B=sh(N,k,v);return c.next({type:"state_creation",token:B}),B},r,{subject:c,install:m=>cb(m,s),toJson:s.toJson,fromJson:s.fromJson,internalRoles:n});return t.families.set(s.key,p),JA(t,p,s),new QA(p,t),r}const Ny=(t,s)=>{const n=ce(s),r=`${t.key}:JSON`;return n.families.get(r)},Zi=(t,s)=>{if(s.family){const r=ce(t),c={key:`${s.family.key}:JSON`,type:"selector_family"},h=dt(r,c),p=JSON.parse(s.family.subKey);return Ot(t,h,p)}return{type:"selector",key:`${s.key}:JSON`}},fb=t=>{const n={type:"atom",key:`*${t.key}`};return t.family&&(n.family={key:`*${t.family.key}`,subKey:t.family.subKey}),n};function FA(t){return typeof t=="object"&&t!==null&&"do"in t&&"undo"in t&&"subscribe"in t}function yf(t,s,n){const r=n.valueMap.get(s.key),o=t.valueMap.get(s.key);if(r!==o)return o;if(r===void 0)return s.default();n.logger.info("📃","atom",s.key,"copying");const c=s.toJson(r),h=s.fromJson(c);return t.valueMap.set(s.key,h),new ih(s,n),h}function Ji(t,s,n,r){const o=t.valueMap.get(s);if(o instanceof df&&o.use(n),n instanceof Promise){const c=new df(n);return t.valueMap.set(s,c),c.then(h=>{Ji(t,s,h,r),r.next({newValue:h,oldValue:c})}).catch(h=>{t.logger.error("💥","state",s,"rejected:",h)}),c}return t.valueMap.set(s,n),n}const WA=(t,s)=>{let n=s.valueMap.get(t.key);if(t.type==="mutable_atom"&&xt(s)){const{parent:r}=s;n=yf(s,t,r)}return n},PA=(t,s)=>{const n=s.valueMap.get(t);if(n instanceof df){const r=n,o=s.selectors.get(t)??s.readonlySelectors.get(t);o&&r.use(o.get());return}s.operation.open&&s.operation.prev.set(t,n),s.valueMap.delete(t),s.logger.info("🗑","state",t,"evicted")},ew=(t,s)=>ce(t).atomsThatAreDefault.has(s),hb=(t,s)=>{const n=ce(t);n.atomsThatAreDefault=new Set(n.atomsThatAreDefault).add(s)},tw=(t,s)=>{const n=ce(t);n.atomsThatAreDefault=new Set(ce(t).atomsThatAreDefault),n.atomsThatAreDefault.delete(s)};function bo(t,s,n){t.logger.info("🔨","atom",s.key,`creating in store "${t.config.name}"`);const r=ce(t),o=r.atoms.get(s.key);if(o&&o.type==="atom")return t.logger.error("❌","atom",s.key,"Tried to create atom, but it already exists in the store."),Js(o);const c=new Pe,h={...s,type:"atom",install:y=>(y.logger.info("🛠️","atom",s.key,`installing in store "${y.config.name}"`),bo(y,s,n)),subject:c};n&&(h.family=n);let p=s.default;s.default instanceof Function&&(p=s.default()),r.atoms.set(h.key,h),hb(t,s.key),Ji(r,s.key,p,c);const m=Js(h);if(s.effects){let y=0;const v=[];for(const x of s.effects){const N=x({setSelf:k=>{et(t,m,k)},onSet:k=>ca(t,m,`effect[${y}]`,k)});N&&v.push(N),++y}h.cleanup=()=>{for(const x of v)x()}}return m}function nw(t,s){if("mutable"in s){const o=sh(t,s,void 0);return t.on.atomCreation.next(o),o}const r=bo(t,s,void 0);return t.on.atomCreation.next(r),r}function rh(t,s){var h;const n=ce(t),{key:r,family:o}=s,c=dt(n,s);if(!o)t.logger.error("❌","atom",r,"Standalone atoms cannot be disposed.");else{(h=c.cleanup)==null||h.call(c);const p=t.valueMap.get(c.key),m=dt(t,{key:o.key,type:"atom_family"}),y={type:"state_disposal",subType:"atom",token:s,value:p};m.subject.next(y);const v=xt(n);if(n.atoms.delete(r),n.valueMap.delete(r),n.selectorAtoms.delete(r),n.atomsThatAreDefault.delete(r),t.timelineTopics.delete(r),s.type==="mutable_atom"){const x=fb(s);rh(t,x),t.trackers.delete(r)}if(t.logger.info("🔥","atom",r,"deleted"),v&&n.transactionMeta.phase==="building"){const x=n.transactionMeta.update.updates.at(-1);(x==null?void 0:x.type)==="molecule_disposal"&&x.values.some(([B])=>{var K;return B===((K=c.family)==null?void 0:K.key)})||n.transactionMeta.update.updates.push(y)}else t.on.atomDisposal.next(s)}}class Sn extends Set{constructor(n,r=0){super(n);g(this,"mode","record");g(this,"subject",new Pe);g(this,"cacheLimit",0);g(this,"cache",[]);g(this,"cacheIdx",-1);g(this,"cacheUpdateNumber",-1);g(this,"parent");g(this,"child",null);g(this,"transactionUpdates",null);n instanceof Sn&&(this.parent=n,this.cacheUpdateNumber=n.cacheUpdateNumber),r&&(this.cacheLimit=r,this.cache=new Array(r),this.subscribe("auto cache",o=>{this.cacheIdx++,this.cacheIdx%=this.cacheLimit,this.cache[this.cacheIdx]=o}))}toJSON(){return{members:[...this],cache:this.cache,cacheLimit:this.cacheLimit,cacheIdx:this.cacheIdx,cacheUpdateNumber:this.cacheUpdateNumber}}static fromJSON(n){const r=new Sn(n.members,n.cacheLimit);return r.cache=n.cache,r.cacheIdx=n.cacheIdx,r.cacheUpdateNumber=n.cacheUpdateNumber,r}add(n){const r=super.add(n);return this.mode==="record"&&(this.cacheUpdateNumber++,this.emit(`add:${Je(n)}`)),r}clear(){const n=this.mode==="record"?[...this]:null;super.clear(),n&&(this.cacheUpdateNumber++,this.emit(`clear:${JSON.stringify(n)}`))}delete(n){const r=super.delete(n);return this.mode==="record"&&(this.cacheUpdateNumber++,this.emit(`del:${Je(n)}`)),r}transaction(n){this.mode="transaction",this.transactionUpdates=[],this.child=new Sn(this);const r=this.child._subscribe("transaction",o=>{var c;(c=this.transactionUpdates)==null||c.push(o)});try{if(n(this.child)){for(const c of this.transactionUpdates)this.doStep(c);this.cacheUpdateNumber++,this.emit(`tx:${this.transactionUpdates.join(";")}`)}}catch(o){throw console.warn("Did not apply transaction to SetRTX; this error was thrown:",o),o}finally{r(),this.child=null,this.transactionUpdates=null,this.mode="record"}}_subscribe(n,r){return this.subject.subscribe(n,r)}subscribe(n,r){return this.subject.subscribe(n,o=>{r(`${this.cacheUpdateNumber}=${o}`)})}emit(n){this.subject.next(n)}doStep(n){const r=n.indexOf(":"),o=n.substring(0,r),c=n.substring(r+1);switch(o){case"add":this.add(JSON.parse(c));break;case"clear":this.clear();break;case"del":this.delete(JSON.parse(c));break;case"tx":for(const h of c.split(";"))this.doStep(h)}}getUpdateNumber(n){const r=n.indexOf("=");return Number(n.substring(0,r))}do(n){const r=n.indexOf("="),o=Number(n.substring(0,r)),c=o-this.cacheUpdateNumber;if(c>0){if(c===1){this.mode="playback";const p=n.substring(r+1);return this.doStep(p),this.mode="record",this.cacheUpdateNumber=o,null}return this.cacheUpdateNumber+1}if(Math.abs(c)<this.cacheLimit){const p=this.cacheIdx+c;if(this.cache[p]===n)return null;this.mode="playback";let y=!1;for(;!y;){this.cacheIdx%=this.cacheLimit;const x=this.cache[this.cacheIdx];if(this.cacheIdx--,!x)return"OUT_OF_RANGE";this.undo(x),y=this.cacheIdx===p-1}const v=n.substring(r+1);return this.doStep(v),this.mode="record",this.cacheUpdateNumber=o,null}return"OUT_OF_RANGE"}undoStep(n){const r=n.indexOf(":"),o=n.substring(0,r),c=n.substring(r+1);switch(o){case"add":this.delete(JSON.parse(c));break;case"del":this.add(JSON.parse(c));break;case"clear":{const h=JSON.parse(c);for(const p of h)this.add(p);break}case"tx":{const h=c.split(";");for(let p=h.length-1;p>=0;p--)this.undoStep(h[p])}}}undo(n){const r=n.indexOf("=");if(Number(n.substring(0,r))===this.cacheUpdateNumber){this.mode="playback";const c=n.substring(r+1);return this.undoStep(c),this.mode="record",this.cacheUpdateNumber--,null}return this.cacheUpdateNumber}}class db{constructor(s,n,r=nt.STORE){g(this,"toolkit");g(this,"options");g(this,"defaultContent");g(this,"molecules",new Map);g(this,"relations");g(this,"states");g(this,"core");g(this,"store");g(this,"realm");this.store=r,this.realm=new hA(r),this.options=s,this.defaultContent=n,this.store.miscResources.set(`join:${s.key}`,this),this.realm.allocate("root",s.key),this.toolkit={get:(...z)=>ln(r,...z),set:(...z)=>{et(r,...z)},find:(...z)=>Ot(r,...z),json:z=>Zi(r,z)};const o=s.between[0],c=s.between[1],h=cb(r,{key:`${s.key}/relatedKeys`,default:()=>new Sn,mutable:!0,fromJson:z=>Sn.fromJSON(z),toJson:z=>z.toJSON()},["join","relations"]);this.core={relatedKeysAtoms:h};const p=({get:z},G)=>z(h,G),m=({set:z},G,re)=>{this.store.molecules.has(Je(G))||this.realm.allocate(s.key,G),z(h,G,I=>I.add(re)),z(h,re,I=>I.add(G))},y=({set:z},G,re)=>{z(h,G,I=>(I.delete(re),I)),z(h,re,I=>(I.delete(G),I))},v=(z,G,re)=>{const{find:I,get:ie,set:ye}=z,_e=I(h,G),Te=ie(_e);for(const Ve of Te)re.includes(Ve)||ye(h,Ve,Ue=>(Ue.delete(G),Ue));ye(_e,Ve=>(Ve.transaction(vt=>{vt.clear();for(const Ue of re){const M=p(z,Ue),V=M.has(G);if(this.relations.cardinality==="1:n"){const F=[];for(const ve of M){if(ve===G)continue;const A=p(z,ve);A.delete(Ue),A.size===0&&F.push(ve)}!V&&M.size>0&&M.clear();for(const ve of F){const A=[Ue,ve].sort(),U=`"${A[0]}:${A[1]}"`;this.molecules.delete(U)}}V||M.add(G),vt.add(Ue)}return!0}),Ve))},x=(z,G,re)=>{const{set:I}=z;I(h,G,ie=>(ie.transaction(ye=>{for(const _e of re)ye.add(_e);return!0}),ie));for(const ie of re)I(h,ie,ye=>(ye.add(G),ye));return!0},N=(z,G,re)=>{const I=p(z,G);return re?I.has(re):I.size>0},k={getRelatedKeys:z=>p(this.toolkit,z),addRelation:(z,G)=>{this.store.moleculeJoins.set(z,s.key),this.store.moleculeJoins.set(G,s.key),m(this.toolkit,z,G)},deleteRelation:(z,G)=>{y(this.toolkit,z,G)},replaceRelationsSafely:(z,G)=>{v(this.toolkit,z,G)},replaceRelationsUnsafely:(z,G)=>{x(this.toolkit,z,G)},has:(z,G)=>N(this.toolkit,z,G)};let B,K;if(n){K=Jf(r,{key:`${s.key}/content`,default:n},["join","content"]);const z=({get:I},ie)=>I(K,ie),G=({set:I},ie,ye)=>{I(K,ie,ye)};B=Object.assign(k,{getContent:I=>z(this.toolkit,I),setContent:(I,ie)=>{G(this.toolkit,I,ie)},deleteContent:I=>{this.realm.deallocate(I)}})}else B=k;const Z=new Tt(s,{externalStore:B,isAType:s.isAType,isBType:s.isBType,makeContentKey:(...z)=>{const[G,re]=z,I=z.sort(),ie=`${I[0]}:${I[1]}`,ye=r.molecules.get(Je(G)),_e=r.molecules.get(Je(re));return ye||this.realm.allocate(s.key,G),_e||this.realm.allocate(s.key,re),this.realm.allocate(G,ie,"all"),this.realm.claim(re,ie),this.store.moleculeJoins.set(ie,s.key),ie}}),oe=()=>Ks(r,{key:`${s.key}/singleRelatedKey`,get:z=>({get:G})=>{const re=G(h,z);for(const I of re)return I;return null}},["join","keys"]),de=()=>Ks(r,{key:`${s.key}/multipleRelatedKeys`,get:z=>({get:G})=>{const re=Ny(h,r);return G(re,z).members}},["join","keys"]),ne=()=>Ks(r,{key:`${s.key}/singleRelatedEntry`,get:z=>({get:G})=>{var I;const re=G(h,z);for(const ie of re){let ye=(I=Z.isAType)!=null&&I.call(Z,z)?z:void 0,_e=ye===void 0?z:void 0;ye??(ye=ie),_e??(_e=ie);const Te=Z.makeContentKey(ye,_e),Ve=G(K,Te);return[ie,Ve]}return null}},["join","entries"]),ze=()=>Ks(r,{key:`${s.key}/multipleRelatedEntries`,get:z=>({get:G})=>{const re=Ny(h,r);return G(re,z).members.map(ie=>{var vt;let ye=(vt=Z.isAType)!=null&&vt.call(Z,z)?z:void 0,_e=ye===void 0?z:void 0;ye??(ye=ie),_e??(_e=ie);const Te=Z.makeContentKey(ye,_e),Ve=G(K,Te);return[ie,Ve]})}},["join","entries"]);switch(s.cardinality){case"1:1":{const z=oe(),G=`${o}KeyOf${Jt(c)}`,re=`${c}KeyOf${Jt(o)}`,I={[G]:z,[re]:z};let ie;if(n){const ye=ne(),_e=`${o}EntryOf${Jt(c)}`,Te=`${c}EntryOf${Jt(o)}`,Ve={[_e]:ye,[Te]:ye};ie=Object.assign(I,Ve)}else ie=I;this.relations=Z,this.states=ie;break}case"1:n":{const z=oe(),G=de(),re=`${o}KeyOf${Jt(c)}`,I=`${c}KeysOf${Jt(o)}`,ie={[re]:z,[I]:G};let ye;if(n){const _e=ne(),Te=ze(),Ve=`${o}EntryOf${Jt(c)}`,vt=`${c}EntriesOf${Jt(o)}`,Ue={[Ve]:_e,[vt]:Te};ye=Object.assign(ie,Ue)}else ye=ie;this.relations=Z,this.states=ye;break}case"n:n":{const z=de(),G=`${o}KeysOf${Jt(c)}`,re=`${c}KeysOf${Jt(o)}`,I={[G]:z,[re]:z};let ie;if(n){const ye=ze(),_e=`${o}EntriesOf${Jt(c)}`,Te=`${c}EntriesOf${Jt(o)}`,Ve={[_e]:ye,[Te]:ye};ie=Object.assign(I,Ve)}else ie=I;this.relations=Z,this.states=ie}}}transact(s,n){const r=this.toolkit;this.toolkit=s,n(this),this.toolkit=r}[Symbol.dispose](){}}function iw(t,s){let n=s.joins.get(t.key);if(n===void 0){const o=nt.STORE.joins.get(t.key);if(o===void 0)throw new Error(`Join "${t.key}" not found in store "${s.config.name}"`);n=new db(o.options,o.defaultContent,s),s.joins.set(t.key,n)}return n}function sw(t,s){return iw(t,s).core.relatedKeysAtoms}function rw(t){return t.startsWith("🔍 ")}var Xc={exports:{}},ue={};/**
23
- * @license React
24
- * react.production.js
25
- *
26
- * Copyright (c) Meta Platforms, Inc. and affiliates.
27
- *
28
- * This source code is licensed under the MIT license found in the
29
- * LICENSE file in the root directory of this source tree.
30
- */var My;function aw(){if(My)return ue;My=1;var t=Symbol.for("react.transitional.element"),s=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),c=Symbol.for("react.consumer"),h=Symbol.for("react.context"),p=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),y=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),x=Symbol.iterator;function N(A){return A===null||typeof A!="object"?null:(A=x&&A[x]||A["@@iterator"],typeof A=="function"?A:null)}var k={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},B=Object.assign,K={};function Z(A,U,Y){this.props=A,this.context=U,this.refs=K,this.updater=Y||k}Z.prototype.isReactComponent={},Z.prototype.setState=function(A,U){if(typeof A!="object"&&typeof A!="function"&&A!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,A,U,"setState")},Z.prototype.forceUpdate=function(A){this.updater.enqueueForceUpdate(this,A,"forceUpdate")};function oe(){}oe.prototype=Z.prototype;function de(A,U,Y){this.props=A,this.context=U,this.refs=K,this.updater=Y||k}var ne=de.prototype=new oe;ne.constructor=de,B(ne,Z.prototype),ne.isPureReactComponent=!0;var ze=Array.isArray,z={H:null,A:null,T:null,S:null,V:null},G=Object.prototype.hasOwnProperty;function re(A,U,Y,H,W,Se){return Y=Se.ref,{$$typeof:t,type:A,key:U,ref:Y!==void 0?Y:null,props:Se}}function I(A,U){return re(A.type,U,void 0,void 0,void 0,A.props)}function ie(A){return typeof A=="object"&&A!==null&&A.$$typeof===t}function ye(A){var U={"=":"=0",":":"=2"};return"$"+A.replace(/[=:]/g,function(Y){return U[Y]})}var _e=/\/+/g;function Te(A,U){return typeof A=="object"&&A!==null&&A.key!=null?ye(""+A.key):U.toString(36)}function Ve(){}function vt(A){switch(A.status){case"fulfilled":return A.value;case"rejected":throw A.reason;default:switch(typeof A.status=="string"?A.then(Ve,Ve):(A.status="pending",A.then(function(U){A.status==="pending"&&(A.status="fulfilled",A.value=U)},function(U){A.status==="pending"&&(A.status="rejected",A.reason=U)})),A.status){case"fulfilled":return A.value;case"rejected":throw A.reason}}throw A}function Ue(A,U,Y,H,W){var Se=typeof A;(Se==="undefined"||Se==="boolean")&&(A=null);var le=!1;if(A===null)le=!0;else switch(Se){case"bigint":case"string":case"number":le=!0;break;case"object":switch(A.$$typeof){case t:case s:le=!0;break;case v:return le=A._init,Ue(le(A._payload),U,Y,H,W)}}if(le)return W=W(A),le=H===""?"."+Te(A,0):H,ze(W)?(Y="",le!=null&&(Y=le.replace(_e,"$&/")+"/"),Ue(W,U,Y,"",function(In){return In})):W!=null&&(ie(W)&&(W=I(W,Y+(W.key==null||A&&A.key===W.key?"":(""+W.key).replace(_e,"$&/")+"/")+le)),U.push(W)),1;le=0;var Ut=H===""?".":H+":";if(ze(A))for(var je=0;je<A.length;je++)H=A[je],Se=Ut+Te(H,je),le+=Ue(H,U,Y,Se,W);else if(je=N(A),typeof je=="function")for(A=je.call(A),je=0;!(H=A.next()).done;)H=H.value,Se=Ut+Te(H,je++),le+=Ue(H,U,Y,Se,W);else if(Se==="object"){if(typeof A.then=="function")return Ue(vt(A),U,Y,H,W);throw U=String(A),Error("Objects are not valid as a React child (found: "+(U==="[object Object]"?"object with keys {"+Object.keys(A).join(", ")+"}":U)+"). If you meant to render a collection of children, use an array instead.")}return le}function M(A,U,Y){if(A==null)return A;var H=[],W=0;return Ue(A,H,"","",function(Se){return U.call(Y,Se,W++)}),H}function V(A){if(A._status===-1){var U=A._result;U=U(),U.then(function(Y){(A._status===0||A._status===-1)&&(A._status=1,A._result=Y)},function(Y){(A._status===0||A._status===-1)&&(A._status=2,A._result=Y)}),A._status===-1&&(A._status=0,A._result=U)}if(A._status===1)return A._result.default;throw A._result}var F=typeof reportError=="function"?reportError:function(A){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var U=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof A=="object"&&A!==null&&typeof A.message=="string"?String(A.message):String(A),error:A});if(!window.dispatchEvent(U))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",A);return}console.error(A)};function ve(){}return ue.Children={map:M,forEach:function(A,U,Y){M(A,function(){U.apply(this,arguments)},Y)},count:function(A){var U=0;return M(A,function(){U++}),U},toArray:function(A){return M(A,function(U){return U})||[]},only:function(A){if(!ie(A))throw Error("React.Children.only expected to receive a single React element child.");return A}},ue.Component=Z,ue.Fragment=n,ue.Profiler=o,ue.PureComponent=de,ue.StrictMode=r,ue.Suspense=m,ue.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=z,ue.__COMPILER_RUNTIME={__proto__:null,c:function(A){return z.H.useMemoCache(A)}},ue.cache=function(A){return function(){return A.apply(null,arguments)}},ue.cloneElement=function(A,U,Y){if(A==null)throw Error("The argument must be a React element, but you passed "+A+".");var H=B({},A.props),W=A.key,Se=void 0;if(U!=null)for(le in U.ref!==void 0&&(Se=void 0),U.key!==void 0&&(W=""+U.key),U)!G.call(U,le)||le==="key"||le==="__self"||le==="__source"||le==="ref"&&U.ref===void 0||(H[le]=U[le]);var le=arguments.length-2;if(le===1)H.children=Y;else if(1<le){for(var Ut=Array(le),je=0;je<le;je++)Ut[je]=arguments[je+2];H.children=Ut}return re(A.type,W,void 0,void 0,Se,H)},ue.createContext=function(A){return A={$$typeof:h,_currentValue:A,_currentValue2:A,_threadCount:0,Provider:null,Consumer:null},A.Provider=A,A.Consumer={$$typeof:c,_context:A},A},ue.createElement=function(A,U,Y){var H,W={},Se=null;if(U!=null)for(H in U.key!==void 0&&(Se=""+U.key),U)G.call(U,H)&&H!=="key"&&H!=="__self"&&H!=="__source"&&(W[H]=U[H]);var le=arguments.length-2;if(le===1)W.children=Y;else if(1<le){for(var Ut=Array(le),je=0;je<le;je++)Ut[je]=arguments[je+2];W.children=Ut}if(A&&A.defaultProps)for(H in le=A.defaultProps,le)W[H]===void 0&&(W[H]=le[H]);return re(A,Se,void 0,void 0,null,W)},ue.createRef=function(){return{current:null}},ue.forwardRef=function(A){return{$$typeof:p,render:A}},ue.isValidElement=ie,ue.lazy=function(A){return{$$typeof:v,_payload:{_status:-1,_result:A},_init:V}},ue.memo=function(A,U){return{$$typeof:y,type:A,compare:U===void 0?null:U}},ue.startTransition=function(A){var U=z.T,Y={};z.T=Y;try{var H=A(),W=z.S;W!==null&&W(Y,H),typeof H=="object"&&H!==null&&typeof H.then=="function"&&H.then(ve,F)}catch(Se){F(Se)}finally{z.T=U}},ue.unstable_useCacheRefresh=function(){return z.H.useCacheRefresh()},ue.use=function(A){return z.H.use(A)},ue.useActionState=function(A,U,Y){return z.H.useActionState(A,U,Y)},ue.useCallback=function(A,U){return z.H.useCallback(A,U)},ue.useContext=function(A){return z.H.useContext(A)},ue.useDebugValue=function(){},ue.useDeferredValue=function(A,U){return z.H.useDeferredValue(A,U)},ue.useEffect=function(A,U,Y){var H=z.H;if(typeof Y=="function")throw Error("useEffect CRUD overload is not enabled in this build of React.");return H.useEffect(A,U)},ue.useId=function(){return z.H.useId()},ue.useImperativeHandle=function(A,U,Y){return z.H.useImperativeHandle(A,U,Y)},ue.useInsertionEffect=function(A,U){return z.H.useInsertionEffect(A,U)},ue.useLayoutEffect=function(A,U){return z.H.useLayoutEffect(A,U)},ue.useMemo=function(A,U){return z.H.useMemo(A,U)},ue.useOptimistic=function(A,U){return z.H.useOptimistic(A,U)},ue.useReducer=function(A,U,Y){return z.H.useReducer(A,U,Y)},ue.useRef=function(A){return z.H.useRef(A)},ue.useState=function(A){return z.H.useState(A)},ue.useSyncExternalStore=function(A,U,Y){return z.H.useSyncExternalStore(A,U,Y)},ue.useTransition=function(){return z.H.useTransition()},ue.version="19.1.0",ue}var $y;function ah(){return $y||($y=1,Xc.exports=aw()),Xc.exports}var bt=ah();const lh=bt.createContext(nt.STORE);function pb(t,...s){let n;if(s.length===2){const r=s[0],o=s[1];n=Ot(t,r,o)}else n=s[0];return n}function Hi(...t){const s=bt.useContext(lh),n=pb(s,...t),r=bt.useRef(null);return r.current??(r.current=o=>{et(s,n,o)}),r.current}function It(...t){const s=bt.useContext(lh),n=pb(s,...t),r=bt.useId();return bt.useSyncExternalStore(o=>ca(s,n,`use-o:${r}`,o),()=>ln(s,n),()=>ln(s,n))}const lw=(t,s,n,r,o)=>c=>{function h(m,y){if(t.logger.info("🧑‍⚖️","continuity",s,"reconciling updates"),et(t,Ql,x=>(x.shift(),x)),m.id===y.id){const x=JSON.stringify(m.updates),N=JSON.stringify(y.updates);if(x===N){t.logger.info("✅","continuity",s,`results for ${m.id} match between client and server`),n.emit(`ack:${s}`,y.epoch);return}}else t.logger.info("❌","continuity",s,`thought update #${y.epoch} was ${m.key}:${m.id}, but it was actually ${y.key}:${y.id}`);t.logger.info("🧑‍⚖️","continuity",s,"updates do not match",m,y);const v=r.toReversed();for(const x of v)js("oldValue",x,t);t.logger.info("⏪","continuity",s,"undid optimistic updates:",v),js("oldValue",m,t),t.logger.info("⏪","continuity",s,"undid zeroth optimistic update",m),js("newValue",y,t),t.logger.info("⏩","continuity",s,"applied confirmed update",y),n.emit(`ack:${s}`,y.epoch);for(const x of r){const N={type:"transaction",key:x.key},{id:k,params:B}=x;Qf(t,N,k)(...B)}t.logger.info("⏩","continuity",s,"reapplied subsequent optimistic updates:",r)}t.logger.info("🧑‍⚖️","continuity",s,"integrating confirmed update",{confirmedUpdate:c,confirmedUpdates:o,optimisticUpdates:r});const p=r[0];if(p)if(t.logger.info("🧑‍⚖️","continuity",s,"has optimistic updates to reconcile"),c.epoch===p.epoch){t.logger.info("🧑‍⚖️","continuity",s,`epoch of confirmed update #${c.epoch} matches zeroth optimistic update`),h(p,c);for(const m of o){const y=r[0];if(m.epoch===(y==null?void 0:y.epoch))h(y,m);else break}}else t.logger.info("🧑‍⚖️","continuity",s,`epoch of confirmed update #${c.epoch} does not match zeroth optimistic update #${p.epoch}`),o.some(y=>y.epoch===c.epoch)||(t.logger.info("👈","continuity",s,"pushing confirmed update to queue",c),et(t,gf,y=>(y.push(c),y.sort((v,x)=>v.epoch-x.epoch),y)));else{t.logger.info("🧑‍⚖️","continuity",s,"has no optimistic updates to deal with");const m=Yn(t);let y;m&&(y=sb(t,s)),y===c.epoch-1?(t.logger.info("✅","continuity",s,`integrating update #${c.epoch} (${c.key} ${c.id})`),js("newValue",c,t),n.emit(`ack:${s}`,c.epoch),Wf(t,s,c.epoch)):m&&y!==void 0&&(t.logger.info("🧑‍⚖️","continuity",s,`received update #${c.epoch} but still waiting for update #${y+1}`,{clientEpoch:y,serverEpoch:c.epoch}),o.some(x=>x.epoch===c.epoch)?t.logger.info("👍","continuity",s,`confirmed update #${c.epoch} is already enqueued`):(t.logger.info("👈","continuity",s,`pushing confirmed update #${c.epoch} to queue`),et(t,gf,x=>(x.push(c),x.sort((N,k)=>N.epoch-k.epoch),x))))}};function ow(t){return s=>{for(const n of s)rh(t,n)}}function uw(t){return s=>{let n=0,r,o;for(const c of s)n%2===0?r=c:(o=c,et(t,r,o)),n++}}const cw=(t,{stringify:s,parse:n},r)=>({setSelf:o,onSet:c})=>{const h=t.getItem(r);h!=null&&o(n(h)),c(({newValue:p})=>{if(p==null){t.removeItem(r);return}t.setItem(r,s(p))})},mb=Xt({key:"mySocketId__INTERNAL",default:void 0});Xi({key:"mySocketId",get:({get:t})=>t(mb)});Xt({key:"myName",default:null,effects:typeof window>"u"?[]:[cw(window.localStorage,JSON,"myUsername")]});const Ql=Xt({key:"updateQueue",default:[]}),gf=Xt({key:"serverConfirmedUpdateQueue",default:[]});function fw(t,s,n){const r=n.key,o=ln(t,Ql),c=ln(t,gf),h=(x,N)=>{s.off(`continuity-init:${r}`,h);let k=0,B,K;for(const Z of N)k%2===0?B=Z:(K=Z,"type"in B&&B.type==="mutable_atom"&&(B=Zi(t,B)),et(t,B,K)),k++;Wf(t,r,x)};s.off(`continuity-init:${r}`),s.on(`continuity-init:${r}`,h);const p=lw(t,r,s,o,c);s.off(`tx-new:${r}`),s.on(`tx-new:${r}`,p);const m=n.actions.map(x=>(rb(t,r,x.key),ZA(t,x,`tx-run:${r}`,k=>{t.logger.info("🤞","continuity",r,"enqueuing optimistic update");const B=o.findIndex(K=>K.id===k.id);B===-1?(t.logger.info("🤞","continuity",r,"enqueuing new optimistic update"),et(t,Ql,K=>(K.push(k),K.sort((Z,oe)=>Z.epoch-oe.epoch),K))):(t.logger.info("🤞","continuity",r,`replacing existing optimistic update at index ${B}`),et(t,Ql,K=>(K[B]=k,K))),s.emit(`tx-run:${r}`,{id:k.id,key:x.key,params:k.params})}))),y=uw(t),v=ow(t);return s.on(`reveal:${r}`,y),s.on(`conceal:${r}`,v),s.emit(`get:${r}`),()=>{s.off(`continuity-init:${r}`),s.off(`tx-new:${r}`);for(const x of m)x()}}const yb=bt.createContext({socket:null,services:null}),hw=({children:t,socket:s})=>{const n=bt.useRef(new Map).current,r=Hi(mb);return bt.useEffect(()=>{r(s==null?void 0:s.id),s==null||s.on("connect",()=>{r(s.id)}),s==null||s.on("disconnect",()=>{r(void 0)})},[s,r]),j.jsx(yb.Provider,{value:{socket:s,services:n},children:t})},{NODE_ENV:dw}=globalThis.env??{},pw=dw==="development";function Hl(){}function mw(t,s){if(pw){const n=bt.useRef(Hl);bt.useEffect(()=>{let r=n.current;if(r===Hl)r=t()??Hl,n.current=r;else return()=>{r(),n.current=Hl}},s)}else bt.useEffect(t,s)}function yw(t){mw(t,[])}function gw(t,s){const{socket:n,services:r}=bt.useContext(yb);yw(()=>{let o=r==null?void 0:r.get(t);return o?o[0]++:(o=[1,n?s(n):void 0],r==null||r.set(t,o)),()=>{var c;o&&(o[0]--,o[0]===0&&((c=o[1])==null||c.call(o),r==null||r.delete(t)))}})}function bw(t){const s=bt.useContext(lh);gw(`tx-sync:${t.key}`,n=>fw(s,n,t))}var Zc={exports:{}},ia={},Qc={exports:{}},Fc={};/**
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 Dy;function vw(){return Dy||(Dy=1,function(t){function s(M,V){var F=M.length;M.push(V);e:for(;0<F;){var ve=F-1>>>1,A=M[ve];if(0<o(A,V))M[ve]=V,M[F]=A,F=ve;else break e}}function n(M){return M.length===0?null:M[0]}function r(M){if(M.length===0)return null;var V=M[0],F=M.pop();if(F!==V){M[0]=F;e:for(var ve=0,A=M.length,U=A>>>1;ve<U;){var Y=2*(ve+1)-1,H=M[Y],W=Y+1,Se=M[W];if(0>o(H,F))W<A&&0>o(Se,H)?(M[ve]=Se,M[W]=F,ve=W):(M[ve]=H,M[Y]=F,ve=Y);else if(W<A&&0>o(Se,F))M[ve]=Se,M[W]=F,ve=W;else break e}}return V}function o(M,V){var F=M.sortIndex-V.sortIndex;return F!==0?F:M.id-V.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;t.unstable_now=function(){return c.now()}}else{var h=Date,p=h.now();t.unstable_now=function(){return h.now()-p}}var m=[],y=[],v=1,x=null,N=3,k=!1,B=!1,K=!1,Z=!1,oe=typeof setTimeout=="function"?setTimeout:null,de=typeof clearTimeout=="function"?clearTimeout:null,ne=typeof setImmediate<"u"?setImmediate:null;function ze(M){for(var V=n(y);V!==null;){if(V.callback===null)r(y);else if(V.startTime<=M)r(y),V.sortIndex=V.expirationTime,s(m,V);else break;V=n(y)}}function z(M){if(K=!1,ze(M),!B)if(n(m)!==null)B=!0,G||(G=!0,Te());else{var V=n(y);V!==null&&Ue(z,V.startTime-M)}}var G=!1,re=-1,I=5,ie=-1;function ye(){return Z?!0:!(t.unstable_now()-ie<I)}function _e(){if(Z=!1,G){var M=t.unstable_now();ie=M;var V=!0;try{e:{B=!1,K&&(K=!1,de(re),re=-1),k=!0;var F=N;try{t:{for(ze(M),x=n(m);x!==null&&!(x.expirationTime>M&&ye());){var ve=x.callback;if(typeof ve=="function"){x.callback=null,N=x.priorityLevel;var A=ve(x.expirationTime<=M);if(M=t.unstable_now(),typeof A=="function"){x.callback=A,ze(M),V=!0;break t}x===n(m)&&r(m),ze(M)}else r(m);x=n(m)}if(x!==null)V=!0;else{var U=n(y);U!==null&&Ue(z,U.startTime-M),V=!1}}break e}finally{x=null,N=F,k=!1}V=void 0}}finally{V?Te():G=!1}}}var Te;if(typeof ne=="function")Te=function(){ne(_e)};else if(typeof MessageChannel<"u"){var Ve=new MessageChannel,vt=Ve.port2;Ve.port1.onmessage=_e,Te=function(){vt.postMessage(null)}}else Te=function(){oe(_e,0)};function Ue(M,V){re=oe(function(){M(t.unstable_now())},V)}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(M){M.callback=null},t.unstable_forceFrameRate=function(M){0>M||125<M?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):I=0<M?Math.floor(1e3/M):5},t.unstable_getCurrentPriorityLevel=function(){return N},t.unstable_next=function(M){switch(N){case 1:case 2:case 3:var V=3;break;default:V=N}var F=N;N=V;try{return M()}finally{N=F}},t.unstable_requestPaint=function(){Z=!0},t.unstable_runWithPriority=function(M,V){switch(M){case 1:case 2:case 3:case 4:case 5:break;default:M=3}var F=N;N=M;try{return V()}finally{N=F}},t.unstable_scheduleCallback=function(M,V,F){var ve=t.unstable_now();switch(typeof F=="object"&&F!==null?(F=F.delay,F=typeof F=="number"&&0<F?ve+F:ve):F=ve,M){case 1:var A=-1;break;case 2:A=250;break;case 5:A=1073741823;break;case 4:A=1e4;break;default:A=5e3}return A=F+A,M={id:v++,callback:V,priorityLevel:M,startTime:F,expirationTime:A,sortIndex:-1},F>ve?(M.sortIndex=F,s(y,M),n(m)===null&&M===n(y)&&(K?(de(re),re=-1):K=!0,Ue(z,F-ve))):(M.sortIndex=A,s(m,M),B||k||(B=!0,G||(G=!0,Te()))),M},t.unstable_shouldYield=ye,t.unstable_wrapCallback=function(M){var V=N;return function(){var F=N;N=V;try{return M.apply(this,arguments)}finally{N=F}}}}(Fc)),Fc}var Cy;function Sw(){return Cy||(Cy=1,Qc.exports=vw()),Qc.exports}var Wc={exports:{}},wt={};/**
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 zy;function Aw(){if(zy)return wt;zy=1;var t=ah();function s(m){var y="https://react.dev/errors/"+m;if(1<arguments.length){y+="?args[]="+encodeURIComponent(arguments[1]);for(var v=2;v<arguments.length;v++)y+="&args[]="+encodeURIComponent(arguments[v])}return"Minified React error #"+m+"; visit "+y+" 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(s(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 c(m,y,v){var x=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:x==null?null:""+x,children:m,containerInfo:y,implementation:v}}var h=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function p(m,y){if(m==="font")return"";if(typeof y=="string")return y==="use-credentials"?y:""}return wt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,wt.createPortal=function(m,y){var v=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!y||y.nodeType!==1&&y.nodeType!==9&&y.nodeType!==11)throw Error(s(299));return c(m,y,null,v)},wt.flushSync=function(m){var y=h.T,v=r.p;try{if(h.T=null,r.p=2,m)return m()}finally{h.T=y,r.p=v,r.d.f()}},wt.preconnect=function(m,y){typeof m=="string"&&(y?(y=y.crossOrigin,y=typeof y=="string"?y==="use-credentials"?y:"":void 0):y=null,r.d.C(m,y))},wt.prefetchDNS=function(m){typeof m=="string"&&r.d.D(m)},wt.preinit=function(m,y){if(typeof m=="string"&&y&&typeof y.as=="string"){var v=y.as,x=p(v,y.crossOrigin),N=typeof y.integrity=="string"?y.integrity:void 0,k=typeof y.fetchPriority=="string"?y.fetchPriority:void 0;v==="style"?r.d.S(m,typeof y.precedence=="string"?y.precedence:void 0,{crossOrigin:x,integrity:N,fetchPriority:k}):v==="script"&&r.d.X(m,{crossOrigin:x,integrity:N,fetchPriority:k,nonce:typeof y.nonce=="string"?y.nonce:void 0})}},wt.preinitModule=function(m,y){if(typeof m=="string")if(typeof y=="object"&&y!==null){if(y.as==null||y.as==="script"){var v=p(y.as,y.crossOrigin);r.d.M(m,{crossOrigin:v,integrity:typeof y.integrity=="string"?y.integrity:void 0,nonce:typeof y.nonce=="string"?y.nonce:void 0})}}else y==null&&r.d.M(m)},wt.preload=function(m,y){if(typeof m=="string"&&typeof y=="object"&&y!==null&&typeof y.as=="string"){var v=y.as,x=p(v,y.crossOrigin);r.d.L(m,v,{crossOrigin:x,integrity:typeof y.integrity=="string"?y.integrity:void 0,nonce:typeof y.nonce=="string"?y.nonce:void 0,type:typeof y.type=="string"?y.type:void 0,fetchPriority:typeof y.fetchPriority=="string"?y.fetchPriority:void 0,referrerPolicy:typeof y.referrerPolicy=="string"?y.referrerPolicy:void 0,imageSrcSet:typeof y.imageSrcSet=="string"?y.imageSrcSet:void 0,imageSizes:typeof y.imageSizes=="string"?y.imageSizes:void 0,media:typeof y.media=="string"?y.media:void 0})}},wt.preloadModule=function(m,y){if(typeof m=="string")if(y){var v=p(y.as,y.crossOrigin);r.d.m(m,{as:typeof y.as=="string"&&y.as!=="script"?y.as:void 0,crossOrigin:v,integrity:typeof y.integrity=="string"?y.integrity:void 0})}else r.d.m(m)},wt.requestFormReset=function(m){r.d.r(m)},wt.unstable_batchedUpdates=function(m,y){return m(y)},wt.useFormState=function(m,y,v){return h.H.useFormState(m,y,v)},wt.useFormStatus=function(){return h.H.useHostTransitionStatus()},wt.version="19.1.0",wt}var Uy;function ww(){if(Uy)return Wc.exports;Uy=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(s){console.error(s)}}return t(),Wc.exports=Aw(),Wc.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 By;function xw(){if(By)return ia;By=1;var t=Sw(),s=ah(),n=ww();function r(e){var i="https://react.dev/errors/"+e;if(1<arguments.length){i+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)i+="&args[]="+encodeURIComponent(arguments[a])}return"Minified React error #"+e+"; visit "+i+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function c(e){var i=e,a=e;if(e.alternate)for(;i.return;)i=i.return;else{e=i;do i=e,(i.flags&4098)!==0&&(a=i.return),e=i.return;while(e)}return i.tag===3?a:null}function h(e){if(e.tag===13){var i=e.memoizedState;if(i===null&&(e=e.alternate,e!==null&&(i=e.memoizedState)),i!==null)return i.dehydrated}return null}function p(e){if(c(e)!==e)throw Error(r(188))}function m(e){var i=e.alternate;if(!i){if(i=c(e),i===null)throw Error(r(188));return i!==e?null:e}for(var a=e,l=i;;){var u=a.return;if(u===null)break;var f=u.alternate;if(f===null){if(l=u.return,l!==null){a=l;continue}break}if(u.child===f.child){for(f=u.child;f;){if(f===a)return p(u),e;if(f===l)return p(u),i;f=f.sibling}throw Error(r(188))}if(a.return!==l.return)a=u,l=f;else{for(var d=!1,b=u.child;b;){if(b===a){d=!0,a=u,l=f;break}if(b===l){d=!0,l=u,a=f;break}b=b.sibling}if(!d){for(b=f.child;b;){if(b===a){d=!0,a=f,l=u;break}if(b===l){d=!0,l=f,a=u;break}b=b.sibling}if(!d)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?e:i}function y(e){var i=e.tag;if(i===5||i===26||i===27||i===6)return e;for(e=e.child;e!==null;){if(i=y(e),i!==null)return i;e=e.sibling}return null}var v=Object.assign,x=Symbol.for("react.element"),N=Symbol.for("react.transitional.element"),k=Symbol.for("react.portal"),B=Symbol.for("react.fragment"),K=Symbol.for("react.strict_mode"),Z=Symbol.for("react.profiler"),oe=Symbol.for("react.provider"),de=Symbol.for("react.consumer"),ne=Symbol.for("react.context"),ze=Symbol.for("react.forward_ref"),z=Symbol.for("react.suspense"),G=Symbol.for("react.suspense_list"),re=Symbol.for("react.memo"),I=Symbol.for("react.lazy"),ie=Symbol.for("react.activity"),ye=Symbol.for("react.memo_cache_sentinel"),_e=Symbol.iterator;function Te(e){return e===null||typeof e!="object"?null:(e=_e&&e[_e]||e["@@iterator"],typeof e=="function"?e:null)}var Ve=Symbol.for("react.client.reference");function vt(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===Ve?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case B:return"Fragment";case Z:return"Profiler";case K:return"StrictMode";case z:return"Suspense";case G:return"SuspenseList";case ie:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case k:return"Portal";case ne:return(e.displayName||"Context")+".Provider";case de:return(e._context.displayName||"Context")+".Consumer";case ze:var i=e.render;return e=e.displayName,e||(e=i.displayName||i.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case re:return i=e.displayName||null,i!==null?i:vt(e.type)||"Memo";case I:i=e._payload,e=e._init;try{return vt(e(i))}catch{}}return null}var Ue=Array.isArray,M=s.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,V=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,F={pending:!1,data:null,method:null,action:null},ve=[],A=-1;function U(e){return{current:e}}function Y(e){0>A||(e.current=ve[A],ve[A]=null,A--)}function H(e,i){A++,ve[A]=e.current,e.current=i}var W=U(null),Se=U(null),le=U(null),Ut=U(null);function je(e,i){switch(H(le,i),H(Se,e),H(W,null),i.nodeType){case 9:case 11:e=(e=i.documentElement)&&(e=e.namespaceURI)?ey(e):0;break;default:if(e=i.tagName,i=i.namespaceURI)i=ey(i),e=ty(i,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}Y(W),H(W,e)}function In(){Y(W),Y(Se),Y(le)}function Mo(e){e.memoizedState!==null&&H(Ut,e);var i=W.current,a=ty(i,e.type);i!==a&&(H(Se,e),H(W,a))}function Ra(e){Se.current===e&&(Y(W),Y(Se)),Ut.current===e&&(Y(Ut),Fr._currentValue=F)}var $o=Object.prototype.hasOwnProperty,Do=t.unstable_scheduleCallback,Co=t.unstable_cancelCallback,k0=t.unstable_shouldYield,N0=t.unstable_requestPaint,dn=t.unstable_now,M0=t.unstable_getCurrentPriorityLevel,Ch=t.unstable_ImmediatePriority,zh=t.unstable_UserBlockingPriority,ka=t.unstable_NormalPriority,$0=t.unstable_LowPriority,Uh=t.unstable_IdlePriority,D0=t.log,C0=t.unstable_setDisableYieldValue,rr=null,Bt=null;function Xn(e){if(typeof D0=="function"&&C0(e),Bt&&typeof Bt.setStrictMode=="function")try{Bt.setStrictMode(rr,e)}catch{}}var qt=Math.clz32?Math.clz32:B0,z0=Math.log,U0=Math.LN2;function B0(e){return e>>>=0,e===0?32:31-(z0(e)/U0|0)|0}var Na=256,Ma=4194304;function xi(e){var i=e&42;if(i!==0)return i;switch(e&-e){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 e&4194048;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function $a(e,i,a){var l=e.pendingLanes;if(l===0)return 0;var u=0,f=e.suspendedLanes,d=e.pingedLanes;e=e.warmLanes;var b=l&134217727;return b!==0?(l=b&~f,l!==0?u=xi(l):(d&=b,d!==0?u=xi(d):a||(a=b&~e,a!==0&&(u=xi(a))))):(b=l&~f,b!==0?u=xi(b):d!==0?u=xi(d):a||(a=l&~e,a!==0&&(u=xi(a)))),u===0?0:i!==0&&i!==u&&(i&f)===0&&(f=u&-u,a=i&-i,f>=a||f===32&&(a&4194048)!==0)?i:u}function ar(e,i){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&i)===0}function q0(e,i){switch(e){case 1:case 2:case 4:case 8:case 64:return i+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 i+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 Bh(){var e=Na;return Na<<=1,(Na&4194048)===0&&(Na=256),e}function qh(){var e=Ma;return Ma<<=1,(Ma&62914560)===0&&(Ma=4194304),e}function zo(e){for(var i=[],a=0;31>a;a++)i.push(e);return i}function lr(e,i){e.pendingLanes|=i,i!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function K0(e,i,a,l,u,f){var d=e.pendingLanes;e.pendingLanes=a,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=a,e.entangledLanes&=a,e.errorRecoveryDisabledLanes&=a,e.shellSuspendCounter=0;var b=e.entanglements,S=e.expirationTimes,_=e.hiddenUpdates;for(a=d&~a;0<a;){var $=31-qt(a),C=1<<$;b[$]=0,S[$]=-1;var T=_[$];if(T!==null)for(_[$]=null,$=0;$<T.length;$++){var R=T[$];R!==null&&(R.lane&=-536870913)}a&=~C}l!==0&&Kh(e,l,0),f!==0&&u===0&&e.tag!==0&&(e.suspendedLanes|=f&~(d&~i))}function Kh(e,i,a){e.pendingLanes|=i,e.suspendedLanes&=~i;var l=31-qt(i);e.entangledLanes|=i,e.entanglements[l]=e.entanglements[l]|1073741824|a&4194090}function jh(e,i){var a=e.entangledLanes|=i;for(e=e.entanglements;a;){var l=31-qt(a),u=1<<l;u&i|e[l]&i&&(e[l]|=i),a&=~u}}function Uo(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=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:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function Bo(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Lh(){var e=V.p;return e!==0?e:(e=window.event,e===void 0?32:Sy(e.type))}function j0(e,i){var a=V.p;try{return V.p=e,i()}finally{V.p=a}}var Zn=Math.random().toString(36).slice(2),St="__reactFiber$"+Zn,Nt="__reactProps$"+Zn,Wi="__reactContainer$"+Zn,qo="__reactEvents$"+Zn,L0="__reactListeners$"+Zn,V0="__reactHandles$"+Zn,Vh="__reactResources$"+Zn,or="__reactMarker$"+Zn;function Ko(e){delete e[St],delete e[Nt],delete e[qo],delete e[L0],delete e[V0]}function Pi(e){var i=e[St];if(i)return i;for(var a=e.parentNode;a;){if(i=a[Wi]||a[St]){if(a=i.alternate,i.child!==null||a!==null&&a.child!==null)for(e=ry(e);e!==null;){if(a=e[St])return a;e=ry(e)}return i}e=a,a=e.parentNode}return null}function es(e){if(e=e[St]||e[Wi]){var i=e.tag;if(i===5||i===6||i===13||i===26||i===27||i===3)return e}return null}function ur(e){var i=e.tag;if(i===5||i===26||i===27||i===6)return e.stateNode;throw Error(r(33))}function ts(e){var i=e[Vh];return i||(i=e[Vh]={hoistableStyles:new Map,hoistableScripts:new Map}),i}function lt(e){e[or]=!0}var Hh=new Set,Gh={};function Oi(e,i){ns(e,i),ns(e+"Capture",i)}function ns(e,i){for(Gh[e]=i,e=0;e<i.length;e++)Hh.add(i[e])}var H0=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]*$"),Yh={},Jh={};function G0(e){return $o.call(Jh,e)?!0:$o.call(Yh,e)?!1:H0.test(e)?Jh[e]=!0:(Yh[e]=!0,!1)}function Da(e,i,a){if(G0(i))if(a===null)e.removeAttribute(i);else{switch(typeof a){case"undefined":case"function":case"symbol":e.removeAttribute(i);return;case"boolean":var l=i.toLowerCase().slice(0,5);if(l!=="data-"&&l!=="aria-"){e.removeAttribute(i);return}}e.setAttribute(i,""+a)}}function Ca(e,i,a){if(a===null)e.removeAttribute(i);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(i);return}e.setAttribute(i,""+a)}}function On(e,i,a,l){if(l===null)e.removeAttribute(a);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(a);return}e.setAttributeNS(i,a,""+l)}}var jo,Ih;function is(e){if(jo===void 0)try{throw Error()}catch(a){var i=a.stack.trim().match(/\n( *(at )?)/);jo=i&&i[1]||"",Ih=-1<a.stack.indexOf(`
55
- at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
56
- `+jo+e+Ih}var Lo=!1;function Vo(e,i){if(!e||Lo)return"";Lo=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var l={DetermineComponentFrameRoot:function(){try{if(i){var C=function(){throw Error()};if(Object.defineProperty(C.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(C,[])}catch(R){var T=R}Reflect.construct(e,[],C)}else{try{C.call()}catch(R){T=R}e.call(C.prototype)}}else{try{throw Error()}catch(R){T=R}(C=e())&&typeof C.catch=="function"&&C.catch(function(){})}}catch(R){if(R&&T&&typeof R.stack=="string")return[R.stack,T.stack]}return[null,null]}};l.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var u=Object.getOwnPropertyDescriptor(l.DetermineComponentFrameRoot,"name");u&&u.configurable&&Object.defineProperty(l.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var f=l.DetermineComponentFrameRoot(),d=f[0],b=f[1];if(d&&b){var S=d.split(`
57
- `),_=b.split(`
58
- `);for(u=l=0;l<S.length&&!S[l].includes("DetermineComponentFrameRoot");)l++;for(;u<_.length&&!_[u].includes("DetermineComponentFrameRoot");)u++;if(l===S.length||u===_.length)for(l=S.length-1,u=_.length-1;1<=l&&0<=u&&S[l]!==_[u];)u--;for(;1<=l&&0<=u;l--,u--)if(S[l]!==_[u]){if(l!==1||u!==1)do if(l--,u--,0>u||S[l]!==_[u]){var $=`
59
- `+S[l].replace(" at new "," at ");return e.displayName&&$.includes("<anonymous>")&&($=$.replace("<anonymous>",e.displayName)),$}while(1<=l&&0<=u);break}}}finally{Lo=!1,Error.prepareStackTrace=a}return(a=e?e.displayName||e.name:"")?is(a):""}function Y0(e){switch(e.tag){case 26:case 27:case 5:return is(e.type);case 16:return is("Lazy");case 13:return is("Suspense");case 19:return is("SuspenseList");case 0:case 15:return Vo(e.type,!1);case 11:return Vo(e.type.render,!1);case 1:return Vo(e.type,!0);case 31:return is("Activity");default:return""}}function Xh(e){try{var i="";do i+=Y0(e),e=e.return;while(e);return i}catch(a){return`
60
- Error generating stack: `+a.message+`
61
- `+a.stack}}function Zt(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Zh(e){var i=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(i==="checkbox"||i==="radio")}function J0(e){var i=Zh(e)?"checked":"value",a=Object.getOwnPropertyDescriptor(e.constructor.prototype,i),l=""+e[i];if(!e.hasOwnProperty(i)&&typeof a<"u"&&typeof a.get=="function"&&typeof a.set=="function"){var u=a.get,f=a.set;return Object.defineProperty(e,i,{configurable:!0,get:function(){return u.call(this)},set:function(d){l=""+d,f.call(this,d)}}),Object.defineProperty(e,i,{enumerable:a.enumerable}),{getValue:function(){return l},setValue:function(d){l=""+d},stopTracking:function(){e._valueTracker=null,delete e[i]}}}}function za(e){e._valueTracker||(e._valueTracker=J0(e))}function Qh(e){if(!e)return!1;var i=e._valueTracker;if(!i)return!0;var a=i.getValue(),l="";return e&&(l=Zh(e)?e.checked?"true":"false":e.value),e=l,e!==a?(i.setValue(e),!0):!1}function Ua(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var I0=/[\n"\\]/g;function Qt(e){return e.replace(I0,function(i){return"\\"+i.charCodeAt(0).toString(16)+" "})}function Ho(e,i,a,l,u,f,d,b){e.name="",d!=null&&typeof d!="function"&&typeof d!="symbol"&&typeof d!="boolean"?e.type=d:e.removeAttribute("type"),i!=null?d==="number"?(i===0&&e.value===""||e.value!=i)&&(e.value=""+Zt(i)):e.value!==""+Zt(i)&&(e.value=""+Zt(i)):d!=="submit"&&d!=="reset"||e.removeAttribute("value"),i!=null?Go(e,d,Zt(i)):a!=null?Go(e,d,Zt(a)):l!=null&&e.removeAttribute("value"),u==null&&f!=null&&(e.defaultChecked=!!f),u!=null&&(e.checked=u&&typeof u!="function"&&typeof u!="symbol"),b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"?e.name=""+Zt(b):e.removeAttribute("name")}function Fh(e,i,a,l,u,f,d,b){if(f!=null&&typeof f!="function"&&typeof f!="symbol"&&typeof f!="boolean"&&(e.type=f),i!=null||a!=null){if(!(f!=="submit"&&f!=="reset"||i!=null))return;a=a!=null?""+Zt(a):"",i=i!=null?""+Zt(i):a,b||i===e.value||(e.value=i),e.defaultValue=i}l=l??u,l=typeof l!="function"&&typeof l!="symbol"&&!!l,e.checked=b?e.checked:!!l,e.defaultChecked=!!l,d!=null&&typeof d!="function"&&typeof d!="symbol"&&typeof d!="boolean"&&(e.name=d)}function Go(e,i,a){i==="number"&&Ua(e.ownerDocument)===e||e.defaultValue===""+a||(e.defaultValue=""+a)}function ss(e,i,a,l){if(e=e.options,i){i={};for(var u=0;u<a.length;u++)i["$"+a[u]]=!0;for(a=0;a<e.length;a++)u=i.hasOwnProperty("$"+e[a].value),e[a].selected!==u&&(e[a].selected=u),u&&l&&(e[a].defaultSelected=!0)}else{for(a=""+Zt(a),i=null,u=0;u<e.length;u++){if(e[u].value===a){e[u].selected=!0,l&&(e[u].defaultSelected=!0);return}i!==null||e[u].disabled||(i=e[u])}i!==null&&(i.selected=!0)}}function Wh(e,i,a){if(i!=null&&(i=""+Zt(i),i!==e.value&&(e.value=i),a==null)){e.defaultValue!==i&&(e.defaultValue=i);return}e.defaultValue=a!=null?""+Zt(a):""}function Ph(e,i,a,l){if(i==null){if(l!=null){if(a!=null)throw Error(r(92));if(Ue(l)){if(1<l.length)throw Error(r(93));l=l[0]}a=l}a==null&&(a=""),i=a}a=Zt(i),e.defaultValue=a,l=e.textContent,l===a&&l!==""&&l!==null&&(e.value=l)}function rs(e,i){if(i){var a=e.firstChild;if(a&&a===e.lastChild&&a.nodeType===3){a.nodeValue=i;return}}e.textContent=i}var X0=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 ed(e,i,a){var l=i.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?l?e.setProperty(i,""):i==="float"?e.cssFloat="":e[i]="":l?e.setProperty(i,a):typeof a!="number"||a===0||X0.has(i)?i==="float"?e.cssFloat=a:e[i]=(""+a).trim():e[i]=a+"px"}function td(e,i,a){if(i!=null&&typeof i!="object")throw Error(r(62));if(e=e.style,a!=null){for(var l in a)!a.hasOwnProperty(l)||i!=null&&i.hasOwnProperty(l)||(l.indexOf("--")===0?e.setProperty(l,""):l==="float"?e.cssFloat="":e[l]="");for(var u in i)l=i[u],i.hasOwnProperty(u)&&a[u]!==l&&ed(e,u,l)}else for(var f in i)i.hasOwnProperty(f)&&ed(e,f,i[f])}function Yo(e){if(e.indexOf("-")===-1)return!1;switch(e){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 Z0=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"]]),Q0=/^[\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 Ba(e){return Q0.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}var Jo=null;function Io(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var as=null,ls=null;function nd(e){var i=es(e);if(i&&(e=i.stateNode)){var a=e[Nt]||null;e:switch(e=i.stateNode,i.type){case"input":if(Ho(e,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name),i=a.name,a.type==="radio"&&i!=null){for(a=e;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll('input[name="'+Qt(""+i)+'"][type="radio"]'),i=0;i<a.length;i++){var l=a[i];if(l!==e&&l.form===e.form){var u=l[Nt]||null;if(!u)throw Error(r(90));Ho(l,u.value,u.defaultValue,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name)}}for(i=0;i<a.length;i++)l=a[i],l.form===e.form&&Qh(l)}break e;case"textarea":Wh(e,a.value,a.defaultValue);break e;case"select":i=a.value,i!=null&&ss(e,!!a.multiple,i,!1)}}}var Xo=!1;function id(e,i,a){if(Xo)return e(i,a);Xo=!0;try{var l=e(i);return l}finally{if(Xo=!1,(as!==null||ls!==null)&&(wl(),as&&(i=as,e=ls,ls=as=null,nd(i),e)))for(i=0;i<e.length;i++)nd(e[i])}}function cr(e,i){var a=e.stateNode;if(a===null)return null;var l=a[Nt]||null;if(l===null)return null;a=l[i];e:switch(i){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)||(e=e.type,l=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!l;break e;default:e=!1}if(e)return null;if(a&&typeof a!="function")throw Error(r(231,i,typeof a));return a}var En=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Zo=!1;if(En)try{var fr={};Object.defineProperty(fr,"passive",{get:function(){Zo=!0}}),window.addEventListener("test",fr,fr),window.removeEventListener("test",fr,fr)}catch{Zo=!1}var Qn=null,Qo=null,qa=null;function sd(){if(qa)return qa;var e,i=Qo,a=i.length,l,u="value"in Qn?Qn.value:Qn.textContent,f=u.length;for(e=0;e<a&&i[e]===u[e];e++);var d=a-e;for(l=1;l<=d&&i[a-l]===u[f-l];l++);return qa=u.slice(e,1<l?1-l:void 0)}function Ka(e){var i=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&i===13&&(e=13)):e=i,e===10&&(e=13),32<=e||e===13?e:0}function ja(){return!0}function rd(){return!1}function Mt(e){function i(a,l,u,f,d){this._reactName=a,this._targetInst=u,this.type=l,this.nativeEvent=f,this.target=d,this.currentTarget=null;for(var b in e)e.hasOwnProperty(b)&&(a=e[b],this[b]=a?a(f):f[b]);return this.isDefaultPrevented=(f.defaultPrevented!=null?f.defaultPrevented:f.returnValue===!1)?ja:rd,this.isPropagationStopped=rd,this}return v(i.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=ja)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=ja)},persist:function(){},isPersistent:ja}),i}var Ei={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},La=Mt(Ei),hr=v({},Ei,{view:0,detail:0}),F0=Mt(hr),Fo,Wo,dr,Va=v({},hr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:eu,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==dr&&(dr&&e.type==="mousemove"?(Fo=e.screenX-dr.screenX,Wo=e.screenY-dr.screenY):Wo=Fo=0,dr=e),Fo)},movementY:function(e){return"movementY"in e?e.movementY:Wo}}),ad=Mt(Va),W0=v({},Va,{dataTransfer:0}),P0=Mt(W0),e1=v({},hr,{relatedTarget:0}),Po=Mt(e1),t1=v({},Ei,{animationName:0,elapsedTime:0,pseudoElement:0}),n1=Mt(t1),i1=v({},Ei,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),s1=Mt(i1),r1=v({},Ei,{data:0}),ld=Mt(r1),a1={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},l1={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"},o1={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function u1(e){var i=this.nativeEvent;return i.getModifierState?i.getModifierState(e):(e=o1[e])?!!i[e]:!1}function eu(){return u1}var c1=v({},hr,{key:function(e){if(e.key){var i=a1[e.key]||e.key;if(i!=="Unidentified")return i}return e.type==="keypress"?(e=Ka(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?l1[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:eu,charCode:function(e){return e.type==="keypress"?Ka(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Ka(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),f1=Mt(c1),h1=v({},Va,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),od=Mt(h1),d1=v({},hr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:eu}),p1=Mt(d1),m1=v({},Ei,{propertyName:0,elapsedTime:0,pseudoElement:0}),y1=Mt(m1),g1=v({},Va,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),b1=Mt(g1),v1=v({},Ei,{newState:0,oldState:0}),S1=Mt(v1),A1=[9,13,27,32],tu=En&&"CompositionEvent"in window,pr=null;En&&"documentMode"in document&&(pr=document.documentMode);var w1=En&&"TextEvent"in window&&!pr,ud=En&&(!tu||pr&&8<pr&&11>=pr),cd=" ",fd=!1;function hd(e,i){switch(e){case"keyup":return A1.indexOf(i.keyCode)!==-1;case"keydown":return i.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function dd(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var os=!1;function x1(e,i){switch(e){case"compositionend":return dd(i);case"keypress":return i.which!==32?null:(fd=!0,cd);case"textInput":return e=i.data,e===cd&&fd?null:e;default:return null}}function O1(e,i){if(os)return e==="compositionend"||!tu&&hd(e,i)?(e=sd(),qa=Qo=Qn=null,os=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(i.ctrlKey||i.altKey||i.metaKey)||i.ctrlKey&&i.altKey){if(i.char&&1<i.char.length)return i.char;if(i.which)return String.fromCharCode(i.which)}return null;case"compositionend":return ud&&i.locale!=="ko"?null:i.data;default:return null}}var E1={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 pd(e){var i=e&&e.nodeName&&e.nodeName.toLowerCase();return i==="input"?!!E1[e.type]:i==="textarea"}function md(e,i,a,l){as?ls?ls.push(l):ls=[l]:as=l,i=Rl(i,"onChange"),0<i.length&&(a=new La("onChange","change",null,a,l),e.push({event:a,listeners:i}))}var mr=null,yr=null;function _1(e){Zm(e,0)}function Ha(e){var i=ur(e);if(Qh(i))return e}function yd(e,i){if(e==="change")return i}var gd=!1;if(En){var nu;if(En){var iu="oninput"in document;if(!iu){var bd=document.createElement("div");bd.setAttribute("oninput","return;"),iu=typeof bd.oninput=="function"}nu=iu}else nu=!1;gd=nu&&(!document.documentMode||9<document.documentMode)}function vd(){mr&&(mr.detachEvent("onpropertychange",Sd),yr=mr=null)}function Sd(e){if(e.propertyName==="value"&&Ha(yr)){var i=[];md(i,yr,e,Io(e)),id(_1,i)}}function T1(e,i,a){e==="focusin"?(vd(),mr=i,yr=a,mr.attachEvent("onpropertychange",Sd)):e==="focusout"&&vd()}function R1(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Ha(yr)}function k1(e,i){if(e==="click")return Ha(i)}function N1(e,i){if(e==="input"||e==="change")return Ha(i)}function M1(e,i){return e===i&&(e!==0||1/e===1/i)||e!==e&&i!==i}var Kt=typeof Object.is=="function"?Object.is:M1;function gr(e,i){if(Kt(e,i))return!0;if(typeof e!="object"||e===null||typeof i!="object"||i===null)return!1;var a=Object.keys(e),l=Object.keys(i);if(a.length!==l.length)return!1;for(l=0;l<a.length;l++){var u=a[l];if(!$o.call(i,u)||!Kt(e[u],i[u]))return!1}return!0}function Ad(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function wd(e,i){var a=Ad(e);e=0;for(var l;a;){if(a.nodeType===3){if(l=e+a.textContent.length,e<=i&&l>=i)return{node:a,offset:i-e};e=l}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=Ad(a)}}function xd(e,i){return e&&i?e===i?!0:e&&e.nodeType===3?!1:i&&i.nodeType===3?xd(e,i.parentNode):"contains"in e?e.contains(i):e.compareDocumentPosition?!!(e.compareDocumentPosition(i)&16):!1:!1}function Od(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var i=Ua(e.document);i instanceof e.HTMLIFrameElement;){try{var a=typeof i.contentWindow.location.href=="string"}catch{a=!1}if(a)e=i.contentWindow;else break;i=Ua(e.document)}return i}function su(e){var i=e&&e.nodeName&&e.nodeName.toLowerCase();return i&&(i==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||i==="textarea"||e.contentEditable==="true")}var $1=En&&"documentMode"in document&&11>=document.documentMode,us=null,ru=null,br=null,au=!1;function Ed(e,i,a){var l=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;au||us==null||us!==Ua(l)||(l=us,"selectionStart"in l&&su(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}),br&&gr(br,l)||(br=l,l=Rl(ru,"onSelect"),0<l.length&&(i=new La("onSelect","select",null,i,a),e.push({event:i,listeners:l}),i.target=us)))}function _i(e,i){var a={};return a[e.toLowerCase()]=i.toLowerCase(),a["Webkit"+e]="webkit"+i,a["Moz"+e]="moz"+i,a}var cs={animationend:_i("Animation","AnimationEnd"),animationiteration:_i("Animation","AnimationIteration"),animationstart:_i("Animation","AnimationStart"),transitionrun:_i("Transition","TransitionRun"),transitionstart:_i("Transition","TransitionStart"),transitioncancel:_i("Transition","TransitionCancel"),transitionend:_i("Transition","TransitionEnd")},lu={},_d={};En&&(_d=document.createElement("div").style,"AnimationEvent"in window||(delete cs.animationend.animation,delete cs.animationiteration.animation,delete cs.animationstart.animation),"TransitionEvent"in window||delete cs.transitionend.transition);function Ti(e){if(lu[e])return lu[e];if(!cs[e])return e;var i=cs[e],a;for(a in i)if(i.hasOwnProperty(a)&&a in _d)return lu[e]=i[a];return e}var Td=Ti("animationend"),Rd=Ti("animationiteration"),kd=Ti("animationstart"),D1=Ti("transitionrun"),C1=Ti("transitionstart"),z1=Ti("transitioncancel"),Nd=Ti("transitionend"),Md=new Map,ou="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(" ");ou.push("scrollEnd");function on(e,i){Md.set(e,i),Oi(i,[e])}var $d=new WeakMap;function Ft(e,i){if(typeof e=="object"&&e!==null){var a=$d.get(e);return a!==void 0?a:(i={value:e,source:i,stack:Xh(i)},$d.set(e,i),i)}return{value:e,source:i,stack:Xh(i)}}var Wt=[],fs=0,uu=0;function Ga(){for(var e=fs,i=uu=fs=0;i<e;){var a=Wt[i];Wt[i++]=null;var l=Wt[i];Wt[i++]=null;var u=Wt[i];Wt[i++]=null;var f=Wt[i];if(Wt[i++]=null,l!==null&&u!==null){var d=l.pending;d===null?u.next=u:(u.next=d.next,d.next=u),l.pending=u}f!==0&&Dd(a,u,f)}}function Ya(e,i,a,l){Wt[fs++]=e,Wt[fs++]=i,Wt[fs++]=a,Wt[fs++]=l,uu|=l,e.lanes|=l,e=e.alternate,e!==null&&(e.lanes|=l)}function cu(e,i,a,l){return Ya(e,i,a,l),Ja(e)}function hs(e,i){return Ya(e,null,null,i),Ja(e)}function Dd(e,i,a){e.lanes|=a;var l=e.alternate;l!==null&&(l.lanes|=a);for(var u=!1,f=e.return;f!==null;)f.childLanes|=a,l=f.alternate,l!==null&&(l.childLanes|=a),f.tag===22&&(e=f.stateNode,e===null||e._visibility&1||(u=!0)),e=f,f=f.return;return e.tag===3?(f=e.stateNode,u&&i!==null&&(u=31-qt(a),e=f.hiddenUpdates,l=e[u],l===null?e[u]=[i]:l.push(i),i.lane=a|536870912),f):null}function Ja(e){if(50<Hr)throw Hr=0,yc=null,Error(r(185));for(var i=e.return;i!==null;)e=i,i=e.return;return e.tag===3?e.stateNode:null}var ds={};function U1(e,i,a,l){this.tag=e,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=i,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 jt(e,i,a,l){return new U1(e,i,a,l)}function fu(e){return e=e.prototype,!(!e||!e.isReactComponent)}function _n(e,i){var a=e.alternate;return a===null?(a=jt(e.tag,i,e.key,e.mode),a.elementType=e.elementType,a.type=e.type,a.stateNode=e.stateNode,a.alternate=e,e.alternate=a):(a.pendingProps=i,a.type=e.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=e.flags&65011712,a.childLanes=e.childLanes,a.lanes=e.lanes,a.child=e.child,a.memoizedProps=e.memoizedProps,a.memoizedState=e.memoizedState,a.updateQueue=e.updateQueue,i=e.dependencies,a.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext},a.sibling=e.sibling,a.index=e.index,a.ref=e.ref,a.refCleanup=e.refCleanup,a}function Cd(e,i){e.flags&=65011714;var a=e.alternate;return a===null?(e.childLanes=0,e.lanes=i,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=a.childLanes,e.lanes=a.lanes,e.child=a.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=a.memoizedProps,e.memoizedState=a.memoizedState,e.updateQueue=a.updateQueue,e.type=a.type,i=a.dependencies,e.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext}),e}function Ia(e,i,a,l,u,f){var d=0;if(l=e,typeof e=="function")fu(e)&&(d=1);else if(typeof e=="string")d=qS(e,a,W.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case ie:return e=jt(31,a,i,u),e.elementType=ie,e.lanes=f,e;case B:return Ri(a.children,u,f,i);case K:d=8,u|=24;break;case Z:return e=jt(12,a,i,u|2),e.elementType=Z,e.lanes=f,e;case z:return e=jt(13,a,i,u),e.elementType=z,e.lanes=f,e;case G:return e=jt(19,a,i,u),e.elementType=G,e.lanes=f,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case oe:case ne:d=10;break e;case de:d=9;break e;case ze:d=11;break e;case re:d=14;break e;case I:d=16,l=null;break e}d=29,a=Error(r(130,e===null?"null":typeof e,"")),l=null}return i=jt(d,a,i,u),i.elementType=e,i.type=l,i.lanes=f,i}function Ri(e,i,a,l){return e=jt(7,e,l,i),e.lanes=a,e}function hu(e,i,a){return e=jt(6,e,null,i),e.lanes=a,e}function du(e,i,a){return i=jt(4,e.children!==null?e.children:[],e.key,i),i.lanes=a,i.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},i}var ps=[],ms=0,Xa=null,Za=0,Pt=[],en=0,ki=null,Tn=1,Rn="";function Ni(e,i){ps[ms++]=Za,ps[ms++]=Xa,Xa=e,Za=i}function zd(e,i,a){Pt[en++]=Tn,Pt[en++]=Rn,Pt[en++]=ki,ki=e;var l=Tn;e=Rn;var u=32-qt(l)-1;l&=~(1<<u),a+=1;var f=32-qt(i)+u;if(30<f){var d=u-u%5;f=(l&(1<<d)-1).toString(32),l>>=d,u-=d,Tn=1<<32-qt(i)+u|a<<u|l,Rn=f+e}else Tn=1<<f|a<<u|l,Rn=e}function pu(e){e.return!==null&&(Ni(e,1),zd(e,1,0))}function mu(e){for(;e===Xa;)Xa=ps[--ms],ps[ms]=null,Za=ps[--ms],ps[ms]=null;for(;e===ki;)ki=Pt[--en],Pt[en]=null,Rn=Pt[--en],Pt[en]=null,Tn=Pt[--en],Pt[en]=null}var _t=null,Ge=null,we=!1,Mi=null,pn=!1,yu=Error(r(519));function $i(e){var i=Error(r(418,""));throw Ar(Ft(i,e)),yu}function Ud(e){var i=e.stateNode,a=e.type,l=e.memoizedProps;switch(i[St]=e,i[Nt]=l,a){case"dialog":me("cancel",i),me("close",i);break;case"iframe":case"object":case"embed":me("load",i);break;case"video":case"audio":for(a=0;a<Yr.length;a++)me(Yr[a],i);break;case"source":me("error",i);break;case"img":case"image":case"link":me("error",i),me("load",i);break;case"details":me("toggle",i);break;case"input":me("invalid",i),Fh(i,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0),za(i);break;case"select":me("invalid",i);break;case"textarea":me("invalid",i),Ph(i,l.value,l.defaultValue,l.children),za(i)}a=l.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||i.textContent===""+a||l.suppressHydrationWarning===!0||Pm(i.textContent,a)?(l.popover!=null&&(me("beforetoggle",i),me("toggle",i)),l.onScroll!=null&&me("scroll",i),l.onScrollEnd!=null&&me("scrollend",i),l.onClick!=null&&(i.onclick=kl),i=!0):i=!1,i||$i(e)}function Bd(e){for(_t=e.return;_t;)switch(_t.tag){case 5:case 13:pn=!1;return;case 27:case 3:pn=!0;return;default:_t=_t.return}}function vr(e){if(e!==_t)return!1;if(!we)return Bd(e),we=!0,!1;var i=e.tag,a;if((a=i!==3&&i!==27)&&((a=i===5)&&(a=e.type,a=!(a!=="form"&&a!=="button")||$c(e.type,e.memoizedProps)),a=!a),a&&Ge&&$i(e),Bd(e),i===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));e:{for(e=e.nextSibling,i=0;e;){if(e.nodeType===8)if(a=e.data,a==="/$"){if(i===0){Ge=cn(e.nextSibling);break e}i--}else a!=="$"&&a!=="$!"&&a!=="$?"||i++;e=e.nextSibling}Ge=null}}else i===27?(i=Ge,hi(e.type)?(e=Uc,Uc=null,Ge=e):Ge=i):Ge=_t?cn(e.stateNode.nextSibling):null;return!0}function Sr(){Ge=_t=null,we=!1}function qd(){var e=Mi;return e!==null&&(Ct===null?Ct=e:Ct.push.apply(Ct,e),Mi=null),e}function Ar(e){Mi===null?Mi=[e]:Mi.push(e)}var gu=U(null),Di=null,kn=null;function Fn(e,i,a){H(gu,i._currentValue),i._currentValue=a}function Nn(e){e._currentValue=gu.current,Y(gu)}function bu(e,i,a){for(;e!==null;){var l=e.alternate;if((e.childLanes&i)!==i?(e.childLanes|=i,l!==null&&(l.childLanes|=i)):l!==null&&(l.childLanes&i)!==i&&(l.childLanes|=i),e===a)break;e=e.return}}function vu(e,i,a,l){var u=e.child;for(u!==null&&(u.return=e);u!==null;){var f=u.dependencies;if(f!==null){var d=u.child;f=f.firstContext;e:for(;f!==null;){var b=f;f=u;for(var S=0;S<i.length;S++)if(b.context===i[S]){f.lanes|=a,b=f.alternate,b!==null&&(b.lanes|=a),bu(f.return,a,e),l||(d=null);break e}f=b.next}}else if(u.tag===18){if(d=u.return,d===null)throw Error(r(341));d.lanes|=a,f=d.alternate,f!==null&&(f.lanes|=a),bu(d,a,e),d=null}else d=u.child;if(d!==null)d.return=u;else for(d=u;d!==null;){if(d===e){d=null;break}if(u=d.sibling,u!==null){u.return=d.return,d=u;break}d=d.return}u=d}}function wr(e,i,a,l){e=null;for(var u=i,f=!1;u!==null;){if(!f){if((u.flags&524288)!==0)f=!0;else if((u.flags&262144)!==0)break}if(u.tag===10){var d=u.alternate;if(d===null)throw Error(r(387));if(d=d.memoizedProps,d!==null){var b=u.type;Kt(u.pendingProps.value,d.value)||(e!==null?e.push(b):e=[b])}}else if(u===Ut.current){if(d=u.alternate,d===null)throw Error(r(387));d.memoizedState.memoizedState!==u.memoizedState.memoizedState&&(e!==null?e.push(Fr):e=[Fr])}u=u.return}e!==null&&vu(i,e,a,l),i.flags|=262144}function Qa(e){for(e=e.firstContext;e!==null;){if(!Kt(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Ci(e){Di=e,kn=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function At(e){return Kd(Di,e)}function Fa(e,i){return Di===null&&Ci(e),Kd(e,i)}function Kd(e,i){var a=i._currentValue;if(i={context:i,memoizedValue:a,next:null},kn===null){if(e===null)throw Error(r(308));kn=i,e.dependencies={lanes:0,firstContext:i},e.flags|=524288}else kn=kn.next=i;return a}var B1=typeof AbortController<"u"?AbortController:function(){var e=[],i=this.signal={aborted:!1,addEventListener:function(a,l){e.push(l)}};this.abort=function(){i.aborted=!0,e.forEach(function(a){return a()})}},q1=t.unstable_scheduleCallback,K1=t.unstable_NormalPriority,st={$$typeof:ne,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Su(){return{controller:new B1,data:new Map,refCount:0}}function xr(e){e.refCount--,e.refCount===0&&q1(K1,function(){e.controller.abort()})}var Or=null,Au=0,ys=0,gs=null;function j1(e,i){if(Or===null){var a=Or=[];Au=0,ys=xc(),gs={status:"pending",value:void 0,then:function(l){a.push(l)}}}return Au++,i.then(jd,jd),i}function jd(){if(--Au===0&&Or!==null){gs!==null&&(gs.status="fulfilled");var e=Or;Or=null,ys=0,gs=null;for(var i=0;i<e.length;i++)(0,e[i])()}}function L1(e,i){var a=[],l={status:"pending",value:null,reason:null,then:function(u){a.push(u)}};return e.then(function(){l.status="fulfilled",l.value=i;for(var u=0;u<a.length;u++)(0,a[u])(i)},function(u){for(l.status="rejected",l.reason=u,u=0;u<a.length;u++)(0,a[u])(void 0)}),l}var Ld=M.S;M.S=function(e,i){typeof i=="object"&&i!==null&&typeof i.then=="function"&&j1(e,i),Ld!==null&&Ld(e,i)};var zi=U(null);function wu(){var e=zi.current;return e!==null?e:Be.pooledCache}function Wa(e,i){i===null?H(zi,zi.current):H(zi,i.pool)}function Vd(){var e=wu();return e===null?null:{parent:st._currentValue,pool:e}}var Er=Error(r(460)),Hd=Error(r(474)),Pa=Error(r(542)),xu={then:function(){}};function Gd(e){return e=e.status,e==="fulfilled"||e==="rejected"}function el(){}function Yd(e,i,a){switch(a=e[a],a===void 0?e.push(i):a!==i&&(i.then(el,el),i=a),i.status){case"fulfilled":return i.value;case"rejected":throw e=i.reason,Id(e),e;default:if(typeof i.status=="string")i.then(el,el);else{if(e=Be,e!==null&&100<e.shellSuspendCounter)throw Error(r(482));e=i,e.status="pending",e.then(function(l){if(i.status==="pending"){var u=i;u.status="fulfilled",u.value=l}},function(l){if(i.status==="pending"){var u=i;u.status="rejected",u.reason=l}})}switch(i.status){case"fulfilled":return i.value;case"rejected":throw e=i.reason,Id(e),e}throw _r=i,Er}}var _r=null;function Jd(){if(_r===null)throw Error(r(459));var e=_r;return _r=null,e}function Id(e){if(e===Er||e===Pa)throw Error(r(483))}var Wn=!1;function Ou(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Eu(e,i){e=e.updateQueue,i.updateQueue===e&&(i.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Pn(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function ei(e,i,a){var l=e.updateQueue;if(l===null)return null;if(l=l.shared,(Oe&2)!==0){var u=l.pending;return u===null?i.next=i:(i.next=u.next,u.next=i),l.pending=i,i=Ja(e),Dd(e,null,a),i}return Ya(e,l,i,a),Ja(e)}function Tr(e,i,a){if(i=i.updateQueue,i!==null&&(i=i.shared,(a&4194048)!==0)){var l=i.lanes;l&=e.pendingLanes,a|=l,i.lanes=a,jh(e,a)}}function _u(e,i){var a=e.updateQueue,l=e.alternate;if(l!==null&&(l=l.updateQueue,a===l)){var u=null,f=null;if(a=a.firstBaseUpdate,a!==null){do{var d={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};f===null?u=f=d:f=f.next=d,a=a.next}while(a!==null);f===null?u=f=i:f=f.next=i}else u=f=i;a={baseState:l.baseState,firstBaseUpdate:u,lastBaseUpdate:f,shared:l.shared,callbacks:l.callbacks},e.updateQueue=a;return}e=a.lastBaseUpdate,e===null?a.firstBaseUpdate=i:e.next=i,a.lastBaseUpdate=i}var Tu=!1;function Rr(){if(Tu){var e=gs;if(e!==null)throw e}}function kr(e,i,a,l){Tu=!1;var u=e.updateQueue;Wn=!1;var f=u.firstBaseUpdate,d=u.lastBaseUpdate,b=u.shared.pending;if(b!==null){u.shared.pending=null;var S=b,_=S.next;S.next=null,d===null?f=_:d.next=_,d=S;var $=e.alternate;$!==null&&($=$.updateQueue,b=$.lastBaseUpdate,b!==d&&(b===null?$.firstBaseUpdate=_:b.next=_,$.lastBaseUpdate=S))}if(f!==null){var C=u.baseState;d=0,$=_=S=null,b=f;do{var T=b.lane&-536870913,R=T!==b.lane;if(R?(be&T)===T:(l&T)===T){T!==0&&T===ys&&(Tu=!0),$!==null&&($=$.next={lane:0,tag:b.tag,payload:b.payload,callback:null,next:null});e:{var se=e,P=b;T=i;var Ne=a;switch(P.tag){case 1:if(se=P.payload,typeof se=="function"){C=se.call(Ne,C,T);break e}C=se;break e;case 3:se.flags=se.flags&-65537|128;case 0:if(se=P.payload,T=typeof se=="function"?se.call(Ne,C,T):se,T==null)break e;C=v({},C,T);break e;case 2:Wn=!0}}T=b.callback,T!==null&&(e.flags|=64,R&&(e.flags|=8192),R=u.callbacks,R===null?u.callbacks=[T]:R.push(T))}else R={lane:T,tag:b.tag,payload:b.payload,callback:b.callback,next:null},$===null?(_=$=R,S=C):$=$.next=R,d|=T;if(b=b.next,b===null){if(b=u.shared.pending,b===null)break;R=b,b=R.next,R.next=null,u.lastBaseUpdate=R,u.shared.pending=null}}while(!0);$===null&&(S=C),u.baseState=S,u.firstBaseUpdate=_,u.lastBaseUpdate=$,f===null&&(u.shared.lanes=0),oi|=d,e.lanes=d,e.memoizedState=C}}function Xd(e,i){if(typeof e!="function")throw Error(r(191,e));e.call(i)}function Zd(e,i){var a=e.callbacks;if(a!==null)for(e.callbacks=null,e=0;e<a.length;e++)Xd(a[e],i)}var bs=U(null),tl=U(0);function Qd(e,i){e=Bn,H(tl,e),H(bs,i),Bn=e|i.baseLanes}function Ru(){H(tl,Bn),H(bs,bs.current)}function ku(){Bn=tl.current,Y(bs),Y(tl)}var ti=0,fe=null,Re=null,Qe=null,nl=!1,vs=!1,Ui=!1,il=0,Nr=0,Ss=null,V1=0;function Xe(){throw Error(r(321))}function Nu(e,i){if(i===null)return!1;for(var a=0;a<i.length&&a<e.length;a++)if(!Kt(e[a],i[a]))return!1;return!0}function Mu(e,i,a,l,u,f){return ti=f,fe=i,i.memoizedState=null,i.updateQueue=null,i.lanes=0,M.H=e===null||e.memoizedState===null?Dp:Cp,Ui=!1,f=a(l,u),Ui=!1,vs&&(f=Wd(i,a,l,u)),Fd(e),f}function Fd(e){M.H=ul;var i=Re!==null&&Re.next!==null;if(ti=0,Qe=Re=fe=null,nl=!1,Nr=0,Ss=null,i)throw Error(r(300));e===null||ot||(e=e.dependencies,e!==null&&Qa(e)&&(ot=!0))}function Wd(e,i,a,l){fe=e;var u=0;do{if(vs&&(Ss=null),Nr=0,vs=!1,25<=u)throw Error(r(301));if(u+=1,Qe=Re=null,e.updateQueue!=null){var f=e.updateQueue;f.lastEffect=null,f.events=null,f.stores=null,f.memoCache!=null&&(f.memoCache.index=0)}M.H=Z1,f=i(a,l)}while(vs);return f}function H1(){var e=M.H,i=e.useState()[0];return i=typeof i.then=="function"?Mr(i):i,e=e.useState()[0],(Re!==null?Re.memoizedState:null)!==e&&(fe.flags|=1024),i}function $u(){var e=il!==0;return il=0,e}function Du(e,i,a){i.updateQueue=e.updateQueue,i.flags&=-2053,e.lanes&=~a}function Cu(e){if(nl){for(e=e.memoizedState;e!==null;){var i=e.queue;i!==null&&(i.pending=null),e=e.next}nl=!1}ti=0,Qe=Re=fe=null,vs=!1,Nr=il=0,Ss=null}function $t(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Qe===null?fe.memoizedState=Qe=e:Qe=Qe.next=e,Qe}function Fe(){if(Re===null){var e=fe.alternate;e=e!==null?e.memoizedState:null}else e=Re.next;var i=Qe===null?fe.memoizedState:Qe.next;if(i!==null)Qe=i,Re=e;else{if(e===null)throw fe.alternate===null?Error(r(467)):Error(r(310));Re=e,e={memoizedState:Re.memoizedState,baseState:Re.baseState,baseQueue:Re.baseQueue,queue:Re.queue,next:null},Qe===null?fe.memoizedState=Qe=e:Qe=Qe.next=e}return Qe}function zu(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Mr(e){var i=Nr;return Nr+=1,Ss===null&&(Ss=[]),e=Yd(Ss,e,i),i=fe,(Qe===null?i.memoizedState:Qe.next)===null&&(i=i.alternate,M.H=i===null||i.memoizedState===null?Dp:Cp),e}function sl(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Mr(e);if(e.$$typeof===ne)return At(e)}throw Error(r(438,String(e)))}function Uu(e){var i=null,a=fe.updateQueue;if(a!==null&&(i=a.memoCache),i==null){var l=fe.alternate;l!==null&&(l=l.updateQueue,l!==null&&(l=l.memoCache,l!=null&&(i={data:l.data.map(function(u){return u.slice()}),index:0})))}if(i==null&&(i={data:[],index:0}),a===null&&(a=zu(),fe.updateQueue=a),a.memoCache=i,a=i.data[i.index],a===void 0)for(a=i.data[i.index]=Array(e),l=0;l<e;l++)a[l]=ye;return i.index++,a}function Mn(e,i){return typeof i=="function"?i(e):i}function rl(e){var i=Fe();return Bu(i,Re,e)}function Bu(e,i,a){var l=e.queue;if(l===null)throw Error(r(311));l.lastRenderedReducer=a;var u=e.baseQueue,f=l.pending;if(f!==null){if(u!==null){var d=u.next;u.next=f.next,f.next=d}i.baseQueue=u=f,l.pending=null}if(f=e.baseState,u===null)e.memoizedState=f;else{i=u.next;var b=d=null,S=null,_=i,$=!1;do{var C=_.lane&-536870913;if(C!==_.lane?(be&C)===C:(ti&C)===C){var T=_.revertLane;if(T===0)S!==null&&(S=S.next={lane:0,revertLane:0,action:_.action,hasEagerState:_.hasEagerState,eagerState:_.eagerState,next:null}),C===ys&&($=!0);else if((ti&T)===T){_=_.next,T===ys&&($=!0);continue}else C={lane:0,revertLane:_.revertLane,action:_.action,hasEagerState:_.hasEagerState,eagerState:_.eagerState,next:null},S===null?(b=S=C,d=f):S=S.next=C,fe.lanes|=T,oi|=T;C=_.action,Ui&&a(f,C),f=_.hasEagerState?_.eagerState:a(f,C)}else T={lane:C,revertLane:_.revertLane,action:_.action,hasEagerState:_.hasEagerState,eagerState:_.eagerState,next:null},S===null?(b=S=T,d=f):S=S.next=T,fe.lanes|=C,oi|=C;_=_.next}while(_!==null&&_!==i);if(S===null?d=f:S.next=b,!Kt(f,e.memoizedState)&&(ot=!0,$&&(a=gs,a!==null)))throw a;e.memoizedState=f,e.baseState=d,e.baseQueue=S,l.lastRenderedState=f}return u===null&&(l.lanes=0),[e.memoizedState,l.dispatch]}function qu(e){var i=Fe(),a=i.queue;if(a===null)throw Error(r(311));a.lastRenderedReducer=e;var l=a.dispatch,u=a.pending,f=i.memoizedState;if(u!==null){a.pending=null;var d=u=u.next;do f=e(f,d.action),d=d.next;while(d!==u);Kt(f,i.memoizedState)||(ot=!0),i.memoizedState=f,i.baseQueue===null&&(i.baseState=f),a.lastRenderedState=f}return[f,l]}function Pd(e,i,a){var l=fe,u=Fe(),f=we;if(f){if(a===void 0)throw Error(r(407));a=a()}else a=i();var d=!Kt((Re||u).memoizedState,a);d&&(u.memoizedState=a,ot=!0),u=u.queue;var b=np.bind(null,l,u,e);if($r(2048,8,b,[e]),u.getSnapshot!==i||d||Qe!==null&&Qe.memoizedState.tag&1){if(l.flags|=2048,As(9,al(),tp.bind(null,l,u,a,i),null),Be===null)throw Error(r(349));f||(ti&124)!==0||ep(l,i,a)}return a}function ep(e,i,a){e.flags|=16384,e={getSnapshot:i,value:a},i=fe.updateQueue,i===null?(i=zu(),fe.updateQueue=i,i.stores=[e]):(a=i.stores,a===null?i.stores=[e]:a.push(e))}function tp(e,i,a,l){i.value=a,i.getSnapshot=l,ip(i)&&sp(e)}function np(e,i,a){return a(function(){ip(i)&&sp(e)})}function ip(e){var i=e.getSnapshot;e=e.value;try{var a=i();return!Kt(e,a)}catch{return!0}}function sp(e){var i=hs(e,2);i!==null&&Yt(i,e,2)}function Ku(e){var i=$t();if(typeof e=="function"){var a=e;if(e=a(),Ui){Xn(!0);try{a()}finally{Xn(!1)}}}return i.memoizedState=i.baseState=e,i.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Mn,lastRenderedState:e},i}function rp(e,i,a,l){return e.baseState=a,Bu(e,Re,typeof l=="function"?l:Mn)}function G1(e,i,a,l,u){if(ol(e))throw Error(r(485));if(e=i.action,e!==null){var f={payload:u,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(d){f.listeners.push(d)}};M.T!==null?a(!0):f.isTransition=!1,l(f),a=i.pending,a===null?(f.next=i.pending=f,ap(i,f)):(f.next=a.next,i.pending=a.next=f)}}function ap(e,i){var a=i.action,l=i.payload,u=e.state;if(i.isTransition){var f=M.T,d={};M.T=d;try{var b=a(u,l),S=M.S;S!==null&&S(d,b),lp(e,i,b)}catch(_){ju(e,i,_)}finally{M.T=f}}else try{f=a(u,l),lp(e,i,f)}catch(_){ju(e,i,_)}}function lp(e,i,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(l){op(e,i,l)},function(l){return ju(e,i,l)}):op(e,i,a)}function op(e,i,a){i.status="fulfilled",i.value=a,up(i),e.state=a,i=e.pending,i!==null&&(a=i.next,a===i?e.pending=null:(a=a.next,i.next=a,ap(e,a)))}function ju(e,i,a){var l=e.pending;if(e.pending=null,l!==null){l=l.next;do i.status="rejected",i.reason=a,up(i),i=i.next;while(i!==l)}e.action=null}function up(e){e=e.listeners;for(var i=0;i<e.length;i++)(0,e[i])()}function cp(e,i){return i}function fp(e,i){if(we){var a=Be.formState;if(a!==null){e:{var l=fe;if(we){if(Ge){t:{for(var u=Ge,f=pn;u.nodeType!==8;){if(!f){u=null;break t}if(u=cn(u.nextSibling),u===null){u=null;break t}}f=u.data,u=f==="F!"||f==="F"?u:null}if(u){Ge=cn(u.nextSibling),l=u.data==="F!";break e}}$i(l)}l=!1}l&&(i=a[0])}}return a=$t(),a.memoizedState=a.baseState=i,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:cp,lastRenderedState:i},a.queue=l,a=Np.bind(null,fe,l),l.dispatch=a,l=Ku(!1),f=Yu.bind(null,fe,!1,l.queue),l=$t(),u={state:i,dispatch:null,action:e,pending:null},l.queue=u,a=G1.bind(null,fe,u,f,a),u.dispatch=a,l.memoizedState=e,[i,a,!1]}function hp(e){var i=Fe();return dp(i,Re,e)}function dp(e,i,a){if(i=Bu(e,i,cp)[0],e=rl(Mn)[0],typeof i=="object"&&i!==null&&typeof i.then=="function")try{var l=Mr(i)}catch(d){throw d===Er?Pa:d}else l=i;i=Fe();var u=i.queue,f=u.dispatch;return a!==i.memoizedState&&(fe.flags|=2048,As(9,al(),Y1.bind(null,u,a),null)),[l,f,e]}function Y1(e,i){e.action=i}function pp(e){var i=Fe(),a=Re;if(a!==null)return dp(i,a,e);Fe(),i=i.memoizedState,a=Fe();var l=a.queue.dispatch;return a.memoizedState=e,[i,l,!1]}function As(e,i,a,l){return e={tag:e,create:a,deps:l,inst:i,next:null},i=fe.updateQueue,i===null&&(i=zu(),fe.updateQueue=i),a=i.lastEffect,a===null?i.lastEffect=e.next=e:(l=a.next,a.next=e,e.next=l,i.lastEffect=e),e}function al(){return{destroy:void 0,resource:void 0}}function mp(){return Fe().memoizedState}function ll(e,i,a,l){var u=$t();l=l===void 0?null:l,fe.flags|=e,u.memoizedState=As(1|i,al(),a,l)}function $r(e,i,a,l){var u=Fe();l=l===void 0?null:l;var f=u.memoizedState.inst;Re!==null&&l!==null&&Nu(l,Re.memoizedState.deps)?u.memoizedState=As(i,f,a,l):(fe.flags|=e,u.memoizedState=As(1|i,f,a,l))}function yp(e,i){ll(8390656,8,e,i)}function gp(e,i){$r(2048,8,e,i)}function bp(e,i){return $r(4,2,e,i)}function vp(e,i){return $r(4,4,e,i)}function Sp(e,i){if(typeof i=="function"){e=e();var a=i(e);return function(){typeof a=="function"?a():i(null)}}if(i!=null)return e=e(),i.current=e,function(){i.current=null}}function Ap(e,i,a){a=a!=null?a.concat([e]):null,$r(4,4,Sp.bind(null,i,e),a)}function Lu(){}function wp(e,i){var a=Fe();i=i===void 0?null:i;var l=a.memoizedState;return i!==null&&Nu(i,l[1])?l[0]:(a.memoizedState=[e,i],e)}function xp(e,i){var a=Fe();i=i===void 0?null:i;var l=a.memoizedState;if(i!==null&&Nu(i,l[1]))return l[0];if(l=e(),Ui){Xn(!0);try{e()}finally{Xn(!1)}}return a.memoizedState=[l,i],l}function Vu(e,i,a){return a===void 0||(ti&1073741824)!==0?e.memoizedState=i:(e.memoizedState=a,e=_m(),fe.lanes|=e,oi|=e,a)}function Op(e,i,a,l){return Kt(a,i)?a:bs.current!==null?(e=Vu(e,a,l),Kt(e,i)||(ot=!0),e):(ti&42)===0?(ot=!0,e.memoizedState=a):(e=_m(),fe.lanes|=e,oi|=e,i)}function Ep(e,i,a,l,u){var f=V.p;V.p=f!==0&&8>f?f:8;var d=M.T,b={};M.T=b,Yu(e,!1,i,a);try{var S=u(),_=M.S;if(_!==null&&_(b,S),S!==null&&typeof S=="object"&&typeof S.then=="function"){var $=L1(S,l);Dr(e,i,$,Gt(e))}else Dr(e,i,l,Gt(e))}catch(C){Dr(e,i,{then:function(){},status:"rejected",reason:C},Gt())}finally{V.p=f,M.T=d}}function J1(){}function Hu(e,i,a,l){if(e.tag!==5)throw Error(r(476));var u=_p(e).queue;Ep(e,u,i,F,a===null?J1:function(){return Tp(e),a(l)})}function _p(e){var i=e.memoizedState;if(i!==null)return i;i={memoizedState:F,baseState:F,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Mn,lastRenderedState:F},next:null};var a={};return i.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Mn,lastRenderedState:a},next:null},e.memoizedState=i,e=e.alternate,e!==null&&(e.memoizedState=i),i}function Tp(e){var i=_p(e).next.queue;Dr(e,i,{},Gt())}function Gu(){return At(Fr)}function Rp(){return Fe().memoizedState}function kp(){return Fe().memoizedState}function I1(e){for(var i=e.return;i!==null;){switch(i.tag){case 24:case 3:var a=Gt();e=Pn(a);var l=ei(i,e,a);l!==null&&(Yt(l,i,a),Tr(l,i,a)),i={cache:Su()},e.payload=i;return}i=i.return}}function X1(e,i,a){var l=Gt();a={lane:l,revertLane:0,action:a,hasEagerState:!1,eagerState:null,next:null},ol(e)?Mp(i,a):(a=cu(e,i,a,l),a!==null&&(Yt(a,e,l),$p(a,i,l)))}function Np(e,i,a){var l=Gt();Dr(e,i,a,l)}function Dr(e,i,a,l){var u={lane:l,revertLane:0,action:a,hasEagerState:!1,eagerState:null,next:null};if(ol(e))Mp(i,u);else{var f=e.alternate;if(e.lanes===0&&(f===null||f.lanes===0)&&(f=i.lastRenderedReducer,f!==null))try{var d=i.lastRenderedState,b=f(d,a);if(u.hasEagerState=!0,u.eagerState=b,Kt(b,d))return Ya(e,i,u,0),Be===null&&Ga(),!1}catch{}finally{}if(a=cu(e,i,u,l),a!==null)return Yt(a,e,l),$p(a,i,l),!0}return!1}function Yu(e,i,a,l){if(l={lane:2,revertLane:xc(),action:l,hasEagerState:!1,eagerState:null,next:null},ol(e)){if(i)throw Error(r(479))}else i=cu(e,a,l,2),i!==null&&Yt(i,e,2)}function ol(e){var i=e.alternate;return e===fe||i!==null&&i===fe}function Mp(e,i){vs=nl=!0;var a=e.pending;a===null?i.next=i:(i.next=a.next,a.next=i),e.pending=i}function $p(e,i,a){if((a&4194048)!==0){var l=i.lanes;l&=e.pendingLanes,a|=l,i.lanes=a,jh(e,a)}}var ul={readContext:At,use:sl,useCallback:Xe,useContext:Xe,useEffect:Xe,useImperativeHandle:Xe,useLayoutEffect:Xe,useInsertionEffect:Xe,useMemo:Xe,useReducer:Xe,useRef:Xe,useState:Xe,useDebugValue:Xe,useDeferredValue:Xe,useTransition:Xe,useSyncExternalStore:Xe,useId:Xe,useHostTransitionStatus:Xe,useFormState:Xe,useActionState:Xe,useOptimistic:Xe,useMemoCache:Xe,useCacheRefresh:Xe},Dp={readContext:At,use:sl,useCallback:function(e,i){return $t().memoizedState=[e,i===void 0?null:i],e},useContext:At,useEffect:yp,useImperativeHandle:function(e,i,a){a=a!=null?a.concat([e]):null,ll(4194308,4,Sp.bind(null,i,e),a)},useLayoutEffect:function(e,i){return ll(4194308,4,e,i)},useInsertionEffect:function(e,i){ll(4,2,e,i)},useMemo:function(e,i){var a=$t();i=i===void 0?null:i;var l=e();if(Ui){Xn(!0);try{e()}finally{Xn(!1)}}return a.memoizedState=[l,i],l},useReducer:function(e,i,a){var l=$t();if(a!==void 0){var u=a(i);if(Ui){Xn(!0);try{a(i)}finally{Xn(!1)}}}else u=i;return l.memoizedState=l.baseState=u,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:u},l.queue=e,e=e.dispatch=X1.bind(null,fe,e),[l.memoizedState,e]},useRef:function(e){var i=$t();return e={current:e},i.memoizedState=e},useState:function(e){e=Ku(e);var i=e.queue,a=Np.bind(null,fe,i);return i.dispatch=a,[e.memoizedState,a]},useDebugValue:Lu,useDeferredValue:function(e,i){var a=$t();return Vu(a,e,i)},useTransition:function(){var e=Ku(!1);return e=Ep.bind(null,fe,e.queue,!0,!1),$t().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,i,a){var l=fe,u=$t();if(we){if(a===void 0)throw Error(r(407));a=a()}else{if(a=i(),Be===null)throw Error(r(349));(be&124)!==0||ep(l,i,a)}u.memoizedState=a;var f={value:a,getSnapshot:i};return u.queue=f,yp(np.bind(null,l,f,e),[e]),l.flags|=2048,As(9,al(),tp.bind(null,l,f,a,i),null),a},useId:function(){var e=$t(),i=Be.identifierPrefix;if(we){var a=Rn,l=Tn;a=(l&~(1<<32-qt(l)-1)).toString(32)+a,i="«"+i+"R"+a,a=il++,0<a&&(i+="H"+a.toString(32)),i+="»"}else a=V1++,i="«"+i+"r"+a.toString(32)+"»";return e.memoizedState=i},useHostTransitionStatus:Gu,useFormState:fp,useActionState:fp,useOptimistic:function(e){var i=$t();i.memoizedState=i.baseState=e;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return i.queue=a,i=Yu.bind(null,fe,!0,a),a.dispatch=i,[e,i]},useMemoCache:Uu,useCacheRefresh:function(){return $t().memoizedState=I1.bind(null,fe)}},Cp={readContext:At,use:sl,useCallback:wp,useContext:At,useEffect:gp,useImperativeHandle:Ap,useInsertionEffect:bp,useLayoutEffect:vp,useMemo:xp,useReducer:rl,useRef:mp,useState:function(){return rl(Mn)},useDebugValue:Lu,useDeferredValue:function(e,i){var a=Fe();return Op(a,Re.memoizedState,e,i)},useTransition:function(){var e=rl(Mn)[0],i=Fe().memoizedState;return[typeof e=="boolean"?e:Mr(e),i]},useSyncExternalStore:Pd,useId:Rp,useHostTransitionStatus:Gu,useFormState:hp,useActionState:hp,useOptimistic:function(e,i){var a=Fe();return rp(a,Re,e,i)},useMemoCache:Uu,useCacheRefresh:kp},Z1={readContext:At,use:sl,useCallback:wp,useContext:At,useEffect:gp,useImperativeHandle:Ap,useInsertionEffect:bp,useLayoutEffect:vp,useMemo:xp,useReducer:qu,useRef:mp,useState:function(){return qu(Mn)},useDebugValue:Lu,useDeferredValue:function(e,i){var a=Fe();return Re===null?Vu(a,e,i):Op(a,Re.memoizedState,e,i)},useTransition:function(){var e=qu(Mn)[0],i=Fe().memoizedState;return[typeof e=="boolean"?e:Mr(e),i]},useSyncExternalStore:Pd,useId:Rp,useHostTransitionStatus:Gu,useFormState:pp,useActionState:pp,useOptimistic:function(e,i){var a=Fe();return Re!==null?rp(a,Re,e,i):(a.baseState=e,[e,a.queue.dispatch])},useMemoCache:Uu,useCacheRefresh:kp},ws=null,Cr=0;function cl(e){var i=Cr;return Cr+=1,ws===null&&(ws=[]),Yd(ws,e,i)}function zr(e,i){i=i.props.ref,e.ref=i!==void 0?i:null}function fl(e,i){throw i.$$typeof===x?Error(r(525)):(e=Object.prototype.toString.call(i),Error(r(31,e==="[object Object]"?"object with keys {"+Object.keys(i).join(", ")+"}":e)))}function zp(e){var i=e._init;return i(e._payload)}function Up(e){function i(O,w){if(e){var E=O.deletions;E===null?(O.deletions=[w],O.flags|=16):E.push(w)}}function a(O,w){if(!e)return null;for(;w!==null;)i(O,w),w=w.sibling;return null}function l(O){for(var w=new Map;O!==null;)O.key!==null?w.set(O.key,O):w.set(O.index,O),O=O.sibling;return w}function u(O,w){return O=_n(O,w),O.index=0,O.sibling=null,O}function f(O,w,E){return O.index=E,e?(E=O.alternate,E!==null?(E=E.index,E<w?(O.flags|=67108866,w):E):(O.flags|=67108866,w)):(O.flags|=1048576,w)}function d(O){return e&&O.alternate===null&&(O.flags|=67108866),O}function b(O,w,E,D){return w===null||w.tag!==6?(w=hu(E,O.mode,D),w.return=O,w):(w=u(w,E),w.return=O,w)}function S(O,w,E,D){var J=E.type;return J===B?$(O,w,E.props.children,D,E.key):w!==null&&(w.elementType===J||typeof J=="object"&&J!==null&&J.$$typeof===I&&zp(J)===w.type)?(w=u(w,E.props),zr(w,E),w.return=O,w):(w=Ia(E.type,E.key,E.props,null,O.mode,D),zr(w,E),w.return=O,w)}function _(O,w,E,D){return w===null||w.tag!==4||w.stateNode.containerInfo!==E.containerInfo||w.stateNode.implementation!==E.implementation?(w=du(E,O.mode,D),w.return=O,w):(w=u(w,E.children||[]),w.return=O,w)}function $(O,w,E,D,J){return w===null||w.tag!==7?(w=Ri(E,O.mode,D,J),w.return=O,w):(w=u(w,E),w.return=O,w)}function C(O,w,E){if(typeof w=="string"&&w!==""||typeof w=="number"||typeof w=="bigint")return w=hu(""+w,O.mode,E),w.return=O,w;if(typeof w=="object"&&w!==null){switch(w.$$typeof){case N:return E=Ia(w.type,w.key,w.props,null,O.mode,E),zr(E,w),E.return=O,E;case k:return w=du(w,O.mode,E),w.return=O,w;case I:var D=w._init;return w=D(w._payload),C(O,w,E)}if(Ue(w)||Te(w))return w=Ri(w,O.mode,E,null),w.return=O,w;if(typeof w.then=="function")return C(O,cl(w),E);if(w.$$typeof===ne)return C(O,Fa(O,w),E);fl(O,w)}return null}function T(O,w,E,D){var J=w!==null?w.key:null;if(typeof E=="string"&&E!==""||typeof E=="number"||typeof E=="bigint")return J!==null?null:b(O,w,""+E,D);if(typeof E=="object"&&E!==null){switch(E.$$typeof){case N:return E.key===J?S(O,w,E,D):null;case k:return E.key===J?_(O,w,E,D):null;case I:return J=E._init,E=J(E._payload),T(O,w,E,D)}if(Ue(E)||Te(E))return J!==null?null:$(O,w,E,D,null);if(typeof E.then=="function")return T(O,w,cl(E),D);if(E.$$typeof===ne)return T(O,w,Fa(O,E),D);fl(O,E)}return null}function R(O,w,E,D,J){if(typeof D=="string"&&D!==""||typeof D=="number"||typeof D=="bigint")return O=O.get(E)||null,b(w,O,""+D,J);if(typeof D=="object"&&D!==null){switch(D.$$typeof){case N:return O=O.get(D.key===null?E:D.key)||null,S(w,O,D,J);case k:return O=O.get(D.key===null?E:D.key)||null,_(w,O,D,J);case I:var he=D._init;return D=he(D._payload),R(O,w,E,D,J)}if(Ue(D)||Te(D))return O=O.get(E)||null,$(w,O,D,J,null);if(typeof D.then=="function")return R(O,w,E,cl(D),J);if(D.$$typeof===ne)return R(O,w,E,Fa(w,D),J);fl(w,D)}return null}function se(O,w,E,D){for(var J=null,he=null,Q=w,ee=w=0,ct=null;Q!==null&&ee<E.length;ee++){Q.index>ee?(ct=Q,Q=null):ct=Q.sibling;var Ae=T(O,Q,E[ee],D);if(Ae===null){Q===null&&(Q=ct);break}e&&Q&&Ae.alternate===null&&i(O,Q),w=f(Ae,w,ee),he===null?J=Ae:he.sibling=Ae,he=Ae,Q=ct}if(ee===E.length)return a(O,Q),we&&Ni(O,ee),J;if(Q===null){for(;ee<E.length;ee++)Q=C(O,E[ee],D),Q!==null&&(w=f(Q,w,ee),he===null?J=Q:he.sibling=Q,he=Q);return we&&Ni(O,ee),J}for(Q=l(Q);ee<E.length;ee++)ct=R(Q,O,ee,E[ee],D),ct!==null&&(e&&ct.alternate!==null&&Q.delete(ct.key===null?ee:ct.key),w=f(ct,w,ee),he===null?J=ct:he.sibling=ct,he=ct);return e&&Q.forEach(function(gi){return i(O,gi)}),we&&Ni(O,ee),J}function P(O,w,E,D){if(E==null)throw Error(r(151));for(var J=null,he=null,Q=w,ee=w=0,ct=null,Ae=E.next();Q!==null&&!Ae.done;ee++,Ae=E.next()){Q.index>ee?(ct=Q,Q=null):ct=Q.sibling;var gi=T(O,Q,Ae.value,D);if(gi===null){Q===null&&(Q=ct);break}e&&Q&&gi.alternate===null&&i(O,Q),w=f(gi,w,ee),he===null?J=gi:he.sibling=gi,he=gi,Q=ct}if(Ae.done)return a(O,Q),we&&Ni(O,ee),J;if(Q===null){for(;!Ae.done;ee++,Ae=E.next())Ae=C(O,Ae.value,D),Ae!==null&&(w=f(Ae,w,ee),he===null?J=Ae:he.sibling=Ae,he=Ae);return we&&Ni(O,ee),J}for(Q=l(Q);!Ae.done;ee++,Ae=E.next())Ae=R(Q,O,ee,Ae.value,D),Ae!==null&&(e&&Ae.alternate!==null&&Q.delete(Ae.key===null?ee:Ae.key),w=f(Ae,w,ee),he===null?J=Ae:he.sibling=Ae,he=Ae);return e&&Q.forEach(function(QS){return i(O,QS)}),we&&Ni(O,ee),J}function Ne(O,w,E,D){if(typeof E=="object"&&E!==null&&E.type===B&&E.key===null&&(E=E.props.children),typeof E=="object"&&E!==null){switch(E.$$typeof){case N:e:{for(var J=E.key;w!==null;){if(w.key===J){if(J=E.type,J===B){if(w.tag===7){a(O,w.sibling),D=u(w,E.props.children),D.return=O,O=D;break e}}else if(w.elementType===J||typeof J=="object"&&J!==null&&J.$$typeof===I&&zp(J)===w.type){a(O,w.sibling),D=u(w,E.props),zr(D,E),D.return=O,O=D;break e}a(O,w);break}else i(O,w);w=w.sibling}E.type===B?(D=Ri(E.props.children,O.mode,D,E.key),D.return=O,O=D):(D=Ia(E.type,E.key,E.props,null,O.mode,D),zr(D,E),D.return=O,O=D)}return d(O);case k:e:{for(J=E.key;w!==null;){if(w.key===J)if(w.tag===4&&w.stateNode.containerInfo===E.containerInfo&&w.stateNode.implementation===E.implementation){a(O,w.sibling),D=u(w,E.children||[]),D.return=O,O=D;break e}else{a(O,w);break}else i(O,w);w=w.sibling}D=du(E,O.mode,D),D.return=O,O=D}return d(O);case I:return J=E._init,E=J(E._payload),Ne(O,w,E,D)}if(Ue(E))return se(O,w,E,D);if(Te(E)){if(J=Te(E),typeof J!="function")throw Error(r(150));return E=J.call(E),P(O,w,E,D)}if(typeof E.then=="function")return Ne(O,w,cl(E),D);if(E.$$typeof===ne)return Ne(O,w,Fa(O,E),D);fl(O,E)}return typeof E=="string"&&E!==""||typeof E=="number"||typeof E=="bigint"?(E=""+E,w!==null&&w.tag===6?(a(O,w.sibling),D=u(w,E),D.return=O,O=D):(a(O,w),D=hu(E,O.mode,D),D.return=O,O=D),d(O)):a(O,w)}return function(O,w,E,D){try{Cr=0;var J=Ne(O,w,E,D);return ws=null,J}catch(Q){if(Q===Er||Q===Pa)throw Q;var he=jt(29,Q,null,O.mode);return he.lanes=D,he.return=O,he}finally{}}}var xs=Up(!0),Bp=Up(!1),tn=U(null),mn=null;function ni(e){var i=e.alternate;H(rt,rt.current&1),H(tn,e),mn===null&&(i===null||bs.current!==null||i.memoizedState!==null)&&(mn=e)}function qp(e){if(e.tag===22){if(H(rt,rt.current),H(tn,e),mn===null){var i=e.alternate;i!==null&&i.memoizedState!==null&&(mn=e)}}else ii()}function ii(){H(rt,rt.current),H(tn,tn.current)}function $n(e){Y(tn),mn===e&&(mn=null),Y(rt)}var rt=U(0);function hl(e){for(var i=e;i!==null;){if(i.tag===13){var a=i.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||a.data==="$?"||zc(a)))return i}else if(i.tag===19&&i.memoizedProps.revealOrder!==void 0){if((i.flags&128)!==0)return i}else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===e)break;for(;i.sibling===null;){if(i.return===null||i.return===e)return null;i=i.return}i.sibling.return=i.return,i=i.sibling}return null}function Ju(e,i,a,l){i=e.memoizedState,a=a(l,i),a=a==null?i:v({},i,a),e.memoizedState=a,e.lanes===0&&(e.updateQueue.baseState=a)}var Iu={enqueueSetState:function(e,i,a){e=e._reactInternals;var l=Gt(),u=Pn(l);u.payload=i,a!=null&&(u.callback=a),i=ei(e,u,l),i!==null&&(Yt(i,e,l),Tr(i,e,l))},enqueueReplaceState:function(e,i,a){e=e._reactInternals;var l=Gt(),u=Pn(l);u.tag=1,u.payload=i,a!=null&&(u.callback=a),i=ei(e,u,l),i!==null&&(Yt(i,e,l),Tr(i,e,l))},enqueueForceUpdate:function(e,i){e=e._reactInternals;var a=Gt(),l=Pn(a);l.tag=2,i!=null&&(l.callback=i),i=ei(e,l,a),i!==null&&(Yt(i,e,a),Tr(i,e,a))}};function Kp(e,i,a,l,u,f,d){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(l,f,d):i.prototype&&i.prototype.isPureReactComponent?!gr(a,l)||!gr(u,f):!0}function jp(e,i,a,l){e=i.state,typeof i.componentWillReceiveProps=="function"&&i.componentWillReceiveProps(a,l),typeof i.UNSAFE_componentWillReceiveProps=="function"&&i.UNSAFE_componentWillReceiveProps(a,l),i.state!==e&&Iu.enqueueReplaceState(i,i.state,null)}function Bi(e,i){var a=i;if("ref"in i){a={};for(var l in i)l!=="ref"&&(a[l]=i[l])}if(e=e.defaultProps){a===i&&(a=v({},a));for(var u in e)a[u]===void 0&&(a[u]=e[u])}return a}var dl=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var i=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(i))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)};function Lp(e){dl(e)}function Vp(e){console.error(e)}function Hp(e){dl(e)}function pl(e,i){try{var a=e.onUncaughtError;a(i.value,{componentStack:i.stack})}catch(l){setTimeout(function(){throw l})}}function Gp(e,i,a){try{var l=e.onCaughtError;l(a.value,{componentStack:a.stack,errorBoundary:i.tag===1?i.stateNode:null})}catch(u){setTimeout(function(){throw u})}}function Xu(e,i,a){return a=Pn(a),a.tag=3,a.payload={element:null},a.callback=function(){pl(e,i)},a}function Yp(e){return e=Pn(e),e.tag=3,e}function Jp(e,i,a,l){var u=a.type.getDerivedStateFromError;if(typeof u=="function"){var f=l.value;e.payload=function(){return u(f)},e.callback=function(){Gp(i,a,l)}}var d=a.stateNode;d!==null&&typeof d.componentDidCatch=="function"&&(e.callback=function(){Gp(i,a,l),typeof u!="function"&&(ui===null?ui=new Set([this]):ui.add(this));var b=l.stack;this.componentDidCatch(l.value,{componentStack:b!==null?b:""})})}function Q1(e,i,a,l,u){if(a.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(i=a.alternate,i!==null&&wr(i,a,u,!0),a=tn.current,a!==null){switch(a.tag){case 13:return mn===null?bc():a.alternate===null&&Ye===0&&(Ye=3),a.flags&=-257,a.flags|=65536,a.lanes=u,l===xu?a.flags|=16384:(i=a.updateQueue,i===null?a.updateQueue=new Set([l]):i.add(l),Sc(e,l,u)),!1;case 22:return a.flags|=65536,l===xu?a.flags|=16384:(i=a.updateQueue,i===null?(i={transitions:null,markerInstances:null,retryQueue:new Set([l])},a.updateQueue=i):(a=i.retryQueue,a===null?i.retryQueue=new Set([l]):a.add(l)),Sc(e,l,u)),!1}throw Error(r(435,a.tag))}return Sc(e,l,u),bc(),!1}if(we)return i=tn.current,i!==null?((i.flags&65536)===0&&(i.flags|=256),i.flags|=65536,i.lanes=u,l!==yu&&(e=Error(r(422),{cause:l}),Ar(Ft(e,a)))):(l!==yu&&(i=Error(r(423),{cause:l}),Ar(Ft(i,a))),e=e.current.alternate,e.flags|=65536,u&=-u,e.lanes|=u,l=Ft(l,a),u=Xu(e.stateNode,l,u),_u(e,u),Ye!==4&&(Ye=2)),!1;var f=Error(r(520),{cause:l});if(f=Ft(f,a),Vr===null?Vr=[f]:Vr.push(f),Ye!==4&&(Ye=2),i===null)return!0;l=Ft(l,a),a=i;do{switch(a.tag){case 3:return a.flags|=65536,e=u&-u,a.lanes|=e,e=Xu(a.stateNode,l,e),_u(a,e),!1;case 1:if(i=a.type,f=a.stateNode,(a.flags&128)===0&&(typeof i.getDerivedStateFromError=="function"||f!==null&&typeof f.componentDidCatch=="function"&&(ui===null||!ui.has(f))))return a.flags|=65536,u&=-u,a.lanes|=u,u=Yp(u),Jp(u,e,a,l),_u(a,u),!1}a=a.return}while(a!==null);return!1}var Ip=Error(r(461)),ot=!1;function mt(e,i,a,l){i.child=e===null?Bp(i,null,a,l):xs(i,e.child,a,l)}function Xp(e,i,a,l,u){a=a.render;var f=i.ref;if("ref"in l){var d={};for(var b in l)b!=="ref"&&(d[b]=l[b])}else d=l;return Ci(i),l=Mu(e,i,a,d,f,u),b=$u(),e!==null&&!ot?(Du(e,i,u),Dn(e,i,u)):(we&&b&&pu(i),i.flags|=1,mt(e,i,l,u),i.child)}function Zp(e,i,a,l,u){if(e===null){var f=a.type;return typeof f=="function"&&!fu(f)&&f.defaultProps===void 0&&a.compare===null?(i.tag=15,i.type=f,Qp(e,i,f,l,u)):(e=Ia(a.type,null,l,i,i.mode,u),e.ref=i.ref,e.return=i,i.child=e)}if(f=e.child,!nc(e,u)){var d=f.memoizedProps;if(a=a.compare,a=a!==null?a:gr,a(d,l)&&e.ref===i.ref)return Dn(e,i,u)}return i.flags|=1,e=_n(f,l),e.ref=i.ref,e.return=i,i.child=e}function Qp(e,i,a,l,u){if(e!==null){var f=e.memoizedProps;if(gr(f,l)&&e.ref===i.ref)if(ot=!1,i.pendingProps=l=f,nc(e,u))(e.flags&131072)!==0&&(ot=!0);else return i.lanes=e.lanes,Dn(e,i,u)}return Zu(e,i,a,l,u)}function Fp(e,i,a){var l=i.pendingProps,u=l.children,f=e!==null?e.memoizedState:null;if(l.mode==="hidden"){if((i.flags&128)!==0){if(l=f!==null?f.baseLanes|a:a,e!==null){for(u=i.child=e.child,f=0;u!==null;)f=f|u.lanes|u.childLanes,u=u.sibling;i.childLanes=f&~l}else i.childLanes=0,i.child=null;return Wp(e,i,l,a)}if((a&536870912)!==0)i.memoizedState={baseLanes:0,cachePool:null},e!==null&&Wa(i,f!==null?f.cachePool:null),f!==null?Qd(i,f):Ru(),qp(i);else return i.lanes=i.childLanes=536870912,Wp(e,i,f!==null?f.baseLanes|a:a,a)}else f!==null?(Wa(i,f.cachePool),Qd(i,f),ii(),i.memoizedState=null):(e!==null&&Wa(i,null),Ru(),ii());return mt(e,i,u,a),i.child}function Wp(e,i,a,l){var u=wu();return u=u===null?null:{parent:st._currentValue,pool:u},i.memoizedState={baseLanes:a,cachePool:u},e!==null&&Wa(i,null),Ru(),qp(i),e!==null&&wr(e,i,l,!0),null}function ml(e,i){var a=i.ref;if(a===null)e!==null&&e.ref!==null&&(i.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(r(284));(e===null||e.ref!==a)&&(i.flags|=4194816)}}function Zu(e,i,a,l,u){return Ci(i),a=Mu(e,i,a,l,void 0,u),l=$u(),e!==null&&!ot?(Du(e,i,u),Dn(e,i,u)):(we&&l&&pu(i),i.flags|=1,mt(e,i,a,u),i.child)}function Pp(e,i,a,l,u,f){return Ci(i),i.updateQueue=null,a=Wd(i,l,a,u),Fd(e),l=$u(),e!==null&&!ot?(Du(e,i,f),Dn(e,i,f)):(we&&l&&pu(i),i.flags|=1,mt(e,i,a,f),i.child)}function em(e,i,a,l,u){if(Ci(i),i.stateNode===null){var f=ds,d=a.contextType;typeof d=="object"&&d!==null&&(f=At(d)),f=new a(l,f),i.memoizedState=f.state!==null&&f.state!==void 0?f.state:null,f.updater=Iu,i.stateNode=f,f._reactInternals=i,f=i.stateNode,f.props=l,f.state=i.memoizedState,f.refs={},Ou(i),d=a.contextType,f.context=typeof d=="object"&&d!==null?At(d):ds,f.state=i.memoizedState,d=a.getDerivedStateFromProps,typeof d=="function"&&(Ju(i,a,d,l),f.state=i.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof f.getSnapshotBeforeUpdate=="function"||typeof f.UNSAFE_componentWillMount!="function"&&typeof f.componentWillMount!="function"||(d=f.state,typeof f.componentWillMount=="function"&&f.componentWillMount(),typeof f.UNSAFE_componentWillMount=="function"&&f.UNSAFE_componentWillMount(),d!==f.state&&Iu.enqueueReplaceState(f,f.state,null),kr(i,l,f,u),Rr(),f.state=i.memoizedState),typeof f.componentDidMount=="function"&&(i.flags|=4194308),l=!0}else if(e===null){f=i.stateNode;var b=i.memoizedProps,S=Bi(a,b);f.props=S;var _=f.context,$=a.contextType;d=ds,typeof $=="object"&&$!==null&&(d=At($));var C=a.getDerivedStateFromProps;$=typeof C=="function"||typeof f.getSnapshotBeforeUpdate=="function",b=i.pendingProps!==b,$||typeof f.UNSAFE_componentWillReceiveProps!="function"&&typeof f.componentWillReceiveProps!="function"||(b||_!==d)&&jp(i,f,l,d),Wn=!1;var T=i.memoizedState;f.state=T,kr(i,l,f,u),Rr(),_=i.memoizedState,b||T!==_||Wn?(typeof C=="function"&&(Ju(i,a,C,l),_=i.memoizedState),(S=Wn||Kp(i,a,S,l,T,_,d))?($||typeof f.UNSAFE_componentWillMount!="function"&&typeof f.componentWillMount!="function"||(typeof f.componentWillMount=="function"&&f.componentWillMount(),typeof f.UNSAFE_componentWillMount=="function"&&f.UNSAFE_componentWillMount()),typeof f.componentDidMount=="function"&&(i.flags|=4194308)):(typeof f.componentDidMount=="function"&&(i.flags|=4194308),i.memoizedProps=l,i.memoizedState=_),f.props=l,f.state=_,f.context=d,l=S):(typeof f.componentDidMount=="function"&&(i.flags|=4194308),l=!1)}else{f=i.stateNode,Eu(e,i),d=i.memoizedProps,$=Bi(a,d),f.props=$,C=i.pendingProps,T=f.context,_=a.contextType,S=ds,typeof _=="object"&&_!==null&&(S=At(_)),b=a.getDerivedStateFromProps,(_=typeof b=="function"||typeof f.getSnapshotBeforeUpdate=="function")||typeof f.UNSAFE_componentWillReceiveProps!="function"&&typeof f.componentWillReceiveProps!="function"||(d!==C||T!==S)&&jp(i,f,l,S),Wn=!1,T=i.memoizedState,f.state=T,kr(i,l,f,u),Rr();var R=i.memoizedState;d!==C||T!==R||Wn||e!==null&&e.dependencies!==null&&Qa(e.dependencies)?(typeof b=="function"&&(Ju(i,a,b,l),R=i.memoizedState),($=Wn||Kp(i,a,$,l,T,R,S)||e!==null&&e.dependencies!==null&&Qa(e.dependencies))?(_||typeof f.UNSAFE_componentWillUpdate!="function"&&typeof f.componentWillUpdate!="function"||(typeof f.componentWillUpdate=="function"&&f.componentWillUpdate(l,R,S),typeof f.UNSAFE_componentWillUpdate=="function"&&f.UNSAFE_componentWillUpdate(l,R,S)),typeof f.componentDidUpdate=="function"&&(i.flags|=4),typeof f.getSnapshotBeforeUpdate=="function"&&(i.flags|=1024)):(typeof f.componentDidUpdate!="function"||d===e.memoizedProps&&T===e.memoizedState||(i.flags|=4),typeof f.getSnapshotBeforeUpdate!="function"||d===e.memoizedProps&&T===e.memoizedState||(i.flags|=1024),i.memoizedProps=l,i.memoizedState=R),f.props=l,f.state=R,f.context=S,l=$):(typeof f.componentDidUpdate!="function"||d===e.memoizedProps&&T===e.memoizedState||(i.flags|=4),typeof f.getSnapshotBeforeUpdate!="function"||d===e.memoizedProps&&T===e.memoizedState||(i.flags|=1024),l=!1)}return f=l,ml(e,i),l=(i.flags&128)!==0,f||l?(f=i.stateNode,a=l&&typeof a.getDerivedStateFromError!="function"?null:f.render(),i.flags|=1,e!==null&&l?(i.child=xs(i,e.child,null,u),i.child=xs(i,null,a,u)):mt(e,i,a,u),i.memoizedState=f.state,e=i.child):e=Dn(e,i,u),e}function tm(e,i,a,l){return Sr(),i.flags|=256,mt(e,i,a,l),i.child}var Qu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Fu(e){return{baseLanes:e,cachePool:Vd()}}function Wu(e,i,a){return e=e!==null?e.childLanes&~a:0,i&&(e|=nn),e}function nm(e,i,a){var l=i.pendingProps,u=!1,f=(i.flags&128)!==0,d;if((d=f)||(d=e!==null&&e.memoizedState===null?!1:(rt.current&2)!==0),d&&(u=!0,i.flags&=-129),d=(i.flags&32)!==0,i.flags&=-33,e===null){if(we){if(u?ni(i):ii(),we){var b=Ge,S;if(S=b){e:{for(S=b,b=pn;S.nodeType!==8;){if(!b){b=null;break e}if(S=cn(S.nextSibling),S===null){b=null;break e}}b=S}b!==null?(i.memoizedState={dehydrated:b,treeContext:ki!==null?{id:Tn,overflow:Rn}:null,retryLane:536870912,hydrationErrors:null},S=jt(18,null,null,0),S.stateNode=b,S.return=i,i.child=S,_t=i,Ge=null,S=!0):S=!1}S||$i(i)}if(b=i.memoizedState,b!==null&&(b=b.dehydrated,b!==null))return zc(b)?i.lanes=32:i.lanes=536870912,null;$n(i)}return b=l.children,l=l.fallback,u?(ii(),u=i.mode,b=yl({mode:"hidden",children:b},u),l=Ri(l,u,a,null),b.return=i,l.return=i,b.sibling=l,i.child=b,u=i.child,u.memoizedState=Fu(a),u.childLanes=Wu(e,d,a),i.memoizedState=Qu,l):(ni(i),Pu(i,b))}if(S=e.memoizedState,S!==null&&(b=S.dehydrated,b!==null)){if(f)i.flags&256?(ni(i),i.flags&=-257,i=ec(e,i,a)):i.memoizedState!==null?(ii(),i.child=e.child,i.flags|=128,i=null):(ii(),u=l.fallback,b=i.mode,l=yl({mode:"visible",children:l.children},b),u=Ri(u,b,a,null),u.flags|=2,l.return=i,u.return=i,l.sibling=u,i.child=l,xs(i,e.child,null,a),l=i.child,l.memoizedState=Fu(a),l.childLanes=Wu(e,d,a),i.memoizedState=Qu,i=u);else if(ni(i),zc(b)){if(d=b.nextSibling&&b.nextSibling.dataset,d)var _=d.dgst;d=_,l=Error(r(419)),l.stack="",l.digest=d,Ar({value:l,source:null,stack:null}),i=ec(e,i,a)}else if(ot||wr(e,i,a,!1),d=(a&e.childLanes)!==0,ot||d){if(d=Be,d!==null&&(l=a&-a,l=(l&42)!==0?1:Uo(l),l=(l&(d.suspendedLanes|a))!==0?0:l,l!==0&&l!==S.retryLane))throw S.retryLane=l,hs(e,l),Yt(d,e,l),Ip;b.data==="$?"||bc(),i=ec(e,i,a)}else b.data==="$?"?(i.flags|=192,i.child=e.child,i=null):(e=S.treeContext,Ge=cn(b.nextSibling),_t=i,we=!0,Mi=null,pn=!1,e!==null&&(Pt[en++]=Tn,Pt[en++]=Rn,Pt[en++]=ki,Tn=e.id,Rn=e.overflow,ki=i),i=Pu(i,l.children),i.flags|=4096);return i}return u?(ii(),u=l.fallback,b=i.mode,S=e.child,_=S.sibling,l=_n(S,{mode:"hidden",children:l.children}),l.subtreeFlags=S.subtreeFlags&65011712,_!==null?u=_n(_,u):(u=Ri(u,b,a,null),u.flags|=2),u.return=i,l.return=i,l.sibling=u,i.child=l,l=u,u=i.child,b=e.child.memoizedState,b===null?b=Fu(a):(S=b.cachePool,S!==null?(_=st._currentValue,S=S.parent!==_?{parent:_,pool:_}:S):S=Vd(),b={baseLanes:b.baseLanes|a,cachePool:S}),u.memoizedState=b,u.childLanes=Wu(e,d,a),i.memoizedState=Qu,l):(ni(i),a=e.child,e=a.sibling,a=_n(a,{mode:"visible",children:l.children}),a.return=i,a.sibling=null,e!==null&&(d=i.deletions,d===null?(i.deletions=[e],i.flags|=16):d.push(e)),i.child=a,i.memoizedState=null,a)}function Pu(e,i){return i=yl({mode:"visible",children:i},e.mode),i.return=e,e.child=i}function yl(e,i){return e=jt(22,e,null,i),e.lanes=0,e.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null},e}function ec(e,i,a){return xs(i,e.child,null,a),e=Pu(i,i.pendingProps.children),e.flags|=2,i.memoizedState=null,e}function im(e,i,a){e.lanes|=i;var l=e.alternate;l!==null&&(l.lanes|=i),bu(e.return,i,a)}function tc(e,i,a,l,u){var f=e.memoizedState;f===null?e.memoizedState={isBackwards:i,rendering:null,renderingStartTime:0,last:l,tail:a,tailMode:u}:(f.isBackwards=i,f.rendering=null,f.renderingStartTime=0,f.last=l,f.tail=a,f.tailMode=u)}function sm(e,i,a){var l=i.pendingProps,u=l.revealOrder,f=l.tail;if(mt(e,i,l.children,a),l=rt.current,(l&2)!==0)l=l&1|2,i.flags|=128;else{if(e!==null&&(e.flags&128)!==0)e:for(e=i.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&im(e,a,i);else if(e.tag===19)im(e,a,i);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===i)break e;for(;e.sibling===null;){if(e.return===null||e.return===i)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}l&=1}switch(H(rt,l),u){case"forwards":for(a=i.child,u=null;a!==null;)e=a.alternate,e!==null&&hl(e)===null&&(u=a),a=a.sibling;a=u,a===null?(u=i.child,i.child=null):(u=a.sibling,a.sibling=null),tc(i,!1,u,a,f);break;case"backwards":for(a=null,u=i.child,i.child=null;u!==null;){if(e=u.alternate,e!==null&&hl(e)===null){i.child=u;break}e=u.sibling,u.sibling=a,a=u,u=e}tc(i,!0,a,null,f);break;case"together":tc(i,!1,null,null,void 0);break;default:i.memoizedState=null}return i.child}function Dn(e,i,a){if(e!==null&&(i.dependencies=e.dependencies),oi|=i.lanes,(a&i.childLanes)===0)if(e!==null){if(wr(e,i,a,!1),(a&i.childLanes)===0)return null}else return null;if(e!==null&&i.child!==e.child)throw Error(r(153));if(i.child!==null){for(e=i.child,a=_n(e,e.pendingProps),i.child=a,a.return=i;e.sibling!==null;)e=e.sibling,a=a.sibling=_n(e,e.pendingProps),a.return=i;a.sibling=null}return i.child}function nc(e,i){return(e.lanes&i)!==0?!0:(e=e.dependencies,!!(e!==null&&Qa(e)))}function F1(e,i,a){switch(i.tag){case 3:je(i,i.stateNode.containerInfo),Fn(i,st,e.memoizedState.cache),Sr();break;case 27:case 5:Mo(i);break;case 4:je(i,i.stateNode.containerInfo);break;case 10:Fn(i,i.type,i.memoizedProps.value);break;case 13:var l=i.memoizedState;if(l!==null)return l.dehydrated!==null?(ni(i),i.flags|=128,null):(a&i.child.childLanes)!==0?nm(e,i,a):(ni(i),e=Dn(e,i,a),e!==null?e.sibling:null);ni(i);break;case 19:var u=(e.flags&128)!==0;if(l=(a&i.childLanes)!==0,l||(wr(e,i,a,!1),l=(a&i.childLanes)!==0),u){if(l)return sm(e,i,a);i.flags|=128}if(u=i.memoizedState,u!==null&&(u.rendering=null,u.tail=null,u.lastEffect=null),H(rt,rt.current),l)break;return null;case 22:case 23:return i.lanes=0,Fp(e,i,a);case 24:Fn(i,st,e.memoizedState.cache)}return Dn(e,i,a)}function rm(e,i,a){if(e!==null)if(e.memoizedProps!==i.pendingProps)ot=!0;else{if(!nc(e,a)&&(i.flags&128)===0)return ot=!1,F1(e,i,a);ot=(e.flags&131072)!==0}else ot=!1,we&&(i.flags&1048576)!==0&&zd(i,Za,i.index);switch(i.lanes=0,i.tag){case 16:e:{e=i.pendingProps;var l=i.elementType,u=l._init;if(l=u(l._payload),i.type=l,typeof l=="function")fu(l)?(e=Bi(l,e),i.tag=1,i=em(null,i,l,e,a)):(i.tag=0,i=Zu(null,i,l,e,a));else{if(l!=null){if(u=l.$$typeof,u===ze){i.tag=11,i=Xp(null,i,l,e,a);break e}else if(u===re){i.tag=14,i=Zp(null,i,l,e,a);break e}}throw i=vt(l)||l,Error(r(306,i,""))}}return i;case 0:return Zu(e,i,i.type,i.pendingProps,a);case 1:return l=i.type,u=Bi(l,i.pendingProps),em(e,i,l,u,a);case 3:e:{if(je(i,i.stateNode.containerInfo),e===null)throw Error(r(387));l=i.pendingProps;var f=i.memoizedState;u=f.element,Eu(e,i),kr(i,l,null,a);var d=i.memoizedState;if(l=d.cache,Fn(i,st,l),l!==f.cache&&vu(i,[st],a,!0),Rr(),l=d.element,f.isDehydrated)if(f={element:l,isDehydrated:!1,cache:d.cache},i.updateQueue.baseState=f,i.memoizedState=f,i.flags&256){i=tm(e,i,l,a);break e}else if(l!==u){u=Ft(Error(r(424)),i),Ar(u),i=tm(e,i,l,a);break e}else{switch(e=i.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(Ge=cn(e.firstChild),_t=i,we=!0,Mi=null,pn=!0,a=Bp(i,null,l,a),i.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if(Sr(),l===u){i=Dn(e,i,a);break e}mt(e,i,l,a)}i=i.child}return i;case 26:return ml(e,i),e===null?(a=uy(i.type,null,i.pendingProps,null))?i.memoizedState=a:we||(a=i.type,e=i.pendingProps,l=Nl(le.current).createElement(a),l[St]=i,l[Nt]=e,gt(l,a,e),lt(l),i.stateNode=l):i.memoizedState=uy(i.type,e.memoizedProps,i.pendingProps,e.memoizedState),null;case 27:return Mo(i),e===null&&we&&(l=i.stateNode=ay(i.type,i.pendingProps,le.current),_t=i,pn=!0,u=Ge,hi(i.type)?(Uc=u,Ge=cn(l.firstChild)):Ge=u),mt(e,i,i.pendingProps.children,a),ml(e,i),e===null&&(i.flags|=4194304),i.child;case 5:return e===null&&we&&((u=l=Ge)&&(l=ES(l,i.type,i.pendingProps,pn),l!==null?(i.stateNode=l,_t=i,Ge=cn(l.firstChild),pn=!1,u=!0):u=!1),u||$i(i)),Mo(i),u=i.type,f=i.pendingProps,d=e!==null?e.memoizedProps:null,l=f.children,$c(u,f)?l=null:d!==null&&$c(u,d)&&(i.flags|=32),i.memoizedState!==null&&(u=Mu(e,i,H1,null,null,a),Fr._currentValue=u),ml(e,i),mt(e,i,l,a),i.child;case 6:return e===null&&we&&((e=a=Ge)&&(a=_S(a,i.pendingProps,pn),a!==null?(i.stateNode=a,_t=i,Ge=null,e=!0):e=!1),e||$i(i)),null;case 13:return nm(e,i,a);case 4:return je(i,i.stateNode.containerInfo),l=i.pendingProps,e===null?i.child=xs(i,null,l,a):mt(e,i,l,a),i.child;case 11:return Xp(e,i,i.type,i.pendingProps,a);case 7:return mt(e,i,i.pendingProps,a),i.child;case 8:return mt(e,i,i.pendingProps.children,a),i.child;case 12:return mt(e,i,i.pendingProps.children,a),i.child;case 10:return l=i.pendingProps,Fn(i,i.type,l.value),mt(e,i,l.children,a),i.child;case 9:return u=i.type._context,l=i.pendingProps.children,Ci(i),u=At(u),l=l(u),i.flags|=1,mt(e,i,l,a),i.child;case 14:return Zp(e,i,i.type,i.pendingProps,a);case 15:return Qp(e,i,i.type,i.pendingProps,a);case 19:return sm(e,i,a);case 31:return l=i.pendingProps,a=i.mode,l={mode:l.mode,children:l.children},e===null?(a=yl(l,a),a.ref=i.ref,i.child=a,a.return=i,i=a):(a=_n(e.child,l),a.ref=i.ref,i.child=a,a.return=i,i=a),i;case 22:return Fp(e,i,a);case 24:return Ci(i),l=At(st),e===null?(u=wu(),u===null&&(u=Be,f=Su(),u.pooledCache=f,f.refCount++,f!==null&&(u.pooledCacheLanes|=a),u=f),i.memoizedState={parent:l,cache:u},Ou(i),Fn(i,st,u)):((e.lanes&a)!==0&&(Eu(e,i),kr(i,null,null,a),Rr()),u=e.memoizedState,f=i.memoizedState,u.parent!==l?(u={parent:l,cache:l},i.memoizedState=u,i.lanes===0&&(i.memoizedState=i.updateQueue.baseState=u),Fn(i,st,l)):(l=f.cache,Fn(i,st,l),l!==u.cache&&vu(i,[st],a,!0))),mt(e,i,i.pendingProps.children,a),i.child;case 29:throw i.pendingProps}throw Error(r(156,i.tag))}function Cn(e){e.flags|=4}function am(e,i){if(i.type!=="stylesheet"||(i.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!py(i)){if(i=tn.current,i!==null&&((be&4194048)===be?mn!==null:(be&62914560)!==be&&(be&536870912)===0||i!==mn))throw _r=xu,Hd;e.flags|=8192}}function gl(e,i){i!==null&&(e.flags|=4),e.flags&16384&&(i=e.tag!==22?qh():536870912,e.lanes|=i,Ts|=i)}function Ur(e,i){if(!we)switch(e.tailMode){case"hidden":i=e.tail;for(var a=null;i!==null;)i.alternate!==null&&(a=i),i=i.sibling;a===null?e.tail=null:a.sibling=null;break;case"collapsed":a=e.tail;for(var l=null;a!==null;)a.alternate!==null&&(l=a),a=a.sibling;l===null?i||e.tail===null?e.tail=null:e.tail.sibling=null:l.sibling=null}}function He(e){var i=e.alternate!==null&&e.alternate.child===e.child,a=0,l=0;if(i)for(var u=e.child;u!==null;)a|=u.lanes|u.childLanes,l|=u.subtreeFlags&65011712,l|=u.flags&65011712,u.return=e,u=u.sibling;else for(u=e.child;u!==null;)a|=u.lanes|u.childLanes,l|=u.subtreeFlags,l|=u.flags,u.return=e,u=u.sibling;return e.subtreeFlags|=l,e.childLanes=a,i}function W1(e,i,a){var l=i.pendingProps;switch(mu(i),i.tag){case 31:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return He(i),null;case 1:return He(i),null;case 3:return a=i.stateNode,l=null,e!==null&&(l=e.memoizedState.cache),i.memoizedState.cache!==l&&(i.flags|=2048),Nn(st),In(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(e===null||e.child===null)&&(vr(i)?Cn(i):e===null||e.memoizedState.isDehydrated&&(i.flags&256)===0||(i.flags|=1024,qd())),He(i),null;case 26:return a=i.memoizedState,e===null?(Cn(i),a!==null?(He(i),am(i,a)):(He(i),i.flags&=-16777217)):a?a!==e.memoizedState?(Cn(i),He(i),am(i,a)):(He(i),i.flags&=-16777217):(e.memoizedProps!==l&&Cn(i),He(i),i.flags&=-16777217),null;case 27:Ra(i),a=le.current;var u=i.type;if(e!==null&&i.stateNode!=null)e.memoizedProps!==l&&Cn(i);else{if(!l){if(i.stateNode===null)throw Error(r(166));return He(i),null}e=W.current,vr(i)?Ud(i):(e=ay(u,l,a),i.stateNode=e,Cn(i))}return He(i),null;case 5:if(Ra(i),a=i.type,e!==null&&i.stateNode!=null)e.memoizedProps!==l&&Cn(i);else{if(!l){if(i.stateNode===null)throw Error(r(166));return He(i),null}if(e=W.current,vr(i))Ud(i);else{switch(u=Nl(le.current),e){case 1:e=u.createElementNS("http://www.w3.org/2000/svg",a);break;case 2:e=u.createElementNS("http://www.w3.org/1998/Math/MathML",a);break;default:switch(a){case"svg":e=u.createElementNS("http://www.w3.org/2000/svg",a);break;case"math":e=u.createElementNS("http://www.w3.org/1998/Math/MathML",a);break;case"script":e=u.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild);break;case"select":e=typeof l.is=="string"?u.createElement("select",{is:l.is}):u.createElement("select"),l.multiple?e.multiple=!0:l.size&&(e.size=l.size);break;default:e=typeof l.is=="string"?u.createElement(a,{is:l.is}):u.createElement(a)}}e[St]=i,e[Nt]=l;e:for(u=i.child;u!==null;){if(u.tag===5||u.tag===6)e.appendChild(u.stateNode);else if(u.tag!==4&&u.tag!==27&&u.child!==null){u.child.return=u,u=u.child;continue}if(u===i)break e;for(;u.sibling===null;){if(u.return===null||u.return===i)break e;u=u.return}u.sibling.return=u.return,u=u.sibling}i.stateNode=e;e:switch(gt(e,a,l),a){case"button":case"input":case"select":case"textarea":e=!!l.autoFocus;break e;case"img":e=!0;break e;default:e=!1}e&&Cn(i)}}return He(i),i.flags&=-16777217,null;case 6:if(e&&i.stateNode!=null)e.memoizedProps!==l&&Cn(i);else{if(typeof l!="string"&&i.stateNode===null)throw Error(r(166));if(e=le.current,vr(i)){if(e=i.stateNode,a=i.memoizedProps,l=null,u=_t,u!==null)switch(u.tag){case 27:case 5:l=u.memoizedProps}e[St]=i,e=!!(e.nodeValue===a||l!==null&&l.suppressHydrationWarning===!0||Pm(e.nodeValue,a)),e||$i(i)}else e=Nl(e).createTextNode(l),e[St]=i,i.stateNode=e}return He(i),null;case 13:if(l=i.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(u=vr(i),l!==null&&l.dehydrated!==null){if(e===null){if(!u)throw Error(r(318));if(u=i.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(r(317));u[St]=i}else Sr(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;He(i),u=!1}else u=qd(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=u),u=!0;if(!u)return i.flags&256?($n(i),i):($n(i),null)}if($n(i),(i.flags&128)!==0)return i.lanes=a,i;if(a=l!==null,e=e!==null&&e.memoizedState!==null,a){l=i.child,u=null,l.alternate!==null&&l.alternate.memoizedState!==null&&l.alternate.memoizedState.cachePool!==null&&(u=l.alternate.memoizedState.cachePool.pool);var f=null;l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(f=l.memoizedState.cachePool.pool),f!==u&&(l.flags|=2048)}return a!==e&&a&&(i.child.flags|=8192),gl(i,i.updateQueue),He(i),null;case 4:return In(),e===null&&Tc(i.stateNode.containerInfo),He(i),null;case 10:return Nn(i.type),He(i),null;case 19:if(Y(rt),u=i.memoizedState,u===null)return He(i),null;if(l=(i.flags&128)!==0,f=u.rendering,f===null)if(l)Ur(u,!1);else{if(Ye!==0||e!==null&&(e.flags&128)!==0)for(e=i.child;e!==null;){if(f=hl(e),f!==null){for(i.flags|=128,Ur(u,!1),e=f.updateQueue,i.updateQueue=e,gl(i,e),i.subtreeFlags=0,e=a,a=i.child;a!==null;)Cd(a,e),a=a.sibling;return H(rt,rt.current&1|2),i.child}e=e.sibling}u.tail!==null&&dn()>Sl&&(i.flags|=128,l=!0,Ur(u,!1),i.lanes=4194304)}else{if(!l)if(e=hl(f),e!==null){if(i.flags|=128,l=!0,e=e.updateQueue,i.updateQueue=e,gl(i,e),Ur(u,!0),u.tail===null&&u.tailMode==="hidden"&&!f.alternate&&!we)return He(i),null}else 2*dn()-u.renderingStartTime>Sl&&a!==536870912&&(i.flags|=128,l=!0,Ur(u,!1),i.lanes=4194304);u.isBackwards?(f.sibling=i.child,i.child=f):(e=u.last,e!==null?e.sibling=f:i.child=f,u.last=f)}return u.tail!==null?(i=u.tail,u.rendering=i,u.tail=i.sibling,u.renderingStartTime=dn(),i.sibling=null,e=rt.current,H(rt,l?e&1|2:e&1),i):(He(i),null);case 22:case 23:return $n(i),ku(),l=i.memoizedState!==null,e!==null?e.memoizedState!==null!==l&&(i.flags|=8192):l&&(i.flags|=8192),l?(a&536870912)!==0&&(i.flags&128)===0&&(He(i),i.subtreeFlags&6&&(i.flags|=8192)):He(i),a=i.updateQueue,a!==null&&gl(i,a.retryQueue),a=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),l=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(l=i.memoizedState.cachePool.pool),l!==a&&(i.flags|=2048),e!==null&&Y(zi),null;case 24:return a=null,e!==null&&(a=e.memoizedState.cache),i.memoizedState.cache!==a&&(i.flags|=2048),Nn(st),He(i),null;case 25:return null;case 30:return null}throw Error(r(156,i.tag))}function P1(e,i){switch(mu(i),i.tag){case 1:return e=i.flags,e&65536?(i.flags=e&-65537|128,i):null;case 3:return Nn(st),In(),e=i.flags,(e&65536)!==0&&(e&128)===0?(i.flags=e&-65537|128,i):null;case 26:case 27:case 5:return Ra(i),null;case 13:if($n(i),e=i.memoizedState,e!==null&&e.dehydrated!==null){if(i.alternate===null)throw Error(r(340));Sr()}return e=i.flags,e&65536?(i.flags=e&-65537|128,i):null;case 19:return Y(rt),null;case 4:return In(),null;case 10:return Nn(i.type),null;case 22:case 23:return $n(i),ku(),e!==null&&Y(zi),e=i.flags,e&65536?(i.flags=e&-65537|128,i):null;case 24:return Nn(st),null;case 25:return null;default:return null}}function lm(e,i){switch(mu(i),i.tag){case 3:Nn(st),In();break;case 26:case 27:case 5:Ra(i);break;case 4:In();break;case 13:$n(i);break;case 19:Y(rt);break;case 10:Nn(i.type);break;case 22:case 23:$n(i),ku(),e!==null&&Y(zi);break;case 24:Nn(st)}}function Br(e,i){try{var a=i.updateQueue,l=a!==null?a.lastEffect:null;if(l!==null){var u=l.next;a=u;do{if((a.tag&e)===e){l=void 0;var f=a.create,d=a.inst;l=f(),d.destroy=l}a=a.next}while(a!==u)}}catch(b){$e(i,i.return,b)}}function si(e,i,a){try{var l=i.updateQueue,u=l!==null?l.lastEffect:null;if(u!==null){var f=u.next;l=f;do{if((l.tag&e)===e){var d=l.inst,b=d.destroy;if(b!==void 0){d.destroy=void 0,u=i;var S=a,_=b;try{_()}catch($){$e(u,S,$)}}}l=l.next}while(l!==f)}}catch($){$e(i,i.return,$)}}function om(e){var i=e.updateQueue;if(i!==null){var a=e.stateNode;try{Zd(i,a)}catch(l){$e(e,e.return,l)}}}function um(e,i,a){a.props=Bi(e.type,e.memoizedProps),a.state=e.memoizedState;try{a.componentWillUnmount()}catch(l){$e(e,i,l)}}function qr(e,i){try{var a=e.ref;if(a!==null){switch(e.tag){case 26:case 27:case 5:var l=e.stateNode;break;case 30:l=e.stateNode;break;default:l=e.stateNode}typeof a=="function"?e.refCleanup=a(l):a.current=l}}catch(u){$e(e,i,u)}}function yn(e,i){var a=e.ref,l=e.refCleanup;if(a!==null)if(typeof l=="function")try{l()}catch(u){$e(e,i,u)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(u){$e(e,i,u)}else a.current=null}function cm(e){var i=e.type,a=e.memoizedProps,l=e.stateNode;try{e:switch(i){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(u){$e(e,e.return,u)}}function ic(e,i,a){try{var l=e.stateNode;SS(l,e.type,a,i),l[Nt]=i}catch(u){$e(e,e.return,u)}}function fm(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&hi(e.type)||e.tag===4}function sc(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||fm(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&hi(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function rc(e,i,a){var l=e.tag;if(l===5||l===6)e=e.stateNode,i?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(e,i):(i=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,i.appendChild(e),a=a._reactRootContainer,a!=null||i.onclick!==null||(i.onclick=kl));else if(l!==4&&(l===27&&hi(e.type)&&(a=e.stateNode,i=null),e=e.child,e!==null))for(rc(e,i,a),e=e.sibling;e!==null;)rc(e,i,a),e=e.sibling}function bl(e,i,a){var l=e.tag;if(l===5||l===6)e=e.stateNode,i?a.insertBefore(e,i):a.appendChild(e);else if(l!==4&&(l===27&&hi(e.type)&&(a=e.stateNode),e=e.child,e!==null))for(bl(e,i,a),e=e.sibling;e!==null;)bl(e,i,a),e=e.sibling}function hm(e){var i=e.stateNode,a=e.memoizedProps;try{for(var l=e.type,u=i.attributes;u.length;)i.removeAttributeNode(u[0]);gt(i,l,a),i[St]=e,i[Nt]=a}catch(f){$e(e,e.return,f)}}var zn=!1,Ze=!1,ac=!1,dm=typeof WeakSet=="function"?WeakSet:Set,ut=null;function eS(e,i){if(e=e.containerInfo,Nc=Ul,e=Od(e),su(e)){if("selectionStart"in e)var a={start:e.selectionStart,end:e.selectionEnd};else e:{a=(a=e.ownerDocument)&&a.defaultView||window;var l=a.getSelection&&a.getSelection();if(l&&l.rangeCount!==0){a=l.anchorNode;var u=l.anchorOffset,f=l.focusNode;l=l.focusOffset;try{a.nodeType,f.nodeType}catch{a=null;break e}var d=0,b=-1,S=-1,_=0,$=0,C=e,T=null;t:for(;;){for(var R;C!==a||u!==0&&C.nodeType!==3||(b=d+u),C!==f||l!==0&&C.nodeType!==3||(S=d+l),C.nodeType===3&&(d+=C.nodeValue.length),(R=C.firstChild)!==null;)T=C,C=R;for(;;){if(C===e)break t;if(T===a&&++_===u&&(b=d),T===f&&++$===l&&(S=d),(R=C.nextSibling)!==null)break;C=T,T=C.parentNode}C=R}a=b===-1||S===-1?null:{start:b,end:S}}else a=null}a=a||{start:0,end:0}}else a=null;for(Mc={focusedElem:e,selectionRange:a},Ul=!1,ut=i;ut!==null;)if(i=ut,e=i.child,(i.subtreeFlags&1024)!==0&&e!==null)e.return=i,ut=e;else for(;ut!==null;){switch(i=ut,f=i.alternate,e=i.flags,i.tag){case 0:break;case 11:case 15:break;case 1:if((e&1024)!==0&&f!==null){e=void 0,a=i,u=f.memoizedProps,f=f.memoizedState,l=a.stateNode;try{var se=Bi(a.type,u,a.elementType===a.type);e=l.getSnapshotBeforeUpdate(se,f),l.__reactInternalSnapshotBeforeUpdate=e}catch(P){$e(a,a.return,P)}}break;case 3:if((e&1024)!==0){if(e=i.stateNode.containerInfo,a=e.nodeType,a===9)Cc(e);else if(a===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Cc(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(r(163))}if(e=i.sibling,e!==null){e.return=i.return,ut=e;break}ut=i.return}}function pm(e,i,a){var l=a.flags;switch(a.tag){case 0:case 11:case 15:ri(e,a),l&4&&Br(5,a);break;case 1:if(ri(e,a),l&4)if(e=a.stateNode,i===null)try{e.componentDidMount()}catch(d){$e(a,a.return,d)}else{var u=Bi(a.type,i.memoizedProps);i=i.memoizedState;try{e.componentDidUpdate(u,i,e.__reactInternalSnapshotBeforeUpdate)}catch(d){$e(a,a.return,d)}}l&64&&om(a),l&512&&qr(a,a.return);break;case 3:if(ri(e,a),l&64&&(e=a.updateQueue,e!==null)){if(i=null,a.child!==null)switch(a.child.tag){case 27:case 5:i=a.child.stateNode;break;case 1:i=a.child.stateNode}try{Zd(e,i)}catch(d){$e(a,a.return,d)}}break;case 27:i===null&&l&4&&hm(a);case 26:case 5:ri(e,a),i===null&&l&4&&cm(a),l&512&&qr(a,a.return);break;case 12:ri(e,a);break;case 13:ri(e,a),l&4&&gm(e,a),l&64&&(e=a.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(a=uS.bind(null,a),TS(e,a))));break;case 22:if(l=a.memoizedState!==null||zn,!l){i=i!==null&&i.memoizedState!==null||Ze,u=zn;var f=Ze;zn=l,(Ze=i)&&!f?ai(e,a,(a.subtreeFlags&8772)!==0):ri(e,a),zn=u,Ze=f}break;case 30:break;default:ri(e,a)}}function mm(e){var i=e.alternate;i!==null&&(e.alternate=null,mm(i)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(i=e.stateNode,i!==null&&Ko(i)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var Le=null,Dt=!1;function Un(e,i,a){for(a=a.child;a!==null;)ym(e,i,a),a=a.sibling}function ym(e,i,a){if(Bt&&typeof Bt.onCommitFiberUnmount=="function")try{Bt.onCommitFiberUnmount(rr,a)}catch{}switch(a.tag){case 26:Ze||yn(a,i),Un(e,i,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:Ze||yn(a,i);var l=Le,u=Dt;hi(a.type)&&(Le=a.stateNode,Dt=!1),Un(e,i,a),Ir(a.stateNode),Le=l,Dt=u;break;case 5:Ze||yn(a,i);case 6:if(l=Le,u=Dt,Le=null,Un(e,i,a),Le=l,Dt=u,Le!==null)if(Dt)try{(Le.nodeType===9?Le.body:Le.nodeName==="HTML"?Le.ownerDocument.body:Le).removeChild(a.stateNode)}catch(f){$e(a,i,f)}else try{Le.removeChild(a.stateNode)}catch(f){$e(a,i,f)}break;case 18:Le!==null&&(Dt?(e=Le,sy(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,a.stateNode),ta(e)):sy(Le,a.stateNode));break;case 4:l=Le,u=Dt,Le=a.stateNode.containerInfo,Dt=!0,Un(e,i,a),Le=l,Dt=u;break;case 0:case 11:case 14:case 15:Ze||si(2,a,i),Ze||si(4,a,i),Un(e,i,a);break;case 1:Ze||(yn(a,i),l=a.stateNode,typeof l.componentWillUnmount=="function"&&um(a,i,l)),Un(e,i,a);break;case 21:Un(e,i,a);break;case 22:Ze=(l=Ze)||a.memoizedState!==null,Un(e,i,a),Ze=l;break;default:Un(e,i,a)}}function gm(e,i){if(i.memoizedState===null&&(e=i.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{ta(e)}catch(a){$e(i,i.return,a)}}function tS(e){switch(e.tag){case 13:case 19:var i=e.stateNode;return i===null&&(i=e.stateNode=new dm),i;case 22:return e=e.stateNode,i=e._retryCache,i===null&&(i=e._retryCache=new dm),i;default:throw Error(r(435,e.tag))}}function lc(e,i){var a=tS(e);i.forEach(function(l){var u=cS.bind(null,e,l);a.has(l)||(a.add(l),l.then(u,u))})}function Lt(e,i){var a=i.deletions;if(a!==null)for(var l=0;l<a.length;l++){var u=a[l],f=e,d=i,b=d;e:for(;b!==null;){switch(b.tag){case 27:if(hi(b.type)){Le=b.stateNode,Dt=!1;break e}break;case 5:Le=b.stateNode,Dt=!1;break e;case 3:case 4:Le=b.stateNode.containerInfo,Dt=!0;break e}b=b.return}if(Le===null)throw Error(r(160));ym(f,d,u),Le=null,Dt=!1,f=u.alternate,f!==null&&(f.return=null),u.return=null}if(i.subtreeFlags&13878)for(i=i.child;i!==null;)bm(i,e),i=i.sibling}var un=null;function bm(e,i){var a=e.alternate,l=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Lt(i,e),Vt(e),l&4&&(si(3,e,e.return),Br(3,e),si(5,e,e.return));break;case 1:Lt(i,e),Vt(e),l&512&&(Ze||a===null||yn(a,a.return)),l&64&&zn&&(e=e.updateQueue,e!==null&&(l=e.callbacks,l!==null&&(a=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=a===null?l:a.concat(l))));break;case 26:var u=un;if(Lt(i,e),Vt(e),l&512&&(Ze||a===null||yn(a,a.return)),l&4){var f=a!==null?a.memoizedState:null;if(l=e.memoizedState,a===null)if(l===null)if(e.stateNode===null){e:{l=e.type,a=e.memoizedProps,u=u.ownerDocument||u;t:switch(l){case"title":f=u.getElementsByTagName("title")[0],(!f||f[or]||f[St]||f.namespaceURI==="http://www.w3.org/2000/svg"||f.hasAttribute("itemprop"))&&(f=u.createElement(l),u.head.insertBefore(f,u.querySelector("head > title"))),gt(f,l,a),f[St]=e,lt(f),l=f;break e;case"link":var d=hy("link","href",u).get(l+(a.href||""));if(d){for(var b=0;b<d.length;b++)if(f=d[b],f.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&f.getAttribute("rel")===(a.rel==null?null:a.rel)&&f.getAttribute("title")===(a.title==null?null:a.title)&&f.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){d.splice(b,1);break t}}f=u.createElement(l),gt(f,l,a),u.head.appendChild(f);break;case"meta":if(d=hy("meta","content",u).get(l+(a.content||""))){for(b=0;b<d.length;b++)if(f=d[b],f.getAttribute("content")===(a.content==null?null:""+a.content)&&f.getAttribute("name")===(a.name==null?null:a.name)&&f.getAttribute("property")===(a.property==null?null:a.property)&&f.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&f.getAttribute("charset")===(a.charSet==null?null:a.charSet)){d.splice(b,1);break t}}f=u.createElement(l),gt(f,l,a),u.head.appendChild(f);break;default:throw Error(r(468,l))}f[St]=e,lt(f),l=f}e.stateNode=l}else dy(u,e.type,e.stateNode);else e.stateNode=fy(u,l,e.memoizedProps);else f!==l?(f===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):f.count--,l===null?dy(u,e.type,e.stateNode):fy(u,l,e.memoizedProps)):l===null&&e.stateNode!==null&&ic(e,e.memoizedProps,a.memoizedProps)}break;case 27:Lt(i,e),Vt(e),l&512&&(Ze||a===null||yn(a,a.return)),a!==null&&l&4&&ic(e,e.memoizedProps,a.memoizedProps);break;case 5:if(Lt(i,e),Vt(e),l&512&&(Ze||a===null||yn(a,a.return)),e.flags&32){u=e.stateNode;try{rs(u,"")}catch(R){$e(e,e.return,R)}}l&4&&e.stateNode!=null&&(u=e.memoizedProps,ic(e,u,a!==null?a.memoizedProps:u)),l&1024&&(ac=!0);break;case 6:if(Lt(i,e),Vt(e),l&4){if(e.stateNode===null)throw Error(r(162));l=e.memoizedProps,a=e.stateNode;try{a.nodeValue=l}catch(R){$e(e,e.return,R)}}break;case 3:if(Dl=null,u=un,un=Ml(i.containerInfo),Lt(i,e),un=u,Vt(e),l&4&&a!==null&&a.memoizedState.isDehydrated)try{ta(i.containerInfo)}catch(R){$e(e,e.return,R)}ac&&(ac=!1,vm(e));break;case 4:l=un,un=Ml(e.stateNode.containerInfo),Lt(i,e),Vt(e),un=l;break;case 12:Lt(i,e),Vt(e);break;case 13:Lt(i,e),Vt(e),e.child.flags&8192&&e.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(dc=dn()),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,lc(e,l)));break;case 22:u=e.memoizedState!==null;var S=a!==null&&a.memoizedState!==null,_=zn,$=Ze;if(zn=_||u,Ze=$||S,Lt(i,e),Ze=$,zn=_,Vt(e),l&8192)e:for(i=e.stateNode,i._visibility=u?i._visibility&-2:i._visibility|1,u&&(a===null||S||zn||Ze||qi(e)),a=null,i=e;;){if(i.tag===5||i.tag===26){if(a===null){S=a=i;try{if(f=S.stateNode,u)d=f.style,typeof d.setProperty=="function"?d.setProperty("display","none","important"):d.display="none";else{b=S.stateNode;var C=S.memoizedProps.style,T=C!=null&&C.hasOwnProperty("display")?C.display:null;b.style.display=T==null||typeof T=="boolean"?"":(""+T).trim()}}catch(R){$e(S,S.return,R)}}}else if(i.tag===6){if(a===null){S=i;try{S.stateNode.nodeValue=u?"":S.memoizedProps}catch(R){$e(S,S.return,R)}}}else if((i.tag!==22&&i.tag!==23||i.memoizedState===null||i===e)&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===e)break e;for(;i.sibling===null;){if(i.return===null||i.return===e)break e;a===i&&(a=null),i=i.return}a===i&&(a=null),i.sibling.return=i.return,i=i.sibling}l&4&&(l=e.updateQueue,l!==null&&(a=l.retryQueue,a!==null&&(l.retryQueue=null,lc(e,a))));break;case 19:Lt(i,e),Vt(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,lc(e,l)));break;case 30:break;case 21:break;default:Lt(i,e),Vt(e)}}function Vt(e){var i=e.flags;if(i&2){try{for(var a,l=e.return;l!==null;){if(fm(l)){a=l;break}l=l.return}if(a==null)throw Error(r(160));switch(a.tag){case 27:var u=a.stateNode,f=sc(e);bl(e,f,u);break;case 5:var d=a.stateNode;a.flags&32&&(rs(d,""),a.flags&=-33);var b=sc(e);bl(e,b,d);break;case 3:case 4:var S=a.stateNode.containerInfo,_=sc(e);rc(e,_,S);break;default:throw Error(r(161))}}catch($){$e(e,e.return,$)}e.flags&=-3}i&4096&&(e.flags&=-4097)}function vm(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var i=e;vm(i),i.tag===5&&i.flags&1024&&i.stateNode.reset(),e=e.sibling}}function ri(e,i){if(i.subtreeFlags&8772)for(i=i.child;i!==null;)pm(e,i.alternate,i),i=i.sibling}function qi(e){for(e=e.child;e!==null;){var i=e;switch(i.tag){case 0:case 11:case 14:case 15:si(4,i,i.return),qi(i);break;case 1:yn(i,i.return);var a=i.stateNode;typeof a.componentWillUnmount=="function"&&um(i,i.return,a),qi(i);break;case 27:Ir(i.stateNode);case 26:case 5:yn(i,i.return),qi(i);break;case 22:i.memoizedState===null&&qi(i);break;case 30:qi(i);break;default:qi(i)}e=e.sibling}}function ai(e,i,a){for(a=a&&(i.subtreeFlags&8772)!==0,i=i.child;i!==null;){var l=i.alternate,u=e,f=i,d=f.flags;switch(f.tag){case 0:case 11:case 15:ai(u,f,a),Br(4,f);break;case 1:if(ai(u,f,a),l=f,u=l.stateNode,typeof u.componentDidMount=="function")try{u.componentDidMount()}catch(_){$e(l,l.return,_)}if(l=f,u=l.updateQueue,u!==null){var b=l.stateNode;try{var S=u.shared.hiddenCallbacks;if(S!==null)for(u.shared.hiddenCallbacks=null,u=0;u<S.length;u++)Xd(S[u],b)}catch(_){$e(l,l.return,_)}}a&&d&64&&om(f),qr(f,f.return);break;case 27:hm(f);case 26:case 5:ai(u,f,a),a&&l===null&&d&4&&cm(f),qr(f,f.return);break;case 12:ai(u,f,a);break;case 13:ai(u,f,a),a&&d&4&&gm(u,f);break;case 22:f.memoizedState===null&&ai(u,f,a),qr(f,f.return);break;case 30:break;default:ai(u,f,a)}i=i.sibling}}function oc(e,i){var a=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),e=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(e=i.memoizedState.cachePool.pool),e!==a&&(e!=null&&e.refCount++,a!=null&&xr(a))}function uc(e,i){e=null,i.alternate!==null&&(e=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==e&&(i.refCount++,e!=null&&xr(e))}function gn(e,i,a,l){if(i.subtreeFlags&10256)for(i=i.child;i!==null;)Sm(e,i,a,l),i=i.sibling}function Sm(e,i,a,l){var u=i.flags;switch(i.tag){case 0:case 11:case 15:gn(e,i,a,l),u&2048&&Br(9,i);break;case 1:gn(e,i,a,l);break;case 3:gn(e,i,a,l),u&2048&&(e=null,i.alternate!==null&&(e=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==e&&(i.refCount++,e!=null&&xr(e)));break;case 12:if(u&2048){gn(e,i,a,l),e=i.stateNode;try{var f=i.memoizedProps,d=f.id,b=f.onPostCommit;typeof b=="function"&&b(d,i.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(S){$e(i,i.return,S)}}else gn(e,i,a,l);break;case 13:gn(e,i,a,l);break;case 23:break;case 22:f=i.stateNode,d=i.alternate,i.memoizedState!==null?f._visibility&2?gn(e,i,a,l):Kr(e,i):f._visibility&2?gn(e,i,a,l):(f._visibility|=2,Os(e,i,a,l,(i.subtreeFlags&10256)!==0)),u&2048&&oc(d,i);break;case 24:gn(e,i,a,l),u&2048&&uc(i.alternate,i);break;default:gn(e,i,a,l)}}function Os(e,i,a,l,u){for(u=u&&(i.subtreeFlags&10256)!==0,i=i.child;i!==null;){var f=e,d=i,b=a,S=l,_=d.flags;switch(d.tag){case 0:case 11:case 15:Os(f,d,b,S,u),Br(8,d);break;case 23:break;case 22:var $=d.stateNode;d.memoizedState!==null?$._visibility&2?Os(f,d,b,S,u):Kr(f,d):($._visibility|=2,Os(f,d,b,S,u)),u&&_&2048&&oc(d.alternate,d);break;case 24:Os(f,d,b,S,u),u&&_&2048&&uc(d.alternate,d);break;default:Os(f,d,b,S,u)}i=i.sibling}}function Kr(e,i){if(i.subtreeFlags&10256)for(i=i.child;i!==null;){var a=e,l=i,u=l.flags;switch(l.tag){case 22:Kr(a,l),u&2048&&oc(l.alternate,l);break;case 24:Kr(a,l),u&2048&&uc(l.alternate,l);break;default:Kr(a,l)}i=i.sibling}}var jr=8192;function Es(e){if(e.subtreeFlags&jr)for(e=e.child;e!==null;)Am(e),e=e.sibling}function Am(e){switch(e.tag){case 26:Es(e),e.flags&jr&&e.memoizedState!==null&&jS(un,e.memoizedState,e.memoizedProps);break;case 5:Es(e);break;case 3:case 4:var i=un;un=Ml(e.stateNode.containerInfo),Es(e),un=i;break;case 22:e.memoizedState===null&&(i=e.alternate,i!==null&&i.memoizedState!==null?(i=jr,jr=16777216,Es(e),jr=i):Es(e));break;default:Es(e)}}function wm(e){var i=e.alternate;if(i!==null&&(e=i.child,e!==null)){i.child=null;do i=e.sibling,e.sibling=null,e=i;while(e!==null)}}function Lr(e){var i=e.deletions;if((e.flags&16)!==0){if(i!==null)for(var a=0;a<i.length;a++){var l=i[a];ut=l,Om(l,e)}wm(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)xm(e),e=e.sibling}function xm(e){switch(e.tag){case 0:case 11:case 15:Lr(e),e.flags&2048&&si(9,e,e.return);break;case 3:Lr(e);break;case 12:Lr(e);break;case 22:var i=e.stateNode;e.memoizedState!==null&&i._visibility&2&&(e.return===null||e.return.tag!==13)?(i._visibility&=-3,vl(e)):Lr(e);break;default:Lr(e)}}function vl(e){var i=e.deletions;if((e.flags&16)!==0){if(i!==null)for(var a=0;a<i.length;a++){var l=i[a];ut=l,Om(l,e)}wm(e)}for(e=e.child;e!==null;){switch(i=e,i.tag){case 0:case 11:case 15:si(8,i,i.return),vl(i);break;case 22:a=i.stateNode,a._visibility&2&&(a._visibility&=-3,vl(i));break;default:vl(i)}e=e.sibling}}function Om(e,i){for(;ut!==null;){var a=ut;switch(a.tag){case 0:case 11:case 15:si(8,a,i);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:xr(a.memoizedState.cache)}if(l=a.child,l!==null)l.return=a,ut=l;else e:for(a=e;ut!==null;){l=ut;var u=l.sibling,f=l.return;if(mm(l),l===a){ut=null;break e}if(u!==null){u.return=f,ut=u;break e}ut=f}}}var nS={getCacheForType:function(e){var i=At(st),a=i.data.get(e);return a===void 0&&(a=e(),i.data.set(e,a)),a}},iS=typeof WeakMap=="function"?WeakMap:Map,Oe=0,Be=null,pe=null,be=0,Ee=0,Ht=null,li=!1,_s=!1,cc=!1,Bn=0,Ye=0,oi=0,Ki=0,fc=0,nn=0,Ts=0,Vr=null,Ct=null,hc=!1,dc=0,Sl=1/0,Al=null,ui=null,yt=0,ci=null,Rs=null,ks=0,pc=0,mc=null,Em=null,Hr=0,yc=null;function Gt(){if((Oe&2)!==0&&be!==0)return be&-be;if(M.T!==null){var e=ys;return e!==0?e:xc()}return Lh()}function _m(){nn===0&&(nn=(be&536870912)===0||we?Bh():536870912);var e=tn.current;return e!==null&&(e.flags|=32),nn}function Yt(e,i,a){(e===Be&&(Ee===2||Ee===9)||e.cancelPendingCommit!==null)&&(Ns(e,0),fi(e,be,nn,!1)),lr(e,a),((Oe&2)===0||e!==Be)&&(e===Be&&((Oe&2)===0&&(Ki|=a),Ye===4&&fi(e,be,nn,!1)),bn(e))}function Tm(e,i,a){if((Oe&6)!==0)throw Error(r(327));var l=!a&&(i&124)===0&&(i&e.expiredLanes)===0||ar(e,i),u=l?aS(e,i):vc(e,i,!0),f=l;do{if(u===0){_s&&!l&&fi(e,i,0,!1);break}else{if(a=e.current.alternate,f&&!sS(a)){u=vc(e,i,!1),f=!1;continue}if(u===2){if(f=i,e.errorRecoveryDisabledLanes&f)var d=0;else d=e.pendingLanes&-536870913,d=d!==0?d:d&536870912?536870912:0;if(d!==0){i=d;e:{var b=e;u=Vr;var S=b.current.memoizedState.isDehydrated;if(S&&(Ns(b,d).flags|=256),d=vc(b,d,!1),d!==2){if(cc&&!S){b.errorRecoveryDisabledLanes|=f,Ki|=f,u=4;break e}f=Ct,Ct=u,f!==null&&(Ct===null?Ct=f:Ct.push.apply(Ct,f))}u=d}if(f=!1,u!==2)continue}}if(u===1){Ns(e,0),fi(e,i,0,!0);break}e:{switch(l=e,f=u,f){case 0:case 1:throw Error(r(345));case 4:if((i&4194048)!==i)break;case 6:fi(l,i,nn,!li);break e;case 2:Ct=null;break;case 3:case 5:break;default:throw Error(r(329))}if((i&62914560)===i&&(u=dc+300-dn(),10<u)){if(fi(l,i,nn,!li),$a(l,0,!0)!==0)break e;l.timeoutHandle=ny(Rm.bind(null,l,a,Ct,Al,hc,i,nn,Ki,Ts,li,f,2,-0,0),u);break e}Rm(l,a,Ct,Al,hc,i,nn,Ki,Ts,li,f,0,-0,0)}}break}while(!0);bn(e)}function Rm(e,i,a,l,u,f,d,b,S,_,$,C,T,R){if(e.timeoutHandle=-1,C=i.subtreeFlags,(C&8192||(C&16785408)===16785408)&&(Qr={stylesheets:null,count:0,unsuspend:KS},Am(i),C=LS(),C!==null)){e.cancelPendingCommit=C(zm.bind(null,e,i,f,a,l,u,d,b,S,$,1,T,R)),fi(e,f,d,!_);return}zm(e,i,f,a,l,u,d,b,S)}function sS(e){for(var i=e;;){var a=i.tag;if((a===0||a===11||a===15)&&i.flags&16384&&(a=i.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var l=0;l<a.length;l++){var u=a[l],f=u.getSnapshot;u=u.value;try{if(!Kt(f(),u))return!1}catch{return!1}}if(a=i.child,i.subtreeFlags&16384&&a!==null)a.return=i,i=a;else{if(i===e)break;for(;i.sibling===null;){if(i.return===null||i.return===e)return!0;i=i.return}i.sibling.return=i.return,i=i.sibling}}return!0}function fi(e,i,a,l){i&=~fc,i&=~Ki,e.suspendedLanes|=i,e.pingedLanes&=~i,l&&(e.warmLanes|=i),l=e.expirationTimes;for(var u=i;0<u;){var f=31-qt(u),d=1<<f;l[f]=-1,u&=~d}a!==0&&Kh(e,a,i)}function wl(){return(Oe&6)===0?(Gr(0),!1):!0}function gc(){if(pe!==null){if(Ee===0)var e=pe.return;else e=pe,kn=Di=null,Cu(e),ws=null,Cr=0,e=pe;for(;e!==null;)lm(e.alternate,e),e=e.return;pe=null}}function Ns(e,i){var a=e.timeoutHandle;a!==-1&&(e.timeoutHandle=-1,wS(a)),a=e.cancelPendingCommit,a!==null&&(e.cancelPendingCommit=null,a()),gc(),Be=e,pe=a=_n(e.current,null),be=i,Ee=0,Ht=null,li=!1,_s=ar(e,i),cc=!1,Ts=nn=fc=Ki=oi=Ye=0,Ct=Vr=null,hc=!1,(i&8)!==0&&(i|=i&32);var l=e.entangledLanes;if(l!==0)for(e=e.entanglements,l&=i;0<l;){var u=31-qt(l),f=1<<u;i|=e[u],l&=~f}return Bn=i,Ga(),a}function km(e,i){fe=null,M.H=ul,i===Er||i===Pa?(i=Jd(),Ee=3):i===Hd?(i=Jd(),Ee=4):Ee=i===Ip?8:i!==null&&typeof i=="object"&&typeof i.then=="function"?6:1,Ht=i,pe===null&&(Ye=1,pl(e,Ft(i,e.current)))}function Nm(){var e=M.H;return M.H=ul,e===null?ul:e}function Mm(){var e=M.A;return M.A=nS,e}function bc(){Ye=4,li||(be&4194048)!==be&&tn.current!==null||(_s=!0),(oi&134217727)===0&&(Ki&134217727)===0||Be===null||fi(Be,be,nn,!1)}function vc(e,i,a){var l=Oe;Oe|=2;var u=Nm(),f=Mm();(Be!==e||be!==i)&&(Al=null,Ns(e,i)),i=!1;var d=Ye;e:do try{if(Ee!==0&&pe!==null){var b=pe,S=Ht;switch(Ee){case 8:gc(),d=6;break e;case 3:case 2:case 9:case 6:tn.current===null&&(i=!0);var _=Ee;if(Ee=0,Ht=null,Ms(e,b,S,_),a&&_s){d=0;break e}break;default:_=Ee,Ee=0,Ht=null,Ms(e,b,S,_)}}rS(),d=Ye;break}catch($){km(e,$)}while(!0);return i&&e.shellSuspendCounter++,kn=Di=null,Oe=l,M.H=u,M.A=f,pe===null&&(Be=null,be=0,Ga()),d}function rS(){for(;pe!==null;)$m(pe)}function aS(e,i){var a=Oe;Oe|=2;var l=Nm(),u=Mm();Be!==e||be!==i?(Al=null,Sl=dn()+500,Ns(e,i)):_s=ar(e,i);e:do try{if(Ee!==0&&pe!==null){i=pe;var f=Ht;t:switch(Ee){case 1:Ee=0,Ht=null,Ms(e,i,f,1);break;case 2:case 9:if(Gd(f)){Ee=0,Ht=null,Dm(i);break}i=function(){Ee!==2&&Ee!==9||Be!==e||(Ee=7),bn(e)},f.then(i,i);break e;case 3:Ee=7;break e;case 4:Ee=5;break e;case 7:Gd(f)?(Ee=0,Ht=null,Dm(i)):(Ee=0,Ht=null,Ms(e,i,f,7));break;case 5:var d=null;switch(pe.tag){case 26:d=pe.memoizedState;case 5:case 27:var b=pe;if(!d||py(d)){Ee=0,Ht=null;var S=b.sibling;if(S!==null)pe=S;else{var _=b.return;_!==null?(pe=_,xl(_)):pe=null}break t}}Ee=0,Ht=null,Ms(e,i,f,5);break;case 6:Ee=0,Ht=null,Ms(e,i,f,6);break;case 8:gc(),Ye=6;break e;default:throw Error(r(462))}}lS();break}catch($){km(e,$)}while(!0);return kn=Di=null,M.H=l,M.A=u,Oe=a,pe!==null?0:(Be=null,be=0,Ga(),Ye)}function lS(){for(;pe!==null&&!k0();)$m(pe)}function $m(e){var i=rm(e.alternate,e,Bn);e.memoizedProps=e.pendingProps,i===null?xl(e):pe=i}function Dm(e){var i=e,a=i.alternate;switch(i.tag){case 15:case 0:i=Pp(a,i,i.pendingProps,i.type,void 0,be);break;case 11:i=Pp(a,i,i.pendingProps,i.type.render,i.ref,be);break;case 5:Cu(i);default:lm(a,i),i=pe=Cd(i,Bn),i=rm(a,i,Bn)}e.memoizedProps=e.pendingProps,i===null?xl(e):pe=i}function Ms(e,i,a,l){kn=Di=null,Cu(i),ws=null,Cr=0;var u=i.return;try{if(Q1(e,u,i,a,be)){Ye=1,pl(e,Ft(a,e.current)),pe=null;return}}catch(f){if(u!==null)throw pe=u,f;Ye=1,pl(e,Ft(a,e.current)),pe=null;return}i.flags&32768?(we||l===1?e=!0:_s||(be&536870912)!==0?e=!1:(li=e=!0,(l===2||l===9||l===3||l===6)&&(l=tn.current,l!==null&&l.tag===13&&(l.flags|=16384))),Cm(i,e)):xl(i)}function xl(e){var i=e;do{if((i.flags&32768)!==0){Cm(i,li);return}e=i.return;var a=W1(i.alternate,i,Bn);if(a!==null){pe=a;return}if(i=i.sibling,i!==null){pe=i;return}pe=i=e}while(i!==null);Ye===0&&(Ye=5)}function Cm(e,i){do{var a=P1(e.alternate,e);if(a!==null){a.flags&=32767,pe=a;return}if(a=e.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!i&&(e=e.sibling,e!==null)){pe=e;return}pe=e=a}while(e!==null);Ye=6,pe=null}function zm(e,i,a,l,u,f,d,b,S){e.cancelPendingCommit=null;do Ol();while(yt!==0);if((Oe&6)!==0)throw Error(r(327));if(i!==null){if(i===e.current)throw Error(r(177));if(f=i.lanes|i.childLanes,f|=uu,K0(e,a,f,d,b,S),e===Be&&(pe=Be=null,be=0),Rs=i,ci=e,ks=a,pc=f,mc=u,Em=l,(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,fS(ka,function(){return jm(),null})):(e.callbackNode=null,e.callbackPriority=0),l=(i.flags&13878)!==0,(i.subtreeFlags&13878)!==0||l){l=M.T,M.T=null,u=V.p,V.p=2,d=Oe,Oe|=4;try{eS(e,i,a)}finally{Oe=d,V.p=u,M.T=l}}yt=1,Um(),Bm(),qm()}}function Um(){if(yt===1){yt=0;var e=ci,i=Rs,a=(i.flags&13878)!==0;if((i.subtreeFlags&13878)!==0||a){a=M.T,M.T=null;var l=V.p;V.p=2;var u=Oe;Oe|=4;try{bm(i,e);var f=Mc,d=Od(e.containerInfo),b=f.focusedElem,S=f.selectionRange;if(d!==b&&b&&b.ownerDocument&&xd(b.ownerDocument.documentElement,b)){if(S!==null&&su(b)){var _=S.start,$=S.end;if($===void 0&&($=_),"selectionStart"in b)b.selectionStart=_,b.selectionEnd=Math.min($,b.value.length);else{var C=b.ownerDocument||document,T=C&&C.defaultView||window;if(T.getSelection){var R=T.getSelection(),se=b.textContent.length,P=Math.min(S.start,se),Ne=S.end===void 0?P:Math.min(S.end,se);!R.extend&&P>Ne&&(d=Ne,Ne=P,P=d);var O=wd(b,P),w=wd(b,Ne);if(O&&w&&(R.rangeCount!==1||R.anchorNode!==O.node||R.anchorOffset!==O.offset||R.focusNode!==w.node||R.focusOffset!==w.offset)){var E=C.createRange();E.setStart(O.node,O.offset),R.removeAllRanges(),P>Ne?(R.addRange(E),R.extend(w.node,w.offset)):(E.setEnd(w.node,w.offset),R.addRange(E))}}}}for(C=[],R=b;R=R.parentNode;)R.nodeType===1&&C.push({element:R,left:R.scrollLeft,top:R.scrollTop});for(typeof b.focus=="function"&&b.focus(),b=0;b<C.length;b++){var D=C[b];D.element.scrollLeft=D.left,D.element.scrollTop=D.top}}Ul=!!Nc,Mc=Nc=null}finally{Oe=u,V.p=l,M.T=a}}e.current=i,yt=2}}function Bm(){if(yt===2){yt=0;var e=ci,i=Rs,a=(i.flags&8772)!==0;if((i.subtreeFlags&8772)!==0||a){a=M.T,M.T=null;var l=V.p;V.p=2;var u=Oe;Oe|=4;try{pm(e,i.alternate,i)}finally{Oe=u,V.p=l,M.T=a}}yt=3}}function qm(){if(yt===4||yt===3){yt=0,N0();var e=ci,i=Rs,a=ks,l=Em;(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?yt=5:(yt=0,Rs=ci=null,Km(e,e.pendingLanes));var u=e.pendingLanes;if(u===0&&(ui=null),Bo(a),i=i.stateNode,Bt&&typeof Bt.onCommitFiberRoot=="function")try{Bt.onCommitFiberRoot(rr,i,void 0,(i.current.flags&128)===128)}catch{}if(l!==null){i=M.T,u=V.p,V.p=2,M.T=null;try{for(var f=e.onRecoverableError,d=0;d<l.length;d++){var b=l[d];f(b.value,{componentStack:b.stack})}}finally{M.T=i,V.p=u}}(ks&3)!==0&&Ol(),bn(e),u=e.pendingLanes,(a&4194090)!==0&&(u&42)!==0?e===yc?Hr++:(Hr=0,yc=e):Hr=0,Gr(0)}}function Km(e,i){(e.pooledCacheLanes&=i)===0&&(i=e.pooledCache,i!=null&&(e.pooledCache=null,xr(i)))}function Ol(e){return Um(),Bm(),qm(),jm()}function jm(){if(yt!==5)return!1;var e=ci,i=pc;pc=0;var a=Bo(ks),l=M.T,u=V.p;try{V.p=32>a?32:a,M.T=null,a=mc,mc=null;var f=ci,d=ks;if(yt=0,Rs=ci=null,ks=0,(Oe&6)!==0)throw Error(r(331));var b=Oe;if(Oe|=4,xm(f.current),Sm(f,f.current,d,a),Oe=b,Gr(0,!1),Bt&&typeof Bt.onPostCommitFiberRoot=="function")try{Bt.onPostCommitFiberRoot(rr,f)}catch{}return!0}finally{V.p=u,M.T=l,Km(e,i)}}function Lm(e,i,a){i=Ft(a,i),i=Xu(e.stateNode,i,2),e=ei(e,i,2),e!==null&&(lr(e,2),bn(e))}function $e(e,i,a){if(e.tag===3)Lm(e,e,a);else for(;i!==null;){if(i.tag===3){Lm(i,e,a);break}else if(i.tag===1){var l=i.stateNode;if(typeof i.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(ui===null||!ui.has(l))){e=Ft(a,e),a=Yp(2),l=ei(i,a,2),l!==null&&(Jp(a,l,i,e),lr(l,2),bn(l));break}}i=i.return}}function Sc(e,i,a){var l=e.pingCache;if(l===null){l=e.pingCache=new iS;var u=new Set;l.set(i,u)}else u=l.get(i),u===void 0&&(u=new Set,l.set(i,u));u.has(a)||(cc=!0,u.add(a),e=oS.bind(null,e,i,a),i.then(e,e))}function oS(e,i,a){var l=e.pingCache;l!==null&&l.delete(i),e.pingedLanes|=e.suspendedLanes&a,e.warmLanes&=~a,Be===e&&(be&a)===a&&(Ye===4||Ye===3&&(be&62914560)===be&&300>dn()-dc?(Oe&2)===0&&Ns(e,0):fc|=a,Ts===be&&(Ts=0)),bn(e)}function Vm(e,i){i===0&&(i=qh()),e=hs(e,i),e!==null&&(lr(e,i),bn(e))}function uS(e){var i=e.memoizedState,a=0;i!==null&&(a=i.retryLane),Vm(e,a)}function cS(e,i){var a=0;switch(e.tag){case 13:var l=e.stateNode,u=e.memoizedState;u!==null&&(a=u.retryLane);break;case 19:l=e.stateNode;break;case 22:l=e.stateNode._retryCache;break;default:throw Error(r(314))}l!==null&&l.delete(i),Vm(e,a)}function fS(e,i){return Do(e,i)}var El=null,$s=null,Ac=!1,_l=!1,wc=!1,ji=0;function bn(e){e!==$s&&e.next===null&&($s===null?El=$s=e:$s=$s.next=e),_l=!0,Ac||(Ac=!0,dS())}function Gr(e,i){if(!wc&&_l){wc=!0;do for(var a=!1,l=El;l!==null;){if(e!==0){var u=l.pendingLanes;if(u===0)var f=0;else{var d=l.suspendedLanes,b=l.pingedLanes;f=(1<<31-qt(42|e)+1)-1,f&=u&~(d&~b),f=f&201326741?f&201326741|1:f?f|2:0}f!==0&&(a=!0,Jm(l,f))}else f=be,f=$a(l,l===Be?f:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(f&3)===0||ar(l,f)||(a=!0,Jm(l,f));l=l.next}while(a);wc=!1}}function hS(){Hm()}function Hm(){_l=Ac=!1;var e=0;ji!==0&&(AS()&&(e=ji),ji=0);for(var i=dn(),a=null,l=El;l!==null;){var u=l.next,f=Gm(l,i);f===0?(l.next=null,a===null?El=u:a.next=u,u===null&&($s=a)):(a=l,(e!==0||(f&3)!==0)&&(_l=!0)),l=u}Gr(e)}function Gm(e,i){for(var a=e.suspendedLanes,l=e.pingedLanes,u=e.expirationTimes,f=e.pendingLanes&-62914561;0<f;){var d=31-qt(f),b=1<<d,S=u[d];S===-1?((b&a)===0||(b&l)!==0)&&(u[d]=q0(b,i)):S<=i&&(e.expiredLanes|=b),f&=~b}if(i=Be,a=be,a=$a(e,e===i?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l=e.callbackNode,a===0||e===i&&(Ee===2||Ee===9)||e.cancelPendingCommit!==null)return l!==null&&l!==null&&Co(l),e.callbackNode=null,e.callbackPriority=0;if((a&3)===0||ar(e,a)){if(i=a&-a,i===e.callbackPriority)return i;switch(l!==null&&Co(l),Bo(a)){case 2:case 8:a=zh;break;case 32:a=ka;break;case 268435456:a=Uh;break;default:a=ka}return l=Ym.bind(null,e),a=Do(a,l),e.callbackPriority=i,e.callbackNode=a,i}return l!==null&&l!==null&&Co(l),e.callbackPriority=2,e.callbackNode=null,2}function Ym(e,i){if(yt!==0&&yt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var a=e.callbackNode;if(Ol()&&e.callbackNode!==a)return null;var l=be;return l=$a(e,e===Be?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l===0?null:(Tm(e,l,i),Gm(e,dn()),e.callbackNode!=null&&e.callbackNode===a?Ym.bind(null,e):null)}function Jm(e,i){if(Ol())return null;Tm(e,i,!0)}function dS(){xS(function(){(Oe&6)!==0?Do(Ch,hS):Hm()})}function xc(){return ji===0&&(ji=Bh()),ji}function Im(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Ba(""+e)}function Xm(e,i){var a=i.ownerDocument.createElement("input");return a.name=i.name,a.value=i.value,e.id&&a.setAttribute("form",e.id),i.parentNode.insertBefore(a,i),e=new FormData(e),a.parentNode.removeChild(a),e}function pS(e,i,a,l,u){if(i==="submit"&&a&&a.stateNode===u){var f=Im((u[Nt]||null).action),d=l.submitter;d&&(i=(i=d[Nt]||null)?Im(i.formAction):d.getAttribute("formAction"),i!==null&&(f=i,d=null));var b=new La("action","action",null,l,u);e.push({event:b,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(ji!==0){var S=d?Xm(u,d):new FormData(u);Hu(a,{pending:!0,data:S,method:u.method,action:f},null,S)}}else typeof f=="function"&&(b.preventDefault(),S=d?Xm(u,d):new FormData(u),Hu(a,{pending:!0,data:S,method:u.method,action:f},f,S))},currentTarget:u}]})}}for(var Oc=0;Oc<ou.length;Oc++){var Ec=ou[Oc],mS=Ec.toLowerCase(),yS=Ec[0].toUpperCase()+Ec.slice(1);on(mS,"on"+yS)}on(Td,"onAnimationEnd"),on(Rd,"onAnimationIteration"),on(kd,"onAnimationStart"),on("dblclick","onDoubleClick"),on("focusin","onFocus"),on("focusout","onBlur"),on(D1,"onTransitionRun"),on(C1,"onTransitionStart"),on(z1,"onTransitionCancel"),on(Nd,"onTransitionEnd"),ns("onMouseEnter",["mouseout","mouseover"]),ns("onMouseLeave",["mouseout","mouseover"]),ns("onPointerEnter",["pointerout","pointerover"]),ns("onPointerLeave",["pointerout","pointerover"]),Oi("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Oi("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Oi("onBeforeInput",["compositionend","keypress","textInput","paste"]),Oi("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Oi("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Oi("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Yr="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(" "),gS=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Yr));function Zm(e,i){i=(i&4)!==0;for(var a=0;a<e.length;a++){var l=e[a],u=l.event;l=l.listeners;e:{var f=void 0;if(i)for(var d=l.length-1;0<=d;d--){var b=l[d],S=b.instance,_=b.currentTarget;if(b=b.listener,S!==f&&u.isPropagationStopped())break e;f=b,u.currentTarget=_;try{f(u)}catch($){dl($)}u.currentTarget=null,f=S}else for(d=0;d<l.length;d++){if(b=l[d],S=b.instance,_=b.currentTarget,b=b.listener,S!==f&&u.isPropagationStopped())break e;f=b,u.currentTarget=_;try{f(u)}catch($){dl($)}u.currentTarget=null,f=S}}}}function me(e,i){var a=i[qo];a===void 0&&(a=i[qo]=new Set);var l=e+"__bubble";a.has(l)||(Qm(i,e,2,!1),a.add(l))}function _c(e,i,a){var l=0;i&&(l|=4),Qm(a,e,l,i)}var Tl="_reactListening"+Math.random().toString(36).slice(2);function Tc(e){if(!e[Tl]){e[Tl]=!0,Hh.forEach(function(a){a!=="selectionchange"&&(gS.has(a)||_c(a,!1,e),_c(a,!0,e))});var i=e.nodeType===9?e:e.ownerDocument;i===null||i[Tl]||(i[Tl]=!0,_c("selectionchange",!1,i))}}function Qm(e,i,a,l){switch(Sy(i)){case 2:var u=GS;break;case 8:u=YS;break;default:u=Lc}a=u.bind(null,i,a,e),u=void 0,!Zo||i!=="touchstart"&&i!=="touchmove"&&i!=="wheel"||(u=!0),l?u!==void 0?e.addEventListener(i,a,{capture:!0,passive:u}):e.addEventListener(i,a,!0):u!==void 0?e.addEventListener(i,a,{passive:u}):e.addEventListener(i,a,!1)}function Rc(e,i,a,l,u){var f=l;if((i&1)===0&&(i&2)===0&&l!==null)e:for(;;){if(l===null)return;var d=l.tag;if(d===3||d===4){var b=l.stateNode.containerInfo;if(b===u)break;if(d===4)for(d=l.return;d!==null;){var S=d.tag;if((S===3||S===4)&&d.stateNode.containerInfo===u)return;d=d.return}for(;b!==null;){if(d=Pi(b),d===null)return;if(S=d.tag,S===5||S===6||S===26||S===27){l=f=d;continue e}b=b.parentNode}}l=l.return}id(function(){var _=f,$=Io(a),C=[];e:{var T=Md.get(e);if(T!==void 0){var R=La,se=e;switch(e){case"keypress":if(Ka(a)===0)break e;case"keydown":case"keyup":R=f1;break;case"focusin":se="focus",R=Po;break;case"focusout":se="blur",R=Po;break;case"beforeblur":case"afterblur":R=Po;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":R=ad;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":R=P0;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":R=p1;break;case Td:case Rd:case kd:R=n1;break;case Nd:R=y1;break;case"scroll":case"scrollend":R=F0;break;case"wheel":R=b1;break;case"copy":case"cut":case"paste":R=s1;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":R=od;break;case"toggle":case"beforetoggle":R=S1}var P=(i&4)!==0,Ne=!P&&(e==="scroll"||e==="scrollend"),O=P?T!==null?T+"Capture":null:T;P=[];for(var w=_,E;w!==null;){var D=w;if(E=D.stateNode,D=D.tag,D!==5&&D!==26&&D!==27||E===null||O===null||(D=cr(w,O),D!=null&&P.push(Jr(w,D,E))),Ne)break;w=w.return}0<P.length&&(T=new R(T,se,null,a,$),C.push({event:T,listeners:P}))}}if((i&7)===0){e:{if(T=e==="mouseover"||e==="pointerover",R=e==="mouseout"||e==="pointerout",T&&a!==Jo&&(se=a.relatedTarget||a.fromElement)&&(Pi(se)||se[Wi]))break e;if((R||T)&&(T=$.window===$?$:(T=$.ownerDocument)?T.defaultView||T.parentWindow:window,R?(se=a.relatedTarget||a.toElement,R=_,se=se?Pi(se):null,se!==null&&(Ne=c(se),P=se.tag,se!==Ne||P!==5&&P!==27&&P!==6)&&(se=null)):(R=null,se=_),R!==se)){if(P=ad,D="onMouseLeave",O="onMouseEnter",w="mouse",(e==="pointerout"||e==="pointerover")&&(P=od,D="onPointerLeave",O="onPointerEnter",w="pointer"),Ne=R==null?T:ur(R),E=se==null?T:ur(se),T=new P(D,w+"leave",R,a,$),T.target=Ne,T.relatedTarget=E,D=null,Pi($)===_&&(P=new P(O,w+"enter",se,a,$),P.target=E,P.relatedTarget=Ne,D=P),Ne=D,R&&se)t:{for(P=R,O=se,w=0,E=P;E;E=Ds(E))w++;for(E=0,D=O;D;D=Ds(D))E++;for(;0<w-E;)P=Ds(P),w--;for(;0<E-w;)O=Ds(O),E--;for(;w--;){if(P===O||O!==null&&P===O.alternate)break t;P=Ds(P),O=Ds(O)}P=null}else P=null;R!==null&&Fm(C,T,R,P,!1),se!==null&&Ne!==null&&Fm(C,Ne,se,P,!0)}}e:{if(T=_?ur(_):window,R=T.nodeName&&T.nodeName.toLowerCase(),R==="select"||R==="input"&&T.type==="file")var J=yd;else if(pd(T))if(gd)J=N1;else{J=R1;var he=T1}else R=T.nodeName,!R||R.toLowerCase()!=="input"||T.type!=="checkbox"&&T.type!=="radio"?_&&Yo(_.elementType)&&(J=yd):J=k1;if(J&&(J=J(e,_))){md(C,J,a,$);break e}he&&he(e,T,_),e==="focusout"&&_&&T.type==="number"&&_.memoizedProps.value!=null&&Go(T,"number",T.value)}switch(he=_?ur(_):window,e){case"focusin":(pd(he)||he.contentEditable==="true")&&(us=he,ru=_,br=null);break;case"focusout":br=ru=us=null;break;case"mousedown":au=!0;break;case"contextmenu":case"mouseup":case"dragend":au=!1,Ed(C,a,$);break;case"selectionchange":if($1)break;case"keydown":case"keyup":Ed(C,a,$)}var Q;if(tu)e:{switch(e){case"compositionstart":var ee="onCompositionStart";break e;case"compositionend":ee="onCompositionEnd";break e;case"compositionupdate":ee="onCompositionUpdate";break e}ee=void 0}else os?hd(e,a)&&(ee="onCompositionEnd"):e==="keydown"&&a.keyCode===229&&(ee="onCompositionStart");ee&&(ud&&a.locale!=="ko"&&(os||ee!=="onCompositionStart"?ee==="onCompositionEnd"&&os&&(Q=sd()):(Qn=$,Qo="value"in Qn?Qn.value:Qn.textContent,os=!0)),he=Rl(_,ee),0<he.length&&(ee=new ld(ee,e,null,a,$),C.push({event:ee,listeners:he}),Q?ee.data=Q:(Q=dd(a),Q!==null&&(ee.data=Q)))),(Q=w1?x1(e,a):O1(e,a))&&(ee=Rl(_,"onBeforeInput"),0<ee.length&&(he=new ld("onBeforeInput","beforeinput",null,a,$),C.push({event:he,listeners:ee}),he.data=Q)),pS(C,e,_,a,$)}Zm(C,i)})}function Jr(e,i,a){return{instance:e,listener:i,currentTarget:a}}function Rl(e,i){for(var a=i+"Capture",l=[];e!==null;){var u=e,f=u.stateNode;if(u=u.tag,u!==5&&u!==26&&u!==27||f===null||(u=cr(e,a),u!=null&&l.unshift(Jr(e,u,f)),u=cr(e,i),u!=null&&l.push(Jr(e,u,f))),e.tag===3)return l;e=e.return}return[]}function Ds(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Fm(e,i,a,l,u){for(var f=i._reactName,d=[];a!==null&&a!==l;){var b=a,S=b.alternate,_=b.stateNode;if(b=b.tag,S!==null&&S===l)break;b!==5&&b!==26&&b!==27||_===null||(S=_,u?(_=cr(a,f),_!=null&&d.unshift(Jr(a,_,S))):u||(_=cr(a,f),_!=null&&d.push(Jr(a,_,S)))),a=a.return}d.length!==0&&e.push({event:i,listeners:d})}var bS=/\r\n?/g,vS=/\u0000|\uFFFD/g;function Wm(e){return(typeof e=="string"?e:""+e).replace(bS,`
62
- `).replace(vS,"")}function Pm(e,i){return i=Wm(i),Wm(e)===i}function kl(){}function ke(e,i,a,l,u,f){switch(a){case"children":typeof l=="string"?i==="body"||i==="textarea"&&l===""||rs(e,l):(typeof l=="number"||typeof l=="bigint")&&i!=="body"&&rs(e,""+l);break;case"className":Ca(e,"class",l);break;case"tabIndex":Ca(e,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":Ca(e,a,l);break;case"style":td(e,l,f);break;case"data":if(i!=="object"){Ca(e,"data",l);break}case"src":case"href":if(l===""&&(i!=="a"||a!=="href")){e.removeAttribute(a);break}if(l==null||typeof l=="function"||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(a);break}l=Ba(""+l),e.setAttribute(a,l);break;case"action":case"formAction":if(typeof l=="function"){e.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 f=="function"&&(a==="formAction"?(i!=="input"&&ke(e,i,"name",u.name,u,null),ke(e,i,"formEncType",u.formEncType,u,null),ke(e,i,"formMethod",u.formMethod,u,null),ke(e,i,"formTarget",u.formTarget,u,null)):(ke(e,i,"encType",u.encType,u,null),ke(e,i,"method",u.method,u,null),ke(e,i,"target",u.target,u,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(a);break}l=Ba(""+l),e.setAttribute(a,l);break;case"onClick":l!=null&&(e.onclick=kl);break;case"onScroll":l!=null&&me("scroll",e);break;case"onScrollEnd":l!=null&&me("scrollend",e);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(r(61));if(a=l.__html,a!=null){if(u.children!=null)throw Error(r(60));e.innerHTML=a}}break;case"multiple":e.multiple=l&&typeof l!="function"&&typeof l!="symbol";break;case"muted":e.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"){e.removeAttribute("xlink:href");break}a=Ba(""+l),e.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"?e.setAttribute(a,""+l):e.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"?e.setAttribute(a,""):e.removeAttribute(a);break;case"capture":case"download":l===!0?e.setAttribute(a,""):l!==!1&&l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(a,l):e.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":l!=null&&typeof l!="function"&&typeof l!="symbol"&&!isNaN(l)&&1<=l?e.setAttribute(a,l):e.removeAttribute(a);break;case"rowSpan":case"start":l==null||typeof l=="function"||typeof l=="symbol"||isNaN(l)?e.removeAttribute(a):e.setAttribute(a,l);break;case"popover":me("beforetoggle",e),me("toggle",e),Da(e,"popover",l);break;case"xlinkActuate":On(e,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":On(e,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":On(e,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":On(e,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":On(e,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":On(e,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":On(e,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":On(e,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":On(e,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":Da(e,"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=Z0.get(a)||a,Da(e,a,l))}}function kc(e,i,a,l,u,f){switch(a){case"style":td(e,l,f);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(r(61));if(a=l.__html,a!=null){if(u.children!=null)throw Error(r(60));e.innerHTML=a}}break;case"children":typeof l=="string"?rs(e,l):(typeof l=="number"||typeof l=="bigint")&&rs(e,""+l);break;case"onScroll":l!=null&&me("scroll",e);break;case"onScrollEnd":l!=null&&me("scrollend",e);break;case"onClick":l!=null&&(e.onclick=kl);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Gh.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(u=a.endsWith("Capture"),i=a.slice(2,u?a.length-7:void 0),f=e[Nt]||null,f=f!=null?f[a]:null,typeof f=="function"&&e.removeEventListener(i,f,u),typeof l=="function")){typeof f!="function"&&f!==null&&(a in e?e[a]=null:e.hasAttribute(a)&&e.removeAttribute(a)),e.addEventListener(i,l,u);break e}a in e?e[a]=l:l===!0?e.setAttribute(a,""):Da(e,a,l)}}}function gt(e,i,a){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":me("error",e),me("load",e);var l=!1,u=!1,f;for(f in a)if(a.hasOwnProperty(f)){var d=a[f];if(d!=null)switch(f){case"src":l=!0;break;case"srcSet":u=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,i));default:ke(e,i,f,d,a,null)}}u&&ke(e,i,"srcSet",a.srcSet,a,null),l&&ke(e,i,"src",a.src,a,null);return;case"input":me("invalid",e);var b=f=d=u=null,S=null,_=null;for(l in a)if(a.hasOwnProperty(l)){var $=a[l];if($!=null)switch(l){case"name":u=$;break;case"type":d=$;break;case"checked":S=$;break;case"defaultChecked":_=$;break;case"value":f=$;break;case"defaultValue":b=$;break;case"children":case"dangerouslySetInnerHTML":if($!=null)throw Error(r(137,i));break;default:ke(e,i,l,$,a,null)}}Fh(e,f,b,S,_,d,u,!1),za(e);return;case"select":me("invalid",e),l=d=f=null;for(u in a)if(a.hasOwnProperty(u)&&(b=a[u],b!=null))switch(u){case"value":f=b;break;case"defaultValue":d=b;break;case"multiple":l=b;default:ke(e,i,u,b,a,null)}i=f,a=d,e.multiple=!!l,i!=null?ss(e,!!l,i,!1):a!=null&&ss(e,!!l,a,!0);return;case"textarea":me("invalid",e),f=u=l=null;for(d in a)if(a.hasOwnProperty(d)&&(b=a[d],b!=null))switch(d){case"value":l=b;break;case"defaultValue":u=b;break;case"children":f=b;break;case"dangerouslySetInnerHTML":if(b!=null)throw Error(r(91));break;default:ke(e,i,d,b,a,null)}Ph(e,l,u,f),za(e);return;case"option":for(S in a)if(a.hasOwnProperty(S)&&(l=a[S],l!=null))switch(S){case"selected":e.selected=l&&typeof l!="function"&&typeof l!="symbol";break;default:ke(e,i,S,l,a,null)}return;case"dialog":me("beforetoggle",e),me("toggle",e),me("cancel",e),me("close",e);break;case"iframe":case"object":me("load",e);break;case"video":case"audio":for(l=0;l<Yr.length;l++)me(Yr[l],e);break;case"image":me("error",e),me("load",e);break;case"details":me("toggle",e);break;case"embed":case"source":case"link":me("error",e),me("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(_ in a)if(a.hasOwnProperty(_)&&(l=a[_],l!=null))switch(_){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,i));default:ke(e,i,_,l,a,null)}return;default:if(Yo(i)){for($ in a)a.hasOwnProperty($)&&(l=a[$],l!==void 0&&kc(e,i,$,l,a,void 0));return}}for(b in a)a.hasOwnProperty(b)&&(l=a[b],l!=null&&ke(e,i,b,l,a,null))}function SS(e,i,a,l){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var u=null,f=null,d=null,b=null,S=null,_=null,$=null;for(R in a){var C=a[R];if(a.hasOwnProperty(R)&&C!=null)switch(R){case"checked":break;case"value":break;case"defaultValue":S=C;default:l.hasOwnProperty(R)||ke(e,i,R,null,l,C)}}for(var T in l){var R=l[T];if(C=a[T],l.hasOwnProperty(T)&&(R!=null||C!=null))switch(T){case"type":f=R;break;case"name":u=R;break;case"checked":_=R;break;case"defaultChecked":$=R;break;case"value":d=R;break;case"defaultValue":b=R;break;case"children":case"dangerouslySetInnerHTML":if(R!=null)throw Error(r(137,i));break;default:R!==C&&ke(e,i,T,R,l,C)}}Ho(e,d,b,S,_,$,f,u);return;case"select":R=d=b=T=null;for(f in a)if(S=a[f],a.hasOwnProperty(f)&&S!=null)switch(f){case"value":break;case"multiple":R=S;default:l.hasOwnProperty(f)||ke(e,i,f,null,l,S)}for(u in l)if(f=l[u],S=a[u],l.hasOwnProperty(u)&&(f!=null||S!=null))switch(u){case"value":T=f;break;case"defaultValue":b=f;break;case"multiple":d=f;default:f!==S&&ke(e,i,u,f,l,S)}i=b,a=d,l=R,T!=null?ss(e,!!a,T,!1):!!l!=!!a&&(i!=null?ss(e,!!a,i,!0):ss(e,!!a,a?[]:"",!1));return;case"textarea":R=T=null;for(b in a)if(u=a[b],a.hasOwnProperty(b)&&u!=null&&!l.hasOwnProperty(b))switch(b){case"value":break;case"children":break;default:ke(e,i,b,null,l,u)}for(d in l)if(u=l[d],f=a[d],l.hasOwnProperty(d)&&(u!=null||f!=null))switch(d){case"value":T=u;break;case"defaultValue":R=u;break;case"children":break;case"dangerouslySetInnerHTML":if(u!=null)throw Error(r(91));break;default:u!==f&&ke(e,i,d,u,l,f)}Wh(e,T,R);return;case"option":for(var se in a)if(T=a[se],a.hasOwnProperty(se)&&T!=null&&!l.hasOwnProperty(se))switch(se){case"selected":e.selected=!1;break;default:ke(e,i,se,null,l,T)}for(S in l)if(T=l[S],R=a[S],l.hasOwnProperty(S)&&T!==R&&(T!=null||R!=null))switch(S){case"selected":e.selected=T&&typeof T!="function"&&typeof T!="symbol";break;default:ke(e,i,S,T,l,R)}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 P in a)T=a[P],a.hasOwnProperty(P)&&T!=null&&!l.hasOwnProperty(P)&&ke(e,i,P,null,l,T);for(_ in l)if(T=l[_],R=a[_],l.hasOwnProperty(_)&&T!==R&&(T!=null||R!=null))switch(_){case"children":case"dangerouslySetInnerHTML":if(T!=null)throw Error(r(137,i));break;default:ke(e,i,_,T,l,R)}return;default:if(Yo(i)){for(var Ne in a)T=a[Ne],a.hasOwnProperty(Ne)&&T!==void 0&&!l.hasOwnProperty(Ne)&&kc(e,i,Ne,void 0,l,T);for($ in l)T=l[$],R=a[$],!l.hasOwnProperty($)||T===R||T===void 0&&R===void 0||kc(e,i,$,T,l,R);return}}for(var O in a)T=a[O],a.hasOwnProperty(O)&&T!=null&&!l.hasOwnProperty(O)&&ke(e,i,O,null,l,T);for(C in l)T=l[C],R=a[C],!l.hasOwnProperty(C)||T===R||T==null&&R==null||ke(e,i,C,T,l,R)}var Nc=null,Mc=null;function Nl(e){return e.nodeType===9?e:e.ownerDocument}function ey(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function ty(e,i){if(e===0)switch(i){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&i==="foreignObject"?0:e}function $c(e,i){return e==="textarea"||e==="noscript"||typeof i.children=="string"||typeof i.children=="number"||typeof i.children=="bigint"||typeof i.dangerouslySetInnerHTML=="object"&&i.dangerouslySetInnerHTML!==null&&i.dangerouslySetInnerHTML.__html!=null}var Dc=null;function AS(){var e=window.event;return e&&e.type==="popstate"?e===Dc?!1:(Dc=e,!0):(Dc=null,!1)}var ny=typeof setTimeout=="function"?setTimeout:void 0,wS=typeof clearTimeout=="function"?clearTimeout:void 0,iy=typeof Promise=="function"?Promise:void 0,xS=typeof queueMicrotask=="function"?queueMicrotask:typeof iy<"u"?function(e){return iy.resolve(null).then(e).catch(OS)}:ny;function OS(e){setTimeout(function(){throw e})}function hi(e){return e==="head"}function sy(e,i){var a=i,l=0,u=0;do{var f=a.nextSibling;if(e.removeChild(a),f&&f.nodeType===8)if(a=f.data,a==="/$"){if(0<l&&8>l){a=l;var d=e.ownerDocument;if(a&1&&Ir(d.documentElement),a&2&&Ir(d.body),a&4)for(a=d.head,Ir(a),d=a.firstChild;d;){var b=d.nextSibling,S=d.nodeName;d[or]||S==="SCRIPT"||S==="STYLE"||S==="LINK"&&d.rel.toLowerCase()==="stylesheet"||a.removeChild(d),d=b}}if(u===0){e.removeChild(f),ta(i);return}u--}else a==="$"||a==="$?"||a==="$!"?u++:l=a.charCodeAt(0)-48;else l=0;a=f}while(a);ta(i)}function Cc(e){var i=e.firstChild;for(i&&i.nodeType===10&&(i=i.nextSibling);i;){var a=i;switch(i=i.nextSibling,a.nodeName){case"HTML":case"HEAD":case"BODY":Cc(a),Ko(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}e.removeChild(a)}}function ES(e,i,a,l){for(;e.nodeType===1;){var u=a;if(e.nodeName.toLowerCase()!==i.toLowerCase()){if(!l&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(l){if(!e[or])switch(i){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(f=e.getAttribute("rel"),f==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(f!==u.rel||e.getAttribute("href")!==(u.href==null||u.href===""?null:u.href)||e.getAttribute("crossorigin")!==(u.crossOrigin==null?null:u.crossOrigin)||e.getAttribute("title")!==(u.title==null?null:u.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(f=e.getAttribute("src"),(f!==(u.src==null?null:u.src)||e.getAttribute("type")!==(u.type==null?null:u.type)||e.getAttribute("crossorigin")!==(u.crossOrigin==null?null:u.crossOrigin))&&f&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(i==="input"&&e.type==="hidden"){var f=u.name==null?null:""+u.name;if(u.type==="hidden"&&e.getAttribute("name")===f)return e}else return e;if(e=cn(e.nextSibling),e===null)break}return null}function _S(e,i,a){if(i==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!a||(e=cn(e.nextSibling),e===null))return null;return e}function zc(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState==="complete"}function TS(e,i){var a=e.ownerDocument;if(e.data!=="$?"||a.readyState==="complete")i();else{var l=function(){i(),a.removeEventListener("DOMContentLoaded",l)};a.addEventListener("DOMContentLoaded",l),e._reactRetry=l}}function cn(e){for(;e!=null;e=e.nextSibling){var i=e.nodeType;if(i===1||i===3)break;if(i===8){if(i=e.data,i==="$"||i==="$!"||i==="$?"||i==="F!"||i==="F")break;if(i==="/$")return null}}return e}var Uc=null;function ry(e){e=e.previousSibling;for(var i=0;e;){if(e.nodeType===8){var a=e.data;if(a==="$"||a==="$!"||a==="$?"){if(i===0)return e;i--}else a==="/$"&&i++}e=e.previousSibling}return null}function ay(e,i,a){switch(i=Nl(a),e){case"html":if(e=i.documentElement,!e)throw Error(r(452));return e;case"head":if(e=i.head,!e)throw Error(r(453));return e;case"body":if(e=i.body,!e)throw Error(r(454));return e;default:throw Error(r(451))}}function Ir(e){for(var i=e.attributes;i.length;)e.removeAttributeNode(i[0]);Ko(e)}var sn=new Map,ly=new Set;function Ml(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var qn=V.d;V.d={f:RS,r:kS,D:NS,C:MS,L:$S,m:DS,X:zS,S:CS,M:US};function RS(){var e=qn.f(),i=wl();return e||i}function kS(e){var i=es(e);i!==null&&i.tag===5&&i.type==="form"?Tp(i):qn.r(e)}var Cs=typeof document>"u"?null:document;function oy(e,i,a){var l=Cs;if(l&&typeof i=="string"&&i){var u=Qt(i);u='link[rel="'+e+'"][href="'+u+'"]',typeof a=="string"&&(u+='[crossorigin="'+a+'"]'),ly.has(u)||(ly.add(u),e={rel:e,crossOrigin:a,href:i},l.querySelector(u)===null&&(i=l.createElement("link"),gt(i,"link",e),lt(i),l.head.appendChild(i)))}}function NS(e){qn.D(e),oy("dns-prefetch",e,null)}function MS(e,i){qn.C(e,i),oy("preconnect",e,i)}function $S(e,i,a){qn.L(e,i,a);var l=Cs;if(l&&e&&i){var u='link[rel="preload"][as="'+Qt(i)+'"]';i==="image"&&a&&a.imageSrcSet?(u+='[imagesrcset="'+Qt(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(u+='[imagesizes="'+Qt(a.imageSizes)+'"]')):u+='[href="'+Qt(e)+'"]';var f=u;switch(i){case"style":f=zs(e);break;case"script":f=Us(e)}sn.has(f)||(e=v({rel:"preload",href:i==="image"&&a&&a.imageSrcSet?void 0:e,as:i},a),sn.set(f,e),l.querySelector(u)!==null||i==="style"&&l.querySelector(Xr(f))||i==="script"&&l.querySelector(Zr(f))||(i=l.createElement("link"),gt(i,"link",e),lt(i),l.head.appendChild(i)))}}function DS(e,i){qn.m(e,i);var a=Cs;if(a&&e){var l=i&&typeof i.as=="string"?i.as:"script",u='link[rel="modulepreload"][as="'+Qt(l)+'"][href="'+Qt(e)+'"]',f=u;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":f=Us(e)}if(!sn.has(f)&&(e=v({rel:"modulepreload",href:e},i),sn.set(f,e),a.querySelector(u)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(Zr(f)))return}l=a.createElement("link"),gt(l,"link",e),lt(l),a.head.appendChild(l)}}}function CS(e,i,a){qn.S(e,i,a);var l=Cs;if(l&&e){var u=ts(l).hoistableStyles,f=zs(e);i=i||"default";var d=u.get(f);if(!d){var b={loading:0,preload:null};if(d=l.querySelector(Xr(f)))b.loading=5;else{e=v({rel:"stylesheet",href:e,"data-precedence":i},a),(a=sn.get(f))&&Bc(e,a);var S=d=l.createElement("link");lt(S),gt(S,"link",e),S._p=new Promise(function(_,$){S.onload=_,S.onerror=$}),S.addEventListener("load",function(){b.loading|=1}),S.addEventListener("error",function(){b.loading|=2}),b.loading|=4,$l(d,i,l)}d={type:"stylesheet",instance:d,count:1,state:b},u.set(f,d)}}}function zS(e,i){qn.X(e,i);var a=Cs;if(a&&e){var l=ts(a).hoistableScripts,u=Us(e),f=l.get(u);f||(f=a.querySelector(Zr(u)),f||(e=v({src:e,async:!0},i),(i=sn.get(u))&&qc(e,i),f=a.createElement("script"),lt(f),gt(f,"link",e),a.head.appendChild(f)),f={type:"script",instance:f,count:1,state:null},l.set(u,f))}}function US(e,i){qn.M(e,i);var a=Cs;if(a&&e){var l=ts(a).hoistableScripts,u=Us(e),f=l.get(u);f||(f=a.querySelector(Zr(u)),f||(e=v({src:e,async:!0,type:"module"},i),(i=sn.get(u))&&qc(e,i),f=a.createElement("script"),lt(f),gt(f,"link",e),a.head.appendChild(f)),f={type:"script",instance:f,count:1,state:null},l.set(u,f))}}function uy(e,i,a,l){var u=(u=le.current)?Ml(u):null;if(!u)throw Error(r(446));switch(e){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(i=zs(a.href),a=ts(u).hoistableStyles,l=a.get(i),l||(l={type:"style",instance:null,count:0,state:null},a.set(i,l)),l):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){e=zs(a.href);var f=ts(u).hoistableStyles,d=f.get(e);if(d||(u=u.ownerDocument||u,d={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},f.set(e,d),(f=u.querySelector(Xr(e)))&&!f._p&&(d.instance=f,d.state.loading=5),sn.has(e)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},sn.set(e,a),f||BS(u,e,a,d.state))),i&&l===null)throw Error(r(528,""));return d}if(i&&l!==null)throw Error(r(529,""));return null;case"script":return i=a.async,a=a.src,typeof a=="string"&&i&&typeof i!="function"&&typeof i!="symbol"?(i=Us(a),a=ts(u).hoistableScripts,l=a.get(i),l||(l={type:"script",instance:null,count:0,state:null},a.set(i,l)),l):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,e))}}function zs(e){return'href="'+Qt(e)+'"'}function Xr(e){return'link[rel="stylesheet"]['+e+"]"}function cy(e){return v({},e,{"data-precedence":e.precedence,precedence:null})}function BS(e,i,a,l){e.querySelector('link[rel="preload"][as="style"]['+i+"]")?l.loading=1:(i=e.createElement("link"),l.preload=i,i.addEventListener("load",function(){return l.loading|=1}),i.addEventListener("error",function(){return l.loading|=2}),gt(i,"link",a),lt(i),e.head.appendChild(i))}function Us(e){return'[src="'+Qt(e)+'"]'}function Zr(e){return"script[async]"+e}function fy(e,i,a){if(i.count++,i.instance===null)switch(i.type){case"style":var l=e.querySelector('style[data-href~="'+Qt(a.href)+'"]');if(l)return i.instance=l,lt(l),l;var u=v({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return l=(e.ownerDocument||e).createElement("style"),lt(l),gt(l,"style",u),$l(l,a.precedence,e),i.instance=l;case"stylesheet":u=zs(a.href);var f=e.querySelector(Xr(u));if(f)return i.state.loading|=4,i.instance=f,lt(f),f;l=cy(a),(u=sn.get(u))&&Bc(l,u),f=(e.ownerDocument||e).createElement("link"),lt(f);var d=f;return d._p=new Promise(function(b,S){d.onload=b,d.onerror=S}),gt(f,"link",l),i.state.loading|=4,$l(f,a.precedence,e),i.instance=f;case"script":return f=Us(a.src),(u=e.querySelector(Zr(f)))?(i.instance=u,lt(u),u):(l=a,(u=sn.get(f))&&(l=v({},a),qc(l,u)),e=e.ownerDocument||e,u=e.createElement("script"),lt(u),gt(u,"link",l),e.head.appendChild(u),i.instance=u);case"void":return null;default:throw Error(r(443,i.type))}else i.type==="stylesheet"&&(i.state.loading&4)===0&&(l=i.instance,i.state.loading|=4,$l(l,a.precedence,e));return i.instance}function $l(e,i,a){for(var l=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),u=l.length?l[l.length-1]:null,f=u,d=0;d<l.length;d++){var b=l[d];if(b.dataset.precedence===i)f=b;else if(f!==u)break}f?f.parentNode.insertBefore(e,f.nextSibling):(i=a.nodeType===9?a.head:a,i.insertBefore(e,i.firstChild))}function Bc(e,i){e.crossOrigin==null&&(e.crossOrigin=i.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=i.referrerPolicy),e.title==null&&(e.title=i.title)}function qc(e,i){e.crossOrigin==null&&(e.crossOrigin=i.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=i.referrerPolicy),e.integrity==null&&(e.integrity=i.integrity)}var Dl=null;function hy(e,i,a){if(Dl===null){var l=new Map,u=Dl=new Map;u.set(a,l)}else u=Dl,l=u.get(a),l||(l=new Map,u.set(a,l));if(l.has(e))return l;for(l.set(e,null),a=a.getElementsByTagName(e),u=0;u<a.length;u++){var f=a[u];if(!(f[or]||f[St]||e==="link"&&f.getAttribute("rel")==="stylesheet")&&f.namespaceURI!=="http://www.w3.org/2000/svg"){var d=f.getAttribute(i)||"";d=e+d;var b=l.get(d);b?b.push(f):l.set(d,[f])}}return l}function dy(e,i,a){e=e.ownerDocument||e,e.head.insertBefore(a,i==="title"?e.querySelector("head > title"):null)}function qS(e,i,a){if(a===1||i.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof i.precedence!="string"||typeof i.href!="string"||i.href==="")break;return!0;case"link":if(typeof i.rel!="string"||typeof i.href!="string"||i.href===""||i.onLoad||i.onError)break;switch(i.rel){case"stylesheet":return e=i.disabled,typeof i.precedence=="string"&&e==null;default:return!0}case"script":if(i.async&&typeof i.async!="function"&&typeof i.async!="symbol"&&!i.onLoad&&!i.onError&&i.src&&typeof i.src=="string")return!0}return!1}function py(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}var Qr=null;function KS(){}function jS(e,i,a){if(Qr===null)throw Error(r(475));var l=Qr;if(i.type==="stylesheet"&&(typeof a.media!="string"||matchMedia(a.media).matches!==!1)&&(i.state.loading&4)===0){if(i.instance===null){var u=zs(a.href),f=e.querySelector(Xr(u));if(f){e=f._p,e!==null&&typeof e=="object"&&typeof e.then=="function"&&(l.count++,l=Cl.bind(l),e.then(l,l)),i.state.loading|=4,i.instance=f,lt(f);return}f=e.ownerDocument||e,a=cy(a),(u=sn.get(u))&&Bc(a,u),f=f.createElement("link"),lt(f);var d=f;d._p=new Promise(function(b,S){d.onload=b,d.onerror=S}),gt(f,"link",a),i.instance=f}l.stylesheets===null&&(l.stylesheets=new Map),l.stylesheets.set(i,e),(e=i.state.preload)&&(i.state.loading&3)===0&&(l.count++,i=Cl.bind(l),e.addEventListener("load",i),e.addEventListener("error",i))}}function LS(){if(Qr===null)throw Error(r(475));var e=Qr;return e.stylesheets&&e.count===0&&Kc(e,e.stylesheets),0<e.count?function(i){var a=setTimeout(function(){if(e.stylesheets&&Kc(e,e.stylesheets),e.unsuspend){var l=e.unsuspend;e.unsuspend=null,l()}},6e4);return e.unsuspend=i,function(){e.unsuspend=null,clearTimeout(a)}}:null}function Cl(){if(this.count--,this.count===0){if(this.stylesheets)Kc(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var zl=null;function Kc(e,i){e.stylesheets=null,e.unsuspend!==null&&(e.count++,zl=new Map,i.forEach(VS,e),zl=null,Cl.call(e))}function VS(e,i){if(!(i.state.loading&4)){var a=zl.get(e);if(a)var l=a.get(null);else{a=new Map,zl.set(e,a);for(var u=e.querySelectorAll("link[data-precedence],style[data-precedence]"),f=0;f<u.length;f++){var d=u[f];(d.nodeName==="LINK"||d.getAttribute("media")!=="not all")&&(a.set(d.dataset.precedence,d),l=d)}l&&a.set(null,l)}u=i.instance,d=u.getAttribute("data-precedence"),f=a.get(d)||l,f===l&&a.set(null,u),a.set(d,u),this.count++,l=Cl.bind(this),u.addEventListener("load",l),u.addEventListener("error",l),f?f.parentNode.insertBefore(u,f.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(u,e.firstChild)),i.state.loading|=4}}var Fr={$$typeof:ne,Provider:null,Consumer:null,_currentValue:F,_currentValue2:F,_threadCount:0};function HS(e,i,a,l,u,f,d,b){this.tag=1,this.containerInfo=e,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=zo(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=zo(0),this.hiddenUpdates=zo(null),this.identifierPrefix=l,this.onUncaughtError=u,this.onCaughtError=f,this.onRecoverableError=d,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=b,this.incompleteTransitions=new Map}function my(e,i,a,l,u,f,d,b,S,_,$,C){return e=new HS(e,i,a,d,b,S,_,C),i=1,f===!0&&(i|=24),f=jt(3,null,null,i),e.current=f,f.stateNode=e,i=Su(),i.refCount++,e.pooledCache=i,i.refCount++,f.memoizedState={element:l,isDehydrated:a,cache:i},Ou(f),e}function yy(e){return e?(e=ds,e):ds}function gy(e,i,a,l,u,f){u=yy(u),l.context===null?l.context=u:l.pendingContext=u,l=Pn(i),l.payload={element:a},f=f===void 0?null:f,f!==null&&(l.callback=f),a=ei(e,l,i),a!==null&&(Yt(a,e,i),Tr(a,e,i))}function by(e,i){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var a=e.retryLane;e.retryLane=a!==0&&a<i?a:i}}function jc(e,i){by(e,i),(e=e.alternate)&&by(e,i)}function vy(e){if(e.tag===13){var i=hs(e,67108864);i!==null&&Yt(i,e,67108864),jc(e,67108864)}}var Ul=!0;function GS(e,i,a,l){var u=M.T;M.T=null;var f=V.p;try{V.p=2,Lc(e,i,a,l)}finally{V.p=f,M.T=u}}function YS(e,i,a,l){var u=M.T;M.T=null;var f=V.p;try{V.p=8,Lc(e,i,a,l)}finally{V.p=f,M.T=u}}function Lc(e,i,a,l){if(Ul){var u=Vc(l);if(u===null)Rc(e,i,l,Bl,a),Ay(e,l);else if(IS(u,e,i,a,l))l.stopPropagation();else if(Ay(e,l),i&4&&-1<JS.indexOf(e)){for(;u!==null;){var f=es(u);if(f!==null)switch(f.tag){case 3:if(f=f.stateNode,f.current.memoizedState.isDehydrated){var d=xi(f.pendingLanes);if(d!==0){var b=f;for(b.pendingLanes|=2,b.entangledLanes|=2;d;){var S=1<<31-qt(d);b.entanglements[1]|=S,d&=~S}bn(f),(Oe&6)===0&&(Sl=dn()+500,Gr(0))}}break;case 13:b=hs(f,2),b!==null&&Yt(b,f,2),wl(),jc(f,2)}if(f=Vc(l),f===null&&Rc(e,i,l,Bl,a),f===u)break;u=f}u!==null&&l.stopPropagation()}else Rc(e,i,l,null,a)}}function Vc(e){return e=Io(e),Hc(e)}var Bl=null;function Hc(e){if(Bl=null,e=Pi(e),e!==null){var i=c(e);if(i===null)e=null;else{var a=i.tag;if(a===13){if(e=h(i),e!==null)return e;e=null}else if(a===3){if(i.stateNode.current.memoizedState.isDehydrated)return i.tag===3?i.stateNode.containerInfo:null;e=null}else i!==e&&(e=null)}}return Bl=e,null}function Sy(e){switch(e){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(M0()){case Ch:return 2;case zh:return 8;case ka:case $0:return 32;case Uh:return 268435456;default:return 32}default:return 32}}var Gc=!1,di=null,pi=null,mi=null,Wr=new Map,Pr=new Map,yi=[],JS="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 Ay(e,i){switch(e){case"focusin":case"focusout":di=null;break;case"dragenter":case"dragleave":pi=null;break;case"mouseover":case"mouseout":mi=null;break;case"pointerover":case"pointerout":Wr.delete(i.pointerId);break;case"gotpointercapture":case"lostpointercapture":Pr.delete(i.pointerId)}}function ea(e,i,a,l,u,f){return e===null||e.nativeEvent!==f?(e={blockedOn:i,domEventName:a,eventSystemFlags:l,nativeEvent:f,targetContainers:[u]},i!==null&&(i=es(i),i!==null&&vy(i)),e):(e.eventSystemFlags|=l,i=e.targetContainers,u!==null&&i.indexOf(u)===-1&&i.push(u),e)}function IS(e,i,a,l,u){switch(i){case"focusin":return di=ea(di,e,i,a,l,u),!0;case"dragenter":return pi=ea(pi,e,i,a,l,u),!0;case"mouseover":return mi=ea(mi,e,i,a,l,u),!0;case"pointerover":var f=u.pointerId;return Wr.set(f,ea(Wr.get(f)||null,e,i,a,l,u)),!0;case"gotpointercapture":return f=u.pointerId,Pr.set(f,ea(Pr.get(f)||null,e,i,a,l,u)),!0}return!1}function wy(e){var i=Pi(e.target);if(i!==null){var a=c(i);if(a!==null){if(i=a.tag,i===13){if(i=h(a),i!==null){e.blockedOn=i,j0(e.priority,function(){if(a.tag===13){var l=Gt();l=Uo(l);var u=hs(a,l);u!==null&&Yt(u,a,l),jc(a,l)}});return}}else if(i===3&&a.stateNode.current.memoizedState.isDehydrated){e.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}e.blockedOn=null}function ql(e){if(e.blockedOn!==null)return!1;for(var i=e.targetContainers;0<i.length;){var a=Vc(e.nativeEvent);if(a===null){a=e.nativeEvent;var l=new a.constructor(a.type,a);Jo=l,a.target.dispatchEvent(l),Jo=null}else return i=es(a),i!==null&&vy(i),e.blockedOn=a,!1;i.shift()}return!0}function xy(e,i,a){ql(e)&&a.delete(i)}function XS(){Gc=!1,di!==null&&ql(di)&&(di=null),pi!==null&&ql(pi)&&(pi=null),mi!==null&&ql(mi)&&(mi=null),Wr.forEach(xy),Pr.forEach(xy)}function Kl(e,i){e.blockedOn===i&&(e.blockedOn=null,Gc||(Gc=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,XS)))}var jl=null;function Oy(e){jl!==e&&(jl=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){jl===e&&(jl=null);for(var i=0;i<e.length;i+=3){var a=e[i],l=e[i+1],u=e[i+2];if(typeof l!="function"){if(Hc(l||a)===null)continue;break}var f=es(a);f!==null&&(e.splice(i,3),i-=3,Hu(f,{pending:!0,data:u,method:a.method,action:l},l,u))}}))}function ta(e){function i(S){return Kl(S,e)}di!==null&&Kl(di,e),pi!==null&&Kl(pi,e),mi!==null&&Kl(mi,e),Wr.forEach(i),Pr.forEach(i);for(var a=0;a<yi.length;a++){var l=yi[a];l.blockedOn===e&&(l.blockedOn=null)}for(;0<yi.length&&(a=yi[0],a.blockedOn===null);)wy(a),a.blockedOn===null&&yi.shift();if(a=(e.ownerDocument||e).$$reactFormReplay,a!=null)for(l=0;l<a.length;l+=3){var u=a[l],f=a[l+1],d=u[Nt]||null;if(typeof f=="function")d||Oy(a);else if(d){var b=null;if(f&&f.hasAttribute("formAction")){if(u=f,d=f[Nt]||null)b=d.formAction;else if(Hc(u)!==null)continue}else b=d.action;typeof b=="function"?a[l+1]=b:(a.splice(l,3),l-=3),Oy(a)}}}function Yc(e){this._internalRoot=e}Ll.prototype.render=Yc.prototype.render=function(e){var i=this._internalRoot;if(i===null)throw Error(r(409));var a=i.current,l=Gt();gy(a,l,e,i,null,null)},Ll.prototype.unmount=Yc.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var i=e.containerInfo;gy(e.current,2,null,e,null,null),wl(),i[Wi]=null}};function Ll(e){this._internalRoot=e}Ll.prototype.unstable_scheduleHydration=function(e){if(e){var i=Lh();e={blockedOn:null,target:e,priority:i};for(var a=0;a<yi.length&&i!==0&&i<yi[a].priority;a++);yi.splice(a,0,e),a===0&&wy(e)}};var Ey=s.version;if(Ey!=="19.1.0")throw Error(r(527,Ey,"19.1.0"));V.findDOMNode=function(e){var i=e._reactInternals;if(i===void 0)throw typeof e.render=="function"?Error(r(188)):(e=Object.keys(e).join(","),Error(r(268,e)));return e=m(i),e=e!==null?y(e):null,e=e===null?null:e.stateNode,e};var ZS={bundleType:0,version:"19.1.0",rendererPackageName:"react-dom",currentDispatcherRef:M,reconcilerVersion:"19.1.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Vl=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Vl.isDisabled&&Vl.supportsFiber)try{rr=Vl.inject(ZS),Bt=Vl}catch{}}return ia.createRoot=function(e,i){if(!o(e))throw Error(r(299));var a=!1,l="",u=Lp,f=Vp,d=Hp,b=null;return i!=null&&(i.unstable_strictMode===!0&&(a=!0),i.identifierPrefix!==void 0&&(l=i.identifierPrefix),i.onUncaughtError!==void 0&&(u=i.onUncaughtError),i.onCaughtError!==void 0&&(f=i.onCaughtError),i.onRecoverableError!==void 0&&(d=i.onRecoverableError),i.unstable_transitionCallbacks!==void 0&&(b=i.unstable_transitionCallbacks)),i=my(e,1,!1,null,null,a,l,u,f,d,b,null),e[Wi]=i.current,Tc(e),new Yc(i)},ia.hydrateRoot=function(e,i,a){if(!o(e))throw Error(r(299));var l=!1,u="",f=Lp,d=Vp,b=Hp,S=null,_=null;return a!=null&&(a.unstable_strictMode===!0&&(l=!0),a.identifierPrefix!==void 0&&(u=a.identifierPrefix),a.onUncaughtError!==void 0&&(f=a.onUncaughtError),a.onCaughtError!==void 0&&(d=a.onCaughtError),a.onRecoverableError!==void 0&&(b=a.onRecoverableError),a.unstable_transitionCallbacks!==void 0&&(S=a.unstable_transitionCallbacks),a.formState!==void 0&&(_=a.formState)),i=my(e,1,!0,i,a??null,l,u,f,d,b,S,_),i.context=yy(null),a=i.current,l=Gt(),l=Uo(l),u=Pn(l),u.callback=null,ei(a,u,l),a=l,i.current.lanes=a,lr(i,a),bn(i),e[Wi]=i.current,Tc(e),new Ll(i)},ia.version="19.1.0",ia}var qy;function Ow(){if(qy)return Zc.exports;qy=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(s){console.error(s)}}return t(),Zc.exports=xw(),Zc.exports}var Ew=Ow();const ba=t=>Array.isArray(t)?t:[t],_w=(t,s)=>{const n=[[],[]];for(const r of t)s(r)?n[0].push(r):n[1].push(r);return n},gb=Array,Li=(t,s)=>t.includes(s),Tw=(t,s=0)=>[...new Array(t)].map((n,r)=>r+s),De=(t,s,n)=>t===void 0?s===void 0?[]:Array.isArray(s)?s:[s]:(Array.isArray(s)?t.push(...s):t.push(s),t),Gi=(t,s)=>s==null?t??[]:t==null?ba(s):t.concat(s),Rw=(...t)=>t.reduce(Gi,[]),Yi=(t,s,n)=>{if(t===void 0)return Array.isArray(s)?s:[s];const r=(n==null?void 0:n.isEqual)??((o,c)=>o===c);for(const o of ba(s))t.some(c=>r(c,o))||t.push(o);return t},kw=(t,s)=>t.reduce((n,r)=>{const o=r[s];return n[o]=De(n[o],r),n},{}),Is=(t,s,n)=>t.length===s.length&&t.every(n!=null&&n.isEqual?(r,o)=>n.isEqual(r,s[o]):(r,o)=>r===s[o]),Qi=(t,s)=>hn(t)===s,hn=t=>{const s=typeof t;return s==="object"?t===null?"null":"object":s==="function"?"object":s},Ln={boolean:"boolean",null:"null",undefined:"undefined",bigint:"a bigint",number:"a number",object:"an object",string:"a string",symbol:"a symbol"},Nw={...Ln,function:"a function"};class Mw extends Error{}const it=t=>Xs(t,Mw),Xs=(t,s=Error)=>{throw new s(t)};class $w extends Error{constructor(){super(...arguments);g(this,"name","ParseError")}}const q=t=>Xs(t,$w),bb=t=>` ${t}`,Ce=(t,s)=>{const n={},r=Array.isArray(t);let o=!1;for(const[c,h]of Object.entries(t).entries()){const p=r?s(c,h[1]):s(...h,c);o||(o=typeof p[0]=="number");const m=Array.isArray(p[0])||p.length===0?p:[p];for(const[y,v]of m)typeof y=="object"?n[y.group]=De(n[y.group],v):n[y]=v}return o?Object.values(n):n},vb=Object.entries,wn=(t,s)=>t in s,oh=(t,s)=>s in t;class Dw{constructor(s){Object.assign(this,s)}}const Cw=class{};class Sb extends Cw{}const zw=(t,s)=>{const n={},r={};let o;for(o in t)o in s?n[o]=t[o]:r[o]=t[o];return[n,r]},Uw=(t,s)=>zw(t,s)[1],va=t=>Object.keys(t).length===0,ro=t=>[...Object.entries(t),...Object.getOwnPropertySymbols(t).map(s=>[s,t[s]])],Bw=(t,s)=>Object.defineProperties(t,Object.getOwnPropertyDescriptors(s)),qw=t=>{const s=Object.keys(t).sort(),n={};for(let r=0;r<s.length;r++)n[s[r]]=t[s[r]];return n},jn=bb("represents an uninitialized value"),Kw=t=>Object.values(t).filter(s=>typeof s=="number"?!0:typeof t[s]!="number"),Ab={Array,Boolean,Date,Error,Function,Map,Number,Promise,RegExp,Set,String,WeakMap,WeakSet},wb=globalThis.File??Blob,xb={ArrayBuffer,Blob,File:wb,FormData,Headers,Request,Response,URL},jw={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array},Zs={...Ab,...xb,...jw,String,Number,Boolean},uh=t=>{var r;let s=Object.getPrototypeOf(t);for(;s!=null&&s.constructor&&(!wn(s.constructor.name,Zs)||!(t instanceof Zs[s.constructor.name]));)s=Object.getPrototypeOf(s);const n=(r=s==null?void 0:s.constructor)==null?void 0:r.name;if(!(n===void 0||n==="Object"))return n},bf=t=>typeof t=="object"&&t!==null?uh(t)??"object":hn(t),Et=Array.isArray,Lw={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"},Vw={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"},Hw={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"},Gw={...Lw,...Vw,...Hw},ch=t=>{const s=Object(t).name??null;return s&&wn(s,Zs)&&Zs[s]===t?s:null},Ky=(t,s)=>{let n=t.prototype;for(;n!==null;){if(n===s.prototype)return!0;n=Object.getPrototypeOf(n)}return!1},Yw=t=>Ob(t,new Map),Ob=(t,s)=>{if(typeof t!="object"||t===null)return t;if(s!=null&&s.has(t))return s.get(t);const n=ch(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(s){s.set(t,r);for(const c in o){const h=o[c];"get"in h||"set"in h||(h.value=Ob(h.value,s))}}return Object.defineProperties(r,o),r},Jw=t=>{let s=jn;return()=>s===jn?s=t():s},vo=t=>typeof t=="function"&&t.length===0,Iw=class extends Function{constructor(...t){const s=t.slice(0,-1),n=t.at(-1);try{super(...s,n)}catch(r){return it(`Encountered an unexpected error while compiling your definition:
63
- Message: ${r}
64
- Source: (${t.slice(0,-1)}) => {
65
- ${t.at(-1)}
66
- }`)}}};class tr{constructor(s,...[n]){return Object.assign(Object.setPrototypeOf(s.bind((n==null?void 0:n.bind)??this),this.constructor.prototype),n==null?void 0:n.attach)}}const Xw=Jw(()=>{try{return new Function("return false")()}catch{return!0}});class xn{constructor(){}}const Zw=()=>{var t,s,n;try{return(((n=(((s=(t=new Error().stack)==null?void 0:t.split(`
67
- `)[2])==null?void 0:s.trim())||"").match(/\(?(.+?)(?::\d+:\d+)?\)?$/))==null?void 0:n[1])||"unknown").replace(/^file:\/\//,"")}catch{return"unknown"}};var jg;const Qw=((jg=globalThis.process)==null?void 0:jg.env)??{},Fw={fileName:Zw,env:Qw},Ww=t=>t[0].toUpperCase()+t.slice(1),Eb=t=>new RegExp(Pw(t),typeof t=="string"?"":t.flags),Pw=t=>`^(?:${typeof t=="string"?t:t.source})$`,vi={negativeLookahead:t=>`(?!${t})`,nonCapturingGroup:t=>`(?:${t})`},vf="\\",So={" ":1,"\n":1," ":1},ex=/^-0\.?0*$/.source,_b=/[1-9]\d*/.source,tx=/\.\d+/.source,nx=/\.\d*[1-9]/.source,Tb=t=>Eb(vi.negativeLookahead(ex)+vi.nonCapturingGroup("-?"+vi.nonCapturingGroup(vi.nonCapturingGroup("0|"+_b)+vi.nonCapturingGroup(t.decimalPattern)+"?")+(t.allowDecimalOnly?"|"+t.decimalPattern:"")+"?")),jy=Tb({decimalPattern:nx,allowDecimalOnly:!1}),ix=jy.test.bind(jy),Sf=Tb({decimalPattern:tx,allowDecimalOnly:!0});Sf.test.bind(Sf);const sx=/^-?\d*\.?\d*$/,rx=t=>t.length!==0&&sx.test(t),ao=Eb(vi.negativeLookahead("^-0$")+"-?"+vi.nonCapturingGroup(vi.nonCapturingGroup("0|"+_b))),ax=ao.test.bind(ao),Af=/^-?\d+$/,lx=Af.test.bind(Af),Rb={number:"a number",bigint:"a bigint",integer:"an integer"},kb=(t,s)=>`'${t}' was parsed as ${Rb[s]} but could not be narrowed to a literal value. Avoid unnecessary leading or trailing zeros and other abnormal notation`,ox=(t,s)=>s==="number"?ix(t):ax(t),ux=(t,s)=>s==="number"?Number(t):Number.parseInt(t),cx=(t,s)=>s==="number"?rx(t):lx(t),fx=(t,s)=>fh(t,"number",s),hx=(t,s)=>fh(t,"number",{...s,strict:!0}),dx=(t,s)=>fh(t,"integer",s),fh=(t,s,n)=>{const r=ux(t,s);return!Number.isNaN(r)&&cx(t,s)?n!=null&&n.strict?ox(t,s)?r:q(kb(t,s)):r:n!=null&&n.errorOnFail?q((n==null?void 0:n.errorOnFail)===!0?`Failed to parse ${Rb[s]} from '${t}'`:n==null?void 0:n.errorOnFail):void 0},px=t=>{if(t[t.length-1]!=="n")return;const s=t.slice(0,-1);let n;try{n=BigInt(s)}catch{return}if(ao.test(s))return n;if(Af.test(s))return q(kb(t,"bigint"))},mx="0.46.0",yx={version:mx,filename:Fw.fileName(),FileConstructor:wb},Sa=yx,Ly=new Map,Pc=Object.create(null),wf=t=>{const s=Ly.get(t);if(s)return s;let n=gx(t);return Pc[n]?n=`${n}${Pc[n]++}`:Pc[n]=1,Sa[n]=t,Ly.set(t,n),n},fa=t=>/^[$A-Z_a-z][\w$]*$/.test(t),gx=t=>{switch(typeof t){case"object":{if(t===null)break;const s=uh(t)??"object";return s[0].toLowerCase()+s.slice(1)}case"function":return fa(t.name)?t.name:"fn";case"symbol":return t.description&&fa(t.description)?t.description:"symbol"}return it(`Unexpected attempt to register serializable value of type ${hn(t)}`)},hh=t=>typeof t=="string"?JSON.stringify(t):typeof t=="bigint"?`${t}n`:`${t}`,bx=(t,s={})=>oa(t,{onUndefined:"$ark.undefined",onBigInt:n=>`$ark.bigint-${n}`,...s},[]),Me=(t,s)=>{switch(hn(t)){case"object":const n=t,r=n.constructor.name;return r==="Object"||r==="Array"?(s==null?void 0:s.quoteKeys)===!1?lo(n,(s==null?void 0:s.indent)??0,""):JSON.stringify(oa(n,Qs,[]),null,s==null?void 0:s.indent):lo(n,(s==null?void 0:s.indent)??0,"");case"symbol":return Qs.onSymbol(t);default:return hh(t)}},lo=(t,s,n)=>{if(typeof t=="function")return Qs.onFunction(t);if(typeof t!="object"||t===null)return hh(t);const r=n+" ".repeat(s);if(Array.isArray(t)){if(t.length===0)return"[]";const c=t.map(h=>lo(h,s,r)).join(`,
68
- `+r);return s?`[
69
- ${r}${c}
70
- ${n}]`:`[${c}]`}const o=t.constructor.name;if(o==="Object"){const c=ro(t).map(([h,p])=>{const m=typeof h=="symbol"?Qs.onSymbol(h):fa(h)?h:JSON.stringify(h),y=lo(p,s,r);return`${r}${m}: ${y}`});return c.length===0?"{}":s?`{
71
- ${c.join(`,
72
- `)}
73
- ${n}}`:`{${c.join(", ")}}`}return t instanceof Date?Aa(t):"expression"in t&&typeof t.expression=="string"?t.expression:o},Qs={onCycle:()=>"(cycle)",onSymbol:t=>`Symbol(${wf(t)})`,onFunction:t=>`Function(${wf(t)})`},oa=(t,s,n)=>{var r,o;switch(hn(t)){case"object":{const c=t;if("toJSON"in c&&typeof c.toJSON=="function")return c.toJSON();if(typeof c=="function")return Qs.onFunction(c);if(n.includes(c))return"(cycle)";const h=[...n,c];if(Array.isArray(c))return c.map(m=>oa(m,s,h));if(c instanceof Date)return c.toDateString();const p={};for(const m in c)p[m]=oa(c[m],s,h);for(const m of Object.getOwnPropertySymbols(c))p[((r=s.onSymbol)==null?void 0:r.call(s,m))??m.toString()]=oa(c[m],s,h);return p}case"symbol":return Qs.onSymbol(t);case"bigint":return((o=s.onBigInt)==null?void 0:o.call(s,t))??`${t}n`;case"undefined":return s.onUndefined??"undefined";case"string":return t.replaceAll("\\","\\\\");default:return t}},Aa=t=>{const s=t.getFullYear(),n=t.getMonth(),r=t.getDate(),o=t.getHours(),c=t.getMinutes(),h=t.getSeconds(),p=t.getMilliseconds();if(n===0&&r===1&&o===0&&c===0&&h===0&&p===0)return`${s}`;const m=`${vx[n]} ${r}, ${s}`;if(o===0&&c===0&&h===0&&p===0)return m;let y=t.toLocaleTimeString();const v=y.endsWith(" AM")||y.endsWith(" PM")?y.slice(-3):"";return v&&(y=y.slice(0,-v.length)),p?y+=`.${Ax(p,3)}`:Sx.test(y)&&(y=y.slice(0,-3)),`${y+v}, ${m}`},vx=["January","February","March","April","May","June","July","August","September","October","November","December"],Sx=/:\d\d:00$/,Ax=(t,s)=>String(t).padStart(s,"0"),Nb=(t,s,...[n])=>{const r=(n==null?void 0:n.stringifySymbol)??Me;let o=t;switch(typeof s){case"string":o=fa(s)?t===""?s:`${t}.${s}`:`${t}[${JSON.stringify(s)}]`;break;case"number":o=`${t}[${s}]`;break;case"symbol":o=`${t}[${r(s)}]`;break;default:n!=null&&n.stringifyNonKey?o=`${t}[${n.stringifyNonKey(s)}]`:q(`${Me(s)} must be a PropertyKey or stringifyNonKey must be passed to options`)}return o},wa=(t,...s)=>t.reduce((n,r)=>Nb(n,r,...s),"");class Mb extends gb{constructor(...n){super();g(this,"cache",{});this.push(...n)}toJSON(){if(this.cache.json)return this.cache.json;this.cache.json=[];for(let n=0;n<this.length;n++)this.cache.json.push(typeof this[n]=="symbol"?Me(this[n]):this[n]);return this.cache.json}stringify(){return this.cache.stringify?this.cache.stringify:this.cache.stringify=wa(this)}stringifyAncestors(){if(this.cache.stringifyAncestors)return this.cache.stringifyAncestors;let n="";const r=[n];for(const o of this)n=Nb(n,o),r.push(n);return this.cache.stringifyAncestors=r}}class wx{constructor(s){g(this,"chars");g(this,"i");g(this,"def");this.def=s,this.chars=[...s],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(s){let n="";for(;this.lookahead;){if(s(this,n))if(n[n.length-1]===vf)n=n.slice(0,-1);else break;n+=this.shift()}return n}shiftUntilLookahead(s){return typeof s=="string"?this.shiftUntil(n=>n.lookahead===s):this.shiftUntil(n=>n.lookahead in s)}shiftUntilNonWhitespace(){return this.shiftUntil(()=>!(this.lookahead in So))}jumpToIndex(s){this.i=s<0?this.length+s:s}jumpForward(s){this.i+=s}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(s,n){return this.chars.slice(s,n).join("")}lookaheadIs(s){return this.lookahead===s}lookaheadIsIn(s){return this.lookahead in s}}let xf="$ark",xx=2;for(;xf in globalThis;)xf=`$ark${xx++}`;const $b=xf;globalThis[$b]=Sa;const L=Sa,Ox=t=>`${$b}.${t}`,kt=t=>Ox(wf(t));class Db extends Sb{constructor(...n){super();g(this,"argNames");g(this,"body","");g(this,"indentation",0);this.argNames=n;for(const r of n){if(r in this)throw new Error(`Arg name '${r}' would overwrite an existing property on FunctionBody`);this[r]=r}}indent(){return this.indentation+=4,this}dedent(){return this.indentation-=4,this}prop(n,r=!1){return Cb(n,r)}index(n,r=!1){return zb(`${n}`,r)}line(n){return this.body+=`${" ".repeat(this.indentation)}${n}
74
- `,this}const(n,r){return this.line(`const ${n} = ${r}`),this}let(n,r){return this.line(`let ${n} = ${r}`)}set(n,r){return this.line(`${n} = ${r}`)}if(n,r){return this.block(`if (${n})`,r)}elseIf(n,r){return this.block(`else if (${n})`,r)}else(n){return this.block("else",n)}for(n,r,o=0){return this.block(`for (let i = ${o}; ${n}; i++)`,r)}forIn(n,r){return this.block(`for (const k in ${n})`,r)}block(n,r,o=""){return this.line(`${n} {`),this.indent(),r(this),this.dedent(),this.line(`}${o}`)}return(n=""){return this.line(`return ${n}`)}write(n="anonymous",r=0){return`${n}(${this.argNames.join(", ")}) { ${r?this.body.split(`
75
- `).map(o=>" ".repeat(r)+`${o}`).join(`
76
- `):this.body} }`}compile(){return new Iw(...this.argNames,this.body)}}const xa=t=>Qi(t,"object")||typeof t=="symbol"?kt(t):hh(t),Cb=(t,s=!1)=>typeof t=="string"&&fa(t)?`${s?"?":""}.${t}`:zb(Ex(t),s),Ex=t=>typeof t=="symbol"?kt(t):JSON.stringify(t),zb=(t,s=!1)=>`${s?"?.":""}[${t}]`;class ef extends Db{constructor(n){super("data","ctx");g(this,"traversalKind");g(this,"optimistic");this.traversalKind=n.kind,this.optimistic=n.optimistic===!0}invoke(n,r){const o=(r==null?void 0:r.arg)??this.data,c=typeof n=="string"?!0:this.requiresContextFor(n),h=typeof n=="string"?n:n.id;return c?`${this.referenceToId(h,r)}(${o}, ${this.ctx})`:`${this.referenceToId(h,r)}(${o})`}referenceToId(n,r){const o=(r==null?void 0:r.kind)??this.traversalKind,c=`this.${n}${o}`;return r!=null&&r.bind?`${c}.bind(${r==null?void 0:r.bind})`:c}requiresContextFor(n){return this.traversalKind==="Apply"||n.allowsRequiresContext}initializeErrorCount(){return this.const("errorCount","ctx.currentErrorCount")}returnIfFail(){return this.if("ctx.currentErrorCount > errorCount",()=>this.return())}returnIfFailFast(){return this.if("ctx.failFast && ctx.currentErrorCount > errorCount",()=>this.return())}traverseKey(n,r,o){const c=this.requiresContextFor(o);return c&&this.line(`${this.ctx}.path.push(${n})`),this.check(o,{arg:r}),c&&this.line(`${this.ctx}.path.pop()`),this}check(n,r){return this.traversalKind==="Allows"?this.if(`!${this.invoke(n,r)}`,()=>this.return(!1)):this.line(this.invoke(n,r))}}const Ub=t=>Ce(t,(s,n)=>[s,Et(n)?[...n]:n]),Vn=bb("arkKind"),te=(t,s)=>(t==null?void 0:t[Vn])===s,Rt=t=>te(t,"root")||te(t,"constraint"),_x=["unit","proto","domain"],Ao=["required","optional","index","sequence"],Bb=["pattern","divisor","exactLength","max","min","maxLength","minLength","before","after"],dh=[...Bb,...Ao,"structure","predicate"],wo=["alias","union","morph","unit","intersection","proto","domain"],Tx=[...wo,...dh],qb=Ce(dh,(t,s)=>[s,1]),Rx=Ce([...Ao,"undeclared"],(t,s)=>[s,1]),Kb=Ce(Tx,(t,s)=>[s,t]),Fl=t=>typeof t=="string"&&t in Kb,oo=t=>Kb[t],ph=t=>wo.slice(oo(t)+1);[...ph("union")];[...ph("morph")];const Ii=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:xa(t),xo=t=>{let s="{ ";for(const[n,r]of Object.entries(t))s+=`${n}: ${xa(r)}, `;return s+" }"},Ie=t=>{var n,r,o,c;const s=t;return s.hasAssociatedError&&((n=s.defaults).expected??(n.expected=h=>"description"in h?h.description:s.defaults.description(h)),(r=s.defaults).actual??(r.actual=h=>Me(h)),(o=s.defaults).problem??(o.problem=h=>`must be ${h.expected}${h.actual?` (was ${h.actual})`:""}`),(c=s.defaults).message??(c.message=h=>{if(h.path.length===0)return h.problem;const p=`${h.propString} ${h.problem}`;return p[0]==="["?`value at ${p}`:p})),s};class kx extends Error{constructor(n,r){super(Me(r,{quoteKeys:!1,indent:4}));g(this,"name","ToJsonSchemaError");g(this,"code");g(this,"context");this.code=n,this.context=r}hasCode(n){return this.code===n}}const Nx={dialect:"https://json-schema.org/draft/2020-12/schema",useRefs:!1,fallback:{arrayObject:t=>at.throw("arrayObject",t),arrayPostfix:t=>at.throw("arrayPostfix",t),defaultValue:t=>at.throw("defaultValue",t),domain:t=>at.throw("domain",t),morph:t=>at.throw("morph",t),patternIntersection:t=>at.throw("patternIntersection",t),predicate:t=>at.throw("predicate",t),proto:t=>at.throw("proto",t),symbolKey:t=>at.throw("symbolKey",t),unit:t=>at.throw("unit",t),date:t=>at.throw("date",t)}},at={Error:kx,throw:(...t)=>{throw new at.Error(...t)},throwInternalOperandError:(t,s)=>it(`Unexpected JSON Schema input for ${t}: ${Me(s)}`),defaultConfig:Nx};L.config??(L.config={});const Of=(t,s)=>{if(!s)return t;const n={...t};let r;for(r in s){const o={...t.keywords};if(r==="keywords"){for(const c in s[r]){const h=s.keywords[c];h!==void 0&&(o[c]=typeof h=="string"?{description:h}:h)}n.keywords=o}else r==="toJsonSchema"?n[r]=jb(t.toJsonSchema,s.toJsonSchema):Fl(r)?n[r]={...t[r],...s[r]}:n[r]=s[r]}return n},jb=(t,s)=>{if(!t)return s??{};if(!s)return t;const n={...t};let r;for(r in s)r==="fallback"?n.fallback=Mx(t.fallback,s.fallback):n[r]=s[r];return n},Mx=(t,s)=>{t=Vy(t),s=Vy(s);const n={};let r;for(r in at.defaultConfig.fallback)n[r]=s[r]??s.default??t[r]??t.default??at.defaultConfig.fallback[r];return n},Vy=t=>typeof t=="function"?{default:t}:t??{};var Lg,Vg;class Fs extends(Vg=Sb,Lg=Vn,Vg){constructor({prefixPath:n,relativePath:r,...o},c){super();g(this,Lg,"error");g(this,"path");g(this,"data");g(this,"nodeConfig");g(this,"input");g(this,"ctx");this.input=o,this.ctx=c,Bw(this,o);const h=c.data;o.code==="union"&&(o.errors=o.errors.flatMap(m=>{const y=m.hasCode("union")?m.errors:[m];return!n&&!r?y:y.map(v=>v.transform(x=>({...x,path:Rw(n,x.path,r)})))})),this.nodeConfig=c.config[this.code];const p=[...o.path??c.path];r&&p.push(...r),n&&p.unshift(...n),this.path=new Mb(...p),this.data="data"in o?o.data:h}transform(n){return new Fs(n({data:this.data,path:this.path,...this.input}),this.ctx)}hasCode(n){return this.code===n}get propString(){return wa(this.path)}get expected(){var r;if(this.input.expected)return this.input.expected;const n=((r=this.meta)==null?void 0:r.expected)??this.nodeConfig.expected;return typeof n=="function"?n(this.input):n}get actual(){var r;if(this.input.actual)return this.input.actual;const n=((r=this.meta)==null?void 0:r.actual)??this.nodeConfig.actual;return typeof n=="function"?n(this.data):n}get problem(){var r;if(this.input.problem)return this.input.problem;const n=((r=this.meta)==null?void 0:r.problem)??this.nodeConfig.problem;return typeof n=="function"?n(this):n}get message(){var r;if(this.input.message)return this.input.message;const n=((r=this.meta)==null?void 0:r.message)??this.nodeConfig.message;return typeof n=="function"?n(this):n}get flat(){return this.hasCode("intersection")?[...this.errors]:[this]}toJSON(){return{data:this.data,path:this.path,...this.input,expected:this.expected,actual:this.actual,problem:this.problem,message:this.message}}toString(){return this.message}throw(){throw this}}var Hg,Gg;class wi extends(Gg=gb,Hg=Vn,Gg){constructor(n){super();g(this,Hg,"errors");g(this,"ctx");g(this,"byPath",Object.create(null));g(this,"byAncestorPath",Object.create(null));g(this,"count",0);g(this,"mutable",this);this.ctx=n}get flatByPath(){return Ce(this.byPath,(n,r)=>[n,r.flat])}get flatProblemsByPath(){return Ce(this.byPath,(n,r)=>[n,r.flat.map(o=>o.problem)])}throw(){throw this.toTraversalError()}toTraversalError(){return new $x(this)}add(n){this.includes(n)||this._add(n)}transform(n){const r=new wi(this.ctx);for(const o of this)r.add(n(o));return r}merge(n){for(const r of n)this.includes(r)||this._add(new Fs({...r,path:[...this.ctx.path,...r.path]},this.ctx))}affectsPath(n){return this.length===0?!1:n.stringifyAncestors().some(r=>r in this.byPath)||n.stringify()in this.byAncestorPath}get summary(){return this.toString()}get issues(){return this}toJSON(){return[...this.map(n=>n.toJSON())]}toString(){return this.join(`
77
- `)}_add(n){const r=this.byPath[n.propString];if(r){if(r.hasCode("union")&&r.errors.length===0)return;const o=n.hasCode("union")&&n.errors.length===0?n:new Fs({code:"intersection",errors:r.hasCode("intersection")?[...r.errors,n]:[r,n]},this.ctx),c=this.indexOf(r);this.mutable[c===-1?this.length:c]=o,this.byPath[n.propString]=o,this.addAncestorPaths(n)}else this.byPath[n.propString]=n,this.addAncestorPaths(n),this.mutable.push(n);this.count++}addAncestorPaths(n){for(const r of n.path.stringifyAncestors())this.byAncestorPath[r]=De(this.byAncestorPath[r],n)}}class $x extends Error{constructor(n){var s=(...YR)=>(super(...YR),g(this,"name","TraversalError"),this);n.length===1?s(n.summary):s(`
78
- `+n.map(r=>` • ${Dx(r)}`).join(`
79
- `)),Object.defineProperty(this,"arkErrors",{value:n,enumerable:!1})}}const Dx=t=>t.toString().split(`
80
- `).join(`
81
- `);class Ls{constructor(s,n){g(this,"path",[]);g(this,"errors",new wi(this));g(this,"root");g(this,"config");g(this,"queuedMorphs",[]);g(this,"branches",[]);g(this,"seen",{});this.root=s,this.config=n}get data(){let s=this.root;for(const n of this.path)s=s==null?void 0:s[n];return s}get propString(){return wa(this.path)}reject(s){return this.error(s),!1}mustBe(s){return this.error(s),!1}error(s){const n=typeof s=="object"?s.code?s:{...s,code:"predicate"}:{code:"predicate",expected:s};return this.errorFromContext(n)}hasError(){return this.currentErrorCount!==0}get currentBranch(){return this.branches.at(-1)}queueMorphs(s){const n={path:new Mb(...this.path),morphs:s};this.currentBranch?this.currentBranch.queuedMorphs.push(n):this.queuedMorphs.push(n)}finalize(s){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()?s?s(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(s){return this.errorFromContext(s)}errorFromContext(s){const n=new Fs(s,this);return this.currentBranch?this.currentBranch.error=n:this.errors.add(n),n}applyQueuedMorphs(){for(;this.queuedMorphs.length;){const s=this.queuedMorphs;this.queuedMorphs=[];for(const{path:n,morphs:r}of s)this.errors.affectsPath(n)||this.applyMorphsAtPath(n,r)}}applyMorphsAtPath(s,n){const r=s.at(-1);let o;if(r!==void 0){o=this.root;for(let c=0;c<s.length-1;c++)o=o[s[c]]}this.path=[...s];for(const c of n){const h=Rt(c),p=c(o===void 0?this.root:o[r],this);if(p instanceof Fs){this.errors.add(p);break}if(p instanceof wi){h||this.errors.merge(p);break}o===void 0?this.root=p:o[r]=p,this.applyQueuedMorphs()}}}const Hn=(t,s,n)=>{if(!n)return s();n.path.push(t);const r=s();return n.path.pop(),r};class Lb extends tr{constructor(n,r){var c;super((h,p,m=this.onFail)=>p?(this.traverseApply(h,p),p.hasError()?p.errors:p.data):this.rootApply(h,m),{attach:n});g(this,"attachments");g(this,"$");g(this,"onFail");g(this,"includesTransform");g(this,"includesContextualPredicate");g(this,"isCyclic");g(this,"allowsRequiresContext");g(this,"rootApplyStrategy");g(this,"contextFreeMorph");g(this,"rootApply");g(this,"referencesById");g(this,"shallowReferences");g(this,"flatRefs");g(this,"flatMorphs");g(this,"allows");g(this,"compiledMeta",Ux(this.metaJson));g(this,"precedence",oo(this.kind));g(this,"precompilation");g(this,"assert",(n,r)=>this(n,r,o=>o.throw()));this.attachments=n,this.$=r,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((h,p)=>Bx(h,p.shallowReferences),[this]);const o=this.isStructural();this.flatRefs=[],this.flatMorphs=[];for(let h=0;h<this.children.length;h++){if(this.includesTransform||(this.includesTransform=this.children[h].includesTransform),this.includesContextualPredicate||(this.includesContextualPredicate=this.children[h].includesContextualPredicate),this.isCyclic||(this.isCyclic=this.children[h].isCyclic),!o){const p=this.children[h].flatRefs;for(let m=0;m<p.length;m++){const y=p[m];if(!this.flatRefs.some(v=>Vb(v,y))){this.flatRefs.push(y);for(const v of y.node.branches)(v.hasKind("morph")||v.hasKind("intersection")&&((c=v.structure)==null?void 0:c.structuralMorph)!==void 0)&&this.flatMorphs.push({path:y.path,propString:y.propString,node:v})}}}Object.assign(this.referencesById,this.children[h].referencesById)}this.flatRefs.sort((h,p)=>h.path.length>p.path.length?1:h.path.length<p.path.length?-1:h.propString>p.propString?1:h.propString<p.propString||h.node.expression<p.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(h=>h.length===1||h.name==="$arkStructuralMorph")?this.hasKind("union")?this.branches.some(h=>h.shallowMorphs.length>1)?"contextual":"branchedOptimistic":this.shallowMorphs.length>1?"contextual":"optimistic":"contextual":"contextual",this.rootApply=this.createRootApply(),this.allows=this.allowsRequiresContext?h=>this.traverseAllows(h,new Ls(h,this.$.resolvedConfig)):h=>this.traverseAllows(h)}get shallowMorphs(){return[]}createRootApply(){switch(this.rootApplyStrategy){case"allows":return(r,o)=>{if(this.allows(r))return r;const c=new Ls(r,this.$.resolvedConfig);return this.traverseApply(r,c),c.finalize(o)};case"contextual":return(r,o)=>{const c=new Ls(r,this.$.resolvedConfig);return this.traverseApply(r,c),c.finalize(o)};case"optimistic":this.contextFreeMorph=this.shallowMorphs[0];const n=this.$.resolvedConfig.clone;return(r,o)=>{if(this.allows(r))return this.contextFreeMorph(n&&(typeof r=="object"&&r!==null||typeof r=="function")?n(r):r);const c=new Ls(r,this.$.resolvedConfig);return this.traverseApply(r,c),c.finalize(o)};case"branchedOptimistic":return this.createBranchedOptimisticRootApply();default:return this.rootApplyStrategy,it(`Unexpected rootApplyStrategy ${this.rootApplyStrategy}`)}}cacheGetter(n,r){return Object.defineProperty(this,n,{value:r}),r}get description(){var n;return this.cacheGetter("description",((n=this.meta)==null?void 0:n.description)??this.$.resolvedConfig[this.kind].description(this))}get references(){return Object.values(this.referencesById)}traverse(n,r){return this(n,r,null)}get in(){return this.cacheGetter("in",this.getIo("in"))}get out(){return this.cacheGetter("out",this.getIo("out"))}getIo(n){if(!this.includesTransform)return this;const r={};for(const[o,c]of this.innerEntries){const h=this.impl.keys[o];if(h.reduceIo)h.reduceIo(n,r,c);else if(h.child){const p=c;r[o]=Et(p)?p.map(m=>m[n]):p[n]}else r[o]=c}return this.$.node(this.kind,r)}toJSON(){return this.json}toString(){return`Type<${this.expression}>`}equals(n){const r=Rt(n)?n:this.$.parseDefinition(n);return this.innerHash===r.innerHash}ifEquals(n){return this.equals(n)?this:void 0}hasKind(n){return this.kind===n}assertHasKind(n){return this.kind!==n&&Xs(`${this.kind} node was not of asserted kind ${n}`),this}hasKindIn(...n){return n.includes(this.kind)}assertHasKindIn(...n){return Li(n,this.kind)||Xs(`${this.kind} node was not one of asserted kinds ${n}`),this}isBasis(){return Li(_x,this.kind)}isConstraint(){return Li(dh,this.kind)}isStructural(){return Li(Ao,this.kind)}isRefinement(){return Li(Bb,this.kind)}isRoot(){return Li(wo,this.kind)}isUnknown(){return this.hasKind("intersection")&&this.children.length===0}isNever(){return this.hasKind("union")&&this.children.length===0}hasUnit(n){return this.hasKind("unit")&&this.allows(n)}hasOpenIntersection(){return this.impl.intersectionIsOpen}get nestableExpression(){return this.expression}select(n){const r=ra.normalize(n);return this._select(r)}_select(n){let r=ra.applyBoundary[n.boundary??"references"](this);return n.kind&&(r=r.filter(o=>o.kind===n.kind)),n.where&&(r=r.filter(n.where)),ra.applyMethod[n.method??"filter"](r,this,n)}transform(n,r){return this._transform(n,this._createTransformContext(r))}_createTransformContext(n){return{root:this,selected:void 0,seen:{},path:[],parseOptions:{prereduced:(n==null?void 0:n.prereduced)??!1},undeclaredKeyHandling:void 0,...n}}_transform(n,r){var x;const o=r.bindScope??this.$;if(r.seen[this.id])return this.$.lazilyResolve(r.seen[this.id]);if(((x=r.shouldTransform)==null?void 0:x.call(r,this,r))===!1)return this;let c;r.seen[this.id]=()=>c,this.hasKind("structure")&&this.undeclared!==r.undeclaredKeyHandling&&(r={...r,undeclaredKeyHandling:this.undeclared});const h=Ce(this.inner,(N,k)=>{if(!this.impl.keys[N].child)return[N,k];const B=k;if(!Et(B)){const Z=B._transform(n,r);return Z?[N,Z]:[]}if(B.length===0)return[N,k];const K=B.flatMap(Z=>Z._transform(n,r)??[]);return K.length?[N,K]:[]});delete r.seen[this.id];const p=Object.assign(h,{meta:this.meta}),m=r.selected&&!r.selected.includes(this)?p:n(this.kind,p,r);if(m===null)return null;if(Rt(m))return c=m;const y=Object.keys(m);return(y.length===0||y.length===1&&y[0]==="meta")&&!va(this.inner)?null:(this.kind==="required"||this.kind==="optional"||this.kind==="index")&&!("value"in m)?r.undeclaredKeyHandling?{...m,value:L.intrinsic.unknown}:null:(this.kind==="morph"&&(m.in??(m.in=L.intrinsic.unknown)),c=o.node(this.kind,m,r.parseOptions))}configureReferences(n,r="references"){const o=ra.normalize(r),c=typeof n=="string"?(y,v)=>({...v,meta:{...v.meta,description:n}}):typeof n=="function"?(y,v)=>({...v,meta:n(v.meta)}):(y,v)=>({...v,meta:{...v.meta,...n}});if(o.boundary==="self")return this.$.node(this.kind,c(this.kind,{...this.inner,meta:this.meta}));const h=this._select(o),p=h&&ba(h),m=o.boundary==="child"?(y,v)=>v.root.children.includes(y):o.boundary==="shallow"?y=>y.kind!=="structure":()=>!0;return this.$.finalize(this.transform(c,{shouldTransform:m,selected:p}))}}const ra={applyBoundary:{self:t=>[t],child:t=>[...t.children],shallow:t=>[...t.shallowReferences],references:t=>[...t.references]},applyMethod:{filter:t=>t,assertFilter:(t,s,n)=>(t.length===0&&Xs(Hy(s,n)),t),find:t=>t[0],assertFind:(t,s,n)=>(t.length===0&&Xs(Hy(s,n)),t[0])},normalize:t=>typeof t=="function"?{boundary:"references",method:"filter",where:t}:typeof t=="string"?wn(t,ra.applyBoundary)?{method:"filter",boundary:t}:{boundary:"references",method:"filter",kind:t}:{boundary:"references",method:"filter",...t}},Hy=(t,s)=>`${t} had no references matching ${Me(s)}.`,Cx=t=>wa(t,{stringifyNonKey:s=>s.expression}),zx=/"(\$ark\.[^"]+)"/g,Ux=t=>JSON.stringify(t).replaceAll(zx,"$1"),Si=(t,s)=>({path:t,node:s,propString:Cx(t)}),Vb=(t,s)=>t.propString===s.propString&&t.node.equals(s.node),Gy=(t,s)=>Yi(t,s,{isEqual:Vb}),Bx=(t,s)=>Yi(t,s,{isEqual:(n,r)=>n.equals(r)});class X extends Array{static init(s,n,r,o){return new X({kind:s,l:n,r,path:(o==null?void 0:o.path)??[],optional:(o==null?void 0:o.optional)??!1})}add(s,n,r,o){return this.push({kind:s,l:n,r,path:(o==null?void 0:o.path)??[],optional:(o==null?void 0:o.optional)??!1}),this}get summary(){return this.describeReasons()}describeReasons(){if(this.length===1){const{path:s,l:n,r}=this[0],o=wa(s);return Hb(`Intersection${o&&` at ${o}`} of ${Yy(n,r)}`)}return`The following intersections result in unsatisfiable types:
82
- • ${this.map(({path:s,l:n,r})=>`${s}: ${Yy(n,r)}`).join(`
83
- • `)}`}throw(){return q(this.describeReasons())}invert(){const s=this.map(n=>({...n,l:n.r,r:n.l}));return s instanceof X?s:new X(...s)}withPrefixKey(s,n){return this.map(r=>({...r,path:[s,...r.path],optional:r.optional||n==="optional"}))}toNeverIfDisjoint(){return L.intrinsic.never}}const Yy=(t,s)=>`${Ef(t)} and ${Ef(s)}`,Ef=t=>Rt(t)?t.expression:Et(t)?t.map(Ef).join(" | ")||"never":String(t),Hb=t=>`${t} results in an unsatisfiable type`,Bs={},Gn=(t,s,n)=>ht(t,s,{$:n,invert:!1,pipe:!1}),_f=(t,s,n)=>ht(t,s,{$:n,invert:!1,pipe:!0}),ht=(t,s,n)=>{const r=n.pipe?"|>":"&",o=`${t.hash}${r}${s.hash}`;if(Bs[o]!==void 0)return Bs[o];if(!n.pipe){const p=`${s.hash}${r}${t.hash}`;if(Bs[p]!==void 0){const m=Bs[p],y=m instanceof X?m.invert():m;return Bs[o]=y,y}}const c=!n.pipe||!t.includesTransform&&!s.includesTransform;if(c&&t.equals(s))return t;let h=c?Tf(t,s,n):t.hasKindIn(...wo)?qx(t,s,n):Tf(t,s,n);return Rt(h)&&(t.equals(h)?h=t:s.equals(h)&&(h=s)),Bs[o]=h,h},Tf=(t,s,n)=>{const r=t.precedence<s.precedence?t.kind:s.kind,o=t.impl.intersections[s.kind]??s.impl.intersections[t.kind];if(o===void 0)return null;if(r===t.kind)return o(t,s,n);{let c=o(s,t,{...n,invert:!n.invert});return c instanceof X&&(c=c.invert()),c}},qx=(t,s,n)=>t.includesTransform||s.includesTransform?n.invert?Jy(s,t,n):Jy(t,s,n):Tf(t,s,n),Jy=(t,s,n)=>t.distribute(r=>Kx(r,s,n),r=>{const o=r.filter(Rt);if(o.length===0)return X.init("union",t.branches,s.branches);if(o.length<t.branches.length||!t.branches.every((h,p)=>h.in.equals(o[p].in)))return n.$.parseSchema(o);if(o.length===1)return o[0];const c={branches:o};return n.$.parseSchema(c)}),Kx=(t,s,n)=>{if(t.hasKind("morph")){const o=[...t.morphs];if(t.lastMorphIfNode){const c=ht(t.lastMorphIfNode,s,n);if(c instanceof X)return c;o[o.length-1]=c}else o.push(s);return n.$.node("morph",{morphs:o,in:t.inner.in})}if(s.hasKind("morph")){const o=ht(t,s.in,n);return o instanceof X?o:n.$.node("morph",{morphs:[s],in:o})}return n.$.node("morph",{morphs:[s],in:t})};class nr extends Lb{constructor(n,r){super(n,r);g(this,"impliedSiblings");Object.defineProperty(this,Vn,{value:"constraint",enumerable:!1})}intersect(n){return Gn(this,n,this.$)}}class Oo extends nr{constructor(){super(...arguments);g(this,"traverseApply",(n,r)=>{this.traverseAllows(n,r)||r.errorFromNodeContext(this.errorContext)})}compile(n){n.traversalKind==="Allows"?n.return(this.compiledCondition):n.if(this.compiledNegation,()=>n.line(`${n.ctx}.errorFromNodeContext(${this.compiledErrorContext})`))}get errorContext(){return{code:this.kind,description:this.description,meta:this.meta,...this.inner}}get compiledErrorContext(){return xo(this.errorContext)}}const zt=t=>(s,n)=>{if(Et(s)){if(s.length===0)return;const o=s.map(c=>n.$.node(t,c));return t==="predicate"?o:o.sort((c,h)=>c.hash<h.hash?-1:1)}const r=n.$.node(t,s);return r.hasOpenIntersection()?[r]:r},uo=t=>{const s=t.r.shift();if(!s){let r=t.l.length===0&&t.kind==="structure"?L.intrinsic.unknown.internal:t.ctx.$.node(t.kind,Object.assign(t.baseInner,jx(t.l)),{prereduced:!0});for(const o of t.roots){if(r instanceof X)return r;r=ht(o,r,t.ctx)}return r}let n=!1;for(let r=0;r<t.l.length;r++){const o=ht(t.l[r],s,t.ctx);if(o!==null){if(o instanceof X)return o;if(n){if(!t.l.includes(o))return it(`Unexpectedly encountered multiple distinct intersection results for refinement ${o}`)}else{if(o.isRoot())return t.roots.push(o),t.l.splice(r),uo(t);t.l[r]=o,n=!0}}}if(n||t.l.push(s),t.kind==="intersection"&&s.impliedSiblings)for(const r of s.impliedSiblings)Yi(t.r,r);return uo(t)},co=t=>Object.entries(t).flatMap(([n,r])=>n in qb?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),jx=t=>{const s={};for(const n of t)if(n.hasOpenIntersection())s[n.kind]=De(s[n.kind],n);else{if(s[n.kind])return it(`Unexpected intersection of closed refinements of kind ${n.kind}`);s[n.kind]=n}return s},Lx=(...t)=>q(Vx(...t)),Vx=(t,s,n)=>{const r=n.hasKind("morph")?"a morph":n.isUnknown()?"unknown":n.exclude(s).defaultShortDescription;return`${Ww(t)} operand must be ${s.description} (was ${r})`},Hx=(t,s,n)=>new fo(t,s,n,n,null);class Gb extends tr{}var Yg,Jg;class fo extends(Jg=tr,Yg=Vn,Jg){constructor(n,r,o,c,h){super((...p)=>{const m=Ce(this.names,(y,v)=>{const x=this.arg$.parse(p[y]);return x.extends(this.constraints[y])||q(Gx(v,this.constraints[y].expression,x.expression)),[v,x]});if(this.defIsLazy()){const y=this.bodyDef(m);return this.$.parse(y)}return this.$.parse(r,{args:m})});g(this,Yg,"generic");g(this,"paramDefs");g(this,"bodyDef");g(this,"$");g(this,"arg$");g(this,"baseInstantiation");g(this,"hkt");g(this,"description");this.paramDefs=n,this.bodyDef=r,this.$=o,this.arg$=c,this.hkt=h,this.description=h?new h().description??`a generic type for ${h.constructor.name}`:"a generic type",this.baseInstantiation=this(...this.constraints)}defIsLazy(){return this.bodyDef instanceof Gb}cacheGetter(n,r){return Object.defineProperty(this,n,{value:r}),r}get json(){return this.cacheGetter("json",{params:this.params.map(n=>n[1].isUnknown()?n[0]:[n[0],n[1].json]),body:bx(this.bodyDef)})}get params(){return this.cacheGetter("params",this.paramDefs.map(n=>typeof n=="string"?[n,L.intrinsic.unknown]:[n[0],this.$.parse(n[1])]))}get names(){return this.cacheGetter("names",this.params.map(n=>n[0]))}get constraints(){return this.cacheGetter("constraints",this.params.map(n=>n[1]))}get internal(){return this}get referencesById(){return this.baseInstantiation.internal.referencesById}get references(){return this.baseInstantiation.internal.references}}const Gx=(t,s,n)=>`${t} must be assignable to ${s} (was ${n})`,Yx=Ie({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 Jx extends nr{constructor(){super(...arguments);g(this,"serializedPredicate",kt(this.predicate));g(this,"compiledCondition",`${this.serializedPredicate}(data, ctx)`);g(this,"compiledNegation",`!${this.compiledCondition}`);g(this,"impliedBasis",null);g(this,"expression",this.serializedPredicate);g(this,"traverseAllows",this.predicate);g(this,"errorContext",{code:"predicate",description:this.description,meta:this.meta});g(this,"compiledErrorContext",xo(this.errorContext));g(this,"traverseApply",(n,r)=>{!this.predicate(n,r.external)&&!r.hasError()&&r.errorFromNodeContext(this.errorContext)})}compile(n){if(n.traversalKind==="Allows"){n.return(this.compiledCondition);return}n.if(`${this.compiledNegation} && !ctx.hasError()`,()=>n.line(`ctx.errorFromNodeContext(${this.compiledErrorContext})`))}reduceJsonSchema(n,r){return r.fallback.predicate({code:"predicate",base:n,predicate:this.predicate})}}const Yb={implementation:Yx,Node:Jx},Ix=Ie({kind:"divisor",collapsibleKey:"rule",keys:{rule:{parse:t=>Number.isInteger(t)?t:q(Zx(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,s,n)=>n.$.node("divisor",{rule:Math.abs(t.rule*s.rule/Qx(t.rule,s.rule))})},obviatesBasisDescription:!0});class Xx extends Oo{constructor(){super(...arguments);g(this,"traverseAllows",n=>n%this.rule===0);g(this,"compiledCondition",`data % ${this.rule} === 0`);g(this,"compiledNegation",`data % ${this.rule} !== 0`);g(this,"impliedBasis",L.intrinsic.number.internal);g(this,"expression",`% ${this.rule}`)}reduceJsonSchema(n){return n.type="integer",this.rule===1||(n.multipleOf=this.rule),n}}const Jb={implementation:Ix,Node:Xx},Zx=t=>`divisor must be an integer (was ${t})`,Qx=(t,s)=>{let n,r=t,o=s;for(;o!==0;)n=o,o=r%o,r=n;return r};class ir extends Oo{constructor(){super(...arguments);g(this,"boundOperandKind",eO[this.kind]);g(this,"compiledActual",this.boundOperandKind==="value"?"data":this.boundOperandKind==="length"?"data.length":"data.valueOf()");g(this,"comparator",tO(this.kind,this.exclusive));g(this,"numericLimit",this.rule.valueOf());g(this,"expression",`${this.comparator} ${this.rule}`);g(this,"compiledCondition",`${this.compiledActual} ${this.comparator} ${this.numericLimit}`);g(this,"compiledNegation",`${this.compiledActual} ${Fx[this.comparator]} ${this.numericLimit}`);g(this,"stringLimit",this.boundOperandKind==="date"?nO(this.numericLimit):`${this.numericLimit}`);g(this,"limitKind",this.comparator[0]==="<"?"upper":"lower")}isStricterThan(n){return(this.limitKind==="upper"?this.numericLimit<n.numericLimit:this.numericLimit>n.numericLimit)||this.numericLimit===n.numericLimit&&this.exclusive===!0&&!n.exclusive}overlapsRange(n){return!(this.isStricterThan(n)||this.numericLimit===n.numericLimit&&(this.exclusive||n.exclusive))}overlapIsUnit(n){return this.numericLimit===n.numericLimit&&!this.exclusive&&!n.exclusive}}const Fx={"<":">=","<=":">",">":"<=",">=":"<"},Wx={min:"max",minLength:"maxLength",after:"before"},Ib={parse:t=>t||void 0},Xb=t=>s=>{if(typeof s=="number")return{rule:s};const{exclusive:n,...r}=s;return n?{...r,rule:t==="minLength"?r.rule+1:r.rule-1}:r},Zb=t=>s=>{if(typeof s=="number"||typeof s=="string"||s instanceof Date)return{rule:s};const{exclusive:n,...r}=s;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},Qb=t=>typeof t=="string"||typeof t=="number"?new Date(t):t,Px=(t,s)=>`${t} bound must be a positive integer (was ${s})`,mh=t=>s=>((!Number.isInteger(s)||s<0)&&q(Px(t,s)),s),eO={min:"value",max:"value",minLength:"length",maxLength:"length",after:"date",before:"date"},tO=(t,s)=>`${wn(t,Wx)?">":"<"}${s?"":"="}`,nO=t=>typeof t=="string"?t:new Date(t).toLocaleString(),iO=t=>`Bounded expression ${t} must be exactly one of number, string, Array, or Date`,sO=Ie({kind:"after",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{parse:Qb,serialize:t=>t.toISOString()}},normalize:Zb("after"),defaults:{description:t=>`${t.collapsibleLimitString} or later`,actual:Aa},intersections:{after:(t,s)=>t.isStricterThan(s)?t:s}});class rO extends ir{constructor(){super(...arguments);g(this,"impliedBasis",L.intrinsic.Date.internal);g(this,"collapsibleLimitString",Aa(this.rule));g(this,"traverseAllows",n=>n>=this.rule)}reduceJsonSchema(n,r){return r.fallback.date({code:"date",base:n,after:this.rule})}}const Fb={implementation:sO,Node:rO},aO=Ie({kind:"before",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{parse:Qb,serialize:t=>t.toISOString()}},normalize:Zb("before"),defaults:{description:t=>`${t.collapsibleLimitString} or earlier`,actual:Aa},intersections:{before:(t,s)=>t.isStricterThan(s)?t:s,after:(t,s,n)=>t.overlapsRange(s)?t.overlapIsUnit(s)?n.$.node("unit",{unit:t.rule}):null:X.init("range",t,s)}});class lO extends ir{constructor(){super(...arguments);g(this,"collapsibleLimitString",Aa(this.rule));g(this,"traverseAllows",n=>n<=this.rule);g(this,"impliedBasis",L.intrinsic.Date.internal)}reduceJsonSchema(n,r){return r.fallback.date({code:"date",base:n,before:this.rule})}}const Wb={implementation:aO,Node:lO},oO=Ie({kind:"exactLength",collapsibleKey:"rule",keys:{rule:{parse:mh("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,s,n)=>X.init("unit",n.$.node("unit",{unit:t.rule}),n.$.node("unit",{unit:s.rule}),{path:["length"]}),minLength:(t,s)=>t.rule>=s.rule?t:X.init("range",t,s),maxLength:(t,s)=>t.rule<=s.rule?t:X.init("range",t,s)}});class uO extends Oo{constructor(){super(...arguments);g(this,"traverseAllows",n=>n.length===this.rule);g(this,"compiledCondition",`data.length === ${this.rule}`);g(this,"compiledNegation",`data.length !== ${this.rule}`);g(this,"impliedBasis",L.intrinsic.lengthBoundable.internal);g(this,"expression",`== ${this.rule}`)}reduceJsonSchema(n){switch(n.type){case"string":return n.minLength=this.rule,n.maxLength=this.rule,n;case"array":return n.minItems=this.rule,n.maxItems=this.rule,n;default:return at.throwInternalOperandError("exactLength",n)}}}const Pb={implementation:oO,Node:uO},cO=Ie({kind:"max",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{},exclusive:Ib},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,s)=>t.isStricterThan(s)?t:s,min:(t,s,n)=>t.overlapsRange(s)?t.overlapIsUnit(s)?n.$.node("unit",{unit:t.rule}):null:X.init("range",t,s)},obviatesBasisDescription:!0});class fO extends ir{constructor(){super(...arguments);g(this,"impliedBasis",L.intrinsic.number.internal);g(this,"traverseAllows",this.exclusive?n=>n<this.rule:n=>n<=this.rule)}reduceJsonSchema(n){return this.exclusive?n.exclusiveMaximum=this.rule:n.maximum=this.rule,n}}const ev={implementation:cO,Node:fO},hO=Ie({kind:"maxLength",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{parse:mh("maxLength")}},reduce:(t,s)=>t.rule===0?s.node("exactLength",t):void 0,normalize:Xb("maxLength"),defaults:{description:t=>`at most length ${t.rule}`,actual:t=>`${t.length}`},intersections:{maxLength:(t,s)=>t.isStricterThan(s)?t:s,minLength:(t,s,n)=>t.overlapsRange(s)?t.overlapIsUnit(s)?n.$.node("exactLength",{rule:t.rule}):null:X.init("range",t,s)}});class dO extends ir{constructor(){super(...arguments);g(this,"impliedBasis",L.intrinsic.lengthBoundable.internal);g(this,"traverseAllows",n=>n.length<=this.rule)}reduceJsonSchema(n){switch(n.type){case"string":return n.maxLength=this.rule,n;case"array":return n.maxItems=this.rule,n;default:return at.throwInternalOperandError("maxLength",n)}}}const tv={implementation:hO,Node:dO},pO=Ie({kind:"min",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{},exclusive:Ib},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,s)=>t.isStricterThan(s)?t:s},obviatesBasisDescription:!0});class mO extends ir{constructor(){super(...arguments);g(this,"impliedBasis",L.intrinsic.number.internal);g(this,"traverseAllows",this.exclusive?n=>n>this.rule:n=>n>=this.rule)}reduceJsonSchema(n){return this.exclusive?n.exclusiveMinimum=this.rule:n.minimum=this.rule,n}}const nv={implementation:pO,Node:mO},yO=Ie({kind:"minLength",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{parse:mh("minLength")}},reduce:t=>t.rule===0?L.intrinsic.unknown:void 0,normalize:Xb("minLength"),defaults:{description:t=>t.rule===1?"non-empty":`at least length ${t.rule}`,actual:t=>t.length===0?"":`${t.length}`},intersections:{minLength:(t,s)=>t.isStricterThan(s)?t:s}});class gO extends ir{constructor(){super(...arguments);g(this,"impliedBasis",L.intrinsic.lengthBoundable.internal);g(this,"traverseAllows",n=>n.length>=this.rule)}reduceJsonSchema(n){switch(n.type){case"string":return n.minLength=this.rule,n;case"array":return n.minItems=this.rule,n;default:return at.throwInternalOperandError("minLength",n)}}}const iv={implementation:yO,Node:gO},bO={min:nv.implementation,max:ev.implementation,minLength:iv.implementation,maxLength:tv.implementation,exactLength:Pb.implementation,after:Fb.implementation,before:Wb.implementation},vO={min:nv.Node,max:ev.Node,minLength:iv.Node,maxLength:tv.Node,exactLength:Pb.Node,after:Fb.Node,before:Wb.Node},SO=Ie({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 AO extends Oo{constructor(){super(...arguments);g(this,"instance",new RegExp(this.rule,this.flags));g(this,"expression",`${this.instance}`);g(this,"traverseAllows",this.instance.test.bind(this.instance));g(this,"compiledCondition",`${this.expression}.test(data)`);g(this,"compiledNegation",`!${this.compiledCondition}`);g(this,"impliedBasis",L.intrinsic.string.internal)}reduceJsonSchema(n,r){return n.pattern?r.fallback.patternIntersection({code:"patternIntersection",base:n,pattern:this.rule}):(n.pattern=this.rule,n)}}const sv={implementation:SO,Node:AO},Wl=(t,s)=>{const n=wO(t);return s&&!s.includes(n)?q(`Root of kind ${n} should be one of ${s}`):n},wO=t=>{if(te(t,"root"))return t.kind;if(typeof t=="string")return t[0]==="$"?"alias":t in Ln?"domain":"proto";if(typeof t=="function")return"proto";if(typeof t!="object"||t===null)return q(Iy(t));if("morphs"in t)return"morph";if("branches"in t||Et(t))return"union";if("unit"in t)return"unit";if("reference"in t)return"alias";const s=Object.keys(t);return s.length===0||s.some(n=>n in qb)?"intersection":"proto"in t?"proto":"domain"in t?"domain":q(Iy(t))},Iy=t=>`${Me(t)} is not a valid type schema`,Gl={},xO=t=>Et(t)?t.map(s=>s.collapsibleJson):t.collapsibleJson,rn={};L.nodesByRegisteredId=rn;const rv=t=>(Gl[t]??(Gl[t]=0),`${t}${++Gl[t]}`),av=t=>{var y;const s=Eo[t.kind],n=((y=s.applyConfig)==null?void 0:y.call(s,t.def,t.$.resolvedConfig))??t.def,r={},{meta:o,...c}=n,h=o===void 0?{}:typeof o=="string"?{description:o}:o,p=vb(c).sort(([v],[x])=>Fl(v)?Fl(x)?oo(v)-oo(x):1:Fl(x)||v<x?-1:1).filter(([v,x])=>{if(v.startsWith("meta.")){const N=v.slice(5);return h[N]=x,!1}return!0});for(const v of p){const x=v[0],N=s.keys[x];if(!N)return q(`Key ${x} is not valid on ${t.kind} schema`);const k=N.parse?N.parse(v[1],t):v[1];k!==jn&&(k!==void 0||N.preserveUndefined)&&(r[x]=k)}if(s.reduce&&!t.prereduced){const v=s.reduce(r,t.$);if(v)return v instanceof X?v.throw():EO(v,h)}return yh({id:t.id,kind:t.kind,inner:r,meta:h,$:t.$})},yh=({id:t,kind:s,inner:n,meta:r,$:o,ignoreCache:c})=>{const h=Eo[s],p=vb(n),m=[];let y={};for(const[oe,de]of p){const ne=h.keys[oe],ze=ne.serialize??(ne.child?xO:Ii);if(y[oe]=ze(de),ne.child===!0){const z=de;Et(z)?m.push(...z):m.push(z)}else typeof ne.child=="function"&&m.push(...ne.child(de))}h.finalizeInnerJson&&(y=h.finalizeInnerJson(y));let v={...y},x={};va(r)||(x=Ce(r,(oe,de)=>[oe,oe==="examples"?de:Ii(de)]),v.meta=Yl(x,"description",!0)),y=Yl(y,h.collapsibleKey,!1);const N=JSON.stringify({kind:s,...y});v=Yl(v,h.collapsibleKey,!1);const k=Yl(v,h.collapsibleKey,!0),B=JSON.stringify({kind:s,...v});if(o.nodesByHash[B]&&!c)return o.nodesByHash[B];const K={id:t,kind:s,impl:h,inner:n,innerEntries:p,innerJson:y,innerHash:N,meta:r,metaJson:x,json:v,hash:B,collapsibleJson:k,children:m};if(s!=="intersection")for(const oe in n)oe!=="in"&&oe!=="out"&&(K[oe]=n[oe]);const Z=new kE[s](K,o);return o.nodesByHash[B]=Z},OO=(t,s)=>t.id===s?t:(Rt(rn[s])&&it(`Unexpected attempt to overwrite node id ${s}`),yh({id:s,kind:t.kind,inner:t.inner,meta:t.meta,$:t.$,ignoreCache:!0})),EO=(t,s,n)=>yh({id:rv(s.alias??t.kind),kind:t.kind,inner:t.inner,meta:s,$:t.$}),Yl=(t,s,n)=>{const r=Object.keys(t);if(r.length===1&&r[0]===s){const o=t[s];if(n||Qi(o,"object")&&(Object.keys(o).length===1||Array.isArray(o)))return o}return t},Rf=(t,s,n)=>{if(t.key!==s.key)return null;const r=t.key;let o=ht(t.value,s.value,n);const c=t.required||s.required?"required":"optional";if(o instanceof X)if(c==="optional")o=L.intrinsic.never.internal;else return o.withPrefixKey(t.key,t.required&&s.required?"required":"optional");if(c==="required")return n.$.node("required",{key:r,value:o});const h=t.hasDefault()?s.hasDefault()?t.default===s.default?t.default:q(ov(t.default,s.default)):t.default:s.hasDefault()?s.default:jn;return n.$.node("optional",{key:r,value:o,default:h})};class lv extends nr{constructor(){super(...arguments);g(this,"required",this.kind==="required");g(this,"optional",this.kind==="optional");g(this,"impliedBasis",L.intrinsic.object.internal);g(this,"serializedKey",xa(this.key));g(this,"compiledKey",typeof this.key=="string"?this.key:this.serializedKey);g(this,"flatRefs",De(this.value.flatRefs.map(n=>Si([this.key,...n.path],n.node)),Si([this.key],this.value)));g(this,"traverseAllows",(n,r)=>this.key in n?Hn(this.key,()=>this.value.traverseAllows(n[this.key],r),r):this.optional);g(this,"traverseApply",(n,r)=>{this.key in n?Hn(this.key,()=>this.value.traverseApply(n[this.key],r),r):this.hasKind("required")&&r.errorFromNodeContext(this.errorContext)})}_transform(n,r){r.path.push(this.key);const o=super._transform(n,r);return r.path.pop(),o}hasDefault(){return"default"in this.inner}compile(n){n.if(`${this.serializedKey} in data`,()=>n.traverseKey(this.serializedKey,`data${n.prop(this.key)}`,this.value)),this.hasKind("required")&&n.else(()=>n.traversalKind==="Apply"?n.line(`ctx.errorFromNodeContext(${this.compiledErrorContext})`):n.return(!1)),n.traversalKind==="Allows"&&n.return(!0)}}const ov=(t,s)=>`Invalid intersection of default values ${Me(t)} & ${Me(s)}`,_O=Ie({kind:"optional",hasAssociatedError:!1,intersectionIsOpen:!0,keys:{key:{},value:{child:!0,parse:(t,s)=>s.$.parseSchema(t)},default:{preserveUndefined:!0}},normalize:t=>t,reduce:(t,s)=>{if(s.resolvedConfig.exactOptionalPropertyTypes===!1&&!t.value.allows(void 0))return s.node("optional",{...t,value:t.value.or(ae.undefined)},{prereduced:!0})},defaults:{description:t=>`${t.compiledKey}?: ${t.value.description}`},intersections:{optional:Rf}});class TO extends lv{constructor(...n){super(...n);g(this,"expression",this.hasDefault()?`${this.compiledKey}: ${this.value.expression} = ${Me(this.inner.default)}`:`${this.compiledKey}?: ${this.value.expression}`);g(this,"defaultValueMorph",RO(this));g(this,"defaultValueMorphRef",this.defaultValueMorph&&kt(this.defaultValueMorph));"default"in this.inner&&bh(this.value,this.inner.default,this.key)}get outProp(){if(!this.hasDefault())return this;const{default:n,...r}=this.inner;return this.cacheGetter("outProp",this.$.node("required",r,{prereduced:!0}))}}const gh={implementation:_O,Node:TO},tf={},RO=t=>{if(!t.hasDefault())return;const s=`{${t.compiledKey}: ${t.value.id} = ${Ii(t.default)}}`;return tf[s]??(tf[s]=uv(t.key,t.value,t.default))},uv=(t,s,n)=>{if(typeof n=="function")return s.includesTransform?(o,c)=>(Hn(t,()=>s(o[t]=n(),c),c),o):o=>(o[t]=n(),o);const r=s.includesTransform?s.assert(n):n;return Qi(r,"object")?(o,c)=>(Hn(t,()=>s(o[t]=n,c),c),o):o=>(o[t]=r,o)},bh=(t,s,n)=>{const r=vo(s);Qi(s,"object")&&!r&&q(kO(n));const o=t.in(r?s():s);if(o instanceof wi){n===null&&q(`Default ${o.summary}`);const c=o.transform(h=>h.transform(p=>({...p,prefixPath:[n]})));q(`Default for ${c.summary}`)}return s},kO=t=>`Non-primitive default ${t===null?"":typeof t=="number"?`for value at [${t}] `:`for ${xa(t)} `}must be specified as a function like () => ({my: 'object'})`;class Oa extends Lb{constructor(n,r){super(n,r);g(this,"branches",this.hasKind("union")?this.inner.branches:[this]);g(this,"_keyof");g(this,"pipe",Object.assign(this._pipe.bind(this),{try:this.tryPipe.bind(this)}));Object.defineProperty(this,Vn,{value:"root",enumerable:!1})}get internal(){return this}get"~standard"(){return{vendor:"arktype",version:1,validate:n=>{const r=this(n);return r instanceof wi?r:{value:r}}}}as(){return this}brand(n){return n===""?q(NO):this}readonly(){return this}distribute(n,r){const o=this.branches.map(n);return(r==null?void 0:r(o))??o}get shortDescription(){return this.meta.description??this.defaultShortDescription}toJsonSchema(n={}){const r=jb(this.$.resolvedConfig.toJsonSchema,n);r.useRefs||(r.useRefs=this.isCyclic);const o=typeof r.dialect=="string"?{$schema:r.dialect}:{};return Object.assign(o,this.toJsonSchemaRecurse(r)),r.useRefs&&(o.$defs=Ce(this.references,(c,h)=>h.isRoot()&&!h.alwaysExpandJsonSchema?[h.id,h.toResolvedJsonSchema(r)]:[])),o}toJsonSchemaRecurse(n){return n.useRefs&&!this.alwaysExpandJsonSchema?{$ref:`#/$defs/${this.id}`}:this.toResolvedJsonSchema(n)}get alwaysExpandJsonSchema(){return this.isBasis()||this.kind==="alias"||this.hasKind("union")&&this.isBoolean}toResolvedJsonSchema(n){const r=this.innerToJsonSchema(n);return Object.assign(r,this.metaJson)}intersect(n){const r=this.$.parseDefinition(n),o=this.rawIntersect(r);return o instanceof X?o:this.$.finalize(o)}rawIntersect(n){return Gn(this,n,this.$)}toNeverIfDisjoint(){return this}and(n){const r=this.intersect(n);return r instanceof X?r.throw():r}rawAnd(n){const r=this.rawIntersect(n);return r instanceof X?r.throw():r}or(n){const r=this.$.parseDefinition(n);return this.$.finalize(this.rawOr(r))}rawOr(n){const r=[...this.branches,...n.branches];return this.$.node("union",r)}map(n){return this.$.schema(this.applyStructuralOperation("map",[n]))}pick(...n){return this.$.schema(this.applyStructuralOperation("pick",n))}omit(...n){return this.$.schema(this.applyStructuralOperation("omit",n))}required(){return this.$.schema(this.applyStructuralOperation("required",[]))}partial(){return this.$.schema(this.applyStructuralOperation("partial",[]))}keyof(){if(this._keyof)return this._keyof;const n=this.applyStructuralOperation("keyof",[]).reduce((r,o)=>r.intersect(o).toNeverIfDisjoint(),L.intrinsic.unknown.internal);return n.branches.length===0&&q(Hb(`keyof ${this.expression}`)),this._keyof=this.$.finalize(n)}get props(){return this.branches.length!==1?q(MO(this.expression)):[...this.applyStructuralOperation("props",[])[0]]}merge(n){const r=this.$.parseDefinition(n);return this.$.schema(r.distribute(o=>this.applyStructuralOperation("merge",[Xy(o)??q(Zy("merge",o.expression))])))}applyStructuralOperation(n,r){return this.distribute(o=>{if(o.equals(L.intrinsic.object)&&n!=="merge")return o;const c=Xy(o);if(c||q(Zy(n,o.expression)),n==="keyof")return c.keyof();if(n==="get")return c.get(...r);if(n==="props")return c.props;const h=n==="required"?"require":n==="partial"?"optionalize":n;return this.$.node("intersection",{...o.inner,structure:c[h](...r)})})}get(...n){return n[0]===void 0?this:this.$.schema(this.applyStructuralOperation("get",n))}extract(n){const r=this.$.parseDefinition(n);return this.$.schema(this.branches.filter(o=>o.extends(r)))}exclude(n){const r=this.$.parseDefinition(n);return this.$.schema(this.branches.filter(o=>!o.extends(r)))}array(){return this.$.schema(this.isUnknown()?{proto:Array}:{proto:Array,sequence:this},{prereduced:!0})}overlaps(n){return!(this.intersect(n)instanceof X)}extends(n){const r=this.intersect(n);return!(r instanceof X)&&this.equals(r)}ifExtends(n){return this.extends(n)?this:void 0}subsumes(n){return this.$.parseDefinition(n).extends(this)}configure(n,r="shallow"){return this.configureReferences(n,r)}describe(n,r="shallow"){return this.configure({description:n},r)}optional(){return[this,"?"]}default(n){return bh(this,n,null),[this,"=",n]}from(n){return this.assert(n)}_pipe(...n){const r=n.reduce((o,c)=>o.rawPipeOnce(c),this);return this.$.finalize(r)}tryPipe(...n){const r=n.reduce((o,c)=>o.rawPipeOnce(te(c,"root")?c:(h,p)=>{try{return c(h,p)}catch(m){return p.error({code:"predicate",predicate:c,actual:`aborted due to error:
84
- ${m}
85
- `})}}),this);return this.$.finalize(r)}to(n){return this.$.finalize(this.toNode(this.$.parseDefinition(n)))}toNode(n){const r=_f(this,n,this.$);return r instanceof X?r.throw():r}rawPipeOnce(n){return te(n,"root")?this.toNode(n):this.distribute(r=>r.hasKind("morph")?this.$.node("morph",{in:r.inner.in,morphs:[...r.morphs,n]}):this.$.node("morph",{in:r,morphs:[n]}),this.$.parseSchema)}narrow(n){return this.constrainOut("predicate",n)}constrain(n,r){return this._constrain("root",n,r)}constrainIn(n,r){return this._constrain("in",n,r)}constrainOut(n,r){return this._constrain("out",n,r)}_constrain(n,r,o){const c=this.$.node(r,o);if(c.isRoot())return c.isUnknown()?this:it(`Unexpected constraint node ${c}`);const h=n==="root"?this:this[n];if(h.hasKind("morph")||c.impliedBasis&&!h.extends(c.impliedBasis))return Lx(r,c.impliedBasis,this);const p=this.$.node("intersection",{[c.kind]:c}),m=n==="out"?_f(this,p,this.$):Gn(this,p,this.$);return m instanceof X&&m.throw(),this.$.finalize(m)}onUndeclaredKey(n){const r=typeof n=="string"?n:n.rule,o=typeof n=="string"?!1:n.deep;return this.$.finalize(this.transform((c,h)=>c==="structure"?r==="ignore"?Uw(h,{undeclared:1}):{...h,undeclared:r}:h,o?void 0:{shouldTransform:c=>!Li(Ao,c.kind)}))}hasEqualMorphs(n){return!this.includesTransform&&!n.includesTransform?!0:!(!Is(this.shallowMorphs,n.shallowMorphs)||!Is(this.flatMorphs,n.flatMorphs,{isEqual:(r,o)=>{var c,h;return r.propString===o.propString&&(r.node.hasKind("morph")&&o.node.hasKind("morph")?r.node.hasEqualMorphs(o.node):r.node.hasKind("intersection")&&o.node.hasKind("intersection")?((c=r.node.structure)==null?void 0:c.structuralMorphRef)===((h=o.node.structure)==null?void 0:h.structuralMorphRef):!1)}}))}onDeepUndeclaredKey(n){return this.onUndeclaredKey({rule:n,deep:!0})}filter(n){return this.constrainIn("predicate",n)}divisibleBy(n){return this.constrain("divisor",n)}matching(n){return this.constrain("pattern",n)}atLeast(n){return this.constrain("min",n)}atMost(n){return this.constrain("max",n)}moreThan(n){return this.constrain("min",qs(n))}lessThan(n){return this.constrain("max",qs(n))}atLeastLength(n){return this.constrain("minLength",n)}atMostLength(n){return this.constrain("maxLength",n)}moreThanLength(n){return this.constrain("minLength",qs(n))}lessThanLength(n){return this.constrain("maxLength",qs(n))}exactlyLength(n){return this.constrain("exactLength",n)}atOrAfter(n){return this.constrain("after",n)}atOrBefore(n){return this.constrain("before",n)}laterThan(n){return this.constrain("after",qs(n))}earlierThan(n){return this.constrain("before",qs(n))}}const NO="Expected a non-empty brand name after #",qs=t=>typeof t=="object"&&!(t instanceof Date)?{...t,exclusive:!0}:{rule:t,exclusive:!0},Jl=(t,s)=>te(s,"root")?te(t,"root")?t.extends(s):s.allows(t):te(t,"root")?t.hasUnit(s):s===t,Xy=t=>{var s;return t.hasKind("morph")?null:t.hasKind("intersection")?t.inner.structure??(((s=t.basis)==null?void 0:s.domain)==="object"?t.$.bindReference(L.intrinsic.emptyStructure):null):t.isBasis()&&t.domain==="object"?t.$.bindReference(L.intrinsic.emptyStructure):null},MO=t=>`Props cannot be extracted from a union. Use .distribute to extract props from each branch instead. Received:
86
- ${t}`,Zy=(t,s)=>`${t} operand must be an object (was ${s})`,Ea=(t,s)=>Ce(ph(t),(n,r)=>[r,s]),$O=t=>typeof t=="string"?{reference:t}:t,Qy=t=>t instanceof X?L.intrinsic.never.internal:t,DO=Ie({kind:"alias",hasAssociatedError:!1,collapsibleKey:"reference",keys:{reference:{serialize:t=>t.startsWith("$")?t:`$ark.${t}`},resolve:{}},normalize:$O,defaults:{description:t=>t.reference},intersections:{alias:(t,s,n)=>n.$.lazilyResolve(()=>Qy(ht(t.resolution,s.resolution,n)),`${t.reference}${n.pipe?"=>":"&"}${s.reference}`),...Ea("alias",(t,s,n)=>s.isUnknown()?t:s.isNever()?s:s.isBasis()&&!s.overlaps(L.intrinsic.object)?X.init("assignability",L.intrinsic.object,s):n.$.lazilyResolve(()=>Qy(ht(t.resolution,s,n)),`${t.reference}${n.pipe?"=>":"&"}${s.id}`))}});class CO extends Oa{constructor(){super(...arguments);g(this,"expression",this.reference);g(this,"structure");g(this,"traverseAllows",(n,r)=>{const o=r.seen[this.reference];return o!=null&&o.includes(n)?!0:(r.seen[this.reference]=De(o,n),this.resolution.traverseAllows(n,r))});g(this,"traverseApply",(n,r)=>{const o=r.seen[this.reference];o!=null&&o.includes(n)||(r.seen[this.reference]=De(o,n),this.resolution.traverseApply(n,r))})}get resolution(){const n=this._resolve();return rn[this.id]=n}_resolve(){if(this.resolve)return this.resolve();if(this.reference[0]==="$")return this.$.resolveRoot(this.reference.slice(1));const n=this.reference;let r=rn[n];const o=[];for(;te(r,"context");){if(o.includes(r.id))return q(zO(r.id,o));o.push(r.id),r=rn[r.id]}return te(r,"root")?r:it(`Unexpected resolution for reference ${this.reference}
87
- Seen: [${o.join("->")}]
88
- Resolution: ${Me(r)}`)}get resolutionId(){if(this.reference.includes("&")||this.reference.includes("=>"))return this.resolution.id;if(this.reference[0]!=="$")return this.reference;const n=this.reference.slice(1),r=this.$.resolutions[n];return typeof r=="string"?r:te(r,"root")?r.id:it(`Unexpected resolution for reference ${this.reference}: ${Me(r)}`)}get defaultShortDescription(){return Ln.object}innerToJsonSchema(n){return this.resolution.toJsonSchemaRecurse(n)}compile(n){const r=this.resolutionId;n.if(`ctx.seen.${r} && ctx.seen.${r}.includes(data)`,()=>n.return(!0)),n.if(`!ctx.seen.${r}`,()=>n.line(`ctx.seen.${r} = []`)),n.line(`ctx.seen.${r}.push(data)`),n.return(n.invoke(r))}}const zO=(t,s)=>`Alias '${t}' has a shallow resolution cycle: ${[...s,t].join("->")}`,vh={implementation:DO,Node:CO};class Sh extends Oa{constructor(){super(...arguments);g(this,"traverseApply",(n,r)=>{this.traverseAllows(n,r)||r.errorFromNodeContext(this.errorContext)})}get errorContext(){return{code:this.kind,description:this.description,meta:this.meta,...this.inner}}get compiledErrorContext(){return xo(this.errorContext)}compile(n){n.traversalKind==="Allows"?n.return(this.compiledCondition):n.if(this.compiledNegation,()=>n.line(`${n.ctx}.errorFromNodeContext(${this.compiledErrorContext})`))}}const UO=Ie({kind:"domain",hasAssociatedError:!0,collapsibleKey:"domain",keys:{domain:{},numberAllowsNaN:{}},normalize:t=>typeof t=="string"?{domain:t}:oh(t,"numberAllowsNaN")&&t.domain!=="number"?q(Ah.writeBadAllowNanMessage(t.domain)):t,applyConfig:(t,s)=>t.numberAllowsNaN===void 0&&t.domain==="number"&&s.numberAllowsNaN?{...t,numberAllowsNaN:!0}:t,defaults:{description:t=>Ln[t.domain],actual:t=>Number.isNaN(t)?"NaN":Ln[hn(t)]},intersections:{domain:(t,s)=>t.domain==="number"&&s.domain==="number"?t.numberAllowsNaN?s:t:X.init("domain",t,s)}});class BO extends Sh{constructor(){super(...arguments);g(this,"requiresNaNCheck",this.domain==="number"&&!this.numberAllowsNaN);g(this,"traverseAllows",this.requiresNaNCheck?n=>typeof n=="number"&&!Number.isNaN(n):n=>hn(n)===this.domain);g(this,"compiledCondition",this.domain==="object"?'((typeof data === "object" && data !== null) || typeof data === "function")':`typeof data === "${this.domain}"${this.requiresNaNCheck?" && !Number.isNaN(data)":""}`);g(this,"compiledNegation",this.domain==="object"?'((typeof data !== "object" || data === null) && typeof data !== "function")':`typeof data !== "${this.domain}"${this.requiresNaNCheck?" || Number.isNaN(data)":""}`);g(this,"expression",this.numberAllowsNaN?"number | NaN":this.domain)}get nestableExpression(){return this.numberAllowsNaN?`(${this.expression})`:this.expression}get defaultShortDescription(){return Ln[this.domain]}innerToJsonSchema(n){return this.domain==="bigint"||this.domain==="symbol"?n.fallback.domain({code:"domain",base:{},domain:this.domain}):{type:this.domain}}}const Ah={implementation:UO,Node:BO,writeBadAllowNanMessage:t=>`numberAllowsNaN may only be specified with domain "number" (was ${t})`},qO=Ie({kind:"intersection",hasAssociatedError:!0,normalize:t=>{if(Rt(t))return t;const{structure:s,...n}=t,r=!!s,o=s??{},c=Ce(n,(h,p)=>wn(h,Rx)?(r&&q(`Flattened structure key ${h} cannot be specified alongside a root 'structure' key.`),o[h]=p,[]):[h,p]);return(te(o,"constraint")||!va(o))&&(c.structure=o),c},finalizeInnerJson:({structure:t,...s})=>Qi(t,"object")?{...t,...s}:s,keys:{domain:{child:!0,parse:(t,s)=>s.$.node("domain",t)},proto:{child:!0,parse:(t,s)=>s.$.node("proto",t)},structure:{child:!0,parse:(t,s)=>s.$.node("structure",t),serialize:t=>{var h;if(!((h=t.sequence)!=null&&h.minLength))return t.collapsibleJson;const{sequence:s,...n}=t.collapsibleJson,{minVariadicLength:r,...o}=s,c=o.variadic&&Object.keys(o).length===1?o.variadic:o;return{...n,sequence:c}}},divisor:{child:!0,parse:zt("divisor")},max:{child:!0,parse:zt("max")},min:{child:!0,parse:zt("min")},maxLength:{child:!0,parse:zt("maxLength")},minLength:{child:!0,parse:zt("minLength")},exactLength:{child:!0,parse:zt("exactLength")},before:{child:!0,parse:zt("before")},after:{child:!0,parse:zt("after")},pattern:{child:!0,parse:zt("pattern")},predicate:{child:!0,parse:zt("predicate")}},reduce:(t,s)=>Fy({},t,{$:s,invert:!1,pipe:!1}),defaults:{description:t=>{if(t.children.length===0)return"unknown";if(t.structure)return t.structure.description;const s=[];if(t.basis&&!t.refinements.some(n=>n.impl.obviatesBasisDescription)&&s.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);s.push(...n)}return t.inner.predicate&&s.push(...t.inner.predicate.map(n=>n.description)),s.join(" and ")},expected:t=>` ◦ ${t.errors.map(s=>s.expected).join(`
89
- ◦ `)}`,problem:t=>`(${t.actual}) must be...
90
- ${t.expected}`},intersections:{intersection:(t,s,n)=>Fy(t.inner,s.inner,n),...Ea("intersection",(t,s,n)=>{var m;if(t.children.length===0)return s;const{domain:r,proto:o,...c}=t.inner,h=o??r,p=h?ht(h,s,n):s;return p instanceof X?p:(m=t==null?void 0:t.basis)!=null&&m.equals(p)?t:t.$.node("intersection",{...c,[p.kind]:p},{prereduced:!0})})}});class KO extends Oa{constructor(){super(...arguments);g(this,"basis",this.inner.domain??this.inner.proto??null);g(this,"refinements",this.children.filter(n=>n.isRefinement()));g(this,"structure",this.inner.structure);g(this,"expression",jO(this));g(this,"traverseAllows",(n,r)=>this.children.every(o=>o.traverseAllows(n,r)));g(this,"traverseApply",(n,r)=>{const o=r.currentErrorCount;if(!(this.basis&&(this.basis.traverseApply(n,r),r.currentErrorCount>o))){if(this.refinements.length){for(let c=0;c<this.refinements.length-1;c++)if(this.refinements[c].traverseApply(n,r),r.failFast&&r.currentErrorCount>o)return;if(this.refinements.at(-1).traverseApply(n,r),r.currentErrorCount>o)return}if(!(this.structure&&(this.structure.traverseApply(n,r),r.currentErrorCount>o))&&this.inner.predicate){for(let c=0;c<this.inner.predicate.length-1;c++)if(this.inner.predicate[c].traverseApply(n,r),r.failFast&&r.currentErrorCount>o)return;this.inner.predicate.at(-1).traverseApply(n,r)}}})}get shallowMorphs(){var n;return(n=this.inner.structure)!=null&&n.structuralMorph?[this.inner.structure.structuralMorph]:[]}get defaultShortDescription(){var n;return((n=this.basis)==null?void 0:n.defaultShortDescription)??"present"}innerToJsonSchema(n){return this.children.reduce((r,o)=>o.isBasis()?o.toJsonSchemaRecurse(n):o.reduceJsonSchema(r,n),{})}compile(n){if(n.traversalKind==="Allows"){for(const r of this.children)n.check(r);n.return(!0);return}if(n.initializeErrorCount(),this.basis&&(n.check(this.basis),this.children.length>1&&n.returnIfFail()),this.refinements.length){for(let r=0;r<this.refinements.length-1;r++)n.check(this.refinements[r]),n.returnIfFailFast();n.check(this.refinements.at(-1)),(this.structure||this.inner.predicate)&&n.returnIfFail()}if(this.structure&&(n.check(this.structure),this.inner.predicate&&n.returnIfFail()),this.inner.predicate){for(let r=0;r<this.inner.predicate.length-1;r++)n.check(this.inner.predicate[r]),n.returnIfFail();n.check(this.inner.predicate.at(-1))}}}const cv={implementation:qO,Node:KO},jO=t=>{var n;let s=((n=t.structure)==null?void 0:n.expression)||`${t.basis&&!t.refinements.some(r=>r.impl.obviatesBasisExpression)?t.basis.nestableExpression+" ":""}${t.refinements.map(r=>r.expression).join(" & ")}`||"unknown";return s==="Array == 0"&&(s="[]"),s},Fy=(t,s,n)=>{const r={},o=t.proto??t.domain,c=s.proto??s.domain,h=o?c?ht(o,c,n):o:c;return h instanceof X?h:(h&&(r[h.kind]=h),uo({kind:"intersection",baseInner:r,l:co(t),r:co(s),roots:[],ctx:n}))},LO=Ie({kind:"morph",hasAssociatedError:!1,keys:{in:{child:!0,parse:(t,s)=>s.$.parseSchema(t)},morphs:{parse:ba,serialize:t=>t.map(s=>te(s,"root")?s.json:kt(s))},declaredIn:{child:!1,serialize:t=>t.json},declaredOut:{child:!1,serialize:t=>t.json}},normalize:t=>t,defaults:{description:t=>{var s;return`a morph from ${t.in.description} to ${((s=t.out)==null?void 0:s.description)??"unknown"}`}},intersections:{morph:(t,s,n)=>{if(!t.hasEqualMorphs(s))return q(HO(t.expression,s.expression));const r=ht(t.in,s.in,n);if(r instanceof X)return r;const o={morphs:t.morphs};if(t.declaredIn||s.declaredIn){const c=ht(t.in,s.in,n);if(c instanceof X)return c.throw();o.declaredIn=c}if(t.declaredOut||s.declaredOut){const c=ht(t.out,s.out,n);if(c instanceof X)return c.throw();o.declaredOut=c}return r.distribute(c=>n.$.node("morph",{...o,in:c}),n.$.parseSchema)},...Ea("morph",(t,s,n)=>{const r=t.inner.in?ht(t.inner.in,s,n):s;return r instanceof X?r:r.equals(t.inner.in)?t:n.$.node("morph",{...t.inner,in:r})})}});class VO extends Oa{constructor(){super(...arguments);g(this,"serializedMorphs",this.morphs.map(kt));g(this,"compiledMorphs",`[${this.serializedMorphs}]`);g(this,"lastMorph",this.inner.morphs.at(-1));g(this,"lastMorphIfNode",te(this.lastMorph,"root")?this.lastMorph:void 0);g(this,"introspectableIn",this.inner.in);g(this,"introspectableOut",this.lastMorphIfNode?Object.assign(this.referencesById,this.lastMorphIfNode.referencesById)&&this.lastMorphIfNode.out:void 0);g(this,"expression",`(In: ${this.in.expression}) => ${this.lastMorphIfNode?"To":"Out"}<${this.out.expression}>`);g(this,"traverseAllows",(n,r)=>!this.introspectableIn||this.introspectableIn.traverseAllows(n,r));g(this,"traverseApply",(n,r)=>{this.introspectableIn&&this.introspectableIn.traverseApply(n,r),r.queueMorphs(this.morphs)})}get shallowMorphs(){var n;return Array.isArray((n=this.inner.in)==null?void 0:n.shallowMorphs)?[...this.inner.in.shallowMorphs,...this.morphs]:this.morphs}get in(){var n;return this.declaredIn??((n=this.inner.in)==null?void 0:n.in)??L.intrinsic.unknown.internal}get out(){return this.declaredOut??this.introspectableOut??L.intrinsic.unknown.internal}declareIn(n){return this.$.node("morph",{...this.inner,declaredIn:n})}declareOut(n){return this.$.node("morph",{...this.inner,declaredOut:n})}get defaultShortDescription(){return this.in.meta.description??this.in.defaultShortDescription}innerToJsonSchema(n){var r;return n.fallback.morph({code:"morph",base:this.in.toJsonSchemaRecurse(n),out:((r=this.introspectableOut)==null?void 0:r.toJsonSchemaRecurse(n))??null})}compile(n){if(n.traversalKind==="Allows"){if(!this.introspectableIn)return;n.return(n.invoke(this.introspectableIn));return}this.introspectableIn&&n.line(n.invoke(this.introspectableIn)),n.line(`ctx.queueMorphs(${this.compiledMorphs})`)}hasEqualMorphs(n){return Is(this.morphs,n.morphs,{isEqual:(r,o)=>r===o||te(r,"root")&&te(o,"root")&&r.equals(o)})}}const fv={implementation:LO,Node:VO},HO=(t,s)=>`The intersection of distinct morphs at a single path is indeterminate:
91
- Left: ${t}
92
- Right: ${s}`,GO=Ie({kind:"proto",hasAssociatedError:!0,collapsibleKey:"proto",keys:{proto:{serialize:t=>ch(t)??Ii(t)},dateAllowsInvalid:{}},normalize:t=>{const s=typeof t=="string"?{proto:Zs[t]}:typeof t=="function"?Rt(t)?t:{proto:t}:typeof t.proto=="string"?{...t,proto:Zs[t.proto]}:t;return typeof s.proto!="function"&&q(ho.writeInvalidSchemaMessage(s.proto)),oh(s,"dateAllowsInvalid")&&s.proto!==Date&&q(ho.writeBadInvalidDateMessage(s.proto)),s},applyConfig:(t,s)=>t.dateAllowsInvalid===void 0&&t.proto===Date&&s.dateAllowsInvalid?{...t,dateAllowsInvalid:!0}:t,defaults:{description:t=>t.builtinName?Gw[t.builtinName]:`an instance of ${t.proto.name}`,actual:t=>t instanceof Date&&t.toString()==="Invalid Date"?"an invalid Date":bf(t)},intersections:{proto:(t,s)=>t.proto===Date&&s.proto===Date?t.dateAllowsInvalid?s:t:Ky(t.proto,s.proto)?t:Ky(s.proto,t.proto)?s:X.init("proto",t,s),domain:(t,s)=>s.domain==="object"?t:X.init("domain",L.intrinsic.object.internal,s)}});class YO extends Sh{constructor(){super(...arguments);g(this,"builtinName",ch(this.proto));g(this,"serializedConstructor",this.json.proto);g(this,"requiresInvalidDateCheck",this.proto===Date&&!this.dateAllowsInvalid);g(this,"traverseAllows",this.requiresInvalidDateCheck?n=>n instanceof Date&&n.toString()!=="Invalid Date":n=>n instanceof this.proto);g(this,"compiledCondition",`data instanceof ${this.serializedConstructor}${this.requiresInvalidDateCheck?' && data.toString() !== "Invalid Date"':""}`);g(this,"compiledNegation",`!(${this.compiledCondition})`);g(this,"expression",this.dateAllowsInvalid?"Date | InvalidDate":this.proto.name);g(this,"domain","object")}innerToJsonSchema(n){var r,o;switch(this.builtinName){case"Array":return{type:"array"};case"Date":return((o=(r=n.fallback).date)==null?void 0:o.call(r,{code:"date",base:{}}))??n.fallback.proto({code:"proto",base:{},proto:this.proto});default:return n.fallback.proto({code:"proto",base:{},proto:this.proto})}}get nestableExpression(){return this.dateAllowsInvalid?`(${this.expression})`:this.expression}get defaultShortDescription(){return this.description}}const ho={implementation:GO,Node:YO,writeBadInvalidDateMessage:t=>`dateAllowsInvalid may only be specified with constructor Date (was ${t.name})`,writeInvalidSchemaMessage:t=>`instanceOf operand must be a function (was ${hn(t)})`},JO=Ie({kind:"union",hasAssociatedError:!0,collapsibleKey:"branches",keys:{ordered:{},branches:{child:!0,parse:(t,s)=>{const n=[];for(const r of t){const o=te(r,"root")?r.branches:s.$.parseSchema(r).branches;for(const c of o)if(c.hasKind("morph")){const h=n.findIndex(p=>p.hasKind("morph")&&p.hasEqualMorphs(c));if(h===-1)n.push(c);else{const p=n[h];n[h]=s.$.node("morph",{...p.inner,in:p.in.rawOr(c.in)})}}else n.push(c)}return s.def.ordered||n.sort((r,o)=>r.hash<o.hash?-1:1),n}}},normalize:t=>Et(t)?{branches:t}:t,reduce:(t,s)=>{const n=iE(t);if(n.length===1)return n[0];if(n.length!==t.branches.length)return s.node("union",{...t,branches:n},{prereduced:!0})},defaults:{description:t=>t.distribute(s=>s.description,Hs),expected:t=>{const s=kw(t.errors,"propString"),n=Object.entries(s).map(([r,o])=>{const c=[];for(const m of o)Yi(c,m.expected);const h=Hs(c),p=o.every(m=>m.actual===o[0].actual)?o[0].actual:Me(o[0].data);return`${r&&`${r} `}must be ${h}${p&&` (was ${p})`}`});return Hs(n)},problem:t=>t.expected,message:t=>t.problem},intersections:{union:(t,s,n)=>{if(t.isNever!==s.isNever)return X.init("presence",t,s);let r;return t.ordered?(s.ordered&&q(rE(t.expression,s.expression)),r=nf(s.branches,t.branches,n),r instanceof X&&r.invert()):r=nf(t.branches,s.branches,n),r instanceof X?r:n.$.parseSchema(t.ordered||s.ordered?{branches:r,ordered:!0}:{branches:r})},...Ea("union",(t,s,n)=>{const r=nf(t.branches,[s],n);return r instanceof X?r:r.length===1?r[0]:n.$.parseSchema(t.ordered?{branches:r,ordered:!0}:{branches:r})})}});class IO extends Oa{constructor(){super(...arguments);g(this,"isBoolean",this.branches.length===2&&this.branches[0].hasUnit(!1)&&this.branches[1].hasUnit(!0));g(this,"unitBranches",this.branches.filter(n=>n.in.hasKind("unit")));g(this,"discriminant",this.discriminate());g(this,"discriminantJson",this.discriminant?eE(this.discriminant):null);g(this,"expression",this.distribute(n=>n.nestableExpression,nE));g(this,"traverseAllows",(n,r)=>this.branches.some(o=>o.traverseAllows(n,r)));g(this,"traverseApply",(n,r)=>{const o=[];for(let c=0;c<this.branches.length;c++){if(r.pushBranch(),this.branches[c].traverseApply(n,r),!r.hasError())return this.branches[c].includesTransform?r.queuedMorphs.push(...r.popBranch().queuedMorphs):r.popBranch();o.push(r.popBranch().error)}r.errorFromNodeContext({code:"union",errors:o,meta:this.meta})});g(this,"traverseOptimistic",n=>{for(let r=0;r<this.branches.length;r++){const o=this.branches[r];if(o.traverseAllows(n))return o.contextFreeMorph?o.contextFreeMorph(n):n}return jn})}get branchGroups(){const n=[];let r=-1;for(const o of this.branches){if(o.hasKind("unit")&&o.domain==="boolean"){r===-1?(r=n.length,n.push(o)):n[r]=L.intrinsic.boolean;continue}n.push(o)}return n}createBranchedOptimisticRootApply(){return(n,r)=>{const o=this.traverseOptimistic(n);if(o!==jn)return o;const c=new Ls(n,this.$.resolvedConfig);return this.traverseApply(n,c),c.finalize(r)}}get shallowMorphs(){return this.branches.reduce((n,r)=>Yi(n,r.shallowMorphs),[])}get defaultShortDescription(){return this.distribute(n=>n.defaultShortDescription,Hs)}innerToJsonSchema(n){if(this.branchGroups.length===1&&this.branchGroups[0].equals(L.intrinsic.boolean))return{type:"boolean"};const r=this.branchGroups.map(o=>o.toJsonSchemaRecurse(n));return r.every(o=>Object.keys(o).length===1&&oh(o,"const"))?{enum:r.map(o=>o.const)}:{anyOf:r}}compile(n){if(!this.discriminant||this.unitBranches.length===this.branches.length&&this.branches.length===2)return this.compileIndiscriminable(n);let r=this.discriminant.optionallyChainedPropString;this.discriminant.kind==="domain"&&(r=`typeof ${r} === "object" ? ${r} === null ? "null" : "object" : typeof ${r} === "function" ? "object" : typeof ${r}`);const o=this.discriminant.cases,c=Object.keys(o),{optimistic:h}=n;if(n.optimistic=!1,n.block(`switch(${r})`,()=>{for(const x in o){const N=o[x],k=x==="default"?x:`case ${x}`;n.line(`${k}: return ${N===!0?h?n.data:N:h?`${n.invoke(N)} ? ${N.contextFreeMorph?`${kt(N.contextFreeMorph)}(${n.data})`:n.data} : "${jn}"`:n.invoke(N)}`)}return n}),n.traversalKind==="Allows"){n.return(h?`"${jn}"`:!1);return}const p=Hs(this.discriminant.kind==="domain"?c.map(x=>{const N=x.slice(1,-1);return N==="function"?Ln.object:Ln[N]}):c),m=this.discriminant.path.map(x=>typeof x=="symbol"?kt(x):JSON.stringify(x)),y=JSON.stringify(p),v=this.discriminant.kind==="domain"?`${WO}[${r}]`:`${PO}(${r})`;n.line(`ctx.errorFromNodeContext({
93
- code: "predicate",
94
- expected: ${y},
95
- actual: ${v},
96
- relativePath: [${m}],
97
- meta: ${this.compiledMeta}
98
- })`)}compileIndiscriminable(n){if(n.traversalKind==="Apply"){n.const("errors","[]");for(const r of this.branches)n.line("ctx.pushBranch()").line(n.invoke(r)).if("!ctx.hasError()",()=>n.return(r.includesTransform?"ctx.queuedMorphs.push(...ctx.popBranch().queuedMorphs)":"ctx.popBranch()")).line("errors.push(ctx.popBranch().error)");n.line(`ctx.errorFromNodeContext({ code: "union", errors, meta: ${this.compiledMeta} })`)}else{const{optimistic:r}=n;n.optimistic=!1;for(const o of this.branches)n.if(`${n.invoke(o)}`,()=>n.return(r?o.contextFreeMorph?`${kt(o.contextFreeMorph)}(${n.data})`:n.data:!0));n.return(r?`"${jn}"`:!1)}}get nestableExpression(){return this.isBoolean?"boolean":`(${this.expression})`}discriminate(){var h,p;if(this.branches.length<2||this.isCyclic)return null;if(this.unitBranches.length===this.branches.length){const m=Ce(this.unitBranches,(y,v)=>[`${v.in.serializedValue}`,v.hasKind("morph")?v:!0]);return{kind:"unit",path:[],optionallyChainedPropString:"data",cases:m}}const n=[];for(let m=0;m<this.branches.length-1;m++){const y=this.branches[m];for(let v=m+1;v<this.branches.length;v++){const x=this.branches[v],N=Gn(y.in,x.in,y.$);if(N instanceof X)for(const k of N){if(!k.kind||k.optional)continue;let B,K;if(k.kind==="domain"){const oe=k.l,de=k.r;B=`"${typeof oe=="string"?oe:oe.domain}"`,K=`"${typeof de=="string"?de:de.domain}"`}else if(k.kind==="unit")B=k.l.serializedValue,K=k.r.serializedValue;else continue;const Z=n.find(oe=>Is(oe.path,k.path)&&oe.kind===k.kind);Z?(Z.cases[B]?Z.cases[B].branchIndices=Yi(Z.cases[B].branchIndices,m):(h=Z.cases)[B]??(h[B]={branchIndices:[m],condition:k.l}),Z.cases[K]?Z.cases[K].branchIndices=Yi(Z.cases[K].branchIndices,v):(p=Z.cases)[K]??(p[K]={branchIndices:[v],condition:k.r})):n.push({kind:k.kind,cases:{[B]:{branchIndices:[m],condition:k.l},[K]:{branchIndices:[v],condition:k.r}},path:k.path})}}}const r=this.ordered?QO(n,this.branches):n;if(!r.length)return null;const o=XO(r,this),c={};for(const m in o.best.cases){const y=ZO(o,m);if(y===null){c[m]=!0;continue}if(y.length===this.branches.length)return null;this.ordered&&y.sort((N,k)=>N.originalIndex-k.originalIndex);const v=y.map(N=>N.branch),x=v.length===1?v[0]:this.$.node("union",this.ordered?{branches:v,ordered:!0}:v);Object.assign(this.referencesById,x.referencesById),c[m]=x}if(o.defaultEntries.length){const m=o.defaultEntries.map(y=>y.branch);c.default=this.$.node("union",this.ordered?{branches:m,ordered:!0}:m,{prereduced:!0}),Object.assign(this.referencesById,c.default.referencesById)}return Object.assign(o.location,{cases:c})}}const XO=(t,s)=>{const n=t.sort((c,h)=>Object.keys(h.cases).length-Object.keys(c.cases).length)[0],r={kind:n.kind,path:n.path,optionallyChainedPropString:hv(n.path)},o=s.branches.map((c,h)=>({originalIndex:h,branch:c}));return{best:n,location:r,defaultEntries:o,node:s}},ZO=(t,s)=>{const n=t.best.cases[s],r=FO(n.condition,t.location.path,t.node.$);let o=[];const c=[];for(let h=0;h<t.defaultEntries.length;h++){const p=t.defaultEntries[h];if(n.branchIndices.includes(p.originalIndex)){const m=Wy(t.node.branches[p.originalIndex],t.location);m===null?o=null:o==null||o.push({originalIndex:p.originalIndex,branch:m})}else if(p.branch.hasKind("alias")&&r.hasKind("domain")&&r.domain==="object")o==null||o.push(p);else{if(p.branch.in.overlaps(r)){const m=Wy(p.branch,t.location);o==null||o.push({originalIndex:p.originalIndex,branch:m})}c.push(p)}}return t.defaultEntries=c,o},QO=(t,s)=>t.filter(r=>{const o=Object.values(r.cases).map(c=>c.branchIndices);for(let c=0;c<o.length-1;c++){const h=o[c];for(let p=c+1;p<o.length;p++){const m=o[p];for(const y of h)for(const v of m)if(y>v&&s[y].overlaps(s[v]))return!1}}return!0}),FO=(t,s,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=s.length-1;o>=0;o--){const c=s[o];r=n.node("intersection",typeof c=="number"?{proto:"Array",sequence:[...Tw(c).map(h=>({})),r]}:{domain:"object",required:[{key:c,value:r}]})}return r},hv=t=>t.reduce((s,n)=>s+Cb(n,!0),"data"),WO=kt(Nw),PO=kt(Me),dv={implementation:JO,Node:IO},eE=t=>({kind:t.kind,path:t.path.map(s=>typeof s=="string"?s:xa(s)),cases:Ce(t.cases,(s,n)=>[s,n===!0?n:n.hasKind("union")&&n.discriminantJson?n.discriminantJson:n.json])}),tE={delimiter:" | ",finalDelimiter:" | "},nE=t=>Hs(t,tE),Hs=(t,s)=>{const n=(s==null?void 0:s.delimiter)??", ",r=(s==null?void 0:s.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={},c=t.filter(p=>o[p]?!1:o[p]=!0),h=c.pop();return`${c.join(n)}${c.length?r:""}${h}`},nf=(t,s,n)=>{const r=s.map(()=>[]);for(let c=0;c<t.length;c++){let h={};for(let p=0;p<s.length;p++){if(r[p]===null)continue;if(t[c].equals(s[p])){r[p]=null,h={};break}const m=ht(t[c],s[p],n);if(!(m instanceof X)){if(m.equals(t[c])){r[p].push(t[c]),h={};break}m.equals(s[p])?r[p]=null:h[p]=m}}for(const p in h)r[p][c]=h[p]}const o=r.flatMap((c,h)=>(c==null?void 0:c.flatMap(p=>p.branches))??s[h]);return o.length===0?X.init("union",t,s):o},iE=({branches:t,ordered:s})=>{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 c=Gn(t[r].in,t[o].in,t[0].$);c instanceof X||(s||sE(t[r],t[o]),c.equals(t[r].in)?n[r]=!!s:c.equals(t[o].in)&&(n[o]=!1))}return t.filter((r,o)=>n[o])},sE=(t,s)=>{!t.includesTransform&&!s.includesTransform||(Is(t.shallowMorphs,s.shallowMorphs)||q(Py(t.expression,s.expression)),Is(t.flatMorphs,s.flatMorphs,{isEqual:(n,r)=>{var o,c;return 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")?((o=n.node.structure)==null?void 0:o.structuralMorphRef)===((c=r.node.structure)==null?void 0:c.structuralMorphRef):!1)}})||q(Py(t.expression,s.expression)))},Wy=(t,s)=>t.transform((n,r)=>n==="domain"||n==="unit"?null:r,{shouldTransform:(n,r)=>{const o=hv(r.path);return s.optionallyChainedPropString.startsWith(o)?n.hasKind("domain")&&n.domain==="object"||(n.hasKind("domain")||s.kind==="unit")&&o===s.optionallyChainedPropString?!0:n.children.length!==0&&n.kind!=="index":!1}}),Py=(t,s)=>`An unordered union of a type including a morph and a type with overlapping input is indeterminate:
99
- Left: ${t}
100
- Right: ${s}`,rE=(t,s)=>`The intersection of two ordered unions is indeterminate:
101
- Left: ${t}
102
- Right: ${s}`,aE=Ie({kind:"unit",hasAssociatedError:!0,keys:{unit:{preserveUndefined:!0,serialize:t=>t instanceof Date?t.toISOString():Ii(t)}},normalize:t=>t,defaults:{description:t=>Me(t.unit),problem:({expected:t,actual:s})=>`${t===s?`must be reference equal to ${t} (serialized to the same value)`:`must be ${t} (was ${s})`}`},intersections:{unit:(t,s)=>X.init("unit",t,s),...Ea("unit",(t,s)=>{if(s.allows(t.unit))return t;const n=s.hasKind("intersection")?s.basis:s;if(n){const r=n.hasKind("domain")?n:L.intrinsic.object;if(t.domain!==r.domain){const o=t.domain==="undefined"||t.domain==="null"||t.domain==="boolean"?t.domain:L.intrinsic[t.domain];return X.init("domain",o,r)}}return X.init("assignability",t,s.hasKind("intersection")?s.children.find(r=>!r.allows(t.unit)):s)})}});class lE extends Sh{constructor(){super(...arguments);g(this,"compiledValue",this.json.unit);g(this,"serializedValue",typeof this.unit=="string"||this.unit instanceof Date?JSON.stringify(this.compiledValue):`${this.compiledValue}`);g(this,"compiledCondition",eg(this.unit,this.serializedValue));g(this,"compiledNegation",eg(this.unit,this.serializedValue,"negated"));g(this,"expression",Me(this.unit));g(this,"domain",hn(this.unit));g(this,"traverseAllows",this.unit instanceof Date?n=>n instanceof Date&&n.toISOString()===this.compiledValue:Number.isNaN(this.unit)?n=>Number.isNaN(n):n=>n===this.unit)}get defaultShortDescription(){return this.domain==="object"?Ln.object:this.description}innerToJsonSchema(n){return this.unit===null?{type:"null"}:L.intrinsic.jsonPrimitive.allows(this.unit)?{const:this.unit}:n.fallback.unit({code:"unit",base:{},unit:this.unit})}}const pv={implementation:aE,Node:lE},eg=(t,s,n)=>{if(t instanceof Date){const r=`data instanceof Date && data.toISOString() === ${s}`;return n?`!(${r})`:r}return Number.isNaN(t)?`${n?"!":""}Number.isNaN(data)`:`data ${n?"!":"="}== ${s}`},oE=Ie({kind:"index",hasAssociatedError:!1,intersectionIsOpen:!0,keys:{signature:{child:!0,parse:(t,s)=>{const n=s.$.parseSchema(t);if(!n.extends(L.intrinsic.key))return q(fE(n.expression));const r=n.branches.filter(o=>o.hasKind("unit"));return r.length?q(cE(r.map(o=>Me(o.unit)))):n}},value:{child:!0,parse:(t,s)=>s.$.parseSchema(t)}},normalize:t=>t,defaults:{description:t=>`[${t.signature.expression}]: ${t.value.description}`},intersections:{index:(t,s,n)=>{if(t.signature.equals(s.signature)){const r=ht(t.value,s.value,n),o=r instanceof X?L.intrinsic.never.internal:r;return n.$.node("index",{signature:t.signature,value:o})}return t.signature.extends(s.signature)&&t.value.subsumes(s.value)?s:s.signature.extends(t.signature)&&s.value.subsumes(t.value)?t:null}}});class uE extends nr{constructor(){super(...arguments);g(this,"impliedBasis",L.intrinsic.object.internal);g(this,"expression",`[${this.signature.expression}]: ${this.value.expression}`);g(this,"flatRefs",De(this.value.flatRefs.map(n=>Si([this.signature,...n.path],n.node)),Si([this.signature],this.value)));g(this,"traverseAllows",(n,r)=>ro(n).every(o=>this.signature.traverseAllows(o[0],r)?Hn(o[0],()=>this.value.traverseAllows(o[1],r),r):!0));g(this,"traverseApply",(n,r)=>{for(const o of ro(n))this.signature.traverseAllows(o[0],r)&&Hn(o[0],()=>this.value.traverseApply(o[1],r),r)})}_transform(n,r){r.path.push(this.signature);const o=super._transform(n,r);return r.path.pop(),o}compile(){}}const mv={implementation:oE,Node:uE},cE=t=>`Index keys ${t.join(", ")} should be specified as named props.`,fE=t=>`Indexed key definition '${t}' must be a string or symbol`,hE=Ie({kind:"required",hasAssociatedError:!0,intersectionIsOpen:!0,keys:{key:{},value:{child:!0,parse:(t,s)=>s.$.parseSchema(t)}},normalize:t=>t,defaults:{description:t=>`${t.compiledKey}: ${t.value.description}`,expected:t=>t.missingValueDescription,actual:()=>"missing"},intersections:{required:Rf,optional:Rf}});class dE extends lv{constructor(){super(...arguments);g(this,"expression",`${this.compiledKey}: ${this.value.expression}`);g(this,"errorContext",Object.freeze({code:"required",missingValueDescription:this.value.defaultShortDescription,relativePath:[this.key],meta:this.meta}));g(this,"compiledErrorContext",xo(this.errorContext))}}const yv={implementation:hE,Node:dE},pE=Ie({kind:"sequence",hasAssociatedError:!1,collapsibleKey:"variadic",keys:{prefix:{child:!0,parse:(t,s)=>{if(t.length!==0)return t.map(n=>s.$.parseSchema(n))}},optionals:{child:!0,parse:(t,s)=>{if(t.length!==0)return t.map(n=>s.$.parseSchema(n))}},defaultables:{child:t=>t.map(s=>s[0]),parse:(t,s)=>{if(t.length!==0)return t.map(n=>{const r=s.$.parseSchema(n[0]);return bh(r,n[1],null),[r,n[1]]})},serialize:t=>t.map(s=>[s[0].collapsibleJson,Ii(s[1])])},variadic:{child:!0,parse:(t,s)=>s.$.parseSchema(t,s)},minVariadicLength:{parse:t=>t===0?void 0:t},postfix:{child:!0,parse:(t,s)=>{if(t.length!==0)return t.map(n=>s.$.parseSchema(n))}}},normalize:t=>{var s,n,r;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((s=t.postfix)!=null&&s.length){if(!t.variadic)return q(bE);if((n=t.optionals)!=null&&n.length||(r=t.defaultables)!=null&&r.length)return q(bv)}return t.minVariadicLength&&!t.variadic?q("minVariadicLength may not be specified without a variadic element"):t}return{variadic:t}},reduce:(t,s)=>{var p,m,y,v,x,N,k;let n=t.minVariadicLength??0;const r=((p=t.prefix)==null?void 0:p.slice())??[],o=((m=t.defaultables)==null?void 0:m.slice())??[],c=((y=t.optionals)==null?void 0:y.slice())??[],h=((v=t.postfix)==null?void 0:v.slice())??[];if(t.variadic){for(;(x=c.at(-1))!=null&&x.equals(t.variadic);)c.pop();if(c.length===0&&o.length===0)for(;(N=r.at(-1))!=null&&N.equals(t.variadic);)r.pop(),n++;for(;(k=h[0])!=null&&k.equals(t.variadic);)h.shift(),n++}else c.length===0&&o.length===0&&r.push(...h.splice(0));if(n!==t.minVariadicLength||t.prefix&&t.prefix.length!==r.length)return s.node("sequence",{...t,prefix:r,defaultables:o,optionals:c,postfix:h,minVariadicLength:n},{prereduced:!0})},defaults:{description:t=>t.isVariadicOnly?`${t.variadic.nestableExpression}[]`:`[${t.tuple.map(n=>n.kind==="defaultables"?`${n.node.nestableExpression} = ${Me(n.default)}`:n.kind==="optionals"?`${n.node.nestableExpression}?`:n.kind==="variadic"?`...${n.node.nestableExpression}[]`:n.node.expression).join(", ")}]`},intersections:{sequence:(t,s,n)=>{const r=aa({l:t.tuple,r:s.tuple,disjoint:new X,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",tg(o[0].result)):n.$.node("union",o.map(c=>({proto:Array,sequence:tg(c.result)})))}}});var Ig,Xg,Zg,Qg;class mE extends nr{constructor(){super(...arguments);g(this,"impliedBasis",L.intrinsic.Array.internal);g(this,"tuple",gE(this.inner));g(this,"prefixLength",((Ig=this.prefix)==null?void 0:Ig.length)??0);g(this,"defaultablesLength",((Xg=this.defaultables)==null?void 0:Xg.length)??0);g(this,"optionalsLength",((Zg=this.optionals)==null?void 0:Zg.length)??0);g(this,"postfixLength",((Qg=this.postfix)==null?void 0:Qg.length)??0);g(this,"defaultablesAndOptionals",[]);g(this,"prevariadic",this.tuple.filter(n=>n.kind==="defaultables"||n.kind==="optionals"?(this.defaultablesAndOptionals.push(n.node),!0):n.kind==="prefix"));g(this,"variadicOrPostfix",Gi(this.variadic&&[this.variadic],this.postfix));g(this,"flatRefs",this.addFlatRefs());g(this,"isVariadicOnly",this.prevariadic.length+this.postfixLength===0);g(this,"minVariadicLength",this.inner.minVariadicLength??0);g(this,"minLength",this.prefixLength+this.minVariadicLength+this.postfixLength);g(this,"minLengthNode",this.minLength===0?null:this.$.node("minLength",this.minLength));g(this,"maxLength",this.variadic?null:this.tuple.length);g(this,"maxLengthNode",this.maxLength===null?null:this.$.node("maxLength",this.maxLength));g(this,"impliedSiblings",this.minLengthNode?this.maxLengthNode?[this.minLengthNode,this.maxLengthNode]:[this.minLengthNode]:this.maxLengthNode?[this.maxLengthNode]:[]);g(this,"defaultValueMorphs",yE(this));g(this,"defaultValueMorphsReference",this.defaultValueMorphs.length?kt(this.defaultValueMorphs):void 0);g(this,"traverseAllows",(n,r)=>{for(let o=0;o<n.length;o++)if(!this.elementAtIndex(n,o).node.traverseAllows(n[o],r))return!1;return!0});g(this,"traverseApply",(n,r)=>{let o=0;for(;o<n.length;o++)Hn(o,()=>this.elementAtIndex(n,o).node.traverseApply(n[o],r),r)});g(this,"expression",this.description)}addFlatRefs(){return Gy(this.flatRefs,this.prevariadic.flatMap((n,r)=>De(n.node.flatRefs.map(o=>Si([`${r}`,...o.path],o.node)),Si([`${r}`],n.node)))),Gy(this.flatRefs,this.variadicOrPostfix.flatMap(n=>De(n.flatRefs.map(r=>Si([L.intrinsic.nonNegativeIntegerString.internal,...r.path],r.node)),Si([L.intrinsic.nonNegativeIntegerString.internal],n)))),this.flatRefs}elementAtIndex(n,r){if(r<this.prevariadic.length)return this.tuple[r];const o=n.length-this.postfixLength;return r>=o?{kind:"postfix",node:this.postfix[r-o]}:{kind:"variadic",node:this.variadic??it(`Unexpected attempt to access index ${r} on ${this}`)}}get element(){return this.cacheGetter("element",this.$.node("union",this.children))}compile(n){if(this.prefix)for(const[r,o]of this.prefix.entries())n.traverseKey(`${r}`,`data[${r}]`,o);for(const[r,o]of this.defaultablesAndOptionals.entries()){const c=`${r+this.prefixLength}`;n.if(`${c} >= ${n.data}.length`,()=>n.traversalKind==="Allows"?n.return(!0):n.return()),n.traverseKey(c,`data[${c}]`,o)}if(this.variadic&&(this.postfix&&n.const("firstPostfixIndex",`${n.data}.length${this.postfix?`- ${this.postfix.length}`:""}`),n.for(`i < ${this.postfix?"firstPostfixIndex":"data.length"}`,()=>n.traverseKey("i","data[i]",this.variadic),this.prevariadic.length),this.postfix))for(const[r,o]of this.postfix.entries()){const c=`firstPostfixIndex + ${r}`;n.traverseKey(c,`data[${c}]`,o)}n.traversalKind==="Allows"&&n.return(!0)}_transform(n,r){r.path.push(L.intrinsic.nonNegativeIntegerString.internal);const o=super._transform(n,r);return r.path.pop(),o}reduceJsonSchema(n,r){if(this.prevariadic.length&&(n.prefixItems=this.prevariadic.map(o=>{const c=o.node.toJsonSchemaRecurse(r);if(o.kind==="defaultables"){const h=typeof o.default=="function"?o.default():o.default;c.default=L.intrinsic.jsonData.allows(h)?h:r.fallback.defaultValue({code:"defaultValue",base:c,value:h})}return c})),this.minLength&&(n.minItems=this.minLength),this.variadic){const o=Object.assign(n,{items:this.variadic.toJsonSchemaRecurse(r)});if(this.maxLength&&(o.maxItems=this.maxLength),this.postfix){const c=this.postfix.map(h=>h.toJsonSchemaRecurse(r));n=r.fallback.arrayPostfix({code:"arrayPostfix",base:o,elements:c})}}else n.items=!1,delete n.maxItems;return n}}const sf={},yE=t=>{if(!t.defaultables)return[];const s=[];let n="[";const r=t.prefixLength+t.defaultablesLength-1;for(let o=t.prefixLength;o<=r;o++){const[c,h]=t.defaultables[o-t.prefixLength];s.push(uv(o,c,h)),n+=`${o}: ${c.id} = ${Ii(h)}, `}return n+="]",sf[n]??(sf[n]=s)},gv={implementation:pE,Node:mE},gE=t=>{const s=[];if(t.prefix)for(const n of t.prefix)s.push({kind:"prefix",node:n});if(t.defaultables)for(const[n,r]of t.defaultables)s.push({kind:"defaultables",node:n,default:r});if(t.optionals)for(const n of t.optionals)s.push({kind:"optionals",node:n});if(t.variadic&&s.push({kind:"variadic",node:t.variadic}),t.postfix)for(const n of t.postfix)s.push({kind:"postfix",node:n});return s},tg=t=>t.reduce((s,n)=>(n.kind==="variadic"?s.variadic=n.node:n.kind==="defaultables"?s.defaultables=De(s.defaultables,[[n.node,n.default]]):s[n.kind]=De(s[n.kind],n.node),s),{}),bv="A postfix required element cannot follow an optional or defaultable element",bE="A postfix element requires a variadic element",aa=t=>{var x,N;const[s,...n]=t.l,[r,...o]=t.r;if(!s||!r)return t;const c=((x=n.at(-1))==null?void 0:x.kind)==="postfix",h=((N=o.at(-1))==null?void 0:N.kind)==="postfix",p=s.kind==="prefix"||r.kind==="prefix"?"prefix":s.kind==="postfix"||r.kind==="postfix"?"postfix":s.kind==="variadic"&&r.kind==="variadic"?"variadic":c||h?"prefix":s.kind==="defaultables"||r.kind==="defaultables"?"defaultables":"optionals";if(s.kind==="prefix"&&r.kind==="variadic"&&h){const k=aa({...t,fixedVariants:[],r:o.map(B=>({...B,kind:"prefix"}))});k.disjoint.length===0&&t.fixedVariants.push(k)}else if(r.kind==="prefix"&&s.kind==="variadic"&&c){const k=aa({...t,fixedVariants:[],l:n.map(B=>({...B,kind:"prefix"}))});k.disjoint.length===0&&t.fixedVariants.push(k)}const m=ht(s.node,r.node,t.ctx);if(m instanceof X)if(p==="prefix"||p==="postfix")t.disjoint.push(...m.withPrefixKey(p==="prefix"?t.result.length:`-${n.length+1}`,"required")),t.result=[...t.result,{kind:p,node:L.intrinsic.never.internal}];else return p==="optionals"||p==="defaultables"?t:aa({...t,fixedVariants:[],l:n.map(k=>({...k,kind:"prefix"})),r:n.map(k=>({...k,kind:"prefix"}))});else p==="defaultables"?(s.kind==="defaultables"&&r.kind==="defaultables"&&s.default!==r.default&&q(ov(s.default,r.default)),t.result=[...t.result,{kind:p,node:m,default:s.kind==="defaultables"?s.default:r.kind==="defaultables"?r.default:it(`Unexpected defaultable intersection from ${s.kind} and ${r.kind} elements.`)}]):t.result=[...t.result,{kind:p,node:m}];const y=t.l.length,v=t.r.length;return(s.kind!=="variadic"||y>=v&&(r.kind==="variadic"||v===1))&&(t.l=n),(r.kind!=="variadic"||v>=y&&(s.kind==="variadic"||y===1))&&(t.r=o),aa(t)},vv=t=>s=>{var n,r;if(s.props.length||s.index){const o=((n=s.index)==null?void 0:n.map(h=>h[t]))??[];for(const h of s.props)o.push(h[t]);s.undeclared&&o.push(`+ (undeclared): ${s.undeclared}`);const c=`{ ${o.join(", ")} }`;return s.sequence?`${c} & ${s.sequence.description}`:c}return((r=s.sequence)==null?void 0:r.description)??"{}"},vE=vv("description"),SE=vv("expression"),ng=(t,s,n)=>{const r=t.required?"required":"optional";if(!s.signature.allows(t.key))return null;const o=Gn(t.value,s.value,n);return o instanceof X?r==="optional"?n.node("optional",{key:t.key,value:L.intrinsic.never.internal}):o.withPrefixKey(t.key,t.kind):null},AE=Ie({kind:"structure",hasAssociatedError:!1,normalize:t=>t,applyConfig:(t,s)=>!t.undeclared&&s.onUndeclaredKey!=="ignore"?{...t,undeclared:s.onUndeclaredKey}:t,keys:{required:{child:!0,parse:zt("required"),reduceIo:(t,s,n)=>{s.required=De(s.required,n.map(r=>r[t]))}},optional:{child:!0,parse:zt("optional"),reduceIo:(t,s,n)=>{if(t==="in"){s.optional=n.map(r=>r.in);return}for(const r of n)s[r.outProp.kind]=De(s[r.outProp.kind],r.outProp.out)}},index:{child:!0,parse:zt("index")},sequence:{child:!0,parse:zt("sequence")},undeclared:{parse:t=>t==="ignore"?void 0:t,reduceIo:(t,s,n)=>{n==="delete"&&(t==="in"?delete s.undeclared:s.undeclared="reject")}}},defaults:{description:vE},intersections:{structure:(t,s,n)=>{const r={...t.inner},o={...s.inner},c=new X;if(t.undeclared){const m=t.keyof();for(const y of s.requiredKeys)m.allows(y)||c.add("presence",L.intrinsic.never.internal,s.propsByKey[y].value,{path:[y]});o.optional&&(o.optional=o.optional.filter(y=>m.allows(y.key))),o.index&&(o.index=o.index.flatMap(y=>{if(y.signature.extends(m))return y;const v=Gn(m,y.signature,n.$);if(v instanceof X)return[];const x=kf(v,y.value,n.$);return x.required&&(o.required=Gi(o.required,x.required)),x.optional&&(o.optional=Gi(o.optional,x.optional)),x.index??[]}))}if(s.undeclared){const m=s.keyof();for(const y of t.requiredKeys)m.allows(y)||c.add("presence",t.propsByKey[y].value,L.intrinsic.never.internal,{path:[y]});r.optional&&(r.optional=r.optional.filter(y=>m.allows(y.key))),r.index&&(r.index=r.index.flatMap(y=>{if(y.signature.extends(m))return y;const v=Gn(m,y.signature,n.$);if(v instanceof X)return[];const x=kf(v,y.value,n.$);return x.required&&(r.required=Gi(r.required,x.required)),x.optional&&(r.optional=Gi(r.optional,x.optional)),x.index??[]}))}const h={};(t.undeclared||s.undeclared)&&(h.undeclared=t.undeclared==="reject"||s.undeclared==="reject"?"reject":"delete");const p=uo({kind:"structure",baseInner:h,l:co(r),r:co(o),roots:[],ctx:n});return p instanceof X&&c.push(...p),c.length?c:p}},reduce:(t,s)=>{if(t.index){if(!(t.required||t.optional))return;let n=!1;const r=t.required??[],o=t.optional??[],c=[...o];for(const h of t.index){for(const p of r){const m=ng(p,h,s);if(m instanceof X)return m}for(const[p,m]of o.entries()){const y=ng(m,h,s);if(y instanceof X)return y;y!==null&&(c[p]=y,n=!0)}}if(n)return s.node("structure",{...t,optional:c},{prereduced:!0})}}});var Fg,Wg;class wE extends nr{constructor(){super(...arguments);g(this,"impliedBasis",L.intrinsic.object.internal);g(this,"impliedSiblings",this.children.flatMap(n=>n.impliedSiblings??[]));g(this,"props",Gi(this.required,this.optional));g(this,"propsByKey",Ce(this.props,(n,r)=>[r.key,r]));g(this,"propsByKeyReference",kt(this.propsByKey));g(this,"expression",SE(this));g(this,"requiredKeys",((Fg=this.required)==null?void 0:Fg.map(n=>n.key))??[]);g(this,"optionalKeys",((Wg=this.optional)==null?void 0:Wg.map(n=>n.key))??[]);g(this,"literalKeys",[...this.requiredKeys,...this.optionalKeys]);g(this,"_keyof");g(this,"traverseAllows",(n,r)=>this._traverse("Allows",n,r));g(this,"traverseApply",(n,r)=>this._traverse("Apply",n,r));g(this,"_traverse",(n,r,o)=>{const c=(o==null?void 0:o.currentErrorCount)??0;for(let h=0;h<this.props.length;h++)if(n==="Allows"){if(!this.props[h].traverseAllows(r,o))return!1}else if(this.props[h].traverseApply(r,o),o.failFast&&o.currentErrorCount>c)return!1;if(this.sequence){if(n==="Allows"){if(!this.sequence.traverseAllows(r,o))return!1}else if(this.sequence.traverseApply(r,o),o.failFast&&o.currentErrorCount>c)return!1}if(this.index||this.undeclared==="reject"){const h=Object.keys(r);h.push(...Object.getOwnPropertySymbols(r));for(let p=0;p<h.length;p++){const m=h[p];if(this.index){for(const y of this.index)if(y.signature.traverseAllows(m,o)){if(n==="Allows"){if(!Hn(m,()=>y.value.traverseAllows(r[m],o),o))return!1}else if(Hn(m,()=>y.value.traverseApply(r[m],o),o),o.failFast&&o.currentErrorCount>c)return!1}}if(this.undeclared==="reject"&&!this.declaresKey(m)&&(n==="Allows"||(o.errorFromNodeContext({code:"predicate",expected:"removed",actual:"",relativePath:[m],meta:this.meta}),o.failFast)))return!1}}return this.structuralMorph&&o&&!o.hasError()&&o.queueMorphs([this.structuralMorph]),!0});g(this,"declaresKey",n=>{var r;return n in this.propsByKey||((r=this.index)==null?void 0:r.some(o=>o.signature.allows(n)))||this.sequence!==void 0&&L.intrinsic.nonNegativeIntegerString.allows(n)});g(this,"structuralMorphRef",this.structuralMorph&&kt(this.structuralMorph))}keyof(){if(this._keyof)return this._keyof;let n=this.$.units(this.literalKeys).branches;if(this.index)for(const{signature:r}of this.index)n=n.concat(r.branches);return this._keyof=this.$.node("union",n)}map(n){return this.$.node("structure",this.props.flatMap(n).reduce((r,o)=>{const c=this.propsByKey[o.key];if(Rt(o))return o.kind!=="required"&&o.kind!=="optional"?q(`Map result must have kind "required" or "optional" (was ${o.kind})`):(r[o.kind]=De(r[o.kind],o),r);const h=o.kind??(c==null?void 0:c.kind)??"required",p=Ce(o,(m,y)=>m in gh.implementation.keys?[m,y]:[]);return r[h]=De(r[h],this.$.node(h,p)),r},{}))}assertHasKeys(n){const r=n.filter(o=>!Jl(o,this.keyof()));if(r.length)return q(ig(this.expression,r))}get(n,...r){var m;let o,c=!1;const h=_E(n);if((typeof h=="string"||typeof h=="symbol")&&this.propsByKey[h]&&(o=this.propsByKey[h].value,c=this.propsByKey[h].required),this.index)for(const y of this.index)Jl(h,y.signature)&&(o=(o==null?void 0:o.and(y.value))??y.value);if(this.sequence&&Jl(h,L.intrinsic.nonNegativeIntegerString))if(te(h,"root"))this.sequence.variadic&&(o=(o==null?void 0:o.and(this.sequence.element))??this.sequence.element);else{const y=Number.parseInt(h);if(y<this.sequence.prevariadic.length){const v=this.sequence.prevariadic[y].node;o=(o==null?void 0:o.and(v))??v,c||(c=y<this.sequence.prefixLength)}else if(this.sequence.variadic){const v=this.$.node("union",this.sequence.variadicOrPostfix);o=(o==null?void 0:o.and(v))??v}}if(!o)return(m=this.sequence)!=null&&m.variadic&&te(h,"root")&&h.extends(L.intrinsic.number)?q(TE(h.expression,this.sequence.expression)):q(ig(this.expression,[h]));const p=o.get(...r);return c?p:p.or(L.intrinsic.undefined)}pick(...n){return this.assertHasKeys(n),this.$.node("structure",this.filterKeys("pick",n))}omit(...n){return this.assertHasKeys(n),this.$.node("structure",this.filterKeys("omit",n))}optionalize(){const{required:n,...r}=this.inner;return this.$.node("structure",{...r,optional:this.props.map(o=>o.hasKind("required")?this.$.node("optional",o.inner):o)})}require(){const{optional:n,...r}=this.inner;return this.$.node("structure",{...r,required:this.props.map(o=>o.hasKind("optional")?{key:o.key,value:o.value}:o)})}merge(n){const r=this.filterKeys("omit",[n.keyof()]);return n.required&&(r.required=De(r.required,n.required)),n.optional&&(r.optional=De(r.optional,n.optional)),n.index&&(r.index=De(r.index,n.index)),n.sequence&&(r.sequence=n.sequence),n.undeclared?r.undeclared=n.undeclared:delete r.undeclared,this.$.node("structure",r)}filterKeys(n,r){const o=Ub(this.inner),c=h=>{const p=r.some(m=>Jl(h,m));return n==="pick"?p:!p};return o.required&&(o.required=o.required.filter(h=>c(h.key))),o.optional&&(o.optional=o.optional.filter(h=>c(h.key))),o.index&&(o.index=o.index.filter(h=>c(h.signature))),o}get defaultable(){var n;return this.cacheGetter("defaultable",((n=this.optional)==null?void 0:n.filter(r=>r.hasDefault()))??[])}_compileDeclaresKey(n){const r=[];if(this.props.length&&r.push(`k in ${this.propsByKeyReference}`),this.index)for(const o of this.index)r.push(n.invoke(o.signature,{kind:"Allows",arg:"k"}));return this.sequence&&r.push("$ark.intrinsic.nonNegativeIntegerString.allows(k)"),r.join(" || ")||"false"}get structuralMorph(){return this.cacheGetter("structuralMorph",OE(this))}compile(n){n.traversalKind==="Apply"&&n.initializeErrorCount();for(const r of this.props)n.check(r),n.traversalKind==="Apply"&&n.returnIfFailFast();if(this.sequence&&(n.check(this.sequence),n.traversalKind==="Apply"&&n.returnIfFailFast()),(this.index||this.undeclared==="reject")&&(n.const("keys","Object.keys(data)"),n.line("keys.push(...Object.getOwnPropertySymbols(data))"),n.for("i < keys.length",()=>this.compileExhaustiveEntry(n))),n.traversalKind==="Allows")return n.return(!0);this.structuralMorphRef&&n.if("ctx && !ctx.hasError()",()=>(n.line("ctx.queueMorphs(["),EE(n,this),n.line("])")))}compileExhaustiveEntry(n){if(n.const("k","keys[i]"),this.index)for(const r of this.index)n.if(`${n.invoke(r.signature,{arg:"k",kind:"Allows"})}`,()=>n.traverseKey("k","data[k]",r.value));return this.undeclared==="reject"&&n.if(`!(${this._compileDeclaresKey(n)})`,()=>n.traversalKind==="Allows"?n.return(!1):n.line(`ctx.errorFromNodeContext({ code: "predicate", expected: "removed", actual: "", relativePath: [k], meta: ${this.compiledMeta} })`).if("ctx.failFast",()=>n.return())),n}reduceJsonSchema(n,r){var o;switch(n.type){case"object":return this.reduceObjectJsonSchema(n,r);case"array":const c=((o=this.sequence)==null?void 0:o.reduceJsonSchema(n,r))??n;return this.props.length||this.index?r.fallback.arrayObject({code:"arrayObject",base:c,object:this.reduceObjectJsonSchema({type:"object"},r)}):c;default:return at.throwInternalOperandError("structure",n)}}reduceObjectJsonSchema(n,r){if(this.props.length){n.properties={};for(const o of this.props){const c=o.value.toJsonSchemaRecurse(r);if(typeof o.key=="symbol"){r.fallback.symbolKey({code:"symbolKey",base:n,key:o.key,value:c,optional:o.optional});continue}if(o.hasDefault()){const h=typeof o.default=="function"?o.default():o.default;c.default=L.intrinsic.jsonData.allows(h)?h:r.fallback.defaultValue({code:"defaultValue",base:c,value:h})}n.properties[o.key]=c}this.requiredKeys.length&&n.properties&&(n.required=this.requiredKeys.filter(o=>typeof o=="string"&&o in n.properties))}if(this.index)for(const o of this.index){const c=o.value.toJsonSchemaRecurse(r);if(o.signature.equals(L.intrinsic.string)){n.additionalProperties=c;continue}for(const h of o.signature.branches){if(!h.extends(L.intrinsic.string)){n=r.fallback.symbolKey({code:"symbolKey",base:n,key:null,value:c,optional:!1});continue}let p={type:"string"};if(h.hasKind("morph")&&(p=r.fallback.morph({code:"morph",base:h.in.toJsonSchemaRecurse(r),out:h.out.toJsonSchemaRecurse(r)})),!h.hasKind("intersection"))return it(`Unexpected index branch kind ${h.kind}.`);const{pattern:m}=h.inner;if(m){const y=Object.assign(p,{pattern:m[0].rule});for(let v=1;v<m.length;v++)p=r.fallback.patternIntersection({code:"patternIntersection",base:y,pattern:m[v].rule});n.patternProperties??(n.patternProperties={}),n.patternProperties[y.pattern]=c}}}return this.undeclared&&!n.additionalProperties&&(n.additionalProperties=!1),n}}const rf={},xE=t=>{var n,r;let s="";for(let o=0;o<t.defaultable.length;o++)s+=t.defaultable[o].defaultValueMorphRef;if((n=t.sequence)!=null&&n.defaultValueMorphsReference&&(s+=(r=t.sequence)==null?void 0:r.defaultValueMorphsReference),t.undeclared==="delete"){if(s+="delete !(",t.required)for(const o of t.required)s+=o.compiledKey+" | ";if(t.optional)for(const o of t.optional)s+=o.compiledKey+" | ";if(t.index)for(const o of t.index)s+=o.signature.id+" | ";if(t.sequence)if(t.sequence.maxLength===null)s+=ae.nonNegativeIntegerString.id;else for(let o=0;o<t.sequence.tuple.length;o++)s+=o+" | ";s+=")"}return s},OE=t=>{const s=xE(t);if(!s)return;if(rf[s])return rf[s];const n=(r,o)=>{var c;for(let h=0;h<t.defaultable.length;h++)t.defaultable[h].key in r||t.defaultable[h].defaultValueMorph(r,o);if((c=t.sequence)!=null&&c.defaultables)for(let h=r.length-t.sequence.prefixLength;h<t.sequence.defaultables.length;h++)t.sequence.defaultValueMorphs[h](r,o);if(t.undeclared==="delete")for(const h in r)t.declaresKey(h)||delete r[h];return r};return rf[s]=n},EE=(t,s)=>{var o;const r=`(data${s.defaultable.some(c=>c.defaultValueMorph.length===2)||((o=s.sequence)==null?void 0:o.defaultValueMorphs.some(c=>c.length===2))?", ctx":""})`;return t.block(`${r} => `,c=>{var h;for(let p=0;p<s.defaultable.length;p++){const{serializedKey:m,defaultValueMorphRef:y}=s.defaultable[p];c.if(`!(${m} in data)`,v=>v.line(`${y}${r}`))}return(h=s.sequence)!=null&&h.defaultables&&c.for(`i < ${s.sequence.defaultables.length}`,p=>p.set("data[i]",5),`data.length - ${s.sequence.prefixLength}`),s.undeclared==="delete"&&c.forIn("data",p=>p.if(`!(${s._compileDeclaresKey(p)})`,m=>m.line("delete data[k]"))),c.return("data")})},Sv={implementation:AE,Node:wE},_E=t=>(te(t,"root")&&t.hasKind("unit")&&(t=t.unit),typeof t=="number"&&(t=`${t}`),t),TE=(t,s)=>`${t} is not allowed as an array index on ${s}. Use the 'nonNegativeIntegerString' keyword instead.`,kf=(t,s,n)=>{const[r,o]=_w(t.branches,h=>h.hasKind("unit"));if(!r.length)return{index:n.node("index",{signature:t,value:s})};const c={};for(const h of r){const p=n.node("required",{key:h.unit,value:s});c[p.kind]=De(c[p.kind],p)}return o.length&&(c.index=n.node("index",{signature:o,value:s})),c},RE=t=>te(t,"root")?t.expression:Me(t),ig=(t,s)=>`Key${s.length===1?"":"s"} ${s.map(RE).join(", ")} ${s.length===1?"does":"do"} not exist on ${t}`,Eo={...bO,alias:vh.implementation,domain:Ah.implementation,unit:pv.implementation,proto:ho.implementation,union:dv.implementation,morph:fv.implementation,intersection:cv.implementation,divisor:Jb.implementation,pattern:sv.implementation,predicate:Yb.implementation,required:yv.implementation,optional:gh.implementation,index:mv.implementation,sequence:gv.implementation,structure:Sv.implementation};L.defaultConfig=qw(Object.assign(Ce(Eo,(t,s)=>[t,s.defaults]),{jitless:Xw(),clone:Yw,onUndeclaredKey:"ignore",exactOptionalPropertyTypes:!0,numberAllowsNaN:!1,dateAllowsInvalid:!1,onFail:null,keywords:{},toJsonSchema:at.defaultConfig}));L.resolvedConfig=Of(L.defaultConfig,L.config);const kE={...vO,alias:vh.Node,domain:Ah.Node,unit:pv.Node,proto:ho.Node,union:dv.Node,morph:fv.Node,intersection:cv.Node,divisor:Jb.Node,pattern:sv.Node,predicate:Yb.Node,required:yv.Node,optional:gh.Node,index:mv.Node,sequence:gv.Node,structure:Sv.Node};class Nf extends Dw{get[Vn](){return"module"}}const Av=(t,s)=>new Nf(Ce(t,(n,r)=>[n,te(r,"module")?Av(r,s):s.bindReference(r)])),NE=t=>Et(t)?t:"branches"in t&&Et(t.branches)?t.branches:void 0,ME=(t,s)=>q(`Node of kind ${s} is not valid as a ${t} definition`),sg=t=>`#${t} duplicates public alias ${t}`,af={};L.ambient??(L.ambient={});let rg;const wv="function $",$E=t=>xv(t,Ov(t)),xv=(t,s)=>{const n=s.write(wv,4),r=s.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)},Ov=t=>new Db().return(t.reduce((s,n)=>{const r=new ef({kind:"Allows"}).indent();n.compile(r);const o=r.write(`${n.id}Allows`),c=new ef({kind:"Apply"}).indent();n.compile(c);const h=c.write(`${n.id}Apply`),p=`${s}${o},
103
- ${h},
104
- `;if(!n.hasKind("union"))return p;const m=new ef({kind:"Allows",optimistic:!0}).indent();n.compile(m);const y=m.write(`${n.id}Optimistic`);return`${p}${y},
105
- `},`{
106
- `)+"}");class Ev{constructor(s,n){g(this,"config");g(this,"resolvedConfig");g(this,"name");g(this,"referencesById",{});g(this,"references",[]);g(this,"resolutions",{});g(this,"exportedNames",[]);g(this,"aliases",{});g(this,"resolved",!1);g(this,"nodesByHash",{});g(this,"intrinsic");g(this,"_json");g(this,"generic",(...s)=>{const n=this;return(r,o)=>new fo(s,o?new Gb(r):r,n,n,o??null)});g(this,"units",(s,n)=>{const r=[];for(const c of s)r.includes(c)||r.push(c);const o=r.map(c=>this.node("unit",{unit:c},n));return this.node("union",o,{...n,prereduced:!0})});g(this,"lazyResolutions",[]);g(this,"schema",(s,n)=>this.finalize(this.parseSchema(s,n)));g(this,"parseSchema",(s,n)=>this.node(Wl(s),s,n));g(this,"precompilation");g(this,"_exportedResolutions");g(this,"_exports");g(this,"node",(s,n,r={})=>{const o=this.preparseNode(s,n,r);if(Rt(o))return this.bindReference(o);const c=this.createParseContext(o),h=av(c),p=this.bindReference(h);return rn[c.id]=p});g(this,"parse",(s,n={})=>this.finalize(this.parseDefinition(s,n)));this.config=Of(L.config,n),this.resolvedConfig=Of(L.resolvedConfig,n),this.name=this.resolvedConfig.name??`anonymousScope${Object.keys(af).length}`,this.name in af&&q(`A Scope already named ${this.name} already exists`),af[this.name]=this;const r=Object.entries(s).map(o=>this.preparseOwnAliasEntry(...o));for(const[o,c]of r){let h=o;if(o[0]==="#"?(h=o.slice(1),h in this.aliases&&q(sg(h)),this.aliases[h]=c):(h in this.aliases&&q(sg(o)),this.aliases[h]=c,this.exportedNames.push(h)),!te(c,"module")&&!te(c,"generic")&&!vo(c)){const p=this.preparseOwnDefinitionFormat(c,{alias:h});this.resolutions[h]=te(p,"root")?this.bindReference(p):this.createParseContext(p).id}}rg??(rg=this.node("union",{branches:["string","number","object","bigint","symbol",{unit:!0},{unit:!1},{unit:void 0},{unit:null}]},{prereduced:!0})),this.nodesByHash[rg.hash]=this.node("intersection",{},{prereduced:!0}),this.intrinsic=L.intrinsic?Ce(L.intrinsic,(o,c)=>o.startsWith("json")?[]:[o,this.bindReference(c)]):{}}get[Vn](){return"scope"}cacheGetter(s,n){return Object.defineProperty(this,s,{value:n}),n}get internal(){return this}get json(){return this._json||this.export(),this._json}defineSchema(s){return s}lazilyResolve(s,n){const r=this.node("alias",{reference:n??"synthetic",resolve:s},{prereduced:!0});return this.resolved||this.lazyResolutions.push(r),r}preparseNode(s,n,r){var p;let o=typeof s=="string"?s:Wl(n,s);if(Rt(n)&&n.kind===o)return n;if(o==="alias"&&!(r!=null&&r.prereduced)){const{reference:m}=vh.implementation.normalize(n,this);if(m.startsWith("$")){const y=this.resolveRoot(m.slice(1));n=y,o=y.kind}}else if(o==="union"&&Qi(n,"object")){const m=NE(n);(m==null?void 0:m.length)===1&&(n=m[0],o=Wl(n))}if(Rt(n)&&n.kind===o)return n;const c=Eo[o],h=((p=c.normalize)==null?void 0:p.call(c,n,this))??n;return Rt(h)?h.kind===o?h:ME(o,h.kind):{...r,$:this,kind:o,def:h,prefix:r.alias??o}}bindReference(s){let n;return Rt(s)?n=s.$===this?s:new s.constructor(s.attachments,this):n=s.$===this?s:new fo(s.params,s.bodyDef,s.$,this,s.hkt),this.resolved||Object.assign(this.referencesById,n.referencesById),n}resolveRoot(s){return this.maybeResolveRoot(s)??q(kv(s))}maybeResolveRoot(s){const n=this.maybeResolve(s);if(!te(n,"generic"))return n}maybeResolveSubalias(s){return Mf(this.aliases,s)??Mf(this.ambient,s)}get ambient(){return L.ambient}maybeResolve(s){var o;const n=this.resolutions[s];if(n){if(typeof n!="string")return this.bindReference(n);const c=rn[n];if(te(c,"root"))return this.resolutions[s]=c;if(te(c,"context")){if(c.phase==="resolving")return this.node("alias",{reference:`$${s}`},{prereduced:!0});if(c.phase==="resolved")return it(`Unexpected resolved context for was uncached by its scope: ${Me(c)}`);c.phase="resolving";const h=this.bindReference(this.parseOwnDefinitionFormat(c.def,c));return c.phase="resolved",rn[h.id]=h,rn[c.id]=h,this.resolutions[s]=h}return it(`Unexpected nodesById entry for ${n}: ${Me(c)}`)}let r=this.aliases[s]??((o=this.ambient)==null?void 0:o[s]);return r?(r=this.normalizeRootScopeValue(r),te(r,"generic")?this.resolutions[s]=this.bindReference(r):te(r,"module")?(r.root||q(Nv(s)),this.resolutions[s]=this.bindReference(r.root)):this.resolutions[s]=this.parse(r,{alias:s})):this.maybeResolveSubalias(s)}createParseContext(s){const n=s.id??rv(s.prefix);return rn[n]=Object.assign(s,{[Vn]:"context",$:this,id:n,phase:"unresolved"})}traversal(s){return new Ls(s,this.resolvedConfig)}import(...s){return new Nf(Ce(this.export(...s),(n,r)=>[`#${n}`,r]))}export(...s){if(!this._exports){this._exports={};for(const r of this.exportedNames){const o=this.aliases[r];this._exports[r]=te(o,"module")?Av(o,this):ag(this.maybeResolve(r))}for(const r of this.lazyResolutions)r.resolution;if(this._exportedResolutions=Rv(this,this._exports),this._json=Tv(this._exportedResolutions),Object.assign(this.resolutions,this._exportedResolutions),this.references=Object.values(this.referencesById),!this.resolvedConfig.jitless){const r=Ov(this.references);this.precompilation=r.write(wv,4),xv(this.references,r)}this.resolved=!0}const n=s.length?s:this.exportedNames;return new Nf(Ce(n,(r,o)=>[o,this._exports[o]]))}resolve(s){return this.export()[s]}parseDefinition(s,n={}){if(te(s,"root"))return this.bindReference(s);const r=this.preparseOwnDefinitionFormat(s,n);if(te(r,"root"))return this.bindReference(r);const o=this.createParseContext(r);rn[o.id]=o;let c=this.bindReference(this.parseOwnDefinitionFormat(s,o));return c.isCyclic&&(c=OO(c,o.id)),rn[o.id]=c,c}finalize(s){return ag(s),!s.precompilation&&!this.resolvedConfig.jitless&&$E(s.references),s}}class _v extends Ev{parseOwnDefinitionFormat(s,n){return av(n)}preparseOwnDefinitionFormat(s,n){return this.preparseNode(Wl(s),s,n)}preparseOwnAliasEntry(s,n){return[s,n]}normalizeRootScopeValue(s){return s}}const ag=t=>{const s=t.references.filter(n=>n.hasKind("alias"));for(const n of s){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},Tv=t=>Ce(t,(s,n)=>[s,te(n,"root")||te(n,"generic")?n.json:te(n,"module")?Tv(n):it(`Unexpected resolution ${Me(n)}`)]),Mf=(t,s)=>{const n=s.indexOf(".");if(n===-1)return;const r=s.slice(0,n),o=t[r];if(o===void 0)return;if(!te(o,"module"))return q(DE(r));const c=s.slice(n+1),h=o[c];if(h===void 0)return Mf(o,c);if(te(h,"root")||te(h,"generic"))return h;if(te(h,"module"))return h.root??q(Nv(s));it(`Unexpected resolution for alias '${s}': ${Me(h)}`)},wh=(t,s)=>new _v(t,s),_a=new _v({}),Rv=(t,s)=>{const n={};for(const r in s){const o=s[r];if(te(o,"module")){const c=Rv(t,o),h=Ce(c,(p,m)=>[`${r}.${p}`,m]);Object.assign(n,h)}else te(o,"root")||te(o,"generic")?n[r]=o:it(`Unexpected scope resolution ${Me(o)}`)}return n},kv=t=>`'${t}' is unresolvable`,DE=t=>`'${t}' must reference a module to be accessed using dot syntax`,Nv=t=>`Reference to submodule '${t}' must specify an alias`;_a.export();const qe=_a.schema,xh=_a.node;_a.defineSchema;const Jn=_a.generic,Mv="^(?:0|[1-9]\\d*)$",CE=new RegExp(Mv);kt(CE);const $v=wh({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();L.intrinsic={...$v};const Dv=wh({integer:{domain:"number",divisor:1},lengthBoundable:["string",Array],key:["string","symbol"],nonNegativeIntegerString:{domain:"string",pattern:Mv}},{prereducedAliases:!0}).export();Object.assign(L.intrinsic,Dv);const zE=wh({jsonPrimitive:["string","number",{unit:!0},{unit:!1},{unit:null}],jsonObject:{domain:"object",index:{signature:"string",value:"$jsonData"}},jsonData:["$jsonPrimitive","$jsonObject"]},{prereducedAliases:!0}).export(),ae={...$v,...Dv,...zE,emptyStructure:xh("structure",{},{prereduced:!0})};L.intrinsic={...ae};const UE=t=>typeof t=="string"&&t[0]==="d"&&(t[1]==="'"||t[1]==='"')&&t.at(-1)===t[1],lg=t=>t.toString()!=="Invalid Date",BE=t=>t.slice(2,-1),Cv=t=>`'${t}' could not be parsed by the Date constructor`,qE=(t,s)=>KE(t,s),KE=(t,s)=>{const n=new Date(t);if(lg(n))return n;const r=fx(t);if(r!==void 0){const o=new Date(r);if(lg(o))return o}return s?q(s===!0?Cv(t):s):void 0},og=(t,s)=>{const n=t.scanner.shiftUntil(LE[Uv[s]]);if(t.scanner.lookahead==="")return t.error(HE(n,s));if(t.scanner.shift(),s==="/"){try{new RegExp(n)}catch(r){q(String(r))}t.root=t.ctx.$.node("intersection",{domain:"string",pattern:n},{prereduced:!0})}else if(wn(s,zv))t.root=t.ctx.$.node("unit",{unit:n});else{const r=qE(n,Cv(n));t.root=t.ctx.$.node("unit",{meta:n,unit:r})}},zv={"'":1,'"':1},jE={"/":1,"'":1,'"':1},Uv={"d'":"'",'d"':'"',"'":"'",'"':'"',"/":"/"},LE={"'":t=>t.lookahead==="'",'"':t=>t.lookahead==='"',"/":t=>t.lookahead==="/"},VE={'"':"double-quote","'":"single-quote","/":"forward slash"},HE=(t,s)=>`${s}${t} requires a closing ${VE[Uv[s]]}`,GE=t=>`Private type references should not include '#'. Use '${t}' instead.`,Bv="Optional definitions like 'string?' are only valid as properties in an object or tuple",qv="Defaultable definitions like 'number = 0' are only valid as properties in an object or tuple",YE={">":!0,">=":!0},JE={"<":!0,"<=":!0},po={"<":">",">":"<","<=":">=",">=":"<=","==":"=="},IE=t=>`Unmatched )${t===""?"":` before ${t}`}`,Kv=t=>`Missing ${t}`,XE=(t,s)=>`Left bounds are only valid when paired with right bounds (try ...${s}${t})`,jv=t=>`Left-bounded expressions must specify their limits using < or <= (was ${t})`,ZE=(t,s,n,r)=>`An expression may have at most one left bound (parsed ${t}${po[s]}, ${n}${po[r]})`,QE=(t,s,n)=>Lv(t,s,n,[]),Lv=(t,s,n,r)=>{const o=n.parseUntilFinalizer();return r.push(o.root),o.finalizer===">"?r.length!==s.params.length?n.error(Vv(t,s.names,r.map(c=>c.expression))):r:o.finalizer===","?Lv(t,s,n,r):o.error(Kv(">"))},Vv=(t,s,n)=>`${t}<${s.join(", ")}> requires exactly ${s.length} args (got ${n.length}${n.length===0?"":`: ${n.join(", ")}`})`,ug=t=>{const s=t.scanner.shiftUntilNextTerminator();s==="keyof"?t.addPrefix("keyof"):t.root=WE(t,s)},FE=(t,s,n)=>{if(n.scanner.shiftUntilNonWhitespace(),n.scanner.shift()!=="<")return n.error(Vv(t,s.names,[]));const o=QE(t,s,n);return s(...o)},WE=(t,s)=>PE(t,s)??e2(t,s)??t.error(s===""?t.scanner.lookahead==="#"?GE(t.shiftedByOne().scanner.shiftUntilNextTerminator()):Hv(t):kv(s)),PE=(t,s)=>{var r;if((r=t.ctx.args)!=null&&r[s]){const o=t.ctx.args[s];return typeof o!="string"?o:t.ctx.$.node("alias",{reference:o},{prereduced:!0})}const n=t.ctx.$.maybeResolve(s);if(te(n,"root"))return n;if(n!==void 0)return te(n,"generic")?FE(s,n,t):q(`Unexpected resolution ${Me(n)}`)},e2=(t,s)=>{const n=hx(s);if(n!==void 0)return t.ctx.$.node("unit",{unit:n});const r=px(s);if(r!==void 0)return t.ctx.$.node("unit",{unit:r})},Hv=t=>{const s=t.previousOperator();return s?Gv(s,t.scanner.unscanned):t2(t.scanner.unscanned)},Gv=(t,s="")=>`Token '${t}' requires a right operand${s?` before '${s}'`:""}`,t2=t=>`Expected an expression${t?` before '${t}'`:""}`,Yv=t=>t.scanner.lookahead===""?t.error(Hv(t)):t.scanner.lookahead==="("?t.shiftedByOne().reduceGroupOpen():t.scanner.lookaheadIsIn(jE)?og(t,t.scanner.shift()):t.scanner.lookaheadIsIn(So)?Yv(t.shiftedByOne()):t.scanner.lookahead==="d"&&t.scanner.nextLookahead in zv?og(t,`${t.scanner.shift()}${t.scanner.shift()}`):ug(t),Vi=class Vi extends wx{shiftUntilNextTerminator(){return this.shiftUntilNonWhitespace(),this.shiftUntil(()=>this.lookahead in Vi.terminatingChars)}};g(Vi,"terminatingChars",{"<":1,">":1,"=":1,"|":1,"&":1,")":1,"[":1,"%":1,",":1,":":1,"?":1,"#":1,...So}),g(Vi,"finalizingLookaheads",{">":1,",":1,"":1,"=":1,"?":1}),g(Vi,"lookaheadIsFinalizing",(s,n)=>s===">"?n[0]==="="?n[1]==="=":n.trimStart()===""||wn(n.trimStart()[0],Vi.terminatingChars):s==="="?n[0]!=="=":s===","||s==="?");let ha=Vi;const n2=(t,s)=>{const n=s2(t,s);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 a2(t,n)},i2={"<":1,">":1,"=":1},s2=(t,s)=>t.scanner.lookaheadIs("=")?`${s}${t.scanner.shift()}`:s,cg=(t,s,n,r)=>n.extends(L.intrinsic.number)?typeof s!="number"?q($f(t,s,r)):t==="=="?["min","max"]:t[0]===">"?["min"]:["max"]:n.extends(L.intrinsic.lengthBoundable)?typeof s!="number"?q($f(t,s,r)):t==="=="?["exactLength"]:t[0]===">"?["minLength"]:["maxLength"]:n.extends(L.intrinsic.Date)?t==="=="?["after","before"]:t[0]===">"?["after"]:["before"]:q(iO(n.expression)),r2=t=>({rule:UE(t.limit)?BE(t.limit):t.limit,exclusive:t.comparator.length===1}),a2=(t,s)=>{const n=t.unsetRoot(),r=t.scanner.location;t.parseOperand();const o=t.unsetRoot(),c=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($f(s,c,"right"));const h=o.unit,p=s.length===1,m=cg(s,typeof h=="number"?h:c,n,"right");for(const v of m)t.constrainRoot(v,s==="=="?{rule:h}:{rule:h,exclusive:p});if(!t.branches.leftBound)return;if(!wn(s,JE))return t.error(jv(s));const y=cg(t.branches.leftBound.comparator,t.branches.leftBound.limit,n,"left");t.constrainRoot(y[0],r2(t.branches.leftBound)),t.branches.leftBound=null},$f=(t,s,n)=>`Comparator ${n==="left"?po[t]:t} must be ${n==="left"?"preceded":"followed"} by a corresponding literal (was ${s})`,l2=t=>{t.scanner.shiftUntilNonWhitespace();const s=t.scanner.shiftUntilNextTerminator();t.root=t.root.brand(s)},o2=t=>{const s=t.scanner.shiftUntilNextTerminator(),n=dx(s,{errorOnFail:fg(s)});n===0&&t.error(fg(0)),t.root=t.root.constrain("divisor",n)},fg=t=>`% operator must be followed by a non-zero integer literal (was ${t})`,Jv=t=>{const s=t.scanner.shift();return s===""?t.finalize(""):s==="["?t.scanner.shift()==="]"?t.setRoot(t.root.array()):t.error(u2):s==="|"?t.scanner.lookahead===">"?t.shiftedByOne().pushRootToBranch("|>"):t.pushRootToBranch(s):s==="&"?t.pushRootToBranch(s):s===")"?t.finalizeGroup():ha.lookaheadIsFinalizing(s,t.scanner.unscanned)?t.finalize(s):wn(s,i2)?n2(t,s):s==="%"?o2(t):s==="#"?l2(t):s in So?Jv(t):t.error(Oh(s))},Oh=(t,s="")=>`'${t}' is not allowed here${s&&` (should be ${s})`}`,u2="Missing expected ']'",c2=t=>{const s=t.unsetRoot();t.parseOperand();const n=t.unsetRoot();if(!n.hasKind("unit"))return t.error(f2(n.expression));const r=n.unit instanceof Date?()=>new Date(n.unit):n.unit;return[s,"=",r]},f2=t=>`Default value '${t}' must a literal value`,hg=(t,s)=>{const n=s.$.maybeResolveRoot(t);if(n)return n;if(t.endsWith("[]")){const c=s.$.maybeResolveRoot(t.slice(0,-2));if(c)return c.array()}const r=new _o(new ha(t),s),o=h2(r);return r.finalizer===">"&&q(Oh(">")),o},h2=t=>{t.parseOperand();let s=Eh(t).root;return s?(t.finalizer==="="?s=c2(t):t.finalizer==="?"&&(s=[s,"?"]),t.scanner.shiftUntilNonWhitespace(),t.scanner.lookahead&&q(Oh(t.scanner.lookahead)),s):it(`Root was unexpectedly unset after parsing string '${t.scanner.scanned}'`)},Eh=t=>{for(;t.finalizer===void 0;)d2(t);return t},d2=t=>t.hasRoot()?t.parseOperator():t.parseOperand();class _o{constructor(s,n){g(this,"root");g(this,"branches",{prefixes:[],leftBound:null,intersection:null,union:null,pipe:null});g(this,"finalizer");g(this,"groups",[]);g(this,"scanner");g(this,"ctx");this.scanner=s,this.ctx=n}error(s){return q(s)}hasRoot(){return this.root!==void 0}setRoot(s){this.root=s}unsetRoot(){const s=this.root;return this.root=void 0,s}constrainRoot(...s){this.root=this.root.constrain(s[0],s[1])}finalize(s){if(this.groups.length)return this.error(Kv(")"));this.finalizeBranches(),this.finalizer=s}reduceLeftBound(s,n){const r=po[n];if(!wn(r,YE))return this.error(jv(n));if(this.branches.leftBound)return this.error(ZE(this.branches.leftBound.limit,this.branches.leftBound.comparator,s,r));this.branches.leftBound={comparator:r,limit:s}}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 s=this.groups.pop();if(!s)return this.error(IE(this.scanner.unscanned));this.branches=s}addPrefix(s){this.branches.prefixes.push(s)}applyPrefixes(){for(;this.branches.prefixes.length;){const s=this.branches.prefixes.pop();this.root=s==="keyof"?this.root.keyof():it(`Unexpected prefix '${s}'`)}}pushRootToBranch(s){var r,o,c;this.assertRangeUnset(),this.applyPrefixes();const n=this.root;this.root=void 0,this.branches.intersection=((r=this.branches.intersection)==null?void 0:r.rawAnd(n))??n,s!=="&"&&(this.branches.union=((o=this.branches.union)==null?void 0:o.rawOr(this.branches.intersection))??this.branches.intersection,this.branches.intersection=null,s!=="|"&&(this.branches.pipe=((c=this.branches.pipe)==null?void 0:c.rawPipeOnce(this.branches.union))??this.branches.union,this.branches.union=null))}parseUntilFinalizer(){return Eh(new _o(this.scanner,this.ctx))}parseOperator(){return Jv(this)}parseOperand(){return Yv(this)}assertRangeUnset(){if(this.branches.leftBound)return this.error(XE(this.branches.leftBound.limit,this.branches.leftBound.comparator))}reduceGroupOpen(){this.groups.push(this.branches),this.branches={prefixes:[],leftBound:null,union:null,intersection:null,pipe:null}}previousOperator(){var s;return((s=this.branches.leftBound)==null?void 0:s.comparator)??this.branches.prefixes.at(-1)??(this.branches.intersection?"&":this.branches.union?"|":this.branches.pipe?"|>":void 0)}shiftedByOne(){return this.scanner.shift(),this}}const p2="An empty string is not a valid generic parameter name",Df=(t,s,n)=>{t.shiftUntilNonWhitespace();const r=t.shiftUntilNextTerminator();return r===""?t.lookahead===""&&s.length?s:q(p2):(t.shiftUntilNonWhitespace(),m2(t,r,s,n))},dg="extends ",m2=(t,s,n,r)=>{if(t.shiftUntilNonWhitespace(),t.unscanned.startsWith(dg))t.jumpForward(dg.length);else return t.lookahead===","&&t.shift(),n.push(s),Df(t,n,r);const o=Eh(new _o(t,r));return n.push([s,o.root]),Df(t,n,r)};class y2 extends tr{constructor(n){super((...r)=>new Il(n)(...r),{bind:n});g(this,"$");this.$=n}in(n){return new Il(this.$,n===void 0?void 0:this.$.parse(n))}at(n,r){return new Il(this.$).at(n,r)}case(n,r){return new Il(this.$).case(n,r)}}class Il extends tr{constructor(n,r){super(o=>this.caseEntries(Object.entries(o).map(([c,h])=>c==="default"?[c,h]:[this.$.parse(c),h])));g(this,"$");g(this,"in");g(this,"key");g(this,"branches",[]);this.$=n,this.in=r}at(n,r){return this.key&&q(b2),this.branches.length&&q(g2),this.key=n,r?this.match(r):this}case(n,r){return this.caseEntry(this.$.parse(n),r)}caseEntry(n,r){const c=(this.key?this.$.parse({[this.key]:n}):n).pipe(r);return this.branches.push(c),this}match(n){return this(n)}strings(n){return this.caseEntries(Object.entries(n).map(([r,o])=>r==="default"?[r,o]:[this.$.node("unit",{unit:r}),o]))}caseEntries(n){for(let r=0;r<n.length;r++){const[o,c]=n[r];if(o==="default")return r!==n.length-1&&q("default may only be specified as the last key of a switch definition"),this.default(c);if(typeof c!="function")return q(`Value for case "${o}" must be a function (was ${hn(c)})`);this.caseEntry(o,c)}return this}default(n){typeof n=="function"&&this.case(ae.unknown,n);const r={branches:this.branches,ordered:!0};(n==="never"||n==="assert")&&(r.meta={onFail:pg});const o=this.$.node("union",r);if(!this.in)return this.$.finalize(o);let c=this.in.pipe(o);return(n==="never"||n==="assert")&&(c=c.configureReferences({onFail:pg},"self")),this.$.finalize(c)}}const pg=t=>t.throw(),g2="A key matcher must be specified before the first case i.e. match.at('foo') or match.in<object>().at('bar')",b2="At most one key matcher may be specified per expression",Iv=(t,s)=>{if(Et(t)){if(t[1]==="=")return[s.$.parseOwnDefinitionFormat(t[0],s),"=",t[2]];if(t[1]==="?")return[s.$.parseOwnDefinitionFormat(t[0],s),"?"]}return e0(t,s)},v2="Only required keys may make their values optional, e.g. { [mySymbol]: ['number', '?'] }",S2="Only required keys may specify default values, e.g. { value: 'number = 0' }",A2=(t,s)=>{var h;let n;const r={},o=ro(t);for(const[p,m]of o){const y=O2(p);if(y.kind==="spread"){if(!va(r))return q(x2);const B=s.$.parseOwnDefinitionFormat(m,s);if(B.equals(ae.object))continue;if(!B.hasKind("intersection")||!((h=B.basis)!=null&&h.equals(ae.object)))return q(E2(B.expression));n=B.structure;continue}if(y.kind==="undeclared"){m!=="reject"&&m!=="delete"&&m!=="ignore"&&q(w2(m)),r.undeclared=m;continue}const v=Iv(m,s),x=y;if(y.kind==="required"){Et(v)?lf(r,"optional",v[1]==="="?{key:y.normalized,value:v[0],default:v[2]}:{key:y.normalized,value:v[0]},s):lf(r,"required",{key:y.normalized,value:v},s);continue}if(Et(v)&&(v[1]==="?"&&q(v2),v[1]==="="&&q(S2)),y.kind==="optional"){lf(r,"optional",{key:y.normalized,value:v},s);continue}const N=s.$.parseOwnDefinitionFormat(x.normalized,s),k=kf(N,v,s.$);k.index&&(r.index=De(r.index,k.index)),k.required&&(r.required=De(r.required,k.required))}const c=s.$.node("structure",r);return s.$.parseSchema({domain:"object",structure:(n==null?void 0:n.merge(c))??c})},lf=(t,s,n,r)=>{t[s]=De(t[s],r.$.node(s,n))},w2=t=>`Value of '+' key must be 'reject', 'delete', or 'ignore' (was ${Me(t)})`,x2="Spread operator may only be used as the first key in an object",O2=t=>typeof t=="symbol"?{kind:"required",normalized:t}:t.at(-1)==="?"?t.at(-2)===vf?{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]===vf&&t[1]==="["&&t.at(-1)==="]"?{kind:"required",normalized:t.slice(1)}:t==="..."?{kind:"spread"}:t==="+"?{kind:"undeclared"}:{kind:"required",normalized:t==="\\..."?"...":t==="\\+"?"+":t},E2=t=>`Spread operand must resolve to an object literal type (was ${t})`,_2=(t,s)=>U2(t)?Fv[t[0]](t,s):C2(t)?Qv[t[1]](t,s):null,T2=(t,s)=>s.$.parseOwnDefinitionFormat(t[1],s).keyof(),of=(t,s)=>{if(t[2]===void 0)return q(Gv(t[1],""));const n=s.$.parseOwnDefinitionFormat(t[0],s),r=s.$.parseOwnDefinitionFormat(t[2],s);if(t[1]==="|")return s.$.node("union",{branches:[n,r]});const o=t[1]==="&"?Gn(n,r,s.$):_f(n,r,s.$);return o instanceof X?o.throw():o},R2=(t,s)=>s.$.parseOwnDefinitionFormat(t[0],s).array(),k2=(t,s)=>typeof t[2]!="function"?q(Xv("=>",t[2])):s.$.parseOwnDefinitionFormat(t[0],s).pipe(t[2]),Xv=(t,s)=>`${t===":"?"Narrow":"Morph"} expression requires a function following '${t}' (was ${typeof s})`,N2=(t,s)=>typeof t[2]!="function"?q(Xv(":",t[2])):s.$.parseOwnDefinitionFormat(t[0],s).constrain("predicate",t[2]),M2=(t,s)=>s.$.parseOwnDefinitionFormat(t[0],s).configureReferences(t[2],"shallow"),Zv=t=>t,$2=Zv({"[]":R2,"?":()=>q(Bv)}),D2=Zv({"|":of,"&":of,":":N2,"=>":k2,"|>":of,"@":M2,"=":()=>q(qv)}),Qv={...$2,...D2},C2=t=>Qv[t[1]]!==void 0,z2=t=>t,Fv=z2({keyof:T2,instanceof:(t,s)=>{if(typeof t[1]!="function")return q(mg(bf(t[1])));const n=t.slice(1).map(r=>typeof r=="function"?s.$.node("proto",{proto:r}):q(mg(bf(r))));return n.length===1?n[0]:s.$.node("union",{branches:n})},"===":(t,s)=>s.$.units(t.slice(1))}),U2=t=>Fv[t[0]]!==void 0,mg=t=>`Expected a constructor following 'instanceof' operator (was ${t})`,B2=(t,s)=>{let n=[{}],r=0;for(;r<t.length;){let o=!1;t[r]==="..."&&r<t.length-1&&(o=!0,r++);const c=Iv(t[r],s),[h,p,m]=Et(c)?c:[c];if(r++,o){if(!h.extends(L.intrinsic.Array))return q(j2(h.expression));n=n.flatMap(y=>h.distribute(v=>K2(Ub(y),v)))}else n=n.map(y=>p==="?"?Wv(y,h):p==="="?q2(y,h,m):Cf(y,h))}return s.$.parseSchema(n.map(o=>va(o)?{proto:Array,exactLength:0}:{proto:Array,sequence:o}))},Cf=(t,s)=>t.defaultables||t.optionals?q(t.variadic?bv:L2):(t.variadic?t.postfix=De(t.postfix,s):t.prefix=De(t.prefix,s),t),Wv=(t,s)=>t.variadic?q(Pv):(t.optionals=De(t.optionals,s),t),q2=(t,s,n)=>t.variadic?q(Pv):t.optionals?q(V2):(t.defaultables=De(t.defaultables,[[s,n]]),t),yg=(t,s)=>(t.postfix&&q(gg),t.variadic?t.variadic.equals(s)||q(gg):t.variadic=s.internal,t),K2=(t,s)=>{const n=s.select({method:"find",kind:"sequence"});if(!n)return yg(t,L.intrinsic.unknown);if(n.prefix)for(const r of n.prefix)Cf(t,r);if(n.optionals)for(const r of n.optionals)Wv(t,r);if(n.variadic&&yg(t,n.variadic),n.postfix)for(const r of n.postfix)Cf(t,r);return t},j2=t=>`Spread element must be an array (was ${t})`,gg="A tuple may have at most one variadic element",L2="A required element may not follow an optional element",Pv="An optional element may not follow a variadic element",V2="A defaultable element may not follow an optional element without a default",uf={},e0=(t,s)=>{var n;if(typeof t=="string"){if(s.args&&Object.keys(s.args).some(o=>t.includes(o)))return hg(t,s);const r=uf[n=s.$.name]??(uf[n]={});return r[t]??(r[t]=hg(t,s))}return Qi(t,"object")?H2(t,s):q(zf(hn(t)))},H2=(t,s)=>{const n=uh(t);switch(n){case void 0:return te(t,"root")?t:A2(t,s);case"Array":return G2(t,s);case"RegExp":return s.$.node("intersection",{domain:"string",pattern:t},{prereduced:!0});case"Function":{const r=vo(t)?t():t;return te(r,"root")?r:q(zf("Function"))}default:return q(zf(n??Me(t)))}},G2=(t,s)=>_2(t,s)??B2(t,s),zf=t=>`Type definitions must be strings or objects (was ${t})`;class Y2 extends tr{constructor(s){const n=Object.assign({errors:wi,hkt:xn,$:s,raw:s.parse,module:s.constructor.module,scope:s.constructor.scope,define:s.define,match:s.match,generic:s.generic,schema:s.schema,keywords:s.ambient,unit:s.unit,enumerated:s.enumerated,instanceOf:s.instanceOf,valueOf:s.valueOf,or:s.or,and:s.and,merge:s.merge,pipe:s.pipe},s.ambientAttachments);super((...r)=>{if(r.length===1)return s.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),c=s.parseGenericParams(o,{});return new fo(c,r[1],s,s,null)}return s.parse(r)},{bind:s,attach:n})}}const da=L,Vs=class Vs extends Ev{constructor(){super(...arguments);g(this,"unit",n=>this.units([n]));g(this,"valueOf",n=>this.units(Kw(n)));g(this,"enumerated",(...n)=>this.units(n));g(this,"instanceOf",n=>this.node("proto",{proto:n},{prereduced:!0}));g(this,"or",(...n)=>this.schema(n.map(r=>this.parse(r))));g(this,"and",(...n)=>n.reduce((r,o)=>r.and(this.parse(o)),this.intrinsic.unknown));g(this,"merge",(...n)=>n.reduce((r,o)=>r.merge(this.parse(o)),this.intrinsic.object));g(this,"pipe",(...n)=>this.intrinsic.unknown.pipe(...n));g(this,"match",new y2(this));g(this,"declare",()=>({type:this.type}));g(this,"type",new Y2(this))}get ambientAttachments(){if(da.typeAttachments)return this.cacheGetter("ambientAttachments",Ce(da.typeAttachments,(n,r)=>[n,this.bindReference(r)]))}preparseOwnAliasEntry(n,r){var p;const o=n.indexOf("<");if(o===-1){if(te(r,"module")||te(r,"generic"))return[n,r];const m=this.name==="ark"?n:n==="root"?this.name:`${this.name}.${n}`,y=(p=this.resolvedConfig.keywords)==null?void 0:p[m];return y&&(r=[r,"@",y]),[n,r]}n.at(-1)!==">"&&q("'>' must be the last character of a generic declaration in a scope");const c=n.slice(0,o),h=n.slice(o+1,-1);return[c,()=>{const m=this.parseGenericParams(h,{alias:c});return Hx(m,r,this)}]}parseGenericParams(n,r){return Df(new ha(n),[],this.createParseContext({...r,def:n,prefix:"generic"}))}normalizeRootScopeValue(n){return vo(n)&&!te(n,"generic")?n():n}preparseOwnDefinitionFormat(n,r){return{...r,def:n,prefix:r.alias??"type"}}parseOwnDefinitionFormat(n,r){!(r.alias&&r.alias in this.aliases)&&!r.args&&(r.args={this:r.id});const c=e0(n,r);if(Et(c)){if(c[1]==="=")return q(qv);if(c[1]==="?")return q(Bv)}return c}define(n){return n}};g(Vs,"scope",(n,r={})=>new Vs(n,r)),g(Vs,"module",(n,r={})=>Vs.scope(n,r).export());let mo=Vs;const J2=Object.assign(mo.scope,{define:t=>t}),xe=mo;class I2 extends xn{constructor(){super(...arguments);g(this,"description",'merge an object\'s properties onto another like `Merge(User, { isAdmin: "true" })`')}}const X2=Jn(["base",ae.object],["props",ae.object])(t=>t.base.merge(t.props),I2),Z2=xe.module({Key:ae.key,Merge:X2});class Q2 extends xn{}const F2=Jn("element")(t=>{const s=t.element.exclude(ae.Array),n=s.array();return s.rawOr(n).pipe(ba).distribute(r=>r.assertHasKind("morph").declareOut(n),qe)},Q2),W2=xe.module({root:ae.Array,readonly:"root",index:ae.nonNegativeIntegerString,liftFrom:F2},{name:"Array"}),Uf=qe(["string",Sa.FileConstructor]),P2=Uf.rawOr(Uf.array()),bg=qe({meta:"an object representing parsed form data",domain:"object",index:{signature:"string",value:P2}}),e_=xe.module({root:["instanceof",FormData],value:Uf,parsed:bg,parse:qe({in:FormData,morphs:t=>{const s={};for(const[n,r]of t)if(n in s){const o=s[n];typeof o=="string"||o instanceof Sa.FileConstructor?s[n]=[o,r]:o.push(r)}else s[n]=r;return s},declaredOut:bg})},{name:"FormData"}),t_=xe.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"}),n_={Boolean:1,Number:1,String:1},i_=xe.module({...Ce({...Ab,...xb},(t,s)=>t in n_?[]:[t,["instanceof",s]]),Array:W2,TypedArray:t_,FormData:e_}),s_=qe({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"}),r_=qe({domain:"number",divisor:1}),t0=xe.module({root:ae.number,integer:r_,epoch:s_,safe:qe({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"}),Ke=(t,s,n)=>{const r={domain:"string",pattern:{rule:t.source,flags:t.flags,meta:s}};return n&&(r.meta={format:n}),xh("intersection",r)},vg=Ke(ao,"a well-formed integer string"),n0=xe.module({root:vg,parse:qe({in:vg,morphs:(t,s)=>{const n=Number.parseInt(t);return Number.isSafeInteger(n)?n:s.error("an integer in the range Number.MIN_SAFE_INTEGER to Number.MAX_SAFE_INTEGER")},declaredOut:ae.integer})},{name:"string.integer"}),a_=Ke(/^[\dA-Fa-f]+$/,"hex characters only"),l_=xe.module({root:Ke(/^(?:[\d+/A-Za-z]{4})*(?:[\d+/A-Za-z]{2}==|[\d+/A-Za-z]{3}=)?$/,"base64-encoded"),url:Ke(/^(?:[\w-]{4})*(?:[\w-]{2}(?:==|%3D%3D)?|[\w-]{3}(?:=|%3D)?)?$/,"base64url-encoded")},{name:"string.base64"}),Sg=Ke(/^[A-Z].*$/,"capitalized"),o_=xe.module({root:qe({in:"string",morphs:t=>t.charAt(0).toUpperCase()+t.slice(1),declaredOut:Sg}),preformatted:Sg},{name:"string.capitalize"}),u_=t=>{const s=t.replaceAll(/[ -]+/g,"");let n=0,r,o,c=!1;for(let h=s.length-1;h>=0;h--)r=s.substring(h,h+1),o=Number.parseInt(r,10),c?(o*=2,n+=o>=10?o%10+1:o):n+=o,c=!c;return!!(n%10===0&&s)},c_=/^(?: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}))$/,f_=qe({domain:"string",pattern:{meta:"a credit card number",rule:c_.source},predicate:{meta:"a credit card number",predicate:u_}}),h_=/^([+-]?\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)?)?)?)?$/,d_=t=>!Number.isNaN(new Date(t).valueOf()),Ag=qe({domain:"string",predicate:{meta:"a parsable date",predicate:d_}}).assertHasKind("intersection"),wg=n0.root.internal.narrow((t,s)=>{const n=Number.parseInt(t),r=t0.epoch(n);return r instanceof wi?(s.errors.merge(r),!1):!0}).configure({description:"an integer string representing a safe Unix timestamp"},"self").assertHasKind("intersection"),p_=xe.module({root:wg,parse:qe({in:wg,morphs:t=>new Date(t),declaredOut:ae.Date})},{name:"string.date.epoch"}),xg=Ke(h_,"an ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) date").internal.assertHasKind("intersection"),m_=xe.module({root:xg,parse:qe({in:xg,morphs:t=>new Date(t),declaredOut:ae.Date})},{name:"string.date.iso"}),y_=xe.module({root:Ag,parse:qe({declaredIn:Ag,in:"string",morphs:(t,s)=>{const n=new Date(t);return Number.isNaN(n.valueOf())?s.error("a parsable date"):n},declaredOut:ae.Date}),iso:m_,epoch:p_},{name:"string.date"}),g_=Ke(/^[\w%+.-]+@[\d.A-Za-z-]+\.[A-Za-z]{2,}$/,"an email address","email"),Og="(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])",bi=`(${Og}[.]){3}${Og}`,b_=new RegExp(`^${bi}$`),We="(?:[0-9a-fA-F]{1,4})",v_=new RegExp(`^((?:${We}:){7}(?:${We}|:)|(?:${We}:){6}(?:${bi}|:${We}|:)|(?:${We}:){5}(?::${bi}|(:${We}){1,2}|:)|(?:${We}:){4}(?:(:${We}){0,1}:${bi}|(:${We}){1,3}|:)|(?:${We}:){3}(?:(:${We}){0,2}:${bi}|(:${We}){1,4}|:)|(?:${We}:){2}(?:(:${We}){0,3}:${bi}|(:${We}){1,5}|:)|(?:${We}:){1}(?:(:${We}){0,4}:${bi}|(:${We}){1,6}|:)|(?::((?::${We}){0,5}:${bi}|(?::${We}){1,7}|:)))(%[0-9a-zA-Z.]{1,})?$`),S_=xe.module({root:["v4 | v6","@","an IP address"],v4:Ke(b_,"an IPv4 address","ipv4"),v6:Ke(v_,"an IPv6 address","ipv6")},{name:"string.ip"}),Gs="a JSON string",i0=t=>{if(!(t instanceof SyntaxError))throw t;return`must be ${Gs} (${t})`},A_=qe({meta:Gs,domain:"string",predicate:{meta:Gs,predicate:(t,s)=>{try{return JSON.parse(t),!0}catch(n){return s.reject({code:"predicate",expected:Gs,problem:i0(n)})}}}}),w_=(t,s)=>{if(t.length===0)return s.error({code:"predicate",expected:Gs,actual:"empty"});try{return JSON.parse(t)}catch(n){return s.error({code:"predicate",expected:Gs,problem:i0(n)})}},x_=xe.module({root:A_,parse:qe({meta:"safe JSON string parser",in:"string",morphs:w_,declaredOut:ae.jsonObject})},{name:"string.json"}),Eg=Ke(/^[a-z]*$/,"only lowercase letters"),O_=xe.module({root:qe({in:"string",morphs:t=>t.toLowerCase(),declaredOut:Eg}),preformatted:Eg},{name:"string.lower"}),s0=["NFC","NFD","NFKC","NFKD"],Ta=Ce(s0,(t,s)=>[s,qe({domain:"string",predicate:n=>n.normalize(s)===n,meta:`${s}-normalized unicode`})]),To=Ce(s0,(t,s)=>[s,qe({in:"string",morphs:n=>n.normalize(s),declaredOut:Ta[s]})]),E_=xe.module({root:To.NFC,preformatted:Ta.NFC},{name:"string.normalize.NFC"}),__=xe.module({root:To.NFD,preformatted:Ta.NFD},{name:"string.normalize.NFD"}),T_=xe.module({root:To.NFKC,preformatted:Ta.NFKC},{name:"string.normalize.NFKC"}),R_=xe.module({root:To.NFKD,preformatted:Ta.NFKD},{name:"string.normalize.NFKD"}),k_=xe.module({root:"NFC",NFC:E_,NFD:__,NFKC:T_,NFKD:R_},{name:"string.normalize"}),_g=Ke(Sf,"a well-formed numeric string"),N_=xe.module({root:_g,parse:qe({in:_g,morphs:t=>Number.parseFloat(t),declaredOut:ae.number})},{name:"string.numeric"}),Tg="a regex pattern",M_=qe({domain:"string",predicate:{meta:Tg,predicate:(t,s)=>{try{return new RegExp(t),!0}catch(n){return s.reject({code:"predicate",expected:Tg,problem:String(n)})}}},meta:{format:"regex"}}),$_=/^(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-]+)*))?$/,D_=Ke($_,"a semantic version (see https://semver.org/)"),Rg=Ke(/^\S.*\S$|^\S?$/,"trimmed"),C_=xe.module({root:qe({in:"string",morphs:t=>t.trim(),declaredOut:Rg}),preformatted:Rg},{name:"string.trim"}),kg=Ke(/^[A-Z]*$/,"only uppercase letters"),z_=xe.module({root:qe({in:"string",morphs:t=>t.toUpperCase(),declaredOut:kg}),preformatted:kg},{name:"string.upper"}),U_=t=>{if(URL.canParse)return URL.canParse(t);try{return new URL(t),!0}catch{return!1}},Ng=qe({domain:"string",predicate:{meta:"a URL string",predicate:U_},meta:{format:"uri"}}),B_=xe.module({root:Ng,parse:qe({declaredIn:Ng,in:"string",morphs:(t,s)=>{try{return new URL(t)}catch{return s.error("a URL string")}},declaredOut:qe(URL)})},{name:"string.url"}),q_=xe.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:Ke(/^[\da-f]{8}-[\da-f]{4}-1[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv1"),v2:Ke(/^[\da-f]{8}-[\da-f]{4}-2[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv2"),v3:Ke(/^[\da-f]{8}-[\da-f]{4}-3[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv3"),v4:Ke(/^[\da-f]{8}-[\da-f]{4}-4[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv4"),v5:Ke(/^[\da-f]{8}-[\da-f]{4}-5[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv5"),v6:Ke(/^[\da-f]{8}-[\da-f]{4}-6[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv6"),v7:Ke(/^[\da-f]{8}-[\da-f]{4}-7[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv7"),v8:Ke(/^[\da-f]{8}-[\da-f]{4}-8[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv8")},{name:"string.uuid"}),K_=xe.module({root:ae.string,alpha:Ke(/^[A-Za-z]*$/,"only letters"),alphanumeric:Ke(/^[\dA-Za-z]*$/,"only letters and digits 0-9"),hex:a_,base64:l_,capitalize:o_,creditCard:f_,date:y_,digits:Ke(/^\d*$/,"only digits 0-9"),email:g_,integer:n0,ip:S_,json:x_,lower:O_,normalize:k_,numeric:N_,regex:M_,semver:D_,trim:C_,upper:z_,url:B_,uuid:q_},{name:"string"}),j_=xe.module({bigint:ae.bigint,boolean:ae.boolean,false:ae.false,never:ae.never,null:ae.null,number:ae.number,object:ae.object,string:ae.string,symbol:ae.symbol,true:ae.true,unknown:ae.unknown,undefined:ae.undefined}),L_=xe.module({root:ae.unknown,any:ae.unknown},{name:"unknown"}),V_=xe.module({root:ae.jsonObject,stringify:xh("morph",{in:ae.jsonObject,morphs:t=>JSON.stringify(t),declaredOut:ae.string})},{name:"object.json"}),H_=xe.module({root:ae.object,json:V_},{name:"object"});class G_ extends xn{constructor(){super(...arguments);g(this,"description",'instantiate an object from an index signature and corresponding value type like `Record("string", "number")`')}}const Y_=Jn(["K",ae.key],"V")(t=>({domain:"object",index:{signature:t.K,value:t.V}}),G_);class J_ extends xn{constructor(){super(...arguments);g(this,"description",'pick a set of properties from an object like `Pick(User, "name | age")`')}}const I_=Jn(["T",ae.object],["K",ae.key])(t=>t.T.pick(t.K),J_);class X_ extends xn{constructor(){super(...arguments);g(this,"description",'omit a set of properties from an object like `Omit(User, "age")`')}}const Z_=Jn(["T",ae.object],["K",ae.key])(t=>t.T.omit(t.K),X_);class Q_ extends xn{constructor(){super(...arguments);g(this,"description","make all named properties of an object optional like `Partial(User)`")}}const F_=Jn(["T",ae.object])(t=>t.T.partial(),Q_);class W_ extends xn{constructor(){super(...arguments);g(this,"description","make all named properties of an object required like `Required(User)`")}}const P_=Jn(["T",ae.object])(t=>t.T.required(),W_);class eT extends xn{constructor(){super(...arguments);g(this,"description",'exclude branches of a union like `Exclude("boolean", "true")`')}}const tT=Jn("T","U")(t=>t.T.exclude(t.U),eT);class nT extends xn{constructor(){super(...arguments);g(this,"description",'extract branches of a union like `Extract("0 | false | 1", "number")`')}}const iT=Jn("T","U")(t=>t.T.extract(t.U),nT),sT=xe.module({Exclude:tT,Extract:iT,Omit:Z_,Partial:F_,Pick:I_,Record:Y_,Required:P_}),Fi=J2({...j_,...sT,...i_,...Z2,string:K_,number:t0,object:H_,unknown:L_},{prereducedAliases:!0,name:"ark"}),ft=Fi.export();Object.assign(da.ambient,ft);da.typeAttachments={string:ft.string.root,number:ft.number.root,bigint:ft.bigint,boolean:ft.boolean,symbol:ft.symbol,undefined:ft.undefined,null:ft.null,object:ft.object.root,unknown:ft.unknown.root,false:ft.false,true:ft.true,never:ft.never,arrayIndex:ft.Array.index,Key:ft.Key,Record:ft.Record,Array:ft.Array.root,Date:ft.Date};const pt=Object.assign(Fi.type,da.typeAttachments);Fi.match;Fi.generic;Fi.schema;Fi.define;Fi.declare;const r0={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 rT(t){return Number.parseInt(t,10)}const aT=pt(r0),lT=aT.keyof().pipe(t=>rT(t));pt([lT,"string"]);function oT(){return j.jsxs("svg",{id:"uuid-3d2d6be6-f179-42a3-9511-1e9ddeb8575f",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 500 101",children:[j.jsx("title",{children:"Tempest Games Logo"}),j.jsx("path",{d:"M155.76.93v59.89h-17.11V7.78h-13.69V.93h30.8Z",style:{fill:"var(--logo-color)",strokeWidth:0}}),j.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}}),j.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}}),j.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}}),j.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}}),j.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}}),j.jsx("path",{d:"M500,7.78h-13.69v53.04h-17.11V.93h30.8v6.84Z",style:{fill:"var(--logo-color)",strokeWidth:0}}),j.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}}),j.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}}),j.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}}),j.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}}),j.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}}),j.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 Ro(t){return j.jsx("a",{...t})}const uT={class:"_class_wtkls_1"};function cT(t){return["required",t]}function fT(t){return["optional",t]}function hT(t,s){let n=[t];for(const r of s){if(typeof r!="string")return!1;n=n.flatMap(o=>{if(o===null)return[];const c=[],h=o[1],p=h[r];p!==void 0&&c.push(p);const m=Object.keys(h).find(y=>y.startsWith("$"));if(m){const y=h[m];y&&c.push(y)}return c})}for(const r of n)if(r===null||r[0]==="optional")return!0;return!1}const An=Object.create(null);An.open="0";An.close="1";An.ping="2";An.pong="3";An.message="4";An.upgrade="5";An.noop="6";const Pl=Object.create(null);Object.keys(An).forEach(t=>{Pl[An[t]]=t});const Bf={type:"error",data:"parser error"},a0=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",l0=typeof ArrayBuffer=="function",o0=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t&&t.buffer instanceof ArrayBuffer,_h=({type:t,data:s},n,r)=>a0&&s instanceof Blob?n?r(s):Mg(s,r):l0&&(s instanceof ArrayBuffer||o0(s))?n?r(s):Mg(new Blob([s]),r):r(An[t]+(s||"")),Mg=(t,s)=>{const n=new FileReader;return n.onload=function(){const r=n.result.split(",")[1];s("b"+(r||""))},n.readAsDataURL(t)};function $g(t){return t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}let cf;function dT(t,s){if(a0&&t.data instanceof Blob)return t.data.arrayBuffer().then($g).then(s);if(l0&&(t.data instanceof ArrayBuffer||o0(t.data)))return s($g(t.data));_h(t,!1,n=>{cf||(cf=new TextEncoder),s(cf.encode(n))})}const Dg="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",la=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let t=0;t<Dg.length;t++)la[Dg.charCodeAt(t)]=t;const pT=t=>{let s=t.length*.75,n=t.length,r,o=0,c,h,p,m;t[t.length-1]==="="&&(s--,t[t.length-2]==="="&&s--);const y=new ArrayBuffer(s),v=new Uint8Array(y);for(r=0;r<n;r+=4)c=la[t.charCodeAt(r)],h=la[t.charCodeAt(r+1)],p=la[t.charCodeAt(r+2)],m=la[t.charCodeAt(r+3)],v[o++]=c<<2|h>>4,v[o++]=(h&15)<<4|p>>2,v[o++]=(p&3)<<6|m&63;return y},mT=typeof ArrayBuffer=="function",Th=(t,s)=>{if(typeof t!="string")return{type:"message",data:u0(t,s)};const n=t.charAt(0);return n==="b"?{type:"message",data:yT(t.substring(1),s)}:Pl[n]?t.length>1?{type:Pl[n],data:t.substring(1)}:{type:Pl[n]}:Bf},yT=(t,s)=>{if(mT){const n=pT(t);return u0(n,s)}else return{base64:!0,data:t}},u0=(t,s)=>{switch(s){case"blob":return t instanceof Blob?t:new Blob([t]);case"arraybuffer":default:return t instanceof ArrayBuffer?t:t.buffer}},c0="",gT=(t,s)=>{const n=t.length,r=new Array(n);let o=0;t.forEach((c,h)=>{_h(c,!1,p=>{r[h]=p,++o===n&&s(r.join(c0))})})},bT=(t,s)=>{const n=t.split(c0),r=[];for(let o=0;o<n.length;o++){const c=Th(n[o],s);if(r.push(c),c.type==="error")break}return r};function vT(){return new TransformStream({transform(t,s){dT(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 c=new DataView(o.buffer);c.setUint8(0,126),c.setUint16(1,r)}else{o=new Uint8Array(9);const c=new DataView(o.buffer);c.setUint8(0,127),c.setBigUint64(1,BigInt(r))}t.data&&typeof t.data!="string"&&(o[0]|=128),s.enqueue(o),s.enqueue(n)})}})}let ff;function Xl(t){return t.reduce((s,n)=>s+n.length,0)}function Zl(t,s){if(t[0].length===s)return t.shift();const n=new Uint8Array(s);let r=0;for(let o=0;o<s;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 ST(t,s){ff||(ff=new TextDecoder);const n=[];let r=0,o=-1,c=!1;return new TransformStream({transform(h,p){for(n.push(h);;){if(r===0){if(Xl(n)<1)break;const m=Zl(n,1);c=(m[0]&128)===128,o=m[0]&127,o<126?r=3:o===126?r=1:r=2}else if(r===1){if(Xl(n)<2)break;const m=Zl(n,2);o=new DataView(m.buffer,m.byteOffset,m.length).getUint16(0),r=3}else if(r===2){if(Xl(n)<8)break;const m=Zl(n,8),y=new DataView(m.buffer,m.byteOffset,m.length),v=y.getUint32(0);if(v>Math.pow(2,21)-1){p.enqueue(Bf);break}o=v*Math.pow(2,32)+y.getUint32(4),r=3}else{if(Xl(n)<o)break;const m=Zl(n,o);p.enqueue(Th(c?m:ff.decode(m),s)),r=0}if(o===0||o>t){p.enqueue(Bf);break}}}})}const f0=4;function tt(t){if(t)return AT(t)}function AT(t){for(var s in tt.prototype)t[s]=tt.prototype[s];return t}tt.prototype.on=tt.prototype.addEventListener=function(t,s){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(s),this};tt.prototype.once=function(t,s){function n(){this.off(t,n),s.apply(this,arguments)}return n.fn=s,this.on(t,n),this};tt.prototype.off=tt.prototype.removeListener=tt.prototype.removeAllListeners=tt.prototype.removeEventListener=function(t,s){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===s||r.fn===s){n.splice(o,1);break}return n.length===0&&delete this._callbacks["$"+t],this};tt.prototype.emit=function(t){this._callbacks=this._callbacks||{};for(var s=new Array(arguments.length-1),n=this._callbacks["$"+t],r=1;r<arguments.length;r++)s[r-1]=arguments[r];if(n){n=n.slice(0);for(var r=0,o=n.length;r<o;++r)n[r].apply(this,s)}return this};tt.prototype.emitReserved=tt.prototype.emit;tt.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]};tt.prototype.hasListeners=function(t){return!!this.listeners(t).length};const ko=typeof Promise=="function"&&typeof Promise.resolve=="function"?s=>Promise.resolve().then(s):(s,n)=>n(s,0),an=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),wT="arraybuffer";function h0(t,...s){return s.reduce((n,r)=>(t.hasOwnProperty(r)&&(n[r]=t[r]),n),{})}const xT=an.setTimeout,OT=an.clearTimeout;function No(t,s){s.useNativeTimers?(t.setTimeoutFn=xT.bind(an),t.clearTimeoutFn=OT.bind(an)):(t.setTimeoutFn=an.setTimeout.bind(an),t.clearTimeoutFn=an.clearTimeout.bind(an))}const ET=1.33;function _T(t){return typeof t=="string"?TT(t):Math.ceil((t.byteLength||t.size)*ET)}function TT(t){let s=0,n=0;for(let r=0,o=t.length;r<o;r++)s=t.charCodeAt(r),s<128?n+=1:s<2048?n+=2:s<55296||s>=57344?n+=3:(r++,n+=4);return n}function d0(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function RT(t){let s="";for(let n in t)t.hasOwnProperty(n)&&(s.length&&(s+="&"),s+=encodeURIComponent(n)+"="+encodeURIComponent(t[n]));return s}function kT(t){let s={},n=t.split("&");for(let r=0,o=n.length;r<o;r++){let c=n[r].split("=");s[decodeURIComponent(c[0])]=decodeURIComponent(c[1])}return s}class NT extends Error{constructor(s,n,r){super(s),this.description=n,this.context=r,this.type="TransportError"}}class Rh extends tt{constructor(s){super(),this.writable=!1,No(this,s),this.opts=s,this.query=s.query,this.socket=s.socket,this.supportsBinary=!s.forceBase64}onError(s,n,r){return super.emitReserved("error",new NT(s,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(s){this.readyState==="open"&&this.write(s)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(s){const n=Th(s,this.socket.binaryType);this.onPacket(n)}onPacket(s){super.emitReserved("packet",s)}onClose(s){this.readyState="closed",super.emitReserved("close",s)}pause(s){}createUri(s,n={}){return s+"://"+this._hostname()+this._port()+this.opts.path+this._query(n)}_hostname(){const s=this.opts.hostname;return s.indexOf(":")===-1?s:"["+s+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(s){const n=RT(s);return n.length?"?"+n:""}}class MT extends Rh{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(s){this.readyState="pausing";const n=()=>{this.readyState="paused",s()};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(s){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)};bT(s,this.socket.binaryType).forEach(n),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const s=()=>{this.write([{type:"close"}])};this.readyState==="open"?s():this.once("open",s)}write(s){this.writable=!1,gT(s,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const s=this.opts.secure?"https":"http",n=this.query||{};return this.opts.timestampRequests!==!1&&(n[this.opts.timestampParam]=d0()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(s,n)}}let p0=!1;try{p0=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const $T=p0;function DT(){}class CT extends MT{constructor(s){if(super(s),typeof location<"u"){const n=location.protocol==="https:";let r=location.port;r||(r=n?"443":"80"),this.xd=typeof location<"u"&&s.hostname!==location.hostname||r!==s.port}}doWrite(s,n){const r=this.request({method:"POST",data:s});r.on("success",n),r.on("error",(o,c)=>{this.onError("xhr post error",o,c)})}doPoll(){const s=this.request();s.on("data",this.onData.bind(this)),s.on("error",(n,r)=>{this.onError("xhr poll error",n,r)}),this.pollXhr=s}}let Ys=class eo extends tt{constructor(s,n,r){super(),this.createRequest=s,No(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 s;const n=h0(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{}(s=this._opts.cookieJar)===null||s===void 0||s.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=eo.requestsCount++,eo.requests[this._index]=this)}_onError(s){this.emitReserved("error",s,this._xhr),this._cleanup(!0)}_cleanup(s){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=DT,s)try{this._xhr.abort()}catch{}typeof document<"u"&&delete eo.requests[this._index],this._xhr=null}}_onLoad(){const s=this._xhr.responseText;s!==null&&(this.emitReserved("data",s),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}};Ys.requestsCount=0;Ys.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",Cg);else if(typeof addEventListener=="function"){const t="onpagehide"in an?"pagehide":"unload";addEventListener(t,Cg,!1)}}function Cg(){for(let t in Ys.requests)Ys.requests.hasOwnProperty(t)&&Ys.requests[t].abort()}const zT=function(){const t=m0({xdomain:!1});return t&&t.responseType!==null}();class UT extends CT{constructor(s){super(s);const n=s&&s.forceBase64;this.supportsBinary=zT&&!n}request(s={}){return Object.assign(s,{xd:this.xd},this.opts),new Ys(m0,this.uri(),s)}}function m0(t){const s=t.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!s||$T))return new XMLHttpRequest}catch{}if(!s)try{return new an[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const y0=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class BT extends Rh{get name(){return"websocket"}doOpen(){const s=this.uri(),n=this.opts.protocols,r=y0?{}:h0(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(s,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=s=>this.onClose({description:"websocket connection closed",context:s}),this.ws.onmessage=s=>this.onData(s.data),this.ws.onerror=s=>this.onError("websocket error",s)}write(s){this.writable=!1;for(let n=0;n<s.length;n++){const r=s[n],o=n===s.length-1;_h(r,this.supportsBinary,c=>{try{this.doWrite(r,c)}catch{}o&&ko(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const s=this.opts.secure?"wss":"ws",n=this.query||{};return this.opts.timestampRequests&&(n[this.opts.timestampParam]=d0()),this.supportsBinary||(n.b64=1),this.createUri(s,n)}}const hf=an.WebSocket||an.MozWebSocket;class qT extends BT{createSocket(s,n,r){return y0?new hf(s,n,r):n?new hf(s,n):new hf(s)}doWrite(s,n){this.ws.send(n)}}class KT extends Rh{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(s){return this.emitReserved("error",s)}this._transport.closed.then(()=>{this.onClose()}).catch(s=>{this.onError("webtransport error",s)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(s=>{const n=ST(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=s.readable.pipeThrough(n).getReader(),o=vT();o.readable.pipeTo(s.writable),this._writer=o.writable.getWriter();const c=()=>{r.read().then(({done:p,value:m})=>{p||(this.onPacket(m),c())}).catch(p=>{})};c();const h={type:"open"};this.query.sid&&(h.data=`{"sid":"${this.query.sid}"}`),this._writer.write(h).then(()=>this.onOpen())})})}write(s){this.writable=!1;for(let n=0;n<s.length;n++){const r=s[n],o=n===s.length-1;this._writer.write(r).then(()=>{o&&ko(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var s;(s=this._transport)===null||s===void 0||s.close()}}const jT={websocket:qT,webtransport:KT,polling:UT},LT=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,VT=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function qf(t){if(t.length>8e3)throw"URI too long";const s=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=LT.exec(t||""),c={},h=14;for(;h--;)c[VT[h]]=o[h]||"";return n!=-1&&r!=-1&&(c.source=s,c.host=c.host.substring(1,c.host.length-1).replace(/;/g,":"),c.authority=c.authority.replace("[","").replace("]","").replace(/;/g,":"),c.ipv6uri=!0),c.pathNames=HT(c,c.path),c.queryKey=GT(c,c.query),c}function HT(t,s){const n=/\/{2,9}/g,r=s.replace(n,"/").split("/");return(s.slice(0,1)=="/"||s.length===0)&&r.splice(0,1),s.slice(-1)=="/"&&r.splice(r.length-1,1),r}function GT(t,s){const n={};return s.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,o,c){o&&(n[o]=c)}),n}const Kf=typeof addEventListener=="function"&&typeof removeEventListener=="function",to=[];Kf&&addEventListener("offline",()=>{to.forEach(t=>t())},!1);class Ai extends tt{constructor(s,n){if(super(),this.binaryType=wT,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,s&&typeof s=="object"&&(n=s,s=null),s){const r=qf(s);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=qf(n.host).host);No(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=kT(this.opts.query)),Kf&&(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"})},to.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(s){const n=Object.assign({},this.opts.query);n.EIO=f0,n.transport=s,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[s]);return new this._transportsByName[s](r)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const s=this.opts.rememberUpgrade&&Ai.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const n=this.createTransport(s);n.open(),this.setTransport(n)}setTransport(s){this.transport&&this.transport.removeAllListeners(),this.transport=s,s.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",Ai.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(s){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",s),this.emitReserved("heartbeat"),s.type){case"open":this.onHandshake(JSON.parse(s.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=s.data,this._onError(n);break;case"message":this.emitReserved("data",s.data),this.emitReserved("message",s.data);break}}onHandshake(s){this.emitReserved("handshake",s),this.id=s.sid,this.transport.query.sid=s.sid,this._pingInterval=s.pingInterval,this._pingTimeout=s.pingTimeout,this._maxPayload=s.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const s=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+s,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},s),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 s=this._getWritablePackets();this.transport.send(s),this._prevBufferLen=s.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+=_T(o)),r>0&&n>this._maxPayload)return this.writeBuffer.slice(0,r);n+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const s=Date.now()>this._pingTimeoutTime;return s&&(this._pingTimeoutTime=0,ko(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),s}write(s,n,r){return this._sendPacket("message",s,n,r),this}send(s,n,r){return this._sendPacket("message",s,n,r),this}_sendPacket(s,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 c={type:s,data:n,options:r};this.emitReserved("packetCreate",c),this.writeBuffer.push(c),o&&this.once("flush",o),this.flush()}close(){const s=()=>{this._onClose("forced close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),s()},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():s()}):this.upgrading?r():s()),this}_onError(s){if(Ai.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",s),this._onClose("transport error",s)}_onClose(s,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(),Kf&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const r=to.indexOf(this._offlineEventListener);r!==-1&&to.splice(r,1)}this.readyState="closed",this.id=null,this.emitReserved("close",s,n),this.writeBuffer=[],this._prevBufferLen=0}}}Ai.protocol=f0;class YT extends Ai{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let s=0;s<this._upgrades.length;s++)this._probe(this._upgrades[s])}_probe(s){let n=this.createTransport(s),r=!1;Ai.priorWebsocketSuccess=!1;const o=()=>{r||(n.send([{type:"ping",data:"probe"}]),n.once("packet",x=>{if(!r)if(x.type==="pong"&&x.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;Ai.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{r||this.readyState!=="closed"&&(v(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{const N=new Error("probe error");N.transport=n.name,this.emitReserved("upgradeError",N)}}))};function c(){r||(r=!0,v(),n.close(),n=null)}const h=x=>{const N=new Error("probe error: "+x);N.transport=n.name,c(),this.emitReserved("upgradeError",N)};function p(){h("transport closed")}function m(){h("socket closed")}function y(x){n&&x.name!==n.name&&c()}const v=()=>{n.removeListener("open",o),n.removeListener("error",h),n.removeListener("close",p),this.off("close",m),this.off("upgrading",y)};n.once("open",o),n.once("error",h),n.once("close",p),this.once("close",m),this.once("upgrading",y),this._upgrades.indexOf("webtransport")!==-1&&s!=="webtransport"?this.setTimeoutFn(()=>{r||n.open()},200):n.open()}onHandshake(s){this._upgrades=this._filterUpgrades(s.upgrades),super.onHandshake(s)}_filterUpgrades(s){const n=[];for(let r=0;r<s.length;r++)~this.transports.indexOf(s[r])&&n.push(s[r]);return n}}let JT=class extends YT{constructor(s,n={}){const r=typeof s=="object"?s:n;(!r.transports||r.transports&&typeof r.transports[0]=="string")&&(r.transports=(r.transports||["polling","websocket","webtransport"]).map(o=>jT[o]).filter(o=>!!o)),super(s,r)}};function IT(t,s="",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=qf(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 c=r.host.indexOf(":")!==-1?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+c+":"+r.port+s,r.href=r.protocol+"://"+c+(n&&n.port===r.port?"":":"+r.port),r}const XT=typeof ArrayBuffer=="function",ZT=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t.buffer instanceof ArrayBuffer,g0=Object.prototype.toString,QT=typeof Blob=="function"||typeof Blob<"u"&&g0.call(Blob)==="[object BlobConstructor]",FT=typeof File=="function"||typeof File<"u"&&g0.call(File)==="[object FileConstructor]";function kh(t){return XT&&(t instanceof ArrayBuffer||ZT(t))||QT&&t instanceof Blob||FT&&t instanceof File}function no(t,s){if(!t||typeof t!="object")return!1;if(Array.isArray(t)){for(let n=0,r=t.length;n<r;n++)if(no(t[n]))return!0;return!1}if(kh(t))return!0;if(t.toJSON&&typeof t.toJSON=="function"&&arguments.length===1)return no(t.toJSON(),!0);for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&no(t[n]))return!0;return!1}function WT(t){const s=[],n=t.data,r=t;return r.data=jf(n,s),r.attachments=s.length,{packet:r,buffers:s}}function jf(t,s){if(!t)return t;if(kh(t)){const n={_placeholder:!0,num:s.length};return s.push(t),n}else if(Array.isArray(t)){const n=new Array(t.length);for(let r=0;r<t.length;r++)n[r]=jf(t[r],s);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]=jf(t[r],s));return n}return t}function PT(t,s){return t.data=Lf(t.data,s),delete t.attachments,t}function Lf(t,s){if(!t)return t;if(t&&t._placeholder===!0){if(typeof t.num=="number"&&t.num>=0&&t.num<s.length)return s[t.num];throw new Error("illegal attachments")}else if(Array.isArray(t))for(let n=0;n<t.length;n++)t[n]=Lf(t[n],s);else if(typeof t=="object")for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(t[n]=Lf(t[n],s));return t}const eR=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],tR=5;var ge;(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"})(ge||(ge={}));class nR{constructor(s){this.replacer=s}encode(s){return(s.type===ge.EVENT||s.type===ge.ACK)&&no(s)?this.encodeAsBinary({type:s.type===ge.EVENT?ge.BINARY_EVENT:ge.BINARY_ACK,nsp:s.nsp,data:s.data,id:s.id}):[this.encodeAsString(s)]}encodeAsString(s){let n=""+s.type;return(s.type===ge.BINARY_EVENT||s.type===ge.BINARY_ACK)&&(n+=s.attachments+"-"),s.nsp&&s.nsp!=="/"&&(n+=s.nsp+","),s.id!=null&&(n+=s.id),s.data!=null&&(n+=JSON.stringify(s.data,this.replacer)),n}encodeAsBinary(s){const n=WT(s),r=this.encodeAsString(n.packet),o=n.buffers;return o.unshift(r),o}}function zg(t){return Object.prototype.toString.call(t)==="[object Object]"}class Nh extends tt{constructor(s){super(),this.reviver=s}add(s){let n;if(typeof s=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");n=this.decodeString(s);const r=n.type===ge.BINARY_EVENT;r||n.type===ge.BINARY_ACK?(n.type=r?ge.EVENT:ge.ACK,this.reconstructor=new iR(n),n.attachments===0&&super.emitReserved("decoded",n)):super.emitReserved("decoded",n)}else if(kh(s)||s.base64)if(this.reconstructor)n=this.reconstructor.takeBinaryData(s),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: "+s)}decodeString(s){let n=0;const r={type:Number(s.charAt(0))};if(ge[r.type]===void 0)throw new Error("unknown packet type "+r.type);if(r.type===ge.BINARY_EVENT||r.type===ge.BINARY_ACK){const c=n+1;for(;s.charAt(++n)!=="-"&&n!=s.length;);const h=s.substring(c,n);if(h!=Number(h)||s.charAt(n)!=="-")throw new Error("Illegal attachments");r.attachments=Number(h)}if(s.charAt(n+1)==="/"){const c=n+1;for(;++n&&!(s.charAt(n)===","||n===s.length););r.nsp=s.substring(c,n)}else r.nsp="/";const o=s.charAt(n+1);if(o!==""&&Number(o)==o){const c=n+1;for(;++n;){const h=s.charAt(n);if(h==null||Number(h)!=h){--n;break}if(n===s.length)break}r.id=Number(s.substring(c,n+1))}if(s.charAt(++n)){const c=this.tryParse(s.substr(n));if(Nh.isPayloadValid(r.type,c))r.data=c;else throw new Error("invalid payload")}return r}tryParse(s){try{return JSON.parse(s,this.reviver)}catch{return!1}}static isPayloadValid(s,n){switch(s){case ge.CONNECT:return zg(n);case ge.DISCONNECT:return n===void 0;case ge.CONNECT_ERROR:return typeof n=="string"||zg(n);case ge.EVENT:case ge.BINARY_EVENT:return Array.isArray(n)&&(typeof n[0]=="number"||typeof n[0]=="string"&&eR.indexOf(n[0])===-1);case ge.ACK:case ge.BINARY_ACK:return Array.isArray(n)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class iR{constructor(s){this.packet=s,this.buffers=[],this.reconPack=s}takeBinaryData(s){if(this.buffers.push(s),this.buffers.length===this.reconPack.attachments){const n=PT(this.reconPack,this.buffers);return this.finishedReconstruction(),n}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const sR=Object.freeze(Object.defineProperty({__proto__:null,Decoder:Nh,Encoder:nR,get PacketType(){return ge},protocol:tR},Symbol.toStringTag,{value:"Module"}));function fn(t,s,n){return t.on(s,n),function(){t.off(s,n)}}const rR=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class b0 extends tt{constructor(s,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=s,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 s=this.io;this.subs=[fn(s,"open",this.onopen.bind(this)),fn(s,"packet",this.onpacket.bind(this)),fn(s,"error",this.onerror.bind(this)),fn(s,"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(...s){return s.unshift("message"),this.emit.apply(this,s),this}emit(s,...n){var r,o,c;if(rR.hasOwnProperty(s))throw new Error('"'+s.toString()+'" is a reserved event name');if(n.unshift(s),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(n),this;const h={type:ge.EVENT,data:n};if(h.options={},h.options.compress=this.flags.compress!==!1,typeof n[n.length-1]=="function"){const v=this.ids++,x=n.pop();this._registerAckCallback(v,x),h.id=v}const p=(o=(r=this.io.engine)===null||r===void 0?void 0:r.transport)===null||o===void 0?void 0:o.writable,m=this.connected&&!(!((c=this.io.engine)===null||c===void 0)&&c._hasPingExpired());return this.flags.volatile&&!p||(m?(this.notifyOutgoingListeners(h),this.packet(h)):this.sendBuffer.push(h)),this.flags={},this}_registerAckCallback(s,n){var r;const o=(r=this.flags.timeout)!==null&&r!==void 0?r:this._opts.ackTimeout;if(o===void 0){this.acks[s]=n;return}const c=this.io.setTimeoutFn(()=>{delete this.acks[s];for(let p=0;p<this.sendBuffer.length;p++)this.sendBuffer[p].id===s&&this.sendBuffer.splice(p,1);n.call(this,new Error("operation has timed out"))},o),h=(...p)=>{this.io.clearTimeoutFn(c),n.apply(this,p)};h.withError=!0,this.acks[s]=h}emitWithAck(s,...n){return new Promise((r,o)=>{const c=(h,p)=>h?o(h):r(p);c.withError=!0,n.push(c),this.emit(s,...n)})}_addToQueue(s){let n;typeof s[s.length-1]=="function"&&(n=s.pop());const r={id:this._queueSeq++,tryCount:0,pending:!1,args:s,flags:Object.assign({fromQueue:!0},this.flags)};s.push((o,...c)=>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,...c)),r.pending=!1,this._drainQueue())),this._queue.push(r),this._drainQueue()}_drainQueue(s=!1){if(!this.connected||this._queue.length===0)return;const n=this._queue[0];n.pending&&!s||(n.pending=!0,n.tryCount++,this.flags=n.flags,this.emit.apply(this,n.args))}packet(s){s.nsp=this.nsp,this.io._packet(s)}onopen(){typeof this.auth=="function"?this.auth(s=>{this._sendConnectPacket(s)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(s){this.packet({type:ge.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},s):s})}onerror(s){this.connected||this.emitReserved("connect_error",s)}onclose(s,n){this.connected=!1,delete this.id,this.emitReserved("disconnect",s,n),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(s=>{if(!this.sendBuffer.some(r=>String(r.id)===s)){const r=this.acks[s];delete this.acks[s],r.withError&&r.call(this,new Error("socket has been disconnected"))}})}onpacket(s){if(s.nsp===this.nsp)switch(s.type){case ge.CONNECT:s.data&&s.data.sid?this.onconnect(s.data.sid,s.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 ge.EVENT:case ge.BINARY_EVENT:this.onevent(s);break;case ge.ACK:case ge.BINARY_ACK:this.onack(s);break;case ge.DISCONNECT:this.ondisconnect();break;case ge.CONNECT_ERROR:this.destroy();const r=new Error(s.data.message);r.data=s.data.data,this.emitReserved("connect_error",r);break}}onevent(s){const n=s.data||[];s.id!=null&&n.push(this.ack(s.id)),this.connected?this.emitEvent(n):this.receiveBuffer.push(Object.freeze(n))}emitEvent(s){if(this._anyListeners&&this._anyListeners.length){const n=this._anyListeners.slice();for(const r of n)r.apply(this,s)}super.emit.apply(this,s),this._pid&&s.length&&typeof s[s.length-1]=="string"&&(this._lastOffset=s[s.length-1])}ack(s){const n=this;let r=!1;return function(...o){r||(r=!0,n.packet({type:ge.ACK,id:s,data:o}))}}onack(s){const n=this.acks[s.id];typeof n=="function"&&(delete this.acks[s.id],n.withError&&s.data.unshift(null),n.apply(this,s.data))}onconnect(s,n){this.id=s,this.recovered=n&&this._pid===n,this._pid=n,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(s=>this.emitEvent(s)),this.receiveBuffer=[],this.sendBuffer.forEach(s=>{this.notifyOutgoingListeners(s),this.packet(s)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(s=>s()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:ge.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(s){return this.flags.compress=s,this}get volatile(){return this.flags.volatile=!0,this}timeout(s){return this.flags.timeout=s,this}onAny(s){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(s),this}prependAny(s){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(s),this}offAny(s){if(!this._anyListeners)return this;if(s){const n=this._anyListeners;for(let r=0;r<n.length;r++)if(s===n[r])return n.splice(r,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(s){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(s),this}prependAnyOutgoing(s){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(s),this}offAnyOutgoing(s){if(!this._anyOutgoingListeners)return this;if(s){const n=this._anyOutgoingListeners;for(let r=0;r<n.length;r++)if(s===n[r])return n.splice(r,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(s){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const n=this._anyOutgoingListeners.slice();for(const r of n)r.apply(this,s.data)}}}function sr(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}sr.prototype.duration=function(){var t=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var s=Math.random(),n=Math.floor(s*this.jitter*t);t=(Math.floor(s*10)&1)==0?t-n:t+n}return Math.min(t,this.max)|0};sr.prototype.reset=function(){this.attempts=0};sr.prototype.setMin=function(t){this.ms=t};sr.prototype.setMax=function(t){this.max=t};sr.prototype.setJitter=function(t){this.jitter=t};class Vf extends tt{constructor(s,n){var r;super(),this.nsps={},this.subs=[],s&&typeof s=="object"&&(n=s,s=void 0),n=n||{},n.path=n.path||"/socket.io",this.opts=n,No(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 sr({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=s;const o=n.parser||sR;this.encoder=new o.Encoder,this.decoder=new o.Decoder,this._autoConnect=n.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(s){return arguments.length?(this._reconnection=!!s,s||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(s){return s===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=s,this)}reconnectionDelay(s){var n;return s===void 0?this._reconnectionDelay:(this._reconnectionDelay=s,(n=this.backoff)===null||n===void 0||n.setMin(s),this)}randomizationFactor(s){var n;return s===void 0?this._randomizationFactor:(this._randomizationFactor=s,(n=this.backoff)===null||n===void 0||n.setJitter(s),this)}reconnectionDelayMax(s){var n;return s===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=s,(n=this.backoff)===null||n===void 0||n.setMax(s),this)}timeout(s){return arguments.length?(this._timeout=s,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(s){if(~this._readyState.indexOf("open"))return this;this.engine=new JT(this.uri,this.opts);const n=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const o=fn(n,"open",function(){r.onopen(),s&&s()}),c=p=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",p),s?s(p):this.maybeReconnectOnOpen()},h=fn(n,"error",c);if(this._timeout!==!1){const p=this._timeout,m=this.setTimeoutFn(()=>{o(),c(new Error("timeout")),n.close()},p);this.opts.autoUnref&&m.unref(),this.subs.push(()=>{this.clearTimeoutFn(m)})}return this.subs.push(o),this.subs.push(h),this}connect(s){return this.open(s)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const s=this.engine;this.subs.push(fn(s,"ping",this.onping.bind(this)),fn(s,"data",this.ondata.bind(this)),fn(s,"error",this.onerror.bind(this)),fn(s,"close",this.onclose.bind(this)),fn(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(s){try{this.decoder.add(s)}catch(n){this.onclose("parse error",n)}}ondecoded(s){ko(()=>{this.emitReserved("packet",s)},this.setTimeoutFn)}onerror(s){this.emitReserved("error",s)}socket(s,n){let r=this.nsps[s];return r?this._autoConnect&&!r.active&&r.connect():(r=new b0(this,s,n),this.nsps[s]=r),r}_destroy(s){const n=Object.keys(this.nsps);for(const r of n)if(this.nsps[r].active)return;this._close()}_packet(s){const n=this.encoder.encode(s);for(let r=0;r<n.length;r++)this.engine.write(n[r],s.options)}cleanup(){this.subs.forEach(s=>s()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(s,n){var r;this.cleanup(),(r=this.engine)===null||r===void 0||r.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",s,n),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const s=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(()=>{s.skipReconnect||(this.emitReserved("reconnect_attempt",s.backoff.attempts),!s.skipReconnect&&s.open(o=>{o?(s._reconnecting=!1,s.reconnect(),this.emitReserved("reconnect_error",o)):s.onreconnect()}))},n);this.opts.autoUnref&&r.unref(),this.subs.push(()=>{this.clearTimeoutFn(r)})}}onreconnect(){const s=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",s)}}const sa={};function io(t,s){typeof t=="object"&&(s=t,t=void 0),s=s||{};const n=IT(t,s.path||"/socket.io"),r=n.source,o=n.id,c=n.path,h=sa[o]&&c in sa[o].nsps,p=s.forceNew||s["force new connection"]||s.multiplex===!1||h;let m;return p?m=new Vf(r,s):(sa[o]||(sa[o]=new Vf(r,s)),m=sa[o]),n.query&&!s.query&&(s.query=n.queryKey),m.socket(n.path,s)}Object.assign(io,{Manager:Vf,Socket:b0,io,connect:io});const aR=["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"],lR=3,oR=15,uR=/^[a-zA-Z0-9_-]+$/,cR=pt(uR).pipe(pt(`string > ${lR} & string < ${oR}`)).brand("username"),Ug=20,Bg={0:"o",1:"l",3:"e",4:"a",5:"s",7:"t","@":"a",$:"s","!":"i"};function fR(t){let s="";for(const n of t)n in Bg?s+=Bg[n]:s+=n;return s}function hR(t){const s=t.toLocaleLowerCase(),n=fR(s);for(const r of aR)if(n.includes(r)||s.includes(r))return!0;return!1}function dR(t){const s=new Set(t).size;return t.length*Math.log2(s)}function pR(t){let s=0;return hR(t)&&(s-=100),s+=dR(t)*.5,Math.max(s,0)}const mR=pt("string").narrow((t,s)=>{const n=pR(t);return n>=Ug?!0:s.mustBe(`Of complexity ${Ug} or more. Was ${n.toFixed(2)}.`)}).brand("password");pt({"+":"delete",username:"string",password:"string"});const yR=pt("string").brand("email");pt({"+":"delete",username:"string",password:"string",email:"string"});var gR={};function v0(t,s){if(t instanceof Promise)throw new Error(s)}function bR(t,s){const n={},r=[];for(const o in t){const c=t[o]["~standard"].validate(s[o]);if(v0(c,`Validation must be synchronous, but ${o} returned a Promise.`),c.issues){r.push(...c.issues.map(h=>({...h,path:[o,...h.path??[]]})));continue}n[o]=c.value}return r.length?{issues:r}:{value:n}}function vR(t){var de;const s=t.runtimeEnvStrict??t.runtimeEnv??gR;if(t.emptyStringAsUndefined??!1)for(const[ne,ze]of Object.entries(s))ze===""&&delete s[ne];if(!!t.skipValidation)return s;const o=typeof t.client=="object"?t.client:{},c=typeof t.server=="object"?t.server:{},h=typeof t.shared=="object"?t.shared:{},p=t.isServer??(typeof window>"u"||"Deno"in window),m=p?{...c,...h,...o}:{...o,...h},y=((de=t.createFinalSchema)==null?void 0:de.call(t,m,p)["~standard"].validate(s))??bR(m,s);v0(y,"Validation must be synchronous");const v=t.onValidationError??(ne=>{throw console.error("❌ Invalid environment variables:",ne),new Error("Invalid environment variables")}),x=t.onInvalidAccess??(()=>{throw new Error("❌ Attempted to access a server-side environment variable on the client")});if(y.issues)return v(y.issues);const N=ne=>t.clientPrefix?!ne.startsWith(t.clientPrefix)&&!(ne in h):!0,k=ne=>p||!N(ne),B=ne=>ne==="__esModule"||ne==="$$typeof",K=(t.extends??[]).reduce((ne,ze)=>Object.assign(ne,ze),{}),Z=Object.assign(K,y.value);return new Proxy(Z,{get(ne,ze){if(typeof ze=="string"&&!B(ze))return k(ze)?Reflect.get(ne,ze):x(ze)}})}const SR={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_BACKEND_ORIGIN:"https://realtime.tempest.games"},AR="__vite_start_time"in globalThis,wR=typeof window<"u",Kn=pt("string"),qg=pt('"true" | "false" | undefined'),Mh=vR({isServer:!AR&&!wR,server:{CI:pt("string | undefined").pipe(Boolean),POSTGRES_USER:Kn,POSTGRES_PASSWORD:Kn,POSTGRES_DATABASE:Kn,POSTGRES_HOST:Kn,POSTGRES_PORT:Kn.pipe(t=>Number.parseInt(t,10)),BACKEND_PORT:Kn.pipe(t=>Number.parseInt(t,10)),RUN_WORKERS_FROM_SOURCE:qg.pipe(t=>t==="true"),FRONTEND_PORT:Kn.pipe(t=>Number.parseInt(t,10)),FRONTEND_ORIGINS:Kn.pipe.try(t=>JSON.parse(t),pt("string[]")),OPENAI_API_KEY:pt("string | undefined")},clientPrefix:"VITE_",client:{VITE_BACKEND_ORIGIN:Kn,VITE_USE_SELF_SIGNED_CERTIFICATE:qg.pipe(t=>t==="true")},runtimeEnv:SR,emptyStringAsUndefined:!0}),$h=io(Mh.VITE_BACKEND_ORIGIN,{auth:t=>{const s=pf(Ws);s&&t(s)},autoConnect:!1}).on("connect",()=>{console.log("connected")}).on("connect_error",()=>{console.log("connect_error"),Xf(Ws,null)}),Ws=Xt({key:"auth",default:null,effects:[({onSet:t})=>{t(({newValue:s})=>{s?(localStorage.setItem("username",s.username),localStorage.setItem("sessionKey",s.sessionKey),console.log("connecting..."),$h.connect()):(console.log("clearing session..."),localStorage.removeItem("sessionKey"))})},({setSelf:t})=>{const s=localStorage.getItem("username"),n=localStorage.getItem("sessionKey");s&&n&&t({username:s,sessionKey:n})}]}),pa=Xt({key:"username",default:window.localStorage.getItem("username")??""}),S0=Xi({key:"usernameIssues",get:({get:t})=>{const s=t(pa),n=cR(s);return n instanceof pt.errors?n:null}}),Ps=Xt({key:"password0",default:""}),A0=Xi({key:"password0Issues",get:({get:t})=>{const s=t(Ps),n=mR(s);return n instanceof pt.errors?n:null}}),Hf=Xt({key:"password1",default:""}),w0=Xi({key:"password1Issues",get:({get:t})=>{const s=t(Ps),n=t(Hf),r=pt(`"${s}"`)(n);return r instanceof pt.errors?r:null}}),Gf=Xt({key:"email",default:""}),x0=Xi({key:"emailIssues",get:({get:t})=>{const s=t(Gf),n=yR(s);return n instanceof pt.errors?n:null}}),xR=Xi({key:"signupReady",get:({get:t})=>{const s=t(S0),n=t(A0),r=t(w0),o=t(x0);return!(s??n??r??o)}}),O0=cT({login:null,sign_up:null,game:fT({clicker:null}),admin:null});function OR(t){return hT(O0,t)}const ER=[["login"],["sign_up"]];function _R(t){return ER.some(s=>s.join("/")===t.join("/"))}function E0(t){history.pushState(null,"",t),Xf(_0,t)}const _0=Xt({key:"pathName",default:window.location.pathname,effects:[({onSet:t,setSelf:s})=>{const n=o=>{history.replaceState(null,"",o),s(o)},r=o=>{switch(o){case"/":{const c=pf(Ws);let h="/login";c&&(h="/game"),n(h);break}case"/login":case"/sign_up":{pf(Ws)&&n("/game");break}}};r(window.location.pathname),t(({newValue:o})=>{r(o)})},({setSelf:t})=>{document.addEventListener("click",s=>{const n=s.target.closest("a");if(n&&n instanceof HTMLAnchorElement){const r=n.getAttribute("href");r!=null&&r.startsWith("/")&&(s.preventDefault(),history.pushState(null,"",r),t(r))}}),window.addEventListener("popstate",()=>{t(window.location.pathname)})}]}),TR=Xi({key:"route",get:({get:t})=>{const n=t(_0).split("/").slice(1);return OR(n)?_R(n)||t(Ws)?n:401:404}});function RR(){return j.jsx("article",{children:j.jsx("h1",{children:"admin"})})}class kR extends Map{set(s,n){return this.has(s)?(console.warn("Tried to set a key that already exists in an InvariantMap",{key:s,value:n}),this):super.set(s,n)}clear(){throw new Error("Cannot clear an InvariantMap")}}const ua=class ua{constructor(s){g(this,"type","continuity");g(this,"globals",[]);g(this,"actions",[]);g(this,"perspectives",[]);g(this,"key");this.key=s}static create(s,n){const r=new ua(s),{type:o,globals:c,actions:h,perspectives:p}=n(r),m={type:o,key:s,globals:c,actions:h,perspectives:p};return ua.existing.set(s,m),m}add(...s){switch(s[0].type){case"atom":case"mutable_atom":this.globals.push(...s);break;case"transaction":this.actions.push(...s);break;case"atom_family":case"mutable_atom_family":{const[r,o]=s;this.perspectives.push({type:"realtime_perspective",resourceAtoms:r,viewAtoms:o})}break}return this}};g(ua,"existing",new kR);let Yf=ua;function NR(t){const{key:s,config:n}=t,r=Yf.create(s,n),{actions:o}=r;for(const c of o)rb(nt.STORE,s,c.key);return Wf(nt.STORE,s,-1),r}Xt({key:"usersInRoomIndex",mutable:!0,default:()=>new Sn,toJson:t=>t.toJSON(),fromJson:t=>Sn.fromJSON(t)});Xt({key:"roomIndex",default:()=>new Sn,mutable:!0,toJson:t=>t.toJSON(),fromJson:t=>Sn.fromJSON(t)});const MR={enteredAtEpoch:0},$R=lA({key:"usersInRooms",between:["room","user"],cardinality:"1:n",isAType:t=>typeof t=="string",isBType:t=>typeof t=="string"},MR);dA({key:"usersInMyRoomView",get:t=>({find:s})=>{const n=oA($R);return[s(n,t)]}});const Dh=Xt({key:"count",default:0}),T0=zA({key:"incrementTX",do:({set:t})=>{t(Dh,s=>s+1)}}),DR=NR({key:"countContinuity",config:t=>t.add(Dh).add(T0)});function CR({route:[t]}){return j.jsx("article",{children:t?j.jsx(UR,{gameId:t}):j.jsx(zR,{})})}function zR(){return j.jsx("nav",{children:j.jsx(Ro,{href:"/game/clicker",children:"Clicker"})})}tA(O0[1].game[1]);function UR({gameId:t}){console.log(t);const s=It(Dh),n=UA(T0);return bw(DR),j.jsxs("article",{children:[j.jsxs("button",{type:"button",onClick:()=>{n()},children:["count is ",s]}),j.jsx("p",{children:"Let's see how high we can count!"})]})}async function BR(t,s="SHA-256"){const r=new TextEncoder().encode(t),o=await crypto.subtle.digest(s,r);return Array.from(new Uint8Array(o)).map(h=>h.toString(16).padStart(2,"0")).join("")}async function R0(t){const s=await BR(t);return`${s.substring(0,8)}-${s.substring(8,12)}-${s.substring(12,16)}-${s.substring(16,20)}-${s.substring(20,32)}`}function qR(){const t=Hi(pa),s=Hi(Ps),n=It(pa),r=It(Ps),[o,c]=bt.useState(null);return j.jsxs("form",{onSubmit:async h=>{h.preventDefault();const p=await R0("login"),m=await fetch(`${Mh.VITE_BACKEND_ORIGIN}/login-${p}`,{method:"POST",body:JSON.stringify({username:n,password:r})});if(console.log(m),m.status===200){t(""),s("");const y=await m.text(),[,v]=y.split(" ");Xf(Ws,{username:n,sessionKey:v}),$h.once("connect",()=>{E0("/game")})}if(m.status>=400){const y=await m.text();c(y)}},children:[j.jsxs("main",{children:[o?j.jsx("aside",{children:o}):null,j.jsxs("label",{htmlFor:"username",children:[j.jsx("span",{children:"Username"}),j.jsx("input",{id:"username",type:"text",value:n,onChange:h=>{t(h.target.value)},autoComplete:"username",autoCapitalize:"none"})]}),j.jsxs("label",{htmlFor:"password",children:[j.jsx("span",{children:"Password"}),j.jsx("input",{id:"password",type:"password",value:r,onChange:h=>{s(h.target.value)},autoComplete:"current-password",autoCapitalize:"none"})]}),j.jsx("button",{type:"submit",disabled:!n||!r,children:"->"})]}),j.jsx("footer",{children:j.jsxs(Ro,{href:"/sign_up",children:["New here? ",j.jsx("u",{children:"Sign up"})," for an account."]})})]})}function KR(){const t=Hi(pa),s=Hi(Ps),n=Hi(Hf),r=Hi(Gf),o=It(pa),c=It(Ps),h=It(Hf),p=It(Gf),m=It(S0),y=It(A0),v=It(w0),x=It(x0),N=It(xR),[k,B]=bt.useState(null);return j.jsxs("form",{onSubmit:async K=>{K.preventDefault();const Z=c,oe=await R0("sign-up"),de=await fetch(`${Mh.VITE_BACKEND_ORIGIN}/sign-up-${oe}`,{method:"POST",body:JSON.stringify({username:o,password:Z,email:p})});if(de.status===201&&(n(""),r(""),E0("/login")),de.status>=400){const ne=await de.text();B(ne)}},children:[j.jsxs("main",{children:[k?j.jsx("aside",{children:k}):null,j.jsxs("label",{htmlFor:"username",children:[j.jsx("span",{children:"Username"}),j.jsx("input",{id:"username",type:"text",value:o,onChange:K=>{t(K.target.value)},autoComplete:"username",autoCapitalize:"none",style:{"--energy-color":o?m?"red":"green":void 0}}),o&&m?j.jsx("aside",{children:m.map(K=>j.jsx("span",{children:K.message},K.path.join(".")))}):null]}),j.jsxs("label",{htmlFor:"password",children:[j.jsx("span",{children:"Password"}),j.jsx("input",{id:"password0",type:"password",value:c,onChange:K=>{s(K.target.value)},autoComplete:"new-password",autoCapitalize:"none",style:{"--energy-color":c?y?"red":"green":void 0}}),c&&y?j.jsx("aside",{children:y.map(K=>j.jsx("span",{children:K.message},K.path.join(".")))}):null]}),j.jsxs("label",{htmlFor:"password",children:[j.jsx("span",{children:"Confirm Password"}),j.jsx("input",{id:"password1",type:"password",value:h,onChange:K=>{n(K.target.value)},autoComplete:"new-password",autoCapitalize:"none",style:{"--energy-color":h?v?"red":"green":void 0}}),h&&v?j.jsx("aside",{children:v.map(K=>j.jsx("span",{children:K.message},K.path.join(".")))}):null]}),j.jsxs("label",{htmlFor:"email",children:[j.jsx("span",{children:"Email"}),j.jsx("input",{id:"email",type:"email",value:p,onChange:K=>{r(K.target.value)},autoComplete:"email",autoCapitalize:"none",style:{"--energy-color":p?x?"red":"green":void 0}}),p&&x?j.jsx("aside",{children:x.map(K=>j.jsx("span",{children:K.message},K.path.join(".")))}):null]}),j.jsx("button",{type:"submit",disabled:!N,children:"->"})]}),j.jsx("footer",{children:j.jsxs(Ro,{href:"/login",children:["Already have an account? ",j.jsx("u",{children:"Log in"})," instead."]})})]})}function jR(){const t=It(TR);return j.jsxs("main",{className:uT.class,children:[j.jsx("header",{children:j.jsx(oT,{})}),j.jsx("main",{children:typeof t=="number"?j.jsxs("article",{children:[j.jsx("h1",{children:t}),j.jsx("h2",{children:r0[t]}),j.jsx(Ro,{href:"/login",children:"Return to Home Page"})]}):(()=>{const[s,...n]=t;switch(s){case"admin":return j.jsx(RR,{});case"login":return j.jsx(qR,{});case"sign_up":return j.jsx(KR,{});case"game":return j.jsx(CR,{route:n})}})()})]})}Ew.createRoot(document.getElementById("root")).render(j.jsx(bt.StrictMode,{children:j.jsx(hw,{socket:$h,children:j.jsx(jR,{})})}));