tempest.games 0.1.45 → 0.2.0

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,100 +0,0 @@
1
- var ZS=Object.defineProperty;var XS=(t,s,n)=>s in t?ZS(t,s,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[s]=n;var g=(t,s,n)=>XS(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 Gc={exports:{}},ta={};/**
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 xy;function QS(){if(xy)return ta;xy=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 ta.Fragment=s,ta.jsx=n,ta.jsxs=n,ta}var Oy;function FS(){return Oy||(Oy=1,Gc.exports=QS()),Gc.exports}var K=FS();function Fg(t=Math.random){return t().toString(36).slice(2)}class ff 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 WS(t){return Object.entries(t)}const PS=(t,s,n=tt.STORE)=>lb(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 We{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 eA extends We{constructor(n){super();g(this,"state");this.state=n}next(n){this.state=n,super.next(n)}}function Yf(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 ${da(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 We,p=Object.assign(m=>{const y=Ye(m),v={key:s.key,subKey:y},E=`${s.key}(${y})`,k=ce(t),N=s.default,B={key:E,default:N instanceof Function?N(m):N};s.effects&&(B.effects=s.effects(m));const j=yo(k,B,v);return c.next({type:"state_creation",token:j}),j},r,{subject:c,install:m=>Yf(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 ${da(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 We,p=Object.assign(m=>{const y=Ye(m),v={key:s.key,subKey:y},E=`${s.key}(${y})`,k=ce(t),N=Pf(k,{key:E,get:s.get(m)},v);return c.next({type:"state_creation",token:N}),N},r,{internalRoles:n,subject:c,install:m=>Ks(m,s),default:m=>s.get(m)({get:(...v)=>ln(t,...v),find:(...v)=>xt(t,...v),json:v=>Qi(t,v)})});return t.families.set(s.key,p),r}function tA(t,s){return"set"in s?th(t,s):Ks(t,s)}class Jf{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 Jf([...this._buffer]);return s._index=this._index,s}}const nA={atom_family:"atom",mutable_atom_family:"mutable_atom",selector_family:"selector",readonly_selector_family:"readonly_selector",molecule_family:"molecule"};function iA(t,s){const n=Ye(s),r=`${t.key}(${n})`,o=nA[t.type],c={key:r,type:o};return Object.assign(c,{family:{key:t.key,subKey:n}}),Object.assign(c,{counterfeit:!0}),c}function Is(t){const s={key:t.key,type:t.type};return"family"in t&&(s.family=t.family),s}function Zt(t){return PA(tt.STORE,t)}function hf(...t){return t.length===2?ln(tt.STORE,...t):ln(tt.STORE,...t)}function sA(t,s,n=tt.STORE){return n.joins.set(t.key,new fb(t,s,n)),{key:t.key,type:"join",a:t.between[0],b:t.between[1],cardinality:t.cardinality}}function rA(t){return tw(t,tt.STORE)}const Yc=t=>(s,n,r,o,...c)=>{console[t](`${s} ${n} "${r}" ${o}`,...c)},aA={error:Yc("error"),info:Yc("info"),warn:Yc("warn")};class lA{constructor(s,n,r=aA){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 oA{constructor(s=tt.STORE){g(this,"store");this.store=s,SA("root",s)}allocate(s,n,r){return pa(this.store,s,n,r)}fuse(s,n,r){return AA(this.store,s,n,r)}deallocate(s){ma(this.store,s)}claim(s,n,r){return no(this.store,s,n,r)}}class uA{constructor(s=tt.STORE){g(this,"store");g(this,"realm");this.store=s,this.realm=new oA(s)}allocate(s,n,r){pa(this.store,s,n,r)}deallocate(s){ma(this.store,s)}claim(s,n,r){no(this.store,s,n,r)}}function Xi(t){return lb(tt.STORE,t)}function cA(t){return tA(tt.STORE,t)}function If(...t){t.length===2?Pe(tt.STORE,...t):Pe(tt.STORE,...t)}function Yn(t){return"epoch"in t.transactionMeta}function Et(t){return"phase"in t.transactionMeta}const fA=t=>{const s=ce(t);if(!Et(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 da(t){return t.type.split("_").map(Jt).join(" ")}class Zf extends Error{constructor(s,n){super(`${da(s)} ${Ye(s.key)} not found in store "${n.config.name}".`)}}function Xf(t,s,n){return(...r)=>{const o=ht(t,s);if(o)return o.run(r,n);throw new Zf(s,t)}}const Wg=t=>s=>t instanceof Function?t(s):t,po=(t,s)=>{if(t.valueMap.has(s.key))return t.logger.info("📖",s.type,s.key,"reading cached value"),XA(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}}},hA=(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}"${Et(t)?` ${t.transactionMeta.phase} "${t.transactionMeta.update.key}"`:""}`)},dA=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)},pA=(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),Qf=(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)},mA=(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)},_y=(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)pA(n,o)||(QA(o,n),Qf(n,o))}},yA=(t,s,n)=>{const r=po(t,s);let o=r;if(s.type==="mutable_atom"&&Et(t)){const{parent:h}=t;o=pf(t,s,h)}o=Wg(n)(o),t.logger.info("📝","atom",s.key,"set to",o),o=Ji(t,s.key,o,s.subject),FA(t,s.key)&&WA(t,s.key),Qf(t,s.key),_y(t,s);const c={oldValue:r,newValue:o};if(!Et(t)){mA(t,s,c);return}if(t.on.transactionApplying.state===null){const{key:h}=s;if(ZA(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"&&Et(t)){const{parent:v}=t;m=pf(t,p,v)}m.do(c.newValue)===null&&_y(t,p)}},Pg=(t,s,n)=>{switch(s.type){case"atom":case"mutable_atom":yA(t,s,n);break;case"selector":s.set(n);break}};function gA(t,s){if(s.family){const n=t.families.get(s.family.key);if(n)return n}}function Pe(t,...s){let n,r,o,c;if(s.length===2?(n=s[0],c=s[1],r=gA(t,n)??null,r&&(o=n.family?Ps(n.family.subKey):null,n=xt(t,r,o))):(r=s[0],o=s[1],c=s[2],n=xt(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=hA(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}`),Pe(t,n,c)});return}const p=ht(t,n);Pg(t,p,c),dA(t)}function bA(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}),Pe(n,p,h)}function vA(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 SA(t,s=tt.STORE){const n={key:t,stringKey:Ye(t),dependsOn:"any"};return s.molecules.set(Ye(t),n),t}function pa(t,s,n,r="any"){const o=s,c=Ye(n),h=[],p=ce(t);if(Array.isArray(o))for(const v of o){const E=Ye(v);p.molecules.get(E)?t.moleculeGraph.set(E,c,{source:E}):h.push(E)}else{const v=Ye(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};Et(p)&&p.transactionMeta.phase==="building"?p.transactionMeta.update.updates.push(m):p.on.moleculeCreation.next(m);for(const v of h){const E=t.disposalTraces.buffer.find(k=>(k==null?void 0:k.key)===v);t.logger.error("❌","molecule",n,"allocation failed:",`Could not allocate to ${v} in store "${t.config.name}".`,E?`
14
- ${v} was most recently disposed
15
- ${E.trace}`:`No previous disposal trace for ${v} was found.`)}return n}function AA(t,s,n,r){const o=`T$--${s}==${n}++${r}`;return pa(t,[n,r],o,"all"),o}function ma(t,s){const n=Ye(s),r=t.molecules.get(n);if(!r){const N=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}".`,N?`
16
- This state was most recently deallocated
17
- ${N.trace}`:`No previous disposal trace for ${n} was found.`);return}const o=t.moleculeJoins.getRelatedKeys(r.key);if(o)for(const N of o){const B=t.joins.get(N);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=Et(m)&&m.transactionMeta.phase==="building";y&&m.transactionMeta.update.updates.push(p);const v=t.moleculeGraph.getRelationEntries({downstreamMoleculeKey:r.stringKey});if(v)for(const[N,{source:B}]of v)if(B===r.stringKey){const j=Ps(N);ma(t,j)}else c.push(B);const E=m.moleculeData.getRelatedKeys(r.stringKey);if(E)for(const N of E){const B=m.families.get(N),j=xt(t,B,r.key);h.push([B.key,j]),mo(t,j)}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 k=vA(new Error);t.disposalTraces.add({key:n,trace:k})}function no(t,s,n,r){const o=Ye(n),c=ce(t),h=c.molecules.get(o);if(!h){const k=t.disposalTraces.buffer.find(N=>(N==null?void 0:N.key)===o);return t.logger.error("❌","molecule",n,"claim failed:",`Could not allocate to ${o} in store "${t.config.name}".`,k?`
18
- ${o} was most recently disposed
19
- ${k.trace}`:`No previous disposal trace for ${o} was found.`),n}const p=Ye(s),m=c.molecules.get(p);if(!m){const k=t.disposalTraces.buffer.find(N=>(N==null?void 0:N.key)===p);return t.logger.error("❌","molecule",n,"claim failed:",`Could not allocate to ${p} in store "${t.config.name}".`,k?`
20
- ${p} was most recently disposed
21
- ${k.trace}`:`No previous disposal trace for ${p} was found.`),n}const y=t.moleculeGraph.getRelationEntries({downstreamMoleculeKey:h.stringKey}).filter(([,{source:k}])=>k!==o).map(([k])=>Ps(k));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 Et(c)&&c.transactionMeta.phase==="building"&&c.transactionMeta.update.updates.push(v),n}function wA(t,s,n){switch(s){case"newValue":{eb(t,n);break}case"oldValue":{mo(n,t.token);break}}}function EA(t,s,n){switch(s){case"newValue":{mo(n,t.token);break}case"oldValue":{eb(t,n),t.subType==="atom"&&n.valueMap.set(t.token.key,t.value);break}}}function eb(t,s){const{family:n}=t.token;if(n){const r=s.families.get(n.key);r&&xt(s,r,Ps(n.subKey))}}function xA(t,s,n){switch(s){case"newValue":pa(n,t.provenance,t.key);break;case"oldValue":ma(n,t.key);break}}function OA(t,s,n){switch(s){case"newValue":ma(n,t.key);break;case"oldValue":{const r=t.provenance.map(Ps);pa(n,r,t.key);for(const[o,c]of t.values){const h=n.families.get(o);if(h){xt(n,h,t.key);const p=`${o}(${Ye(t.key)})`;n.valueMap.set(p,c)}}}break}}function _A(t,s,n){switch(s){case"newValue":{const r=t.to.length===1?t.to[0]:t.to;no(n,r,t.key,"exclusive")}break;case"oldValue":{const r=t.from.length===1?t.from[0]:t.from;no(n,r,t.key,"exclusive")}break}}function Ls(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":bA(t,o,n);break;case"state_creation":wA(o,t,n);break;case"state_disposal":EA(o,t,n);break;case"molecule_creation":xA(o,t,n);break;case"molecule_disposal":OA(o,t,n);break;case"molecule_transfer":_A(o,t,n);break;case"transaction_update":Ls(t,o,n);break}}function tb(t,s){return t.transactionMeta.actionContinuities.getRelatedKey(s)}function nb(t,s){return t.transactionMeta.epoch.get(s)}function TA(t,s){if(!Yn(t))return;const r=tb(t,s);if(r!==void 0)return nb(t,r)}function Ff(t,s,n){Yn(t)&&s&&t.transactionMeta.epoch.set(s,n)}function RA(t,s,n){if(!Yn(t))return;const o=tb(t,s);o!==void 0&&t.transactionMeta.epoch.set(o,n)}const NA=(t,s)=>{var c;const n=ce(s),{parent:r}=n;if(r===null||!Et(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),Ls("newValue",n.transactionMeta.update,r),Yn(r)){RA(r,n.transactionMeta.update.key,n.transactionMeta.update.epoch);const h=ht(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 Et(r)&&r.transactionMeta.update.updates.push(n.transactionMeta.update);r.on.transactionApplying.next(null)};function ib(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 kA(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=xt(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=ht(t,r).default(c);return t.defaults.set(r.key,p),p}}}return po(t,ht(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 Sn 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 MA=(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 Sn(o.atoms),atomsThatAreDefault:new Set(o.atomsThatAreDefault),families:new Sn(o.families),joins:new Sn(o.joins),operation:{open:!1},readonlySelectors:new Sn(o.readonlySelectors),timelines:new Sn(o.timelines),timelineTopics:new Tt(o.timelineTopics.toJSON()),trackers:new Map,transactions:new Sn(o.transactions),selectorAtoms:new Tt(o.selectorAtoms.toJSON()),selectorGraph:new Tt(o.selectorGraph.toJSON(),{makeContentKey:(...y)=>y.sort().join(":")}),selectors:new Sn(o.selectors),valueMap:new Sn(o.valueMap),defaults:o.defaults,disposalTraces:t.disposalTraces.copy(),molecules:new Sn(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 Sn(o.miscResources)},h=TA(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)=>{Pe(m,...y)},run:(y,v=Fg())=>Xf(m,y,v),find:(...y)=>xt(t,...y),json:y=>Qi(m,y),dispose:(...y)=>{mo(m,...y)},env:()=>kA(m)}},m=Object.assign(c,{transactionMeta:p});return o.child=m,t.logger.info("🛫","transaction",s,"Building transaction with params:",n),m};function sb(t,s){const n={key:s.key,type:"transaction",run:(c,h)=>{const p=MA(t,s.key,c,h);try{const m=ce(t),{toolkit:y}=p.transactionMeta,v=s.do(y,...c);return NA(v,m),v}catch(m){throw fA(r),t.logger.warn("💥","transaction",s.key,"caught:",m),m}},install:c=>sb(c,s),subject:new We},r=ce(t);r.transactions.set(n.key,n);const o=Is(n);return t.on.transactionCreation.next(o),o}function $A(t){return sb(tt.STORE,t)}function DA(t,s=Fg()){return Xf(tt.STORE,t,s)}class CA{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 Jf(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 We,atomDisposal:new We,selectorCreation:new We,selectorDisposal:new We,timelineCreation:new We,transactionCreation:new We,transactionApplying:new eA(null),operationClose:new We,moleculeCreation:new We,moleculeDisposal:new We});g(this,"operation",{open:!1});g(this,"config",{name:"IMPLICIT_STORE",lifespan:"ephemeral"});g(this,"loggers",[new lA("warn",(s,n,r)=>!nw(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=Qi(n,h),m=ub(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 tt={get STORE(){return globalThis.ATOM_IO_IMPLICIT_STORE??(globalThis.ATOM_IO_IMPLICIT_STORE=new CA({name:"IMPLICIT_STORE",lifespan:"ephemeral"})),globalThis.ATOM_IO_IMPLICIT_STORE}};function ht(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 zA(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 Et(c)&&c.on.transactionApplying.state===null&&c.transactionMeta.update.updates.push({type:"state_creation",token:o});return o}function UA(t,s,n){const r=Ye(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&&Is(h)}function xt(t,s,n){let r=UA(t,s,n);if(r)return r;const o=Ye(n),c=t.molecules.get(o);if(!c&&t.config.lifespan==="immortal"){const h=iA(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=zA(t,s,n),c&&ce(t).moleculeData.set(o,s.key),r}function mo(t,...s){let n;if(s.length===1)n=s[0];else{const r=s[0],o=s[1];n=xt(t,r,o)}try{ht(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":sh(t,n);break;case"selector":case"readonly_selector":HA(t,n);break}}const Wf=(t,s)=>ce(t).atoms.has(s),BA=(t,s)=>ce(t).selectors.has(s),qA=(t,s)=>ce(t).readonlySelectors.has(s),jA=(t,s)=>Wf(t,s)||BA(t,s)||qA(t,s),df=(t,s)=>ce(s).selectorGraph.getRelationEntries({downstreamSelectorKey:t}).filter(([r,{source:o}])=>o!==t).map(([r,{source:o}])=>o).filter(r=>jA(s,r)),rb=(t,s,n)=>{const r=[],o=df(t,n);for(;o.length>0;){const c=o.shift();s.has(c)||(s.add(c),Wf(n,c)?r.includes(c)||r.push(c):o.push(...df(c,n)))}return r},KA=(t,s)=>{const n=t.key,r=df(n,s),o=new Set;return r.flatMap(c=>Wf(s,c)?c:rb(c,o,s))},LA=(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=rb(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)},ab=(t,s,n)=>({get:(...r)=>{const o=ce(n);let c;if(r.length===2){const[m,y]=r;c=xt(n,m,y)}else[c]=r;const h=ht(n,c),p=po(n,h);return n.logger.info("🔌","selector",t,`registers dependency ( "${c.key}" =`,p,")"),o.selectorGraph.set({upstreamSelectorKey:c.key,downstreamSelectorKey:t},{source:c.key}),LA(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=xt(n,m,y)}const h=ce(n),p=ht(h,o);Pg(h,p,c)},find:(...r)=>xt(n,...r),json:r=>Qi(n,r)}),Pf=(t,s,n)=>{const r=ce(t),o=new We,c=new Set,{get:h,find:p,json:m}=ab(s.key,c,r),y=()=>{const N=s.get({get:h,find:p,json:m});return Ji(ce(t),s.key,N,o),c.clear(),N},v={...s,subject:o,install:N=>Pf(N,s,n),get:y,type:"readonly_selector",...n&&{family:n}};r.readonlySelectors.set(s.key,v);const E=y();t.logger.info("✨",v.type,v.key,"=",E);const k={key:s.key,type:"readonly_selector"};return n&&(k.family=n),k},eh=(t,s,n)=>{const r=ce(t),o=new We,c=new Set,h=ab(s.key,c,r),{find:p,get:m,json:y}=h,v={find:p,get:m,json:y},E=(X=s.get,F=ce(t))=>{const le=X(v);return Ji(F,s.key,le,o),c.clear(),le},N={...s,subject:o,install:X=>eh(X,s,n),get:E,set:X=>{const F=ce(t),le=E(s.get,F),ve=Wg(X)(le);t.logger.info("📝","selector",s.key,"set (",le,"->",ve,")"),Ji(F,s.key,ve,o),Qf(F,s.key),Yn(F)&&o.next({newValue:ve,oldValue:le}),s.set(h,ve)},type:"selector",...n&&{family:n}};r.selectors.set(s.key,N);const B=E();t.logger.info("✨",N.type,N.key,"=",B);const j={key:s.key,type:"selector"};return n&&(j.family=n),j};function lb(t,s){if("set"in s){const o=eh(t,s,void 0);return t.on.selectorCreation.next(o),o}const r=Pf(t,s,void 0);return t.on.selectorCreation.next(r),r}function HA(t,s){const n=ce(t),{key:r}=s,o=ht(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"},ht(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"},ht(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"),Et(n)&&n.transactionMeta.phase==="building"?n.transactionMeta.update.updates.push({type:"state_disposal",subType:"selector",token:s}):t.on.selectorDisposal.next(s)}}function th(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 ${da(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 We,p=Object.assign(m=>{const y=Ye(m),v={key:s.key,subKey:y},E=`${s.key}(${y})`,k=ce(t),N=eh(k,{key:E,get:s.get(m),set:s.set(m)},v);return c.next({type:"state_creation",token:N}),N},r,{internalRoles:n,subject:c,install:m=>th(m,s),default:m=>s.get(m)({get:(...v)=>ln(t,...v),find:(...v)=>xt(t,...v),json:v=>Qi(t,v)})});return t.families.set(s.key,p),r}function VA(t,s,n){return th(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 Ps=t=>JSON.parse(t),Ye=t=>JSON.stringify(t),GA=(t,s)=>{const n=ce(t);return n.operation.open?n.operation.prev.get(s.key):n.valueMap.get(s.key)},Ty=(t,s)=>{const n=ce(t);return KA(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=GA(n,s),m=po(n,s);t.logger.info("✨",s.type,s.key,"went",p,"->",m),s.subject.next({newValue:m,oldValue:p})})})};function ua(t,s,n,r){function o(E){if(t.operation.open){const k=t.on.operationClose.subscribe(`state subscription ${n}`,()=>{k(),r(E)})}else r(E)}const c=ht(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=Ty(t,c),m=E=>{p&&(p.length=0,p.push(...Ty(t,c))),o(E)});const y=c.subject.subscribe(n,m);return()=>{if(t.logger.info("🙈",c.type,c.key,`Removing subscription "${n}"`),y(),p)for(const E of p)E()}}const YA=(t,s,n,r)=>{const o=ht(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()}},JA=(t,s,n,r)=>{const o=ht(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 Bg;Bg=Symbol.dispose;class nh{constructor(s,n){g(this,"Update");g(this,"unsubscribeFromInnerValue");g(this,"unsubscribeFromState");g(this,"mutableState");g(this,"latestUpdateState");g(this,Bg);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=yo(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}:${Et(r)?r.transactionMeta.update.key:"main"}:${s.key}`,c=ln(r,s);this.unsubscribeFromInnerValue=c.subscribe(o,h=>{Pe(r,n,h)}),this.unsubscribeFromState=ua(r,s,o,h=>{h.newValue!==h.oldValue&&(this.unsubscribeFromInnerValue(),this.unsubscribeFromInnerValue=h.newValue.subscribe(o,p=>{Pe(r,n,p)}))})}updateCore(s,n,r){const o=`tracker:${r.config.name}:${Et(r)?r.transactionMeta.update.key:"main"}:${s.key}`;ua(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=YA(r,{key:p,type:"timeline"},o,E=>{v(),Pe(r,s,k=>(E==="redo"&&c?k.do(c):E==="undo"&&h&&k.undo(h),k))});return}}const m=r.on.operationClose.subscribe(o,()=>{m();const y=ln(r,s),v=c===null?-1:y.getUpdateNumber(c),E=v-y.cacheUpdateNumber;c&&E===1?Pe(r,s,k=>(k.do(c),k)):r.logger.info("❌","mutable_atom",s.key,`could not be updated. Expected update number ${y.cacheUpdateNumber+1}, but got ${v}`)})})}}function ih(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."),Is(o);const c=new We,h={...s,type:"mutable_atom",install:y=>(y.logger.info("🛠️","atom",s.key,`installing in store "${y.config.name}"`),ih(y,s,n)),subject:c};n&&(h.family=n);const p=s.default();r.atoms.set(h.key,h),cb(t,s.key),Ji(r,s.key,p,c);const m=Is(h);if(s.effects){let y=0;const v=[];for(const E of s.effects){const k=E({setSelf:N=>{Pe(t,m,N)},onSet:N=>ua(t,m,`effect[${y}]`,N)});k&&v.push(k),++y}h.cleanup=()=>{for(const E of v)E()}}return new nh(m,t),n||PS(m,s,t),m}class IA{constructor(s,n){g(this,"trackers",new Map);g(this,"Update");g(this,"latestUpdateAtoms");g(this,"mutableAtoms");const r=Yf(n,{key:`*${s.key}`,default:null},["mutable","updates"]);this.latestUpdateAtoms=ht(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=Ps(h.family.subKey);switch(c){case"state_creation":this.trackers.set(p,new nh(h,n));break;case"state_disposal":{const m=this.trackers.get(p);m&&(m[Symbol.dispose](),this.trackers.delete(p))}break}}})}}function ob(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 ${da(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 We,p=Object.assign(m=>{const y=Ye(m),v={key:s.key,subKey:y},E=`${s.key}(${y})`,k=ce(t),N={key:E,default:()=>s.default(m),toJson:s.toJson,fromJson:s.fromJson,mutable:!0};s.effects&&(N.effects=s.effects(m));const B=ih(k,N,v);return c.next({type:"state_creation",token:B}),B},r,{subject:c,install:m=>ob(m,s),toJson:s.toJson,fromJson:s.fromJson,internalRoles:n});return t.families.set(s.key,p),VA(t,p,s),new IA(p,t),r}const Ry=(t,s)=>{const n=ce(s),r=`${t.key}:JSON`;return n.families.get(r)},Qi=(t,s)=>{if(s.family){const r=ce(t),c={key:`${s.family.key}:JSON`,type:"selector_family"},h=ht(r,c),p=JSON.parse(s.family.subKey);return xt(t,h,p)}return{type:"selector",key:`${s.key}:JSON`}},ub=t=>{const n={type:"atom",key:`*${t.key}`};return t.family&&(n.family={key:`*${t.family.key}`,subKey:t.family.subKey}),n};function ZA(t){return typeof t=="object"&&t!==null&&"do"in t&&"undo"in t&&"subscribe"in t}function pf(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 nh(s,n),h}function Ji(t,s,n,r){const o=t.valueMap.get(s);if(o instanceof ff&&o.use(n),n instanceof Promise){const c=new ff(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 XA=(t,s)=>{let n=s.valueMap.get(t.key);if(t.type==="mutable_atom"&&Et(s)){const{parent:r}=s;n=pf(s,t,r)}return n},QA=(t,s)=>{const n=s.valueMap.get(t);if(n instanceof ff){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")},FA=(t,s)=>ce(t).atomsThatAreDefault.has(s),cb=(t,s)=>{const n=ce(t);n.atomsThatAreDefault=new Set(n.atomsThatAreDefault).add(s)},WA=(t,s)=>{const n=ce(t);n.atomsThatAreDefault=new Set(ce(t).atomsThatAreDefault),n.atomsThatAreDefault.delete(s)};function yo(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."),Is(o);const c=new We,h={...s,type:"atom",install:y=>(y.logger.info("🛠️","atom",s.key,`installing in store "${y.config.name}"`),yo(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),cb(t,s.key),Ji(r,s.key,p,c);const m=Is(h);if(s.effects){let y=0;const v=[];for(const E of s.effects){const k=E({setSelf:N=>{Pe(t,m,N)},onSet:N=>ua(t,m,`effect[${y}]`,N)});k&&v.push(k),++y}h.cleanup=()=>{for(const E of v)E()}}return m}function PA(t,s){if("mutable"in s){const o=ih(t,s,void 0);return t.on.atomCreation.next(o),o}const r=yo(t,s,void 0);return t.on.atomCreation.next(r),r}function sh(t,s){var h;const n=ce(t),{key:r,family:o}=s,c=ht(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=ht(t,{key:o.key,type:"atom_family"}),y={type:"state_disposal",subType:"atom",token:s,value:p};m.subject.next(y);const v=Et(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 E=ub(s);sh(t,E),t.trackers.delete(r)}if(t.logger.info("🔥","atom",r,"deleted"),v&&n.transactionMeta.phase==="building"){const E=n.transactionMeta.update.updates.at(-1);(E==null?void 0:E.type)==="molecule_disposal"&&E.values.some(([B])=>{var j;return B===((j=c.family)==null?void 0:j.key)})||n.transactionMeta.update.updates.push(y)}else t.on.atomDisposal.next(s)}}class An extends Set{constructor(n,r=0){super(n);g(this,"mode","record");g(this,"subject",new We);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 An&&(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 An(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:${Ye(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:${Ye(n)}`)),r}transaction(n){this.mode="transaction",this.transactionUpdates=[],this.child=new An(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 E=this.cache[this.cacheIdx];if(this.cacheIdx--,!E)return"OUT_OF_RANGE";this.undo(E),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 fb{constructor(s,n,r=tt.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 uA(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)=>{Pe(r,...z)},find:(...z)=>xt(r,...z),json:z=>Qi(r,z)};const o=s.between[0],c=s.between[1],h=ob(r,{key:`${s.key}/relatedKeys`,default:()=>new An,mutable:!0,fromJson:z=>An.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(Ye(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:me}=z,_e=I(h,G),Te=ie(_e);for(const Le of Te)re.includes(Le)||me(h,Le,Ce=>(Ce.delete(G),Ce));me(_e,Le=>(Le.transaction(vt=>{vt.clear();for(const Ce of re){const M=p(z,Ce),H=M.has(G);if(this.relations.cardinality==="1:n"){const W=[];for(const be of M){if(be===G)continue;const A=p(z,be);A.delete(Ce),A.size===0&&W.push(be)}!H&&M.size>0&&M.clear();for(const be of W){const A=[Ce,be].sort(),U=`"${A[0]}:${A[1]}"`;this.molecules.delete(U)}}H||M.add(G),vt.add(Ce)}return!0}),Le))},E=(z,G,re)=>{const{set:I}=z;I(h,G,ie=>(ie.transaction(me=>{for(const _e of re)me.add(_e);return!0}),ie));for(const ie of re)I(h,ie,me=>(me.add(G),me));return!0},k=(z,G,re)=>{const I=p(z,G);return re?I.has(re):I.size>0},N={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)=>{E(this.toolkit,z,G)},has:(z,G)=>k(this.toolkit,z,G)};let B,j;if(n){j=Yf(r,{key:`${s.key}/content`,default:n},["join","content"]);const z=({get:I},ie)=>I(j,ie),G=({set:I},ie,me)=>{I(j,ie,me)};B=Object.assign(N,{getContent:I=>z(this.toolkit,I),setContent:(I,ie)=>{G(this.toolkit,I,ie)},deleteContent:I=>{this.realm.deallocate(I)}})}else B=N;const X=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]}`,me=r.molecules.get(Ye(G)),_e=r.molecules.get(Ye(re));return me||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}}),F=()=>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"]),le=()=>Ks(r,{key:`${s.key}/multipleRelatedKeys`,get:z=>({get:G})=>{const re=Ry(h,r);return G(re,z).members}},["join","keys"]),ve=()=>Ks(r,{key:`${s.key}/singleRelatedEntry`,get:z=>({get:G})=>{var I;const re=G(h,z);for(const ie of re){let me=(I=X.isAType)!=null&&I.call(X,z)?z:void 0,_e=me===void 0?z:void 0;me??(me=ie),_e??(_e=ie);const Te=X.makeContentKey(me,_e),Le=G(j,Te);return[ie,Le]}return null}},["join","entries"]),bt=()=>Ks(r,{key:`${s.key}/multipleRelatedEntries`,get:z=>({get:G})=>{const re=Ry(h,r);return G(re,z).members.map(ie=>{var vt;let me=(vt=X.isAType)!=null&&vt.call(X,z)?z:void 0,_e=me===void 0?z:void 0;me??(me=ie),_e??(_e=ie);const Te=X.makeContentKey(me,_e),Le=G(j,Te);return[ie,Le]})}},["join","entries"]);switch(s.cardinality){case"1:1":{const z=F(),G=`${o}KeyOf${Jt(c)}`,re=`${c}KeyOf${Jt(o)}`,I={[G]:z,[re]:z};let ie;if(n){const me=ve(),_e=`${o}EntryOf${Jt(c)}`,Te=`${c}EntryOf${Jt(o)}`,Le={[_e]:me,[Te]:me};ie=Object.assign(I,Le)}else ie=I;this.relations=X,this.states=ie;break}case"1:n":{const z=F(),G=le(),re=`${o}KeyOf${Jt(c)}`,I=`${c}KeysOf${Jt(o)}`,ie={[re]:z,[I]:G};let me;if(n){const _e=ve(),Te=bt(),Le=`${o}EntryOf${Jt(c)}`,vt=`${c}EntriesOf${Jt(o)}`,Ce={[Le]:_e,[vt]:Te};me=Object.assign(ie,Ce)}else me=ie;this.relations=X,this.states=me;break}case"n:n":{const z=le(),G=`${o}KeysOf${Jt(c)}`,re=`${c}KeysOf${Jt(o)}`,I={[G]:z,[re]:z};let ie;if(n){const me=bt(),_e=`${o}EntriesOf${Jt(c)}`,Te=`${c}EntriesOf${Jt(o)}`,Le={[_e]:me,[Te]:me};ie=Object.assign(I,Le)}else ie=I;this.relations=X,this.states=ie}}}transact(s,n){const r=this.toolkit;this.toolkit=s,n(this),this.toolkit=r}[Symbol.dispose](){}}function ew(t,s){let n=s.joins.get(t.key);if(n===void 0){const o=tt.STORE.joins.get(t.key);if(o===void 0)throw new Error(`Join "${t.key}" not found in store "${s.config.name}"`);n=new fb(o.options,o.defaultContent,s),s.joins.set(t.key,n)}return n}function tw(t,s){return ew(t,s).core.relatedKeysAtoms}function nw(t){return t.startsWith("🔍 ")}var Jc={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 Ny;function iw(){if(Ny)return ue;Ny=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"),E=Symbol.iterator;function k(A){return A===null||typeof A!="object"?null:(A=E&&A[E]||A["@@iterator"],typeof A=="function"?A:null)}var N={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},B=Object.assign,j={};function X(A,U,Y){this.props=A,this.context=U,this.refs=j,this.updater=Y||N}X.prototype.isReactComponent={},X.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")},X.prototype.forceUpdate=function(A){this.updater.enqueueForceUpdate(this,A,"forceUpdate")};function F(){}F.prototype=X.prototype;function le(A,U,Y){this.props=A,this.context=U,this.refs=j,this.updater=Y||N}var ve=le.prototype=new F;ve.constructor=le,B(ve,X.prototype),ve.isPureReactComponent=!0;var bt=Array.isArray,z={H:null,A:null,T:null,S:null,V:null},G=Object.prototype.hasOwnProperty;function re(A,U,Y,V,P,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 me(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?me(""+A.key):U.toString(36)}function Le(){}function vt(A){switch(A.status){case"fulfilled":return A.value;case"rejected":throw A.reason;default:switch(typeof A.status=="string"?A.then(Le,Le):(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 Ce(A,U,Y,V,P){var Se=typeof A;(Se==="undefined"||Se==="boolean")&&(A=null);var oe=!1;if(A===null)oe=!0;else switch(Se){case"bigint":case"string":case"number":oe=!0;break;case"object":switch(A.$$typeof){case t:case s:oe=!0;break;case v:return oe=A._init,Ce(oe(A._payload),U,Y,V,P)}}if(oe)return P=P(A),oe=V===""?"."+Te(A,0):V,bt(P)?(Y="",oe!=null&&(Y=oe.replace(_e,"$&/")+"/"),Ce(P,U,Y,"",function(In){return In})):P!=null&&(ie(P)&&(P=I(P,Y+(P.key==null||A&&A.key===P.key?"":(""+P.key).replace(_e,"$&/")+"/")+oe)),U.push(P)),1;oe=0;var Ut=V===""?".":V+":";if(bt(A))for(var je=0;je<A.length;je++)V=A[je],Se=Ut+Te(V,je),oe+=Ce(V,U,Y,Se,P);else if(je=k(A),typeof je=="function")for(A=je.call(A),je=0;!(V=A.next()).done;)V=V.value,Se=Ut+Te(V,je++),oe+=Ce(V,U,Y,Se,P);else if(Se==="object"){if(typeof A.then=="function")return Ce(vt(A),U,Y,V,P);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 oe}function M(A,U,Y){if(A==null)return A;var V=[],P=0;return Ce(A,V,"","",function(Se){return U.call(Y,Se,P++)}),V}function H(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 W=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 be(){}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=X,ue.Fragment=n,ue.Profiler=o,ue.PureComponent=le,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 V=B({},A.props),P=A.key,Se=void 0;if(U!=null)for(oe in U.ref!==void 0&&(Se=void 0),U.key!==void 0&&(P=""+U.key),U)!G.call(U,oe)||oe==="key"||oe==="__self"||oe==="__source"||oe==="ref"&&U.ref===void 0||(V[oe]=U[oe]);var oe=arguments.length-2;if(oe===1)V.children=Y;else if(1<oe){for(var Ut=Array(oe),je=0;je<oe;je++)Ut[je]=arguments[je+2];V.children=Ut}return re(A.type,P,void 0,void 0,Se,V)},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 V,P={},Se=null;if(U!=null)for(V in U.key!==void 0&&(Se=""+U.key),U)G.call(U,V)&&V!=="key"&&V!=="__self"&&V!=="__source"&&(P[V]=U[V]);var oe=arguments.length-2;if(oe===1)P.children=Y;else if(1<oe){for(var Ut=Array(oe),je=0;je<oe;je++)Ut[je]=arguments[je+2];P.children=Ut}if(A&&A.defaultProps)for(V in oe=A.defaultProps,oe)P[V]===void 0&&(P[V]=oe[V]);return re(A,Se,void 0,void 0,null,P)},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:H}},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 V=A(),P=z.S;P!==null&&P(Y,V),typeof V=="object"&&V!==null&&typeof V.then=="function"&&V.then(be,W)}catch(Se){W(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 V=z.H;if(typeof Y=="function")throw Error("useEffect CRUD overload is not enabled in this build of React.");return V.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 ky;function rh(){return ky||(ky=1,Jc.exports=iw()),Jc.exports}var gt=rh();const ah=gt.createContext(tt.STORE);function hb(t,...s){let n;if(s.length===2){const r=s[0],o=s[1];n=xt(t,r,o)}else n=s[0];return n}function Vi(...t){const s=gt.useContext(ah),n=hb(s,...t),r=gt.useRef(null);return r.current??(r.current=o=>{Pe(s,n,o)}),r.current}function It(...t){const s=gt.useContext(ah),n=hb(s,...t),r=gt.useId();return gt.useSyncExternalStore(o=>ua(s,n,`use-o:${r}`,o),()=>ln(s,n),()=>ln(s,n))}const sw=(t,s,n,r,o)=>c=>{function h(m,y){if(t.logger.info("🧑‍⚖️","continuity",s,"reconciling updates"),Pe(t,Zl,E=>(E.shift(),E)),m.id===y.id){const E=JSON.stringify(m.updates),k=JSON.stringify(y.updates);if(E===k){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 E of v)Ls("oldValue",E,t);t.logger.info("⏪","continuity",s,"undid optimistic updates:",v),Ls("oldValue",m,t),t.logger.info("⏪","continuity",s,"undid zeroth optimistic update",m),Ls("newValue",y,t),t.logger.info("⏩","continuity",s,"applied confirmed update",y),n.emit(`ack:${s}`,y.epoch);for(const E of r){const k={type:"transaction",key:E.key},{id:N,params:B}=E;Xf(t,k,N)(...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),Pe(t,mf,y=>(y.push(c),y.sort((v,E)=>v.epoch-E.epoch),y)));else{t.logger.info("🧑‍⚖️","continuity",s,"has no optimistic updates to deal with");const m=Yn(t);let y;m&&(y=nb(t,s)),y===c.epoch-1?(t.logger.info("✅","continuity",s,`integrating update #${c.epoch} (${c.key} ${c.id})`),Ls("newValue",c,t),n.emit(`ack:${s}`,c.epoch),Ff(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(E=>E.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`),Pe(t,mf,E=>(E.push(c),E.sort((k,N)=>k.epoch-N.epoch),E))))}};function rw(t){return s=>{for(const n of s)sh(t,n)}}function aw(t){return s=>{let n=0,r,o;for(const c of s)n%2===0?r=c:(o=c,Pe(t,r,o)),n++}}const lw=(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))})},db=Zt({key:"mySocketId__INTERNAL",default:void 0});Xi({key:"mySocketId",get:({get:t})=>t(db)});Zt({key:"myName",default:null,effects:typeof window>"u"?[]:[lw(window.localStorage,JSON,"myUsername")]});const Zl=Zt({key:"updateQueue",default:[]}),mf=Zt({key:"serverConfirmedUpdateQueue",default:[]});function ow(t,s,n){const r=n.key,o=ln(t,Zl),c=ln(t,mf),h=(E,k)=>{s.off(`continuity-init:${r}`,h);let N=0,B,j;for(const X of k)N%2===0?B=X:(j=X,"type"in B&&B.type==="mutable_atom"&&(B=Qi(t,B)),Pe(t,B,j)),N++;Ff(t,r,E)};s.off(`continuity-init:${r}`),s.on(`continuity-init:${r}`,h);const p=sw(t,r,s,o,c);s.off(`tx-new:${r}`),s.on(`tx-new:${r}`,p);const m=n.actions.map(E=>(ib(t,r,E.key),JA(t,E,`tx-run:${r}`,N=>{t.logger.info("🤞","continuity",r,"enqueuing optimistic update");const B=o.findIndex(j=>j.id===N.id);B===-1?(t.logger.info("🤞","continuity",r,"enqueuing new optimistic update"),Pe(t,Zl,j=>(j.push(N),j.sort((X,F)=>X.epoch-F.epoch),j))):(t.logger.info("🤞","continuity",r,`replacing existing optimistic update at index ${B}`),Pe(t,Zl,j=>(j[B]=N,j))),s.emit(`tx-run:${r}`,{id:N.id,key:E.key,params:N.params})}))),y=aw(t),v=rw(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 E of m)E()}}const pb=gt.createContext({socket:null,services:null}),uw=({children:t,socket:s})=>{const n=gt.useRef(new Map).current,r=Vi(db);return gt.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]),K.jsx(pb.Provider,{value:{socket:s,services:n},children:t})},{NODE_ENV:cw}=globalThis.env??{},fw=cw==="development";function Ll(){}function hw(t,s){if(fw){const n=gt.useRef(Ll);gt.useEffect(()=>{let r=n.current;if(r===Ll)r=t()??Ll,n.current=r;else return()=>{r(),n.current=Ll}},s)}else gt.useEffect(t,s)}function dw(t){hw(t,[])}function pw(t,s){const{socket:n,services:r}=gt.useContext(pb);dw(()=>{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 mw(t){const s=gt.useContext(ah);pw(`tx-sync:${t.key}`,n=>ow(s,n,t))}var Ic={exports:{}},na={},Zc={exports:{}},Xc={};/**
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 My;function yw(){return My||(My=1,function(t){function s(M,H){var W=M.length;M.push(H);e:for(;0<W;){var be=W-1>>>1,A=M[be];if(0<o(A,H))M[be]=H,M[W]=A,W=be;else break e}}function n(M){return M.length===0?null:M[0]}function r(M){if(M.length===0)return null;var H=M[0],W=M.pop();if(W!==H){M[0]=W;e:for(var be=0,A=M.length,U=A>>>1;be<U;){var Y=2*(be+1)-1,V=M[Y],P=Y+1,Se=M[P];if(0>o(V,W))P<A&&0>o(Se,V)?(M[be]=Se,M[P]=W,be=P):(M[be]=V,M[Y]=W,be=Y);else if(P<A&&0>o(Se,W))M[be]=Se,M[P]=W,be=P;else break e}}return H}function o(M,H){var W=M.sortIndex-H.sortIndex;return W!==0?W:M.id-H.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,E=null,k=3,N=!1,B=!1,j=!1,X=!1,F=typeof setTimeout=="function"?setTimeout:null,le=typeof clearTimeout=="function"?clearTimeout:null,ve=typeof setImmediate<"u"?setImmediate:null;function bt(M){for(var H=n(y);H!==null;){if(H.callback===null)r(y);else if(H.startTime<=M)r(y),H.sortIndex=H.expirationTime,s(m,H);else break;H=n(y)}}function z(M){if(j=!1,bt(M),!B)if(n(m)!==null)B=!0,G||(G=!0,Te());else{var H=n(y);H!==null&&Ce(z,H.startTime-M)}}var G=!1,re=-1,I=5,ie=-1;function me(){return X?!0:!(t.unstable_now()-ie<I)}function _e(){if(X=!1,G){var M=t.unstable_now();ie=M;var H=!0;try{e:{B=!1,j&&(j=!1,le(re),re=-1),N=!0;var W=k;try{t:{for(bt(M),E=n(m);E!==null&&!(E.expirationTime>M&&me());){var be=E.callback;if(typeof be=="function"){E.callback=null,k=E.priorityLevel;var A=be(E.expirationTime<=M);if(M=t.unstable_now(),typeof A=="function"){E.callback=A,bt(M),H=!0;break t}E===n(m)&&r(m),bt(M)}else r(m);E=n(m)}if(E!==null)H=!0;else{var U=n(y);U!==null&&Ce(z,U.startTime-M),H=!1}}break e}finally{E=null,k=W,N=!1}H=void 0}}finally{H?Te():G=!1}}}var Te;if(typeof ve=="function")Te=function(){ve(_e)};else if(typeof MessageChannel<"u"){var Le=new MessageChannel,vt=Le.port2;Le.port1.onmessage=_e,Te=function(){vt.postMessage(null)}}else Te=function(){F(_e,0)};function Ce(M,H){re=F(function(){M(t.unstable_now())},H)}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 k},t.unstable_next=function(M){switch(k){case 1:case 2:case 3:var H=3;break;default:H=k}var W=k;k=H;try{return M()}finally{k=W}},t.unstable_requestPaint=function(){X=!0},t.unstable_runWithPriority=function(M,H){switch(M){case 1:case 2:case 3:case 4:case 5:break;default:M=3}var W=k;k=M;try{return H()}finally{k=W}},t.unstable_scheduleCallback=function(M,H,W){var be=t.unstable_now();switch(typeof W=="object"&&W!==null?(W=W.delay,W=typeof W=="number"&&0<W?be+W:be):W=be,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=W+A,M={id:v++,callback:H,priorityLevel:M,startTime:W,expirationTime:A,sortIndex:-1},W>be?(M.sortIndex=W,s(y,M),n(m)===null&&M===n(y)&&(j?(le(re),re=-1):j=!0,Ce(z,W-be))):(M.sortIndex=A,s(m,M),B||N||(B=!0,G||(G=!0,Te()))),M},t.unstable_shouldYield=me,t.unstable_wrapCallback=function(M){var H=k;return function(){var W=k;k=H;try{return M.apply(this,arguments)}finally{k=W}}}}(Xc)),Xc}var $y;function gw(){return $y||($y=1,Zc.exports=yw()),Zc.exports}var Qc={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 Dy;function bw(){if(Dy)return wt;Dy=1;var t=rh();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 E=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:E==null?null:""+E,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,E=p(v,y.crossOrigin),k=typeof y.integrity=="string"?y.integrity:void 0,N=typeof y.fetchPriority=="string"?y.fetchPriority:void 0;v==="style"?r.d.S(m,typeof y.precedence=="string"?y.precedence:void 0,{crossOrigin:E,integrity:k,fetchPriority:N}):v==="script"&&r.d.X(m,{crossOrigin:E,integrity:k,fetchPriority:N,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,E=p(v,y.crossOrigin);r.d.L(m,v,{crossOrigin:E,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 Cy;function vw(){if(Cy)return Qc.exports;Cy=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(),Qc.exports=bw(),Qc.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 zy;function Sw(){if(zy)return na;zy=1;var t=gw(),s=rh(),n=vw();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,E=Symbol.for("react.element"),k=Symbol.for("react.transitional.element"),N=Symbol.for("react.portal"),B=Symbol.for("react.fragment"),j=Symbol.for("react.strict_mode"),X=Symbol.for("react.profiler"),F=Symbol.for("react.provider"),le=Symbol.for("react.consumer"),ve=Symbol.for("react.context"),bt=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"),me=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 Le=Symbol.for("react.client.reference");function vt(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===Le?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case B:return"Fragment";case X:return"Profiler";case j:return"StrictMode";case z:return"Suspense";case G:return"SuspenseList";case ie:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case N:return"Portal";case ve:return(e.displayName||"Context")+".Provider";case le:return(e._context.displayName||"Context")+".Consumer";case bt: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 Ce=Array.isArray,M=s.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,H=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,W={pending:!1,data:null,method:null,action:null},be=[],A=-1;function U(e){return{current:e}}function Y(e){0>A||(e.current=be[A],be[A]=null,A--)}function V(e,i){A++,be[A]=e.current,e.current=i}var P=U(null),Se=U(null),oe=U(null),Ut=U(null);function je(e,i){switch(V(oe,i),V(Se,e),V(P,null),i.nodeType){case 9:case 11:e=(e=i.documentElement)&&(e=e.namespaceURI)?Wm(e):0;break;default:if(e=i.tagName,i=i.namespaceURI)i=Wm(i),e=Pm(i,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}Y(P),V(P,e)}function In(){Y(P),Y(Se),Y(oe)}function No(e){e.memoizedState!==null&&V(Ut,e);var i=P.current,a=Pm(i,e.type);i!==a&&(V(Se,e),V(P,a))}function _a(e){Se.current===e&&(Y(P),Y(Se)),Ut.current===e&&(Y(Ut),Qr._currentValue=W)}var ko=Object.prototype.hasOwnProperty,Mo=t.unstable_scheduleCallback,$o=t.unstable_cancelCallback,_0=t.unstable_shouldYield,T0=t.unstable_requestPaint,pn=t.unstable_now,R0=t.unstable_getCurrentPriorityLevel,$h=t.unstable_ImmediatePriority,Dh=t.unstable_UserBlockingPriority,Ta=t.unstable_NormalPriority,N0=t.unstable_LowPriority,Ch=t.unstable_IdlePriority,k0=t.log,M0=t.unstable_setDisableYieldValue,sr=null,Bt=null;function Zn(e){if(typeof k0=="function"&&M0(e),Bt&&typeof Bt.setStrictMode=="function")try{Bt.setStrictMode(sr,e)}catch{}}var qt=Math.clz32?Math.clz32:C0,$0=Math.log,D0=Math.LN2;function C0(e){return e>>>=0,e===0?32:31-($0(e)/D0|0)|0}var Ra=256,Na=4194304;function Ei(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 ka(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=Ei(l):(d&=b,d!==0?u=Ei(d):a||(a=b&~e,a!==0&&(u=Ei(a))))):(b=l&~f,b!==0?u=Ei(b):d!==0?u=Ei(d):a||(a=l&~e,a!==0&&(u=Ei(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 rr(e,i){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&i)===0}function z0(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 zh(){var e=Ra;return Ra<<=1,(Ra&4194048)===0&&(Ra=256),e}function Uh(){var e=Na;return Na<<=1,(Na&62914560)===0&&(Na=4194304),e}function Do(e){for(var i=[],a=0;31>a;a++)i.push(e);return i}function ar(e,i){e.pendingLanes|=i,i!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function U0(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&&Bh(e,l,0),f!==0&&u===0&&e.tag!==0&&(e.suspendedLanes|=f&~(d&~i))}function Bh(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 qh(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 Co(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 zo(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function jh(){var e=H.p;return e!==0?e:(e=window.event,e===void 0?32:by(e.type))}function B0(e,i){var a=H.p;try{return H.p=e,i()}finally{H.p=a}}var Xn=Math.random().toString(36).slice(2),St="__reactFiber$"+Xn,kt="__reactProps$"+Xn,Pi="__reactContainer$"+Xn,Uo="__reactEvents$"+Xn,q0="__reactListeners$"+Xn,j0="__reactHandles$"+Xn,Kh="__reactResources$"+Xn,lr="__reactMarker$"+Xn;function Bo(e){delete e[St],delete e[kt],delete e[Uo],delete e[q0],delete e[j0]}function es(e){var i=e[St];if(i)return i;for(var a=e.parentNode;a;){if(i=a[Pi]||a[St]){if(a=i.alternate,i.child!==null||a!==null&&a.child!==null)for(e=iy(e);e!==null;){if(a=e[St])return a;e=iy(e)}return i}e=a,a=e.parentNode}return null}function ts(e){if(e=e[St]||e[Pi]){var i=e.tag;if(i===5||i===6||i===13||i===26||i===27||i===3)return e}return null}function or(e){var i=e.tag;if(i===5||i===26||i===27||i===6)return e.stateNode;throw Error(r(33))}function ns(e){var i=e[Kh];return i||(i=e[Kh]={hoistableStyles:new Map,hoistableScripts:new Map}),i}function rt(e){e[lr]=!0}var Lh=new Set,Hh={};function xi(e,i){is(e,i),is(e+"Capture",i)}function is(e,i){for(Hh[e]=i,e=0;e<i.length;e++)Lh.add(i[e])}var K0=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]*$"),Vh={},Gh={};function L0(e){return ko.call(Gh,e)?!0:ko.call(Vh,e)?!1:K0.test(e)?Gh[e]=!0:(Vh[e]=!0,!1)}function Ma(e,i,a){if(L0(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 $a(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 xn(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 qo,Yh;function ss(e){if(qo===void 0)try{throw Error()}catch(a){var i=a.stack.trim().match(/\n( *(at )?)/);qo=i&&i[1]||"",Yh=-1<a.stack.indexOf(`
55
- at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
56
- `+qo+e+Yh}var jo=!1;function Ko(e,i){if(!e||jo)return"";jo=!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{jo=!1,Error.prepareStackTrace=a}return(a=e?e.displayName||e.name:"")?ss(a):""}function H0(e){switch(e.tag){case 26:case 27:case 5:return ss(e.type);case 16:return ss("Lazy");case 13:return ss("Suspense");case 19:return ss("SuspenseList");case 0:case 15:return Ko(e.type,!1);case 11:return Ko(e.type.render,!1);case 1:return Ko(e.type,!0);case 31:return ss("Activity");default:return""}}function Jh(e){try{var i="";do i+=H0(e),e=e.return;while(e);return i}catch(a){return`
60
- Error generating stack: `+a.message+`
61
- `+a.stack}}function Xt(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Ih(e){var i=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(i==="checkbox"||i==="radio")}function V0(e){var i=Ih(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 Da(e){e._valueTracker||(e._valueTracker=V0(e))}function Zh(e){if(!e)return!1;var i=e._valueTracker;if(!i)return!0;var a=i.getValue(),l="";return e&&(l=Ih(e)?e.checked?"true":"false":e.value),e=l,e!==a?(i.setValue(e),!0):!1}function Ca(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 G0=/[\n"\\]/g;function Qt(e){return e.replace(G0,function(i){return"\\"+i.charCodeAt(0).toString(16)+" "})}function Lo(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=""+Xt(i)):e.value!==""+Xt(i)&&(e.value=""+Xt(i)):d!=="submit"&&d!=="reset"||e.removeAttribute("value"),i!=null?Ho(e,d,Xt(i)):a!=null?Ho(e,d,Xt(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=""+Xt(b):e.removeAttribute("name")}function Xh(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?""+Xt(a):"",i=i!=null?""+Xt(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 Ho(e,i,a){i==="number"&&Ca(e.ownerDocument)===e||e.defaultValue===""+a||(e.defaultValue=""+a)}function rs(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=""+Xt(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 Qh(e,i,a){if(i!=null&&(i=""+Xt(i),i!==e.value&&(e.value=i),a==null)){e.defaultValue!==i&&(e.defaultValue=i);return}e.defaultValue=a!=null?""+Xt(a):""}function Fh(e,i,a,l){if(i==null){if(l!=null){if(a!=null)throw Error(r(92));if(Ce(l)){if(1<l.length)throw Error(r(93));l=l[0]}a=l}a==null&&(a=""),i=a}a=Xt(i),e.defaultValue=a,l=e.textContent,l===a&&l!==""&&l!==null&&(e.value=l)}function as(e,i){if(i){var a=e.firstChild;if(a&&a===e.lastChild&&a.nodeType===3){a.nodeValue=i;return}}e.textContent=i}var Y0=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 Wh(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||Y0.has(i)?i==="float"?e.cssFloat=a:e[i]=(""+a).trim():e[i]=a+"px"}function Ph(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&&Wh(e,u,l)}else for(var f in i)i.hasOwnProperty(f)&&Wh(e,f,i[f])}function Vo(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 J0=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"]]),I0=/^[\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 za(e){return I0.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}var Go=null;function Yo(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var ls=null,os=null;function ed(e){var i=ts(e);if(i&&(e=i.stateNode)){var a=e[kt]||null;e:switch(e=i.stateNode,i.type){case"input":if(Lo(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[kt]||null;if(!u)throw Error(r(90));Lo(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&&Zh(l)}break e;case"textarea":Qh(e,a.value,a.defaultValue);break e;case"select":i=a.value,i!=null&&rs(e,!!a.multiple,i,!1)}}}var Jo=!1;function td(e,i,a){if(Jo)return e(i,a);Jo=!0;try{var l=e(i);return l}finally{if(Jo=!1,(ls!==null||os!==null)&&(Sl(),ls&&(i=ls,e=os,os=ls=null,ed(i),e)))for(i=0;i<e.length;i++)ed(e[i])}}function ur(e,i){var a=e.stateNode;if(a===null)return null;var l=a[kt]||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 On=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Io=!1;if(On)try{var cr={};Object.defineProperty(cr,"passive",{get:function(){Io=!0}}),window.addEventListener("test",cr,cr),window.removeEventListener("test",cr,cr)}catch{Io=!1}var Qn=null,Zo=null,Ua=null;function nd(){if(Ua)return Ua;var e,i=Zo,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 Ua=u.slice(e,1<l?1-l:void 0)}function Ba(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 qa(){return!0}function id(){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)?qa:id,this.isPropagationStopped=id,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=qa)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=qa)},persist:function(){},isPersistent:qa}),i}var Oi={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ja=Mt(Oi),fr=v({},Oi,{view:0,detail:0}),Z0=Mt(fr),Xo,Qo,hr,Ka=v({},fr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Wo,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!==hr&&(hr&&e.type==="mousemove"?(Xo=e.screenX-hr.screenX,Qo=e.screenY-hr.screenY):Qo=Xo=0,hr=e),Xo)},movementY:function(e){return"movementY"in e?e.movementY:Qo}}),sd=Mt(Ka),X0=v({},Ka,{dataTransfer:0}),Q0=Mt(X0),F0=v({},fr,{relatedTarget:0}),Fo=Mt(F0),W0=v({},Oi,{animationName:0,elapsedTime:0,pseudoElement:0}),P0=Mt(W0),e1=v({},Oi,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),t1=Mt(e1),n1=v({},Oi,{data:0}),rd=Mt(n1),i1={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},s1={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"},r1={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function a1(e){var i=this.nativeEvent;return i.getModifierState?i.getModifierState(e):(e=r1[e])?!!i[e]:!1}function Wo(){return a1}var l1=v({},fr,{key:function(e){if(e.key){var i=i1[e.key]||e.key;if(i!=="Unidentified")return i}return e.type==="keypress"?(e=Ba(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?s1[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Wo,charCode:function(e){return e.type==="keypress"?Ba(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Ba(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),o1=Mt(l1),u1=v({},Ka,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),ad=Mt(u1),c1=v({},fr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Wo}),f1=Mt(c1),h1=v({},Oi,{propertyName:0,elapsedTime:0,pseudoElement:0}),d1=Mt(h1),p1=v({},Ka,{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}),m1=Mt(p1),y1=v({},Oi,{newState:0,oldState:0}),g1=Mt(y1),b1=[9,13,27,32],Po=On&&"CompositionEvent"in window,dr=null;On&&"documentMode"in document&&(dr=document.documentMode);var v1=On&&"TextEvent"in window&&!dr,ld=On&&(!Po||dr&&8<dr&&11>=dr),od=" ",ud=!1;function cd(e,i){switch(e){case"keyup":return b1.indexOf(i.keyCode)!==-1;case"keydown":return i.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function fd(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var us=!1;function S1(e,i){switch(e){case"compositionend":return fd(i);case"keypress":return i.which!==32?null:(ud=!0,od);case"textInput":return e=i.data,e===od&&ud?null:e;default:return null}}function A1(e,i){if(us)return e==="compositionend"||!Po&&cd(e,i)?(e=nd(),Ua=Zo=Qn=null,us=!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 ld&&i.locale!=="ko"?null:i.data;default:return null}}var w1={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 hd(e){var i=e&&e.nodeName&&e.nodeName.toLowerCase();return i==="input"?!!w1[e.type]:i==="textarea"}function dd(e,i,a,l){ls?os?os.push(l):os=[l]:ls=l,i=_l(i,"onChange"),0<i.length&&(a=new ja("onChange","change",null,a,l),e.push({event:a,listeners:i}))}var pr=null,mr=null;function E1(e){Im(e,0)}function La(e){var i=or(e);if(Zh(i))return e}function pd(e,i){if(e==="change")return i}var md=!1;if(On){var eu;if(On){var tu="oninput"in document;if(!tu){var yd=document.createElement("div");yd.setAttribute("oninput","return;"),tu=typeof yd.oninput=="function"}eu=tu}else eu=!1;md=eu&&(!document.documentMode||9<document.documentMode)}function gd(){pr&&(pr.detachEvent("onpropertychange",bd),mr=pr=null)}function bd(e){if(e.propertyName==="value"&&La(mr)){var i=[];dd(i,mr,e,Yo(e)),td(E1,i)}}function x1(e,i,a){e==="focusin"?(gd(),pr=i,mr=a,pr.attachEvent("onpropertychange",bd)):e==="focusout"&&gd()}function O1(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return La(mr)}function _1(e,i){if(e==="click")return La(i)}function T1(e,i){if(e==="input"||e==="change")return La(i)}function R1(e,i){return e===i&&(e!==0||1/e===1/i)||e!==e&&i!==i}var jt=typeof Object.is=="function"?Object.is:R1;function yr(e,i){if(jt(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(!ko.call(i,u)||!jt(e[u],i[u]))return!1}return!0}function vd(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Sd(e,i){var a=vd(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=vd(a)}}function Ad(e,i){return e&&i?e===i?!0:e&&e.nodeType===3?!1:i&&i.nodeType===3?Ad(e,i.parentNode):"contains"in e?e.contains(i):e.compareDocumentPosition?!!(e.compareDocumentPosition(i)&16):!1:!1}function wd(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var i=Ca(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=Ca(e.document)}return i}function nu(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 N1=On&&"documentMode"in document&&11>=document.documentMode,cs=null,iu=null,gr=null,su=!1;function Ed(e,i,a){var l=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;su||cs==null||cs!==Ca(l)||(l=cs,"selectionStart"in l&&nu(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}),gr&&yr(gr,l)||(gr=l,l=_l(iu,"onSelect"),0<l.length&&(i=new ja("onSelect","select",null,i,a),e.push({event:i,listeners:l}),i.target=cs)))}function _i(e,i){var a={};return a[e.toLowerCase()]=i.toLowerCase(),a["Webkit"+e]="webkit"+i,a["Moz"+e]="moz"+i,a}var fs={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")},ru={},xd={};On&&(xd=document.createElement("div").style,"AnimationEvent"in window||(delete fs.animationend.animation,delete fs.animationiteration.animation,delete fs.animationstart.animation),"TransitionEvent"in window||delete fs.transitionend.transition);function Ti(e){if(ru[e])return ru[e];if(!fs[e])return e;var i=fs[e],a;for(a in i)if(i.hasOwnProperty(a)&&a in xd)return ru[e]=i[a];return e}var Od=Ti("animationend"),_d=Ti("animationiteration"),Td=Ti("animationstart"),k1=Ti("transitionrun"),M1=Ti("transitionstart"),$1=Ti("transitioncancel"),Rd=Ti("transitionend"),Nd=new Map,au="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(" ");au.push("scrollEnd");function on(e,i){Nd.set(e,i),xi(i,[e])}var kd=new WeakMap;function Ft(e,i){if(typeof e=="object"&&e!==null){var a=kd.get(e);return a!==void 0?a:(i={value:e,source:i,stack:Jh(i)},kd.set(e,i),i)}return{value:e,source:i,stack:Jh(i)}}var Wt=[],hs=0,lu=0;function Ha(){for(var e=hs,i=lu=hs=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&&Md(a,u,f)}}function Va(e,i,a,l){Wt[hs++]=e,Wt[hs++]=i,Wt[hs++]=a,Wt[hs++]=l,lu|=l,e.lanes|=l,e=e.alternate,e!==null&&(e.lanes|=l)}function ou(e,i,a,l){return Va(e,i,a,l),Ga(e)}function ds(e,i){return Va(e,null,null,i),Ga(e)}function Md(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 Ga(e){if(50<Hr)throw Hr=0,pc=null,Error(r(185));for(var i=e.return;i!==null;)e=i,i=e.return;return e.tag===3?e.stateNode:null}var ps={};function D1(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 Kt(e,i,a,l){return new D1(e,i,a,l)}function uu(e){return e=e.prototype,!(!e||!e.isReactComponent)}function _n(e,i){var a=e.alternate;return a===null?(a=Kt(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 $d(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 Ya(e,i,a,l,u,f){var d=0;if(l=e,typeof e=="function")uu(e)&&(d=1);else if(typeof e=="string")d=zS(e,a,P.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case ie:return e=Kt(31,a,i,u),e.elementType=ie,e.lanes=f,e;case B:return Ri(a.children,u,f,i);case j:d=8,u|=24;break;case X:return e=Kt(12,a,i,u|2),e.elementType=X,e.lanes=f,e;case z:return e=Kt(13,a,i,u),e.elementType=z,e.lanes=f,e;case G:return e=Kt(19,a,i,u),e.elementType=G,e.lanes=f,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case F:case ve:d=10;break e;case le:d=9;break e;case bt: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=Kt(d,a,i,u),i.elementType=e,i.type=l,i.lanes=f,i}function Ri(e,i,a,l){return e=Kt(7,e,l,i),e.lanes=a,e}function cu(e,i,a){return e=Kt(6,e,null,i),e.lanes=a,e}function fu(e,i,a){return i=Kt(4,e.children!==null?e.children:[],e.key,i),i.lanes=a,i.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},i}var ms=[],ys=0,Ja=null,Ia=0,Pt=[],en=0,Ni=null,Tn=1,Rn="";function ki(e,i){ms[ys++]=Ia,ms[ys++]=Ja,Ja=e,Ia=i}function Dd(e,i,a){Pt[en++]=Tn,Pt[en++]=Rn,Pt[en++]=Ni,Ni=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 hu(e){e.return!==null&&(ki(e,1),Dd(e,1,0))}function du(e){for(;e===Ja;)Ja=ms[--ys],ms[ys]=null,Ia=ms[--ys],ms[ys]=null;for(;e===Ni;)Ni=Pt[--en],Pt[en]=null,Rn=Pt[--en],Pt[en]=null,Tn=Pt[--en],Pt[en]=null}var _t=null,Ve=null,we=!1,Mi=null,mn=!1,pu=Error(r(519));function $i(e){var i=Error(r(418,""));throw Sr(Ft(i,e)),pu}function Cd(e){var i=e.stateNode,a=e.type,l=e.memoizedProps;switch(i[St]=e,i[kt]=l,a){case"dialog":pe("cancel",i),pe("close",i);break;case"iframe":case"object":case"embed":pe("load",i);break;case"video":case"audio":for(a=0;a<Gr.length;a++)pe(Gr[a],i);break;case"source":pe("error",i);break;case"img":case"image":case"link":pe("error",i),pe("load",i);break;case"details":pe("toggle",i);break;case"input":pe("invalid",i),Xh(i,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0),Da(i);break;case"select":pe("invalid",i);break;case"textarea":pe("invalid",i),Fh(i,l.value,l.defaultValue,l.children),Da(i)}a=l.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||i.textContent===""+a||l.suppressHydrationWarning===!0||Fm(i.textContent,a)?(l.popover!=null&&(pe("beforetoggle",i),pe("toggle",i)),l.onScroll!=null&&pe("scroll",i),l.onScrollEnd!=null&&pe("scrollend",i),l.onClick!=null&&(i.onclick=Tl),i=!0):i=!1,i||$i(e)}function zd(e){for(_t=e.return;_t;)switch(_t.tag){case 5:case 13:mn=!1;return;case 27:case 3:mn=!0;return;default:_t=_t.return}}function br(e){if(e!==_t)return!1;if(!we)return zd(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")||kc(e.type,e.memoizedProps)),a=!a),a&&Ve&&$i(e),zd(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){Ve=cn(e.nextSibling);break e}i--}else a!=="$"&&a!=="$!"&&a!=="$?"||i++;e=e.nextSibling}Ve=null}}else i===27?(i=Ve,hi(e.type)?(e=Cc,Cc=null,Ve=e):Ve=i):Ve=_t?cn(e.stateNode.nextSibling):null;return!0}function vr(){Ve=_t=null,we=!1}function Ud(){var e=Mi;return e!==null&&(Ct===null?Ct=e:Ct.push.apply(Ct,e),Mi=null),e}function Sr(e){Mi===null?Mi=[e]:Mi.push(e)}var mu=U(null),Di=null,Nn=null;function Fn(e,i,a){V(mu,i._currentValue),i._currentValue=a}function kn(e){e._currentValue=mu.current,Y(mu)}function yu(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 gu(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),yu(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),yu(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 Ar(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;jt(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(Qr):e=[Qr])}u=u.return}e!==null&&gu(i,e,a,l),i.flags|=262144}function Za(e){for(e=e.firstContext;e!==null;){if(!jt(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Ci(e){Di=e,Nn=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function At(e){return Bd(Di,e)}function Xa(e,i){return Di===null&&Ci(e),Bd(e,i)}function Bd(e,i){var a=i._currentValue;if(i={context:i,memoizedValue:a,next:null},Nn===null){if(e===null)throw Error(r(308));Nn=i,e.dependencies={lanes:0,firstContext:i},e.flags|=524288}else Nn=Nn.next=i;return a}var C1=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()})}},z1=t.unstable_scheduleCallback,U1=t.unstable_NormalPriority,nt={$$typeof:ve,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function bu(){return{controller:new C1,data:new Map,refCount:0}}function wr(e){e.refCount--,e.refCount===0&&z1(U1,function(){e.controller.abort()})}var Er=null,vu=0,gs=0,bs=null;function B1(e,i){if(Er===null){var a=Er=[];vu=0,gs=Ac(),bs={status:"pending",value:void 0,then:function(l){a.push(l)}}}return vu++,i.then(qd,qd),i}function qd(){if(--vu===0&&Er!==null){bs!==null&&(bs.status="fulfilled");var e=Er;Er=null,gs=0,bs=null;for(var i=0;i<e.length;i++)(0,e[i])()}}function q1(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 jd=M.S;M.S=function(e,i){typeof i=="object"&&i!==null&&typeof i.then=="function"&&B1(e,i),jd!==null&&jd(e,i)};var zi=U(null);function Su(){var e=zi.current;return e!==null?e:ze.pooledCache}function Qa(e,i){i===null?V(zi,zi.current):V(zi,i.pool)}function Kd(){var e=Su();return e===null?null:{parent:nt._currentValue,pool:e}}var xr=Error(r(460)),Ld=Error(r(474)),Fa=Error(r(542)),Au={then:function(){}};function Hd(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Wa(){}function Vd(e,i,a){switch(a=e[a],a===void 0?e.push(i):a!==i&&(i.then(Wa,Wa),i=a),i.status){case"fulfilled":return i.value;case"rejected":throw e=i.reason,Yd(e),e;default:if(typeof i.status=="string")i.then(Wa,Wa);else{if(e=ze,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,Yd(e),e}throw Or=i,xr}}var Or=null;function Gd(){if(Or===null)throw Error(r(459));var e=Or;return Or=null,e}function Yd(e){if(e===xr||e===Fa)throw Error(r(483))}var Wn=!1;function wu(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,(xe&2)!==0){var u=l.pending;return u===null?i.next=i:(i.next=u.next,u.next=i),l.pending=i,i=Ga(e),Md(e,null,a),i}return Va(e,l,i,a),Ga(e)}function _r(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,qh(e,a)}}function xu(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 Ou=!1;function Tr(){if(Ou){var e=bs;if(e!==null)throw e}}function Rr(e,i,a,l){Ou=!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?(ge&T)===T:(l&T)===T){T!==0&&T===gs&&(Ou=!0),$!==null&&($=$.next={lane:0,tag:b.tag,payload:b.payload,callback:null,next:null});e:{var se=e,ee=b;T=i;var ke=a;switch(ee.tag){case 1:if(se=ee.payload,typeof se=="function"){C=se.call(ke,C,T);break e}C=se;break e;case 3:se.flags=se.flags&-65537|128;case 0:if(se=ee.payload,T=typeof se=="function"?se.call(ke,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 Jd(e,i){if(typeof e!="function")throw Error(r(191,e));e.call(i)}function Id(e,i){var a=e.callbacks;if(a!==null)for(e.callbacks=null,e=0;e<a.length;e++)Jd(a[e],i)}var vs=U(null),Pa=U(0);function Zd(e,i){e=Bn,V(Pa,e),V(vs,i),Bn=e|i.baseLanes}function _u(){V(Pa,Bn),V(vs,vs.current)}function Tu(){Bn=Pa.current,Y(vs),Y(Pa)}var ti=0,fe=null,Re=null,Xe=null,el=!1,Ss=!1,Ui=!1,tl=0,Nr=0,As=null,j1=0;function Ie(){throw Error(r(321))}function Ru(e,i){if(i===null)return!1;for(var a=0;a<i.length&&a<e.length;a++)if(!jt(e[a],i[a]))return!1;return!0}function Nu(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?Mp:$p,Ui=!1,f=a(l,u),Ui=!1,Ss&&(f=Qd(i,a,l,u)),Xd(e),f}function Xd(e){M.H=ll;var i=Re!==null&&Re.next!==null;if(ti=0,Xe=Re=fe=null,el=!1,Nr=0,As=null,i)throw Error(r(300));e===null||at||(e=e.dependencies,e!==null&&Za(e)&&(at=!0))}function Qd(e,i,a,l){fe=e;var u=0;do{if(Ss&&(As=null),Nr=0,Ss=!1,25<=u)throw Error(r(301));if(u+=1,Xe=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=J1,f=i(a,l)}while(Ss);return f}function K1(){var e=M.H,i=e.useState()[0];return i=typeof i.then=="function"?kr(i):i,e=e.useState()[0],(Re!==null?Re.memoizedState:null)!==e&&(fe.flags|=1024),i}function ku(){var e=tl!==0;return tl=0,e}function Mu(e,i,a){i.updateQueue=e.updateQueue,i.flags&=-2053,e.lanes&=~a}function $u(e){if(el){for(e=e.memoizedState;e!==null;){var i=e.queue;i!==null&&(i.pending=null),e=e.next}el=!1}ti=0,Xe=Re=fe=null,Ss=!1,Nr=tl=0,As=null}function $t(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Xe===null?fe.memoizedState=Xe=e:Xe=Xe.next=e,Xe}function Qe(){if(Re===null){var e=fe.alternate;e=e!==null?e.memoizedState:null}else e=Re.next;var i=Xe===null?fe.memoizedState:Xe.next;if(i!==null)Xe=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},Xe===null?fe.memoizedState=Xe=e:Xe=Xe.next=e}return Xe}function Du(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function kr(e){var i=Nr;return Nr+=1,As===null&&(As=[]),e=Vd(As,e,i),i=fe,(Xe===null?i.memoizedState:Xe.next)===null&&(i=i.alternate,M.H=i===null||i.memoizedState===null?Mp:$p),e}function nl(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return kr(e);if(e.$$typeof===ve)return At(e)}throw Error(r(438,String(e)))}function Cu(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=Du(),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]=me;return i.index++,a}function Mn(e,i){return typeof i=="function"?i(e):i}function il(e){var i=Qe();return zu(i,Re,e)}function zu(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?(ge&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===gs&&($=!0);else if((ti&T)===T){_=_.next,T===gs&&($=!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,!jt(f,e.memoizedState)&&(at=!0,$&&(a=bs,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 Uu(e){var i=Qe(),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);jt(f,i.memoizedState)||(at=!0),i.memoizedState=f,i.baseQueue===null&&(i.baseState=f),a.lastRenderedState=f}return[f,l]}function Fd(e,i,a){var l=fe,u=Qe(),f=we;if(f){if(a===void 0)throw Error(r(407));a=a()}else a=i();var d=!jt((Re||u).memoizedState,a);d&&(u.memoizedState=a,at=!0),u=u.queue;var b=ep.bind(null,l,u,e);if(Mr(2048,8,b,[e]),u.getSnapshot!==i||d||Xe!==null&&Xe.memoizedState.tag&1){if(l.flags|=2048,ws(9,sl(),Pd.bind(null,l,u,a,i),null),ze===null)throw Error(r(349));f||(ti&124)!==0||Wd(l,i,a)}return a}function Wd(e,i,a){e.flags|=16384,e={getSnapshot:i,value:a},i=fe.updateQueue,i===null?(i=Du(),fe.updateQueue=i,i.stores=[e]):(a=i.stores,a===null?i.stores=[e]:a.push(e))}function Pd(e,i,a,l){i.value=a,i.getSnapshot=l,tp(i)&&np(e)}function ep(e,i,a){return a(function(){tp(i)&&np(e)})}function tp(e){var i=e.getSnapshot;e=e.value;try{var a=i();return!jt(e,a)}catch{return!0}}function np(e){var i=ds(e,2);i!==null&&Yt(i,e,2)}function Bu(e){var i=$t();if(typeof e=="function"){var a=e;if(e=a(),Ui){Zn(!0);try{a()}finally{Zn(!1)}}}return i.memoizedState=i.baseState=e,i.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Mn,lastRenderedState:e},i}function ip(e,i,a,l){return e.baseState=a,zu(e,Re,typeof l=="function"?l:Mn)}function L1(e,i,a,l,u){if(al(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,sp(i,f)):(f.next=a.next,i.pending=a.next=f)}}function sp(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),rp(e,i,b)}catch(_){qu(e,i,_)}finally{M.T=f}}else try{f=a(u,l),rp(e,i,f)}catch(_){qu(e,i,_)}}function rp(e,i,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(l){ap(e,i,l)},function(l){return qu(e,i,l)}):ap(e,i,a)}function ap(e,i,a){i.status="fulfilled",i.value=a,lp(i),e.state=a,i=e.pending,i!==null&&(a=i.next,a===i?e.pending=null:(a=a.next,i.next=a,sp(e,a)))}function qu(e,i,a){var l=e.pending;if(e.pending=null,l!==null){l=l.next;do i.status="rejected",i.reason=a,lp(i),i=i.next;while(i!==l)}e.action=null}function lp(e){e=e.listeners;for(var i=0;i<e.length;i++)(0,e[i])()}function op(e,i){return i}function up(e,i){if(we){var a=ze.formState;if(a!==null){e:{var l=fe;if(we){if(Ve){t:{for(var u=Ve,f=mn;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){Ve=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:op,lastRenderedState:i},a.queue=l,a=Rp.bind(null,fe,l),l.dispatch=a,l=Bu(!1),f=Vu.bind(null,fe,!1,l.queue),l=$t(),u={state:i,dispatch:null,action:e,pending:null},l.queue=u,a=L1.bind(null,fe,u,f,a),u.dispatch=a,l.memoizedState=e,[i,a,!1]}function cp(e){var i=Qe();return fp(i,Re,e)}function fp(e,i,a){if(i=zu(e,i,op)[0],e=il(Mn)[0],typeof i=="object"&&i!==null&&typeof i.then=="function")try{var l=kr(i)}catch(d){throw d===xr?Fa:d}else l=i;i=Qe();var u=i.queue,f=u.dispatch;return a!==i.memoizedState&&(fe.flags|=2048,ws(9,sl(),H1.bind(null,u,a),null)),[l,f,e]}function H1(e,i){e.action=i}function hp(e){var i=Qe(),a=Re;if(a!==null)return fp(i,a,e);Qe(),i=i.memoizedState,a=Qe();var l=a.queue.dispatch;return a.memoizedState=e,[i,l,!1]}function ws(e,i,a,l){return e={tag:e,create:a,deps:l,inst:i,next:null},i=fe.updateQueue,i===null&&(i=Du(),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 sl(){return{destroy:void 0,resource:void 0}}function dp(){return Qe().memoizedState}function rl(e,i,a,l){var u=$t();l=l===void 0?null:l,fe.flags|=e,u.memoizedState=ws(1|i,sl(),a,l)}function Mr(e,i,a,l){var u=Qe();l=l===void 0?null:l;var f=u.memoizedState.inst;Re!==null&&l!==null&&Ru(l,Re.memoizedState.deps)?u.memoizedState=ws(i,f,a,l):(fe.flags|=e,u.memoizedState=ws(1|i,f,a,l))}function pp(e,i){rl(8390656,8,e,i)}function mp(e,i){Mr(2048,8,e,i)}function yp(e,i){return Mr(4,2,e,i)}function gp(e,i){return Mr(4,4,e,i)}function bp(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 vp(e,i,a){a=a!=null?a.concat([e]):null,Mr(4,4,bp.bind(null,i,e),a)}function ju(){}function Sp(e,i){var a=Qe();i=i===void 0?null:i;var l=a.memoizedState;return i!==null&&Ru(i,l[1])?l[0]:(a.memoizedState=[e,i],e)}function Ap(e,i){var a=Qe();i=i===void 0?null:i;var l=a.memoizedState;if(i!==null&&Ru(i,l[1]))return l[0];if(l=e(),Ui){Zn(!0);try{e()}finally{Zn(!1)}}return a.memoizedState=[l,i],l}function Ku(e,i,a){return a===void 0||(ti&1073741824)!==0?e.memoizedState=i:(e.memoizedState=a,e=xm(),fe.lanes|=e,oi|=e,a)}function wp(e,i,a,l){return jt(a,i)?a:vs.current!==null?(e=Ku(e,a,l),jt(e,i)||(at=!0),e):(ti&42)===0?(at=!0,e.memoizedState=a):(e=xm(),fe.lanes|=e,oi|=e,i)}function Ep(e,i,a,l,u){var f=H.p;H.p=f!==0&&8>f?f:8;var d=M.T,b={};M.T=b,Vu(e,!1,i,a);try{var S=u(),_=M.S;if(_!==null&&_(b,S),S!==null&&typeof S=="object"&&typeof S.then=="function"){var $=q1(S,l);$r(e,i,$,Gt(e))}else $r(e,i,l,Gt(e))}catch(C){$r(e,i,{then:function(){},status:"rejected",reason:C},Gt())}finally{H.p=f,M.T=d}}function V1(){}function Lu(e,i,a,l){if(e.tag!==5)throw Error(r(476));var u=xp(e).queue;Ep(e,u,i,W,a===null?V1:function(){return Op(e),a(l)})}function xp(e){var i=e.memoizedState;if(i!==null)return i;i={memoizedState:W,baseState:W,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Mn,lastRenderedState:W},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 Op(e){var i=xp(e).next.queue;$r(e,i,{},Gt())}function Hu(){return At(Qr)}function _p(){return Qe().memoizedState}function Tp(){return Qe().memoizedState}function G1(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),_r(l,i,a)),i={cache:bu()},e.payload=i;return}i=i.return}}function Y1(e,i,a){var l=Gt();a={lane:l,revertLane:0,action:a,hasEagerState:!1,eagerState:null,next:null},al(e)?Np(i,a):(a=ou(e,i,a,l),a!==null&&(Yt(a,e,l),kp(a,i,l)))}function Rp(e,i,a){var l=Gt();$r(e,i,a,l)}function $r(e,i,a,l){var u={lane:l,revertLane:0,action:a,hasEagerState:!1,eagerState:null,next:null};if(al(e))Np(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,jt(b,d))return Va(e,i,u,0),ze===null&&Ha(),!1}catch{}finally{}if(a=ou(e,i,u,l),a!==null)return Yt(a,e,l),kp(a,i,l),!0}return!1}function Vu(e,i,a,l){if(l={lane:2,revertLane:Ac(),action:l,hasEagerState:!1,eagerState:null,next:null},al(e)){if(i)throw Error(r(479))}else i=ou(e,a,l,2),i!==null&&Yt(i,e,2)}function al(e){var i=e.alternate;return e===fe||i!==null&&i===fe}function Np(e,i){Ss=el=!0;var a=e.pending;a===null?i.next=i:(i.next=a.next,a.next=i),e.pending=i}function kp(e,i,a){if((a&4194048)!==0){var l=i.lanes;l&=e.pendingLanes,a|=l,i.lanes=a,qh(e,a)}}var ll={readContext:At,use:nl,useCallback:Ie,useContext:Ie,useEffect:Ie,useImperativeHandle:Ie,useLayoutEffect:Ie,useInsertionEffect:Ie,useMemo:Ie,useReducer:Ie,useRef:Ie,useState:Ie,useDebugValue:Ie,useDeferredValue:Ie,useTransition:Ie,useSyncExternalStore:Ie,useId:Ie,useHostTransitionStatus:Ie,useFormState:Ie,useActionState:Ie,useOptimistic:Ie,useMemoCache:Ie,useCacheRefresh:Ie},Mp={readContext:At,use:nl,useCallback:function(e,i){return $t().memoizedState=[e,i===void 0?null:i],e},useContext:At,useEffect:pp,useImperativeHandle:function(e,i,a){a=a!=null?a.concat([e]):null,rl(4194308,4,bp.bind(null,i,e),a)},useLayoutEffect:function(e,i){return rl(4194308,4,e,i)},useInsertionEffect:function(e,i){rl(4,2,e,i)},useMemo:function(e,i){var a=$t();i=i===void 0?null:i;var l=e();if(Ui){Zn(!0);try{e()}finally{Zn(!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){Zn(!0);try{a(i)}finally{Zn(!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=Y1.bind(null,fe,e),[l.memoizedState,e]},useRef:function(e){var i=$t();return e={current:e},i.memoizedState=e},useState:function(e){e=Bu(e);var i=e.queue,a=Rp.bind(null,fe,i);return i.dispatch=a,[e.memoizedState,a]},useDebugValue:ju,useDeferredValue:function(e,i){var a=$t();return Ku(a,e,i)},useTransition:function(){var e=Bu(!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(),ze===null)throw Error(r(349));(ge&124)!==0||Wd(l,i,a)}u.memoizedState=a;var f={value:a,getSnapshot:i};return u.queue=f,pp(ep.bind(null,l,f,e),[e]),l.flags|=2048,ws(9,sl(),Pd.bind(null,l,f,a,i),null),a},useId:function(){var e=$t(),i=ze.identifierPrefix;if(we){var a=Rn,l=Tn;a=(l&~(1<<32-qt(l)-1)).toString(32)+a,i="«"+i+"R"+a,a=tl++,0<a&&(i+="H"+a.toString(32)),i+="»"}else a=j1++,i="«"+i+"r"+a.toString(32)+"»";return e.memoizedState=i},useHostTransitionStatus:Hu,useFormState:up,useActionState:up,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=Vu.bind(null,fe,!0,a),a.dispatch=i,[e,i]},useMemoCache:Cu,useCacheRefresh:function(){return $t().memoizedState=G1.bind(null,fe)}},$p={readContext:At,use:nl,useCallback:Sp,useContext:At,useEffect:mp,useImperativeHandle:vp,useInsertionEffect:yp,useLayoutEffect:gp,useMemo:Ap,useReducer:il,useRef:dp,useState:function(){return il(Mn)},useDebugValue:ju,useDeferredValue:function(e,i){var a=Qe();return wp(a,Re.memoizedState,e,i)},useTransition:function(){var e=il(Mn)[0],i=Qe().memoizedState;return[typeof e=="boolean"?e:kr(e),i]},useSyncExternalStore:Fd,useId:_p,useHostTransitionStatus:Hu,useFormState:cp,useActionState:cp,useOptimistic:function(e,i){var a=Qe();return ip(a,Re,e,i)},useMemoCache:Cu,useCacheRefresh:Tp},J1={readContext:At,use:nl,useCallback:Sp,useContext:At,useEffect:mp,useImperativeHandle:vp,useInsertionEffect:yp,useLayoutEffect:gp,useMemo:Ap,useReducer:Uu,useRef:dp,useState:function(){return Uu(Mn)},useDebugValue:ju,useDeferredValue:function(e,i){var a=Qe();return Re===null?Ku(a,e,i):wp(a,Re.memoizedState,e,i)},useTransition:function(){var e=Uu(Mn)[0],i=Qe().memoizedState;return[typeof e=="boolean"?e:kr(e),i]},useSyncExternalStore:Fd,useId:_p,useHostTransitionStatus:Hu,useFormState:hp,useActionState:hp,useOptimistic:function(e,i){var a=Qe();return Re!==null?ip(a,Re,e,i):(a.baseState=e,[e,a.queue.dispatch])},useMemoCache:Cu,useCacheRefresh:Tp},Es=null,Dr=0;function ol(e){var i=Dr;return Dr+=1,Es===null&&(Es=[]),Vd(Es,e,i)}function Cr(e,i){i=i.props.ref,e.ref=i!==void 0?i:null}function ul(e,i){throw i.$$typeof===E?Error(r(525)):(e=Object.prototype.toString.call(i),Error(r(31,e==="[object Object]"?"object with keys {"+Object.keys(i).join(", ")+"}":e)))}function Dp(e){var i=e._init;return i(e._payload)}function Cp(e){function i(x,w){if(e){var O=x.deletions;O===null?(x.deletions=[w],x.flags|=16):O.push(w)}}function a(x,w){if(!e)return null;for(;w!==null;)i(x,w),w=w.sibling;return null}function l(x){for(var w=new Map;x!==null;)x.key!==null?w.set(x.key,x):w.set(x.index,x),x=x.sibling;return w}function u(x,w){return x=_n(x,w),x.index=0,x.sibling=null,x}function f(x,w,O){return x.index=O,e?(O=x.alternate,O!==null?(O=O.index,O<w?(x.flags|=67108866,w):O):(x.flags|=67108866,w)):(x.flags|=1048576,w)}function d(x){return e&&x.alternate===null&&(x.flags|=67108866),x}function b(x,w,O,D){return w===null||w.tag!==6?(w=cu(O,x.mode,D),w.return=x,w):(w=u(w,O),w.return=x,w)}function S(x,w,O,D){var J=O.type;return J===B?$(x,w,O.props.children,D,O.key):w!==null&&(w.elementType===J||typeof J=="object"&&J!==null&&J.$$typeof===I&&Dp(J)===w.type)?(w=u(w,O.props),Cr(w,O),w.return=x,w):(w=Ya(O.type,O.key,O.props,null,x.mode,D),Cr(w,O),w.return=x,w)}function _(x,w,O,D){return w===null||w.tag!==4||w.stateNode.containerInfo!==O.containerInfo||w.stateNode.implementation!==O.implementation?(w=fu(O,x.mode,D),w.return=x,w):(w=u(w,O.children||[]),w.return=x,w)}function $(x,w,O,D,J){return w===null||w.tag!==7?(w=Ri(O,x.mode,D,J),w.return=x,w):(w=u(w,O),w.return=x,w)}function C(x,w,O){if(typeof w=="string"&&w!==""||typeof w=="number"||typeof w=="bigint")return w=cu(""+w,x.mode,O),w.return=x,w;if(typeof w=="object"&&w!==null){switch(w.$$typeof){case k:return O=Ya(w.type,w.key,w.props,null,x.mode,O),Cr(O,w),O.return=x,O;case N:return w=fu(w,x.mode,O),w.return=x,w;case I:var D=w._init;return w=D(w._payload),C(x,w,O)}if(Ce(w)||Te(w))return w=Ri(w,x.mode,O,null),w.return=x,w;if(typeof w.then=="function")return C(x,ol(w),O);if(w.$$typeof===ve)return C(x,Xa(x,w),O);ul(x,w)}return null}function T(x,w,O,D){var J=w!==null?w.key:null;if(typeof O=="string"&&O!==""||typeof O=="number"||typeof O=="bigint")return J!==null?null:b(x,w,""+O,D);if(typeof O=="object"&&O!==null){switch(O.$$typeof){case k:return O.key===J?S(x,w,O,D):null;case N:return O.key===J?_(x,w,O,D):null;case I:return J=O._init,O=J(O._payload),T(x,w,O,D)}if(Ce(O)||Te(O))return J!==null?null:$(x,w,O,D,null);if(typeof O.then=="function")return T(x,w,ol(O),D);if(O.$$typeof===ve)return T(x,w,Xa(x,O),D);ul(x,O)}return null}function R(x,w,O,D,J){if(typeof D=="string"&&D!==""||typeof D=="number"||typeof D=="bigint")return x=x.get(O)||null,b(w,x,""+D,J);if(typeof D=="object"&&D!==null){switch(D.$$typeof){case k:return x=x.get(D.key===null?O:D.key)||null,S(w,x,D,J);case N:return x=x.get(D.key===null?O:D.key)||null,_(w,x,D,J);case I:var he=D._init;return D=he(D._payload),R(x,w,O,D,J)}if(Ce(D)||Te(D))return x=x.get(O)||null,$(w,x,D,J,null);if(typeof D.then=="function")return R(x,w,O,ol(D),J);if(D.$$typeof===ve)return R(x,w,O,Xa(w,D),J);ul(w,D)}return null}function se(x,w,O,D){for(var J=null,he=null,Q=w,te=w=0,ot=null;Q!==null&&te<O.length;te++){Q.index>te?(ot=Q,Q=null):ot=Q.sibling;var Ae=T(x,Q,O[te],D);if(Ae===null){Q===null&&(Q=ot);break}e&&Q&&Ae.alternate===null&&i(x,Q),w=f(Ae,w,te),he===null?J=Ae:he.sibling=Ae,he=Ae,Q=ot}if(te===O.length)return a(x,Q),we&&ki(x,te),J;if(Q===null){for(;te<O.length;te++)Q=C(x,O[te],D),Q!==null&&(w=f(Q,w,te),he===null?J=Q:he.sibling=Q,he=Q);return we&&ki(x,te),J}for(Q=l(Q);te<O.length;te++)ot=R(Q,x,te,O[te],D),ot!==null&&(e&&ot.alternate!==null&&Q.delete(ot.key===null?te:ot.key),w=f(ot,w,te),he===null?J=ot:he.sibling=ot,he=ot);return e&&Q.forEach(function(gi){return i(x,gi)}),we&&ki(x,te),J}function ee(x,w,O,D){if(O==null)throw Error(r(151));for(var J=null,he=null,Q=w,te=w=0,ot=null,Ae=O.next();Q!==null&&!Ae.done;te++,Ae=O.next()){Q.index>te?(ot=Q,Q=null):ot=Q.sibling;var gi=T(x,Q,Ae.value,D);if(gi===null){Q===null&&(Q=ot);break}e&&Q&&gi.alternate===null&&i(x,Q),w=f(gi,w,te),he===null?J=gi:he.sibling=gi,he=gi,Q=ot}if(Ae.done)return a(x,Q),we&&ki(x,te),J;if(Q===null){for(;!Ae.done;te++,Ae=O.next())Ae=C(x,Ae.value,D),Ae!==null&&(w=f(Ae,w,te),he===null?J=Ae:he.sibling=Ae,he=Ae);return we&&ki(x,te),J}for(Q=l(Q);!Ae.done;te++,Ae=O.next())Ae=R(Q,x,te,Ae.value,D),Ae!==null&&(e&&Ae.alternate!==null&&Q.delete(Ae.key===null?te:Ae.key),w=f(Ae,w,te),he===null?J=Ae:he.sibling=Ae,he=Ae);return e&&Q.forEach(function(IS){return i(x,IS)}),we&&ki(x,te),J}function ke(x,w,O,D){if(typeof O=="object"&&O!==null&&O.type===B&&O.key===null&&(O=O.props.children),typeof O=="object"&&O!==null){switch(O.$$typeof){case k:e:{for(var J=O.key;w!==null;){if(w.key===J){if(J=O.type,J===B){if(w.tag===7){a(x,w.sibling),D=u(w,O.props.children),D.return=x,x=D;break e}}else if(w.elementType===J||typeof J=="object"&&J!==null&&J.$$typeof===I&&Dp(J)===w.type){a(x,w.sibling),D=u(w,O.props),Cr(D,O),D.return=x,x=D;break e}a(x,w);break}else i(x,w);w=w.sibling}O.type===B?(D=Ri(O.props.children,x.mode,D,O.key),D.return=x,x=D):(D=Ya(O.type,O.key,O.props,null,x.mode,D),Cr(D,O),D.return=x,x=D)}return d(x);case N:e:{for(J=O.key;w!==null;){if(w.key===J)if(w.tag===4&&w.stateNode.containerInfo===O.containerInfo&&w.stateNode.implementation===O.implementation){a(x,w.sibling),D=u(w,O.children||[]),D.return=x,x=D;break e}else{a(x,w);break}else i(x,w);w=w.sibling}D=fu(O,x.mode,D),D.return=x,x=D}return d(x);case I:return J=O._init,O=J(O._payload),ke(x,w,O,D)}if(Ce(O))return se(x,w,O,D);if(Te(O)){if(J=Te(O),typeof J!="function")throw Error(r(150));return O=J.call(O),ee(x,w,O,D)}if(typeof O.then=="function")return ke(x,w,ol(O),D);if(O.$$typeof===ve)return ke(x,w,Xa(x,O),D);ul(x,O)}return typeof O=="string"&&O!==""||typeof O=="number"||typeof O=="bigint"?(O=""+O,w!==null&&w.tag===6?(a(x,w.sibling),D=u(w,O),D.return=x,x=D):(a(x,w),D=cu(O,x.mode,D),D.return=x,x=D),d(x)):a(x,w)}return function(x,w,O,D){try{Dr=0;var J=ke(x,w,O,D);return Es=null,J}catch(Q){if(Q===xr||Q===Fa)throw Q;var he=Kt(29,Q,null,x.mode);return he.lanes=D,he.return=x,he}finally{}}}var xs=Cp(!0),zp=Cp(!1),tn=U(null),yn=null;function ni(e){var i=e.alternate;V(it,it.current&1),V(tn,e),yn===null&&(i===null||vs.current!==null||i.memoizedState!==null)&&(yn=e)}function Up(e){if(e.tag===22){if(V(it,it.current),V(tn,e),yn===null){var i=e.alternate;i!==null&&i.memoizedState!==null&&(yn=e)}}else ii()}function ii(){V(it,it.current),V(tn,tn.current)}function $n(e){Y(tn),yn===e&&(yn=null),Y(it)}var it=U(0);function cl(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==="$?"||Dc(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 Gu(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 Yu={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),_r(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),_r(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),_r(i,e,a))}};function Bp(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?!yr(a,l)||!yr(u,f):!0}function qp(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&&Yu.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 fl=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 jp(e){fl(e)}function Kp(e){console.error(e)}function Lp(e){fl(e)}function hl(e,i){try{var a=e.onUncaughtError;a(i.value,{componentStack:i.stack})}catch(l){setTimeout(function(){throw l})}}function Hp(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 Ju(e,i,a){return a=Pn(a),a.tag=3,a.payload={element:null},a.callback=function(){hl(e,i)},a}function Vp(e){return e=Pn(e),e.tag=3,e}function Gp(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(){Hp(i,a,l)}}var d=a.stateNode;d!==null&&typeof d.componentDidCatch=="function"&&(e.callback=function(){Hp(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 I1(e,i,a,l,u){if(a.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(i=a.alternate,i!==null&&Ar(i,a,u,!0),a=tn.current,a!==null){switch(a.tag){case 13:return yn===null?yc():a.alternate===null&&Ge===0&&(Ge=3),a.flags&=-257,a.flags|=65536,a.lanes=u,l===Au?a.flags|=16384:(i=a.updateQueue,i===null?a.updateQueue=new Set([l]):i.add(l),bc(e,l,u)),!1;case 22:return a.flags|=65536,l===Au?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)),bc(e,l,u)),!1}throw Error(r(435,a.tag))}return bc(e,l,u),yc(),!1}if(we)return i=tn.current,i!==null?((i.flags&65536)===0&&(i.flags|=256),i.flags|=65536,i.lanes=u,l!==pu&&(e=Error(r(422),{cause:l}),Sr(Ft(e,a)))):(l!==pu&&(i=Error(r(423),{cause:l}),Sr(Ft(i,a))),e=e.current.alternate,e.flags|=65536,u&=-u,e.lanes|=u,l=Ft(l,a),u=Ju(e.stateNode,l,u),xu(e,u),Ge!==4&&(Ge=2)),!1;var f=Error(r(520),{cause:l});if(f=Ft(f,a),Lr===null?Lr=[f]:Lr.push(f),Ge!==4&&(Ge=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=Ju(a.stateNode,l,e),xu(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=Vp(u),Gp(u,e,a,l),xu(a,u),!1}a=a.return}while(a!==null);return!1}var Yp=Error(r(461)),at=!1;function pt(e,i,a,l){i.child=e===null?zp(i,null,a,l):xs(i,e.child,a,l)}function Jp(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=Nu(e,i,a,d,f,u),b=ku(),e!==null&&!at?(Mu(e,i,u),Dn(e,i,u)):(we&&b&&hu(i),i.flags|=1,pt(e,i,l,u),i.child)}function Ip(e,i,a,l,u){if(e===null){var f=a.type;return typeof f=="function"&&!uu(f)&&f.defaultProps===void 0&&a.compare===null?(i.tag=15,i.type=f,Zp(e,i,f,l,u)):(e=Ya(a.type,null,l,i,i.mode,u),e.ref=i.ref,e.return=i,i.child=e)}if(f=e.child,!ec(e,u)){var d=f.memoizedProps;if(a=a.compare,a=a!==null?a:yr,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 Zp(e,i,a,l,u){if(e!==null){var f=e.memoizedProps;if(yr(f,l)&&e.ref===i.ref)if(at=!1,i.pendingProps=l=f,ec(e,u))(e.flags&131072)!==0&&(at=!0);else return i.lanes=e.lanes,Dn(e,i,u)}return Iu(e,i,a,l,u)}function Xp(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 Qp(e,i,l,a)}if((a&536870912)!==0)i.memoizedState={baseLanes:0,cachePool:null},e!==null&&Qa(i,f!==null?f.cachePool:null),f!==null?Zd(i,f):_u(),Up(i);else return i.lanes=i.childLanes=536870912,Qp(e,i,f!==null?f.baseLanes|a:a,a)}else f!==null?(Qa(i,f.cachePool),Zd(i,f),ii(),i.memoizedState=null):(e!==null&&Qa(i,null),_u(),ii());return pt(e,i,u,a),i.child}function Qp(e,i,a,l){var u=Su();return u=u===null?null:{parent:nt._currentValue,pool:u},i.memoizedState={baseLanes:a,cachePool:u},e!==null&&Qa(i,null),_u(),Up(i),e!==null&&Ar(e,i,l,!0),null}function dl(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 Iu(e,i,a,l,u){return Ci(i),a=Nu(e,i,a,l,void 0,u),l=ku(),e!==null&&!at?(Mu(e,i,u),Dn(e,i,u)):(we&&l&&hu(i),i.flags|=1,pt(e,i,a,u),i.child)}function Fp(e,i,a,l,u,f){return Ci(i),i.updateQueue=null,a=Qd(i,l,a,u),Xd(e),l=ku(),e!==null&&!at?(Mu(e,i,f),Dn(e,i,f)):(we&&l&&hu(i),i.flags|=1,pt(e,i,a,f),i.child)}function Wp(e,i,a,l,u){if(Ci(i),i.stateNode===null){var f=ps,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=Yu,i.stateNode=f,f._reactInternals=i,f=i.stateNode,f.props=l,f.state=i.memoizedState,f.refs={},wu(i),d=a.contextType,f.context=typeof d=="object"&&d!==null?At(d):ps,f.state=i.memoizedState,d=a.getDerivedStateFromProps,typeof d=="function"&&(Gu(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&&Yu.enqueueReplaceState(f,f.state,null),Rr(i,l,f,u),Tr(),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=ps,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)&&qp(i,f,l,d),Wn=!1;var T=i.memoizedState;f.state=T,Rr(i,l,f,u),Tr(),_=i.memoizedState,b||T!==_||Wn?(typeof C=="function"&&(Gu(i,a,C,l),_=i.memoizedState),(S=Wn||Bp(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=ps,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)&&qp(i,f,l,S),Wn=!1,T=i.memoizedState,f.state=T,Rr(i,l,f,u),Tr();var R=i.memoizedState;d!==C||T!==R||Wn||e!==null&&e.dependencies!==null&&Za(e.dependencies)?(typeof b=="function"&&(Gu(i,a,b,l),R=i.memoizedState),($=Wn||Bp(i,a,$,l,T,R,S)||e!==null&&e.dependencies!==null&&Za(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,dl(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)):pt(e,i,a,u),i.memoizedState=f.state,e=i.child):e=Dn(e,i,u),e}function Pp(e,i,a,l){return vr(),i.flags|=256,pt(e,i,a,l),i.child}var Zu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Xu(e){return{baseLanes:e,cachePool:Kd()}}function Qu(e,i,a){return e=e!==null?e.childLanes&~a:0,i&&(e|=nn),e}function em(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:(it.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=Ve,S;if(S=b){e:{for(S=b,b=mn;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:Ni!==null?{id:Tn,overflow:Rn}:null,retryLane:536870912,hydrationErrors:null},S=Kt(18,null,null,0),S.stateNode=b,S.return=i,i.child=S,_t=i,Ve=null,S=!0):S=!1}S||$i(i)}if(b=i.memoizedState,b!==null&&(b=b.dehydrated,b!==null))return Dc(b)?i.lanes=32:i.lanes=536870912,null;$n(i)}return b=l.children,l=l.fallback,u?(ii(),u=i.mode,b=pl({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=Xu(a),u.childLanes=Qu(e,d,a),i.memoizedState=Zu,l):(ni(i),Fu(i,b))}if(S=e.memoizedState,S!==null&&(b=S.dehydrated,b!==null)){if(f)i.flags&256?(ni(i),i.flags&=-257,i=Wu(e,i,a)):i.memoizedState!==null?(ii(),i.child=e.child,i.flags|=128,i=null):(ii(),u=l.fallback,b=i.mode,l=pl({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=Xu(a),l.childLanes=Qu(e,d,a),i.memoizedState=Zu,i=u);else if(ni(i),Dc(b)){if(d=b.nextSibling&&b.nextSibling.dataset,d)var _=d.dgst;d=_,l=Error(r(419)),l.stack="",l.digest=d,Sr({value:l,source:null,stack:null}),i=Wu(e,i,a)}else if(at||Ar(e,i,a,!1),d=(a&e.childLanes)!==0,at||d){if(d=ze,d!==null&&(l=a&-a,l=(l&42)!==0?1:Co(l),l=(l&(d.suspendedLanes|a))!==0?0:l,l!==0&&l!==S.retryLane))throw S.retryLane=l,ds(e,l),Yt(d,e,l),Yp;b.data==="$?"||yc(),i=Wu(e,i,a)}else b.data==="$?"?(i.flags|=192,i.child=e.child,i=null):(e=S.treeContext,Ve=cn(b.nextSibling),_t=i,we=!0,Mi=null,mn=!1,e!==null&&(Pt[en++]=Tn,Pt[en++]=Rn,Pt[en++]=Ni,Tn=e.id,Rn=e.overflow,Ni=i),i=Fu(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=Xu(a):(S=b.cachePool,S!==null?(_=nt._currentValue,S=S.parent!==_?{parent:_,pool:_}:S):S=Kd(),b={baseLanes:b.baseLanes|a,cachePool:S}),u.memoizedState=b,u.childLanes=Qu(e,d,a),i.memoizedState=Zu,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 Fu(e,i){return i=pl({mode:"visible",children:i},e.mode),i.return=e,e.child=i}function pl(e,i){return e=Kt(22,e,null,i),e.lanes=0,e.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null},e}function Wu(e,i,a){return xs(i,e.child,null,a),e=Fu(i,i.pendingProps.children),e.flags|=2,i.memoizedState=null,e}function tm(e,i,a){e.lanes|=i;var l=e.alternate;l!==null&&(l.lanes|=i),yu(e.return,i,a)}function Pu(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 nm(e,i,a){var l=i.pendingProps,u=l.revealOrder,f=l.tail;if(pt(e,i,l.children,a),l=it.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&&tm(e,a,i);else if(e.tag===19)tm(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(V(it,l),u){case"forwards":for(a=i.child,u=null;a!==null;)e=a.alternate,e!==null&&cl(e)===null&&(u=a),a=a.sibling;a=u,a===null?(u=i.child,i.child=null):(u=a.sibling,a.sibling=null),Pu(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&&cl(e)===null){i.child=u;break}e=u.sibling,u.sibling=a,a=u,u=e}Pu(i,!0,a,null,f);break;case"together":Pu(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(Ar(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 ec(e,i){return(e.lanes&i)!==0?!0:(e=e.dependencies,!!(e!==null&&Za(e)))}function Z1(e,i,a){switch(i.tag){case 3:je(i,i.stateNode.containerInfo),Fn(i,nt,e.memoizedState.cache),vr();break;case 27:case 5:No(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?em(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||(Ar(e,i,a,!1),l=(a&i.childLanes)!==0),u){if(l)return nm(e,i,a);i.flags|=128}if(u=i.memoizedState,u!==null&&(u.rendering=null,u.tail=null,u.lastEffect=null),V(it,it.current),l)break;return null;case 22:case 23:return i.lanes=0,Xp(e,i,a);case 24:Fn(i,nt,e.memoizedState.cache)}return Dn(e,i,a)}function im(e,i,a){if(e!==null)if(e.memoizedProps!==i.pendingProps)at=!0;else{if(!ec(e,a)&&(i.flags&128)===0)return at=!1,Z1(e,i,a);at=(e.flags&131072)!==0}else at=!1,we&&(i.flags&1048576)!==0&&Dd(i,Ia,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")uu(l)?(e=Bi(l,e),i.tag=1,i=Wp(null,i,l,e,a)):(i.tag=0,i=Iu(null,i,l,e,a));else{if(l!=null){if(u=l.$$typeof,u===bt){i.tag=11,i=Jp(null,i,l,e,a);break e}else if(u===re){i.tag=14,i=Ip(null,i,l,e,a);break e}}throw i=vt(l)||l,Error(r(306,i,""))}}return i;case 0:return Iu(e,i,i.type,i.pendingProps,a);case 1:return l=i.type,u=Bi(l,i.pendingProps),Wp(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),Rr(i,l,null,a);var d=i.memoizedState;if(l=d.cache,Fn(i,nt,l),l!==f.cache&&gu(i,[nt],a,!0),Tr(),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=Pp(e,i,l,a);break e}else if(l!==u){u=Ft(Error(r(424)),i),Sr(u),i=Pp(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(Ve=cn(e.firstChild),_t=i,we=!0,Mi=null,mn=!0,a=zp(i,null,l,a),i.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if(vr(),l===u){i=Dn(e,i,a);break e}pt(e,i,l,a)}i=i.child}return i;case 26:return dl(e,i),e===null?(a=ly(i.type,null,i.pendingProps,null))?i.memoizedState=a:we||(a=i.type,e=i.pendingProps,l=Rl(oe.current).createElement(a),l[St]=i,l[kt]=e,yt(l,a,e),rt(l),i.stateNode=l):i.memoizedState=ly(i.type,e.memoizedProps,i.pendingProps,e.memoizedState),null;case 27:return No(i),e===null&&we&&(l=i.stateNode=sy(i.type,i.pendingProps,oe.current),_t=i,mn=!0,u=Ve,hi(i.type)?(Cc=u,Ve=cn(l.firstChild)):Ve=u),pt(e,i,i.pendingProps.children,a),dl(e,i),e===null&&(i.flags|=4194304),i.child;case 5:return e===null&&we&&((u=l=Ve)&&(l=wS(l,i.type,i.pendingProps,mn),l!==null?(i.stateNode=l,_t=i,Ve=cn(l.firstChild),mn=!1,u=!0):u=!1),u||$i(i)),No(i),u=i.type,f=i.pendingProps,d=e!==null?e.memoizedProps:null,l=f.children,kc(u,f)?l=null:d!==null&&kc(u,d)&&(i.flags|=32),i.memoizedState!==null&&(u=Nu(e,i,K1,null,null,a),Qr._currentValue=u),dl(e,i),pt(e,i,l,a),i.child;case 6:return e===null&&we&&((e=a=Ve)&&(a=ES(a,i.pendingProps,mn),a!==null?(i.stateNode=a,_t=i,Ve=null,e=!0):e=!1),e||$i(i)),null;case 13:return em(e,i,a);case 4:return je(i,i.stateNode.containerInfo),l=i.pendingProps,e===null?i.child=xs(i,null,l,a):pt(e,i,l,a),i.child;case 11:return Jp(e,i,i.type,i.pendingProps,a);case 7:return pt(e,i,i.pendingProps,a),i.child;case 8:return pt(e,i,i.pendingProps.children,a),i.child;case 12:return pt(e,i,i.pendingProps.children,a),i.child;case 10:return l=i.pendingProps,Fn(i,i.type,l.value),pt(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,pt(e,i,l,a),i.child;case 14:return Ip(e,i,i.type,i.pendingProps,a);case 15:return Zp(e,i,i.type,i.pendingProps,a);case 19:return nm(e,i,a);case 31:return l=i.pendingProps,a=i.mode,l={mode:l.mode,children:l.children},e===null?(a=pl(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 Xp(e,i,a);case 24:return Ci(i),l=At(nt),e===null?(u=Su(),u===null&&(u=ze,f=bu(),u.pooledCache=f,f.refCount++,f!==null&&(u.pooledCacheLanes|=a),u=f),i.memoizedState={parent:l,cache:u},wu(i),Fn(i,nt,u)):((e.lanes&a)!==0&&(Eu(e,i),Rr(i,null,null,a),Tr()),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,nt,l)):(l=f.cache,Fn(i,nt,l),l!==u.cache&&gu(i,[nt],a,!0))),pt(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 sm(e,i){if(i.type!=="stylesheet"||(i.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!hy(i)){if(i=tn.current,i!==null&&((ge&4194048)===ge?yn!==null:(ge&62914560)!==ge&&(ge&536870912)===0||i!==yn))throw Or=Au,Ld;e.flags|=8192}}function ml(e,i){i!==null&&(e.flags|=4),e.flags&16384&&(i=e.tag!==22?Uh():536870912,e.lanes|=i,Rs|=i)}function zr(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 X1(e,i,a){var l=i.pendingProps;switch(du(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),kn(nt),In(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(e===null||e.child===null)&&(br(i)?Cn(i):e===null||e.memoizedState.isDehydrated&&(i.flags&256)===0||(i.flags|=1024,Ud())),He(i),null;case 26:return a=i.memoizedState,e===null?(Cn(i),a!==null?(He(i),sm(i,a)):(He(i),i.flags&=-16777217)):a?a!==e.memoizedState?(Cn(i),He(i),sm(i,a)):(He(i),i.flags&=-16777217):(e.memoizedProps!==l&&Cn(i),He(i),i.flags&=-16777217),null;case 27:_a(i),a=oe.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=P.current,br(i)?Cd(i):(e=sy(u,l,a),i.stateNode=e,Cn(i))}return He(i),null;case 5:if(_a(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=P.current,br(i))Cd(i);else{switch(u=Rl(oe.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[kt]=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(yt(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=oe.current,br(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||Fm(e.nodeValue,a)),e||$i(i)}else e=Rl(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=br(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 vr(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;He(i),u=!1}else u=Ud(),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),ml(i,i.updateQueue),He(i),null;case 4:return In(),e===null&&Oc(i.stateNode.containerInfo),He(i),null;case 10:return kn(i.type),He(i),null;case 19:if(Y(it),u=i.memoizedState,u===null)return He(i),null;if(l=(i.flags&128)!==0,f=u.rendering,f===null)if(l)zr(u,!1);else{if(Ge!==0||e!==null&&(e.flags&128)!==0)for(e=i.child;e!==null;){if(f=cl(e),f!==null){for(i.flags|=128,zr(u,!1),e=f.updateQueue,i.updateQueue=e,ml(i,e),i.subtreeFlags=0,e=a,a=i.child;a!==null;)$d(a,e),a=a.sibling;return V(it,it.current&1|2),i.child}e=e.sibling}u.tail!==null&&pn()>bl&&(i.flags|=128,l=!0,zr(u,!1),i.lanes=4194304)}else{if(!l)if(e=cl(f),e!==null){if(i.flags|=128,l=!0,e=e.updateQueue,i.updateQueue=e,ml(i,e),zr(u,!0),u.tail===null&&u.tailMode==="hidden"&&!f.alternate&&!we)return He(i),null}else 2*pn()-u.renderingStartTime>bl&&a!==536870912&&(i.flags|=128,l=!0,zr(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=pn(),i.sibling=null,e=it.current,V(it,l?e&1|2:e&1),i):(He(i),null);case 22:case 23:return $n(i),Tu(),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&&ml(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),kn(nt),He(i),null;case 25:return null;case 30:return null}throw Error(r(156,i.tag))}function Q1(e,i){switch(du(i),i.tag){case 1:return e=i.flags,e&65536?(i.flags=e&-65537|128,i):null;case 3:return kn(nt),In(),e=i.flags,(e&65536)!==0&&(e&128)===0?(i.flags=e&-65537|128,i):null;case 26:case 27:case 5:return _a(i),null;case 13:if($n(i),e=i.memoizedState,e!==null&&e.dehydrated!==null){if(i.alternate===null)throw Error(r(340));vr()}return e=i.flags,e&65536?(i.flags=e&-65537|128,i):null;case 19:return Y(it),null;case 4:return In(),null;case 10:return kn(i.type),null;case 22:case 23:return $n(i),Tu(),e!==null&&Y(zi),e=i.flags,e&65536?(i.flags=e&-65537|128,i):null;case 24:return kn(nt),null;case 25:return null;default:return null}}function rm(e,i){switch(du(i),i.tag){case 3:kn(nt),In();break;case 26:case 27:case 5:_a(i);break;case 4:In();break;case 13:$n(i);break;case 19:Y(it);break;case 10:kn(i.type);break;case 22:case 23:$n(i),Tu(),e!==null&&Y(zi);break;case 24:kn(nt)}}function Ur(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){Me(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($){Me(u,S,$)}}}l=l.next}while(l!==f)}}catch($){Me(i,i.return,$)}}function am(e){var i=e.updateQueue;if(i!==null){var a=e.stateNode;try{Id(i,a)}catch(l){Me(e,e.return,l)}}}function lm(e,i,a){a.props=Bi(e.type,e.memoizedProps),a.state=e.memoizedState;try{a.componentWillUnmount()}catch(l){Me(e,i,l)}}function Br(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){Me(e,i,u)}}function gn(e,i){var a=e.ref,l=e.refCleanup;if(a!==null)if(typeof l=="function")try{l()}catch(u){Me(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){Me(e,i,u)}else a.current=null}function om(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){Me(e,e.return,u)}}function tc(e,i,a){try{var l=e.stateNode;gS(l,e.type,a,i),l[kt]=i}catch(u){Me(e,e.return,u)}}function um(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&hi(e.type)||e.tag===4}function nc(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||um(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 ic(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=Tl));else if(l!==4&&(l===27&&hi(e.type)&&(a=e.stateNode,i=null),e=e.child,e!==null))for(ic(e,i,a),e=e.sibling;e!==null;)ic(e,i,a),e=e.sibling}function yl(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(yl(e,i,a),e=e.sibling;e!==null;)yl(e,i,a),e=e.sibling}function cm(e){var i=e.stateNode,a=e.memoizedProps;try{for(var l=e.type,u=i.attributes;u.length;)i.removeAttributeNode(u[0]);yt(i,l,a),i[St]=e,i[kt]=a}catch(f){Me(e,e.return,f)}}var zn=!1,Ze=!1,sc=!1,fm=typeof WeakSet=="function"?WeakSet:Set,lt=null;function F1(e,i){if(e=e.containerInfo,Rc=Cl,e=wd(e),nu(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(Nc={focusedElem:e,selectionRange:a},Cl=!1,lt=i;lt!==null;)if(i=lt,e=i.child,(i.subtreeFlags&1024)!==0&&e!==null)e.return=i,lt=e;else for(;lt!==null;){switch(i=lt,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(ee){Me(a,a.return,ee)}}break;case 3:if((e&1024)!==0){if(e=i.stateNode.containerInfo,a=e.nodeType,a===9)$c(e);else if(a===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":$c(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,lt=e;break}lt=i.return}}function hm(e,i,a){var l=a.flags;switch(a.tag){case 0:case 11:case 15:ri(e,a),l&4&&Ur(5,a);break;case 1:if(ri(e,a),l&4)if(e=a.stateNode,i===null)try{e.componentDidMount()}catch(d){Me(a,a.return,d)}else{var u=Bi(a.type,i.memoizedProps);i=i.memoizedState;try{e.componentDidUpdate(u,i,e.__reactInternalSnapshotBeforeUpdate)}catch(d){Me(a,a.return,d)}}l&64&&am(a),l&512&&Br(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{Id(e,i)}catch(d){Me(a,a.return,d)}}break;case 27:i===null&&l&4&&cm(a);case 26:case 5:ri(e,a),i===null&&l&4&&om(a),l&512&&Br(a,a.return);break;case 12:ri(e,a);break;case 13:ri(e,a),l&4&&mm(e,a),l&64&&(e=a.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(a=aS.bind(null,a),xS(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 dm(e){var i=e.alternate;i!==null&&(e.alternate=null,dm(i)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(i=e.stateNode,i!==null&&Bo(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 Ke=null,Dt=!1;function Un(e,i,a){for(a=a.child;a!==null;)pm(e,i,a),a=a.sibling}function pm(e,i,a){if(Bt&&typeof Bt.onCommitFiberUnmount=="function")try{Bt.onCommitFiberUnmount(sr,a)}catch{}switch(a.tag){case 26:Ze||gn(a,i),Un(e,i,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:Ze||gn(a,i);var l=Ke,u=Dt;hi(a.type)&&(Ke=a.stateNode,Dt=!1),Un(e,i,a),Jr(a.stateNode),Ke=l,Dt=u;break;case 5:Ze||gn(a,i);case 6:if(l=Ke,u=Dt,Ke=null,Un(e,i,a),Ke=l,Dt=u,Ke!==null)if(Dt)try{(Ke.nodeType===9?Ke.body:Ke.nodeName==="HTML"?Ke.ownerDocument.body:Ke).removeChild(a.stateNode)}catch(f){Me(a,i,f)}else try{Ke.removeChild(a.stateNode)}catch(f){Me(a,i,f)}break;case 18:Ke!==null&&(Dt?(e=Ke,ny(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,a.stateNode),ea(e)):ny(Ke,a.stateNode));break;case 4:l=Ke,u=Dt,Ke=a.stateNode.containerInfo,Dt=!0,Un(e,i,a),Ke=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||(gn(a,i),l=a.stateNode,typeof l.componentWillUnmount=="function"&&lm(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 mm(e,i){if(i.memoizedState===null&&(e=i.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{ea(e)}catch(a){Me(i,i.return,a)}}function W1(e){switch(e.tag){case 13:case 19:var i=e.stateNode;return i===null&&(i=e.stateNode=new fm),i;case 22:return e=e.stateNode,i=e._retryCache,i===null&&(i=e._retryCache=new fm),i;default:throw Error(r(435,e.tag))}}function rc(e,i){var a=W1(e);i.forEach(function(l){var u=lS.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)){Ke=b.stateNode,Dt=!1;break e}break;case 5:Ke=b.stateNode,Dt=!1;break e;case 3:case 4:Ke=b.stateNode.containerInfo,Dt=!0;break e}b=b.return}if(Ke===null)throw Error(r(160));pm(f,d,u),Ke=null,Dt=!1,f=u.alternate,f!==null&&(f.return=null),u.return=null}if(i.subtreeFlags&13878)for(i=i.child;i!==null;)ym(i,e),i=i.sibling}var un=null;function ym(e,i){var a=e.alternate,l=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Lt(i,e),Ht(e),l&4&&(si(3,e,e.return),Ur(3,e),si(5,e,e.return));break;case 1:Lt(i,e),Ht(e),l&512&&(Ze||a===null||gn(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),Ht(e),l&512&&(Ze||a===null||gn(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[lr]||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"))),yt(f,l,a),f[St]=e,rt(f),l=f;break e;case"link":var d=cy("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),yt(f,l,a),u.head.appendChild(f);break;case"meta":if(d=cy("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),yt(f,l,a),u.head.appendChild(f);break;default:throw Error(r(468,l))}f[St]=e,rt(f),l=f}e.stateNode=l}else fy(u,e.type,e.stateNode);else e.stateNode=uy(u,l,e.memoizedProps);else f!==l?(f===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):f.count--,l===null?fy(u,e.type,e.stateNode):uy(u,l,e.memoizedProps)):l===null&&e.stateNode!==null&&tc(e,e.memoizedProps,a.memoizedProps)}break;case 27:Lt(i,e),Ht(e),l&512&&(Ze||a===null||gn(a,a.return)),a!==null&&l&4&&tc(e,e.memoizedProps,a.memoizedProps);break;case 5:if(Lt(i,e),Ht(e),l&512&&(Ze||a===null||gn(a,a.return)),e.flags&32){u=e.stateNode;try{as(u,"")}catch(R){Me(e,e.return,R)}}l&4&&e.stateNode!=null&&(u=e.memoizedProps,tc(e,u,a!==null?a.memoizedProps:u)),l&1024&&(sc=!0);break;case 6:if(Lt(i,e),Ht(e),l&4){if(e.stateNode===null)throw Error(r(162));l=e.memoizedProps,a=e.stateNode;try{a.nodeValue=l}catch(R){Me(e,e.return,R)}}break;case 3:if(Ml=null,u=un,un=Nl(i.containerInfo),Lt(i,e),un=u,Ht(e),l&4&&a!==null&&a.memoizedState.isDehydrated)try{ea(i.containerInfo)}catch(R){Me(e,e.return,R)}sc&&(sc=!1,gm(e));break;case 4:l=un,un=Nl(e.stateNode.containerInfo),Lt(i,e),Ht(e),un=l;break;case 12:Lt(i,e),Ht(e);break;case 13:Lt(i,e),Ht(e),e.child.flags&8192&&e.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(fc=pn()),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,rc(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=_,Ht(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){Me(S,S.return,R)}}}else if(i.tag===6){if(a===null){S=i;try{S.stateNode.nodeValue=u?"":S.memoizedProps}catch(R){Me(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,rc(e,a))));break;case 19:Lt(i,e),Ht(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,rc(e,l)));break;case 30:break;case 21:break;default:Lt(i,e),Ht(e)}}function Ht(e){var i=e.flags;if(i&2){try{for(var a,l=e.return;l!==null;){if(um(l)){a=l;break}l=l.return}if(a==null)throw Error(r(160));switch(a.tag){case 27:var u=a.stateNode,f=nc(e);yl(e,f,u);break;case 5:var d=a.stateNode;a.flags&32&&(as(d,""),a.flags&=-33);var b=nc(e);yl(e,b,d);break;case 3:case 4:var S=a.stateNode.containerInfo,_=nc(e);ic(e,_,S);break;default:throw Error(r(161))}}catch($){Me(e,e.return,$)}e.flags&=-3}i&4096&&(e.flags&=-4097)}function gm(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var i=e;gm(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;)hm(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:gn(i,i.return);var a=i.stateNode;typeof a.componentWillUnmount=="function"&&lm(i,i.return,a),qi(i);break;case 27:Jr(i.stateNode);case 26:case 5:gn(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),Ur(4,f);break;case 1:if(ai(u,f,a),l=f,u=l.stateNode,typeof u.componentDidMount=="function")try{u.componentDidMount()}catch(_){Me(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++)Jd(S[u],b)}catch(_){Me(l,l.return,_)}}a&&d&64&&am(f),Br(f,f.return);break;case 27:cm(f);case 26:case 5:ai(u,f,a),a&&l===null&&d&4&&om(f),Br(f,f.return);break;case 12:ai(u,f,a);break;case 13:ai(u,f,a),a&&d&4&&mm(u,f);break;case 22:f.memoizedState===null&&ai(u,f,a),Br(f,f.return);break;case 30:break;default:ai(u,f,a)}i=i.sibling}}function ac(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&&wr(a))}function lc(e,i){e=null,i.alternate!==null&&(e=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==e&&(i.refCount++,e!=null&&wr(e))}function bn(e,i,a,l){if(i.subtreeFlags&10256)for(i=i.child;i!==null;)bm(e,i,a,l),i=i.sibling}function bm(e,i,a,l){var u=i.flags;switch(i.tag){case 0:case 11:case 15:bn(e,i,a,l),u&2048&&Ur(9,i);break;case 1:bn(e,i,a,l);break;case 3:bn(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&&wr(e)));break;case 12:if(u&2048){bn(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){Me(i,i.return,S)}}else bn(e,i,a,l);break;case 13:bn(e,i,a,l);break;case 23:break;case 22:f=i.stateNode,d=i.alternate,i.memoizedState!==null?f._visibility&2?bn(e,i,a,l):qr(e,i):f._visibility&2?bn(e,i,a,l):(f._visibility|=2,Os(e,i,a,l,(i.subtreeFlags&10256)!==0)),u&2048&&ac(d,i);break;case 24:bn(e,i,a,l),u&2048&&lc(i.alternate,i);break;default:bn(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),Ur(8,d);break;case 23:break;case 22:var $=d.stateNode;d.memoizedState!==null?$._visibility&2?Os(f,d,b,S,u):qr(f,d):($._visibility|=2,Os(f,d,b,S,u)),u&&_&2048&&ac(d.alternate,d);break;case 24:Os(f,d,b,S,u),u&&_&2048&&lc(d.alternate,d);break;default:Os(f,d,b,S,u)}i=i.sibling}}function qr(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:qr(a,l),u&2048&&ac(l.alternate,l);break;case 24:qr(a,l),u&2048&&lc(l.alternate,l);break;default:qr(a,l)}i=i.sibling}}var jr=8192;function _s(e){if(e.subtreeFlags&jr)for(e=e.child;e!==null;)vm(e),e=e.sibling}function vm(e){switch(e.tag){case 26:_s(e),e.flags&jr&&e.memoizedState!==null&&BS(un,e.memoizedState,e.memoizedProps);break;case 5:_s(e);break;case 3:case 4:var i=un;un=Nl(e.stateNode.containerInfo),_s(e),un=i;break;case 22:e.memoizedState===null&&(i=e.alternate,i!==null&&i.memoizedState!==null?(i=jr,jr=16777216,_s(e),jr=i):_s(e));break;default:_s(e)}}function Sm(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 Kr(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];lt=l,wm(l,e)}Sm(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Am(e),e=e.sibling}function Am(e){switch(e.tag){case 0:case 11:case 15:Kr(e),e.flags&2048&&si(9,e,e.return);break;case 3:Kr(e);break;case 12:Kr(e);break;case 22:var i=e.stateNode;e.memoizedState!==null&&i._visibility&2&&(e.return===null||e.return.tag!==13)?(i._visibility&=-3,gl(e)):Kr(e);break;default:Kr(e)}}function gl(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];lt=l,wm(l,e)}Sm(e)}for(e=e.child;e!==null;){switch(i=e,i.tag){case 0:case 11:case 15:si(8,i,i.return),gl(i);break;case 22:a=i.stateNode,a._visibility&2&&(a._visibility&=-3,gl(i));break;default:gl(i)}e=e.sibling}}function wm(e,i){for(;lt!==null;){var a=lt;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:wr(a.memoizedState.cache)}if(l=a.child,l!==null)l.return=a,lt=l;else e:for(a=e;lt!==null;){l=lt;var u=l.sibling,f=l.return;if(dm(l),l===a){lt=null;break e}if(u!==null){u.return=f,lt=u;break e}lt=f}}}var P1={getCacheForType:function(e){var i=At(nt),a=i.data.get(e);return a===void 0&&(a=e(),i.data.set(e,a)),a}},eS=typeof WeakMap=="function"?WeakMap:Map,xe=0,ze=null,de=null,ge=0,Oe=0,Vt=null,li=!1,Ts=!1,oc=!1,Bn=0,Ge=0,oi=0,ji=0,uc=0,nn=0,Rs=0,Lr=null,Ct=null,cc=!1,fc=0,bl=1/0,vl=null,ui=null,mt=0,ci=null,Ns=null,ks=0,hc=0,dc=null,Em=null,Hr=0,pc=null;function Gt(){if((xe&2)!==0&&ge!==0)return ge&-ge;if(M.T!==null){var e=gs;return e!==0?e:Ac()}return jh()}function xm(){nn===0&&(nn=(ge&536870912)===0||we?zh():536870912);var e=tn.current;return e!==null&&(e.flags|=32),nn}function Yt(e,i,a){(e===ze&&(Oe===2||Oe===9)||e.cancelPendingCommit!==null)&&(Ms(e,0),fi(e,ge,nn,!1)),ar(e,a),((xe&2)===0||e!==ze)&&(e===ze&&((xe&2)===0&&(ji|=a),Ge===4&&fi(e,ge,nn,!1)),vn(e))}function Om(e,i,a){if((xe&6)!==0)throw Error(r(327));var l=!a&&(i&124)===0&&(i&e.expiredLanes)===0||rr(e,i),u=l?iS(e,i):gc(e,i,!0),f=l;do{if(u===0){Ts&&!l&&fi(e,i,0,!1);break}else{if(a=e.current.alternate,f&&!tS(a)){u=gc(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=Lr;var S=b.current.memoizedState.isDehydrated;if(S&&(Ms(b,d).flags|=256),d=gc(b,d,!1),d!==2){if(oc&&!S){b.errorRecoveryDisabledLanes|=f,ji|=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){Ms(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=fc+300-pn(),10<u)){if(fi(l,i,nn,!li),ka(l,0,!0)!==0)break e;l.timeoutHandle=ey(_m.bind(null,l,a,Ct,vl,cc,i,nn,ji,Rs,li,f,2,-0,0),u);break e}_m(l,a,Ct,vl,cc,i,nn,ji,Rs,li,f,0,-0,0)}}break}while(!0);vn(e)}function _m(e,i,a,l,u,f,d,b,S,_,$,C,T,R){if(e.timeoutHandle=-1,C=i.subtreeFlags,(C&8192||(C&16785408)===16785408)&&(Xr={stylesheets:null,count:0,unsuspend:US},vm(i),C=qS(),C!==null)){e.cancelPendingCommit=C(Dm.bind(null,e,i,f,a,l,u,d,b,S,$,1,T,R)),fi(e,f,d,!_);return}Dm(e,i,f,a,l,u,d,b,S)}function tS(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(!jt(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&=~uc,i&=~ji,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&&Bh(e,a,i)}function Sl(){return(xe&6)===0?(Vr(0),!1):!0}function mc(){if(de!==null){if(Oe===0)var e=de.return;else e=de,Nn=Di=null,$u(e),Es=null,Dr=0,e=de;for(;e!==null;)rm(e.alternate,e),e=e.return;de=null}}function Ms(e,i){var a=e.timeoutHandle;a!==-1&&(e.timeoutHandle=-1,vS(a)),a=e.cancelPendingCommit,a!==null&&(e.cancelPendingCommit=null,a()),mc(),ze=e,de=a=_n(e.current,null),ge=i,Oe=0,Vt=null,li=!1,Ts=rr(e,i),oc=!1,Rs=nn=uc=ji=oi=Ge=0,Ct=Lr=null,cc=!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,Ha(),a}function Tm(e,i){fe=null,M.H=ll,i===xr||i===Fa?(i=Gd(),Oe=3):i===Ld?(i=Gd(),Oe=4):Oe=i===Yp?8:i!==null&&typeof i=="object"&&typeof i.then=="function"?6:1,Vt=i,de===null&&(Ge=1,hl(e,Ft(i,e.current)))}function Rm(){var e=M.H;return M.H=ll,e===null?ll:e}function Nm(){var e=M.A;return M.A=P1,e}function yc(){Ge=4,li||(ge&4194048)!==ge&&tn.current!==null||(Ts=!0),(oi&134217727)===0&&(ji&134217727)===0||ze===null||fi(ze,ge,nn,!1)}function gc(e,i,a){var l=xe;xe|=2;var u=Rm(),f=Nm();(ze!==e||ge!==i)&&(vl=null,Ms(e,i)),i=!1;var d=Ge;e:do try{if(Oe!==0&&de!==null){var b=de,S=Vt;switch(Oe){case 8:mc(),d=6;break e;case 3:case 2:case 9:case 6:tn.current===null&&(i=!0);var _=Oe;if(Oe=0,Vt=null,$s(e,b,S,_),a&&Ts){d=0;break e}break;default:_=Oe,Oe=0,Vt=null,$s(e,b,S,_)}}nS(),d=Ge;break}catch($){Tm(e,$)}while(!0);return i&&e.shellSuspendCounter++,Nn=Di=null,xe=l,M.H=u,M.A=f,de===null&&(ze=null,ge=0,Ha()),d}function nS(){for(;de!==null;)km(de)}function iS(e,i){var a=xe;xe|=2;var l=Rm(),u=Nm();ze!==e||ge!==i?(vl=null,bl=pn()+500,Ms(e,i)):Ts=rr(e,i);e:do try{if(Oe!==0&&de!==null){i=de;var f=Vt;t:switch(Oe){case 1:Oe=0,Vt=null,$s(e,i,f,1);break;case 2:case 9:if(Hd(f)){Oe=0,Vt=null,Mm(i);break}i=function(){Oe!==2&&Oe!==9||ze!==e||(Oe=7),vn(e)},f.then(i,i);break e;case 3:Oe=7;break e;case 4:Oe=5;break e;case 7:Hd(f)?(Oe=0,Vt=null,Mm(i)):(Oe=0,Vt=null,$s(e,i,f,7));break;case 5:var d=null;switch(de.tag){case 26:d=de.memoizedState;case 5:case 27:var b=de;if(!d||hy(d)){Oe=0,Vt=null;var S=b.sibling;if(S!==null)de=S;else{var _=b.return;_!==null?(de=_,Al(_)):de=null}break t}}Oe=0,Vt=null,$s(e,i,f,5);break;case 6:Oe=0,Vt=null,$s(e,i,f,6);break;case 8:mc(),Ge=6;break e;default:throw Error(r(462))}}sS();break}catch($){Tm(e,$)}while(!0);return Nn=Di=null,M.H=l,M.A=u,xe=a,de!==null?0:(ze=null,ge=0,Ha(),Ge)}function sS(){for(;de!==null&&!_0();)km(de)}function km(e){var i=im(e.alternate,e,Bn);e.memoizedProps=e.pendingProps,i===null?Al(e):de=i}function Mm(e){var i=e,a=i.alternate;switch(i.tag){case 15:case 0:i=Fp(a,i,i.pendingProps,i.type,void 0,ge);break;case 11:i=Fp(a,i,i.pendingProps,i.type.render,i.ref,ge);break;case 5:$u(i);default:rm(a,i),i=de=$d(i,Bn),i=im(a,i,Bn)}e.memoizedProps=e.pendingProps,i===null?Al(e):de=i}function $s(e,i,a,l){Nn=Di=null,$u(i),Es=null,Dr=0;var u=i.return;try{if(I1(e,u,i,a,ge)){Ge=1,hl(e,Ft(a,e.current)),de=null;return}}catch(f){if(u!==null)throw de=u,f;Ge=1,hl(e,Ft(a,e.current)),de=null;return}i.flags&32768?(we||l===1?e=!0:Ts||(ge&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))),$m(i,e)):Al(i)}function Al(e){var i=e;do{if((i.flags&32768)!==0){$m(i,li);return}e=i.return;var a=X1(i.alternate,i,Bn);if(a!==null){de=a;return}if(i=i.sibling,i!==null){de=i;return}de=i=e}while(i!==null);Ge===0&&(Ge=5)}function $m(e,i){do{var a=Q1(e.alternate,e);if(a!==null){a.flags&=32767,de=a;return}if(a=e.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!i&&(e=e.sibling,e!==null)){de=e;return}de=e=a}while(e!==null);Ge=6,de=null}function Dm(e,i,a,l,u,f,d,b,S){e.cancelPendingCommit=null;do wl();while(mt!==0);if((xe&6)!==0)throw Error(r(327));if(i!==null){if(i===e.current)throw Error(r(177));if(f=i.lanes|i.childLanes,f|=lu,U0(e,a,f,d,b,S),e===ze&&(de=ze=null,ge=0),Ns=i,ci=e,ks=a,hc=f,dc=u,Em=l,(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,oS(Ta,function(){return qm(),null})):(e.callbackNode=null,e.callbackPriority=0),l=(i.flags&13878)!==0,(i.subtreeFlags&13878)!==0||l){l=M.T,M.T=null,u=H.p,H.p=2,d=xe,xe|=4;try{F1(e,i,a)}finally{xe=d,H.p=u,M.T=l}}mt=1,Cm(),zm(),Um()}}function Cm(){if(mt===1){mt=0;var e=ci,i=Ns,a=(i.flags&13878)!==0;if((i.subtreeFlags&13878)!==0||a){a=M.T,M.T=null;var l=H.p;H.p=2;var u=xe;xe|=4;try{ym(i,e);var f=Nc,d=wd(e.containerInfo),b=f.focusedElem,S=f.selectionRange;if(d!==b&&b&&b.ownerDocument&&Ad(b.ownerDocument.documentElement,b)){if(S!==null&&nu(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,ee=Math.min(S.start,se),ke=S.end===void 0?ee:Math.min(S.end,se);!R.extend&&ee>ke&&(d=ke,ke=ee,ee=d);var x=Sd(b,ee),w=Sd(b,ke);if(x&&w&&(R.rangeCount!==1||R.anchorNode!==x.node||R.anchorOffset!==x.offset||R.focusNode!==w.node||R.focusOffset!==w.offset)){var O=C.createRange();O.setStart(x.node,x.offset),R.removeAllRanges(),ee>ke?(R.addRange(O),R.extend(w.node,w.offset)):(O.setEnd(w.node,w.offset),R.addRange(O))}}}}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}}Cl=!!Rc,Nc=Rc=null}finally{xe=u,H.p=l,M.T=a}}e.current=i,mt=2}}function zm(){if(mt===2){mt=0;var e=ci,i=Ns,a=(i.flags&8772)!==0;if((i.subtreeFlags&8772)!==0||a){a=M.T,M.T=null;var l=H.p;H.p=2;var u=xe;xe|=4;try{hm(e,i.alternate,i)}finally{xe=u,H.p=l,M.T=a}}mt=3}}function Um(){if(mt===4||mt===3){mt=0,T0();var e=ci,i=Ns,a=ks,l=Em;(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?mt=5:(mt=0,Ns=ci=null,Bm(e,e.pendingLanes));var u=e.pendingLanes;if(u===0&&(ui=null),zo(a),i=i.stateNode,Bt&&typeof Bt.onCommitFiberRoot=="function")try{Bt.onCommitFiberRoot(sr,i,void 0,(i.current.flags&128)===128)}catch{}if(l!==null){i=M.T,u=H.p,H.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,H.p=u}}(ks&3)!==0&&wl(),vn(e),u=e.pendingLanes,(a&4194090)!==0&&(u&42)!==0?e===pc?Hr++:(Hr=0,pc=e):Hr=0,Vr(0)}}function Bm(e,i){(e.pooledCacheLanes&=i)===0&&(i=e.pooledCache,i!=null&&(e.pooledCache=null,wr(i)))}function wl(e){return Cm(),zm(),Um(),qm()}function qm(){if(mt!==5)return!1;var e=ci,i=hc;hc=0;var a=zo(ks),l=M.T,u=H.p;try{H.p=32>a?32:a,M.T=null,a=dc,dc=null;var f=ci,d=ks;if(mt=0,Ns=ci=null,ks=0,(xe&6)!==0)throw Error(r(331));var b=xe;if(xe|=4,Am(f.current),bm(f,f.current,d,a),xe=b,Vr(0,!1),Bt&&typeof Bt.onPostCommitFiberRoot=="function")try{Bt.onPostCommitFiberRoot(sr,f)}catch{}return!0}finally{H.p=u,M.T=l,Bm(e,i)}}function jm(e,i,a){i=Ft(a,i),i=Ju(e.stateNode,i,2),e=ei(e,i,2),e!==null&&(ar(e,2),vn(e))}function Me(e,i,a){if(e.tag===3)jm(e,e,a);else for(;i!==null;){if(i.tag===3){jm(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=Vp(2),l=ei(i,a,2),l!==null&&(Gp(a,l,i,e),ar(l,2),vn(l));break}}i=i.return}}function bc(e,i,a){var l=e.pingCache;if(l===null){l=e.pingCache=new eS;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)||(oc=!0,u.add(a),e=rS.bind(null,e,i,a),i.then(e,e))}function rS(e,i,a){var l=e.pingCache;l!==null&&l.delete(i),e.pingedLanes|=e.suspendedLanes&a,e.warmLanes&=~a,ze===e&&(ge&a)===a&&(Ge===4||Ge===3&&(ge&62914560)===ge&&300>pn()-fc?(xe&2)===0&&Ms(e,0):uc|=a,Rs===ge&&(Rs=0)),vn(e)}function Km(e,i){i===0&&(i=Uh()),e=ds(e,i),e!==null&&(ar(e,i),vn(e))}function aS(e){var i=e.memoizedState,a=0;i!==null&&(a=i.retryLane),Km(e,a)}function lS(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),Km(e,a)}function oS(e,i){return Mo(e,i)}var El=null,Ds=null,vc=!1,xl=!1,Sc=!1,Ki=0;function vn(e){e!==Ds&&e.next===null&&(Ds===null?El=Ds=e:Ds=Ds.next=e),xl=!0,vc||(vc=!0,cS())}function Vr(e,i){if(!Sc&&xl){Sc=!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,Gm(l,f))}else f=ge,f=ka(l,l===ze?f:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(f&3)===0||rr(l,f)||(a=!0,Gm(l,f));l=l.next}while(a);Sc=!1}}function uS(){Lm()}function Lm(){xl=vc=!1;var e=0;Ki!==0&&(bS()&&(e=Ki),Ki=0);for(var i=pn(),a=null,l=El;l!==null;){var u=l.next,f=Hm(l,i);f===0?(l.next=null,a===null?El=u:a.next=u,u===null&&(Ds=a)):(a=l,(e!==0||(f&3)!==0)&&(xl=!0)),l=u}Vr(e)}function Hm(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]=z0(b,i)):S<=i&&(e.expiredLanes|=b),f&=~b}if(i=ze,a=ge,a=ka(e,e===i?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l=e.callbackNode,a===0||e===i&&(Oe===2||Oe===9)||e.cancelPendingCommit!==null)return l!==null&&l!==null&&$o(l),e.callbackNode=null,e.callbackPriority=0;if((a&3)===0||rr(e,a)){if(i=a&-a,i===e.callbackPriority)return i;switch(l!==null&&$o(l),zo(a)){case 2:case 8:a=Dh;break;case 32:a=Ta;break;case 268435456:a=Ch;break;default:a=Ta}return l=Vm.bind(null,e),a=Mo(a,l),e.callbackPriority=i,e.callbackNode=a,i}return l!==null&&l!==null&&$o(l),e.callbackPriority=2,e.callbackNode=null,2}function Vm(e,i){if(mt!==0&&mt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var a=e.callbackNode;if(wl()&&e.callbackNode!==a)return null;var l=ge;return l=ka(e,e===ze?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l===0?null:(Om(e,l,i),Hm(e,pn()),e.callbackNode!=null&&e.callbackNode===a?Vm.bind(null,e):null)}function Gm(e,i){if(wl())return null;Om(e,i,!0)}function cS(){SS(function(){(xe&6)!==0?Mo($h,uS):Lm()})}function Ac(){return Ki===0&&(Ki=zh()),Ki}function Ym(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:za(""+e)}function Jm(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 fS(e,i,a,l,u){if(i==="submit"&&a&&a.stateNode===u){var f=Ym((u[kt]||null).action),d=l.submitter;d&&(i=(i=d[kt]||null)?Ym(i.formAction):d.getAttribute("formAction"),i!==null&&(f=i,d=null));var b=new ja("action","action",null,l,u);e.push({event:b,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(Ki!==0){var S=d?Jm(u,d):new FormData(u);Lu(a,{pending:!0,data:S,method:u.method,action:f},null,S)}}else typeof f=="function"&&(b.preventDefault(),S=d?Jm(u,d):new FormData(u),Lu(a,{pending:!0,data:S,method:u.method,action:f},f,S))},currentTarget:u}]})}}for(var wc=0;wc<au.length;wc++){var Ec=au[wc],hS=Ec.toLowerCase(),dS=Ec[0].toUpperCase()+Ec.slice(1);on(hS,"on"+dS)}on(Od,"onAnimationEnd"),on(_d,"onAnimationIteration"),on(Td,"onAnimationStart"),on("dblclick","onDoubleClick"),on("focusin","onFocus"),on("focusout","onBlur"),on(k1,"onTransitionRun"),on(M1,"onTransitionStart"),on($1,"onTransitionCancel"),on(Rd,"onTransitionEnd"),is("onMouseEnter",["mouseout","mouseover"]),is("onMouseLeave",["mouseout","mouseover"]),is("onPointerEnter",["pointerout","pointerover"]),is("onPointerLeave",["pointerout","pointerover"]),xi("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),xi("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),xi("onBeforeInput",["compositionend","keypress","textInput","paste"]),xi("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),xi("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),xi("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Gr="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(" "),pS=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Gr));function Im(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($){fl($)}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($){fl($)}u.currentTarget=null,f=S}}}}function pe(e,i){var a=i[Uo];a===void 0&&(a=i[Uo]=new Set);var l=e+"__bubble";a.has(l)||(Zm(i,e,2,!1),a.add(l))}function xc(e,i,a){var l=0;i&&(l|=4),Zm(a,e,l,i)}var Ol="_reactListening"+Math.random().toString(36).slice(2);function Oc(e){if(!e[Ol]){e[Ol]=!0,Lh.forEach(function(a){a!=="selectionchange"&&(pS.has(a)||xc(a,!1,e),xc(a,!0,e))});var i=e.nodeType===9?e:e.ownerDocument;i===null||i[Ol]||(i[Ol]=!0,xc("selectionchange",!1,i))}}function Zm(e,i,a,l){switch(by(i)){case 2:var u=LS;break;case 8:u=HS;break;default:u=jc}a=u.bind(null,i,a,e),u=void 0,!Io||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 _c(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=es(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}td(function(){var _=f,$=Yo(a),C=[];e:{var T=Nd.get(e);if(T!==void 0){var R=ja,se=e;switch(e){case"keypress":if(Ba(a)===0)break e;case"keydown":case"keyup":R=o1;break;case"focusin":se="focus",R=Fo;break;case"focusout":se="blur",R=Fo;break;case"beforeblur":case"afterblur":R=Fo;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=sd;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":R=Q0;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":R=f1;break;case Od:case _d:case Td:R=P0;break;case Rd:R=d1;break;case"scroll":case"scrollend":R=Z0;break;case"wheel":R=m1;break;case"copy":case"cut":case"paste":R=t1;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":R=ad;break;case"toggle":case"beforetoggle":R=g1}var ee=(i&4)!==0,ke=!ee&&(e==="scroll"||e==="scrollend"),x=ee?T!==null?T+"Capture":null:T;ee=[];for(var w=_,O;w!==null;){var D=w;if(O=D.stateNode,D=D.tag,D!==5&&D!==26&&D!==27||O===null||x===null||(D=ur(w,x),D!=null&&ee.push(Yr(w,D,O))),ke)break;w=w.return}0<ee.length&&(T=new R(T,se,null,a,$),C.push({event:T,listeners:ee}))}}if((i&7)===0){e:{if(T=e==="mouseover"||e==="pointerover",R=e==="mouseout"||e==="pointerout",T&&a!==Go&&(se=a.relatedTarget||a.fromElement)&&(es(se)||se[Pi]))break e;if((R||T)&&(T=$.window===$?$:(T=$.ownerDocument)?T.defaultView||T.parentWindow:window,R?(se=a.relatedTarget||a.toElement,R=_,se=se?es(se):null,se!==null&&(ke=c(se),ee=se.tag,se!==ke||ee!==5&&ee!==27&&ee!==6)&&(se=null)):(R=null,se=_),R!==se)){if(ee=sd,D="onMouseLeave",x="onMouseEnter",w="mouse",(e==="pointerout"||e==="pointerover")&&(ee=ad,D="onPointerLeave",x="onPointerEnter",w="pointer"),ke=R==null?T:or(R),O=se==null?T:or(se),T=new ee(D,w+"leave",R,a,$),T.target=ke,T.relatedTarget=O,D=null,es($)===_&&(ee=new ee(x,w+"enter",se,a,$),ee.target=O,ee.relatedTarget=ke,D=ee),ke=D,R&&se)t:{for(ee=R,x=se,w=0,O=ee;O;O=Cs(O))w++;for(O=0,D=x;D;D=Cs(D))O++;for(;0<w-O;)ee=Cs(ee),w--;for(;0<O-w;)x=Cs(x),O--;for(;w--;){if(ee===x||x!==null&&ee===x.alternate)break t;ee=Cs(ee),x=Cs(x)}ee=null}else ee=null;R!==null&&Xm(C,T,R,ee,!1),se!==null&&ke!==null&&Xm(C,ke,se,ee,!0)}}e:{if(T=_?or(_):window,R=T.nodeName&&T.nodeName.toLowerCase(),R==="select"||R==="input"&&T.type==="file")var J=pd;else if(hd(T))if(md)J=T1;else{J=O1;var he=x1}else R=T.nodeName,!R||R.toLowerCase()!=="input"||T.type!=="checkbox"&&T.type!=="radio"?_&&Vo(_.elementType)&&(J=pd):J=_1;if(J&&(J=J(e,_))){dd(C,J,a,$);break e}he&&he(e,T,_),e==="focusout"&&_&&T.type==="number"&&_.memoizedProps.value!=null&&Ho(T,"number",T.value)}switch(he=_?or(_):window,e){case"focusin":(hd(he)||he.contentEditable==="true")&&(cs=he,iu=_,gr=null);break;case"focusout":gr=iu=cs=null;break;case"mousedown":su=!0;break;case"contextmenu":case"mouseup":case"dragend":su=!1,Ed(C,a,$);break;case"selectionchange":if(N1)break;case"keydown":case"keyup":Ed(C,a,$)}var Q;if(Po)e:{switch(e){case"compositionstart":var te="onCompositionStart";break e;case"compositionend":te="onCompositionEnd";break e;case"compositionupdate":te="onCompositionUpdate";break e}te=void 0}else us?cd(e,a)&&(te="onCompositionEnd"):e==="keydown"&&a.keyCode===229&&(te="onCompositionStart");te&&(ld&&a.locale!=="ko"&&(us||te!=="onCompositionStart"?te==="onCompositionEnd"&&us&&(Q=nd()):(Qn=$,Zo="value"in Qn?Qn.value:Qn.textContent,us=!0)),he=_l(_,te),0<he.length&&(te=new rd(te,e,null,a,$),C.push({event:te,listeners:he}),Q?te.data=Q:(Q=fd(a),Q!==null&&(te.data=Q)))),(Q=v1?S1(e,a):A1(e,a))&&(te=_l(_,"onBeforeInput"),0<te.length&&(he=new rd("onBeforeInput","beforeinput",null,a,$),C.push({event:he,listeners:te}),he.data=Q)),fS(C,e,_,a,$)}Im(C,i)})}function Yr(e,i,a){return{instance:e,listener:i,currentTarget:a}}function _l(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=ur(e,a),u!=null&&l.unshift(Yr(e,u,f)),u=ur(e,i),u!=null&&l.push(Yr(e,u,f))),e.tag===3)return l;e=e.return}return[]}function Cs(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Xm(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?(_=ur(a,f),_!=null&&d.unshift(Yr(a,_,S))):u||(_=ur(a,f),_!=null&&d.push(Yr(a,_,S)))),a=a.return}d.length!==0&&e.push({event:i,listeners:d})}var mS=/\r\n?/g,yS=/\u0000|\uFFFD/g;function Qm(e){return(typeof e=="string"?e:""+e).replace(mS,`
62
- `).replace(yS,"")}function Fm(e,i){return i=Qm(i),Qm(e)===i}function Tl(){}function Ne(e,i,a,l,u,f){switch(a){case"children":typeof l=="string"?i==="body"||i==="textarea"&&l===""||as(e,l):(typeof l=="number"||typeof l=="bigint")&&i!=="body"&&as(e,""+l);break;case"className":$a(e,"class",l);break;case"tabIndex":$a(e,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":$a(e,a,l);break;case"style":Ph(e,l,f);break;case"data":if(i!=="object"){$a(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=za(""+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"&&Ne(e,i,"name",u.name,u,null),Ne(e,i,"formEncType",u.formEncType,u,null),Ne(e,i,"formMethod",u.formMethod,u,null),Ne(e,i,"formTarget",u.formTarget,u,null)):(Ne(e,i,"encType",u.encType,u,null),Ne(e,i,"method",u.method,u,null),Ne(e,i,"target",u.target,u,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(a);break}l=za(""+l),e.setAttribute(a,l);break;case"onClick":l!=null&&(e.onclick=Tl);break;case"onScroll":l!=null&&pe("scroll",e);break;case"onScrollEnd":l!=null&&pe("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=za(""+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":pe("beforetoggle",e),pe("toggle",e),Ma(e,"popover",l);break;case"xlinkActuate":xn(e,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":xn(e,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":xn(e,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":xn(e,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":xn(e,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":xn(e,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":xn(e,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":xn(e,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":xn(e,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":Ma(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=J0.get(a)||a,Ma(e,a,l))}}function Tc(e,i,a,l,u,f){switch(a){case"style":Ph(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"?as(e,l):(typeof l=="number"||typeof l=="bigint")&&as(e,""+l);break;case"onScroll":l!=null&&pe("scroll",e);break;case"onScrollEnd":l!=null&&pe("scrollend",e);break;case"onClick":l!=null&&(e.onclick=Tl);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Hh.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[kt]||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,""):Ma(e,a,l)}}}function yt(e,i,a){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":pe("error",e),pe("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:Ne(e,i,f,d,a,null)}}u&&Ne(e,i,"srcSet",a.srcSet,a,null),l&&Ne(e,i,"src",a.src,a,null);return;case"input":pe("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:Ne(e,i,l,$,a,null)}}Xh(e,f,b,S,_,d,u,!1),Da(e);return;case"select":pe("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:Ne(e,i,u,b,a,null)}i=f,a=d,e.multiple=!!l,i!=null?rs(e,!!l,i,!1):a!=null&&rs(e,!!l,a,!0);return;case"textarea":pe("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:Ne(e,i,d,b,a,null)}Fh(e,l,u,f),Da(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:Ne(e,i,S,l,a,null)}return;case"dialog":pe("beforetoggle",e),pe("toggle",e),pe("cancel",e),pe("close",e);break;case"iframe":case"object":pe("load",e);break;case"video":case"audio":for(l=0;l<Gr.length;l++)pe(Gr[l],e);break;case"image":pe("error",e),pe("load",e);break;case"details":pe("toggle",e);break;case"embed":case"source":case"link":pe("error",e),pe("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:Ne(e,i,_,l,a,null)}return;default:if(Vo(i)){for($ in a)a.hasOwnProperty($)&&(l=a[$],l!==void 0&&Tc(e,i,$,l,a,void 0));return}}for(b in a)a.hasOwnProperty(b)&&(l=a[b],l!=null&&Ne(e,i,b,l,a,null))}function gS(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)||Ne(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&&Ne(e,i,T,R,l,C)}}Lo(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)||Ne(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&&Ne(e,i,u,f,l,S)}i=b,a=d,l=R,T!=null?rs(e,!!a,T,!1):!!l!=!!a&&(i!=null?rs(e,!!a,i,!0):rs(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:Ne(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&&Ne(e,i,d,u,l,f)}Qh(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:Ne(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:Ne(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 ee in a)T=a[ee],a.hasOwnProperty(ee)&&T!=null&&!l.hasOwnProperty(ee)&&Ne(e,i,ee,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:Ne(e,i,_,T,l,R)}return;default:if(Vo(i)){for(var ke in a)T=a[ke],a.hasOwnProperty(ke)&&T!==void 0&&!l.hasOwnProperty(ke)&&Tc(e,i,ke,void 0,l,T);for($ in l)T=l[$],R=a[$],!l.hasOwnProperty($)||T===R||T===void 0&&R===void 0||Tc(e,i,$,T,l,R);return}}for(var x in a)T=a[x],a.hasOwnProperty(x)&&T!=null&&!l.hasOwnProperty(x)&&Ne(e,i,x,null,l,T);for(C in l)T=l[C],R=a[C],!l.hasOwnProperty(C)||T===R||T==null&&R==null||Ne(e,i,C,T,l,R)}var Rc=null,Nc=null;function Rl(e){return e.nodeType===9?e:e.ownerDocument}function Wm(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 Pm(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 kc(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 Mc=null;function bS(){var e=window.event;return e&&e.type==="popstate"?e===Mc?!1:(Mc=e,!0):(Mc=null,!1)}var ey=typeof setTimeout=="function"?setTimeout:void 0,vS=typeof clearTimeout=="function"?clearTimeout:void 0,ty=typeof Promise=="function"?Promise:void 0,SS=typeof queueMicrotask=="function"?queueMicrotask:typeof ty<"u"?function(e){return ty.resolve(null).then(e).catch(AS)}:ey;function AS(e){setTimeout(function(){throw e})}function hi(e){return e==="head"}function ny(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&&Jr(d.documentElement),a&2&&Jr(d.body),a&4)for(a=d.head,Jr(a),d=a.firstChild;d;){var b=d.nextSibling,S=d.nodeName;d[lr]||S==="SCRIPT"||S==="STYLE"||S==="LINK"&&d.rel.toLowerCase()==="stylesheet"||a.removeChild(d),d=b}}if(u===0){e.removeChild(f),ea(i);return}u--}else a==="$"||a==="$?"||a==="$!"?u++:l=a.charCodeAt(0)-48;else l=0;a=f}while(a);ea(i)}function $c(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":$c(a),Bo(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}e.removeChild(a)}}function wS(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[lr])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 ES(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 Dc(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState==="complete"}function xS(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 Cc=null;function iy(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 sy(e,i,a){switch(i=Rl(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 Jr(e){for(var i=e.attributes;i.length;)e.removeAttributeNode(i[0]);Bo(e)}var sn=new Map,ry=new Set;function Nl(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var qn=H.d;H.d={f:OS,r:_S,D:TS,C:RS,L:NS,m:kS,X:$S,S:MS,M:DS};function OS(){var e=qn.f(),i=Sl();return e||i}function _S(e){var i=ts(e);i!==null&&i.tag===5&&i.type==="form"?Op(i):qn.r(e)}var zs=typeof document>"u"?null:document;function ay(e,i,a){var l=zs;if(l&&typeof i=="string"&&i){var u=Qt(i);u='link[rel="'+e+'"][href="'+u+'"]',typeof a=="string"&&(u+='[crossorigin="'+a+'"]'),ry.has(u)||(ry.add(u),e={rel:e,crossOrigin:a,href:i},l.querySelector(u)===null&&(i=l.createElement("link"),yt(i,"link",e),rt(i),l.head.appendChild(i)))}}function TS(e){qn.D(e),ay("dns-prefetch",e,null)}function RS(e,i){qn.C(e,i),ay("preconnect",e,i)}function NS(e,i,a){qn.L(e,i,a);var l=zs;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=Us(e);break;case"script":f=Bs(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(Ir(f))||i==="script"&&l.querySelector(Zr(f))||(i=l.createElement("link"),yt(i,"link",e),rt(i),l.head.appendChild(i)))}}function kS(e,i){qn.m(e,i);var a=zs;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=Bs(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"),yt(l,"link",e),rt(l),a.head.appendChild(l)}}}function MS(e,i,a){qn.S(e,i,a);var l=zs;if(l&&e){var u=ns(l).hoistableStyles,f=Us(e);i=i||"default";var d=u.get(f);if(!d){var b={loading:0,preload:null};if(d=l.querySelector(Ir(f)))b.loading=5;else{e=v({rel:"stylesheet",href:e,"data-precedence":i},a),(a=sn.get(f))&&zc(e,a);var S=d=l.createElement("link");rt(S),yt(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,kl(d,i,l)}d={type:"stylesheet",instance:d,count:1,state:b},u.set(f,d)}}}function $S(e,i){qn.X(e,i);var a=zs;if(a&&e){var l=ns(a).hoistableScripts,u=Bs(e),f=l.get(u);f||(f=a.querySelector(Zr(u)),f||(e=v({src:e,async:!0},i),(i=sn.get(u))&&Uc(e,i),f=a.createElement("script"),rt(f),yt(f,"link",e),a.head.appendChild(f)),f={type:"script",instance:f,count:1,state:null},l.set(u,f))}}function DS(e,i){qn.M(e,i);var a=zs;if(a&&e){var l=ns(a).hoistableScripts,u=Bs(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))&&Uc(e,i),f=a.createElement("script"),rt(f),yt(f,"link",e),a.head.appendChild(f)),f={type:"script",instance:f,count:1,state:null},l.set(u,f))}}function ly(e,i,a,l){var u=(u=oe.current)?Nl(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=Us(a.href),a=ns(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=Us(a.href);var f=ns(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(Ir(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||CS(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=Bs(a),a=ns(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 Us(e){return'href="'+Qt(e)+'"'}function Ir(e){return'link[rel="stylesheet"]['+e+"]"}function oy(e){return v({},e,{"data-precedence":e.precedence,precedence:null})}function CS(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}),yt(i,"link",a),rt(i),e.head.appendChild(i))}function Bs(e){return'[src="'+Qt(e)+'"]'}function Zr(e){return"script[async]"+e}function uy(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,rt(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"),rt(l),yt(l,"style",u),kl(l,a.precedence,e),i.instance=l;case"stylesheet":u=Us(a.href);var f=e.querySelector(Ir(u));if(f)return i.state.loading|=4,i.instance=f,rt(f),f;l=oy(a),(u=sn.get(u))&&zc(l,u),f=(e.ownerDocument||e).createElement("link"),rt(f);var d=f;return d._p=new Promise(function(b,S){d.onload=b,d.onerror=S}),yt(f,"link",l),i.state.loading|=4,kl(f,a.precedence,e),i.instance=f;case"script":return f=Bs(a.src),(u=e.querySelector(Zr(f)))?(i.instance=u,rt(u),u):(l=a,(u=sn.get(f))&&(l=v({},a),Uc(l,u)),e=e.ownerDocument||e,u=e.createElement("script"),rt(u),yt(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,kl(l,a.precedence,e));return i.instance}function kl(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 zc(e,i){e.crossOrigin==null&&(e.crossOrigin=i.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=i.referrerPolicy),e.title==null&&(e.title=i.title)}function Uc(e,i){e.crossOrigin==null&&(e.crossOrigin=i.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=i.referrerPolicy),e.integrity==null&&(e.integrity=i.integrity)}var Ml=null;function cy(e,i,a){if(Ml===null){var l=new Map,u=Ml=new Map;u.set(a,l)}else u=Ml,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[lr]||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 fy(e,i,a){e=e.ownerDocument||e,e.head.insertBefore(a,i==="title"?e.querySelector("head > title"):null)}function zS(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 hy(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}var Xr=null;function US(){}function BS(e,i,a){if(Xr===null)throw Error(r(475));var l=Xr;if(i.type==="stylesheet"&&(typeof a.media!="string"||matchMedia(a.media).matches!==!1)&&(i.state.loading&4)===0){if(i.instance===null){var u=Us(a.href),f=e.querySelector(Ir(u));if(f){e=f._p,e!==null&&typeof e=="object"&&typeof e.then=="function"&&(l.count++,l=$l.bind(l),e.then(l,l)),i.state.loading|=4,i.instance=f,rt(f);return}f=e.ownerDocument||e,a=oy(a),(u=sn.get(u))&&zc(a,u),f=f.createElement("link"),rt(f);var d=f;d._p=new Promise(function(b,S){d.onload=b,d.onerror=S}),yt(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=$l.bind(l),e.addEventListener("load",i),e.addEventListener("error",i))}}function qS(){if(Xr===null)throw Error(r(475));var e=Xr;return e.stylesheets&&e.count===0&&Bc(e,e.stylesheets),0<e.count?function(i){var a=setTimeout(function(){if(e.stylesheets&&Bc(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 $l(){if(this.count--,this.count===0){if(this.stylesheets)Bc(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Dl=null;function Bc(e,i){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Dl=new Map,i.forEach(jS,e),Dl=null,$l.call(e))}function jS(e,i){if(!(i.state.loading&4)){var a=Dl.get(e);if(a)var l=a.get(null);else{a=new Map,Dl.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=$l.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 Qr={$$typeof:ve,Provider:null,Consumer:null,_currentValue:W,_currentValue2:W,_threadCount:0};function KS(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=Do(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Do(0),this.hiddenUpdates=Do(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 dy(e,i,a,l,u,f,d,b,S,_,$,C){return e=new KS(e,i,a,d,b,S,_,C),i=1,f===!0&&(i|=24),f=Kt(3,null,null,i),e.current=f,f.stateNode=e,i=bu(),i.refCount++,e.pooledCache=i,i.refCount++,f.memoizedState={element:l,isDehydrated:a,cache:i},wu(f),e}function py(e){return e?(e=ps,e):ps}function my(e,i,a,l,u,f){u=py(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),_r(a,e,i))}function yy(e,i){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var a=e.retryLane;e.retryLane=a!==0&&a<i?a:i}}function qc(e,i){yy(e,i),(e=e.alternate)&&yy(e,i)}function gy(e){if(e.tag===13){var i=ds(e,67108864);i!==null&&Yt(i,e,67108864),qc(e,67108864)}}var Cl=!0;function LS(e,i,a,l){var u=M.T;M.T=null;var f=H.p;try{H.p=2,jc(e,i,a,l)}finally{H.p=f,M.T=u}}function HS(e,i,a,l){var u=M.T;M.T=null;var f=H.p;try{H.p=8,jc(e,i,a,l)}finally{H.p=f,M.T=u}}function jc(e,i,a,l){if(Cl){var u=Kc(l);if(u===null)_c(e,i,l,zl,a),vy(e,l);else if(GS(u,e,i,a,l))l.stopPropagation();else if(vy(e,l),i&4&&-1<VS.indexOf(e)){for(;u!==null;){var f=ts(u);if(f!==null)switch(f.tag){case 3:if(f=f.stateNode,f.current.memoizedState.isDehydrated){var d=Ei(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}vn(f),(xe&6)===0&&(bl=pn()+500,Vr(0))}}break;case 13:b=ds(f,2),b!==null&&Yt(b,f,2),Sl(),qc(f,2)}if(f=Kc(l),f===null&&_c(e,i,l,zl,a),f===u)break;u=f}u!==null&&l.stopPropagation()}else _c(e,i,l,null,a)}}function Kc(e){return e=Yo(e),Lc(e)}var zl=null;function Lc(e){if(zl=null,e=es(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 zl=e,null}function by(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(R0()){case $h:return 2;case Dh:return 8;case Ta:case N0:return 32;case Ch:return 268435456;default:return 32}default:return 32}}var Hc=!1,di=null,pi=null,mi=null,Fr=new Map,Wr=new Map,yi=[],VS="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 vy(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":Fr.delete(i.pointerId);break;case"gotpointercapture":case"lostpointercapture":Wr.delete(i.pointerId)}}function Pr(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=ts(i),i!==null&&gy(i)),e):(e.eventSystemFlags|=l,i=e.targetContainers,u!==null&&i.indexOf(u)===-1&&i.push(u),e)}function GS(e,i,a,l,u){switch(i){case"focusin":return di=Pr(di,e,i,a,l,u),!0;case"dragenter":return pi=Pr(pi,e,i,a,l,u),!0;case"mouseover":return mi=Pr(mi,e,i,a,l,u),!0;case"pointerover":var f=u.pointerId;return Fr.set(f,Pr(Fr.get(f)||null,e,i,a,l,u)),!0;case"gotpointercapture":return f=u.pointerId,Wr.set(f,Pr(Wr.get(f)||null,e,i,a,l,u)),!0}return!1}function Sy(e){var i=es(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,B0(e.priority,function(){if(a.tag===13){var l=Gt();l=Co(l);var u=ds(a,l);u!==null&&Yt(u,a,l),qc(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 Ul(e){if(e.blockedOn!==null)return!1;for(var i=e.targetContainers;0<i.length;){var a=Kc(e.nativeEvent);if(a===null){a=e.nativeEvent;var l=new a.constructor(a.type,a);Go=l,a.target.dispatchEvent(l),Go=null}else return i=ts(a),i!==null&&gy(i),e.blockedOn=a,!1;i.shift()}return!0}function Ay(e,i,a){Ul(e)&&a.delete(i)}function YS(){Hc=!1,di!==null&&Ul(di)&&(di=null),pi!==null&&Ul(pi)&&(pi=null),mi!==null&&Ul(mi)&&(mi=null),Fr.forEach(Ay),Wr.forEach(Ay)}function Bl(e,i){e.blockedOn===i&&(e.blockedOn=null,Hc||(Hc=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,YS)))}var ql=null;function wy(e){ql!==e&&(ql=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){ql===e&&(ql=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(Lc(l||a)===null)continue;break}var f=ts(a);f!==null&&(e.splice(i,3),i-=3,Lu(f,{pending:!0,data:u,method:a.method,action:l},l,u))}}))}function ea(e){function i(S){return Bl(S,e)}di!==null&&Bl(di,e),pi!==null&&Bl(pi,e),mi!==null&&Bl(mi,e),Fr.forEach(i),Wr.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);)Sy(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[kt]||null;if(typeof f=="function")d||wy(a);else if(d){var b=null;if(f&&f.hasAttribute("formAction")){if(u=f,d=f[kt]||null)b=d.formAction;else if(Lc(u)!==null)continue}else b=d.action;typeof b=="function"?a[l+1]=b:(a.splice(l,3),l-=3),wy(a)}}}function Vc(e){this._internalRoot=e}jl.prototype.render=Vc.prototype.render=function(e){var i=this._internalRoot;if(i===null)throw Error(r(409));var a=i.current,l=Gt();my(a,l,e,i,null,null)},jl.prototype.unmount=Vc.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var i=e.containerInfo;my(e.current,2,null,e,null,null),Sl(),i[Pi]=null}};function jl(e){this._internalRoot=e}jl.prototype.unstable_scheduleHydration=function(e){if(e){var i=jh();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&&Sy(e)}};var Ey=s.version;if(Ey!=="19.1.0")throw Error(r(527,Ey,"19.1.0"));H.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 JS={bundleType:0,version:"19.1.0",rendererPackageName:"react-dom",currentDispatcherRef:M,reconcilerVersion:"19.1.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Kl=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Kl.isDisabled&&Kl.supportsFiber)try{sr=Kl.inject(JS),Bt=Kl}catch{}}return na.createRoot=function(e,i){if(!o(e))throw Error(r(299));var a=!1,l="",u=jp,f=Kp,d=Lp,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=dy(e,1,!1,null,null,a,l,u,f,d,b,null),e[Pi]=i.current,Oc(e),new Vc(i)},na.hydrateRoot=function(e,i,a){if(!o(e))throw Error(r(299));var l=!1,u="",f=jp,d=Kp,b=Lp,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=dy(e,1,!0,i,a??null,l,u,f,d,b,S,_),i.context=py(null),a=i.current,l=Gt(),l=Co(l),u=Pn(l),u.callback=null,ei(a,u,l),a=l,i.current.lanes=a,ar(i,a),vn(i),e[Pi]=i.current,Oc(e),new jl(i)},na.version="19.1.0",na}var Uy;function Aw(){if(Uy)return Ic.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(),Ic.exports=Sw(),Ic.exports}var ww=Aw();const ya=t=>Array.isArray(t)?t:[t],Ew=(t,s)=>{const n=[[],[]];for(const r of t)s(r)?n[0].push(r):n[1].push(r);return n},mb=Array,Li=(t,s)=>t.includes(s),xw=(t,s=0)=>[...new Array(t)].map((n,r)=>r+s),$e=(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?ya(s):t.concat(s),Ow=(...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);return ya(s).forEach(o=>{t.some(c=>r(c,o))||t.push(o)}),t},_w=(t,s)=>t.reduce((n,r)=>{const o=r[s];return n[o]=$e(n[o],r),n},{}),Zs=(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]),Fi=(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"},Tw={...Ln,function:"a function"};class Rw extends Error{}const st=t=>Ii(t,Rw),Ii=(t,s=Error)=>{throw new s(t)};class Nw extends Error{constructor(){super(...arguments);g(this,"name","ParseError")}}const q=t=>Ii(t,Nw),yb=t=>` ${t}`,Ue=(t,s)=>{const n={},r=Array.isArray(t);let o=!1;return Object.entries(t).forEach((c,h)=>{const p=r?s(h,c[1]):s(...c,h);o||(o=typeof p[0]=="number"),(Array.isArray(p[0])||p.length===0?p:[p]).forEach(([y,v])=>{typeof y=="object"?n[y.group]=$e(n[y.group],v):n[y]=v})}),o?Object.values(n):n},gb=Object.entries,dn=(t,s)=>t in s,lh=(t,s)=>s in t;class kw{constructor(s){Object.assign(this,s)}}const Mw=class{};class bb extends Mw{}const $w=(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]},Dw=(t,s)=>$w(t,s)[1],ga=t=>Object.keys(t).length===0,yf=t=>[...Object.entries(t),...Object.getOwnPropertySymbols(t).map(s=>[s,t[s]])],Cw=(t,s)=>Object.defineProperties(t,Object.getOwnPropertyDescriptors(s)),zw=t=>{const s=Object.keys(t).sort(),n={};for(let r=0;r<s.length;r++)n[s[r]]=t[s[r]];return n},Kn=yb("represents an uninitialized value"),Uw=t=>Object.values(t).filter(s=>typeof s=="number"?!0:typeof t[s]!="number"),vb={Array,Boolean,Date,Error,Function,Map,Number,Promise,RegExp,Set,String,WeakMap,WeakSet},Sb=globalThis.File??Blob,Ab={ArrayBuffer,Blob,File:Sb,FormData,Headers,Request,Response,URL},Bw={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array},Xs={...vb,...Ab,...Bw,String,Number,Boolean},oh=t=>{var r;let s=Object.getPrototypeOf(t);for(;s!=null&&s.constructor&&(!dn(s.constructor.name,Xs)||!(t instanceof Xs[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},gf=t=>typeof t=="object"&&t!==null?oh(t)??"object":hn(t),Ot=Array.isArray,qw={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"},jw={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"},Kw={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"},Lw={...qw,...jw,...Kw},uh=t=>{const s=Object(t).name??null;return s&&dn(s,Xs)&&Xs[s]===t?s:null},By=(t,s)=>{let n=t.prototype;for(;n!==null;){if(n===s.prototype)return!0;n=Object.getPrototypeOf(n)}return!1},Hw=t=>wb(t,new Map),wb=(t,s)=>{if(typeof t!="object"||t===null)return t;if(s!=null&&s.has(t))return s.get(t);const n=uh(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=wb(h.value,s))}}return Object.defineProperties(r,o),r},Vw=t=>{let s=Kn;return()=>s===Kn?s=t():s},go=t=>typeof t=="function"&&t.length===0,Gw=class extends Function{constructor(...t){const s=t.slice(0,-1),n=t.at(-1);try{super(...s,n)}catch(r){return st(`Encountered an unexpected error while compiling your definition:
63
- Message: ${r}
64
- Source: (${t.slice(0,-1)}) => {
65
- ${t.at(-1)}
66
- }`)}}};class er{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 Yw=Vw(()=>{try{return new Function("return false")()}catch{return!0}});class En{constructor(){}}const Jw=()=>{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 qg;const Iw=((qg=globalThis.process)==null?void 0:qg.env)??{},Zw={fileName:Jw,env:Iw},Xw=t=>t[0].toUpperCase()+t.slice(1),Eb=t=>new RegExp(Qw(t),typeof t=="string"?"":t.flags),Qw=t=>`^(?:${typeof t=="string"?t:t.source})$`,vi={negativeLookahead:t=>`(?!${t})`,nonCapturingGroup:t=>`(?:${t})`},bf="\\",bo={" ":1,"\n":1," ":1},Fw=/^-0\.?0*$/.source,xb=/[1-9]\d*/.source,Ww=/\.\d+/.source,Pw=/\.\d*[1-9]/.source,Ob=t=>Eb(vi.negativeLookahead(Fw)+vi.nonCapturingGroup("-?"+vi.nonCapturingGroup(vi.nonCapturingGroup("0|"+xb)+vi.nonCapturingGroup(t.decimalPattern)+"?")+(t.allowDecimalOnly?"|"+t.decimalPattern:"")+"?")),qy=Ob({decimalPattern:Pw,allowDecimalOnly:!1}),eE=qy.test.bind(qy),vf=Ob({decimalPattern:Ww,allowDecimalOnly:!0});vf.test.bind(vf);const tE=/^-?\d*\.?\d*$/,nE=t=>t.length!==0&&tE.test(t),io=Eb(vi.negativeLookahead("^-0$")+"-?"+vi.nonCapturingGroup(vi.nonCapturingGroup("0|"+xb))),iE=io.test.bind(io),Sf=/^-?\d+$/,sE=Sf.test.bind(Sf),_b={number:"a number",bigint:"a bigint",integer:"an integer"},Tb=(t,s)=>`'${t}' was parsed as ${_b[s]} but could not be narrowed to a literal value. Avoid unnecessary leading or trailing zeros and other abnormal notation`,rE=(t,s)=>s==="number"?eE(t):iE(t),aE=(t,s)=>s==="number"?Number(t):Number.parseInt(t),lE=(t,s)=>s==="number"?nE(t):sE(t),oE=(t,s)=>ch(t,"number",s),uE=(t,s)=>ch(t,"number",{...s,strict:!0}),cE=(t,s)=>ch(t,"integer",s),ch=(t,s,n)=>{const r=aE(t,s);return!Number.isNaN(r)&&lE(t,s)?n!=null&&n.strict?rE(t,s)?r:q(Tb(t,s)):r:n!=null&&n.errorOnFail?q((n==null?void 0:n.errorOnFail)===!0?`Failed to parse ${_b[s]} from '${t}'`:n==null?void 0:n.errorOnFail):void 0},fE=t=>{if(t[t.length-1]!=="n")return;const s=t.slice(0,-1);let n;try{n=BigInt(s)}catch{return}if(io.test(s))return n;if(Sf.test(s))return q(Tb(t,"bigint"))},hE="0.45.9",dE={version:hE,filename:Zw.fileName(),FileConstructor:Sb},ba=dE,jy=new WeakMap,Fc=Object.create(null),Af=t=>{const s=jy.get(t);if(s)return s;let n=pE(t);return Fc[n]?n=`${n}${Fc[n]++}`:Fc[n]=1,ba[n]=t,jy.set(t,n),n},so=t=>/^[a-zA-Z_$][a-zA-Z_$0-9]*$/.test(t),pE=t=>{switch(typeof t){case"object":{if(t===null)break;const s=oh(t)??"object";return s[0].toLowerCase()+s.slice(1)}case"function":return so(t.name)?t.name:"fn";case"symbol":return t.description&&so(t.description)?t.description:"symbol"}return st(`Unexpected attempt to register serializable value of type ${hn(t)}`)},Rb=t=>typeof t=="string"?JSON.stringify(t):typeof t=="bigint"?`${t}n`:`${t}`,mE=(t,s={})=>la(t,{onUndefined:"$ark.undefined",onBigInt:n=>`$ark.bigint-${n}`,...s},[]),De=(t,s)=>{switch(hn(t)){case"object":const n=t,r=n.constructor.name;return r==="Object"||r==="Array"?JSON.stringify(la(n,ro,[]),null,s):n instanceof Date?va(n):typeof n.expression=="string"?n.expression:r;case"symbol":return ro.onSymbol(t);default:return Rb(t)}},ro={onCycle:()=>"(cycle)",onSymbol:t=>`Symbol(${Af(t)})`,onFunction:t=>`Function(${Af(t)})`},la=(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 ro.onFunction(c);if(n.includes(c))return"(cycle)";const h=[...n,c];if(Array.isArray(c))return c.map(m=>la(m,s,h));if(c instanceof Date)return c.toDateString();const p={};for(const m in c)p[m]=la(c[m],s,h);for(const m of Object.getOwnPropertySymbols(c))p[((r=s.onSymbol)==null?void 0:r.call(s,m))??m.toString()]=la(c[m],s,h);return p}case"symbol":return ro.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}},va=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=`${yE[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+=`.${bE(p,3)}`:gE.test(y)&&(y=y.slice(0,-3)),`${y+v}, ${m}`},yE=["January","February","March","April","May","June","July","August","September","October","November","December"],gE=/:\d\d:00$/,bE=(t,s)=>String(t).padStart(s,"0"),Nb=(t,s,...[n])=>{const r=(n==null?void 0:n.stringifySymbol)??De;let o=t;switch(typeof s){case"string":o=so(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(`${De(s)} must be a PropertyKey or stringifyNonKey must be passed to options`)}return o},Sa=(t,...s)=>t.reduce((n,r)=>Nb(n,r,...s),"");class kb extends mb{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"?De(this[n]):this[n]);return this.cache.json}stringify(){return this.cache.stringify?this.cache.stringify:this.cache.stringify=Sa(this)}stringifyAncestors(){if(this.cache.stringifyAncestors)return this.cache.stringifyAncestors;let n="";const r=[n];return this.forEach(o=>{n=Nb(n,o),r.push(n)}),this.cache.stringifyAncestors=r}}class vE{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]===bf)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 bo))}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 wf="$ark",SE=2;for(;wf in globalThis;)wf=`$ark${SE++}`;const Mb=wf;globalThis[Mb]=ba;const L=ba,AE=t=>`${Mb}.${t}`,Nt=t=>AE(Af(t));class $b extends bb{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 Db(n,r)}index(n,r=!1){return Cb(`${n}`,r)}line(n){return this.body+=`${" ".repeat(this.indentation)}${n}
68
- `,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(`
69
- `).map(o=>" ".repeat(r)+`${o}`).join(`
70
- `):this.body} }`}compile(){return new Gw(...this.argNames,this.body)}}const Aa=t=>Fi(t,"object")||typeof t=="symbol"?Nt(t):Rb(t),Db=(t,s=!1)=>typeof t=="string"&&so(t)?`${s?"?":""}.${t}`:Cb(wE(t),s),wE=t=>typeof t=="symbol"?Nt(t):JSON.stringify(t),Cb=(t,s=!1)=>`${s?"?.":""}[${t}]`;class Wc extends $b{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 zb=t=>Ue(t,(s,n)=>[s,Ot(n)?[...n]:n]),Hn=yb("arkKind"),ne=(t,s)=>(t==null?void 0:t[Hn])===s,Rt=t=>ne(t,"root")||ne(t,"constraint"),EE=["unit","proto","domain"],vo=["required","optional","index","sequence"],Ub=["pattern","divisor","exactLength","max","min","maxLength","minLength","before","after"],fh=[...Ub,...vo,"structure","predicate"],So=["alias","union","morph","unit","intersection","proto","domain"],xE=[...So,...fh],Bb=Ue(fh,(t,s)=>[s,1]),OE=Ue([...vo,"undeclared"],(t,s)=>[s,1]),qb=Ue(xE,(t,s)=>[s,t]),Xl=t=>typeof t=="string"&&t in qb,ao=t=>qb[t],hh=t=>So.slice(ao(t)+1);[...hh("union")];[...hh("morph")];const Zi=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:Aa(t),Ao=t=>{let s="{ ";for(const[n,r]of Object.entries(t))s+=`${n}: ${Aa(r)}, `;return s+" }"},Je=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=>De(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};L.config??(L.config={});const Ef=(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 n[r]=Xl(r)?{...t[r],...s[r]}:s[r]}return n};var jg,Kg;class Qs extends(Kg=bb,jg=Hn,Kg){constructor({prefixPath:n,relativePath:r,...o},c){super();g(this,jg,"error");g(this,"path");g(this,"data");g(this,"nodeConfig");g(this,"input");g(this,"ctx");this.input=o,this.ctx=c,Cw(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(E=>({...E,path:Ow(n,E.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 kb(...p),this.data="data"in o?o.data:h}transform(n){return new Qs(n({data:this.data,path:this.path,...this.input}),this.ctx)}hasCode(n){return this.code===n}get propString(){return Sa(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 Lg,Hg;class wi extends(Hg=mb,Lg=Hn,Hg){constructor(n){super();g(this,Lg,"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 Ue(this.byPath,(n,r)=>[n,r.flat])}get flatProblemsByPath(){return Ue(this.byPath,(n,r)=>[n,r.flat.map(o=>o.problem)])}throw(){throw this.toTraversalError()}toTraversalError(){return new _E(this)}add(n){this.includes(n)||this._add(n)}transform(n){const r=new wi(this.ctx);return this.forEach(o=>r.add(n(o))),r}merge(n){n.forEach(r=>{this.includes(r)||this._add(new Qs({...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(`
71
- `)}_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 Qs({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){n.path.stringifyAncestors().forEach(r=>{this.byAncestorPath[r]=$e(this.byAncestorPath[r],n)})}}class _E extends Error{constructor(n){var s=(...jR)=>(super(...jR),g(this,"name","TraversalError"),this);n.length===1?s(n.summary):s(`
72
- `+n.map(r=>` • ${TE(r)}`).join(`
73
- `)),Object.defineProperty(this,"arkErrors",{value:n,enumerable:!1})}}const TE=t=>t.toString().split(`
74
- `).join(`
75
- `);class Hs{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 Sa(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 kb(...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 Qs(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 Qs){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 Vn=(t,s,n)=>{if(!n)return s();n.path.push(t);const r=s();return n.path.pop(),r};class jb extends er{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",kE(this.metaJson));g(this,"precedence",ao(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)=>ME(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=>Kb(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 Hs(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 Hs(r,this.$.resolvedConfig);return this.traverseApply(r,c),c.finalize(o)};case"contextual":return(r,o)=>{const c=new Hs(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 Hs(r,this.$.resolvedConfig);return this.traverseApply(r,c),c.finalize(o)};case"branchedOptimistic":return this.createBranchedOptimisticRootApply();default:return this.rootApplyStrategy,st(`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]=Ot(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&&Ii(`${this.kind} node was not of asserted kind ${n}`),this}hasKindIn(...n){return n.includes(this.kind)}assertHasKindIn(...n){return Li(n,this.kind)||Ii(`${this.kind} node was not one of asserted kinds ${n}`),this}isBasis(){return Li(EE,this.kind)}isConstraint(){return Li(fh,this.kind)}isStructural(){return Li(vo,this.kind)}isRefinement(){return Li(Ub,this.kind)}isRoot(){return Li(So,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=sa.normalize(n);return this._select(r)}_select(n){let r=sa.applyBoundary[n.boundary??"references"](this);return n.kind&&(r=r.filter(o=>o.kind===n.kind)),n.where&&(r=r.filter(n.where)),sa.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 E;const o=r.bindScope??this.$;if(r.seen[this.id])return this.$.lazilyResolve(r.seen[this.id]);if(((E=r.shouldTransform)==null?void 0:E.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=Ue(this.inner,(k,N)=>{if(!this.impl.keys[k].child)return[k,N];const B=N;if(!Ot(B)){const X=B._transform(n,r);return X?[k,X]:[]}if(B.length===0)return[k,N];const j=B.flatMap(X=>X._transform(n,r)??[]);return j.length?[k,j]:[]});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")&&!ga(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=sa.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&&ya(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 sa={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&&Ii(Ky(s,n)),t),find:t=>t[0],assertFind:(t,s,n)=>(t.length===0&&Ii(Ky(s,n)),t[0])},normalize:t=>typeof t=="function"?{boundary:"references",method:"filter",where:t}:typeof t=="string"?dn(t,sa.applyBoundary)?{method:"filter",boundary:t}:{boundary:"references",method:"filter",kind:t}:{boundary:"references",method:"filter",...t}},Ky=(t,s)=>`${t} had no references matching ${De(s)}.`,RE=t=>Sa(t,{stringifyNonKey:s=>s.expression}),NE=/"(\$ark\.[^"]+)"/g,kE=t=>JSON.stringify(t).replaceAll(NE,"$1"),Si=(t,s)=>({path:t,node:s,propString:RE(t)}),Kb=(t,s)=>t.propString===s.propString&&t.node.equals(s.node),Ly=(t,s)=>Yi(t,s,{isEqual:Kb}),ME=(t,s)=>Yi(t,s,{isEqual:(n,r)=>n.equals(r)});class Z extends Array{static init(s,n,r,o){return new Z({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=Sa(s);return Lb(`Intersection${o&&` at ${o}`} of ${Hy(n,r)}`)}return`The following intersections result in unsatisfiable types:
76
- • ${this.map(({path:s,l:n,r})=>`${s}: ${Hy(n,r)}`).join(`
77
- • `)}`}throw(){return q(this.describeReasons())}invert(){const s=this.map(n=>({...n,l:n.r,r:n.l}));return s instanceof Z?s:new Z(...s)}withPrefixKey(s,n){return this.map(r=>({...r,path:[s,...r.path],optional:r.optional||n==="optional"}))}toNeverIfDisjoint(){return L.intrinsic.never}}const Hy=(t,s)=>`${xf(t)} and ${xf(s)}`,xf=t=>Rt(t)?t.expression:Ot(t)?t.map(xf).join(" | ")||"never":String(t),Lb=t=>`${t} results in an unsatisfiable type`,qs={},Gn=(t,s,n)=>ft(t,s,{$:n,invert:!1,pipe:!1}),Of=(t,s,n)=>ft(t,s,{$:n,invert:!1,pipe:!0}),ft=(t,s,n)=>{const r=n.pipe?"|>":"&",o=`${t.hash}${r}${s.hash}`;if(qs[o]!==void 0)return qs[o];if(!n.pipe){const p=`${s.hash}${r}${t.hash}`;if(qs[p]!==void 0){const m=qs[p],y=m instanceof Z?m.invert():m;return qs[o]=y,y}}const c=!n.pipe||!t.includesTransform&&!s.includesTransform;if(c&&t.equals(s))return t;let h=c?_f(t,s,n):t.hasKindIn(...So)?$E(t,s,n):_f(t,s,n);return Rt(h)&&(t.equals(h)?h=t:s.equals(h)&&(h=s)),qs[o]=h,h},_f=(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 Z&&(c=c.invert()),c}},$E=(t,s,n)=>t.includesTransform||s.includesTransform?n.invert?Vy(s,t,n):Vy(t,s,n):_f(t,s,n),Vy=(t,s,n)=>t.distribute(r=>DE(r,s,n),r=>{const o=r.filter(Rt);if(o.length===0)return Z.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)}),DE=(t,s,n)=>{if(t.hasKind("morph")){const o=[...t.morphs];if(t.lastMorphIfNode){const c=ft(t.lastMorphIfNode,s,n);if(c instanceof Z)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=ft(t,s.in,n);return o instanceof Z?o:n.$.node("morph",{morphs:[s],in:o})}return n.$.node("morph",{morphs:[s],in:t})};class tr extends jb{constructor(n,r){super(n,r);g(this,"impliedSiblings");Object.defineProperty(this,Hn,{value:"constraint",enumerable:!1})}intersect(n){return Gn(this,n,this.$)}}class wo extends tr{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 Ao(this.errorContext)}}const zt=t=>(s,n)=>{if(Ot(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},lo=t=>{var r;const s=t.r.shift();if(!s){let o=t.l.length===0&&t.kind==="structure"?L.intrinsic.unknown.internal:t.ctx.$.node(t.kind,Object.assign(t.baseInner,CE(t.l)),{prereduced:!0});for(const c of t.roots){if(o instanceof Z)return o;o=ft(c,o,t.ctx)}return o}let n=!1;for(let o=0;o<t.l.length;o++){const c=ft(t.l[o],s,t.ctx);if(c!==null){if(c instanceof Z)return c;if(n){if(!t.l.includes(c))return st(`Unexpectedly encountered multiple distinct intersection results for refinement ${c}`)}else{if(c.isRoot())return t.roots.push(c),t.l.splice(o),lo(t);t.l[o]=c,n=!0}}}return n||t.l.push(s),t.kind==="intersection"&&((r=s.impliedSiblings)==null||r.forEach(o=>Yi(t.r,o))),lo(t)},oo=t=>Object.entries(t).flatMap(([n,r])=>n in Bb?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),CE=t=>{const s={};for(const n of t)if(n.hasOpenIntersection())s[n.kind]=$e(s[n.kind],n);else{if(s[n.kind])return st(`Unexpected intersection of closed refinements of kind ${n.kind}`);s[n.kind]=n}return s},zE=(...t)=>q(UE(...t)),UE=(t,s,n)=>{const r=n.hasKind("morph")?"a morph":n.isUnknown()?"unknown":n.exclude(s).defaultShortDescription;return`${Xw(t)} operand must be ${s.description} (was ${r})`},BE=(t,s,n)=>new uo(t,s,n,n,null);class Hb extends er{}var Vg,Gg;class uo extends(Gg=er,Vg=Hn,Gg){constructor(n,r,o,c,h){super((...p)=>{const m=Ue(this.names,(y,v)=>{const E=this.arg$.parse(p[y]);return E.extends(this.constraints[y])||q(qE(v,this.constraints[y].expression,E.expression)),[v,E]});if(this.defIsLazy()){const y=this.bodyDef(m);return this.$.parse(y)}return this.$.parse(r,{args:m})});g(this,Vg,"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 Hb}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:mE(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 qE=(t,s,n)=>`${t} must be assignable to ${s} (was ${n})`,Gy={morph:"it represents a transformation, while JSON Schema only allows validation. Consider creating a Schema from one of its endpoints using `.in` or `.out`.",cyclic:"cyclic types are not yet convertible to JSON Schema. If this feature is important to you, please add your feedback at https://github.com/arktypeio/arktype/issues/1087"},Yy=(t,s)=>{let n=`${t} is not convertible to JSON Schema`;if(s){const r=dn(s,Gy)?Gy[s]:s;n+=` because ${r}`}return n},ct={writeUnjsonifiableMessage:Yy,UnjsonifiableError:class extends Error{},throwUnjsonifiableError:(...t)=>Ii(Yy(...t)),throwInternalOperandError:(t,s)=>st(`Unexpected JSON Schema input for ${t}: ${De(s)}`)},jE=Je({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 KE extends tr{constructor(){super(...arguments);g(this,"serializedPredicate",Nt(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",Ao(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(){return ct.throwUnjsonifiableError(`Predicate ${this.expression}`)}}const Vb={implementation:jE,Node:KE},LE=Je({kind:"divisor",collapsibleKey:"rule",keys:{rule:{parse:t=>Number.isInteger(t)?t:q(VE(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/GE(t.rule,s.rule))})},obviatesBasisDescription:!0});class HE extends wo{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 Gb={implementation:LE,Node:HE},VE=t=>`divisor must be an integer (was ${t})`,GE=(t,s)=>{let n,r=t,o=s;for(;o!==0;)n=o,o=r%o,r=n;return r};class nr extends wo{constructor(){super(...arguments);g(this,"boundOperandKind",ZE[this.kind]);g(this,"compiledActual",this.boundOperandKind==="value"?"data":this.boundOperandKind==="length"?"data.length":"data.valueOf()");g(this,"comparator",XE(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} ${YE[this.comparator]} ${this.numericLimit}`);g(this,"stringLimit",this.boundOperandKind==="date"?QE(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 YE={"<":">=","<=":">",">":"<=",">=":"<"},JE={min:"max",minLength:"maxLength",after:"before"},Yb={parse:t=>t||void 0},Jb=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},Ib=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},Zb=t=>typeof t=="string"||typeof t=="number"?new Date(t):t,IE=(t,s)=>`${t} bound must be a positive integer (was ${s})`,dh=t=>s=>((!Number.isInteger(s)||s<0)&&q(IE(t,s)),s),ZE={min:"value",max:"value",minLength:"length",maxLength:"length",after:"date",before:"date"},XE=(t,s)=>`${dn(t,JE)?">":"<"}${s?"":"="}`,QE=t=>typeof t=="string"?t:new Date(t).toLocaleString(),FE=t=>`Bounded expression ${t} must be exactly one of number, string, Array, or Date`,WE=Je({kind:"after",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{parse:Zb,serialize:t=>t.toISOString()}},normalize:Ib("after"),defaults:{description:t=>`${t.collapsibleLimitString} or later`,actual:va},intersections:{after:(t,s)=>t.isStricterThan(s)?t:s}});class PE extends nr{constructor(){super(...arguments);g(this,"impliedBasis",L.intrinsic.Date.internal);g(this,"collapsibleLimitString",va(this.rule));g(this,"traverseAllows",n=>n>=this.rule)}reduceJsonSchema(){return ct.throwUnjsonifiableError("Date instance")}}const Xb={implementation:WE,Node:PE},ex=Je({kind:"before",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{parse:Zb,serialize:t=>t.toISOString()}},normalize:Ib("before"),defaults:{description:t=>`${t.collapsibleLimitString} or earlier`,actual:va},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:Z.init("range",t,s)}});class tx extends nr{constructor(){super(...arguments);g(this,"collapsibleLimitString",va(this.rule));g(this,"traverseAllows",n=>n<=this.rule);g(this,"impliedBasis",L.intrinsic.Date.internal)}reduceJsonSchema(){return ct.throwUnjsonifiableError("Date instance")}}const Qb={implementation:ex,Node:tx},nx=Je({kind:"exactLength",collapsibleKey:"rule",keys:{rule:{parse:dh("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)=>Z.init("unit",n.$.node("unit",{unit:t.rule}),n.$.node("unit",{unit:s.rule}),{path:["length"]}),minLength:(t,s)=>t.rule>=s.rule?t:Z.init("range",t,s),maxLength:(t,s)=>t.rule<=s.rule?t:Z.init("range",t,s)}});class ix extends wo{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 ct.throwInternalOperandError("exactLength",n)}}}const Fb={implementation:nx,Node:ix},sx=Je({kind:"max",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{},exclusive:Yb},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:Z.init("range",t,s)},obviatesBasisDescription:!0});class rx extends nr{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 Wb={implementation:sx,Node:rx},ax=Je({kind:"maxLength",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{parse:dh("maxLength")}},reduce:(t,s)=>t.rule===0?s.node("exactLength",t):void 0,normalize:Jb("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:Z.init("range",t,s)}});class lx extends nr{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 ct.throwInternalOperandError("maxLength",n)}}}const Pb={implementation:ax,Node:lx},ox=Je({kind:"min",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{},exclusive:Yb},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 ux extends nr{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 ev={implementation:ox,Node:ux},cx=Je({kind:"minLength",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{parse:dh("minLength")}},reduce:t=>t.rule===0?L.intrinsic.unknown:void 0,normalize:Jb("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 fx extends nr{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 ct.throwInternalOperandError("minLength",n)}}}const tv={implementation:cx,Node:fx},hx={min:ev.implementation,max:Wb.implementation,minLength:tv.implementation,maxLength:Pb.implementation,exactLength:Fb.implementation,after:Xb.implementation,before:Qb.implementation},dx={min:ev.Node,max:Wb.Node,minLength:tv.Node,maxLength:Pb.Node,exactLength:Fb.Node,after:Xb.Node,before:Qb.Node},px=Je({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 mx extends wo{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){return n.pattern?ct.throwUnjsonifiableError(`Intersection of patterns ${n.pattern} & ${this.rule}`):(n.pattern=this.rule,n)}}const nv={implementation:px,Node:mx},Ql=(t,s)=>{const n=yx(t);return s&&!s.includes(n)?q(`Root of kind ${n} should be one of ${s}`):n},yx=t=>{if(ne(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(Jy(t));if("morphs"in t)return"morph";if("branches"in t||Ot(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 Bb)?"intersection":"proto"in t?"proto":"domain"in t?"domain":q(Jy(t))},Jy=t=>`${De(t)} is not a valid type schema`,Hl={},gx=t=>Ot(t)?t.map(s=>s.collapsibleJson):t.collapsibleJson,rn={};L.nodesByRegisteredId=rn;const iv=t=>(Hl[t]??(Hl[t]=0),`${t}${++Hl[t]}`),sv=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=gb(c).sort(([v],[E])=>Xl(v)?Xl(E)?ao(v)-ao(E):1:Xl(E)||v<E?-1:1).filter(([v,E])=>{if(v.startsWith("meta.")){const k=v.slice(5);return h[k]=E,!1}return!0});for(const v of p){const E=v[0],k=s.keys[E];if(!k)return q(`Key ${E} is not valid on ${t.kind} schema`);const N=k.parse?k.parse(v[1],t):v[1];N!==Kn&&(N!==void 0||k.preserveUndefined)&&(r[E]=N)}if(s.reduce&&!t.prereduced){const v=s.reduce(r,t.$);if(v)return v instanceof Z?v.throw():vx(v,h)}return ph({id:t.id,kind:t.kind,inner:r,meta:h,$:t.$})},ph=({id:t,kind:s,inner:n,meta:r,$:o,ignoreCache:c})=>{const h=Eo[s],p=gb(n),m=[];let y={};p.forEach(([F,le])=>{const ve=h.keys[F],bt=ve.serialize??(ve.child?gx:Zi);if(y[F]=bt(le),ve.child===!0){const z=le;Ot(z)?m.push(...z):m.push(z)}else typeof ve.child=="function"&&m.push(...ve.child(le))}),h.finalizeInnerJson&&(y=h.finalizeInnerJson(y));let v={...y},E={};ga(r)||(E=Ue(r,(F,le)=>[F,F==="examples"?le:Zi(le)]),v.meta=Vl(E,"description",!0)),y=Vl(y,h.collapsibleKey,!1);const k=JSON.stringify({kind:s,...y});v=Vl(v,h.collapsibleKey,!1);const N=Vl(v,h.collapsibleKey,!0),B=JSON.stringify({kind:s,...v});if(o.nodesByHash[B]&&!c)return o.nodesByHash[B];const j={id:t,kind:s,impl:h,inner:n,innerEntries:p,innerJson:y,innerHash:k,meta:r,metaJson:E,json:v,hash:B,collapsibleJson:N,children:m};if(s!=="intersection")for(const F in n)F!=="in"&&F!=="out"&&(j[F]=n[F]);const X=new EO[s](j,o);return o.nodesByHash[B]=X},bx=(t,s)=>t.id===s?t:(Rt(rn[s])&&st(`Unexpected attempt to overwrite node id ${s}`),ph({id:s,kind:t.kind,inner:t.inner,meta:t.meta,$:t.$,ignoreCache:!0})),vx=(t,s,n)=>ph({id:iv(s.alias??t.kind),kind:t.kind,inner:t.inner,meta:s,$:t.$}),Vl=(t,s,n)=>{const r=Object.keys(t);if(r.length===1&&r[0]===s){const o=t[s];if(n||Fi(o,"object")&&(Object.keys(o).length===1||Array.isArray(o)))return o}return t},Tf=(t,s,n)=>{if(t.key!==s.key)return null;const r=t.key;let o=ft(t.value,s.value,n);const c=t.required||s.required?"required":"optional";if(o instanceof Z)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(av(t.default,s.default)):t.default:s.hasDefault()?s.default:Kn;return n.$.node("optional",{key:r,value:o,default:h})};class rv extends tr{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",Aa(this.key));g(this,"compiledKey",typeof this.key=="string"?this.key:this.serializedKey);g(this,"flatRefs",$e(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?Vn(this.key,()=>this.value.traverseAllows(n[this.key],r),r):this.optional);g(this,"traverseApply",(n,r)=>{this.key in n?Vn(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 av=(t,s)=>`Invalid intersection of default values ${De(t)} & ${De(s)}`,Sx=Je({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:Tf}});class Ax extends rv{constructor(...n){super(...n);g(this,"expression",this.hasDefault()?`${this.compiledKey}: ${this.value.expression} = ${De(this.inner.default)}`:`${this.compiledKey}?: ${this.value.expression}`);g(this,"defaultValueMorph",wx(this));g(this,"defaultValueMorphRef",this.defaultValueMorph&&Nt(this.defaultValueMorph));"default"in this.inner&&yh(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 mh={implementation:Sx,Node:Ax},Pc={},wx=t=>{if(!t.hasDefault())return;const s=`{${t.compiledKey}: ${t.value.id} = ${Zi(t.default)}}`;return Pc[s]??(Pc[s]=lv(t.key,t.value,t.default))},lv=(t,s,n)=>{if(typeof n=="function")return s.includesTransform?(o,c)=>(Vn(t,()=>s(o[t]=n(),c),c),o):o=>(o[t]=n(),o);const r=s.includesTransform?s.assert(n):n;return Fi(r,"object")?(o,c)=>(Vn(t,()=>s(o[t]=n,c),c),o):o=>(o[t]=r,o)},yh=(t,s,n)=>{const r=go(s);Fi(s,"object")&&!r&&q(Ex(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},Ex=t=>`Non-primitive default ${t===null?"":typeof t=="number"?`for value at [${t}] `:`for ${Aa(t)} `}must be specified as a function like () => ({my: 'object'})`;class wa extends jb{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,Hn,{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(xx):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={dialect:"https://json-schema.org/draft/2020-12/schema",...n},o=this.toJsonSchemaRecurse(r);return typeof r.dialect=="string"&&(o.$schema=r.dialect),o}toJsonSchemaRecurse(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 Z?o:this.$.finalize(o)}rawIntersect(n){return Gn(this,n,this.$)}toNeverIfDisjoint(){return this}and(n){const r=this.intersect(n);return r instanceof Z?r.throw():r}rawAnd(n){const r=this.rawIntersect(n);return r instanceof Z?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(Lb(`keyof ${this.expression}`)),this._keyof=this.$.finalize(n)}get props(){return this.branches.length!==1?q(Ox(this.expression)):[...this.applyStructuralOperation("props",[])[0]]}merge(n){const r=this.$.parseDefinition(n);return this.$.schema(r.distribute(o=>this.applyStructuralOperation("merge",[Iy(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=Iy(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 Z)}extends(n){const r=this.intersect(n);return!(r instanceof Z)&&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 yh(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(ne(c,"root")?c:(h,p)=>{try{return c(h,p)}catch(m){return p.error({code:"predicate",predicate:c,actual:`aborted due to error:
78
- ${m}
79
- `})}}),this);return this.$.finalize(r)}to(n){return this.$.finalize(this.toNode(this.$.parseDefinition(n)))}toNode(n){const r=Of(this,n,this.$);return r instanceof Z?r.throw():r}rawPipeOnce(n){return ne(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:st(`Unexpected constraint node ${c}`);const h=n==="root"?this:this[n];if(h.hasKind("morph")||c.impliedBasis&&!h.extends(c.impliedBasis))return zE(r,c.impliedBasis,this);const p=this.$.node("intersection",{[c.kind]:c}),m=n==="out"?Of(this,p,this.$):Gn(this,p,this.$);return m instanceof Z&&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"?Dw(h,{undeclared:1}):{...h,undeclared:r}:h,o?void 0:{shouldTransform:c=>!Li(vo,c.kind)}))}hasEqualMorphs(n){return!this.includesTransform&&!n.includesTransform?!0:!(!Zs(this.shallowMorphs,n.shallowMorphs)||!Zs(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",js(n))}lessThan(n){return this.constrain("max",js(n))}atLeastLength(n){return this.constrain("minLength",n)}atMostLength(n){return this.constrain("maxLength",n)}moreThanLength(n){return this.constrain("minLength",js(n))}lessThanLength(n){return this.constrain("maxLength",js(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",js(n))}earlierThan(n){return this.constrain("before",js(n))}}const xx="Expected a non-empty brand name after #",js=t=>typeof t=="object"&&!(t instanceof Date)?{...t,exclusive:!0}:{rule:t,exclusive:!0},Gl=(t,s)=>ne(s,"root")?ne(t,"root")?t.extends(s):s.allows(t):ne(t,"root")?t.hasUnit(s):s===t,Iy=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},Ox=t=>`Props cannot be extracted from a union. Use .distribute to extract props from each branch instead. Received:
80
- ${t}`,Zy=(t,s)=>`${t} operand must be an object (was ${s})`,Ea=(t,s)=>Ue(hh(t),(n,r)=>[r,s]),_x=t=>typeof t=="string"?{reference:t}:t,Xy=t=>t instanceof Z?L.intrinsic.never.internal:t,Tx=Je({kind:"alias",hasAssociatedError:!1,collapsibleKey:"reference",keys:{reference:{serialize:t=>t.startsWith("$")?t:`$ark.${t}`},resolve:{}},normalize:_x,defaults:{description:t=>t.reference},intersections:{alias:(t,s,n)=>n.$.lazilyResolve(()=>Xy(ft(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)?Z.init("assignability",L.intrinsic.object,s):n.$.lazilyResolve(()=>Xy(ft(t.resolution,s,n)),`${t.reference}${n.pipe?"=>":"&"}${s.id}`))}});class Rx extends wa{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]=$e(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]=$e(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(;ne(r,"context");){if(o.includes(r.id))return q(Nx(r.id,o));o.push(r.id),r=rn[r.id]}return ne(r,"root")?r:st(`Unexpected resolution for reference ${this.reference}
81
- Seen: [${o.join("->")}]
82
- Resolution: ${De(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:ne(r,"root")?r.id:st(`Unexpected resolution for reference ${this.reference}: ${De(r)}`)}get defaultShortDescription(){return Ln.object}innerToJsonSchema(n){return ct.throwUnjsonifiableError(this.expression,"cyclic")}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 Nx=(t,s)=>`Alias '${t}' has a shallow resolution cycle: ${[...s,t].join("->")}`,gh={implementation:Tx,Node:Rx};class bh extends wa{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 Ao(this.errorContext)}compile(n){n.traversalKind==="Allows"?n.return(this.compiledCondition):n.if(this.compiledNegation,()=>n.line(`${n.ctx}.errorFromNodeContext(${this.compiledErrorContext})`))}}const kx=Je({kind:"domain",hasAssociatedError:!0,collapsibleKey:"domain",keys:{domain:{},numberAllowsNaN:{}},normalize:t=>typeof t=="string"?{domain:t}:lh(t,"numberAllowsNaN")&&t.domain!=="number"?q(vh.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:Z.init("domain",t,s)}});class Mx extends bh{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"?ct.throwUnjsonifiableError(this.domain):{type:this.domain}}}const vh={implementation:kx,Node:Mx,writeBadAllowNanMessage:t=>`numberAllowsNaN may only be specified with domain "number" (was ${t})`},$x=Je({kind:"intersection",hasAssociatedError:!0,normalize:t=>{if(Rt(t))return t;const{structure:s,...n}=t,r=!!s,o=s??{},c=Ue(n,(h,p)=>dn(h,OE)?(r&&q(`Flattened structure key ${h} cannot be specified alongside a root 'structure' key.`),o[h]=p,[]):[h,p]);return(ne(o,"constraint")||!ga(o))&&(c.structure=o),c},finalizeInnerJson:({structure:t,...s})=>Fi(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)=>Qy({},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(`
83
- ◦ `)}`,problem:t=>`(${t.actual}) must be...
84
- ${t.expected}`},intersections:{intersection:(t,s,n)=>Qy(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?ft(h,s,n):s;return p instanceof Z?p:(m=t==null?void 0:t.basis)!=null&&m.equals(p)?t:t.$.node("intersection",{...c,[p.kind]:p},{prereduced:!0})})}});class Dx extends wa{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",Cx(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"){this.children.forEach(r=>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 ov={implementation:$x,Node:Dx},Cx=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},Qy=(t,s,n)=>{const r={},o=t.proto??t.domain,c=s.proto??s.domain,h=o?c?ft(o,c,n):o:c;return h instanceof Z?h:(h&&(r[h.kind]=h),lo({kind:"intersection",baseInner:r,l:oo(t),r:oo(s),roots:[],ctx:n}))},zx=Je({kind:"morph",hasAssociatedError:!1,keys:{in:{child:!0,parse:(t,s)=>s.$.parseSchema(t)},morphs:{parse:ya,serialize:t=>t.map(s=>ne(s,"root")?s.json:Nt(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(Bx(t.expression,s.expression));const r=ft(t.in,s.in,n);if(r instanceof Z)return r;const o={morphs:t.morphs};if(t.declaredIn||s.declaredIn){const c=ft(t.in,s.in,n);if(c instanceof Z)return c.throw();o.declaredIn=c}if(t.declaredOut||s.declaredOut){const c=ft(t.out,s.out,n);if(c instanceof Z)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?ft(t.inner.in,s,n):s;return r instanceof Z?r:r.equals(t.inner.in)?t:n.$.node("morph",{...t.inner,in:r})})}});class Ux extends wa{constructor(){super(...arguments);g(this,"serializedMorphs",this.morphs.map(Nt));g(this,"compiledMorphs",`[${this.serializedMorphs}]`);g(this,"lastMorph",this.inner.morphs.at(-1));g(this,"lastMorphIfNode",ne(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){return ct.throwUnjsonifiableError(this.expression,"morph")}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 Zs(this.morphs,n.morphs,{isEqual:(r,o)=>r===o||ne(r,"root")&&ne(o,"root")&&r.equals(o)})}}const uv={implementation:zx,Node:Ux},Bx=(t,s)=>`The intersection of distinct morphs at a single path is indeterminate:
85
- Left: ${t}
86
- Right: ${s}`,qx=Je({kind:"proto",hasAssociatedError:!0,collapsibleKey:"proto",keys:{proto:{serialize:t=>uh(t)??Zi(t)},dateAllowsInvalid:{}},normalize:t=>{const s=typeof t=="string"?{proto:Xs[t]}:typeof t=="function"?Rt(t)?t:{proto:t}:typeof t.proto=="string"?{...t,proto:Xs[t.proto]}:t;return typeof s.proto!="function"&&q(co.writeInvalidSchemaMessage(s.proto)),lh(s,"dateAllowsInvalid")&&s.proto!==Date&&q(co.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?Lw[t.builtinName]:`an instance of ${t.proto.name}`,actual:t=>t instanceof Date&&t.toString()==="Invalid Date"?"an invalid Date":gf(t)},intersections:{proto:(t,s)=>t.proto===Date&&s.proto===Date?t.dateAllowsInvalid?s:t:By(t.proto,s.proto)?t:By(s.proto,t.proto)?s:Z.init("proto",t,s),domain:(t,s)=>s.domain==="object"?t:Z.init("domain",L.intrinsic.object.internal,s)}});class jx extends bh{constructor(){super(...arguments);g(this,"builtinName",uh(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){switch(this.builtinName){case"Array":return{type:"array"};default:return ct.throwUnjsonifiableError(this.description)}}get nestableExpression(){return this.dateAllowsInvalid?`(${this.expression})`:this.expression}get defaultShortDescription(){return this.description}}const co={implementation:qx,Node:jx,writeBadInvalidDateMessage:t=>`dateAllowsInvalid may only be specified with constructor Date (was ${t.name})`,writeInvalidSchemaMessage:t=>`instanceOf operand must be a function (was ${hn(t)})`},Kx=Je({kind:"union",hasAssociatedError:!0,collapsibleKey:"branches",keys:{ordered:{},branches:{child:!0,parse:(t,s)=>{const n=[];return t.forEach(r=>{(ne(r,"root")?r.branches:s.$.parseSchema(r).branches).forEach(c=>{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)})}),s.def.ordered||n.sort((r,o)=>r.hash<o.hash?-1:1),n}}},normalize:t=>Ot(t)?{branches:t}:t,reduce:(t,s)=>{const n=Fx(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,Gs),expected:t=>{const s=_w(t.errors,"propString"),n=Object.entries(s).map(([r,o])=>{const c=[];o.forEach(m=>Yi(c,m.expected));const h=Gs(c),p=o.every(m=>m.actual===o[0].actual)?o[0].actual:De(o[0].data);return`${r&&`${r} `}must be ${h}${p&&` (was ${p})`}`});return Gs(n)},problem:t=>t.expected,message:t=>t.problem},intersections:{union:(t,s,n)=>{if(t.isNever!==s.isNever)return Z.init("presence",t,s);let r;return t.ordered?(s.ordered&&q(Px(t.expression,s.expression)),r=ef(s.branches,t.branches,n),r instanceof Z&&r.invert()):r=ef(t.branches,s.branches,n),r instanceof Z?r:n.$.parseSchema(t.ordered||s.ordered?{branches:r,ordered:!0}:{branches:r})},...Ea("union",(t,s,n)=>{const r=ef(t.branches,[s],n);return r instanceof Z?r:r.length===1?r[0]:n.$.parseSchema(t.ordered?{branches:r,ordered:!0}:{branches:r})})}});class Lx extends wa{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?Zx(this.discriminant):null);g(this,"expression",this.distribute(n=>n.nestableExpression,Qx));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 Kn})}get branchGroups(){const n=[];let r=-1;return this.branches.forEach(o=>{if(o.hasKind("unit")&&o.domain==="boolean"){r===-1?(r=n.length,n.push(o)):n[r]=L.intrinsic.boolean;return}n.push(o)}),n}createBranchedOptimisticRootApply(){return(n,r)=>{const o=this.traverseOptimistic(n);if(o!==Kn)return o;const c=new Hs(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,Gs)}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&&lh(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 E in o){const k=o[E],N=E==="default"?E:`case ${E}`;n.line(`${N}: return ${k===!0?h?n.data:k:h?`${n.invoke(k)} ? ${k.contextFreeMorph?`${Nt(k.contextFreeMorph)}(${n.data})`:n.data} : "${Kn}"`:n.invoke(k)}`)}return n}),n.traversalKind==="Allows"){n.return(h?`"${Kn}"`:!1);return}const p=Gs(this.discriminant.kind==="domain"?c.map(E=>{const k=E.slice(1,-1);return k==="function"?Ln.object:Ln[k]}):c),m=this.discriminant.path.map(E=>typeof E=="symbol"?Nt(E):JSON.stringify(E)),y=JSON.stringify(p),v=this.discriminant.kind==="domain"?`${Jx}[${r}]`:`${Ix}(${r})`;n.line(`ctx.errorFromNodeContext({
87
- code: "predicate",
88
- expected: ${y},
89
- actual: ${v},
90
- relativePath: [${m}],
91
- meta: ${this.compiledMeta}
92
- })`)}compileIndiscriminable(n){if(n.traversalKind==="Apply")n.const("errors","[]"),this.branches.forEach(r=>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,this.branches.forEach(o=>n.if(`${n.invoke(o)}`,()=>n.return(r?o.contextFreeMorph?`${Nt(o.contextFreeMorph)}(${n.data})`:n.data:!0))),n.return(r?`"${Kn}"`:!1)}}get nestableExpression(){return this.isBoolean?"boolean":`(${this.expression})`}discriminate(){var h,p;if(this.branches.length<2)return null;if(this.unitBranches.length===this.branches.length){const m=Ue(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 E=this.branches[v],k=Gn(y.in,E.in,y.$);if(k instanceof Z)for(const N of k){if(!N.kind||N.optional)continue;let B,j;if(N.kind==="domain"){const F=N.l,le=N.r;B=`"${typeof F=="string"?F:F.domain}"`,j=`"${typeof le=="string"?le:le.domain}"`}else if(N.kind==="unit")B=N.l.serializedValue,j=N.r.serializedValue;else continue;const X=n.find(F=>Zs(F.path,N.path)&&F.kind===N.kind);X?(X.cases[B]?X.cases[B].branchIndices=Yi(X.cases[B].branchIndices,m):(h=X.cases)[B]??(h[B]={branchIndices:[m],condition:N.l}),X.cases[j]?X.cases[j].branchIndices=Yi(X.cases[j].branchIndices,v):(p=X.cases)[j]??(p[j]={branchIndices:[v],condition:N.r})):n.push({kind:N.kind,cases:{[B]:{branchIndices:[m],condition:N.l},[j]:{branchIndices:[v],condition:N.r}},path:N.path})}}}const r=this.ordered?Gx(n,this.branches):n;if(!r.length)return null;const o=Hx(r,this),c={};for(const m in o.best.cases){const y=Vx(o,m);if(y===null){c[m]=!0;continue}if(y.length===this.branches.length)return null;this.ordered&&y.sort((k,N)=>k.originalIndex-N.originalIndex);const v=y.map(k=>k.branch),E=v.length===1?v[0]:this.$.node("union",this.ordered?{branches:v,ordered:!0}:v);Object.assign(this.referencesById,E.referencesById),c[m]=E}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 Hx=(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:cv(n.path)},o=s.branches.map((c,h)=>({originalIndex:h,branch:c}));return{best:n,location:r,defaultEntries:o,node:s}},Vx=(t,s)=>{const n=t.best.cases[s],r=Yx(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=Fy(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=Fy(p.branch,t.location);o==null||o.push({originalIndex:p.originalIndex,branch:m})}c.push(p)}}return t.defaultEntries=c,o},Gx=(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}),Yx=(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:[...xw(c).map(h=>({})),r]}:{domain:"object",required:[{key:c,value:r}]})}return r},cv=t=>t.reduce((s,n)=>s+Db(n,!0),"data"),Jx=Nt(Tw),Ix=Nt(De),fv={implementation:Kx,Node:Lx},Zx=t=>({kind:t.kind,path:t.path.map(s=>typeof s=="string"?s:Aa(s)),cases:Ue(t.cases,(s,n)=>[s,n===!0?n:n.hasKind("union")&&n.discriminantJson?n.discriminantJson:n.json])}),Xx={delimiter:" | ",finalDelimiter:" | "},Qx=t=>Gs(t,Xx),Gs=(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}`},ef=(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=ft(t[c],s[p],n);if(!(m instanceof Z)){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?Z.init("union",t,s):o},Fx=({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 Z||(s||Wx(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])},Wx=(t,s)=>{!t.includesTransform&&!s.includesTransform||(Zs(t.shallowMorphs,s.shallowMorphs)||q(Wy(t.expression,s.expression)),Zs(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(Wy(t.expression,s.expression)))},Fy=(t,s)=>t.transform((n,r)=>n==="domain"||n==="unit"?null:r,{shouldTransform:(n,r)=>{const o=cv(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}}),Wy=(t,s)=>`An unordered union of a type including a morph and a type with overlapping input is indeterminate:
93
- Left: ${t}
94
- Right: ${s}`,Px=(t,s)=>`The intersection of two ordered unions is indeterminate:
95
- Left: ${t}
96
- Right: ${s}`,eO=Je({kind:"unit",hasAssociatedError:!0,keys:{unit:{preserveUndefined:!0,serialize:t=>t instanceof Date?t.toISOString():Zi(t)}},normalize:t=>t,defaults:{description:t=>De(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)=>Z.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 Z.init("domain",o,r)}}return Z.init("assignability",t,s.hasKind("intersection")?s.children.find(r=>!r.allows(t.unit)):s)})}});class tO extends bh{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",Py(this.unit,this.serializedValue));g(this,"compiledNegation",Py(this.unit,this.serializedValue,"negated"));g(this,"expression",De(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}:ct.throwUnjsonifiableError(this.defaultShortDescription)}}const hv={implementation:eO,Node:tO},Py=(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}`},nO=Je({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(rO(n.expression));const r=n.branches.filter(o=>o.hasKind("unit"));return r.length?q(sO(r.map(o=>De(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=ft(t.value,s.value,n),o=r instanceof Z?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 iO extends tr{constructor(){super(...arguments);g(this,"impliedBasis",L.intrinsic.object.internal);g(this,"expression",`[${this.signature.expression}]: ${this.value.expression}`);g(this,"flatRefs",$e(this.value.flatRefs.map(n=>Si([this.signature,...n.path],n.node)),Si([this.signature],this.value)));g(this,"traverseAllows",(n,r)=>yf(n).every(o=>this.signature.traverseAllows(o[0],r)?Vn(o[0],()=>this.value.traverseAllows(o[1],r),r):!0));g(this,"traverseApply",(n,r)=>yf(n).forEach(o=>{this.signature.traverseAllows(o[0],r)&&Vn(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 dv={implementation:nO,Node:iO},sO=t=>`Index keys ${t.join(", ")} should be specified as named props.`,rO=t=>`Indexed key definition '${t}' must be a string or symbol`,aO=Je({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:Tf,optional:Tf}});class lO extends rv{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",Ao(this.errorContext))}}const pv={implementation:aO,Node:lO},oO=Je({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 yh(r,n[1],null),[r,n[1]]})},serialize:t=>t.map(s=>[s[0].collapsibleJson,Zi(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(hO);if((n=t.optionals)!=null&&n.length||(r=t.defaultables)!=null&&r.length)return q(yv)}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,E,k,N;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(;(E=c.at(-1))!=null&&E.equals(t.variadic);)c.pop();if(c.length===0&&o.length===0)for(;(k=r.at(-1))!=null&&k.equals(t.variadic);)r.pop(),n++;for(;(N=h[0])!=null&&N.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} = ${De(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=ra({l:t.tuple,r:s.tuple,disjoint:new Z,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",eg(o[0].result)):n.$.node("union",o.map(c=>({proto:Array,sequence:eg(c.result)})))}}});var Yg,Jg,Ig,Zg;class uO extends tr{constructor(){super(...arguments);g(this,"impliedBasis",L.intrinsic.Array.internal);g(this,"tuple",fO(this.inner));g(this,"prefixLength",((Yg=this.prefix)==null?void 0:Yg.length)??0);g(this,"defaultablesLength",((Jg=this.defaultables)==null?void 0:Jg.length)??0);g(this,"optionalsLength",((Ig=this.optionals)==null?void 0:Ig.length)??0);g(this,"postfixLength",((Zg=this.postfix)==null?void 0:Zg.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",cO(this));g(this,"defaultValueMorphsReference",this.defaultValueMorphs.length?Nt(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++)Vn(o,()=>this.elementAtIndex(n,o).node.traverseApply(n[o],r),r)});g(this,"expression",this.description)}addFlatRefs(){return Ly(this.flatRefs,this.prevariadic.flatMap((n,r)=>$e(n.node.flatRefs.map(o=>Si([`${r}`,...o.path],o.node)),Si([`${r}`],n.node)))),Ly(this.flatRefs,this.variadicOrPostfix.flatMap(n=>$e(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??st(`Unexpected attempt to access index ${r} on ${this}`)}}get element(){return this.cacheGetter("element",this.$.node("union",this.children))}compile(n){var r,o;(r=this.prefix)==null||r.forEach((c,h)=>n.traverseKey(`${h}`,`data[${h}]`,c)),this.defaultablesAndOptionals.forEach((c,h)=>{const p=`${h+this.prefixLength}`;n.if(`${p} >= ${n.data}.length`,()=>n.traversalKind==="Allows"?n.return(!0):n.return()),n.traverseKey(p,`data[${p}]`,c)}),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),(o=this.postfix)==null||o.forEach((c,h)=>{const p=`firstPostfixIndex + ${h}`;n.traverseKey(p,`data[${p}]`,c)})),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){var o;return this.prevariadic.length&&(n.prefixItems=this.prevariadic.map(c=>{const h=c.node.toJsonSchemaRecurse(r);if(c.kind==="defaultables"){const p=typeof c.default=="function"?c.default():c.default;h.default=p}return h})),this.minLength&&(n.minItems=this.minLength),this.variadic?(n.items=(o=this.variadic)==null?void 0:o.toJsonSchemaRecurse(r),this.maxLength&&(n.maxItems=this.maxLength)):(n.items=!1,delete n.maxItems),this.postfix?ct.throwUnjsonifiableError(`Postfix tuple element${this.postfixLength>1?"s":""} ${this.postfix.join(", ")}`):n}}const tf={},cO=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(lv(o,c,h)),n+=`${o}: ${c.id} = ${Zi(h)}, `}return n+="]",tf[n]??(tf[n]=s)},mv={implementation:oO,Node:uO},fO=t=>{var n,r,o,c;const s=[];return(n=t.prefix)==null||n.forEach(h=>s.push({kind:"prefix",node:h})),(r=t.defaultables)==null||r.forEach(([h,p])=>s.push({kind:"defaultables",node:h,default:p})),(o=t.optionals)==null||o.forEach(h=>s.push({kind:"optionals",node:h})),t.variadic&&s.push({kind:"variadic",node:t.variadic}),(c=t.postfix)==null||c.forEach(h=>s.push({kind:"postfix",node:h})),s},eg=t=>t.reduce((s,n)=>(n.kind==="variadic"?s.variadic=n.node:n.kind==="defaultables"?s.defaultables=$e(s.defaultables,[[n.node,n.default]]):s[n.kind]=$e(s[n.kind],n.node),s),{}),yv="A postfix required element cannot follow an optional or defaultable element",hO="A postfix element requires a variadic element",ra=t=>{var E,k;const[s,...n]=t.l,[r,...o]=t.r;if(!s||!r)return t;const c=((E=n.at(-1))==null?void 0:E.kind)==="postfix",h=((k=o.at(-1))==null?void 0:k.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 N=ra({...t,fixedVariants:[],r:o.map(B=>({...B,kind:"prefix"}))});N.disjoint.length===0&&t.fixedVariants.push(N)}else if(r.kind==="prefix"&&s.kind==="variadic"&&c){const N=ra({...t,fixedVariants:[],l:n.map(B=>({...B,kind:"prefix"}))});N.disjoint.length===0&&t.fixedVariants.push(N)}const m=ft(s.node,r.node,t.ctx);if(m instanceof Z)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:ra({...t,fixedVariants:[],l:n.map(N=>({...N,kind:"prefix"})),r:n.map(N=>({...N,kind:"prefix"}))});else p==="defaultables"?(s.kind==="defaultables"&&r.kind==="defaultables"&&s.default!==r.default&&q(av(s.default,r.default)),t.result=[...t.result,{kind:p,node:m,default:s.kind==="defaultables"?s.default:r.kind==="defaultables"?r.default:st(`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),ra(t)},gv=t=>s=>{var n,r;if(s.props.length||s.index){const o=((n=s.index)==null?void 0:n.map(h=>h[t]))??[];s.props.forEach(h=>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)??"{}"},dO=gv("description"),pO=gv("expression"),tg=(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 Z?r==="optional"?n.node("optional",{key:t.key,value:L.intrinsic.never.internal}):o.withPrefixKey(t.key,t.kind):null},mO=Je({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=$e(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}n.forEach(r=>s[r.outProp.kind]=$e(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:dO},intersections:{structure:(t,s,n)=>{const r={...t.inner},o={...s.inner},c=new Z;if(t.undeclared){const m=t.keyof();s.requiredKeys.forEach(y=>{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 Z)return[];const E=Rf(v,y.value,n.$);return E.required&&(o.required=Gi(o.required,E.required)),E.optional&&(o.optional=Gi(o.optional,E.optional)),E.index??[]}))}if(s.undeclared){const m=s.keyof();t.requiredKeys.forEach(y=>{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 Z)return[];const E=Rf(v,y.value,n.$);return E.required&&(r.required=Gi(r.required,E.required)),E.optional&&(r.optional=Gi(r.optional,E.optional)),E.index??[]}))}const h={};(t.undeclared||s.undeclared)&&(h.undeclared=t.undeclared==="reject"||s.undeclared==="reject"?"reject":"delete");const p=lo({kind:"structure",baseInner:h,l:oo(r),r:oo(o),roots:[],ctx:n});return p instanceof Z&&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=tg(p,h,s);if(m instanceof Z)return m}for(const[p,m]of o.entries()){const y=tg(m,h,s);if(y instanceof Z)return y;y!==null&&(c[p]=y,n=!0)}}if(n)return s.node("structure",{...t,optional:c},{prereduced:!0})}}});var Xg,Qg;class yO extends tr{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",Ue(this.props,(n,r)=>[r.key,r]));g(this,"propsByKeyReference",Nt(this.propsByKey));g(this,"expression",pO(this));g(this,"requiredKeys",((Xg=this.required)==null?void 0:Xg.map(n=>n.key))??[]);g(this,"optionalKeys",((Qg=this.optional)==null?void 0:Qg.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(!Vn(m,()=>y.value.traverseAllows(r[m],o),o))return!1}else if(Vn(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&&Nt(this.structuralMorph))}keyof(){var r;if(this._keyof)return this._keyof;let n=this.$.units(this.literalKeys).branches;return(r=this.index)==null||r.forEach(({signature:o})=>{n=n.concat(o.branches)}),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]=$e(r[o.kind],o),r);const h=o.kind??(c==null?void 0:c.kind)??"required",p=Ue(o,(m,y)=>m in mh.implementation.keys?[m,y]:[]);return r[h]=$e(r[h],this.$.node(h,p)),r},{}))}assertHasKeys(n){const r=n.filter(o=>!Gl(o,this.keyof()));if(r.length)return q(ng(this.expression,r))}get(n,...r){var m,y;let o,c=!1;const h=SO(n);if((typeof h=="string"||typeof h=="symbol")&&this.propsByKey[h]&&(o=this.propsByKey[h].value,c=this.propsByKey[h].required),(m=this.index)==null||m.forEach(v=>{Gl(h,v.signature)&&(o=(o==null?void 0:o.and(v.value))??v.value)}),this.sequence&&Gl(h,L.intrinsic.nonNegativeIntegerString))if(ne(h,"root"))this.sequence.variadic&&(o=(o==null?void 0:o.and(this.sequence.element))??this.sequence.element);else{const v=Number.parseInt(h);if(v<this.sequence.prevariadic.length){const E=this.sequence.prevariadic[v].node;o=(o==null?void 0:o.and(E))??E,c||(c=v<this.sequence.prefixLength)}else if(this.sequence.variadic){const E=this.$.node("union",this.sequence.variadicOrPostfix);o=(o==null?void 0:o.and(E))??E}}if(!o)return(y=this.sequence)!=null&&y.variadic&&ne(h,"root")&&h.extends(L.intrinsic.number)?q(AO(h.expression,this.sequence.expression)):q(ng(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=$e(r.required,n.required)),n.optional&&(r.optional=$e(r.optional,n.optional)),n.index&&(r.index=$e(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=zb(this.inner),c=h=>{const p=r.some(m=>Gl(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){var o;const r=[];return this.props.length&&r.push(`k in ${this.propsByKeyReference}`),(o=this.index)==null||o.forEach(c=>r.push(n.invoke(c.signature,{kind:"Allows",arg:"k"}))),this.sequence&&r.push("$ark.intrinsic.nonNegativeIntegerString.allows(k)"),r.join(" || ")||"false"}get structuralMorph(){return this.cacheGetter("structuralMorph",bO(this))}compile(n){if(n.traversalKind==="Apply"&&n.initializeErrorCount(),this.props.forEach(r=>{n.check(r),n.traversalKind==="Apply"&&n.returnIfFailFast()}),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(["),vO(n,this),n.line("])")))}compileExhaustiveEntry(n){var r;return n.const("k","keys[i]"),(r=this.index)==null||r.forEach(o=>{n.if(`${n.invoke(o.signature,{arg:"k",kind:"Allows"})}`,()=>n.traverseKey("k","data[k]",o.value))}),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":return this.props.length||this.index?ct.throwUnjsonifiableError(`Additional properties on array ${this.expression}`):((o=this.sequence)==null?void 0:o.reduceJsonSchema(n,r))??n;default:return ct.throwInternalOperandError("structure",n)}}reduceObjectJsonSchema(n,r){var o;return this.props.length&&(n.properties={},this.props.forEach(c=>{if(typeof c.key=="symbol")return ct.throwUnjsonifiableError(`Symbolic key ${c.serializedKey}`);const h=c.value.toJsonSchemaRecurse(r);if(c.hasDefault()){const p=typeof c.default=="function"?c.default():c.default;h.default=p}n.properties[c.key]=h}),this.requiredKeys.length&&(n.required=this.requiredKeys)),(o=this.index)==null||o.forEach(c=>{if(c.signature.equals(L.intrinsic.string))return n.additionalProperties=c.value.toJsonSchemaRecurse(r);if(!c.signature.extends(L.intrinsic.string))return ct.throwUnjsonifiableError(`Symbolic index signature ${c.signature.exclude(L.intrinsic.string)}`);c.signature.branches.forEach(h=>{var p;if(!h.hasKind("intersection")||((p=h.inner.pattern)==null?void 0:p.length)!==1)return ct.throwUnjsonifiableError(`Index signature ${h}`);n.patternProperties??(n.patternProperties={}),n.patternProperties[h.inner.pattern[0].rule]=c.value.toJsonSchemaRecurse(r)})}),this.undeclared&&!n.additionalProperties&&(n.additionalProperties=!1),n}}const nf={},gO=t=>{var n,r,o,c,h;let s="";for(let p=0;p<t.defaultable.length;p++)s+=t.defaultable[p].defaultValueMorphRef;return(n=t.sequence)!=null&&n.defaultValueMorphsReference&&(s+=(r=t.sequence)==null?void 0:r.defaultValueMorphsReference),t.undeclared==="delete"&&(s+="delete !(",(o=t.required)==null||o.forEach(p=>s+=p.compiledKey+" | "),(c=t.optional)==null||c.forEach(p=>s+=p.compiledKey+" | "),(h=t.index)==null||h.forEach(p=>s+=p.signature.id+" | "),t.sequence&&(t.sequence.maxLength===null?s+=ae.nonNegativeIntegerString.id:s+=t.sequence.tuple.forEach((p,m)=>s+=m+" | ")),s+=")"),s},bO=t=>{const s=gO(t);if(!s)return;if(nf[s])return nf[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 nf[s]=n},vO=(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")})},bv={implementation:mO,Node:yO},SO=t=>(ne(t,"root")&&t.hasKind("unit")&&(t=t.unit),typeof t=="number"&&(t=`${t}`),t),AO=(t,s)=>`${t} is not allowed as an array index on ${s}. Use the 'nonNegativeIntegerString' keyword instead.`,Rf=(t,s,n)=>{const[r,o]=Ew(t.branches,h=>h.hasKind("unit"));if(!r.length)return{index:n.node("index",{signature:t,value:s})};const c={};return r.forEach(h=>{const p=n.node("required",{key:h.unit,value:s});c[p.kind]=$e(c[p.kind],p)}),o.length&&(c.index=n.node("index",{signature:o,value:s})),c},wO=t=>ne(t,"root")?t.expression:De(t),ng=(t,s)=>`Key${s.length===1?"":"s"} ${s.map(wO).join(", ")} ${s.length===1?"does":"do"} not exist on ${t}`,Eo={...hx,alias:gh.implementation,domain:vh.implementation,unit:hv.implementation,proto:co.implementation,union:fv.implementation,morph:uv.implementation,intersection:ov.implementation,divisor:Gb.implementation,pattern:nv.implementation,predicate:Vb.implementation,required:pv.implementation,optional:mh.implementation,index:dv.implementation,sequence:mv.implementation,structure:bv.implementation};L.defaultConfig=zw(Object.assign(Ue(Eo,(t,s)=>[t,s.defaults]),{jitless:Yw(),clone:Hw,onUndeclaredKey:"ignore",exactOptionalPropertyTypes:!0,numberAllowsNaN:!1,dateAllowsInvalid:!1,onFail:null,keywords:{}}));L.resolvedConfig=Ef(L.defaultConfig,L.config);const EO={...dx,alias:gh.Node,domain:vh.Node,unit:hv.Node,proto:co.Node,union:fv.Node,morph:uv.Node,intersection:ov.Node,divisor:Gb.Node,pattern:nv.Node,predicate:Vb.Node,required:pv.Node,optional:mh.Node,index:dv.Node,sequence:mv.Node,structure:bv.Node};class Nf extends kw{get[Hn](){return"module"}}const vv=(t,s)=>new Nf(Ue(t,(n,r)=>[n,ne(r,"module")?vv(r,s):s.bindReference(r)])),xO=t=>Ot(t)?t:"branches"in t&&Ot(t.branches)?t.branches:void 0,OO=(t,s)=>q(`Node of kind ${s} is not valid as a ${t} definition`),ig=t=>`#${t} duplicates public alias ${t}`,sf={};L.ambient??(L.ambient={});let sg;const Sv="function $",_O=t=>Av(t,wv(t)),Av=(t,s)=>{const n=s.write(Sv,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)},wv=t=>new $b().return(t.reduce((s,n)=>{const r=new Wc({kind:"Allows"}).indent();n.compile(r);const o=r.write(`${n.id}Allows`),c=new Wc({kind:"Apply"}).indent();n.compile(c);const h=c.write(`${n.id}Apply`),p=`${s}${o},
97
- ${h},
98
- `;if(!n.hasKind("union"))return p;const m=new Wc({kind:"Allows",optimistic:!0}).indent();n.compile(m);const y=m.write(`${n.id}Optimistic`);return`${p}${y},
99
- `},`{
100
- `)+"}");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 uo(s,o?new Hb(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(Ql(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=sv(c),p=this.bindReference(h);return rn[c.id]=p});g(this,"parse",(s,n={})=>this.finalize(this.parseDefinition(s,n)));this.config=Ef(L.config,n),this.resolvedConfig=Ef(L.resolvedConfig,n),this.name=this.resolvedConfig.name??`anonymousScope${Object.keys(sf).length}`,this.name in sf&&q(`A Scope already named ${this.name} already exists`),sf[this.name]=this,Object.entries(s).map(o=>this.preparseOwnAliasEntry(...o)).forEach(([o,c])=>{let h=o;if(o[0]==="#"?(h=o.slice(1),h in this.aliases&&q(ig(h)),this.aliases[h]=c):(h in this.aliases&&q(ig(o)),this.aliases[h]=c,this.exportedNames.push(h)),!ne(c,"module")&&!ne(c,"generic")&&!go(c)){const p=this.preparseOwnDefinitionFormat(c,{alias:h});ne(p,"root")?this.resolutions[h]=this.bindReference(p):this.resolutions[h]=this.createParseContext(p).id}}),sg??(sg=this.node("union",{branches:["string","number","object","bigint","symbol",{unit:!0},{unit:!1},{unit:void 0},{unit:null}]},{prereduced:!0})),this.nodesByHash[sg.hash]=this.node("intersection",{},{prereduced:!0}),this.intrinsic=L.intrinsic?Ue(L.intrinsic,(o,c)=>o.startsWith("json")?[]:[o,this.bindReference(c)]):{}}get[Hn](){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:Ql(n,s);if(Rt(n)&&n.kind===o)return n;if(o==="alias"&&!(r!=null&&r.prereduced)){const{reference:m}=gh.implementation.normalize(n,this);if(m.startsWith("$")){const y=this.resolveRoot(m.slice(1));n=y,o=y.kind}}else if(o==="union"&&Fi(n,"object")){const m=xO(n);(m==null?void 0:m.length)===1&&(n=m[0],o=Ql(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:OO(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 uo(s.params,s.bodyDef,s.$,this,s.hkt),this.resolved||Object.assign(this.referencesById,n.referencesById),n}resolveRoot(s){return this.maybeResolveRoot(s)??q(Tv(s))}maybeResolveRoot(s){const n=this.maybeResolve(s);if(!ne(n,"generic"))return n}maybeResolveSubalias(s){return kf(this.aliases,s)??kf(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(ne(c,"root"))return this.resolutions[s]=c;if(ne(c,"context")){if(c.phase==="resolving")return this.node("alias",{reference:`$${s}`},{prereduced:!0});if(c.phase==="resolved")return st(`Unexpected resolved context for was uncached by its scope: ${De(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 st(`Unexpected nodesById entry for ${n}: ${De(c)}`)}let r=this.aliases[s]??((o=this.ambient)==null?void 0:o[s]);return r?(r=this.normalizeRootScopeValue(r),ne(r,"generic")?this.resolutions[s]=this.bindReference(r):ne(r,"module")?r.root?this.resolutions[s]=this.bindReference(r.root):q(Rv(s)):this.resolutions[s]=this.parse(r,{alias:s})):this.maybeResolveSubalias(s)}createParseContext(s){const n=s.id??iv(s.prefix);return rn[n]=Object.assign(s,{[Hn]:"context",$:this,id:n,phase:"unresolved"})}traversal(s){return new Hs(s,this.resolvedConfig)}import(...s){return new Nf(Ue(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]=ne(o,"module")?vv(o,this):rg(this.maybeResolve(r))}if(this.lazyResolutions.forEach(r=>r.resolution),this._exportedResolutions=_v(this,this._exports),this._json=Ov(this._exportedResolutions),Object.assign(this.resolutions,this._exportedResolutions),this.references=Object.values(this.referencesById),!this.resolvedConfig.jitless){const r=wv(this.references);this.precompilation=r.write(Sv,4),Av(this.references,r)}this.resolved=!0}const n=s.length?s:this.exportedNames;return new Nf(Ue(n,(r,o)=>[o,this._exports[o]]))}resolve(s){return this.export()[s]}parseDefinition(s,n={}){if(ne(s,"root"))return this.bindReference(s);const r=this.preparseOwnDefinitionFormat(s,n);if(ne(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=bx(c,o.id)),rn[o.id]=c,c}finalize(s){return rg(s),!s.precompilation&&!this.resolvedConfig.jitless&&_O(s.references),s}}class xv extends Ev{parseOwnDefinitionFormat(s,n){return sv(n)}preparseOwnDefinitionFormat(s,n){return this.preparseNode(Ql(s),s,n)}preparseOwnAliasEntry(s,n){return[s,n]}normalizeRootScopeValue(s){return s}}const rg=t=>(t.references.filter(s=>s.hasKind("alias")).forEach(s=>{Object.assign(s.referencesById,s.resolution.referencesById),t.references.forEach(n=>{s.id in n.referencesById&&Object.assign(n.referencesById,s.referencesById)})}),t),Ov=t=>Ue(t,(s,n)=>[s,ne(n,"root")||ne(n,"generic")?n.json:ne(n,"module")?Ov(n):st(`Unexpected resolution ${De(n)}`)]),kf=(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(!ne(o,"module"))return q(TO(r));const c=s.slice(n+1),h=o[c];if(h===void 0)return kf(o,c);if(ne(h,"root")||ne(h,"generic"))return h;if(ne(h,"module"))return h.root??q(Rv(s));st(`Unexpected resolution for alias '${s}': ${De(h)}`)},Sh=(t,s)=>new xv(t,s),xa=new xv({}),_v=(t,s)=>{const n={};for(const r in s){const o=s[r];if(ne(o,"module")){const c=_v(t,o),h=Ue(c,(p,m)=>[`${r}.${p}`,m]);Object.assign(n,h)}else ne(o,"root")||ne(o,"generic")?n[r]=o:st(`Unexpected scope resolution ${De(o)}`)}return n},Tv=t=>`'${t}' is unresolvable`,TO=t=>`'${t}' must reference a module to be accessed using dot syntax`,Rv=t=>`Reference to submodule '${t}' must specify an alias`;xa.export();const qe=xa.schema,Ah=xa.node;xa.defineSchema;const Jn=xa.generic,Nv="^(?:0|[1-9]\\d*)$",RO=new RegExp(Nv);Nt(RO);const kv=Sh({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={...kv};const Mv=Sh({integer:{domain:"number",divisor:1},lengthBoundable:["string",Array],key:["string","symbol"],nonNegativeIntegerString:{domain:"string",pattern:Nv}},{prereducedAliases:!0}).export();Object.assign(L.intrinsic,Mv);const NO=Sh({jsonPrimitive:["string","number",{unit:!0},{unit:!1},{unit:null}],jsonObject:{domain:"object",index:{signature:"string",value:"$jsonData"}},jsonData:["$jsonPrimitive","$jsonObject"]},{prereducedAliases:!0}).export(),ae={...kv,...Mv,...NO,emptyStructure:Ah("structure",{},{prereduced:!0})};L.intrinsic={...ae};const kO=t=>typeof t=="string"&&t[0]==="d"&&(t[1]==="'"||t[1]==='"')&&t.at(-1)===t[1],ag=t=>t.toString()!=="Invalid Date",MO=t=>t.slice(2,-1),$v=t=>`'${t}' could not be parsed by the Date constructor`,$O=(t,s)=>DO(t,s),DO=(t,s)=>{const n=new Date(t);if(ag(n))return n;const r=oE(t);if(r!==void 0){const o=new Date(r);if(ag(o))return o}return s?q(s===!0?$v(t):s):void 0},lg=(t,s)=>{const n=t.scanner.shiftUntil(zO[Cv[s]]);if(t.scanner.lookahead==="")return t.error(BO(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(dn(s,Dv))t.root=t.ctx.$.node("unit",{unit:n});else{const r=$O(n,$v(n));t.root=t.ctx.$.node("unit",{meta:n,unit:r})}},Dv={"'":1,'"':1},CO={"/":1,"'":1,'"':1},Cv={"d'":"'",'d"':'"',"'":"'",'"':'"',"/":"/"},zO={"'":t=>t.lookahead==="'",'"':t=>t.lookahead==='"',"/":t=>t.lookahead==="/"},UO={'"':"double-quote","'":"single-quote","/":"forward slash"},BO=(t,s)=>`${s}${t} requires a closing ${UO[Cv[s]]}`,qO=t=>`Private type references should not include '#'. Use '${t}' instead.`,zv="Optional definitions like 'string?' are only valid as properties in an object or tuple",Uv="Defaultable definitions like 'number = 0' are only valid as properties in an object or tuple",jO={">":!0,">=":!0},KO={"<":!0,"<=":!0},fo={"<":">",">":"<","<=":">=",">=":"<=","==":"=="},LO=t=>`Unmatched )${t===""?"":` before ${t}`}`,Bv=t=>`Missing ${t}`,HO=(t,s)=>`Left bounds are only valid when paired with right bounds (try ...${s}${t})`,qv=t=>`Left-bounded expressions must specify their limits using < or <= (was ${t})`,VO=(t,s,n,r)=>`An expression may have at most one left bound (parsed ${t}${fo[s]}, ${n}${fo[r]})`,GO=(t,s,n)=>jv(t,s,n,[]),jv=(t,s,n,r)=>{const o=n.parseUntilFinalizer();return r.push(o.root),o.finalizer===">"?r.length!==s.params.length?n.error(Kv(t,s.names,r.map(c=>c.expression))):r:o.finalizer===","?jv(t,s,n,r):o.error(Bv(">"))},Kv=(t,s,n)=>`${t}<${s.join(", ")}> requires exactly ${s.length} args (got ${n.length}${n.length===0?"":`: ${n.join(", ")}`})`,og=t=>{const s=t.scanner.shiftUntilNextTerminator();s==="keyof"?t.addPrefix("keyof"):t.root=JO(t,s)},YO=(t,s,n)=>{if(n.scanner.shiftUntilNonWhitespace(),n.scanner.shift()!=="<")return n.error(Kv(t,s.names,[]));const o=GO(t,s,n);return s(...o)},JO=(t,s)=>IO(t,s)??ZO(t,s)??t.error(s===""?t.scanner.lookahead==="#"?qO(t.shiftedByOne().scanner.shiftUntilNextTerminator()):Lv(t):Tv(s)),IO=(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(ne(n,"root"))return n;if(n!==void 0)return ne(n,"generic")?YO(s,n,t):q(`Unexpected resolution ${De(n)}`)},ZO=(t,s)=>{const n=uE(s);if(n!==void 0)return t.ctx.$.node("unit",{unit:n});const r=fE(s);if(r!==void 0)return t.ctx.$.node("unit",{unit:r})},Lv=t=>{const s=t.previousOperator();return s?Hv(s,t.scanner.unscanned):XO(t.scanner.unscanned)},Hv=(t,s="")=>`Token '${t}' requires a right operand${s?` before '${s}'`:""}`,XO=t=>`Expected an expression${t?` before '${t}'`:""}`,Vv=t=>t.scanner.lookahead===""?t.error(Lv(t)):t.scanner.lookahead==="("?t.shiftedByOne().reduceGroupOpen():t.scanner.lookaheadIsIn(CO)?lg(t,t.scanner.shift()):t.scanner.lookaheadIsIn(bo)?Vv(t.shiftedByOne()):t.scanner.lookahead==="d"&&t.scanner.nextLookahead in Dv?lg(t,`${t.scanner.shift()}${t.scanner.shift()}`):og(t),Hi=class Hi extends vE{shiftUntilNextTerminator(){return this.shiftUntilNonWhitespace(),this.shiftUntil(()=>this.lookahead in Hi.terminatingChars)}};g(Hi,"terminatingChars",{"<":1,">":1,"=":1,"|":1,"&":1,")":1,"[":1,"%":1,",":1,":":1,"?":1,"#":1,...bo}),g(Hi,"finalizingLookaheads",{">":1,",":1,"":1,"=":1,"?":1}),g(Hi,"lookaheadIsFinalizing",(s,n)=>s===">"?n[0]==="="?n[1]==="=":n.trimStart()===""||dn(n.trimStart()[0],Hi.terminatingChars):s==="="?n[0]!=="=":s===","||s==="?");let ca=Hi;const QO=(t,s)=>{const n=WO(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 e_(t,n)},FO={"<":1,">":1,"=":1},WO=(t,s)=>t.scanner.lookaheadIs("=")?`${s}${t.scanner.shift()}`:s,ug=(t,s,n,r)=>n.extends(L.intrinsic.number)?typeof s!="number"?q(Mf(t,s,r)):t==="=="?["min","max"]:t[0]===">"?["min"]:["max"]:n.extends(L.intrinsic.lengthBoundable)?typeof s!="number"?q(Mf(t,s,r)):t==="=="?["exactLength"]:t[0]===">"?["minLength"]:["maxLength"]:n.extends(L.intrinsic.Date)?t==="=="?["after","before"]:t[0]===">"?["after"]:["before"]:q(FE(n.expression)),PO=t=>({rule:kO(t.limit)?MO(t.limit):t.limit,exclusive:t.comparator.length===1}),e_=(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(Mf(s,c,"right"));const h=o.unit,p=s.length===1,m=ug(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(!dn(s,KO))return t.error(qv(s));const y=ug(t.branches.leftBound.comparator,t.branches.leftBound.limit,n,"left");t.constrainRoot(y[0],PO(t.branches.leftBound)),t.branches.leftBound=null},Mf=(t,s,n)=>`Comparator ${n==="left"?fo[t]:t} must be ${n==="left"?"preceded":"followed"} by a corresponding literal (was ${s})`,t_=t=>{t.scanner.shiftUntilNonWhitespace();const s=t.scanner.shiftUntilNextTerminator();t.root=t.root.brand(s)},n_=t=>{const s=t.scanner.shiftUntilNextTerminator(),n=cE(s,{errorOnFail:cg(s)});n===0&&t.error(cg(0)),t.root=t.root.constrain("divisor",n)},cg=t=>`% operator must be followed by a non-zero integer literal (was ${t})`,Gv=t=>{const s=t.scanner.shift();return s===""?t.finalize(""):s==="["?t.scanner.shift()==="]"?t.setRoot(t.root.array()):t.error(i_):s==="|"?t.scanner.lookahead===">"?t.shiftedByOne().pushRootToBranch("|>"):t.pushRootToBranch(s):s==="&"?t.pushRootToBranch(s):s===")"?t.finalizeGroup():ca.lookaheadIsFinalizing(s,t.scanner.unscanned)?t.finalize(s):dn(s,FO)?QO(t,s):s==="%"?n_(t):s==="#"?t_(t):s in bo?Gv(t):t.error(wh(s))},wh=(t,s="")=>`'${t}' is not allowed here${s&&` (should be ${s})`}`,i_="Missing expected ']'",s_=t=>{const s=t.unsetRoot();t.parseOperand();const n=t.unsetRoot();if(!n.hasKind("unit"))return t.error(r_(n.expression));const r=n.unit instanceof Date?()=>new Date(n.unit):n.unit;return[s,"=",r]},r_=t=>`Default value '${t}' must a literal value`,fg=(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 xo(new ca(t),s),o=a_(r);return r.finalizer===">"&&q(wh(">")),o},a_=t=>{t.parseOperand();let s=Eh(t).root;return s?(t.finalizer==="="?s=s_(t):t.finalizer==="?"&&(s=[s,"?"]),t.scanner.shiftUntilNonWhitespace(),t.scanner.lookahead&&q(wh(t.scanner.lookahead)),s):st(`Root was unexpectedly unset after parsing string '${t.scanner.scanned}'`)},Eh=t=>{for(;t.finalizer===void 0;)l_(t);return t},l_=t=>t.hasRoot()?t.parseOperator():t.parseOperand();class xo{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(Bv(")"));this.finalizeBranches(),this.finalizer=s}reduceLeftBound(s,n){const r=fo[n];if(!dn(r,jO))return this.error(qv(n));if(this.branches.leftBound)return this.error(VO(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(LO(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():st(`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 xo(this.scanner,this.ctx))}parseOperator(){return Gv(this)}parseOperand(){return Vv(this)}assertRangeUnset(){if(this.branches.leftBound)return this.error(HO(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 o_="An empty string is not a valid generic parameter name",$f=(t,s,n)=>{t.shiftUntilNonWhitespace();const r=t.shiftUntilNextTerminator();return r===""?t.lookahead===""&&s.length?s:q(o_):(t.shiftUntilNonWhitespace(),u_(t,r,s,n))},hg="extends ",u_=(t,s,n,r)=>{if(t.shiftUntilNonWhitespace(),t.unscanned.startsWith(hg))t.jumpForward(hg.length);else return t.lookahead===","&&t.shift(),n.push(s),$f(t,n,r);const o=Eh(new xo(t,r));return n.push([s,o.root]),$f(t,n,r)};class c_ extends er{constructor(n){super((...r)=>new Yl(n)(...r),{bind:n});g(this,"$");this.$=n}in(n){return new Yl(this.$,n===void 0?void 0:this.$.parse(n))}at(n,r){return new Yl(this.$).at(n,r)}case(n,r){return new Yl(this.$).case(n,r)}}class Yl extends er{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(h_),this.branches.length&&q(f_),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:dg});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:dg},"self")),this.$.finalize(c)}}const dg=t=>t.throw(),f_="A key matcher must be specified before the first case i.e. match.at('foo') or match.in<object>().at('bar')",h_="At most one key matcher may be specified per expression",Yv=(t,s)=>{if(Ot(t)){if(t[1]==="=")return[s.$.parseOwnDefinitionFormat(t[0],s),"=",t[2]];if(t[1]==="?")return[s.$.parseOwnDefinitionFormat(t[0],s),"?"]}return Wv(t,s)},d_="Only required keys may make their values optional, e.g. { [mySymbol]: ['number', '?'] }",p_="Only required keys may specify default values, e.g. { value: 'number = 0' }",m_=(t,s)=>{var h;let n;const r={},o=yf(t);for(const[p,m]of o){const y=b_(p);if(y.kind==="spread"){if(!ga(r))return q(g_);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(v_(B.expression));n=B.structure;continue}if(y.kind==="undeclared"){m!=="reject"&&m!=="delete"&&m!=="ignore"&&q(y_(m)),r.undeclared=m;continue}const v=Yv(m,s),E=y;if(y.kind==="required"){Ot(v)?rf(r,"optional",v[1]==="="?{key:y.normalized,value:v[0],default:v[2]}:{key:y.normalized,value:v[0]},s):rf(r,"required",{key:y.normalized,value:v},s);continue}if(Ot(v)&&(v[1]==="?"&&q(d_),v[1]==="="&&q(p_)),y.kind==="optional"){rf(r,"optional",{key:y.normalized,value:v},s);continue}const k=s.$.parseOwnDefinitionFormat(E.normalized,s),N=Rf(k,v,s.$);N.index&&(r.index=$e(r.index,N.index)),N.required&&(r.required=$e(r.required,N.required))}const c=s.$.node("structure",r);return s.$.parseSchema({domain:"object",structure:(n==null?void 0:n.merge(c))??c})},rf=(t,s,n,r)=>{t[s]=$e(t[s],r.$.node(s,n))},y_=t=>`Value of '+' key must be 'reject', 'delete', or 'ignore' (was ${De(t)})`,g_="Spread operator may only be used as the first key in an object",b_=t=>typeof t=="symbol"?{kind:"required",normalized:t}:t.at(-1)==="?"?t.at(-2)===bf?{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]===bf&&t[1]==="["&&t.at(-1)==="]"?{kind:"required",normalized:t.slice(1)}:t==="..."?{kind:"spread"}:t==="+"?{kind:"undeclared"}:{kind:"required",normalized:t==="\\..."?"...":t==="\\+"?"+":t},v_=t=>`Spread operand must resolve to an object literal type (was ${t})`,S_=(t,s)=>k_(t)?Xv[t[0]](t,s):R_(t)?Zv[t[1]](t,s):null,A_=(t,s)=>s.$.parseOwnDefinitionFormat(t[1],s).keyof(),af=(t,s)=>{if(t[2]===void 0)return q(Hv(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.$):Of(n,r,s.$);return o instanceof Z?o.throw():o},w_=(t,s)=>s.$.parseOwnDefinitionFormat(t[0],s).array(),E_=(t,s)=>typeof t[2]!="function"?q(Jv("=>",t[2])):s.$.parseOwnDefinitionFormat(t[0],s).pipe(t[2]),Jv=(t,s)=>`${t===":"?"Narrow":"Morph"} expression requires a function following '${t}' (was ${typeof s})`,x_=(t,s)=>typeof t[2]!="function"?q(Jv(":",t[2])):s.$.parseOwnDefinitionFormat(t[0],s).constrain("predicate",t[2]),O_=(t,s)=>s.$.parseOwnDefinitionFormat(t[0],s).configureReferences(t[2],"shallow"),Iv=t=>t,__=Iv({"[]":w_,"?":()=>q(zv)}),T_=Iv({"|":af,"&":af,":":x_,"=>":E_,"|>":af,"@":O_,"=":()=>q(Uv)}),Zv={...__,...T_},R_=t=>Zv[t[1]]!==void 0,N_=t=>t,Xv=N_({keyof:A_,instanceof:(t,s)=>{if(typeof t[1]!="function")return q(pg(gf(t[1])));const n=t.slice(1).map(r=>typeof r=="function"?s.$.node("proto",{proto:r}):q(pg(gf(r))));return n.length===1?n[0]:s.$.node("union",{branches:n})},"===":(t,s)=>s.$.units(t.slice(1))}),k_=t=>Xv[t[0]]!==void 0,pg=t=>`Expected a constructor following 'instanceof' operator (was ${t})`,M_=(t,s)=>{let n=[{}],r=0;for(;r<t.length;){let o=!1;t[r]==="..."&&r<t.length-1&&(o=!0,r++);const c=Yv(t[r],s),[h,p,m]=Ot(c)?c:[c];if(r++,o){if(!h.extends(L.intrinsic.Array))return q(C_(h.expression));n=n.flatMap(y=>h.distribute(v=>D_(zb(y),v)))}else n=n.map(y=>p==="?"?Qv(y,h):p==="="?$_(y,h,m):Df(y,h))}return s.$.parseSchema(n.map(o=>ga(o)?{proto:Array,exactLength:0}:{proto:Array,sequence:o}))},Df=(t,s)=>t.defaultables||t.optionals?q(t.variadic?yv:z_):(t.variadic?t.postfix=$e(t.postfix,s):t.prefix=$e(t.prefix,s),t),Qv=(t,s)=>t.variadic?q(Fv):(t.optionals=$e(t.optionals,s),t),$_=(t,s,n)=>t.variadic?q(Fv):t.optionals?q(U_):(t.defaultables=$e(t.defaultables,[[s,n]]),t),mg=(t,s)=>(t.postfix&&q(yg),t.variadic?t.variadic.equals(s)||q(yg):t.variadic=s.internal,t),D_=(t,s)=>{var r,o,c;const n=s.select({method:"find",kind:"sequence"});return n?((r=n.prefix)==null||r.forEach(h=>Df(t,h)),(o=n.optionals)==null||o.forEach(h=>Qv(t,h)),n.variadic&&mg(t,n.variadic),(c=n.postfix)==null||c.forEach(h=>Df(t,h)),t):mg(t,L.intrinsic.unknown)},C_=t=>`Spread element must be an array (was ${t})`,yg="A tuple may have at most one variadic element",z_="A required element may not follow an optional element",Fv="An optional element may not follow a variadic element",U_="A defaultable element may not follow an optional element without a default",lf={},Wv=(t,s)=>{var n;if(typeof t=="string"){if(s.args&&Object.keys(s.args).some(o=>t.includes(o)))return fg(t,s);const r=lf[n=s.$.name]??(lf[n]={});return r[t]??(r[t]=fg(t,s))}return Fi(t,"object")?B_(t,s):q(Cf(hn(t)))},B_=(t,s)=>{const n=oh(t);switch(n){case void 0:return ne(t,"root")?t:m_(t,s);case"Array":return q_(t,s);case"RegExp":return s.$.node("intersection",{domain:"string",pattern:t},{prereduced:!0});case"Function":{const r=go(t)?t():t;return ne(r,"root")?r:q(Cf("Function"))}default:return q(Cf(n??De(t)))}},q_=(t,s)=>S_(t,s)??M_(t,s),Cf=t=>`Type definitions must be strings or objects (was ${t})`;class j_ extends er{constructor(s){const n=Object.assign({errors:wi,hkt:En,$: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 uo(c,r[1],s,s,null)}return s.parse(r)},{bind:s,attach:n})}}const fa=L,Vs=class Vs extends Ev{constructor(){super(...arguments);g(this,"unit",n=>this.units([n]));g(this,"valueOf",n=>this.units(Uw(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 c_(this));g(this,"declare",()=>({type:this.type}));g(this,"type",new j_(this))}get ambientAttachments(){if(fa.typeAttachments)return this.cacheGetter("ambientAttachments",Ue(fa.typeAttachments,(n,r)=>[n,this.bindReference(r)]))}preparseOwnAliasEntry(n,r){var p;const o=n.indexOf("<");if(o===-1){if(ne(r,"module")||ne(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 BE(m,r,this)}]}parseGenericParams(n,r){return $f(new ca(n),[],this.createParseContext({...r,def:n,prefix:"generic"}))}normalizeRootScopeValue(n){return go(n)&&!ne(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=Wv(n,r);if(Ot(c)){if(c[1]==="=")return q(Uv);if(c[1]==="?")return q(zv)}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 ho=Vs;const K_=Object.assign(ho.scope,{define:t=>t}),Ee=ho;class L_ extends En{constructor(){super(...arguments);g(this,"description",'merge an object\'s properties onto another like `Merge(User, { isAdmin: "true" })`')}}const H_=Jn(["base",ae.object],["props",ae.object])(t=>t.base.merge(t.props),L_),V_=Ee.module({Key:ae.key,Merge:H_});class G_ extends En{}const Y_=Jn("element")(t=>{const s=t.element.exclude(ae.Array),n=s.array();return s.rawOr(n).pipe(ya).distribute(r=>r.assertHasKind("morph").declareOut(n),qe)},G_),J_=Ee.module({root:ae.Array,readonly:"root",index:ae.nonNegativeIntegerString,liftFrom:Y_},{name:"Array"}),zf=qe(["string",ba.FileConstructor]),I_=zf.rawOr(zf.array()),gg=qe({meta:"an object representing parsed form data",domain:"object",index:{signature:"string",value:I_}}),Z_=Ee.module({root:["instanceof",FormData],value:zf,parsed:gg,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 ba.FileConstructor?s[n]=[o,r]:o.push(r)}else s[n]=r;return s},declaredOut:gg})},{name:"FormData"}),X_=Ee.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"}),Q_={Boolean:1,Number:1,String:1},F_=Ee.module({...Ue({...vb,...Ab},(t,s)=>t in Q_?[]:[t,["instanceof",s]]),Array:J_,TypedArray:X_,FormData:Z_}),W_=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"}),P_=qe({domain:"number",divisor:1}),Pv=Ee.module({root:ae.number,integer:P_,epoch:W_,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"}),Be=(t,s)=>Ah("intersection",{domain:"string",pattern:{rule:t.source,flags:t.flags,meta:s}}),bg=Be(io,"a well-formed integer string"),e0=Ee.module({root:bg,parse:qe({in:bg,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"}),e2=Be(/^[0-9a-fA-F]+$/,"hex characters only"),t2=Ee.module({root:Be(/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/,"base64-encoded"),url:Be(/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2}(?:==|%3D%3D)?|[A-Za-z0-9_-]{3}(?:=|%3D)?)?$/,"base64url-encoded")},{name:"string.base64"}),vg=Be(/^[A-Z].*$/,"capitalized"),n2=Ee.module({root:qe({in:"string",morphs:t=>t.charAt(0).toUpperCase()+t.slice(1),declaredOut:vg}),preformatted:vg},{name:"string.capitalize"}),i2=t=>{const s=t.replace(/[- ]+/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,o>=10?n+=o%10+1:n+=o):n+=o,c=!c;return!!(n%10===0&&s)},s2=/^(?:4[0-9]{12}(?:[0-9]{3,6})?|5[1-5][0-9]{14}|(222[1-9]|22[3-9][0-9]|2[3-6][0-9]{2}|27[01][0-9]|2720)[0-9]{12}|6(?:011|5[0-9][0-9])[0-9]{12,15}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\d{3})\d{11}|6[27][0-9]{14}|^(81[0-9]{14,17}))$/,r2=qe({domain:"string",pattern:{meta:"a credit card number",rule:s2.source},predicate:{meta:"a credit card number",predicate:i2}}),a2=/^([+-]?\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)?)?)?)?$/,l2=t=>!Number.isNaN(new Date(t).valueOf()),Sg=qe({domain:"string",predicate:{meta:"a parsable date",predicate:l2}}).assertHasKind("intersection"),Ag=e0.root.internal.narrow((t,s)=>{const n=Number.parseInt(t),r=Pv.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"),o2=Ee.module({root:Ag,parse:qe({in:Ag,morphs:t=>new Date(t),declaredOut:ae.Date})},{name:"string.date.epoch"}),wg=Be(a2,"an ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) date").internal.assertHasKind("intersection"),u2=Ee.module({root:wg,parse:qe({in:wg,morphs:t=>new Date(t),declaredOut:ae.Date})},{name:"string.date.iso"}),c2=Ee.module({root:Sg,parse:qe({declaredIn:Sg,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:u2,epoch:o2},{name:"string.date"}),f2=Be(/^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}$/,"an email address"),Eg="(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])",bi=`(${Eg}[.]){3}${Eg}`,h2=new RegExp(`^${bi}$`),Fe="(?:[0-9a-fA-F]{1,4})",d2=new RegExp(`^((?:${Fe}:){7}(?:${Fe}|:)|(?:${Fe}:){6}(?:${bi}|:${Fe}|:)|(?:${Fe}:){5}(?::${bi}|(:${Fe}){1,2}|:)|(?:${Fe}:){4}(?:(:${Fe}){0,1}:${bi}|(:${Fe}){1,3}|:)|(?:${Fe}:){3}(?:(:${Fe}){0,2}:${bi}|(:${Fe}){1,4}|:)|(?:${Fe}:){2}(?:(:${Fe}){0,3}:${bi}|(:${Fe}){1,5}|:)|(?:${Fe}:){1}(?:(:${Fe}){0,4}:${bi}|(:${Fe}){1,6}|:)|(?::((?::${Fe}){0,5}:${bi}|(?::${Fe}){1,7}|:)))(%[0-9a-zA-Z.]{1,})?$`),p2=Ee.module({root:["v4 | v6","@","an IP address"],v4:Be(h2,"an IPv4 address"),v6:Be(d2,"an IPv6 address")},{name:"string.ip"}),Ys="a JSON string",t0=t=>{if(!(t instanceof SyntaxError))throw t;return`must be ${Ys} (${t})`},m2=qe({meta:Ys,domain:"string",predicate:{meta:Ys,predicate:(t,s)=>{try{return JSON.parse(t),!0}catch(n){return s.reject({code:"predicate",expected:Ys,problem:t0(n)})}}}}),y2=(t,s)=>{if(t.length===0)return s.error({code:"predicate",expected:Ys,actual:"empty"});try{return JSON.parse(t)}catch(n){return s.error({code:"predicate",expected:Ys,problem:t0(n)})}},g2=Ee.module({root:m2,parse:qe({meta:"safe JSON string parser",in:"string",morphs:y2,declaredOut:ae.jsonObject})},{name:"string.json"}),xg=Be(/^[a-z]*$/,"only lowercase letters"),b2=Ee.module({root:qe({in:"string",morphs:t=>t.toLowerCase(),declaredOut:xg}),preformatted:xg},{name:"string.lower"}),n0=["NFC","NFD","NFKC","NFKD"],Oa=Ue(n0,(t,s)=>[s,qe({domain:"string",predicate:n=>n.normalize(s)===n,meta:`${s}-normalized unicode`})]),Oo=Ue(n0,(t,s)=>[s,qe({in:"string",morphs:n=>n.normalize(s),declaredOut:Oa[s]})]),v2=Ee.module({root:Oo.NFC,preformatted:Oa.NFC},{name:"string.normalize.NFC"}),S2=Ee.module({root:Oo.NFD,preformatted:Oa.NFD},{name:"string.normalize.NFD"}),A2=Ee.module({root:Oo.NFKC,preformatted:Oa.NFKC},{name:"string.normalize.NFKC"}),w2=Ee.module({root:Oo.NFKD,preformatted:Oa.NFKD},{name:"string.normalize.NFKD"}),E2=Ee.module({root:"NFC",NFC:v2,NFD:S2,NFKC:A2,NFKD:w2},{name:"string.normalize"}),Og=Be(vf,"a well-formed numeric string"),x2=Ee.module({root:Og,parse:qe({in:Og,morphs:t=>Number.parseFloat(t),declaredOut:ae.number})},{name:"string.numeric"}),O2=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/,_2=Be(O2,"a semantic version (see https://semver.org/)"),_g=Be(/^\S.*\S$|^\S?$/,"trimmed"),T2=Ee.module({root:qe({in:"string",morphs:t=>t.trim(),declaredOut:_g}),preformatted:_g},{name:"string.trim"}),Tg=Be(/^[A-Z]*$/,"only uppercase letters"),R2=Ee.module({root:qe({in:"string",morphs:t=>t.toUpperCase(),declaredOut:Tg}),preformatted:Tg},{name:"string.upper"}),N2=t=>{if(URL.canParse)return URL.canParse(t);try{return new URL(t),!0}catch{return!1}},Rg=qe({domain:"string",predicate:{meta:"a URL string",predicate:N2}}),k2=Ee.module({root:Rg,parse:qe({declaredIn:Rg,in:"string",morphs:(t,s)=>{try{return new URL(t)}catch{return s.error("a URL string")}},declaredOut:qe(URL)})},{name:"string.url"}),M2=Ee.module({root:["versioned | nil | max","@","a UUID"],"#nil":"'00000000-0000-0000-0000-000000000000'","#max":"'ffffffff-ffff-ffff-ffff-ffffffffffff'","#versioned":/[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}/i,v1:Be(/^[0-9a-f]{8}-[0-9a-f]{4}-1[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,"a UUIDv1"),v2:Be(/^[0-9a-f]{8}-[0-9a-f]{4}-2[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,"a UUIDv2"),v3:Be(/^[0-9a-f]{8}-[0-9a-f]{4}-3[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,"a UUIDv3"),v4:Be(/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,"a UUIDv4"),v5:Be(/^[0-9a-f]{8}-[0-9a-f]{4}-5[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,"a UUIDv5"),v6:Be(/^[0-9a-f]{8}-[0-9a-f]{4}-6[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,"a UUIDv6"),v7:Be(/^[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,"a UUIDv7"),v8:Be(/^[0-9a-f]{8}-[0-9a-f]{4}-8[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,"a UUIDv8")},{name:"string.uuid"}),$2=Ee.module({root:ae.string,alpha:Be(/^[A-Za-z]*$/,"only letters"),alphanumeric:Be(/^[A-Za-z\d]*$/,"only letters and digits 0-9"),hex:e2,base64:t2,capitalize:n2,creditCard:r2,date:c2,digits:Be(/^\d*$/,"only digits 0-9"),email:f2,integer:e0,ip:p2,json:g2,lower:b2,normalize:E2,numeric:x2,semver:_2,trim:T2,upper:R2,url:k2,uuid:M2},{name:"string"}),D2=Ee.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}),C2=Ee.module({root:ae.unknown,any:ae.unknown},{name:"unknown"}),z2=Ee.module({root:ae.jsonObject,stringify:Ah("morph",{in:ae.jsonObject,morphs:t=>JSON.stringify(t),declaredOut:ae.string})},{name:"object.json"}),U2=Ee.module({root:ae.object,json:z2},{name:"object"});class B2 extends En{constructor(){super(...arguments);g(this,"description",'instantiate an object from an index signature and corresponding value type like `Record("string", "number")`')}}const q2=Jn(["K",ae.key],"V")(t=>({domain:"object",index:{signature:t.K,value:t.V}}),B2);class j2 extends En{constructor(){super(...arguments);g(this,"description",'pick a set of properties from an object like `Pick(User, "name | age")`')}}const K2=Jn(["T",ae.object],["K",ae.key])(t=>t.T.pick(t.K),j2);class L2 extends En{constructor(){super(...arguments);g(this,"description",'omit a set of properties from an object like `Omit(User, "age")`')}}const H2=Jn(["T",ae.object],["K",ae.key])(t=>t.T.omit(t.K),L2);class V2 extends En{constructor(){super(...arguments);g(this,"description","make all named properties of an object optional like `Partial(User)`")}}const G2=Jn(["T",ae.object])(t=>t.T.partial(),V2);class Y2 extends En{constructor(){super(...arguments);g(this,"description","make all named properties of an object required like `Required(User)`")}}const J2=Jn(["T",ae.object])(t=>t.T.required(),Y2);class I2 extends En{constructor(){super(...arguments);g(this,"description",'exclude branches of a union like `Exclude("boolean", "true")`')}}const Z2=Jn("T","U")(t=>t.T.exclude(t.U),I2);class X2 extends En{constructor(){super(...arguments);g(this,"description",'extract branches of a union like `Extract("0 | false | 1", "number")`')}}const Q2=Jn("T","U")(t=>t.T.extract(t.U),X2),F2=Ee.module({Exclude:Z2,Extract:Q2,Omit:H2,Partial:G2,Pick:K2,Record:q2,Required:J2}),Wi=K_({...D2,...F2,...F_,...V_,string:$2,number:Pv,object:U2,unknown:C2},{prereducedAliases:!0,name:"ark"}),ut=Wi.export();Object.assign(fa.ambient,ut);fa.typeAttachments={string:ut.string.root,number:ut.number.root,bigint:ut.bigint,boolean:ut.boolean,symbol:ut.symbol,undefined:ut.undefined,null:ut.null,object:ut.object.root,unknown:ut.unknown.root,false:ut.false,true:ut.true,never:ut.never,arrayIndex:ut.Array.index,Key:ut.Key,Record:ut.Record,Array:ut.Array.root,Date:ut.Date};const dt=Object.assign(Wi.type,fa.typeAttachments);Wi.match;Wi.generic;Wi.schema;Wi.define;Wi.declare;const i0={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 W2(t){return Number.parseInt(t,10)}const P2=dt(i0),eT=P2.keyof().pipe(t=>W2(t));dt([eT,"string"]);function tT(){return K.jsxs("svg",{id:"uuid-3d2d6be6-f179-42a3-9511-1e9ddeb8575f",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 500 101",children:[K.jsx("title",{children:"Tempest Games Logo"}),K.jsx("path",{d:"M155.76.93v59.89h-17.11V7.78h-13.69V.93h30.8Z",style:{fill:"var(--logo-color)",strokeWidth:0}}),K.jsx("path",{d:"M202.91,7.86h-13.18v17.03h13.18v6.84h-13.18v22.24h13.18v6.84h-30.29V.93h30.29v6.93Z",style:{fill:"var(--logo-color)",strokeWidth:0}}),K.jsx("path",{d:"M289.49.93v59.89h-17.11V7.78h-.43c-8.21,0-11.21,5.82-11.21,17.03v36.02h-16.25V24.8c0-11.21-2.99-17.03-11.21-17.03h-.43v53.04h-17.11V.93h18.74c9.92,0,15.31,4.96,18.14,11.21,2.82-6.25,8.21-11.21,18.14-11.21h18.73Z",style:{fill:"var(--logo-color)",strokeWidth:0}}),K.jsx("path",{d:"M352.82,29.68c0,11.72-6.42,19.16-24.55,19.16h-4.53v11.98h-17.11V1.1l46.2-.17v28.75ZM323.73,7.78v34.22h2.48c7.36,0,9.5-4.11,9.5-12.15V7.78h-11.98Z",style:{fill:"var(--logo-color)",strokeWidth:0}}),K.jsx("path",{d:"M396.8,7.86h-13.17v17.03h13.17v6.84h-13.17v22.24h13.17v6.84h-30.28V.93h30.28v6.93Z",style:{fill:"var(--logo-color)",strokeWidth:0}}),K.jsx("path",{d:"M425.9,12.57v14.03h27.89v16.94c0,12.75-1.71,18.13-16.43,18.13h-14.54c-9.58,0-14.03-2.74-14.03-11.97v-5.99h15.4v5.13c0,4.53.77,5.99,4.62,5.99h1.71c5.05,0,6.16-1.46,6.16-6.84v-14.54h-27.89v-16.68c0-13.52,3.85-16.68,18.82-16.68h12.83c8.81,0,13.17,1.54,13.17,10.78v7.19h-15.4v-6.5c0-3.42-1.03-4.62-4.45-4.62h-1.45c-4.28,0-6.42,1.46-6.42,5.65Z",style:{fill:"var(--logo-color)",strokeWidth:0}}),K.jsx("path",{d:"M500,7.78h-13.69v53.04h-17.11V.93h30.8v6.84Z",style:{fill:"var(--logo-color)",strokeWidth:0}}),K.jsx("path",{d:"M155.96,93.78v-3.57h-5.58v-7.14h13.39v17.85h-24.76v-28.56h24.76v7.14h-16.96v14.28h9.15Z",style:{fill:"var(--logo-color)",strokeWidth:0}}),K.jsx("path",{d:"M224.26,100.92h-8.25v-10.71h-8.25v3.57h4.68v7.14h-12.94v-17.85h16.51v-3.57h-16.51v-7.14h24.76v28.56Z",style:{fill:"var(--logo-color)",strokeWidth:0}}),K.jsx("path",{d:"M259.99,72.36h30.57v28.56h-7.81v-21.42h-3.57v21.42h-7.81v-21.42h-3.57v21.42h-7.81v-28.56Z",style:{fill:"var(--logo-color)",strokeWidth:0}}),K.jsx("path",{d:"M343.24,83.08v-3.57h-9.14v14.28h16.96v7.14h-24.76v-28.56h24.76v17.85h-13.38v-7.14h5.57Z",style:{fill:"var(--logo-color)",strokeWidth:0}}),K.jsx("path",{d:"M394.59,79.5v3.57h16.96v17.85h-24.76v-7.14h16.96v-3.57h-16.96v-17.85h24.76v7.14h-16.96Z",style:{fill:"var(--logo-color)",strokeWidth:0}}),K.jsx("path",{d:"M0,63.42v-20.84h20.83L0,63.42ZM100,.92v32.29h-35.42v8.33h-8.33V14.46h-22.92l1.04,7.29h9.38v19.79h-8.33v-8.33H0V.92h100ZM0,100.92v-26.04l6.25-1.04,25-26.04,1.04,1.05-10.42,18.75-4.16,7.29h13.54l3.13-3.12,8.33-22.92h1.04v41.66h3.12l9.38-8.33v-33.33h1.04l8.33,22.92,3.12,3.12h13.54l-4.17-7.29-10.42-19.8,1.04-1.04,25,27.09,6.25,1.04v26.04H0ZM100,42.59v20.84l-20.83-20.84h20.83Z",style:{fill:"var(--logo-color)",strokeWidth:0}})]})}function _o(t){return K.jsx("a",{...t})}const nT={class:"_class_wtkls_1"};function iT(t){return["required",t]}function sT(t){return["optional",t]}function rT(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 wn=Object.create(null);wn.open="0";wn.close="1";wn.ping="2";wn.pong="3";wn.message="4";wn.upgrade="5";wn.noop="6";const Fl=Object.create(null);Object.keys(wn).forEach(t=>{Fl[wn[t]]=t});const Uf={type:"error",data:"parser error"},s0=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",r0=typeof ArrayBuffer=="function",a0=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t&&t.buffer instanceof ArrayBuffer,xh=({type:t,data:s},n,r)=>s0&&s instanceof Blob?n?r(s):Ng(s,r):r0&&(s instanceof ArrayBuffer||a0(s))?n?r(s):Ng(new Blob([s]),r):r(wn[t]+(s||"")),Ng=(t,s)=>{const n=new FileReader;return n.onload=function(){const r=n.result.split(",")[1];s("b"+(r||""))},n.readAsDataURL(t)};function kg(t){return t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}let of;function aT(t,s){if(s0&&t.data instanceof Blob)return t.data.arrayBuffer().then(kg).then(s);if(r0&&(t.data instanceof ArrayBuffer||a0(t.data)))return s(kg(t.data));xh(t,!1,n=>{of||(of=new TextEncoder),s(of.encode(n))})}const Mg="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",aa=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let t=0;t<Mg.length;t++)aa[Mg.charCodeAt(t)]=t;const lT=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=aa[t.charCodeAt(r)],h=aa[t.charCodeAt(r+1)],p=aa[t.charCodeAt(r+2)],m=aa[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},oT=typeof ArrayBuffer=="function",Oh=(t,s)=>{if(typeof t!="string")return{type:"message",data:l0(t,s)};const n=t.charAt(0);return n==="b"?{type:"message",data:uT(t.substring(1),s)}:Fl[n]?t.length>1?{type:Fl[n],data:t.substring(1)}:{type:Fl[n]}:Uf},uT=(t,s)=>{if(oT){const n=lT(t);return l0(n,s)}else return{base64:!0,data:t}},l0=(t,s)=>{switch(s){case"blob":return t instanceof Blob?t:new Blob([t]);case"arraybuffer":default:return t instanceof ArrayBuffer?t:t.buffer}},o0="",cT=(t,s)=>{const n=t.length,r=new Array(n);let o=0;t.forEach((c,h)=>{xh(c,!1,p=>{r[h]=p,++o===n&&s(r.join(o0))})})},fT=(t,s)=>{const n=t.split(o0),r=[];for(let o=0;o<n.length;o++){const c=Oh(n[o],s);if(r.push(c),c.type==="error")break}return r};function hT(){return new TransformStream({transform(t,s){aT(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 uf;function Jl(t){return t.reduce((s,n)=>s+n.length,0)}function Il(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 dT(t,s){uf||(uf=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(Jl(n)<1)break;const m=Il(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(Jl(n)<2)break;const m=Il(n,2);o=new DataView(m.buffer,m.byteOffset,m.length).getUint16(0),r=3}else if(r===2){if(Jl(n)<8)break;const m=Il(n,8),y=new DataView(m.buffer,m.byteOffset,m.length),v=y.getUint32(0);if(v>Math.pow(2,21)-1){p.enqueue(Uf);break}o=v*Math.pow(2,32)+y.getUint32(4),r=3}else{if(Jl(n)<o)break;const m=Il(n,o);p.enqueue(Oh(c?m:uf.decode(m),s)),r=0}if(o===0||o>t){p.enqueue(Uf);break}}}})}const u0=4;function et(t){if(t)return pT(t)}function pT(t){for(var s in et.prototype)t[s]=et.prototype[s];return t}et.prototype.on=et.prototype.addEventListener=function(t,s){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(s),this};et.prototype.once=function(t,s){function n(){this.off(t,n),s.apply(this,arguments)}return n.fn=s,this.on(t,n),this};et.prototype.off=et.prototype.removeListener=et.prototype.removeAllListeners=et.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};et.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};et.prototype.emitReserved=et.prototype.emit;et.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]};et.prototype.hasListeners=function(t){return!!this.listeners(t).length};const To=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")(),mT="arraybuffer";function c0(t,...s){return s.reduce((n,r)=>(t.hasOwnProperty(r)&&(n[r]=t[r]),n),{})}const yT=an.setTimeout,gT=an.clearTimeout;function Ro(t,s){s.useNativeTimers?(t.setTimeoutFn=yT.bind(an),t.clearTimeoutFn=gT.bind(an)):(t.setTimeoutFn=an.setTimeout.bind(an),t.clearTimeoutFn=an.clearTimeout.bind(an))}const bT=1.33;function vT(t){return typeof t=="string"?ST(t):Math.ceil((t.byteLength||t.size)*bT)}function ST(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 f0(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function AT(t){let s="";for(let n in t)t.hasOwnProperty(n)&&(s.length&&(s+="&"),s+=encodeURIComponent(n)+"="+encodeURIComponent(t[n]));return s}function wT(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 ET extends Error{constructor(s,n,r){super(s),this.description=n,this.context=r,this.type="TransportError"}}class _h extends et{constructor(s){super(),this.writable=!1,Ro(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 ET(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=Oh(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=AT(s);return n.length?"?"+n:""}}class xT extends _h{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)};fT(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,cT(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]=f0()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(s,n)}}let h0=!1;try{h0=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const OT=h0;function _T(){}class TT extends xT{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 Js=class Wl extends et{constructor(s,n,r){super(),this.createRequest=s,Ro(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=c0(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=Wl.requestsCount++,Wl.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=_T,s)try{this._xhr.abort()}catch{}typeof document<"u"&&delete Wl.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()}};Js.requestsCount=0;Js.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",$g);else if(typeof addEventListener=="function"){const t="onpagehide"in an?"pagehide":"unload";addEventListener(t,$g,!1)}}function $g(){for(let t in Js.requests)Js.requests.hasOwnProperty(t)&&Js.requests[t].abort()}const RT=function(){const t=d0({xdomain:!1});return t&&t.responseType!==null}();class NT extends TT{constructor(s){super(s);const n=s&&s.forceBase64;this.supportsBinary=RT&&!n}request(s={}){return Object.assign(s,{xd:this.xd},this.opts),new Js(d0,this.uri(),s)}}function d0(t){const s=t.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!s||OT))return new XMLHttpRequest}catch{}if(!s)try{return new an[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const p0=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class kT extends _h{get name(){return"websocket"}doOpen(){const s=this.uri(),n=this.opts.protocols,r=p0?{}:c0(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;xh(r,this.supportsBinary,c=>{try{this.doWrite(r,c)}catch{}o&&To(()=>{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]=f0()),this.supportsBinary||(n.b64=1),this.createUri(s,n)}}const cf=an.WebSocket||an.MozWebSocket;class MT extends kT{createSocket(s,n,r){return p0?new cf(s,n,r):n?new cf(s,n):new cf(s)}doWrite(s,n){this.ws.send(n)}}class $T extends _h{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=dT(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=s.readable.pipeThrough(n).getReader(),o=hT();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&&To(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var s;(s=this._transport)===null||s===void 0||s.close()}}const DT={websocket:MT,webtransport:$T,polling:NT},CT=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,zT=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Bf(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=CT.exec(t||""),c={},h=14;for(;h--;)c[zT[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=UT(c,c.path),c.queryKey=BT(c,c.query),c}function UT(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 BT(t,s){const n={};return s.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,o,c){o&&(n[o]=c)}),n}const qf=typeof addEventListener=="function"&&typeof removeEventListener=="function",Pl=[];qf&&addEventListener("offline",()=>{Pl.forEach(t=>t())},!1);class Ai extends et{constructor(s,n){if(super(),this.binaryType=mT,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=Bf(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=Bf(n.host).host);Ro(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=wT(this.opts.query)),qf&&(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"})},Pl.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(s){const n=Object.assign({},this.opts.query);n.EIO=u0,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+=vT(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,To(()=>{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(),qf&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const r=Pl.indexOf(this._offlineEventListener);r!==-1&&Pl.splice(r,1)}this.readyState="closed",this.id=null,this.emitReserved("close",s,n),this.writeBuffer=[],this._prevBufferLen=0}}}Ai.protocol=u0;class qT 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",E=>{if(!r)if(E.type==="pong"&&E.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 k=new Error("probe error");k.transport=n.name,this.emitReserved("upgradeError",k)}}))};function c(){r||(r=!0,v(),n.close(),n=null)}const h=E=>{const k=new Error("probe error: "+E);k.transport=n.name,c(),this.emitReserved("upgradeError",k)};function p(){h("transport closed")}function m(){h("socket closed")}function y(E){n&&E.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 qT{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=>DT[o]).filter(o=>!!o)),super(s,r)}};function KT(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=Bf(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 LT=typeof ArrayBuffer=="function",HT=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t.buffer instanceof ArrayBuffer,m0=Object.prototype.toString,VT=typeof Blob=="function"||typeof Blob<"u"&&m0.call(Blob)==="[object BlobConstructor]",GT=typeof File=="function"||typeof File<"u"&&m0.call(File)==="[object FileConstructor]";function Th(t){return LT&&(t instanceof ArrayBuffer||HT(t))||VT&&t instanceof Blob||GT&&t instanceof File}function eo(t,s){if(!t||typeof t!="object")return!1;if(Array.isArray(t)){for(let n=0,r=t.length;n<r;n++)if(eo(t[n]))return!0;return!1}if(Th(t))return!0;if(t.toJSON&&typeof t.toJSON=="function"&&arguments.length===1)return eo(t.toJSON(),!0);for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&eo(t[n]))return!0;return!1}function YT(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(Th(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 JT(t,s){return t.data=Kf(t.data,s),delete t.attachments,t}function Kf(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]=Kf(t[n],s);else if(typeof t=="object")for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(t[n]=Kf(t[n],s));return t}const IT=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],ZT=5;var ye;(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"})(ye||(ye={}));class XT{constructor(s){this.replacer=s}encode(s){return(s.type===ye.EVENT||s.type===ye.ACK)&&eo(s)?this.encodeAsBinary({type:s.type===ye.EVENT?ye.BINARY_EVENT:ye.BINARY_ACK,nsp:s.nsp,data:s.data,id:s.id}):[this.encodeAsString(s)]}encodeAsString(s){let n=""+s.type;return(s.type===ye.BINARY_EVENT||s.type===ye.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=YT(s),r=this.encodeAsString(n.packet),o=n.buffers;return o.unshift(r),o}}function Dg(t){return Object.prototype.toString.call(t)==="[object Object]"}class Rh extends et{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===ye.BINARY_EVENT;r||n.type===ye.BINARY_ACK?(n.type=r?ye.EVENT:ye.ACK,this.reconstructor=new QT(n),n.attachments===0&&super.emitReserved("decoded",n)):super.emitReserved("decoded",n)}else if(Th(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(ye[r.type]===void 0)throw new Error("unknown packet type "+r.type);if(r.type===ye.BINARY_EVENT||r.type===ye.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(Rh.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 ye.CONNECT:return Dg(n);case ye.DISCONNECT:return n===void 0;case ye.CONNECT_ERROR:return typeof n=="string"||Dg(n);case ye.EVENT:case ye.BINARY_EVENT:return Array.isArray(n)&&(typeof n[0]=="number"||typeof n[0]=="string"&&IT.indexOf(n[0])===-1);case ye.ACK:case ye.BINARY_ACK:return Array.isArray(n)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class QT{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=JT(this.reconPack,this.buffers);return this.finishedReconstruction(),n}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const FT=Object.freeze(Object.defineProperty({__proto__:null,Decoder:Rh,Encoder:XT,get PacketType(){return ye},protocol:ZT},Symbol.toStringTag,{value:"Module"}));function fn(t,s,n){return t.on(s,n),function(){t.off(s,n)}}const WT=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class y0 extends et{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(WT.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:ye.EVENT,data:n};if(h.options={},h.options.compress=this.flags.compress!==!1,typeof n[n.length-1]=="function"){const v=this.ids++,E=n.pop();this._registerAckCallback(v,E),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:ye.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 ye.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 ye.EVENT:case ye.BINARY_EVENT:this.onevent(s);break;case ye.ACK:case ye.BINARY_ACK:this.onack(s);break;case ye.DISCONNECT:this.ondisconnect();break;case ye.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:ye.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:ye.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 ir(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}ir.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};ir.prototype.reset=function(){this.attempts=0};ir.prototype.setMin=function(t){this.ms=t};ir.prototype.setMax=function(t){this.max=t};ir.prototype.setJitter=function(t){this.jitter=t};class Lf extends et{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,Ro(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 ir({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||FT;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){To(()=>{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 y0(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 ia={};function to(t,s){typeof t=="object"&&(s=t,t=void 0),s=s||{};const n=KT(t,s.path||"/socket.io"),r=n.source,o=n.id,c=n.path,h=ia[o]&&c in ia[o].nsps,p=s.forceNew||s["force new connection"]||s.multiplex===!1||h;let m;return p?m=new Lf(r,s):(ia[o]||(ia[o]=new Lf(r,s)),m=ia[o]),n.query&&!s.query&&(s.query=n.queryKey),m.socket(n.path,s)}Object.assign(to,{Manager:Lf,Socket:y0,io:to,connect:to});const PT=["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"],eR=3,tR=15,nR=/^[a-zA-Z0-9_-]+$/,iR=dt(nR).pipe(dt(`string > ${eR} & string < ${tR}`)).brand("username"),Cg=20,zg={0:"o",1:"l",3:"e",4:"a",5:"s",7:"t","@":"a",$:"s","!":"i"};function sR(t){let s="";for(const n of t)n in zg?s+=zg[n]:s+=n;return s}function rR(t){const s=t.toLocaleLowerCase(),n=sR(s);for(const r of PT)if(n.includes(r)||s.includes(r))return!0;return!1}function aR(t){const s=new Set(t).size;return t.length*Math.log2(s)}function lR(t){let s=0;return rR(t)&&(s-=100),s+=aR(t)*.5,Math.max(s,0)}const oR=dt("string").narrow((t,s)=>{const n=lR(t);return n>=Cg?!0:s.mustBe(`Of complexity ${Cg} or more. Was ${n.toFixed(2)}.`)}).brand("password");dt({"+":"delete",username:"string",password:"string"});const uR=dt("string").brand("email");dt({"+":"delete",username:"string",password:"string",email:"string"});var cR={};function fR(t,s){const n={},r=[];for(const o in t){const c=t[o],h=s[o],p=c["~standard"].validate(h);if(p instanceof Promise)throw new Error(`Validation must be synchronous, but ${o} returned a Promise.`);if(p.issues){r.push(...p.issues.map(m=>({...m,path:[o,...m.path??[]]})));continue}n[o]=p.value}return r.length?{issues:r}:{value:n}}function hR(t){const s=t.runtimeEnvStrict??t.runtimeEnv??cR;for(const[F,le]of Object.entries(s))le===""&&delete s[F];if(!!t.skipValidation)return s;const r=typeof t.client=="object"?t.client:{},o=typeof t.server=="object"?t.server:{},c=typeof t.shared=="object"?t.shared:{},h=t.isServer??(typeof window>"u"||"Deno"in window),p=h?{...o,...c,...r}:{...r,...c},m=fR(p,s),y=t.onValidationError??(F=>{throw console.error("❌ Invalid environment variables:",F),new Error("Invalid environment variables")}),v=t.onInvalidAccess??(()=>{throw new Error("❌ Attempted to access a server-side environment variable on the client")});if(m.issues)return y(m.issues);const E=F=>t.clientPrefix?!F.startsWith(t.clientPrefix)&&!(F in c):!0,k=F=>h||!E(F),N=F=>F==="__esModule"||F==="$$typeof",B=(t.extends??[]).reduce((F,le)=>Object.assign(F,le),{}),j=Object.assign(m.value,B);return new Proxy(j,{get(F,le){if(typeof le=="string"&&!N(le))return k(le)?Reflect.get(F,le):v(le)}})}const dR={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_BACKEND_ORIGIN:"https://realtime.tempest.games"},pR="__vite_start_time"in globalThis,mR=typeof window<"u",jn=dt("string"),Ug=dt('"true" | "false" | undefined'),Nh=hR({isServer:!pR&&!mR,server:{CI:dt("string | undefined").pipe(Boolean),POSTGRES_USER:jn,POSTGRES_PASSWORD:jn,POSTGRES_DATABASE:jn,POSTGRES_HOST:jn,POSTGRES_PORT:jn.pipe(t=>Number.parseInt(t,10)),BACKEND_PORT:jn.pipe(t=>Number.parseInt(t,10)),RUN_WORKERS_FROM_SOURCE:Ug.pipe(t=>t==="true"),FRONTEND_PORT:jn.pipe(t=>Number.parseInt(t,10)),FRONTEND_ORIGINS:jn.pipe.try(t=>JSON.parse(t),dt("string[]")),OPENAI_API_KEY:dt("string | undefined")},clientPrefix:"VITE_",client:{VITE_BACKEND_ORIGIN:jn,VITE_USE_SELF_SIGNED_CERTIFICATE:Ug.pipe(t=>t==="true")},runtimeEnv:dR}),kh=to(Nh.VITE_BACKEND_ORIGIN,{auth:t=>{const s=hf(Fs);s&&t(s)},autoConnect:!1}).on("connect",()=>{console.log("connected")}).on("connect_error",()=>{console.log("connect_error"),If(Fs,null)}),Fs=Zt({key:"auth",default:null,effects:[({onSet:t})=>{t(({newValue:s})=>{s?(localStorage.setItem("username",s.username),localStorage.setItem("sessionKey",s.sessionKey),console.log("connecting..."),kh.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})}]}),ha=Zt({key:"username",default:window.localStorage.getItem("username")??""}),g0=Xi({key:"usernameIssues",get:({get:t})=>{const s=t(ha),n=iR(s);return n instanceof dt.errors?n:null}}),Ws=Zt({key:"password0",default:""}),b0=Xi({key:"password0Issues",get:({get:t})=>{const s=t(Ws),n=oR(s);return n instanceof dt.errors?n:null}}),Hf=Zt({key:"password1",default:""}),v0=Xi({key:"password1Issues",get:({get:t})=>{const s=t(Ws),n=t(Hf),r=dt(`"${s}"`)(n);return r instanceof dt.errors?r:null}}),Vf=Zt({key:"email",default:""}),S0=Xi({key:"emailIssues",get:({get:t})=>{const s=t(Vf),n=uR(s);return n instanceof dt.errors?n:null}}),yR=Xi({key:"signupReady",get:({get:t})=>{const s=t(g0),n=t(b0),r=t(v0),o=t(S0);return!(s??n??r??o)}}),A0=iT({login:null,sign_up:null,game:sT({clicker:null}),admin:null});function gR(t){return rT(A0,t)}const bR=[["login"],["sign_up"]];function vR(t){return bR.some(s=>s.join("/")===t.join("/"))}function w0(t){history.pushState(null,"",t),If(E0,t)}const E0=Zt({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=hf(Fs);let h="/login";c&&(h="/game"),n(h);break}case"/login":case"/sign_up":{hf(Fs)&&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)})}]}),SR=Xi({key:"route",get:({get:t})=>{const n=t(E0).split("/").slice(1);return gR(n)?vR(n)||t(Fs)?n:401:404}});function AR(){return K.jsx("article",{children:K.jsx("h1",{children:"admin"})})}class wR 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 oa=class oa{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 oa(s),{type:o,globals:c,actions:h,perspectives:p}=n(r),m={type:o,key:s,globals:c,actions:h,perspectives:p};return oa.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(oa,"existing",new wR);let Gf=oa;function ER(t){const{key:s,config:n}=t,r=Gf.create(s,n),{actions:o}=r;for(const c of o)ib(tt.STORE,s,c.key);return Ff(tt.STORE,s,-1),r}Zt({key:"usersInRoomIndex",mutable:!0,default:()=>new An,toJson:t=>t.toJSON(),fromJson:t=>An.fromJSON(t)});Zt({key:"roomIndex",default:()=>new An,mutable:!0,toJson:t=>t.toJSON(),fromJson:t=>An.fromJSON(t)});const xR={enteredAtEpoch:0},OR=sA({key:"usersInRooms",between:["room","user"],cardinality:"1:n",isAType:t=>typeof t=="string",isBType:t=>typeof t=="string"},xR);cA({key:"usersInMyRoomView",get:t=>({find:s})=>{const n=rA(OR);return[s(n,t)]}});const Mh=Zt({key:"count",default:0}),x0=$A({key:"incrementTX",do:({set:t})=>{t(Mh,s=>s+1)}}),_R=ER({key:"countContinuity",config:t=>t.add(Mh).add(x0)});function TR({route:[t]}){return K.jsx("article",{children:t?K.jsx(NR,{gameId:t}):K.jsx(RR,{})})}function RR(){return K.jsx("nav",{children:K.jsx(_o,{href:"/game/clicker",children:"Clicker"})})}WS(A0[1].game[1]);function NR({gameId:t}){console.log(t);const s=It(Mh),n=DA(x0);return mw(_R),K.jsxs("article",{children:[K.jsxs("button",{type:"button",onClick:()=>{n()},children:["count is ",s]}),K.jsx("p",{children:"Let's see how high we can count!"})]})}async function kR(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 O0(t){const s=await kR(t);return`${s.substring(0,8)}-${s.substring(8,12)}-${s.substring(12,16)}-${s.substring(16,20)}-${s.substring(20,32)}`}function MR(){const t=Vi(ha),s=Vi(Ws),n=It(ha),r=It(Ws),[o,c]=gt.useState(null);return K.jsxs("form",{onSubmit:async h=>{h.preventDefault();const p=await O0("login"),m=await fetch(`${Nh.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(" ");If(Fs,{username:n,sessionKey:v}),kh.once("connect",()=>{w0("/game")})}if(m.status>=400){const y=await m.text();c(y)}},children:[K.jsxs("main",{children:[o?K.jsx("aside",{children:o}):null,K.jsxs("label",{htmlFor:"username",children:[K.jsx("span",{children:"Username"}),K.jsx("input",{id:"username",type:"text",value:n,onChange:h=>{t(h.target.value)},autoComplete:"username",autoCapitalize:"none"})]}),K.jsxs("label",{htmlFor:"password",children:[K.jsx("span",{children:"Password"}),K.jsx("input",{id:"password",type:"password",value:r,onChange:h=>{s(h.target.value)},autoComplete:"current-password",autoCapitalize:"none"})]}),K.jsx("button",{type:"submit",disabled:!n||!r,children:"->"})]}),K.jsx("footer",{children:K.jsxs(_o,{href:"/sign_up",children:["New here? ",K.jsx("u",{children:"Sign up"})," for an account."]})})]})}function $R(){const t=Vi(ha),s=Vi(Ws),n=Vi(Hf),r=Vi(Vf),o=It(ha),c=It(Ws),h=It(Hf),p=It(Vf),m=It(g0),y=It(b0),v=It(v0),E=It(S0),k=It(yR),[N,B]=gt.useState(null);return K.jsxs("form",{onSubmit:async j=>{j.preventDefault();const X=c,F=await O0("sign-up"),le=await fetch(`${Nh.VITE_BACKEND_ORIGIN}/sign-up-${F}`,{method:"POST",body:JSON.stringify({username:o,password:X,email:p})});if(le.status===201&&(n(""),r(""),w0("/login")),le.status>=400){const ve=await le.text();B(ve)}},children:[K.jsxs("main",{children:[N?K.jsx("aside",{children:N}):null,K.jsxs("label",{htmlFor:"username",children:[K.jsx("span",{children:"Username"}),K.jsx("input",{id:"username",type:"text",value:o,onChange:j=>{t(j.target.value)},autoComplete:"username",autoCapitalize:"none",style:{"--energy-color":o?m?"red":"green":void 0}}),o&&m?K.jsx("aside",{children:m.map(j=>K.jsx("span",{children:j.message},j.path.join(".")))}):null]}),K.jsxs("label",{htmlFor:"password",children:[K.jsx("span",{children:"Password"}),K.jsx("input",{id:"password0",type:"password",value:c,onChange:j=>{s(j.target.value)},autoComplete:"new-password",autoCapitalize:"none",style:{"--energy-color":c?y?"red":"green":void 0}}),c&&y?K.jsx("aside",{children:y.map(j=>K.jsx("span",{children:j.message},j.path.join(".")))}):null]}),K.jsxs("label",{htmlFor:"password",children:[K.jsx("span",{children:"Confirm Password"}),K.jsx("input",{id:"password1",type:"password",value:h,onChange:j=>{n(j.target.value)},autoComplete:"new-password",autoCapitalize:"none",style:{"--energy-color":h?v?"red":"green":void 0}}),h&&v?K.jsx("aside",{children:v.map(j=>K.jsx("span",{children:j.message},j.path.join(".")))}):null]}),K.jsxs("label",{htmlFor:"email",children:[K.jsx("span",{children:"Email"}),K.jsx("input",{id:"email",type:"email",value:p,onChange:j=>{r(j.target.value)},autoComplete:"email",autoCapitalize:"none",style:{"--energy-color":p?E?"red":"green":void 0}}),p&&E?K.jsx("aside",{children:E.map(j=>K.jsx("span",{children:j.message},j.path.join(".")))}):null]}),K.jsx("button",{type:"submit",disabled:!k,children:"->"})]}),K.jsx("footer",{children:K.jsxs(_o,{href:"/login",children:["Already have an account? ",K.jsx("u",{children:"Log in"})," instead."]})})]})}function DR(){const t=It(SR);return K.jsxs("main",{className:nT.class,children:[K.jsx("header",{children:K.jsx(tT,{})}),K.jsx("main",{children:typeof t=="number"?K.jsxs("article",{children:[K.jsx("h1",{children:t}),K.jsx("h2",{children:i0[t]}),K.jsx(_o,{href:"/login",children:"Return to Home Page"})]}):(()=>{const[s,...n]=t;switch(s){case"admin":return K.jsx(AR,{});case"login":return K.jsx(MR,{});case"sign_up":return K.jsx($R,{});case"game":return K.jsx(TR,{route:n})}})()})]})}ww.createRoot(document.getElementById("root")).render(K.jsx(gt.StrictMode,{children:K.jsx(uw,{socket:kh,children:K.jsx(DR,{})})}));