tempest.games 0.2.101 → 0.2.102
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.
|
@@ -63,4 +63,4 @@ ${c},
|
|
|
63
63
|
`;if(!n.hasKind("union"))return f;const h=new dp({kind:"Allows",optimistic:!0}).indent();n.compile(h);const m=h.write(`${n.id}Optimistic`);return`${f}${m},
|
|
64
64
|
`},`{
|
|
65
65
|
`)+"}");class fE{config;resolvedConfig;name;get[Xi](){return"scope"}referencesById={};references=[];resolutions={};exportedNames=[];aliases={};resolved=!1;nodesByHash={};intrinsic;constructor(e,n){this.config=um(W.config,n),this.resolvedConfig=um(W.resolvedConfig,n),this.name=this.resolvedConfig.name??`anonymousScope${Object.keys(mp).length}`,this.name in mp&&Y(`A Scope already named ${this.name} already exists`),mp[this.name]=this;const r=Object.entries(e).map(o=>this.preparseOwnAliasEntry(...o));for(const[o,u]of r){let c=o;if(o[0]==="#"?(c=o.slice(1),c in this.aliases&&Y(Hw(c)),this.aliases[c]=u):(c in this.aliases&&Y(Hw(o)),this.aliases[c]=u,this.exportedNames.push(c)),!fe(u,"module")&&!fe(u,"generic")&&!wf(u)){const f=this.preparseOwnDefinitionFormat(u,{alias:c});this.resolutions[c]=fe(f,"root")?this.bindReference(f):this.createParseContext(f).id}}Fw??=this.node("union",{branches:["string","number","object","bigint","symbol",{unit:!0},{unit:!1},{unit:void 0},{unit:null}]},{prereduced:!0}),this.nodesByHash[Fw.hash]=this.node("intersection",{},{prereduced:!0}),this.intrinsic=W.intrinsic?Ge(W.intrinsic,(o,u)=>o.startsWith("json")?[]:[o,this.bindReference(u)]):{}}cacheGetter(e,n){return Object.defineProperty(this,e,{value:n}),n}get internal(){return this}_json;get json(){return this._json||this.export(),this._json}defineSchema(e){return e}generic=(...e)=>{const n=this;return(r,o)=>new Xc(e,o?new kA(r):r,n,n,o??null)};units=(e,n)=>{const r=[];for(const u of e)r.includes(u)||r.push(u);const o=r.map(u=>this.node("unit",{unit:u},n));return this.node("union",o,{...n,prereduced:!0})};lazyResolutions=[];lazilyResolve(e,n){const r=this.node("alias",{reference:n??"synthetic",resolve:e},{prereduced:!0});return this.resolved||this.lazyResolutions.push(r),r}schema=(e,n)=>this.finalize(this.parseSchema(e,n));parseSchema=(e,n)=>this.node(xc(e),e,n);preparseNode(e,n,r){let o=typeof e=="string"?e:xc(n,e);if(Qt(n)&&n.kind===o)return n;if(o==="alias"&&!r?.prereduced){const{reference:f}=zy.implementation.normalize(n,this);if(f.startsWith("$")){const h=this.resolveRoot(f.slice(1));n=h,o=h.kind}}else if(o==="union"&&Cs(n,"object")){const f=c3(n);f?.length===1&&(n=f[0],o=xc(n))}if(Qt(n)&&n.kind===o)return n;const c=_f[o].normalize?.(n,this)??n;return Qt(c)?c.kind===o?c:f3(o,c.kind):{...r,$:this,kind:o,def:c,prefix:r.alias??o}}bindReference(e){let n;return Qt(e)?n=e.$===this?e:new e.constructor(e.attachments,this):n=e.$===this?e:new Xc(e.params,e.bodyDef,e.$,this,e.hkt),this.resolved||Object.assign(this.referencesById,n.referencesById),n}resolveRoot(e){return this.maybeResolveRoot(e)??Y(mE(e))}maybeResolveRoot(e){const n=this.maybeResolve(e);if(!fe(n,"generic"))return n}maybeResolveSubalias(e){return ym(this.aliases,e)??ym(this.ambient,e)}get ambient(){return W.ambient}maybeResolve(e){const n=this.resolutions[e];if(n){if(typeof n!="string")return this.bindReference(n);const o=Ln[n];if(fe(o,"root"))return this.resolutions[e]=o;if(fe(o,"context")){if(o.phase==="resolving")return this.node("alias",{reference:`$${e}`},{prereduced:!0});if(o.phase==="resolved")return _t(`Unexpected resolved context for was uncached by its scope: ${Ie(o)}`);o.phase="resolving";const u=this.bindReference(this.parseOwnDefinitionFormat(o.def,o));return o.phase="resolved",Ln[u.id]=u,Ln[o.id]=u,this.resolutions[e]=u}return _t(`Unexpected nodesById entry for ${n}: ${Ie(o)}`)}let r=this.aliases[e]??this.ambient?.[e];return r?(r=this.normalizeRootScopeValue(r),fe(r,"generic")?this.resolutions[e]=this.bindReference(r):fe(r,"module")?(r.root||Y(yE(e)),this.resolutions[e]=this.bindReference(r.root)):this.resolutions[e]=this.parse(r,{alias:e})):this.maybeResolveSubalias(e)}createParseContext(e){const n=e.id??IA(e.prefix);return Ln[n]=Object.assign(e,{[Xi]:"context",$:this,id:n,phase:"unresolved"})}traversal(e){return new To(e,this.resolvedConfig)}import(...e){return new mm(Ge(this.export(...e),(n,r)=>[`#${n}`,r]))}precompilation;_exportedResolutions;_exports;export(...e){if(!this._exports){this._exports={};for(const r of this.exportedNames){const o=this.aliases[r];this._exports[r]=fe(o,"module")?aE(o,this):Gw(this.maybeResolve(r))}for(const r of this.lazyResolutions)r.resolution;if(this._exportedResolutions=pE(this,this._exports),this._json=hE(this._exportedResolutions),Object.assign(this.resolutions,this._exportedResolutions),this.references=Object.values(this.referencesById),!this.resolvedConfig.jitless){const r=cE(this.references);this.precompilation=r.write(lE,4),uE(this.references,r)}this.resolved=!0}const n=e.length?e:this.exportedNames;return new mm(Ge(n,(r,o)=>[o,this._exports[o]]))}resolve(e){return this.export()[e]}node=(e,n,r={})=>{const o=this.preparseNode(e,n,r);if(Qt(o))return this.bindReference(o);const u=this.createParseContext(o),c=HA(u),f=this.bindReference(c);return Ln[u.id]=f};parse=(e,n={})=>this.finalize(this.parseDefinition(e,n));parseDefinition(e,n={}){if(fe(e,"root"))return this.bindReference(e);const r=this.preparseOwnDefinitionFormat(e,n);if(fe(r,"root"))return this.bindReference(r);const o=this.createParseContext(r);Ln[o.id]=o;let u=this.bindReference(this.parseOwnDefinitionFormat(e,o));return u.isCyclic&&(u=tj(u,o.id)),Ln[o.id]=u,u}finalize(e){return Gw(e),!e.precompilation&&!this.resolvedConfig.jitless&&d3(e.references),e}}class dE extends fE{parseOwnDefinitionFormat(e,n){return HA(n)}preparseOwnDefinitionFormat(e,n){return this.preparseNode(xc(e),e,n)}preparseOwnAliasEntry(e,n){return[e,n]}normalizeRootScopeValue(e){return e}}const Gw=t=>{const e=t.references.filter(n=>n.hasKind("alias"));for(const n of e){Object.assign(n.referencesById,n.resolution.referencesById);for(const r of t.references)n.id in r.referencesById&&Object.assign(r.referencesById,n.referencesById)}return t},hE=t=>Ge(t,(e,n)=>[e,fe(n,"root")||fe(n,"generic")?n.json:fe(n,"module")?hE(n):_t(`Unexpected resolution ${Ie(n)}`)]),ym=(t,e)=>{const n=e.indexOf(".");if(n===-1)return;const r=e.slice(0,n),o=t[r];if(o===void 0)return;if(!fe(o,"module"))return Y(h3(r));const u=e.slice(n+1),c=o[u];if(c===void 0)return ym(o,u);if(fe(c,"root")||fe(c,"generic"))return c;if(fe(c,"module"))return c.root??Y(yE(e));_t(`Unexpected resolution for alias '${e}': ${Ie(c)}`)},Uy=(t,e)=>new dE(t,e),Dl=new dE({}),pE=(t,e)=>{const n={};for(const r in e){const o=e[r];if(fe(o,"module")){const u=pE(t,o),c=Ge(u,(f,h)=>[`${r}.${f}`,h]);Object.assign(n,c)}else fe(o,"root")||fe(o,"generic")?n[r]=o:_t(`Unexpected scope resolution ${Ie(o)}`)}return n},mE=t=>`'${t}' is unresolvable`,h3=t=>`'${t}' must reference a module to be accessed using dot syntax`,yE=t=>`Reference to submodule '${t}' must specify an alias`;Dl.export();const Ye=Dl.schema,Ky=Dl.node;Dl.defineSchema;const tr=Dl.generic,gE="^(?:0|[1-9]\\d*)$",p3=new RegExp(gE);en(p3);const vE=Uy({bigint:"bigint",boolean:[{unit:!1},{unit:!0}],false:{unit:!1},never:[],null:{unit:null},number:"number",object:"object",string:"string",symbol:"symbol",true:{unit:!0},unknown:{},undefined:{unit:void 0},Array,Date},{prereducedAliases:!0}).export();W.intrinsic={...vE};const bE=Uy({integer:{domain:"number",divisor:1},lengthBoundable:["string",Array],key:["string","symbol"],nonNegativeIntegerString:{domain:"string",pattern:gE}},{prereducedAliases:!0}).export();Object.assign(W.intrinsic,bE);const m3=Uy({jsonPrimitive:["string","number",{unit:!0},{unit:!1},{unit:null}],jsonObject:{domain:"object",index:{signature:"string",value:"$jsonData"}},jsonData:["$jsonPrimitive","$jsonObject"]},{prereducedAliases:!0}).export(),me={...vE,...bE,...m3,emptyStructure:Ky("structure",{},{prereduced:!0})};W.intrinsic={...me};const Yw=((t,e)=>new RegExp(t,e));Object.assign(Yw,{as:Yw});const y3=t=>typeof t=="string"&&t[0]==="d"&&(t[1]==="'"||t[1]==='"')&&t[t.length-1]===t[1],Jw=t=>t.toString()!=="Invalid Date",g3=t=>t.slice(2,-1),SE=t=>`'${t}' could not be parsed by the Date constructor`,v3=(t,e)=>b3(t,e),b3=(t,e)=>{const n=new Date(t);if(Jw(n))return n;const r=KN(t);if(r!==void 0){const o=new Date(r);if(Jw(o))return o}return e?Y(e===!0?SE(t):e):void 0},S3=Ye({proto:"Array",sequence:"string",required:{key:"groups",value:["object",{unit:void 0}]}}),yp=(t,e)=>{const n=t.scanner.shiftUntilEscapable(T3[TE[e]]);if(t.scanner.lookahead==="")return t.error(E3(n,e));if(t.scanner.shift(),e in xE){let r;try{r=new RegExp(n)}catch(o){Y(String(o))}t.root=t.ctx.$.node("intersection",{domain:"string",pattern:n},{prereduced:!0}),e==="x/"&&(t.root=t.ctx.$.node("morph",{in:t.root,morphs:o=>r.exec(o),declaredOut:S3}))}else if(Si(e,wE))t.root=t.ctx.$.node("unit",{unit:n});else{const r=v3(n,SE(n));t.root=t.ctx.$.node("unit",{meta:n,unit:r})}},wE={"'":1,'"':1},w3={"/":1,"'":1,'"':1},x3={"d'":"'",'d"':'"',"'":"'",'"':'"'},xE={"/":"/","x/":"/"},TE={...x3,...xE},T3={"'":t=>t.lookahead==="'",'"':t=>t.lookahead==='"',"/":t=>t.lookahead==="/"},A3={'"':"double-quote","'":"single-quote","/":"forward slash"},E3=(t,e)=>`${e}${t} requires a closing ${A3[TE[e]]}`,O3=t=>`Private type references should not include '#'. Use '${t}' instead.`,AE="Optional definitions like 'string?' are only valid as properties in an object or tuple",EE="Defaultable definitions like 'number = 0' are only valid as properties in an object or tuple",Jo={"<":1,">":1,"=":1,"|":1,"&":1,")":1,"[":1,"%":1,",":1,":":1,"?":1,"#":1,...xf},_3=(t,e)=>t===">"?e[0]==="="?e[1]==="=":e.trimStart()===""||Si(e.trimStart()[0],Jo):t==="="?e[0]!=="=":t===","||t==="?",R3=(t,e,n)=>OE(t,e,n,[]),OE=(t,e,n,r)=>{const o=n.parseUntilFinalizer();return r.push(o.root),o.finalizer===">"?r.length!==e.params.length?n.error(_E(t,e.names,r.map(u=>u.expression))):r:o.finalizer===","?OE(t,e,n,r):o.error(mA(">"))},_E=(t,e,n)=>`${t}<${e.join(", ")}> requires exactly ${e.length} args (got ${n.length}${n.length===0?"":`: ${n.join(", ")}`})`,gp=t=>{const e=t.scanner.shiftUntilLookahead(Jo);e==="keyof"?t.addPrefix("keyof"):t.root=C3(t,e)},k3=(t,e,n)=>{if(n.scanner.shiftUntilNonWhitespace(),n.scanner.shift()!=="<")return n.error(_E(t,e.names,[]));const o=R3(t,e,n);return e(...o)},C3=(t,e)=>M3(t,e)??D3(t,e)??t.error(e===""?t.scanner.lookahead==="#"?O3(t.shiftedBy(1).scanner.shiftUntilLookahead(Jo)):RE(t):mE(e)),M3=(t,e)=>{if(t.ctx.args?.[e]){const r=t.ctx.args[e];return typeof r!="string"?r:t.ctx.$.node("alias",{reference:r},{prereduced:!0})}const n=t.ctx.$.maybeResolve(e);if(fe(n,"root"))return n;if(n!==void 0)return fe(n,"generic")?k3(e,n,t):Y(`Unexpected resolution ${Ie(n)}`)},D3=(t,e)=>{const n=qN(e);if(n!==void 0)return t.ctx.$.node("unit",{unit:n});const r=IN(e);if(r!==void 0)return t.ctx.$.node("unit",{unit:r})},RE=t=>{const e=t.previousOperator();return e?kE(e,t.scanner.unscanned):N3(t.scanner.unscanned)},kE=(t,e="")=>`Token '${t}' requires a right operand${e?` before '${e}'`:""}`,N3=t=>`Expected an expression${t?` before '${t}'`:""}`,CE=t=>t.scanner.lookahead===""?t.error(RE(t)):t.scanner.lookahead==="("?t.shiftedBy(1).reduceGroupOpen():t.scanner.lookaheadIsIn(w3)?yp(t,t.scanner.shift()):t.scanner.lookaheadIsIn(xf)?CE(t.shiftedBy(1)):t.scanner.lookahead==="d"?t.scanner.nextLookahead in wE?yp(t,`${t.scanner.shift()}${t.scanner.shift()}`):gp(t):t.scanner.lookahead==="x"&&t.scanner.nextLookahead==="/"?t.shiftedBy(2)&&yp(t,"x/"):gp(t),$3={">":!0,">=":!0},j3={"<":!0,"<=":!0},Qc={"<":">",">":"<","<=":">=",">=":"<=","==":"=="},B3=(t,e)=>`Left bounds are only valid when paired with right bounds (try ...${e}${t})`,ME=t=>`Left-bounded expressions must specify their limits using < or <= (was ${t})`,z3=(t,e,n,r)=>`An expression may have at most one left bound (parsed ${t}${Qc[e]}, ${n}${Qc[r]})`,L3=(t,e)=>{const n=U3(t,e);if(t.root.hasKind("unit")){if(typeof t.root.unit=="number"){t.reduceLeftBound(t.root.unit,n),t.unsetRoot();return}if(t.root.unit instanceof Date){const r=`d'${t.root.description??t.root.unit.toISOString()}'`;t.unsetRoot(),t.reduceLeftBound(r,n);return}}return q3(t,n)},V3={"<":1,">":1,"=":1},U3=(t,e)=>t.scanner.lookaheadIs("=")?`${e}${t.scanner.shift()}`:e,Xw=(t,e,n,r)=>n.extends(W.intrinsic.number)?typeof e!="number"?Y(gm(t,e,r)):t==="=="?["min","max"]:t[0]===">"?["min"]:["max"]:n.extends(W.intrinsic.lengthBoundable)?typeof e!="number"?Y(gm(t,e,r)):t==="=="?["exactLength"]:t[0]===">"?["minLength"]:["maxLength"]:n.extends(W.intrinsic.Date)?t==="=="?["after","before"]:t[0]===">"?["after"]:["before"]:Y($$(n.expression)),K3=t=>({rule:y3(t.limit)?g3(t.limit):t.limit,exclusive:t.comparator.length===1}),q3=(t,e)=>{const n=t.unsetRoot(),r=t.scanner.location;t.parseOperand();const o=t.unsetRoot(),u=t.scanner.sliceChars(r,t.scanner.location);if(t.root=n,!o.hasKind("unit")||typeof o.unit!="number"&&!(o.unit instanceof Date))return t.error(gm(e,u,"right"));const c=o.unit,f=e.length===1,h=Xw(e,typeof c=="number"?c:u,n,"right");for(const y of h)t.constrainRoot(y,e==="=="?{rule:c}:{rule:c,exclusive:f});if(!t.branches.leftBound)return;if(!Si(e,j3))return t.error(ME(e));const m=Xw(t.branches.leftBound.comparator,t.branches.leftBound.limit,n,"left");t.constrainRoot(m[0],K3(t.branches.leftBound)),t.branches.leftBound=null},gm=(t,e,n)=>`Comparator ${n==="left"?Qc[t]:t} must be ${n==="left"?"preceded":"followed"} by a corresponding literal (was ${e})`,P3=t=>{t.scanner.shiftUntilNonWhitespace();const e=t.scanner.shiftUntilLookahead(Jo);t.root=t.root.brand(e)},I3=t=>{t.scanner.shiftUntilNonWhitespace();const e=t.scanner.shiftUntilLookahead(Jo),n=PN(e,{errorOnFail:Zw(e)});n===0&&t.error(Zw(0)),t.root=t.root.constrain("divisor",n)},Zw=t=>`% operator must be followed by a non-zero integer literal (was ${t})`,DE=t=>{const e=t.scanner.shift();return e===""?t.finalize(""):e==="["?t.scanner.shift()==="]"?t.setRoot(t.root.array()):t.error(H3):e==="|"?t.scanner.lookahead===">"?t.shiftedBy(1).pushRootToBranch("|>"):t.pushRootToBranch(e):e==="&"?t.pushRootToBranch(e):e===")"?t.finalizeGroup():_3(e,t.scanner.unscanned)?t.finalize(e):Si(e,V3)?L3(t,e):e==="%"?I3(t):e==="#"?P3(t):e in xf?DE(t):t.error(qy(e))},qy=(t,e="")=>`'${t}' is not allowed here${e&&` (should be ${e})`}`,H3="Missing expected ']'",F3=t=>{const e=t.unsetRoot();t.parseOperand();const n=t.unsetRoot();if(!n.hasKind("unit"))return t.error(G3(n.expression));const r=n.unit instanceof Date?()=>new Date(n.unit):n.unit;return[e,"=",r]},G3=t=>`Default value '${t}' must be a literal value`,Qw=(t,e)=>{const n=e.$.maybeResolveRoot(t);if(n)return n;if(t.endsWith("[]")){const u=e.$.maybeResolveRoot(t.slice(0,-2));if(u)return u.array()}const r=new Rf(new pA(t),e),o=Y3(r);return r.finalizer===">"&&Y(qy(">")),o},Y3=t=>{t.parseOperand();let e=Py(t).root;return e?(t.finalizer==="="?e=F3(t):t.finalizer==="?"&&(e=[e,"?"]),t.scanner.shiftUntilNonWhitespace(),t.scanner.lookahead&&Y(qy(t.scanner.lookahead)),e):_t(`Root was unexpectedly unset after parsing string '${t.scanner.scanned}'`)},Py=t=>{for(;t.finalizer===void 0;)J3(t);return t},J3=t=>t.hasRoot()?t.parseOperator():t.parseOperand();class Rf{root;branches={prefixes:[],leftBound:null,intersection:null,union:null,pipe:null};finalizer;groups=[];scanner;ctx;constructor(e,n){this.scanner=e,this.ctx=n}error(e){return Y(e)}hasRoot(){return this.root!==void 0}setRoot(e){this.root=e}unsetRoot(){const e=this.root;return this.root=void 0,e}constrainRoot(...e){this.root=this.root.constrain(e[0],e[1])}finalize(e){if(this.groups.length)return this.error(mA(")"));this.finalizeBranches(),this.finalizer=e}reduceLeftBound(e,n){const r=Qc[n];if(!Si(r,$3))return this.error(ME(n));if(this.branches.leftBound)return this.error(z3(this.branches.leftBound.limit,this.branches.leftBound.comparator,e,r));this.branches.leftBound={comparator:r,limit:e}}finalizeBranches(){if(this.assertRangeUnset(),this.branches.pipe){this.pushRootToBranch("|>"),this.root=this.branches.pipe;return}if(this.branches.union){this.pushRootToBranch("|"),this.root=this.branches.union;return}if(this.branches.intersection){this.pushRootToBranch("&"),this.root=this.branches.intersection;return}this.applyPrefixes()}finalizeGroup(){this.finalizeBranches();const e=this.groups.pop();if(!e)return this.error(QN(")",this.scanner.unscanned));this.branches=e}addPrefix(e){this.branches.prefixes.push(e)}applyPrefixes(){for(;this.branches.prefixes.length;){const e=this.branches.prefixes.pop();this.root=e==="keyof"?this.root.keyof():_t(`Unexpected prefix '${e}'`)}}pushRootToBranch(e){this.assertRangeUnset(),this.applyPrefixes();const n=this.root;this.root=void 0,this.branches.intersection=this.branches.intersection?.rawAnd(n)??n,e!=="&"&&(this.branches.union=this.branches.union?.rawOr(this.branches.intersection)??this.branches.intersection,this.branches.intersection=null,e!=="|"&&(this.branches.pipe=this.branches.pipe?.rawPipeOnce(this.branches.union)??this.branches.union,this.branches.union=null))}parseUntilFinalizer(){return Py(new Rf(this.scanner,this.ctx))}parseOperator(){return DE(this)}parseOperand(){return CE(this)}assertRangeUnset(){if(this.branches.leftBound)return this.error(B3(this.branches.leftBound.limit,this.branches.leftBound.comparator))}reduceGroupOpen(){this.groups.push(this.branches),this.branches={prefixes:[],leftBound:null,union:null,intersection:null,pipe:null}}previousOperator(){return this.branches.leftBound?.comparator??this.branches.prefixes[this.branches.prefixes.length-1]??(this.branches.intersection?"&":this.branches.union?"|":this.branches.pipe?"|>":void 0)}shiftedBy(e){return this.scanner.jumpForward(e),this}}const X3="An empty string is not a valid generic parameter name",vm=(t,e,n)=>{t.shiftUntilNonWhitespace();const r=t.shiftUntilLookahead(Jo);return r===""?t.lookahead===""&&e.length?e:Y(X3):(t.shiftUntilNonWhitespace(),Z3(t,r,e,n))},Ww="extends ",Z3=(t,e,n,r)=>{if(t.shiftUntilNonWhitespace(),t.unscanned.startsWith(Ww))t.jumpForward(Ww.length);else return t.lookahead===","&&t.shift(),n.push(e),vm(t,n,r);const o=Py(new Rf(t,r));return n.push([e,o.root]),vm(t,n,r)};class Q3 extends Hr{constructor(e){const n={$:e,raw:e.fn};super((...r)=>{const o=r.indexOf(":"),u=o===-1?r.length-1:o-1,c=r.slice(0,u+1),f=e.parse(c).assertHasKind("intersection");let h=e.intrinsic.unknown;if(o!==-1){if(o!==r.length-2)return Y(eB);h=e.parse(r[o+1])}return m=>new W3(m,f,h)},{attach:n})}}class W3 extends Hr{raw;params;returns;expression;constructor(e,n,r){const o=`typed ${e.name}`,u={[o]:(...f)=>{const h=n.assert(f),m=e(...h);return r.assert(m)}}[o];super(u),this.raw=e,this.params=n,this.returns=r;let c=n.expression;c[0]==="["&&c[c.length-1]==="]"?c=c.slice(1,-1):c.endsWith("[]")&&(c=`...${c}`),this.expression=`(${c}) => ${r?.expression??"unknown"}`}}const eB=`":" must be followed by exactly one return type e.g:
|
|
66
|
-
fn("string", ":", "number")(s => s.length)`;class tB extends Hr{$;constructor(e){super((...n)=>new uc(e)(...n),{bind:e}),this.$=e}in(e){return new uc(this.$,e===void 0?void 0:this.$.parse(e))}at(e,n){return new uc(this.$).at(e,n)}case(e,n){return new uc(this.$).case(e,n)}}class uc extends Hr{$;in;key;branches=[];constructor(e,n){super(r=>this.caseEntries(Object.entries(r).map(([o,u])=>o==="default"?[o,u]:[this.$.parse(o),u]))),this.$=e,this.in=n}at(e,n){return this.key&&Y(iB),this.branches.length&&Y(nB),this.key=e,n?this.match(n):this}case(e,n){return this.caseEntry(this.$.parse(e),n)}caseEntry(e,n){const o=(this.key?this.$.parse({[this.key]:e}):e).pipe(n);return this.branches.push(o),this}match(e){return this(e)}strings(e){return this.caseEntries(Object.entries(e).map(([n,r])=>n==="default"?[n,r]:[this.$.node("unit",{unit:n}),r]))}caseEntries(e){for(let n=0;n<e.length;n++){const[r,o]=e[n];if(r==="default")return n!==e.length-1&&Y("default may only be specified as the last key of a switch definition"),this.default(o);if(typeof o!="function")return Y(`Value for case "${r}" must be a function (was ${ei(o)})`);this.caseEntry(r,o)}return this}default(e){typeof e=="function"&&this.case(me.unknown,e);const n={branches:this.branches,ordered:!0};(e==="never"||e==="assert")&&(n.meta={onFail:ex});const r=this.$.node("union",n);if(!this.in)return this.$.finalize(r);let o=this.in.pipe(r);return(e==="never"||e==="assert")&&(o=o.configureReferences({onFail:ex},"self")),this.$.finalize(o)}}const ex=t=>t.throw(),nB="A key matcher must be specified before the first case i.e. match.at('foo') or match.in<object>().at('bar')",iB="At most one key matcher may be specified per expression",NE=(t,e)=>{if(Xt(t)){if(t[1]==="=")return[e.$.parseOwnDefinitionFormat(t[0],e),"=",t[2]];if(t[1]==="?")return[e.$.parseOwnDefinitionFormat(t[0],e),"?"]}return UE(t,e)},rB="Only required keys may make their values optional, e.g. { [mySymbol]: ['number', '?'] }",sB="Only required keys may specify default values, e.g. { value: 'number = 0' }",oB=(t,e)=>{let n;const r={},o=Ic(t);for(const[c,f]of o){const h=uB(c);if(h.kind==="spread"){if(!Ol(r))return Y(lB);const S=e.$.parseOwnDefinitionFormat(f,e);if(S.equals(me.object))continue;if(!S.hasKind("intersection")||!S.basis?.equals(me.object))return Y(cB(S.expression));n=S.structure;continue}if(h.kind==="undeclared"){f!=="reject"&&f!=="delete"&&f!=="ignore"&&Y(aB(f)),r.undeclared=f;continue}const m=NE(f,e),y=h;if(h.kind==="required"){Xt(m)?vp(r,"optional",m[1]==="="?{key:h.normalized,value:m[0],default:m[2]}:{key:h.normalized,value:m[0]},e):vp(r,"required",{key:h.normalized,value:m},e);continue}if(Xt(m)&&(m[1]==="?"&&Y(rB),m[1]==="="&&Y(sB)),h.kind==="optional"){vp(r,"optional",{key:h.normalized,value:m},e);continue}const g=e.$.parseOwnDefinitionFormat(y.normalized,e),b=pm(g,m,e.$);b.index&&(r.index=Fe(r.index,b.index)),b.required&&(r.required=Fe(r.required,b.required))}const u=e.$.node("structure",r);return e.$.parseSchema({domain:"object",structure:n?.merge(u)??u})},vp=(t,e,n,r)=>{t[e]=Fe(t[e],r.$.node(e,n))},aB=t=>`Value of '+' key must be 'reject', 'delete', or 'ignore' (was ${Ie(t)})`,lB="Spread operator may only be used as the first key in an object",uB=t=>typeof t=="symbol"?{kind:"required",normalized:t}:t[t.length-1]==="?"?t[t.length-2]===tl?{kind:"required",normalized:`${t.slice(0,-2)}?`}:{kind:"optional",normalized:t.slice(0,-1)}:t[0]==="["&&t[t.length-1]==="]"?{kind:"index",normalized:t.slice(1,-1)}:t[0]===tl&&t[1]==="["&&t[t.length-1]==="]"?{kind:"required",normalized:t.slice(1)}:t==="..."?{kind:"spread"}:t==="+"?{kind:"undeclared"}:{kind:"required",normalized:t==="\\..."?"...":t==="\\+"?"+":t},cB=t=>`Spread operand must resolve to an object literal type (was ${t})`,fB=(t,e)=>wB(t)?zE[t[0]](t,e):bB(t)?BE[t[1]](t,e):null,dB=(t,e)=>e.$.parseOwnDefinitionFormat(t[1],e).keyof(),bp=(t,e)=>{if(t[2]===void 0)return Y(kE(t[1],""));const n=e.$.parseOwnDefinitionFormat(t[0],e),r=e.$.parseOwnDefinitionFormat(t[2],e);if(t[1]==="|")return e.$.node("union",{branches:[n,r]});const o=t[1]==="&"?Qi(n,r,e.$):fm(n,r,e.$);return o instanceof ae?o.throw():o},hB=(t,e)=>e.$.parseOwnDefinitionFormat(t[0],e).array(),pB=(t,e)=>typeof t[2]!="function"?Y($E("=>",t[2])):e.$.parseOwnDefinitionFormat(t[0],e).pipe(t[2]),$E=(t,e)=>`${t===":"?"Narrow":"Morph"} expression requires a function following '${t}' (was ${typeof e})`,mB=(t,e)=>typeof t[2]!="function"?Y($E(":",t[2])):e.$.parseOwnDefinitionFormat(t[0],e).constrain("predicate",t[2]),yB=(t,e)=>e.$.parseOwnDefinitionFormat(t[0],e).configure(t[2],t[3]),jE=t=>t,gB=jE({"[]":hB,"?":()=>Y(AE)}),vB=jE({"|":bp,"&":bp,":":mB,"=>":pB,"|>":bp,"@":yB,"=":()=>Y(EE)}),BE={...gB,...vB},bB=t=>BE[t[1]]!==void 0,SB=t=>t,zE=SB({keyof:dB,instanceof:(t,e)=>{if(typeof t[1]!="function")return Y(tx(rm(t[1])));const n=t.slice(1).map(r=>typeof r=="function"?e.$.node("proto",{proto:r}):Y(tx(rm(r))));return n.length===1?n[0]:e.$.node("union",{branches:n})},"===":(t,e)=>e.$.units(t.slice(1))}),wB=t=>zE[t[0]]!==void 0,tx=t=>`Expected a constructor following 'instanceof' operator (was ${t})`,xB=(t,e)=>{let n=[{}],r=0;for(;r<t.length;){let o=!1;t[r]==="..."&&r<t.length-1&&(o=!0,r++);const u=NE(t[r],e),[c,f,h]=Xt(u)?u:[u];if(r++,o){if(!c.extends(W.intrinsic.Array))return Y(EB(c.expression));n=n.flatMap(m=>c.distribute(y=>AB(SA(m),y)))}else n=n.map(m=>f==="?"?LE(m,c):f==="="?TB(m,c,h):bm(m,c))}return e.$.parseSchema(n.map(o=>Ol(o)?{proto:Array,exactLength:0}:{proto:Array,sequence:o}))},bm=(t,e)=>t.defaultables||t.optionals?Y(t.variadic?rE:OB):(t.variadic?t.postfix=Fe(t.postfix,e):t.prefix=Fe(t.prefix,e),t),LE=(t,e)=>t.variadic?Y(VE):(t.optionals=Fe(t.optionals,e),t),TB=(t,e,n)=>t.variadic?Y(VE):t.optionals?Y(_B):(t.defaultables=Fe(t.defaultables,[[e,n]]),t),nx=(t,e)=>(t.postfix&&Y(ix),t.variadic?t.variadic.equals(e)||Y(ix):t.variadic=e.internal,t),AB=(t,e)=>{const n=e.select({method:"find",kind:"sequence"});if(!n)return nx(t,W.intrinsic.unknown);if(n.prefix)for(const r of n.prefix)bm(t,r);if(n.optionals)for(const r of n.optionals)LE(t,r);if(n.variadic&&nx(t,n.variadic),n.postfix)for(const r of n.postfix)bm(t,r);return t},EB=t=>`Spread element must be an array (was ${t})`,ix="A tuple may have at most one variadic element",OB="A required element may not follow an optional element",VE="An optional element may not follow a variadic element",_B="A defaultable element may not follow an optional element without a default",RB={},UE=(t,e)=>{if(typeof t=="string"){if(e.args&&Object.keys(e.args).some(r=>t.includes(r)))return Qw(t,e);const n=RB[e.$.name]??={};return n[t]??=Qw(t,e)}return Cs(t,"object")?kB(t,e):Y(Sm(ei(t)))},kB=(t,e)=>{const n=_y(t);switch(n){case void 0:return fe(t,"root")?t:"~standard"in t?CB(t,e):oB(t,e);case"Array":return MB(t,e);case"RegExp":return e.$.node("intersection",{domain:"string",pattern:t},{prereduced:!0});case"Function":{const r=wf(t)?t():t;return fe(r,"root")?r:Y(Sm("Function"))}default:return Y(Sm(n??Ie(t)))}},CB=(t,e)=>e.$.intrinsic.unknown.pipe((n,r)=>{const o=t["~standard"].validate(n);if(!o.issues)return o.value;for(const{message:u,path:c}of o.issues)c?c.length?r.error({problem:RN(u),relativePath:c.map(f=>typeof f=="object"?f.key:f)}):r.error({message:u}):r.error({message:u})}),MB=(t,e)=>fB(t,e)??xB(t,e),Sm=t=>`Type definitions must be strings or objects (was ${t})`;class DB extends Hr{constructor(e){const n=Object.assign({errors:Lr,hkt:wi,$:e,raw:e.parse,module:e.constructor.module,scope:e.constructor.scope,declare:e.declare,define:e.define,match:e.match,generic:e.generic,schema:e.schema,keywords:e.ambient,unit:e.unit,enumerated:e.enumerated,instanceOf:e.instanceOf,valueOf:e.valueOf,or:e.or,and:e.and,merge:e.merge,pipe:e.pipe,fn:e.fn},e.ambientAttachments);super((...r)=>{if(r.length===1)return e.parse(r[0]);if(r.length===2&&typeof r[0]=="string"&&r[0][0]==="<"&&r[0][r[0].length-1]===">"){const o=r[0].slice(1,-1),u=e.parseGenericParams(o,{});return new Xc(u,r[1],e,e,null)}return e.parse(r)},{attach:n})}}const ml=W;class kf extends fE{get ambientAttachments(){if(ml.typeAttachments)return this.cacheGetter("ambientAttachments",Ge(ml.typeAttachments,(e,n)=>[e,this.bindReference(n)]))}preparseOwnAliasEntry(e,n){const r=e.indexOf("<");if(r===-1){if(fe(n,"module")||fe(n,"generic"))return[e,n];const c=this.name==="ark"?e:e==="root"?this.name:`${this.name}.${e}`,f=this.resolvedConfig.keywords?.[c];return f&&(n=[n,"@",f]),[e,n]}e[e.length-1]!==">"&&Y("'>' must be the last character of a generic declaration in a scope");const o=e.slice(0,r),u=e.slice(r+1,-1);return[o,()=>{const c=this.parseGenericParams(u,{alias:o});return S$(c,n,this)}]}parseGenericParams(e,n){return vm(new pA(e),[],this.createParseContext({...n,def:e,prefix:"generic"}))}normalizeRootScopeValue(e){return wf(e)&&!fe(e,"generic")?e():e}preparseOwnDefinitionFormat(e,n){return{...n,def:e,prefix:n.alias??"type"}}parseOwnDefinitionFormat(e,n){!(n.alias&&n.alias in this.aliases)&&!n.args&&(n.args={this:n.id});const o=UE(e,n);if(Xt(o)){if(o[1]==="=")return Y(EE);if(o[1]==="?")return Y(AE)}return o}unit=e=>this.units([e]);valueOf=e=>this.units(hN(e));enumerated=(...e)=>this.units(e);instanceOf=e=>this.node("proto",{proto:e},{prereduced:!0});or=(...e)=>this.schema(e.map(n=>this.parse(n)));and=(...e)=>e.reduce((n,r)=>n.and(this.parse(r)),this.intrinsic.unknown);merge=(...e)=>e.reduce((n,r)=>n.merge(this.parse(r)),this.intrinsic.object);pipe=(...e)=>this.intrinsic.unknown.pipe(...e);fn=new Q3(this);match=new tB(this);declare=()=>({type:this.type});define(e){return e}type=new DB(this);static scope=((e,n={})=>new kf(e,n));static module=((e,n={})=>this.scope(e,n).export())}const NB=Object.assign(kf.scope,{define:t=>t}),ze=kf;class $B extends wi{description='merge an object\'s properties onto another like `Merge(User, { isAdmin: "true" })`'}const jB=tr(["base",me.object],["props",me.object])(t=>t.base.merge(t.props),$B),BB=ze.module({Key:me.key,Merge:jB});class zB extends wi{}const LB=tr("element")(t=>{const e=t.element.exclude(me.Array),n=e.array();return e.rawOr(n).pipe(El).distribute(r=>r.assertHasKind("morph").declareOut(n),Ye)},zB),VB=ze.module({root:me.Array,readonly:"root",index:me.nonNegativeIntegerString,liftFrom:LB},{name:"Array"}),wm=Ye(["string",_l.FileConstructor]),UB=wm.rawOr(wm.array()),rx=Ye({meta:"an object representing parsed form data",domain:"object",index:{signature:"string",value:UB}}),KB=ze.module({root:["instanceof",FormData],value:wm,parsed:rx,parse:Ye({in:FormData,morphs:t=>{const e={};for(const[n,r]of t)if(n in e){const o=e[n];typeof o=="string"||o instanceof _l.FileConstructor?e[n]=[o,r]:o.push(r)}else e[n]=r;return e},declaredOut:rx})},{name:"FormData"}),qB=ze.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"}),PB={Boolean:1,Number:1,String:1},IB=ze.module({...Ge({...iA,...sA},(t,e)=>t in PB?[]:[t,["instanceof",e]]),Array:VB,TypedArray:qB,FormData:KB}),HB=Ye({domain:{domain:"number",meta:"a number representing a Unix timestamp"},divisor:{rule:1,meta:"an integer representing a Unix timestamp"},min:{rule:-864e13,meta:"a Unix timestamp after -8640000000000000"},max:{rule:864e13,meta:"a Unix timestamp before 8640000000000000"},meta:"an integer representing a safe Unix timestamp"}),FB=Ye({domain:"number",divisor:1}),KE=ze.module({root:me.number,integer:FB,epoch:HB,safe:Ye({domain:{domain:"number",numberAllowsNaN:!1},min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER}),NaN:["===",Number.NaN],Infinity:["===",Number.POSITIVE_INFINITY],NegativeInfinity:["===",Number.NEGATIVE_INFINITY]},{name:"number"}),et=(t,e,n)=>{const r={domain:"string",pattern:{rule:t.source,flags:t.flags,meta:e}};return n&&(r.meta={format:n}),Ky("intersection",r)},sx=et(Hc,"a well-formed integer string"),qE=ze.module({root:sx,parse:Ye({in:sx,morphs:(t,e)=>{const n=Number.parseInt(t);return Number.isSafeInteger(n)?n:e.error("an integer in the range Number.MIN_SAFE_INTEGER to Number.MAX_SAFE_INTEGER")},declaredOut:me.integer})},{name:"string.integer"}),GB=et(/^[\dA-Fa-f]+$/,"hex characters only"),YB=ze.module({root:et(/^(?:[\d+/A-Za-z]{4})*(?:[\d+/A-Za-z]{2}==|[\d+/A-Za-z]{3}=)?$/,"base64-encoded"),url:et(/^(?:[\w-]{4})*(?:[\w-]{2}(?:==|%3D%3D)?|[\w-]{3}(?:=|%3D)?)?$/,"base64url-encoded")},{name:"string.base64"}),ox=et(/^[A-Z].*$/,"capitalized"),JB=ze.module({root:Ye({in:"string",morphs:t=>t.charAt(0).toUpperCase()+t.slice(1),declaredOut:ox}),preformatted:ox},{name:"string.capitalize"}),XB=t=>{const e=t.replace(/[ -]+/g,"");let n=0,r,o,u=!1;for(let c=e.length-1;c>=0;c--)r=e.substring(c,c+1),o=Number.parseInt(r,10),u?(o*=2,n+=o>=10?o%10+1:o):n+=o,u=!u;return!!(n%10===0&&e)},ZB=/^(?:4\d{12}(?:\d{3,6})?|5[1-5]\d{14}|(222[1-9]|22[3-9]\d|2[3-6]\d{2}|27[01]\d|2720)\d{12}|6(?:011|5\d\d)\d{12,15}|3[47]\d{13}|3(?:0[0-5]|[68]\d)\d{11}|(?:2131|1800|35\d{3})\d{11}|6[27]\d{14}|^(81\d{14,17}))$/,QB=Ye({domain:"string",pattern:{meta:"a credit card number",rule:ZB.source},predicate:{meta:"a credit card number",predicate:XB}}),WB=/^([+-]?\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)?)?)?)?$/,ez=t=>!Number.isNaN(new Date(t).valueOf()),ax=Ye({domain:"string",predicate:{meta:"a parsable date",predicate:ez}}).assertHasKind("intersection"),lx=qE.root.internal.narrow((t,e)=>{const n=Number.parseInt(t),r=KE.epoch(n);return r instanceof Lr?(e.errors.merge(r),!1):!0}).configure({description:"an integer string representing a safe Unix timestamp"},"self").assertHasKind("intersection"),tz=ze.module({root:lx,parse:Ye({in:lx,morphs:t=>new Date(t),declaredOut:me.Date})},{name:"string.date.epoch"}),ux=et(WB,"an ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) date").internal.assertHasKind("intersection"),nz=ze.module({root:ux,parse:Ye({in:ux,morphs:t=>new Date(t),declaredOut:me.Date})},{name:"string.date.iso"}),iz=ze.module({root:ax,parse:Ye({declaredIn:ax,in:"string",morphs:(t,e)=>{const n=new Date(t);return Number.isNaN(n.valueOf())?e.error("a parsable date"):n},declaredOut:me.Date}),iso:nz,epoch:tz},{name:"string.date"}),rz=et(/^[\w%+.-]+@[\d.A-Za-z-]+\.[A-Za-z]{2,}$/,"an email address","email"),cx="(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])",_r=`(${cx}[.]){3}${cx}`,sz=new RegExp(`^${_r}$`),xt="(?:[0-9a-fA-F]{1,4})",oz=new RegExp(`^((?:${xt}:){7}(?:${xt}|:)|(?:${xt}:){6}(?:${_r}|:${xt}|:)|(?:${xt}:){5}(?::${_r}|(:${xt}){1,2}|:)|(?:${xt}:){4}(?:(:${xt}){0,1}:${_r}|(:${xt}){1,3}|:)|(?:${xt}:){3}(?:(:${xt}){0,2}:${_r}|(:${xt}){1,4}|:)|(?:${xt}:){2}(?:(:${xt}){0,3}:${_r}|(:${xt}){1,5}|:)|(?:${xt}:){1}(?:(:${xt}){0,4}:${_r}|(:${xt}){1,6}|:)|(?::((?::${xt}){0,5}:${_r}|(?::${xt}){1,7}|:)))(%[0-9a-zA-Z.]{1,})?$`),az=ze.module({root:["v4 | v6","@","an IP address"],v4:et(sz,"an IPv4 address","ipv4"),v6:et(oz,"an IPv6 address","ipv6")},{name:"string.ip"}),No="a JSON string",PE=t=>{if(!(t instanceof SyntaxError))throw t;return`must be ${No} (${t})`},lz=Ye({meta:No,domain:"string",predicate:{meta:No,predicate:(t,e)=>{try{return JSON.parse(t),!0}catch(n){return e.reject({code:"predicate",expected:No,problem:PE(n)})}}}}),uz=(t,e)=>{if(t.length===0)return e.error({code:"predicate",expected:No,actual:"empty"});try{return JSON.parse(t)}catch(n){return e.error({code:"predicate",expected:No,problem:PE(n)})}},cz=ze.module({root:lz,parse:Ye({meta:"safe JSON string parser",in:"string",morphs:uz,declaredOut:me.jsonObject})},{name:"string.json"}),fx=et(/^[a-z]*$/,"only lowercase letters"),fz=ze.module({root:Ye({in:"string",morphs:t=>t.toLowerCase(),declaredOut:fx}),preformatted:fx},{name:"string.lower"}),IE=["NFC","NFD","NFKC","NFKD"],Nl=Ge(IE,(t,e)=>[e,Ye({domain:"string",predicate:n=>n.normalize(e)===n,meta:`${e}-normalized unicode`})]),Cf=Ge(IE,(t,e)=>[e,Ye({in:"string",morphs:n=>n.normalize(e),declaredOut:Nl[e]})]),dz=ze.module({root:Cf.NFC,preformatted:Nl.NFC},{name:"string.normalize.NFC"}),hz=ze.module({root:Cf.NFD,preformatted:Nl.NFD},{name:"string.normalize.NFD"}),pz=ze.module({root:Cf.NFKC,preformatted:Nl.NFKC},{name:"string.normalize.NFKC"}),mz=ze.module({root:Cf.NFKD,preformatted:Nl.NFKD},{name:"string.normalize.NFKD"}),yz=ze.module({root:"NFC",NFC:dz,NFD:hz,NFKC:pz,NFKD:mz},{name:"string.normalize"}),dx=et(sm,"a well-formed numeric string"),gz=ze.module({root:dx,parse:Ye({in:dx,morphs:t=>Number.parseFloat(t),declaredOut:me.number})},{name:"string.numeric"}),hx="a regex pattern",vz=Ye({domain:"string",predicate:{meta:hx,predicate:(t,e)=>{try{return new RegExp(t),!0}catch(n){return e.reject({code:"predicate",expected:hx,problem:String(n)})}}},meta:{format:"regex"}}),bz=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[A-Za-z-][\dA-Za-z-]*)(?:\.(?:0|[1-9]\d*|\d*[A-Za-z-][\dA-Za-z-]*))*))?(?:\+([\dA-Za-z-]+(?:\.[\dA-Za-z-]+)*))?$/,Sz=et(bz,"a semantic version (see https://semver.org/)"),px=et(/^\S.*\S$|^\S?$/,"trimmed"),wz=ze.module({root:Ye({in:"string",morphs:t=>t.trim(),declaredOut:px}),preformatted:px},{name:"string.trim"}),mx=et(/^[A-Z]*$/,"only uppercase letters"),xz=ze.module({root:Ye({in:"string",morphs:t=>t.toUpperCase(),declaredOut:mx}),preformatted:mx},{name:"string.upper"}),Tz=t=>URL.canParse(t),yx=Ye({domain:"string",predicate:{meta:"a URL string",predicate:Tz},meta:{format:"uri"}}),Az=ze.module({root:yx,parse:Ye({declaredIn:yx,in:"string",morphs:(t,e)=>{try{return new URL(t)}catch{return e.error("a URL string")}},declaredOut:Ye(URL)})},{name:"string.url"}),Ez=ze.module({root:["versioned | nil | max","@",{description:"a UUID",format:"uuid"}],"#nil":"'00000000-0000-0000-0000-000000000000'","#max":"'ffffffff-ffff-ffff-ffff-ffffffffffff'","#versioned":/[\da-f]{8}-[\da-f]{4}-[1-8][\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}/i,v1:et(/^[\da-f]{8}-[\da-f]{4}-1[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv1"),v2:et(/^[\da-f]{8}-[\da-f]{4}-2[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv2"),v3:et(/^[\da-f]{8}-[\da-f]{4}-3[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv3"),v4:et(/^[\da-f]{8}-[\da-f]{4}-4[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv4"),v5:et(/^[\da-f]{8}-[\da-f]{4}-5[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv5"),v6:et(/^[\da-f]{8}-[\da-f]{4}-6[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv6"),v7:et(/^[\da-f]{8}-[\da-f]{4}-7[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv7"),v8:et(/^[\da-f]{8}-[\da-f]{4}-8[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv8")},{name:"string.uuid"}),Oz=ze.module({root:me.string,alpha:et(/^[A-Za-z]*$/,"only letters"),alphanumeric:et(/^[\dA-Za-z]*$/,"only letters and digits 0-9"),hex:GB,base64:YB,capitalize:JB,creditCard:QB,date:iz,digits:et(/^\d*$/,"only digits 0-9"),email:rz,integer:qE,ip:az,json:cz,lower:fz,normalize:yz,numeric:gz,regex:vz,semver:Sz,trim:wz,upper:xz,url:Az,uuid:Ez},{name:"string"}),_z=ze.module({bigint:me.bigint,boolean:me.boolean,false:me.false,never:me.never,null:me.null,number:me.number,object:me.object,string:me.string,symbol:me.symbol,true:me.true,unknown:me.unknown,undefined:me.undefined}),Rz=ze.module({root:me.unknown,any:me.unknown},{name:"unknown"}),kz=ze.module({root:me.jsonObject,stringify:Ky("morph",{in:me.jsonObject,morphs:t=>JSON.stringify(t),declaredOut:me.string})},{name:"object.json"}),Cz=ze.module({root:me.object,json:kz},{name:"object"});class Mz extends wi{description='instantiate an object from an index signature and corresponding value type like `Record("string", "number")`'}const Dz=tr(["K",me.key],"V")(t=>({domain:"object",index:{signature:t.K,value:t.V}}),Mz);class Nz extends wi{description='pick a set of properties from an object like `Pick(User, "name | age")`'}const $z=tr(["T",me.object],["K",me.key])(t=>t.T.pick(t.K),Nz);class jz extends wi{description='omit a set of properties from an object like `Omit(User, "age")`'}const Bz=tr(["T",me.object],["K",me.key])(t=>t.T.omit(t.K),jz);class zz extends wi{description="make all named properties of an object optional like `Partial(User)`"}const Lz=tr(["T",me.object])(t=>t.T.partial(),zz);class Vz extends wi{description="make all named properties of an object required like `Required(User)`"}const Uz=tr(["T",me.object])(t=>t.T.required(),Vz);class Kz extends wi{description='exclude branches of a union like `Exclude("boolean", "true")`'}const qz=tr("T","U")(t=>t.T.exclude(t.U),Kz);class Pz extends wi{description='extract branches of a union like `Extract("0 | false | 1", "number")`'}const Iz=tr("T","U")(t=>t.T.extract(t.U),Pz),Hz=ze.module({Exclude:qz,Extract:Iz,Omit:Bz,Partial:Lz,Pick:$z,Record:Dz,Required:Uz}),Fr=NB({..._z,...Hz,...IB,...BB,string:Oz,number:KE,object:Cz,unknown:Rz},{prereducedAliases:!0,name:"ark"}),jt=Fr.export();Object.assign(ml.ambient,jt);ml.typeAttachments={string:jt.string.root,number:jt.number.root,bigint:jt.bigint,boolean:jt.boolean,symbol:jt.symbol,undefined:jt.undefined,null:jt.null,object:jt.object.root,unknown:jt.unknown.root,false:jt.false,true:jt.true,never:jt.never,arrayIndex:jt.Array.index,Key:jt.Key,Record:jt.Record,Array:jt.Array.root,Date:jt.Date};const Et=Object.assign(Fr.type,ml.typeAttachments);Fr.match;Fr.fn;Fr.generic;Fr.schema;Fr.define;Fr.declare;const HE={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 Fz(t){return Number.parseInt(t,10)}const Gz=Et(HE),Yz=Gz.keyof().pipe(t=>Fz(t));Et([Yz,"string"]);function Jz(t){return F.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 500 101",...t,children:[F.jsx("title",{children:"Tempest Games Logo"}),F.jsx("path",{d:"M155.76.93v59.89h-17.11V7.78h-13.69V.93h30.8Z",style:{fill:"var(--logo-color)",strokeWidth:0}}),F.jsx("path",{d:"M202.91,7.86h-13.18v17.03h13.18v6.84h-13.18v22.24h13.18v6.84h-30.29V.93h30.29v6.93Z",style:{fill:"var(--logo-color)",strokeWidth:0}}),F.jsx("path",{d:"M289.49.93v59.89h-17.11V7.78h-.43c-8.21,0-11.21,5.82-11.21,17.03v36.02h-16.25V24.8c0-11.21-2.99-17.03-11.21-17.03h-.43v53.04h-17.11V.93h18.74c9.92,0,15.31,4.96,18.14,11.21,2.82-6.25,8.21-11.21,18.14-11.21h18.73Z",style:{fill:"var(--logo-color)",strokeWidth:0}}),F.jsx("path",{d:"M352.82,29.68c0,11.72-6.42,19.16-24.55,19.16h-4.53v11.98h-17.11V1.1l46.2-.17v28.75ZM323.73,7.78v34.22h2.48c7.36,0,9.5-4.11,9.5-12.15V7.78h-11.98Z",style:{fill:"var(--logo-color)",strokeWidth:0}}),F.jsx("path",{d:"M396.8,7.86h-13.17v17.03h13.17v6.84h-13.17v22.24h13.17v6.84h-30.28V.93h30.28v6.93Z",style:{fill:"var(--logo-color)",strokeWidth:0}}),F.jsx("path",{d:"M425.9,12.57v14.03h27.89v16.94c0,12.75-1.71,18.13-16.43,18.13h-14.54c-9.58,0-14.03-2.74-14.03-11.97v-5.99h15.4v5.13c0,4.53.77,5.99,4.62,5.99h1.71c5.05,0,6.16-1.46,6.16-6.84v-14.54h-27.89v-16.68c0-13.52,3.85-16.68,18.82-16.68h12.83c8.81,0,13.17,1.54,13.17,10.78v7.19h-15.4v-6.5c0-3.42-1.03-4.62-4.45-4.62h-1.45c-4.28,0-6.42,1.46-6.42,5.65Z",style:{fill:"var(--logo-color)",strokeWidth:0}}),F.jsx("path",{d:"M500,7.78h-13.69v53.04h-17.11V.93h30.8v6.84Z",style:{fill:"var(--logo-color)",strokeWidth:0}}),F.jsx("path",{d:"M155.96,93.78v-3.57h-5.58v-7.14h13.39v17.85h-24.76v-28.56h24.76v7.14h-16.96v14.28h9.15Z",style:{fill:"var(--logo-color)",strokeWidth:0}}),F.jsx("path",{d:"M224.26,100.92h-8.25v-10.71h-8.25v3.57h4.68v7.14h-12.94v-17.85h16.51v-3.57h-16.51v-7.14h24.76v28.56Z",style:{fill:"var(--logo-color)",strokeWidth:0}}),F.jsx("path",{d:"M259.99,72.36h30.57v28.56h-7.81v-21.42h-3.57v21.42h-7.81v-21.42h-3.57v21.42h-7.81v-28.56Z",style:{fill:"var(--logo-color)",strokeWidth:0}}),F.jsx("path",{d:"M343.24,83.08v-3.57h-9.14v14.28h16.96v7.14h-24.76v-28.56h24.76v17.85h-13.38v-7.14h5.57Z",style:{fill:"var(--logo-color)",strokeWidth:0}}),F.jsx("path",{d:"M394.59,79.5v3.57h16.96v17.85h-24.76v-7.14h16.96v-3.57h-16.96v-17.85h24.76v7.14h-16.96Z",style:{fill:"var(--logo-color)",strokeWidth:0}}),F.jsx("path",{d:"M0,63.42v-20.84h20.83L0,63.42ZM100,.92v32.29h-35.42v8.33h-8.33V14.46h-22.92l1.04,7.29h9.38v19.79h-8.33v-8.33H0V.92h100ZM0,100.92v-26.04l6.25-1.04,25-26.04,1.04,1.05-10.42,18.75-4.16,7.29h13.54l3.13-3.12,8.33-22.92h1.04v41.66h3.12l9.38-8.33v-33.33h1.04l8.33,22.92,3.12,3.12h13.54l-4.17-7.29-10.42-19.8,1.04-1.04,25,27.09,6.25,1.04v26.04H0ZM100,42.59v20.84l-20.83-20.84h20.83Z",style:{fill:"var(--logo-color)",strokeWidth:0}})]})}function FE(t){return F.jsx("a",{...t})}const Xz={class:"_class_1riwg_1"},Sp=["⠋","⠙","⠸","⠴","⠦","⠇"];function Zz({input:t}){const e=N.useRef(null),[n,r]=N.useState(typeof t=="string"?t:null);return N.useEffect(()=>{let o=!0,u;if(typeof t=="string")r(t);else{let c=0;u=setInterval(()=>{e.current&&(e.current.textContent=Sp[c],c=(c+1)%Sp.length)},100),t.then(f=>{o&&(clearInterval(u),r(f))})}return()=>{o=!1,u&&clearInterval(u)}},[t]),F.jsx("span",{ref:e,children:n??Sp[0]})}const GE=(t,{stringify:e,parse:n},r)=>({setSelf:o,onSet:u})=>{if(!t)return;const c=t.getItem(r);c!=null&&o(n(c)),u(({newValue:f})=>{if(f==null){t.removeItem(r);return}t.setItem(r,e(f))})},Qz=Object.freeze(Object.defineProperty({__proto__:null,storageSync:GE},Symbol.toStringTag,{value:"Module"}));var Wz=Object.create,YE=Object.defineProperty,eL=Object.getOwnPropertyDescriptor,JE=Object.getOwnPropertyNames,tL=Object.getPrototypeOf,nL=Object.prototype.hasOwnProperty,xi=(t,e)=>function(){return e||(0,t[JE(t)[0]])((e={exports:{}}).exports,e),e.exports},iL=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(var o=JE(e),u=0,c=o.length,f;u<c;u++)f=o[u],!nL.call(t,f)&&f!==n&&YE(t,f,{get:(h=>e[h]).bind(null,f),enumerable:!(r=eL(e,f))||r.enumerable});return t},gt=(t,e,n)=>(n=t!=null?Wz(tL(t)):{},iL(YE(n,"default",{value:t,enumerable:!0}),t)),XE=xi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/typeof.js"(t,e){function n(r){"@babel/helpers - typeof";return e.exports=n=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(o){return typeof o}:function(o){return o&&typeof Symbol=="function"&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},e.exports.__esModule=!0,e.exports.default=e.exports,n(r)}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports}}),rL=xi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js"(t,e){var n=XE().default;function r(o,u){if(n(o)!="object"||!o)return o;var c=o[Symbol.toPrimitive];if(c!==void 0){var f=c.call(o,u||"default");if(n(f)!="object")return f;throw new TypeError("@@toPrimitive must return a primitive value.")}return(u==="string"?String:Number)(o)}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}}),sL=xi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js"(t,e){var n=XE().default,r=rL();function o(u){var c=r(u,"string");return n(c)=="symbol"?c:c+""}e.exports=o,e.exports.__esModule=!0,e.exports.default=e.exports}}),Ms=xi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(t,e){var n=sL();function r(o,u,c){return(u=n(u))in o?Object.defineProperty(o,u,{value:c,enumerable:!0,configurable:!0,writable:!0}):o[u]=c,o}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}}),ti=xi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(t,e){var n=Ms();function r(u,c){var f=Object.keys(u);if(Object.getOwnPropertySymbols){var h=Object.getOwnPropertySymbols(u);c&&(h=h.filter(function(m){return Object.getOwnPropertyDescriptor(u,m).enumerable})),f.push.apply(f,h)}return f}function o(u){for(var c=1;c<arguments.length;c++){var f=arguments[c]!=null?arguments[c]:{};c%2?r(Object(f),!0).forEach(function(h){n(u,h,f[h])}):Object.getOwnPropertyDescriptors?Object.defineProperties(u,Object.getOwnPropertyDescriptors(f)):r(Object(f)).forEach(function(h){Object.defineProperty(u,h,Object.getOwnPropertyDescriptor(f,h))})}return u}e.exports=o,e.exports.__esModule=!0,e.exports.default=e.exports}});function Mf(t){const e={subscribe(n){let r=null,o=!1,u=!1,c=!1;function f(){if(r===null){c=!0;return}u||(u=!0,typeof r=="function"?r():r&&r.unsubscribe())}return r=t({next(h){var m;o||(m=n.next)===null||m===void 0||m.call(n,h)},error(h){var m;o||(o=!0,(m=n.error)===null||m===void 0||m.call(n,h),f())},complete(){var h;o||(o=!0,(h=n.complete)===null||h===void 0||h.call(n),f())}}),c&&f(),{unsubscribe:f}},pipe(...n){return n.reduce(oL,e)}};return e}function oL(t,e){return e(t)}function aL(t){const e=new AbortController;return new Promise((r,o)=>{let u=!1;function c(){u||(u=!0,f.unsubscribe())}e.signal.addEventListener("abort",()=>{o(e.signal.reason)});const f=t.subscribe({next(h){u=!0,r(h),c()},error(h){o(h)},complete(){e.abort(),c()}})})}function lL(t){return e=>{let n=0,r=null;const o=[];function u(){r||(r=e.subscribe({next(f){for(const m of o){var h;(h=m.next)===null||h===void 0||h.call(m,f)}},error(f){for(const m of o){var h;(h=m.error)===null||h===void 0||h.call(m,f)}},complete(){for(const h of o){var f;(f=h.complete)===null||f===void 0||f.call(h)}}}))}function c(){if(n===0&&r){const f=r;r=null,f.unsubscribe()}}return Mf(f=>(n++,o.push(f),u(),{unsubscribe(){n--,c();const h=o.findIndex(m=>m===f);h>-1&&o.splice(h,1)}}))}}function uL(t){let e=t;const n=[],r=c=>{e!==void 0&&c.next(e),n.push(c)},o=c=>{n.splice(n.indexOf(c),1)},u=Mf(c=>(r(c),()=>{o(c)}));return u.next=c=>{if(e!==c){e=c;for(const f of n)f.next(c)}},u.get=()=>e,u}function cL(t){return Mf(e=>{function n(o=0,u=t.op){const c=t.links[o];if(!c)throw new Error("No more links to execute - did you forget to add an ending link?");return c({op:u,next(h){return n(o+1,h)}})}return n().subscribe(e)})}function yl(t){return!!t&&!Array.isArray(t)&&typeof t=="object"}function fL(){return Object.create(null)}var dL=Object.create,ZE=Object.defineProperty,hL=Object.getOwnPropertyDescriptor,QE=Object.getOwnPropertyNames,pL=Object.getPrototypeOf,mL=Object.prototype.hasOwnProperty,$l=(t,e)=>function(){return e||(0,t[QE(t)[0]])((e={exports:{}}).exports,e),e.exports},yL=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(var o=QE(e),u=0,c=o.length,f;u<c;u++)f=o[u],!mL.call(t,f)&&f!==n&&ZE(t,f,{get:(h=>e[h]).bind(null,f),enumerable:!(r=hL(e,f))||r.enumerable});return t},Df=(t,e,n)=>(n=t!=null?dL(pL(t)):{},yL(ZE(n,"default",{value:t,enumerable:!0}),t));const WE=()=>{},gx=t=>{Object.freeze&&Object.freeze(t)};function eO(t,e,n){var r;const o=e.join(".");return(r=n[o])!==null&&r!==void 0||(n[o]=new Proxy(WE,{get(u,c){if(!(typeof c!="string"||c==="then"))return eO(t,[...e,c],n)},apply(u,c,f){const h=e[e.length-1];let m={args:f,path:e};return h==="call"?m={args:f.length>=2?[f[1]]:[],path:e.slice(0,-1)}:h==="apply"&&(m={args:f.length>=2?f[1]:[],path:e.slice(0,-1)}),gx(m.args),gx(m.path),t(m)}})),n[o]}const gL=t=>eO(t,[],fL()),vL=t=>new Proxy(WE,{get(e,n){if(n!=="then")return t(n)}});var tO=$l({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/typeof.js"(t,e){function n(r){"@babel/helpers - typeof";return e.exports=n=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(o){return typeof o}:function(o){return o&&typeof Symbol=="function"&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},e.exports.__esModule=!0,e.exports.default=e.exports,n(r)}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports}}),bL=$l({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js"(t,e){var n=tO().default;function r(o,u){if(n(o)!="object"||!o)return o;var c=o[Symbol.toPrimitive];if(c!==void 0){var f=c.call(o,u||"default");if(n(f)!="object")return f;throw new TypeError("@@toPrimitive must return a primitive value.")}return(u==="string"?String:Number)(o)}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}}),SL=$l({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js"(t,e){var n=tO().default,r=bL();function o(u){var c=r(u,"string");return n(c)=="symbol"?c:c+""}e.exports=o,e.exports.__esModule=!0,e.exports.default=e.exports}}),nO=$l({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(t,e){var n=SL();function r(o,u,c){return(u=n(u))in o?Object.defineProperty(o,u,{value:c,enumerable:!0,configurable:!0,writable:!0}):o[u]=c,o}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}}),Iy=$l({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(t,e){var n=nO();function r(u,c){var f=Object.keys(u);if(Object.getOwnPropertySymbols){var h=Object.getOwnPropertySymbols(u);c&&(h=h.filter(function(m){return Object.getOwnPropertyDescriptor(u,m).enumerable})),f.push.apply(f,h)}return f}function o(u){for(var c=1;c<arguments.length;c++){var f=arguments[c]!=null?arguments[c]:{};c%2?r(Object(f),!0).forEach(function(h){n(u,h,f[h])}):Object.getOwnPropertyDescriptors?Object.defineProperties(u,Object.getOwnPropertyDescriptors(f)):r(Object(f)).forEach(function(h){Object.defineProperty(u,h,Object.getOwnPropertyDescriptor(f,h))})}return u}e.exports=o,e.exports.__esModule=!0,e.exports.default=e.exports}});Df(Iy());Df(nO());var cc=Df(Iy());function wL(t,e){if("error"in t){const r=e.deserialize(t.error);return{ok:!1,error:(0,cc.default)((0,cc.default)({},t),{},{error:r})}}return{ok:!0,result:(0,cc.default)((0,cc.default)({},t.result),(!t.result.type||t.result.type==="data")&&{type:"data",data:e.deserialize(t.result.data)})}}var wp=class extends Error{constructor(){super("Unable to transform response from server")}};function xL(t,e){let n;try{n=wL(t,e)}catch{throw new wp}if(!n.ok&&(!yl(n.error.error)||typeof n.error.error.code!="number"))throw new wp;if(n.ok&&!yl(n.result))throw new wp;return n}Df(Iy());var fc=gt(Ms()),So=gt(ti());function TL(t){return t instanceof gl}function AL(t){return yl(t)&&yl(t.error)&&typeof t.error.code=="number"&&typeof t.error.message=="string"}function EL(t,e){return typeof t=="string"?t:yl(t)&&typeof t.message=="string"?t.message:e}var gl=class Tc extends Error{constructor(e,n){var r,o;const u=n?.cause;super(e,{cause:u}),(0,fc.default)(this,"cause",void 0),(0,fc.default)(this,"shape",void 0),(0,fc.default)(this,"data",void 0),(0,fc.default)(this,"meta",void 0),this.meta=n?.meta,this.cause=u,this.shape=n==null||(r=n.result)===null||r===void 0?void 0:r.error,this.data=n==null||(o=n.result)===null||o===void 0?void 0:o.error.data,this.name="TRPCClientError",Object.setPrototypeOf(this,Tc.prototype)}static from(e,n={}){const r=e;return TL(r)?(n.meta&&(r.meta=(0,So.default)((0,So.default)({},r.meta),n.meta)),r):AL(r)?new Tc(r.error.message,(0,So.default)((0,So.default)({},n),{},{result:r})):new Tc(EL(r,"Unknown error"),(0,So.default)((0,So.default)({},n),{},{cause:r}))}};function OL(t){const e=t;return e?"input"in e?e:{input:e,output:e}:{input:{serialize:n=>n,deserialize:n=>n},output:{serialize:n=>n,deserialize:n=>n}}}const vx=t=>typeof t=="function";function _L(t){if(t)return t;if(typeof window<"u"&&vx(window.fetch))return window.fetch;if(typeof globalThis<"u"&&vx(globalThis.fetch))return globalThis.fetch;throw new Error("No fetch implementation found")}var il=gt(ti());function RL(t){return{url:t.url.toString(),fetch:t.fetch,transformer:OL(t.transformer),methodOverride:t.methodOverride}}function kL(t){const e={};for(let n=0;n<t.length;n++){const r=t[n];e[n]=r}return e}const CL={query:"GET",mutation:"POST",subscription:"PATCH"};function iO(t){return"input"in t?t.transformer.input.serialize(t.input):kL(t.inputs.map(e=>t.transformer.input.serialize(e)))}const rO=t=>{const e=t.url.split("?");let r=e[0].replace(/\/$/,"")+"/"+t.path;const o=[];if(e[1]&&o.push(e[1]),"inputs"in t&&o.push("batch=1"),t.type==="query"||t.type==="subscription"){const u=iO(t);u!==void 0&&t.methodOverride!=="POST"&&o.push(`input=${encodeURIComponent(JSON.stringify(u))}`)}return o.length&&(r+="?"+o.join("&")),r},ML=t=>{if(t.type==="query"&&t.methodOverride!=="POST")return;const e=iO(t);return e!==void 0?JSON.stringify(e):void 0},DL=t=>BL((0,il.default)((0,il.default)({},t),{},{contentTypeHeader:"application/json",getUrl:rO,getBody:ML}));var NL=class extends Error{constructor(){const t="AbortError";super(t),this.name=t,this.message=t}};const $L=t=>{var e;if(t?.aborted)throw(e=t.throwIfAborted)===null||e===void 0||e.call(t),typeof DOMException<"u"?new DOMException("AbortError","AbortError"):new NL};async function jL(t){var e;$L(t.signal);const n=t.getUrl(t),r=t.getBody(t),o=(e=t.methodOverride)!==null&&e!==void 0?e:CL[t.type],u=await(async()=>{const f=await t.headers();return Symbol.iterator in f?Object.fromEntries(f):f})(),c=(0,il.default)((0,il.default)((0,il.default)({},t.contentTypeHeader&&o!=="GET"?{"content-type":t.contentTypeHeader}:{}),t.trpcAcceptHeader?{"trpc-accept":t.trpcAcceptHeader}:void 0),u);return _L(t.fetch)(n,{method:o,signal:t.signal,body:r,headers:c})}async function BL(t){const e={},n=await jL(t);e.response=n;const r=await n.json();return e.responseJSON=r,{json:r,meta:e}}gt(ti());const bx=()=>{throw new Error("Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new")};function Sx(t){let e=null,n=null;const r=()=>{clearTimeout(n),n=null,e=null};function o(f){const h=[[]];let m=0;for(;;){const b=f[m];if(!b)break;const S=h[h.length-1];if(b.aborted){var y;(y=b.reject)===null||y===void 0||y.call(b,new Error("Aborted")),m++;continue}if(t.validate(S.concat(b).map(T=>T.key))){S.push(b),m++;continue}if(S.length===0){var g;(g=b.reject)===null||g===void 0||g.call(b,new Error("Input is too big for a single dispatch")),m++;continue}h.push([])}return h}function u(){const f=o(e);r();for(const h of f){if(!h.length)continue;const m={items:h};for(const g of h)g.batch=m;t.fetch(m.items.map(g=>g.key)).then(async g=>{await Promise.all(g.map(async(S,x)=>{const T=m.items[x];try{var _;const C=await Promise.resolve(S);(_=T.resolve)===null||_===void 0||_.call(T,C)}catch(C){var k;(k=T.reject)===null||k===void 0||k.call(T,C)}T.batch=null,T.reject=null,T.resolve=null}));for(const S of m.items){var b;(b=S.reject)===null||b===void 0||b.call(S,new Error("Missing result")),S.batch=null}}).catch(g=>{for(const S of m.items){var b;(b=S.reject)===null||b===void 0||b.call(S,g),S.batch=null}})}}function c(f){var h;const m={aborted:!1,key:f,batch:null,resolve:bx,reject:bx},y=new Promise((g,b)=>{var S;m.reject=b,m.resolve=g,(S=e)!==null&&S!==void 0||(e=[]),e.push(m)});return(h=n)!==null&&h!==void 0||(n=setTimeout(u)),y}return{load:c}}function zL(...t){const e=new AbortController,n=t.length;let r=0;const o=()=>{++r===n&&e.abort()};for(const u of t)u?.aborted?o():u?.addEventListener("abort",o,{once:!0});return e.signal}var dc=gt(ti());function LL(t){var e,n;const r=RL(t),o=(e=t.maxURLLength)!==null&&e!==void 0?e:1/0,u=(n=t.maxItems)!==null&&n!==void 0?n:1/0;return()=>{const c=y=>({validate(g){if(o===1/0&&u===1/0)return!0;if(g.length>u)return!1;const b=g.map(T=>T.path).join(","),S=g.map(T=>T.input);return rO((0,dc.default)((0,dc.default)({},r),{},{type:y,path:b,inputs:S,signal:null})).length<=o},async fetch(g){const b=g.map(C=>C.path).join(","),S=g.map(C=>C.input),x=zL(...g.map(C=>C.signal)),T=await DL((0,dc.default)((0,dc.default)({},r),{},{path:b,inputs:S,type:y,headers(){return t.headers?typeof t.headers=="function"?t.headers({opList:g}):t.headers:{}},signal:x}));return(Array.isArray(T.json)?T.json:g.map(()=>T.json)).map(C=>({meta:T.meta,json:C}))}}),f=Sx(c("query")),h=Sx(c("mutation")),m={query:f,mutation:h};return({op:y})=>Mf(g=>{if(y.type==="subscription")throw new Error("Subscriptions are unsupported by `httpLink` - use `httpSubscriptionLink` or `wsLink`");const S=m[y.type].load(y);let x;return S.then(T=>{x=T;const _=xL(T.json,r.transformer.output);if(!_.ok){g.error(gl.from(_.error,{meta:T.meta}));return}g.next({context:T.meta,result:_.result}),g.complete()}).catch(T=>{g.error(gl.from(T,{meta:x?.meta}))}),()=>{}})}}gt(ti());const sO=(t,...e)=>typeof t=="function"?t(...e):t;gt(Ms());function VL(){let t,e;return{promise:new Promise((r,o)=>{t=r,e=o}),resolve:t,reject:e}}async function UL(t){const e=await sO(t.url);if(!t.connectionParams)return e;const r=`${e.includes("?")?"&":"?"}connectionParams=1`;return e+r}async function KL(t){const e={method:"connectionParams",data:await sO(t)};return JSON.stringify(e)}gt(Ms());var ps=gt(Ms());function qL(t){const{promise:e,resolve:n,reject:r}=VL();return t.addEventListener("open",()=>{t.removeEventListener("error",r),n()}),t.addEventListener("error",r),e}function PL(t,{intervalMs:e,pongTimeoutMs:n}){let r,o;function u(){r=setTimeout(()=>{t.send("PING"),o=setTimeout(()=>{t.close()},n)},e)}function c(){clearTimeout(r),u()}function f(){clearTimeout(o),c()}t.addEventListener("open",u),t.addEventListener("message",({data:h})=>{clearTimeout(r),u(),h==="PONG"&&f()}),t.addEventListener("close",()=>{clearTimeout(r),clearTimeout(o)})}var IL=class xm{constructor(e){var n;if((0,ps.default)(this,"id",++xm.connectCount),(0,ps.default)(this,"WebSocketPonyfill",void 0),(0,ps.default)(this,"urlOptions",void 0),(0,ps.default)(this,"keepAliveOpts",void 0),(0,ps.default)(this,"wsObservable",uL(null)),(0,ps.default)(this,"openPromise",null),this.WebSocketPonyfill=(n=e.WebSocketPonyfill)!==null&&n!==void 0?n:WebSocket,!this.WebSocketPonyfill)throw new Error("No WebSocket implementation found - you probably don't want to use this on the server, but if you do you need to pass a `WebSocket`-ponyfill");this.urlOptions=e.urlOptions,this.keepAliveOpts=e.keepAlive}get ws(){return this.wsObservable.get()}set ws(e){this.wsObservable.next(e)}isOpen(){return!!this.ws&&this.ws.readyState===this.WebSocketPonyfill.OPEN&&!this.openPromise}isClosed(){return!!this.ws&&(this.ws.readyState===this.WebSocketPonyfill.CLOSING||this.ws.readyState===this.WebSocketPonyfill.CLOSED)}async open(){var e=this;if(e.openPromise)return e.openPromise;e.id=++xm.connectCount;const n=UL(e.urlOptions).then(r=>new e.WebSocketPonyfill(r));e.openPromise=n.then(async r=>{e.ws=r,r.addEventListener("message",function({data:o}){o==="PING"&&this.send("PONG")}),e.keepAliveOpts.enabled&&PL(r,e.keepAliveOpts),r.addEventListener("close",()=>{e.ws===r&&(e.ws=null)}),await qL(r),e.urlOptions.connectionParams&&r.send(await KL(e.urlOptions.connectionParams))});try{await e.openPromise}finally{e.openPromise=null}}async close(){var e=this;try{await e.openPromise}finally{var n;(n=e.ws)===null||n===void 0||n.close()}}};(0,ps.default)(IL,"connectCount",0);gt(Ms());gt(ti());var xp=gt(Ms()),wx=gt(ti()),HL=class{constructor(t){(0,xp.default)(this,"links",void 0),(0,xp.default)(this,"runtime",void 0),(0,xp.default)(this,"requestId",void 0),this.requestId=0,this.runtime={},this.links=t.links.map(e=>e(this.runtime))}$request(t){var e;return cL({links:this.links,op:(0,wx.default)((0,wx.default)({},t),{},{context:(e=t.context)!==null&&e!==void 0?e:{},id:++this.requestId})}).pipe(lL())}async requestAsPromise(t){var e=this;try{const n=e.$request(t);return(await aL(n)).result.data}catch(n){throw gl.from(n)}}query(t,e,n){return this.requestAsPromise({type:"query",path:t,input:e,context:n?.context,signal:n?.signal})}mutation(t,e,n){return this.requestAsPromise({type:"mutation",path:t,input:e,context:n?.context,signal:n?.signal})}subscription(t,e,n){return this.$request({type:"subscription",path:t,input:e,context:n.context,signal:n.signal}).subscribe({next(o){switch(o.result.type){case"state":{var u;(u=n.onConnectionStateChange)===null||u===void 0||u.call(n,o.result);break}case"started":{var c;(c=n.onStarted)===null||c===void 0||c.call(n,{context:o.context});break}case"stopped":{var f;(f=n.onStopped)===null||f===void 0||f.call(n);break}case"data":case void 0:{var h;(h=n.onData)===null||h===void 0||h.call(n,o.result.data);break}}},error(o){var u;(u=n.onError)===null||u===void 0||u.call(n,o)},complete(){var o;(o=n.onComplete)===null||o===void 0||o.call(n)}})}};const FL=Symbol.for("trpc_untypedClient"),GL={query:"query",mutate:"mutation",subscribe:"subscription"},YL=t=>GL[t];function JL(t){const e=gL(({path:n,args:r})=>{const o=[...n],u=YL(o.pop()),c=o.join(".");return t[u](c,...r)});return vL(n=>n===FL?t:e[n])}function XL(t){const e=new HL(t);return JL(e)}gt(ti());gt(ti());var ZL=xi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/asyncIterator.js"(t,e){function n(o){var u,c,f,h=2;for(typeof Symbol<"u"&&(c=Symbol.asyncIterator,f=Symbol.iterator);h--;){if(c&&(u=o[c])!=null)return u.call(o);if(f&&(u=o[f])!=null)return new r(u.call(o));c="@@asyncIterator",f="@@iterator"}throw new TypeError("Object is not async iterable")}function r(o){function u(c){if(Object(c)!==c)return Promise.reject(new TypeError(c+" is not an object."));var f=c.done;return Promise.resolve(c.value).then(function(h){return{value:h,done:f}})}return r=function(f){this.s=f,this.n=f.next},r.prototype={s:null,n:null,next:function(){return u(this.n.apply(this.s,arguments))},return:function(f){var h=this.s.return;return h===void 0?Promise.resolve({value:f,done:!0}):u(h.apply(this.s,arguments))},throw:function(f){var h=this.s.return;return h===void 0?Promise.reject(f):u(h.apply(this.s,arguments))}},new r(o)}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports}});gt(ZL());gt(ti());var QL=xi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/usingCtx.js"(t,e){function n(){var r=typeof SuppressedError=="function"?SuppressedError:function(f,h){var m=Error();return m.name="SuppressedError",m.error=f,m.suppressed=h,m},o={},u=[];function c(f,h){if(h!=null){if(Object(h)!==h)throw new TypeError("using declarations can only be used with objects, functions, null, or undefined.");if(f)var m=h[Symbol.asyncDispose||Symbol.for("Symbol.asyncDispose")];if(m===void 0&&(m=h[Symbol.dispose||Symbol.for("Symbol.dispose")],f))var y=m;if(typeof m!="function")throw new TypeError("Object is not disposable.");y&&(m=function(){try{y.call(h)}catch(b){return Promise.reject(b)}}),u.push({v:h,d:m,a:f})}else f&&u.push({d:h,a:f});return h}return{e:o,u:c.bind(null,!1),a:c.bind(null,!0),d:function(){var h,m=this.e,y=0;function g(){for(;h=u.pop();)try{if(!h.a&&y===1)return y=0,u.push(h),Promise.resolve().then(g);if(h.d){var S=h.d.call(h.v);if(h.a)return y|=2,Promise.resolve(S).then(g,b)}else y|=1}catch(x){return b(x)}if(y===1)return m!==o?Promise.reject(m):Promise.resolve();if(m!==o)throw m}function b(S){return m=m!==o?new r(S,m):S,g()}return g()}}}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports}}),oO=xi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/OverloadYield.js"(t,e){function n(r,o){this.v=r,this.k=o}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports}}),WL=xi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/awaitAsyncGenerator.js"(t,e){var n=oO();function r(o){return new n(o,0)}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}}),eV=xi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/wrapAsyncGenerator.js"(t,e){var n=oO();function r(u){return function(){return new o(u.apply(this,arguments))}}function o(u){var c,f;function h(y,g){try{var b=u[y](g),S=b.value,x=S instanceof n;Promise.resolve(x?S.v:S).then(function(T){if(x){var _=y==="return"?"return":"next";if(!S.k||T.done)return h(_,T);T=u[_](T).value}m(b.done?"return":"normal",T)},function(T){h("throw",T)})}catch(T){m("throw",T)}}function m(y,g){switch(y){case"return":c.resolve({value:g,done:!0});break;case"throw":c.reject(g);break;default:c.resolve({value:g,done:!1})}(c=c.next)?h(c.key,c.arg):f=null}this._invoke=function(y,g){return new Promise(function(b,S){var x={key:y,arg:g,resolve:b,reject:S,next:null};f?f=f.next=x:(c=f=x,h(y,g))})},typeof u.return!="function"&&(this.return=void 0)}o.prototype[typeof Symbol=="function"&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},o.prototype.next=function(u){return this._invoke("next",u)},o.prototype.throw=function(u){return this._invoke("throw",u)},o.prototype.return=function(u){return this._invoke("return",u)},e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}});gt(QL());gt(WL());gt(eV());gt(ti());function aO(t,e){if(t instanceof Promise)throw new Error(e)}function tV(t,e){const n={},r=[];for(const o in t){const u=t[o]["~standard"].validate(e[o]);if(aO(u,`Validation must be synchronous, but ${o} returned a Promise.`),u.issues){r.push(...u.issues.map(c=>({...c,message:c.message,path:[o,...c.path??[]]})));continue}n[o]=u.value}return r.length?{issues:r}:{value:n}}var nV={};function iV(t){const e=t.runtimeEnvStrict??t.runtimeEnv??nV;if(t.emptyStringAsUndefined??!1)for(const[T,_]of Object.entries(e))_===""&&delete e[T];if(t.skipValidation){if(t.extends)for(const T of t.extends)T.skipValidation=!0;return e}const n=typeof t.client=="object"?t.client:{},r=typeof t.server=="object"?t.server:{},o=typeof t.shared=="object"?t.shared:{},u=t.isServer??(typeof window>"u"||"Deno"in window),c=u?{...r,...o,...n}:{...n,...o},f=t.createFinalSchema?.(c,u)?.["~standard"].validate(e)??tV(c,e);aO(f,"Validation must be synchronous");const h=t.onValidationError??(T=>{throw console.error("❌ Invalid environment variables:",T),new Error("Invalid environment variables")}),m=t.onInvalidAccess??(()=>{throw new Error("❌ Attempted to access a server-side environment variable on the client")});if(f.issues)return h(f.issues);const y=T=>t.clientPrefix?!T.startsWith(t.clientPrefix)&&!(T in o):!0,g=T=>u||!y(T),b=T=>T==="__esModule"||T==="$$typeof",S=(t.extends??[]).reduce((T,_)=>Object.assign(T,_),{}),x=Object.assign(S,f.value);return new Proxy(x,{get(T,_){if(typeof _=="string"&&!b(_))return g(_)?Reflect.get(T,_):m(_)}})}const rV={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_BACKEND_ORIGIN:"https://realtime.tempest.games"},sV="__vite_start_time"in globalThis,oV=typeof window<"u",qi=Et("string"),xx=Et('"true" | "false" | undefined'),lO=iV({isServer:!sV&&!oV,server:{CI:Et("string | undefined").pipe(Boolean),POSTGRES_USER:qi,POSTGRES_PASSWORD:qi,POSTGRES_DATABASE:qi,POSTGRES_HOST:qi,POSTGRES_PORT:qi.pipe(t=>Number.parseInt(t,10)),BACKEND_PORT:qi.pipe(t=>Number.parseInt(t,10)),RUN_WORKERS_FROM_SOURCE:xx.pipe(t=>t==="true"),FRONTEND_PORT:qi.pipe(t=>Number.parseInt(t,10)),FRONTEND_ORIGINS:qi.pipe.try(t=>JSON.parse(t),Et("string[]")),API_KEY_OPENAI:Et("string | undefined"),API_KEY_RESEND:Et("string | undefined")},clientPrefix:"VITE_",client:{VITE_BACKEND_ORIGIN:qi,VITE_DEV_FRONTEND_HOST:Et("string | undefined"),VITE_DEV_HTTPS:xx.pipe(t=>t==="true")},runtimeEnv:rV,emptyStringAsUndefined:!0}),cn=XL({links:[LL({url:lO.VITE_BACKEND_ORIGIN,fetch(t,e){return e?(Object.assign(e,{credentials:"include"}),fetch(t,e)):fetch(t)}})]}),aV=ft({key:"appVersionQuery",default:cn.version.query});ft({key:"lastKnownVersion",default:null,effects:[GE(localStorage,JSON,"lastKnownVersion")]});const lV=vi({key:"appVersion",get:async({get:t})=>{const e=t(aV),{version:n}=await e;return n}});function Tp(t){return["optional",t]}function uV(t,e){let n=[t];for(const r of e){if(typeof r!="string")return!1;n=n.flatMap(o=>{if(o===null)return[];const u=[],c=o[1],f=c[r];f!==void 0&&u.push(f);const h=Object.keys(c).find(m=>m.startsWith("$"));if(h){const m=c[h];m&&u.push(m)}return u})}for(const r of n)if(r===null||r[0]==="optional")return!0;return!1}const yi=Object.create(null);yi.open="0";yi.close="1";yi.ping="2";yi.pong="3";yi.message="4";yi.upgrade="5";yi.noop="6";const Ac=Object.create(null);Object.keys(yi).forEach(t=>{Ac[yi[t]]=t});const Tm={type:"error",data:"parser error"},uO=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",cO=typeof ArrayBuffer=="function",fO=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t&&t.buffer instanceof ArrayBuffer,Hy=({type:t,data:e},n,r)=>uO&&e instanceof Blob?n?r(e):Tx(e,r):cO&&(e instanceof ArrayBuffer||fO(e))?n?r(e):Tx(new Blob([e]),r):r(yi[t]+(e||"")),Tx=(t,e)=>{const n=new FileReader;return n.onload=function(){const r=n.result.split(",")[1];e("b"+(r||""))},n.readAsDataURL(t)};function Ax(t){return t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}let Ap;function cV(t,e){if(uO&&t.data instanceof Blob)return t.data.arrayBuffer().then(Ax).then(e);if(cO&&(t.data instanceof ArrayBuffer||fO(t.data)))return e(Ax(t.data));Hy(t,!1,n=>{Ap||(Ap=new TextEncoder),e(Ap.encode(n))})}const Ex="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Wa=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let t=0;t<Ex.length;t++)Wa[Ex.charCodeAt(t)]=t;const fV=t=>{let e=t.length*.75,n=t.length,r,o=0,u,c,f,h;t[t.length-1]==="="&&(e--,t[t.length-2]==="="&&e--);const m=new ArrayBuffer(e),y=new Uint8Array(m);for(r=0;r<n;r+=4)u=Wa[t.charCodeAt(r)],c=Wa[t.charCodeAt(r+1)],f=Wa[t.charCodeAt(r+2)],h=Wa[t.charCodeAt(r+3)],y[o++]=u<<2|c>>4,y[o++]=(c&15)<<4|f>>2,y[o++]=(f&3)<<6|h&63;return m},dV=typeof ArrayBuffer=="function",Fy=(t,e)=>{if(typeof t!="string")return{type:"message",data:dO(t,e)};const n=t.charAt(0);return n==="b"?{type:"message",data:hV(t.substring(1),e)}:Ac[n]?t.length>1?{type:Ac[n],data:t.substring(1)}:{type:Ac[n]}:Tm},hV=(t,e)=>{if(dV){const n=fV(t);return dO(n,e)}else return{base64:!0,data:t}},dO=(t,e)=>{switch(e){case"blob":return t instanceof Blob?t:new Blob([t]);case"arraybuffer":default:return t instanceof ArrayBuffer?t:t.buffer}},hO="",pV=(t,e)=>{const n=t.length,r=new Array(n);let o=0;t.forEach((u,c)=>{Hy(u,!1,f=>{r[c]=f,++o===n&&e(r.join(hO))})})},mV=(t,e)=>{const n=t.split(hO),r=[];for(let o=0;o<n.length;o++){const u=Fy(n[o],e);if(r.push(u),u.type==="error")break}return r};function yV(){return new TransformStream({transform(t,e){cV(t,n=>{const r=n.length;let o;if(r<126)o=new Uint8Array(1),new DataView(o.buffer).setUint8(0,r);else if(r<65536){o=new Uint8Array(3);const u=new DataView(o.buffer);u.setUint8(0,126),u.setUint16(1,r)}else{o=new Uint8Array(9);const u=new DataView(o.buffer);u.setUint8(0,127),u.setBigUint64(1,BigInt(r))}t.data&&typeof t.data!="string"&&(o[0]|=128),e.enqueue(o),e.enqueue(n)})}})}let Ep;function hc(t){return t.reduce((e,n)=>e+n.length,0)}function pc(t,e){if(t[0].length===e)return t.shift();const n=new Uint8Array(e);let r=0;for(let o=0;o<e;o++)n[o]=t[0][r++],r===t[0].length&&(t.shift(),r=0);return t.length&&r<t[0].length&&(t[0]=t[0].slice(r)),n}function gV(t,e){Ep||(Ep=new TextDecoder);const n=[];let r=0,o=-1,u=!1;return new TransformStream({transform(c,f){for(n.push(c);;){if(r===0){if(hc(n)<1)break;const h=pc(n,1);u=(h[0]&128)===128,o=h[0]&127,o<126?r=3:o===126?r=1:r=2}else if(r===1){if(hc(n)<2)break;const h=pc(n,2);o=new DataView(h.buffer,h.byteOffset,h.length).getUint16(0),r=3}else if(r===2){if(hc(n)<8)break;const h=pc(n,8),m=new DataView(h.buffer,h.byteOffset,h.length),y=m.getUint32(0);if(y>Math.pow(2,21)-1){f.enqueue(Tm);break}o=y*Math.pow(2,32)+m.getUint32(4),r=3}else{if(hc(n)<o)break;const h=pc(n,o);f.enqueue(Fy(u?h:Ep.decode(h),e)),r=0}if(o===0||o>t){f.enqueue(Tm);break}}}})}const pO=4;function Ot(t){if(t)return vV(t)}function vV(t){for(var e in Ot.prototype)t[e]=Ot.prototype[e];return t}Ot.prototype.on=Ot.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this};Ot.prototype.once=function(t,e){function n(){this.off(t,n),e.apply(this,arguments)}return n.fn=e,this.on(t,n),this};Ot.prototype.off=Ot.prototype.removeListener=Ot.prototype.removeAllListeners=Ot.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks["$"+t];if(!n)return this;if(arguments.length==1)return delete this._callbacks["$"+t],this;for(var r,o=0;o<n.length;o++)if(r=n[o],r===e||r.fn===e){n.splice(o,1);break}return n.length===0&&delete this._callbacks["$"+t],this};Ot.prototype.emit=function(t){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),n=this._callbacks["$"+t],r=1;r<arguments.length;r++)e[r-1]=arguments[r];if(n){n=n.slice(0);for(var r=0,o=n.length;r<o;++r)n[r].apply(this,e)}return this};Ot.prototype.emitReserved=Ot.prototype.emit;Ot.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]};Ot.prototype.hasListeners=function(t){return!!this.listeners(t).length};const Nf=typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,n)=>n(e,0),Vn=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),bV="arraybuffer";function mO(t,...e){return e.reduce((n,r)=>(t.hasOwnProperty(r)&&(n[r]=t[r]),n),{})}const SV=Vn.setTimeout,wV=Vn.clearTimeout;function $f(t,e){e.useNativeTimers?(t.setTimeoutFn=SV.bind(Vn),t.clearTimeoutFn=wV.bind(Vn)):(t.setTimeoutFn=Vn.setTimeout.bind(Vn),t.clearTimeoutFn=Vn.clearTimeout.bind(Vn))}const xV=1.33;function TV(t){return typeof t=="string"?AV(t):Math.ceil((t.byteLength||t.size)*xV)}function AV(t){let e=0,n=0;for(let r=0,o=t.length;r<o;r++)e=t.charCodeAt(r),e<128?n+=1:e<2048?n+=2:e<55296||e>=57344?n+=3:(r++,n+=4);return n}function yO(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function EV(t){let e="";for(let n in t)t.hasOwnProperty(n)&&(e.length&&(e+="&"),e+=encodeURIComponent(n)+"="+encodeURIComponent(t[n]));return e}function OV(t){let e={},n=t.split("&");for(let r=0,o=n.length;r<o;r++){let u=n[r].split("=");e[decodeURIComponent(u[0])]=decodeURIComponent(u[1])}return e}class _V extends Error{constructor(e,n,r){super(e),this.description=n,this.context=r,this.type="TransportError"}}class Gy extends Ot{constructor(e){super(),this.writable=!1,$f(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,n,r){return super.emitReserved("error",new _V(e,n,r)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(e){this.readyState==="open"&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const n=Fy(e,this.socket.binaryType);this.onPacket(n)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,n={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(n)}_hostname(){const e=this.opts.hostname;return e.indexOf(":")===-1?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(e){const n=EV(e);return n.length?"?"+n:""}}class RV extends Gy{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(e){this.readyState="pausing";const n=()=>{this.readyState="paused",e()};if(this._polling||!this.writable){let r=0;this._polling&&(r++,this.once("pollComplete",function(){--r||n()})),this.writable||(r++,this.once("drain",function(){--r||n()}))}else n()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){const n=r=>{if(this.readyState==="opening"&&r.type==="open"&&this.onOpen(),r.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(r)};mV(e,this.socket.binaryType).forEach(n),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const e=()=>{this.write([{type:"close"}])};this.readyState==="open"?e():this.once("open",e)}write(e){this.writable=!1,pV(e,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const e=this.opts.secure?"https":"http",n=this.query||{};return this.opts.timestampRequests!==!1&&(n[this.opts.timestampParam]=yO()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(e,n)}}let gO=!1;try{gO=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const kV=gO;function CV(){}class MV extends RV{constructor(e){if(super(e),typeof location<"u"){const n=location.protocol==="https:";let r=location.port;r||(r=n?"443":"80"),this.xd=typeof location<"u"&&e.hostname!==location.hostname||r!==e.port}}doWrite(e,n){const r=this.request({method:"POST",data:e});r.on("success",n),r.on("error",(o,u)=>{this.onError("xhr post error",o,u)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(n,r)=>{this.onError("xhr poll error",n,r)}),this.pollXhr=e}}let $o=class Ec extends Ot{constructor(e,n,r){super(),this.createRequest=e,$f(this,r),this._opts=r,this._method=r.method||"GET",this._uri=n,this._data=r.data!==void 0?r.data:null,this._create()}_create(){var e;const n=mO(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this._opts.xd;const r=this._xhr=this.createRequest(n);try{r.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let o in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(o)&&r.setRequestHeader(o,this._opts.extraHeaders[o])}}catch{}if(this._method==="POST")try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{r.setRequestHeader("Accept","*/*")}catch{}(e=this._opts.cookieJar)===null||e===void 0||e.addCookies(r),"withCredentials"in r&&(r.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(r.timeout=this._opts.requestTimeout),r.onreadystatechange=()=>{var o;r.readyState===3&&((o=this._opts.cookieJar)===null||o===void 0||o.parseCookies(r.getResponseHeader("set-cookie"))),r.readyState===4&&(r.status===200||r.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof r.status=="number"?r.status:0)},0))},r.send(this._data)}catch(o){this.setTimeoutFn(()=>{this._onError(o)},0);return}typeof document<"u"&&(this._index=Ec.requestsCount++,Ec.requests[this._index]=this)}_onError(e){this.emitReserved("error",e,this._xhr),this._cleanup(!0)}_cleanup(e){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=CV,e)try{this._xhr.abort()}catch{}typeof document<"u"&&delete Ec.requests[this._index],this._xhr=null}}_onLoad(){const e=this._xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}};$o.requestsCount=0;$o.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",Ox);else if(typeof addEventListener=="function"){const t="onpagehide"in Vn?"pagehide":"unload";addEventListener(t,Ox,!1)}}function Ox(){for(let t in $o.requests)$o.requests.hasOwnProperty(t)&&$o.requests[t].abort()}const DV=(function(){const t=vO({xdomain:!1});return t&&t.responseType!==null})();class NV extends MV{constructor(e){super(e);const n=e&&e.forceBase64;this.supportsBinary=DV&&!n}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new $o(vO,this.uri(),e)}}function vO(t){const e=t.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||kV))return new XMLHttpRequest}catch{}if(!e)try{return new Vn[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const bO=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class $V extends Gy{get name(){return"websocket"}doOpen(){const e=this.uri(),n=this.opts.protocols,r=bO?{}:mO(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,n,r)}catch(o){return this.emitReserved("error",o)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let n=0;n<e.length;n++){const r=e[n],o=n===e.length-1;Hy(r,this.supportsBinary,u=>{try{this.doWrite(r,u)}catch{}o&&Nf(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",n=this.query||{};return this.opts.timestampRequests&&(n[this.opts.timestampParam]=yO()),this.supportsBinary||(n.b64=1),this.createUri(e,n)}}const Op=Vn.WebSocket||Vn.MozWebSocket;class jV extends $V{createSocket(e,n,r){return bO?new Op(e,n,r):n?new Op(e,n):new Op(e)}doWrite(e,n){this.ws.send(n)}}class BV extends Gy{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved("error",e)}this._transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{const n=gV(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=e.readable.pipeThrough(n).getReader(),o=yV();o.readable.pipeTo(e.writable),this._writer=o.writable.getWriter();const u=()=>{r.read().then(({done:f,value:h})=>{f||(this.onPacket(h),u())}).catch(f=>{})};u();const c={type:"open"};this.query.sid&&(c.data=`{"sid":"${this.query.sid}"}`),this._writer.write(c).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let n=0;n<e.length;n++){const r=e[n],o=n===e.length-1;this._writer.write(r).then(()=>{o&&Nf(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)===null||e===void 0||e.close()}}const zV={websocket:jV,webtransport:BV,polling:NV},LV=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,VV=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Am(t){if(t.length>8e3)throw"URI too long";const e=t,n=t.indexOf("["),r=t.indexOf("]");n!=-1&&r!=-1&&(t=t.substring(0,n)+t.substring(n,r).replace(/:/g,";")+t.substring(r,t.length));let o=LV.exec(t||""),u={},c=14;for(;c--;)u[VV[c]]=o[c]||"";return n!=-1&&r!=-1&&(u.source=e,u.host=u.host.substring(1,u.host.length-1).replace(/;/g,":"),u.authority=u.authority.replace("[","").replace("]","").replace(/;/g,":"),u.ipv6uri=!0),u.pathNames=UV(u,u.path),u.queryKey=KV(u,u.query),u}function UV(t,e){const n=/\/{2,9}/g,r=e.replace(n,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&r.splice(0,1),e.slice(-1)=="/"&&r.splice(r.length-1,1),r}function KV(t,e){const n={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,o,u){o&&(n[o]=u)}),n}const Em=typeof addEventListener=="function"&&typeof removeEventListener=="function",Oc=[];Em&&addEventListener("offline",()=>{Oc.forEach(t=>t())},!1);class jr extends Ot{constructor(e,n){if(super(),this.binaryType=bV,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&typeof e=="object"&&(n=e,e=null),e){const r=Am(e);n.hostname=r.host,n.secure=r.protocol==="https"||r.protocol==="wss",n.port=r.port,r.query&&(n.query=r.query)}else n.host&&(n.hostname=Am(n.host).host);$f(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=OV(this.opts.query)),Em&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},Oc.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){const n=Object.assign({},this.opts.query);n.EIO=pO,n.transport=e,this.id&&(n.sid=this.id);const r=Object.assign({},this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](r)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const e=this.opts.rememberUpgrade&&jr.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const n=this.createTransport(e);n.open(),this.setTransport(n)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",n=>this._onClose("transport close",n))}onOpen(){this.readyState="open",jr.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const n=new Error("server error");n.code=e.data,this._onError(n);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data);break}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},e),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let n=1;for(let r=0;r<this.writeBuffer.length;r++){const o=this.writeBuffer[r].data;if(o&&(n+=TV(o)),r>0&&n>this._maxPayload)return this.writeBuffer.slice(0,r);n+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,Nf(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}write(e,n,r){return this._sendPacket("message",e,n,r),this}send(e,n,r){return this._sendPacket("message",e,n,r),this}_sendPacket(e,n,r,o){if(typeof n=="function"&&(o=n,n=void 0),typeof r=="function"&&(o=r,r=null),this.readyState==="closing"||this.readyState==="closed")return;r=r||{},r.compress=r.compress!==!1;const u={type:e,data:n,options:r};this.emitReserved("packetCreate",u),this.writeBuffer.push(u),o&&this.once("flush",o),this.flush()}close(){const e=()=>{this._onClose("forced close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),e()},r=()=>{this.once("upgrade",n),this.once("upgradeError",n)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?r():e()}):this.upgrading?r():e()),this}_onError(e){if(jr.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,n){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),Em&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const r=Oc.indexOf(this._offlineEventListener);r!==-1&&Oc.splice(r,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,n),this.writeBuffer=[],this._prevBufferLen=0}}}jr.protocol=pO;class qV extends jr{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let n=this.createTransport(e),r=!1;jr.priorWebsocketSuccess=!1;const o=()=>{r||(n.send([{type:"ping",data:"probe"}]),n.once("packet",g=>{if(!r)if(g.type==="pong"&&g.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;jr.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{r||this.readyState!=="closed"&&(y(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{const b=new Error("probe error");b.transport=n.name,this.emitReserved("upgradeError",b)}}))};function u(){r||(r=!0,y(),n.close(),n=null)}const c=g=>{const b=new Error("probe error: "+g);b.transport=n.name,u(),this.emitReserved("upgradeError",b)};function f(){c("transport closed")}function h(){c("socket closed")}function m(g){n&&g.name!==n.name&&u()}const y=()=>{n.removeListener("open",o),n.removeListener("error",c),n.removeListener("close",f),this.off("close",h),this.off("upgrading",m)};n.once("open",o),n.once("error",c),n.once("close",f),this.once("close",h),this.once("upgrading",m),this._upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{r||n.open()},200):n.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){const n=[];for(let r=0;r<e.length;r++)~this.transports.indexOf(e[r])&&n.push(e[r]);return n}}let PV=class extends qV{constructor(e,n={}){const r=typeof e=="object"?e:n;(!r.transports||r.transports&&typeof r.transports[0]=="string")&&(r.transports=(r.transports||["polling","websocket","webtransport"]).map(o=>zV[o]).filter(o=>!!o)),super(e,r)}};function IV(t,e="",n){let r=t;n=n||typeof location<"u"&&location,t==null&&(t=n.protocol+"//"+n.host),typeof t=="string"&&(t.charAt(0)==="/"&&(t.charAt(1)==="/"?t=n.protocol+t:t=n.host+t),/^(https?|wss?):\/\//.test(t)||(typeof n<"u"?t=n.protocol+"//"+t:t="https://"+t),r=Am(t)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";const u=r.host.indexOf(":")!==-1?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+u+":"+r.port+e,r.href=r.protocol+"://"+u+(n&&n.port===r.port?"":":"+r.port),r}const HV=typeof ArrayBuffer=="function",FV=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t.buffer instanceof ArrayBuffer,SO=Object.prototype.toString,GV=typeof Blob=="function"||typeof Blob<"u"&&SO.call(Blob)==="[object BlobConstructor]",YV=typeof File=="function"||typeof File<"u"&&SO.call(File)==="[object FileConstructor]";function Yy(t){return HV&&(t instanceof ArrayBuffer||FV(t))||GV&&t instanceof Blob||YV&&t instanceof File}function _c(t,e){if(!t||typeof t!="object")return!1;if(Array.isArray(t)){for(let n=0,r=t.length;n<r;n++)if(_c(t[n]))return!0;return!1}if(Yy(t))return!0;if(t.toJSON&&typeof t.toJSON=="function"&&arguments.length===1)return _c(t.toJSON(),!0);for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&_c(t[n]))return!0;return!1}function JV(t){const e=[],n=t.data,r=t;return r.data=Om(n,e),r.attachments=e.length,{packet:r,buffers:e}}function Om(t,e){if(!t)return t;if(Yy(t)){const n={_placeholder:!0,num:e.length};return e.push(t),n}else if(Array.isArray(t)){const n=new Array(t.length);for(let r=0;r<t.length;r++)n[r]=Om(t[r],e);return n}else if(typeof t=="object"&&!(t instanceof Date)){const n={};for(const r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=Om(t[r],e));return n}return t}function XV(t,e){return t.data=_m(t.data,e),delete t.attachments,t}function _m(t,e){if(!t)return t;if(t&&t._placeholder===!0){if(typeof t.num=="number"&&t.num>=0&&t.num<e.length)return e[t.num];throw new Error("illegal attachments")}else if(Array.isArray(t))for(let n=0;n<t.length;n++)t[n]=_m(t[n],e);else if(typeof t=="object")for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(t[n]=_m(t[n],e));return t}const ZV=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],QV=5;var Ce;(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"})(Ce||(Ce={}));class WV{constructor(e){this.replacer=e}encode(e){return(e.type===Ce.EVENT||e.type===Ce.ACK)&&_c(e)?this.encodeAsBinary({type:e.type===Ce.EVENT?Ce.BINARY_EVENT:Ce.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let n=""+e.type;return(e.type===Ce.BINARY_EVENT||e.type===Ce.BINARY_ACK)&&(n+=e.attachments+"-"),e.nsp&&e.nsp!=="/"&&(n+=e.nsp+","),e.id!=null&&(n+=e.id),e.data!=null&&(n+=JSON.stringify(e.data,this.replacer)),n}encodeAsBinary(e){const n=JV(e),r=this.encodeAsString(n.packet),o=n.buffers;return o.unshift(r),o}}function _x(t){return Object.prototype.toString.call(t)==="[object Object]"}class Jy extends Ot{constructor(e){super(),this.reviver=e}add(e){let n;if(typeof e=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");n=this.decodeString(e);const r=n.type===Ce.BINARY_EVENT;r||n.type===Ce.BINARY_ACK?(n.type=r?Ce.EVENT:Ce.ACK,this.reconstructor=new e4(n),n.attachments===0&&super.emitReserved("decoded",n)):super.emitReserved("decoded",n)}else if(Yy(e)||e.base64)if(this.reconstructor)n=this.reconstructor.takeBinaryData(e),n&&(this.reconstructor=null,super.emitReserved("decoded",n));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+e)}decodeString(e){let n=0;const r={type:Number(e.charAt(0))};if(Ce[r.type]===void 0)throw new Error("unknown packet type "+r.type);if(r.type===Ce.BINARY_EVENT||r.type===Ce.BINARY_ACK){const u=n+1;for(;e.charAt(++n)!=="-"&&n!=e.length;);const c=e.substring(u,n);if(c!=Number(c)||e.charAt(n)!=="-")throw new Error("Illegal attachments");r.attachments=Number(c)}if(e.charAt(n+1)==="/"){const u=n+1;for(;++n&&!(e.charAt(n)===","||n===e.length););r.nsp=e.substring(u,n)}else r.nsp="/";const o=e.charAt(n+1);if(o!==""&&Number(o)==o){const u=n+1;for(;++n;){const c=e.charAt(n);if(c==null||Number(c)!=c){--n;break}if(n===e.length)break}r.id=Number(e.substring(u,n+1))}if(e.charAt(++n)){const u=this.tryParse(e.substr(n));if(Jy.isPayloadValid(r.type,u))r.data=u;else throw new Error("invalid payload")}return r}tryParse(e){try{return JSON.parse(e,this.reviver)}catch{return!1}}static isPayloadValid(e,n){switch(e){case Ce.CONNECT:return _x(n);case Ce.DISCONNECT:return n===void 0;case Ce.CONNECT_ERROR:return typeof n=="string"||_x(n);case Ce.EVENT:case Ce.BINARY_EVENT:return Array.isArray(n)&&(typeof n[0]=="number"||typeof n[0]=="string"&&ZV.indexOf(n[0])===-1);case Ce.ACK:case Ce.BINARY_ACK:return Array.isArray(n)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class e4{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const n=XV(this.reconPack,this.buffers);return this.finishedReconstruction(),n}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const t4=Object.freeze(Object.defineProperty({__proto__:null,Decoder:Jy,Encoder:WV,get PacketType(){return Ce},protocol:QV},Symbol.toStringTag,{value:"Module"}));function Zn(t,e,n){return t.on(e,n),function(){t.off(e,n)}}const n4=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class wO extends Ot{constructor(e,n,r){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=n,r&&r.auth&&(this.auth=r.auth),this._opts=Object.assign({},r),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[Zn(e,"open",this.onopen.bind(this)),Zn(e,"packet",this.onpacket.bind(this)),Zn(e,"error",this.onerror.bind(this)),Zn(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...n){var r,o,u;if(n4.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(n.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(n),this;const c={type:Ce.EVENT,data:n};if(c.options={},c.options.compress=this.flags.compress!==!1,typeof n[n.length-1]=="function"){const y=this.ids++,g=n.pop();this._registerAckCallback(y,g),c.id=y}const f=(o=(r=this.io.engine)===null||r===void 0?void 0:r.transport)===null||o===void 0?void 0:o.writable,h=this.connected&&!(!((u=this.io.engine)===null||u===void 0)&&u._hasPingExpired());return this.flags.volatile&&!f||(h?(this.notifyOutgoingListeners(c),this.packet(c)):this.sendBuffer.push(c)),this.flags={},this}_registerAckCallback(e,n){var r;const o=(r=this.flags.timeout)!==null&&r!==void 0?r:this._opts.ackTimeout;if(o===void 0){this.acks[e]=n;return}const u=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let f=0;f<this.sendBuffer.length;f++)this.sendBuffer[f].id===e&&this.sendBuffer.splice(f,1);n.call(this,new Error("operation has timed out"))},o),c=(...f)=>{this.io.clearTimeoutFn(u),n.apply(this,f)};c.withError=!0,this.acks[e]=c}emitWithAck(e,...n){return new Promise((r,o)=>{const u=(c,f)=>c?o(c):r(f);u.withError=!0,n.push(u),this.emit(e,...n)})}_addToQueue(e){let n;typeof e[e.length-1]=="function"&&(n=e.pop());const r={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((o,...u)=>r!==this._queue[0]?void 0:(o!==null?r.tryCount>this._opts.retries&&(this._queue.shift(),n&&n(o)):(this._queue.shift(),n&&n(null,...u)),r.pending=!1,this._drainQueue())),this._queue.push(r),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;const n=this._queue[0];n.pending&&!e||(n.pending=!0,n.tryCount++,this.flags=n.flags,this.emit.apply(this,n.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:Ce.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,n){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,n),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(r=>String(r.id)===e)){const r=this.acks[e];delete this.acks[e],r.withError&&r.call(this,new Error("socket has been disconnected"))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case Ce.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case Ce.EVENT:case Ce.BINARY_EVENT:this.onevent(e);break;case Ce.ACK:case Ce.BINARY_ACK:this.onack(e);break;case Ce.DISCONNECT:this.ondisconnect();break;case Ce.CONNECT_ERROR:this.destroy();const r=new Error(e.data.message);r.data=e.data.data,this.emitReserved("connect_error",r);break}}onevent(e){const n=e.data||[];e.id!=null&&n.push(this.ack(e.id)),this.connected?this.emitEvent(n):this.receiveBuffer.push(Object.freeze(n))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const n=this._anyListeners.slice();for(const r of n)r.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]=="string"&&(this._lastOffset=e[e.length-1])}ack(e){const n=this;let r=!1;return function(...o){r||(r=!0,n.packet({type:Ce.ACK,id:e,data:o}))}}onack(e){const n=this.acks[e.id];typeof n=="function"&&(delete this.acks[e.id],n.withError&&e.data.unshift(null),n.apply(this,e.data))}onconnect(e,n){this.id=e,this.recovered=n&&this._pid===n,this._pid=n,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Ce.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const n=this._anyListeners;for(let r=0;r<n.length;r++)if(e===n[r])return n.splice(r,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){const n=this._anyOutgoingListeners;for(let r=0;r<n.length;r++)if(e===n[r])return n.splice(r,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const n=this._anyOutgoingListeners.slice();for(const r of n)r.apply(this,e.data)}}}function Xo(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}Xo.prototype.duration=function(){var t=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),n=Math.floor(e*this.jitter*t);t=(Math.floor(e*10)&1)==0?t-n:t+n}return Math.min(t,this.max)|0};Xo.prototype.reset=function(){this.attempts=0};Xo.prototype.setMin=function(t){this.ms=t};Xo.prototype.setMax=function(t){this.max=t};Xo.prototype.setJitter=function(t){this.jitter=t};class Rm extends Ot{constructor(e,n){var r;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(n=e,e=void 0),n=n||{},n.path=n.path||"/socket.io",this.opts=n,$f(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 Xo({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=e;const o=n.parser||t4;this.encoder=new o.Encoder,this.decoder=new o.Decoder,this._autoConnect=n.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var n;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(n=this.backoff)===null||n===void 0||n.setMin(e),this)}randomizationFactor(e){var n;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(n=this.backoff)===null||n===void 0||n.setJitter(e),this)}reconnectionDelayMax(e){var n;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(n=this.backoff)===null||n===void 0||n.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new PV(this.uri,this.opts);const n=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const o=Zn(n,"open",function(){r.onopen(),e&&e()}),u=f=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",f),e?e(f):this.maybeReconnectOnOpen()},c=Zn(n,"error",u);if(this._timeout!==!1){const f=this._timeout,h=this.setTimeoutFn(()=>{o(),u(new Error("timeout")),n.close()},f);this.opts.autoUnref&&h.unref(),this.subs.push(()=>{this.clearTimeoutFn(h)})}return this.subs.push(o),this.subs.push(c),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(Zn(e,"ping",this.onping.bind(this)),Zn(e,"data",this.ondata.bind(this)),Zn(e,"error",this.onerror.bind(this)),Zn(e,"close",this.onclose.bind(this)),Zn(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(n){this.onclose("parse error",n)}}ondecoded(e){Nf(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,n){let r=this.nsps[e];return r?this._autoConnect&&!r.active&&r.connect():(r=new wO(this,e,n),this.nsps[e]=r),r}_destroy(e){const n=Object.keys(this.nsps);for(const r of n)if(this.nsps[r].active)return;this._close()}_packet(e){const n=this.encoder.encode(e);for(let r=0;r<n.length;r++)this.engine.write(n[r],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(e,n){var r;this.cleanup(),(r=this.engine)===null||r===void 0||r.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,n),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const n=this.backoff.duration();this._reconnecting=!0;const r=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(o=>{o?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",o)):e.onreconnect()}))},n);this.opts.autoUnref&&r.unref(),this.subs.push(()=>{this.clearTimeoutFn(r)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const Ya={};function Rc(t,e){typeof t=="object"&&(e=t,t=void 0),e=e||{};const n=IV(t,e.path||"/socket.io"),r=n.source,o=n.id,u=n.path,c=Ya[o]&&u in Ya[o].nsps,f=e.forceNew||e["force new connection"]||e.multiplex===!1||c;let h;return f?h=new Rm(r,e):(Ya[o]||(Ya[o]=new Rm(r,e)),h=Ya[o]),n.query&&!e.query&&(e.query=n.queryKey),h.socket(n.path,e)}Object.assign(Rc,{Manager:Rm,Socket:wO,io:Rc,connect:Rc});const i4=["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"],r4=3,s4=15,o4=/^[a-zA-Z0-9_-]+$/,a4=Et(o4).pipe(Et(`string > ${r4} & string < ${s4}`)).brand("username"),Rx=20,kx={0:"o",1:"l",3:"e",4:"a",5:"s",7:"t","@":"a",$:"s","!":"i"};function l4(t){let e="";for(const n of t)n in kx?e+=kx[n]:e+=n;return e}function u4(t){const e=t.toLocaleLowerCase(),n=l4(e);for(const r of i4)if(n.includes(r)||e.includes(r))return!0;return!1}function c4(t){const e=new Set(t).size;return t.length*Math.log2(e)}function f4(t){let e=0;return u4(t)&&(e-=100),e+=c4(t)*.5,Math.max(e,0)}const d4=Et("string").narrow((t,e)=>{const n=f4(t);return n>=Rx?!0:e.mustBe(`Of complexity ${Rx} or more. Was ${n.toFixed(2)}.`)}).brand("password");Et({"+":"delete",email:"string",password:"string"});const h4=Et("string").brand("email");Et({"+":"delete",username:"string",password:"string",email:"string"});const p4=Et({email:"string",userId:"string",username:"string",password:"boolean",verification:"'unverified' | 'verified'"}),gi=Rc(lO.VITE_BACKEND_ORIGIN,{auth:t=>{const e=nt(ut);e&&t(e)},withCredentials:!0,autoConnect:!1});gi.on("connect",()=>{console.log("connected")}).on("connect_error",()=>{console.log("connect_error"),De(ut,null)}).on("usernameChanged",t=>{De(ut,e=>e===null?null:{...e,username:t})});const ut=ft({key:"auth",default:function(){const e=localStorage.getItem("auth");if(e)try{const n=qr(e),r=p4(n);return r instanceof Et.errors?(console.error("failed to parse auth data",r),null):(r.verification==="verified"&&(console.log("connecting..."),gi.connect()),r)}catch(n){return console.error("failed to parse auth data",n),null}return null},effects:[function({onSet:e}){e(({newValue:n})=>{console.log("setting auth",n),n?(console.log("setting auth",n),De(jo,n.username),localStorage.setItem("auth",zt(n)),n.verification==="verified"?(console.log("connecting..."),gi.connect()):_s("/verify")):(console.log("clearing session..."),localStorage.removeItem("auth"))})}]}),jo=ft({key:"username",default:nt(ut)?.username??""}),_p=ft({key:"usernameDebounce",default:!0}),m4=ft({key:"usernameDebounced100ms",default:window.localStorage.getItem("username")??"",effects:[({setSelf:t})=>{zC(jo,()=>{nt(_p)&&(t(nt(jo)),De(_p,!1),setTimeout(()=>{De(_p,!0),t(nt(jo))},2e3))})}]}),y4=vi({key:"isUsernameTakenQuery",get:({get:t})=>{const e=t(m4);if(!e)return!1;const n=nt(ut);return e===n?.username?!1:cn.isUsernameTaken.query({username:e})}}),xO=vi({key:"usernameIssues",get:({get:t})=>{const e=t(jo),n=a4(e);return n instanceof Et.errors?n:null}}),fi=ft({key:"password0",default:""}),TO=vi({key:"password0Issues",get:({get:t})=>{const e=t(fi),n=d4(e);return n instanceof Et.errors?n:null}}),Po=ft({key:"email",default:""}),AO=vi({key:"emailIssues",get:({get:t})=>{const e=t(Po),n=h4(e);return n instanceof Et.errors?n:null}});vi({key:"signupReady",get:({get:t})=>{const e=t(xO),n=t(TO),r=t(AO);return!(e??n??r)}});const Gi=ft({key:"oneTimeCode",default:""}),km=ft({key:"oneTimeCodeNewEmail",default:""}),li=ft({key:"authTarget",default:null}),EO=Tp({verify:Tp({$token:null}),game:Tp({clicker:null}),account:null,admin:null});function g4(t){return uV(EO,t)}const v4=[[]];function b4(t){return v4.some(e=>e.join("/")===t.join("/"))}function _s(t){history.pushState(null,"",t),De(OO,t)}const OO=ft({key:"pathName",default:window.location.pathname,effects:[({onSet:t,setSelf:e})=>{const n=o=>{history.replaceState(null,"",o),e(o)},r=o=>{switch(o){case"/":{const u=nt(ut);switch(console.log("/","auth",u),u?.verification){case"verified":n("/game");break;case"unverified":n("/verify");break}break}case"/verify":{nt(ut)?.verification==="verified"&&n("/game");break}case"/game":case"/game/clicker":{nt(ut)?.verification==="unverified"&&n("/verify");break}case"/admin":break;case"/account":{const u=nt(ut);if(!u){n("/");break}u.verification==="unverified"&&n("/verify");break}}};r(window.location.pathname),t(({newValue:o})=>{r(o)})},({setSelf:t})=>{document.addEventListener("click",e=>{const n=e.target.closest("a");if(n&&n instanceof HTMLAnchorElement){const r=n.getAttribute("href");r?.startsWith("/")&&(e.preventDefault(),history.pushState(null,"",r),t(r))}}),window.addEventListener("popstate",()=>{t(window.location.pathname)})}]}),S4=vi({key:"route",get:({get:t})=>{const n=t(OO).split("/").slice(1).filter(Boolean);return g4(n)?b4(n)||t(ut)?n:401:404}}),Cx=ft({key:"buttonBlockActive",default:!1}),Bn=ft({key:"editing",default:[],effects:[({onSet:t})=>{t(({newValue:e})=>{switch(e[0]){case"email":{nt(_O)?.focus();break}case"new-password":{nt(RO)?.focus();break}case"username":{nt(kO)?.focus();break}}})}]}),_O=ft({key:"emailInputElement",default:null}),RO=ft({key:"password0InputElement",default:null}),kO=ft({key:"usernameInputElement",default:null});function w4(t){const e=N.useRef(null);return N.useEffect(()=>{De(t,e.current)},[t]),e}const x4=vi({key:"otcLoginFieldLabel",get:({get:t})=>{const e=t(ut);return e?`Code sent to ${e.email}`:""}}),T4=vi({key:"otcVerifyFieldLabel",get:({get:t})=>{const e=t(Po);return e?`Code sent to ${e}`:""}});function Rp({label:t,inputToken:e,issuesToken:n,inputElementToken:r,initialState:o,onSubmit:u,onOpen:c,onCancel:f,extraIssues:h}){const m=At(e),y=Qn(e),g=At(Gi),b=Qn(Gi),S=At(km),x=Qn(km),T=At(fi),_=Qn(fi),k=At(Cx),C=Qn(Cx),M=At(Bn),G=Qn(Bn),I=At(n),ee=At(x4),J=At(T4),X=w4(r),he=M[0]===t,pe=M.at(-1),[we,...je]=M;return F.jsxs("form",{onSubmit:async be=>{if(be.preventDefault(),k){C(!1);return}console.log(`submitted! changing ${t} to`,m);const Z=await u(m);Error.isError(Z)&&console.error(Z)},children:[he?F.jsx("button",{type:"button",onClick:async()=>{await f?.(),G([])},children:"x"}):null,F.jsxs("main",{children:[F.jsxs("label",{htmlFor:t,children:[I||h?F.jsxs("aside",{children:[h,I?.map(be=>F.jsx("span",{children:be.message},be.path.join(".")))]}):null,F.jsx("span",{children:t==="new-password"?"Password":hs(t)}),F.jsx("input",{id:t,type:t==="new-password"?"password":"text",ref:X,value:m,onChange:be=>{y(be.target.value)},autoComplete:t,autoCapitalize:"none",disabled:pe!==t})]}),he?je.map(be=>F.jsxs("label",{htmlFor:`${t}-${be}`,children:[F.jsx("span",{children:(()=>{switch(be){case"otcLogin":return ee;case"otcVerify":return J;case"passwordLogin":return"Password"}})()}),F.jsx("input",{id:`${t}-otc`,type:"text",ref:X,value:(()=>{switch(be){case"otcLogin":return g;case"otcVerify":return t==="email"?S:g;case"passwordLogin":return T}})(),onChange:Z=>{switch(be){case"otcLogin":b(Z.target.value);break;case"otcVerify":if(t==="email"){x(Z.target.value);break}b(Z.target.value);break;case"passwordLogin":_(Z.target.value)}},autoComplete:t.includes("otc")?"one-time-code":t.includes("password")?"password":"",autoCapitalize:"none",disabled:be!==pe})]},`${t}-${be}`)):null]}),M[0]===t?F.jsx("button",{type:"submit",children:"->"}):F.jsx("button",{type:"button",onMouseDown:async()=>{C(!0),await c?.(),G(o)},onMouseUp:()=>{C(!1)},children:"/"})]})}function A4(){const t=At(ut),e=At(y4);return N.useEffect(()=>{t&&De(Po,t.email),t?.password&&De(fi,"••••••••••••")},[]),t?F.jsxs("article",{"data-css":"editor",children:[F.jsx(Rp,{label:"username",inputToken:jo,issuesToken:xO,inputElementToken:kO,initialState:["username"],onSubmit:async n=>(await new Promise(r=>{gi.once("usernameChanged",r),gi.emit("changeUsername",n)}),De(Bn,[]),n),extraIssues:e?F.jsx("span",{children:"This username is taken."}):null}),F.jsx(Rp,{label:"email",inputToken:Po,issuesToken:AO,inputElementToken:_O,initialState:["email"],onSubmit:async n=>{const r=nt(Bn);if(r[0]!=="email")return new Error("field not email");switch(r.length){case 1:{const{userKey:o,nextStep:u}=await cn.offerNewEmail.mutate({emailOffered:n});switch(console.log({authTarget:o,nextStep:u}),u){case"otc_login":{De(li,o),De(Bn,["email","otcLogin"]);break}case"password_login":{De(li,o),De(Bn,["email","passwordLogin"]);break}case"otc_verify":{De(li,o),De(Gi,"not needed"),De(Bn,["email","otcLogin","otcVerify"]);break}}return o}case 2:switch(console.log("case 2"),r[1]){case"otcLogin":{console.log("case 2.1");const o=nt(li);if(!o)return new Error("No auth target");const u=nt(Gi),c=await cn.verifyAccountAction.mutate({oneTimeCode:u,userKey:o});return De(ut,c),De(Bn,["email","otcLogin","otcVerify"]),o}case"passwordLogin":return new Error("not implemented")}break;case 3:{const o=nt(li);if(!o)return new Error("No auth target");const u=nt(km),c=await cn.verifyAccountAction.mutate({oneTimeCode:u,userKey:o});return De(ut,c),De(Bn,[]),c.email}}}}),F.jsx(Rp,{label:"new-password",inputToken:fi,issuesToken:TO,inputElementToken:RO,initialState:t.password?["new-password","otcVerify"]:["new-password"],onSubmit:async n=>{const r=nt(Bn);if(r[0]!=="new-password")return new Error("field not new-password");switch(r.length){case 1:return await cn.setPassword.mutate({password:n}),De(fi,"••••••••••••"),De(ut,o=>o&&{...o,password:!0}),De(Bn,[]),"done";case 2:{const o=nt(li);return o?(await cn.verifyAccountAction.mutate({oneTimeCode:nt(Gi),userKey:o}),De(ut,u=>u&&{...u,password:!1}),De(fi,""),De(Bn,["new-password"]),"done"):new Error("No userKey")}}},onCancel:()=>{t.password&&De(fi,"••••••••••••")},onOpen:async()=>{if(t.password){const n=nt(li);if(!n)return new Error("No userKey");await cn.startPasswordReset.mutate({userKey:n})}}})]}):F.jsx("p",{children:"You must be logged in to verify your account."})}function E4(){return F.jsx("article",{children:F.jsx("h1",{children:"admin"})})}const Xy=ft({key:"count",default:0}),CO=LC({key:"incrementTX",do:({set:t})=>{t(Xy,e=>e+1)}}),O4=kM({key:"countContinuity",config:t=>t.add(Xy).add(CO)});function _4({route:[,t]}){return F.jsx("article",{children:t?F.jsx(k4,{gameId:t}):F.jsx(R4,{})})}function R4(){return F.jsx("nav",{children:F.jsx(FE,{href:"/game/clicker",children:"Clicker"})})}UC(EO[1].game[1]);function k4({gameId:t}){console.log(t);const e=At(Xy),n=VC(CO);return KM(O4),F.jsxs("article",{children:[F.jsxs("button",{type:"button",onClick:()=>{n()},children:["count is ",e]}),F.jsx("p",{children:"Let's see how high we can count!"})]})}const MO=N.createContext({});function C4(t){const e=N.useRef(null);return e.current===null&&(e.current=t()),e.current}const Zy=typeof window<"u",M4=Zy?N.useLayoutEffect:N.useEffect,Qy=N.createContext(null);function Wy(t,e){t.indexOf(e)===-1&&t.push(e)}function eg(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}const Wi=(t,e,n)=>n>e?e:n<t?t:n;let tg=()=>{};const er={},DO=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t);function NO(t){return typeof t=="object"&&t!==null}const $O=t=>/^0[^.\s]+$/u.test(t);function ng(t){let e;return()=>(e===void 0&&(e=t()),e)}const Kn=t=>t,D4=(t,e)=>n=>e(t(n)),jl=(...t)=>t.reduce(D4),vl=(t,e,n)=>{const r=e-t;return r===0?1:(n-t)/r};class ig{constructor(){this.subscriptions=[]}add(e){return Wy(this.subscriptions,e),()=>eg(this.subscriptions,e)}notify(e,n,r){const o=this.subscriptions.length;if(o)if(o===1)this.subscriptions[0](e,n,r);else for(let u=0;u<o;u++){const c=this.subscriptions[u];c&&c(e,n,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const pi=t=>t*1e3,Un=t=>t/1e3;function jO(t,e){return e?t*(1e3/e):0}const BO=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t,N4=1e-7,$4=12;function j4(t,e,n,r,o){let u,c,f=0;do c=e+(n-e)/2,u=BO(c,r,o)-t,u>0?n=c:e=c;while(Math.abs(u)>N4&&++f<$4);return c}function Bl(t,e,n,r){if(t===e&&n===r)return Kn;const o=u=>j4(u,0,1,t,n);return u=>u===0||u===1?u:BO(o(u),e,r)}const zO=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,LO=t=>e=>1-t(1-e),VO=Bl(.33,1.53,.69,.99),rg=LO(VO),UO=zO(rg),KO=t=>(t*=2)<1?.5*rg(t):.5*(2-Math.pow(2,-10*(t-1))),sg=t=>1-Math.sin(Math.acos(t)),qO=LO(sg),PO=zO(sg),B4=Bl(.42,0,1,1),z4=Bl(0,0,.58,1),IO=Bl(.42,0,.58,1),L4=t=>Array.isArray(t)&&typeof t[0]!="number",HO=t=>Array.isArray(t)&&typeof t[0]=="number",V4={linear:Kn,easeIn:B4,easeInOut:IO,easeOut:z4,circIn:sg,circInOut:PO,circOut:qO,backIn:rg,backInOut:UO,backOut:VO,anticipate:KO},U4=t=>typeof t=="string",Mx=t=>{if(HO(t)){tg(t.length===4);const[e,n,r,o]=t;return Bl(e,n,r,o)}else if(U4(t))return V4[t];return t},mc=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function K4(t,e){let n=new Set,r=new Set,o=!1,u=!1;const c=new WeakSet;let f={delta:0,timestamp:0,isProcessing:!1};function h(y){c.has(y)&&(m.schedule(y),t()),y(f)}const m={schedule:(y,g=!1,b=!1)=>{const x=b&&o?n:r;return g&&c.add(y),x.has(y)||x.add(y),y},cancel:y=>{r.delete(y),c.delete(y)},process:y=>{if(f=y,o){u=!0;return}o=!0,[n,r]=[r,n],n.forEach(h),n.clear(),o=!1,u&&(u=!1,m.process(y))}};return m}const q4=40;function FO(t,e){let n=!1,r=!0;const o={delta:0,timestamp:0,isProcessing:!1},u=()=>n=!0,c=mc.reduce((M,G)=>(M[G]=K4(u),M),{}),{setup:f,read:h,resolveKeyframes:m,preUpdate:y,update:g,preRender:b,render:S,postRender:x}=c,T=()=>{const M=er.useManualTiming?o.timestamp:performance.now();n=!1,er.useManualTiming||(o.delta=r?1e3/60:Math.max(Math.min(M-o.timestamp,q4),1)),o.timestamp=M,o.isProcessing=!0,f.process(o),h.process(o),m.process(o),y.process(o),g.process(o),b.process(o),S.process(o),x.process(o),o.isProcessing=!1,n&&e&&(r=!1,t(T))},_=()=>{n=!0,r=!0,o.isProcessing||t(T)};return{schedule:mc.reduce((M,G)=>{const I=c[G];return M[G]=(ee,J=!1,X=!1)=>(n||_(),I.schedule(ee,J,X)),M},{}),cancel:M=>{for(let G=0;G<mc.length;G++)c[mc[G]].cancel(M)},state:o,steps:c}}const{schedule:it,cancel:Vr,state:Ht,steps:kp}=FO(typeof requestAnimationFrame<"u"?requestAnimationFrame:Kn,!0);let kc;function P4(){kc=void 0}const fn={now:()=>(kc===void 0&&fn.set(Ht.isProcessing||er.useManualTiming?Ht.timestamp:performance.now()),kc),set:t=>{kc=t,queueMicrotask(P4)}},GO=t=>e=>typeof e=="string"&&e.startsWith(t),YO=GO("--"),I4=GO("var(--"),og=t=>I4(t)?H4.test(t.split("/*")[0].trim()):!1,H4=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,Zo={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},bl={...Zo,transform:t=>Wi(0,1,t)},yc={...Zo,default:1},rl=t=>Math.round(t*1e5)/1e5,ag=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function F4(t){return t==null}const G4=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,lg=(t,e)=>n=>!!(typeof n=="string"&&G4.test(n)&&n.startsWith(t)||e&&!F4(n)&&Object.prototype.hasOwnProperty.call(n,e)),JO=(t,e,n)=>r=>{if(typeof r!="string")return r;const[o,u,c,f]=r.match(ag);return{[t]:parseFloat(o),[e]:parseFloat(u),[n]:parseFloat(c),alpha:f!==void 0?parseFloat(f):1}},Y4=t=>Wi(0,255,t),Cp={...Zo,transform:t=>Math.round(Y4(t))},gs={test:lg("rgb","red"),parse:JO("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:r=1})=>"rgba("+Cp.transform(t)+", "+Cp.transform(e)+", "+Cp.transform(n)+", "+rl(bl.transform(r))+")"};function J4(t){let e="",n="",r="",o="";return t.length>5?(e=t.substring(1,3),n=t.substring(3,5),r=t.substring(5,7),o=t.substring(7,9)):(e=t.substring(1,2),n=t.substring(2,3),r=t.substring(3,4),o=t.substring(4,5),e+=e,n+=n,r+=r,o+=o),{red:parseInt(e,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:o?parseInt(o,16)/255:1}}const Cm={test:lg("#"),parse:J4,transform:gs.transform},zl=t=>({test:e=>typeof e=="string"&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),Rr=zl("deg"),mi=zl("%"),de=zl("px"),X4=zl("vh"),Z4=zl("vw"),Dx={...mi,parse:t=>mi.parse(t)/100,transform:t=>mi.transform(t*100)},Ao={test:lg("hsl","hue"),parse:JO("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:r=1})=>"hsla("+Math.round(t)+", "+mi.transform(rl(e))+", "+mi.transform(rl(n))+", "+rl(bl.transform(r))+")"},Tt={test:t=>gs.test(t)||Cm.test(t)||Ao.test(t),parse:t=>gs.test(t)?gs.parse(t):Ao.test(t)?Ao.parse(t):Cm.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?gs.transform(t):Ao.transform(t),getAnimatableNone:t=>{const e=Tt.parse(t);return e.alpha=0,Tt.transform(e)}},Q4=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function W4(t){return isNaN(t)&&typeof t=="string"&&(t.match(ag)?.length||0)+(t.match(Q4)?.length||0)>0}const XO="number",ZO="color",eU="var",tU="var(",Nx="${}",nU=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Sl(t){const e=t.toString(),n=[],r={color:[],number:[],var:[]},o=[];let u=0;const f=e.replace(nU,h=>(Tt.test(h)?(r.color.push(u),o.push(ZO),n.push(Tt.parse(h))):h.startsWith(tU)?(r.var.push(u),o.push(eU),n.push(h)):(r.number.push(u),o.push(XO),n.push(parseFloat(h))),++u,Nx)).split(Nx);return{values:n,split:f,indexes:r,types:o}}function QO(t){return Sl(t).values}function WO(t){const{split:e,types:n}=Sl(t),r=e.length;return o=>{let u="";for(let c=0;c<r;c++)if(u+=e[c],o[c]!==void 0){const f=n[c];f===XO?u+=rl(o[c]):f===ZO?u+=Tt.transform(o[c]):u+=o[c]}return u}}const iU=t=>typeof t=="number"?0:Tt.test(t)?Tt.getAnimatableNone(t):t;function rU(t){const e=QO(t);return WO(t)(e.map(iU))}const Ur={test:W4,parse:QO,createTransformer:WO,getAnimatableNone:rU};function Mp(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+(e-t)*6*n:n<1/2?e:n<2/3?t+(e-t)*(2/3-n)*6:t}function sU({hue:t,saturation:e,lightness:n,alpha:r}){t/=360,e/=100,n/=100;let o=0,u=0,c=0;if(!e)o=u=c=n;else{const f=n<.5?n*(1+e):n+e-n*e,h=2*n-f;o=Mp(h,f,t+1/3),u=Mp(h,f,t),c=Mp(h,f,t-1/3)}return{red:Math.round(o*255),green:Math.round(u*255),blue:Math.round(c*255),alpha:r}}function Wc(t,e){return n=>n>0?e:t}const rt=(t,e,n)=>t+(e-t)*n,Dp=(t,e,n)=>{const r=t*t,o=n*(e*e-r)+r;return o<0?0:Math.sqrt(o)},oU=[Cm,gs,Ao],aU=t=>oU.find(e=>e.test(t));function $x(t){const e=aU(t);if(!e)return!1;let n=e.parse(t);return e===Ao&&(n=sU(n)),n}const jx=(t,e)=>{const n=$x(t),r=$x(e);if(!n||!r)return Wc(t,e);const o={...n};return u=>(o.red=Dp(n.red,r.red,u),o.green=Dp(n.green,r.green,u),o.blue=Dp(n.blue,r.blue,u),o.alpha=rt(n.alpha,r.alpha,u),gs.transform(o))},Mm=new Set(["none","hidden"]);function lU(t,e){return Mm.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}function uU(t,e){return n=>rt(t,e,n)}function ug(t){return typeof t=="number"?uU:typeof t=="string"?og(t)?Wc:Tt.test(t)?jx:dU:Array.isArray(t)?e_:typeof t=="object"?Tt.test(t)?jx:cU:Wc}function e_(t,e){const n=[...t],r=n.length,o=t.map((u,c)=>ug(u)(u,e[c]));return u=>{for(let c=0;c<r;c++)n[c]=o[c](u);return n}}function cU(t,e){const n={...t,...e},r={};for(const o in n)t[o]!==void 0&&e[o]!==void 0&&(r[o]=ug(t[o])(t[o],e[o]));return o=>{for(const u in r)n[u]=r[u](o);return n}}function fU(t,e){const n=[],r={color:0,var:0,number:0};for(let o=0;o<e.values.length;o++){const u=e.types[o],c=t.indexes[u][r[u]],f=t.values[c]??0;n[o]=f,r[u]++}return n}const dU=(t,e)=>{const n=Ur.createTransformer(e),r=Sl(t),o=Sl(e);return r.indexes.var.length===o.indexes.var.length&&r.indexes.color.length===o.indexes.color.length&&r.indexes.number.length>=o.indexes.number.length?Mm.has(t)&&!o.values.length||Mm.has(e)&&!r.values.length?lU(t,e):jl(e_(fU(r,o),o.values),n):Wc(t,e)};function t_(t,e,n){return typeof t=="number"&&typeof e=="number"&&typeof n=="number"?rt(t,e,n):ug(t)(t,e)}const hU=t=>{const e=({timestamp:n})=>t(n);return{start:(n=!0)=>it.update(e,n),stop:()=>Vr(e),now:()=>Ht.isProcessing?Ht.timestamp:fn.now()}},n_=(t,e,n=10)=>{let r="";const o=Math.max(Math.round(e/n),2);for(let u=0;u<o;u++)r+=Math.round(t(u/(o-1))*1e4)/1e4+", ";return`linear(${r.substring(0,r.length-2)})`},ef=2e4;function cg(t){let e=0;const n=50;let r=t.next(e);for(;!r.done&&e<ef;)e+=n,r=t.next(e);return e>=ef?1/0:e}function pU(t,e=100,n){const r=n({...t,keyframes:[0,e]}),o=Math.min(cg(r),ef);return{type:"keyframes",ease:u=>r.next(o*u).value/e,duration:Un(o)}}const mU=5;function i_(t,e,n){const r=Math.max(e-mU,0);return jO(n-t(r),e-r)}const lt={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},Np=.001;function yU({duration:t=lt.duration,bounce:e=lt.bounce,velocity:n=lt.velocity,mass:r=lt.mass}){let o,u,c=1-e;c=Wi(lt.minDamping,lt.maxDamping,c),t=Wi(lt.minDuration,lt.maxDuration,Un(t)),c<1?(o=m=>{const y=m*c,g=y*t,b=y-n,S=Dm(m,c),x=Math.exp(-g);return Np-b/S*x},u=m=>{const g=m*c*t,b=g*n+n,S=Math.pow(c,2)*Math.pow(m,2)*t,x=Math.exp(-g),T=Dm(Math.pow(m,2),c);return(-o(m)+Np>0?-1:1)*((b-S)*x)/T}):(o=m=>{const y=Math.exp(-m*t),g=(m-n)*t+1;return-Np+y*g},u=m=>{const y=Math.exp(-m*t),g=(n-m)*(t*t);return y*g});const f=5/t,h=vU(o,u,f);if(t=pi(t),isNaN(h))return{stiffness:lt.stiffness,damping:lt.damping,duration:t};{const m=Math.pow(h,2)*r;return{stiffness:m,damping:c*2*Math.sqrt(r*m),duration:t}}}const gU=12;function vU(t,e,n){let r=n;for(let o=1;o<gU;o++)r=r-t(r)/e(r);return r}function Dm(t,e){return t*Math.sqrt(1-e*e)}const bU=["duration","bounce"],SU=["stiffness","damping","mass"];function Bx(t,e){return e.some(n=>t[n]!==void 0)}function wU(t){let e={velocity:lt.velocity,stiffness:lt.stiffness,damping:lt.damping,mass:lt.mass,isResolvedFromDuration:!1,...t};if(!Bx(t,SU)&&Bx(t,bU))if(t.visualDuration){const n=t.visualDuration,r=2*Math.PI/(n*1.2),o=r*r,u=2*Wi(.05,1,1-(t.bounce||0))*Math.sqrt(o);e={...e,mass:lt.mass,stiffness:o,damping:u}}else{const n=yU(t);e={...e,...n,mass:lt.mass},e.isResolvedFromDuration=!0}return e}function tf(t=lt.visualDuration,e=lt.bounce){const n=typeof t!="object"?{visualDuration:t,keyframes:[0,1],bounce:e}:t;let{restSpeed:r,restDelta:o}=n;const u=n.keyframes[0],c=n.keyframes[n.keyframes.length-1],f={done:!1,value:u},{stiffness:h,damping:m,mass:y,duration:g,velocity:b,isResolvedFromDuration:S}=wU({...n,velocity:-Un(n.velocity||0)}),x=b||0,T=m/(2*Math.sqrt(h*y)),_=c-u,k=Un(Math.sqrt(h/y)),C=Math.abs(_)<5;r||(r=C?lt.restSpeed.granular:lt.restSpeed.default),o||(o=C?lt.restDelta.granular:lt.restDelta.default);let M;if(T<1){const I=Dm(k,T);M=ee=>{const J=Math.exp(-T*k*ee);return c-J*((x+T*k*_)/I*Math.sin(I*ee)+_*Math.cos(I*ee))}}else if(T===1)M=I=>c-Math.exp(-k*I)*(_+(x+k*_)*I);else{const I=k*Math.sqrt(T*T-1);M=ee=>{const J=Math.exp(-T*k*ee),X=Math.min(I*ee,300);return c-J*((x+T*k*_)*Math.sinh(X)+I*_*Math.cosh(X))/I}}const G={calculatedDuration:S&&g||null,next:I=>{const ee=M(I);if(S)f.done=I>=g;else{let J=I===0?x:0;T<1&&(J=I===0?pi(x):i_(M,I,ee));const X=Math.abs(J)<=r,he=Math.abs(c-ee)<=o;f.done=X&&he}return f.value=f.done?c:ee,f},toString:()=>{const I=Math.min(cg(G),ef),ee=n_(J=>G.next(I*J).value,I,30);return I+"ms "+ee},toTransition:()=>{}};return G}tf.applyToOptions=t=>{const e=pU(t,100,tf);return t.ease=e.ease,t.duration=pi(e.duration),t.type="keyframes",t};function Nm({keyframes:t,velocity:e=0,power:n=.8,timeConstant:r=325,bounceDamping:o=10,bounceStiffness:u=500,modifyTarget:c,min:f,max:h,restDelta:m=.5,restSpeed:y}){const g=t[0],b={done:!1,value:g},S=X=>f!==void 0&&X<f||h!==void 0&&X>h,x=X=>f===void 0?h:h===void 0||Math.abs(f-X)<Math.abs(h-X)?f:h;let T=n*e;const _=g+T,k=c===void 0?_:c(_);k!==_&&(T=k-g);const C=X=>-T*Math.exp(-X/r),M=X=>k+C(X),G=X=>{const he=C(X),pe=M(X);b.done=Math.abs(he)<=m,b.value=b.done?k:pe};let I,ee;const J=X=>{S(b.value)&&(I=X,ee=tf({keyframes:[b.value,x(b.value)],velocity:i_(M,X,b.value),damping:o,stiffness:u,restDelta:m,restSpeed:y}))};return J(0),{calculatedDuration:null,next:X=>{let he=!1;return!ee&&I===void 0&&(he=!0,G(X),J(X)),I!==void 0&&X>=I?ee.next(X-I):(!he&&G(X),b)}}}function xU(t,e,n){const r=[],o=n||er.mix||t_,u=t.length-1;for(let c=0;c<u;c++){let f=o(t[c],t[c+1]);if(e){const h=Array.isArray(e)?e[c]||Kn:e;f=jl(h,f)}r.push(f)}return r}function TU(t,e,{clamp:n=!0,ease:r,mixer:o}={}){const u=t.length;if(tg(u===e.length),u===1)return()=>e[0];if(u===2&&e[0]===e[1])return()=>e[1];const c=t[0]===t[1];t[0]>t[u-1]&&(t=[...t].reverse(),e=[...e].reverse());const f=xU(e,r,o),h=f.length,m=y=>{if(c&&y<t[0])return e[0];let g=0;if(h>1)for(;g<t.length-2&&!(y<t[g+1]);g++);const b=vl(t[g],t[g+1],y);return f[g](b)};return n?y=>m(Wi(t[0],t[u-1],y)):m}function AU(t,e){const n=t[t.length-1];for(let r=1;r<=e;r++){const o=vl(0,e,r);t.push(rt(n,1,o))}}function EU(t){const e=[0];return AU(e,t.length-1),e}function OU(t,e){return t.map(n=>n*e)}function _U(t,e){return t.map(()=>e||IO).splice(0,t.length-1)}function sl({duration:t=300,keyframes:e,times:n,ease:r="easeInOut"}){const o=L4(r)?r.map(Mx):Mx(r),u={done:!1,value:e[0]},c=OU(n&&n.length===e.length?n:EU(e),t),f=TU(c,e,{ease:Array.isArray(o)?o:_U(e,o)});return{calculatedDuration:t,next:h=>(u.value=f(h),u.done=h>=t,u)}}const RU=t=>t!==null;function fg(t,{repeat:e,repeatType:n="loop"},r,o=1){const u=t.filter(RU),f=o<0||e&&n!=="loop"&&e%2===1?0:u.length-1;return!f||r===void 0?u[f]:r}const kU={decay:Nm,inertia:Nm,tween:sl,keyframes:sl,spring:tf};function r_(t){typeof t.type=="string"&&(t.type=kU[t.type])}class dg{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,n){return this.finished.then(e,n)}}const CU=t=>t/100;class hg extends dg{constructor(e){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{const{motionValue:n}=this.options;n&&n.updatedAt!==fn.now()&&this.tick(fn.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),this.options.onStop?.())},this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){const{options:e}=this;r_(e);const{type:n=sl,repeat:r=0,repeatDelay:o=0,repeatType:u,velocity:c=0}=e;let{keyframes:f}=e;const h=n||sl;h!==sl&&typeof f[0]!="number"&&(this.mixKeyframes=jl(CU,t_(f[0],f[1])),f=[0,100]);const m=h({...e,keyframes:f});u==="mirror"&&(this.mirroredGenerator=h({...e,keyframes:[...f].reverse(),velocity:-c})),m.calculatedDuration===null&&(m.calculatedDuration=cg(m));const{calculatedDuration:y}=m;this.calculatedDuration=y,this.resolvedDuration=y+o,this.totalDuration=this.resolvedDuration*(r+1)-o,this.generator=m}updateTime(e){const n=Math.round(e-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=n}tick(e,n=!1){const{generator:r,totalDuration:o,mixKeyframes:u,mirroredGenerator:c,resolvedDuration:f,calculatedDuration:h}=this;if(this.startTime===null)return r.next(0);const{delay:m=0,keyframes:y,repeat:g,repeatType:b,repeatDelay:S,type:x,onUpdate:T,finalKeyframe:_}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-o/this.speed,this.startTime)),n?this.currentTime=e:this.updateTime(e);const k=this.currentTime-m*(this.playbackSpeed>=0?1:-1),C=this.playbackSpeed>=0?k<0:k>o;this.currentTime=Math.max(k,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=o);let M=this.currentTime,G=r;if(g){const X=Math.min(this.currentTime,o)/f;let he=Math.floor(X),pe=X%1;!pe&&X>=1&&(pe=1),pe===1&&he--,he=Math.min(he,g+1),he%2&&(b==="reverse"?(pe=1-pe,S&&(pe-=S/f)):b==="mirror"&&(G=c)),M=Wi(0,1,pe)*f}const I=C?{done:!1,value:y[0]}:G.next(M);u&&(I.value=u(I.value));let{done:ee}=I;!C&&h!==null&&(ee=this.playbackSpeed>=0?this.currentTime>=o:this.currentTime<=0);const J=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&ee);return J&&x!==Nm&&(I.value=fg(y,this.options,_,this.speed)),T&&T(I.value),J&&this.finish(),I}then(e,n){return this.finished.then(e,n)}get duration(){return Un(this.calculatedDuration)}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+Un(e)}get time(){return Un(this.currentTime)}set time(e){e=pi(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?.start(!1)}get speed(){return this.playbackSpeed}set speed(e){this.updateTime(fn.now());const n=this.playbackSpeed!==e;this.playbackSpeed=e,n&&(this.time=Un(this.currentTime))}play(){if(this.isStopped)return;const{driver:e=hU,startTime:n}=this.options;this.driver||(this.driver=e(o=>this.tick(o))),this.options.onPlay?.();const r=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=r):this.holdTime!==null?this.startTime=r-this.holdTime:this.startTime||(this.startTime=n??r),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(fn.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state="finished",this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),e.observe(this)}}function MU(t){for(let e=1;e<t.length;e++)t[e]??(t[e]=t[e-1])}const vs=t=>t*180/Math.PI,$m=t=>{const e=vs(Math.atan2(t[1],t[0]));return jm(e)},DU={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:t=>(Math.abs(t[0])+Math.abs(t[3]))/2,rotate:$m,rotateZ:$m,skewX:t=>vs(Math.atan(t[1])),skewY:t=>vs(Math.atan(t[2])),skew:t=>(Math.abs(t[1])+Math.abs(t[2]))/2},jm=t=>(t=t%360,t<0&&(t+=360),t),zx=$m,Lx=t=>Math.sqrt(t[0]*t[0]+t[1]*t[1]),Vx=t=>Math.sqrt(t[4]*t[4]+t[5]*t[5]),NU={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:Lx,scaleY:Vx,scale:t=>(Lx(t)+Vx(t))/2,rotateX:t=>jm(vs(Math.atan2(t[6],t[5]))),rotateY:t=>jm(vs(Math.atan2(-t[2],t[0]))),rotateZ:zx,rotate:zx,skewX:t=>vs(Math.atan(t[4])),skewY:t=>vs(Math.atan(t[1])),skew:t=>(Math.abs(t[1])+Math.abs(t[4]))/2};function Bm(t){return t.includes("scale")?1:0}function zm(t,e){if(!t||t==="none")return Bm(e);const n=t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let r,o;if(n)r=NU,o=n;else{const f=t.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=DU,o=f}if(!o)return Bm(e);const u=r[e],c=o[1].split(",").map(jU);return typeof u=="function"?u(c):c[u]}const $U=(t,e)=>{const{transform:n="none"}=getComputedStyle(t);return zm(n,e)};function jU(t){return parseFloat(t.trim())}const Qo=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Wo=new Set(Qo),Ux=t=>t===Zo||t===de,BU=new Set(["x","y","z"]),zU=Qo.filter(t=>!BU.has(t));function LU(t){const e=[];return zU.forEach(n=>{const r=t.getValue(n);r!==void 0&&(e.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),e}const ws={width:({x:t},{paddingLeft:e="0",paddingRight:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),height:({y:t},{paddingTop:e="0",paddingBottom:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:(t,{transform:e})=>zm(e,"x"),y:(t,{transform:e})=>zm(e,"y")};ws.translateX=ws.x;ws.translateY=ws.y;const xs=new Set;let Lm=!1,Vm=!1,Um=!1;function s_(){if(Vm){const t=Array.from(xs).filter(r=>r.needsMeasurement),e=new Set(t.map(r=>r.element)),n=new Map;e.forEach(r=>{const o=LU(r);o.length&&(n.set(r,o),r.render())}),t.forEach(r=>r.measureInitialState()),e.forEach(r=>{r.render();const o=n.get(r);o&&o.forEach(([u,c])=>{r.getValue(u)?.set(c)})}),t.forEach(r=>r.measureEndState()),t.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}Vm=!1,Lm=!1,xs.forEach(t=>t.complete(Um)),xs.clear()}function o_(){xs.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(Vm=!0)})}function VU(){Um=!0,o_(),s_(),Um=!1}class pg{constructor(e,n,r,o,u,c=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=n,this.name=r,this.motionValue=o,this.element=u,this.isAsync=c}scheduleResolve(){this.state="scheduled",this.isAsync?(xs.add(this),Lm||(Lm=!0,it.read(o_),it.resolveKeyframes(s_))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:n,element:r,motionValue:o}=this;if(e[0]===null){const u=o?.get(),c=e[e.length-1];if(u!==void 0)e[0]=u;else if(r&&n){const f=r.readValue(n,c);f!=null&&(e[0]=f)}e[0]===void 0&&(e[0]=c),o&&u===void 0&&o.set(e[0])}MU(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),xs.delete(this)}cancel(){this.state==="scheduled"&&(xs.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const UU=t=>t.startsWith("--");function KU(t,e,n){UU(e)?t.style.setProperty(e,n):t.style[e]=n}const qU=ng(()=>window.ScrollTimeline!==void 0),PU={};function IU(t,e){const n=ng(t);return()=>PU[e]??n()}const a_=IU(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),el=([t,e,n,r])=>`cubic-bezier(${t}, ${e}, ${n}, ${r})`,Kx={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:el([0,.65,.55,1]),circOut:el([.55,0,1,.45]),backIn:el([.31,.01,.66,-.59]),backOut:el([.33,1.53,.69,.99])};function l_(t,e){if(t)return typeof t=="function"?a_()?n_(t,e):"ease-out":HO(t)?el(t):Array.isArray(t)?t.map(n=>l_(n,e)||Kx.easeOut):Kx[t]}function HU(t,e,n,{delay:r=0,duration:o=300,repeat:u=0,repeatType:c="loop",ease:f="easeOut",times:h}={},m=void 0){const y={[e]:n};h&&(y.offset=h);const g=l_(f,o);Array.isArray(g)&&(y.easing=g);const b={delay:r,duration:o,easing:Array.isArray(g)?"linear":g,fill:"both",iterations:u+1,direction:c==="reverse"?"alternate":"normal"};return m&&(b.pseudoElement=m),t.animate(y,b)}function u_(t){return typeof t=="function"&&"applyToOptions"in t}function FU({type:t,...e}){return u_(t)&&a_()?t.applyToOptions(e):(e.duration??(e.duration=300),e.ease??(e.ease="easeOut"),e)}class GU extends dg{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,!e)return;const{element:n,name:r,keyframes:o,pseudoElement:u,allowFlatten:c=!1,finalKeyframe:f,onComplete:h}=e;this.isPseudoElement=!!u,this.allowFlatten=c,this.options=e,tg(typeof e.type!="string");const m=FU(e);this.animation=HU(n,r,o,m,u),m.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!u){const y=fg(o,this.options,f,this.speed);this.updateMotionValue?this.updateMotionValue(y):KU(n,r,y),this.animation.cancel()}h?.(),this.notifyFinished()}}play(){this.isStopped||(this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:e}=this;e==="idle"||e==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){this.isPseudoElement||this.animation.commitStyles?.()}get duration(){const e=this.animation.effect?.getComputedTiming?.().duration||0;return Un(Number(e))}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+Un(e)}get time(){return Un(Number(this.animation.currentTime)||0)}set time(e){this.finishedTime=null,this.animation.currentTime=pi(e)}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return Number(this.animation.startTime)}set startTime(e){this.animation.startTime=e}attachTimeline({timeline:e,observe:n}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,e&&qU()?(this.animation.timeline=e,Kn):n(this)}}const c_={anticipate:KO,backInOut:UO,circInOut:PO};function YU(t){return t in c_}function JU(t){typeof t.ease=="string"&&YU(t.ease)&&(t.ease=c_[t.ease])}const qx=10;class XU extends GU{constructor(e){JU(e),r_(e),super(e),e.startTime&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){const{motionValue:n,onUpdate:r,onComplete:o,element:u,...c}=this.options;if(!n)return;if(e!==void 0){n.set(e);return}const f=new hg({...c,autoplay:!1}),h=pi(this.finishedTime??this.time);n.setWithVelocity(f.sample(h-qx).value,f.sample(h).value,qx),f.stop()}}const Px=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(Ur.test(t)||t==="0")&&!t.startsWith("url("));function ZU(t){const e=t[0];if(t.length===1)return!0;for(let n=0;n<t.length;n++)if(t[n]!==e)return!0}function QU(t,e,n,r){const o=t[0];if(o===null)return!1;if(e==="display"||e==="visibility")return!0;const u=t[t.length-1],c=Px(o,e),f=Px(u,e);return!c||!f?!1:ZU(t)||(n==="spring"||u_(n))&&r}function Km(t){t.duration=0,t.type="keyframes"}const WU=new Set(["opacity","clipPath","filter","transform"]),eK=ng(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function tK(t){const{motionValue:e,name:n,repeatDelay:r,repeatType:o,damping:u,type:c}=t;if(!(e?.owner?.current instanceof HTMLElement))return!1;const{onUpdate:h,transformTemplate:m}=e.owner.getProps();return eK()&&n&&WU.has(n)&&(n!=="transform"||!m)&&!h&&!r&&o!=="mirror"&&u!==0&&c!=="inertia"}const nK=40;class iK extends dg{constructor({autoplay:e=!0,delay:n=0,type:r="keyframes",repeat:o=0,repeatDelay:u=0,repeatType:c="loop",keyframes:f,name:h,motionValue:m,element:y,...g}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=fn.now();const b={autoplay:e,delay:n,type:r,repeat:o,repeatDelay:u,repeatType:c,name:h,motionValue:m,element:y,...g},S=y?.KeyframeResolver||pg;this.keyframeResolver=new S(f,(x,T,_)=>this.onKeyframesResolved(x,T,b,!_),h,m,y),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,n,r,o){this.keyframeResolver=void 0;const{name:u,type:c,velocity:f,delay:h,isHandoff:m,onUpdate:y}=r;this.resolvedAt=fn.now(),QU(e,u,c,f)||((er.instantAnimations||!h)&&y?.(fg(e,r,n)),e[0]=e[e.length-1],Km(r),r.repeat=0);const b={startTime:o?this.resolvedAt?this.resolvedAt-this.createdAt>nK?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:n,...r,keyframes:e},S=!m&&tK(b)?new XU({...b,element:b.motionValue.owner.current}):new hg(b);S.finished.then(()=>this.notifyFinished()).catch(Kn),this.pendingTimeline&&(this.stopTimeline=S.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=S}get finished(){return this._animation?this.animation.finished:this._finished}then(e,n){return this.finished.finally(e).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),VU()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}}const rK=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function sK(t){const e=rK.exec(t);if(!e)return[,];const[,n,r,o]=e;return[`--${n??r}`,o]}function f_(t,e,n=1){const[r,o]=sK(t);if(!r)return;const u=window.getComputedStyle(e).getPropertyValue(r);if(u){const c=u.trim();return DO(c)?parseFloat(c):c}return og(o)?f_(o,e,n+1):o}function mg(t,e){return t?.[e]??t?.default??t}const d_=new Set(["width","height","top","left","right","bottom",...Qo]),oK={test:t=>t==="auto",parse:t=>t},h_=t=>e=>e.test(t),p_=[Zo,de,mi,Rr,Z4,X4,oK],Ix=t=>p_.find(h_(t));function aK(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||$O(t):!0}const lK=new Set(["brightness","contrast","saturate","opacity"]);function uK(t){const[e,n]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[r]=n.match(ag)||[];if(!r)return t;const o=n.replace(r,"");let u=lK.has(e)?1:0;return r!==n&&(u*=100),e+"("+u+o+")"}const cK=/\b([a-z-]*)\(.*?\)/gu,qm={...Ur,getAnimatableNone:t=>{const e=t.match(cK);return e?e.map(uK).join(" "):t}},Hx={...Zo,transform:Math.round},fK={rotate:Rr,rotateX:Rr,rotateY:Rr,rotateZ:Rr,scale:yc,scaleX:yc,scaleY:yc,scaleZ:yc,skew:Rr,skewX:Rr,skewY:Rr,distance:de,translateX:de,translateY:de,translateZ:de,x:de,y:de,z:de,perspective:de,transformPerspective:de,opacity:bl,originX:Dx,originY:Dx,originZ:de},yg={borderWidth:de,borderTopWidth:de,borderRightWidth:de,borderBottomWidth:de,borderLeftWidth:de,borderRadius:de,radius:de,borderTopLeftRadius:de,borderTopRightRadius:de,borderBottomRightRadius:de,borderBottomLeftRadius:de,width:de,maxWidth:de,height:de,maxHeight:de,top:de,right:de,bottom:de,left:de,padding:de,paddingTop:de,paddingRight:de,paddingBottom:de,paddingLeft:de,margin:de,marginTop:de,marginRight:de,marginBottom:de,marginLeft:de,backgroundPositionX:de,backgroundPositionY:de,...fK,zIndex:Hx,fillOpacity:bl,strokeOpacity:bl,numOctaves:Hx},dK={...yg,color:Tt,backgroundColor:Tt,outlineColor:Tt,fill:Tt,stroke:Tt,borderColor:Tt,borderTopColor:Tt,borderRightColor:Tt,borderBottomColor:Tt,borderLeftColor:Tt,filter:qm,WebkitFilter:qm},m_=t=>dK[t];function y_(t,e){let n=m_(t);return n!==qm&&(n=Ur),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const hK=new Set(["auto","none","0"]);function pK(t,e,n){let r=0,o;for(;r<t.length&&!o;){const u=t[r];typeof u=="string"&&!hK.has(u)&&Sl(u).values.length&&(o=t[r]),r++}if(o&&n)for(const u of e)t[u]=y_(n,o)}class mK extends pg{constructor(e,n,r,o,u){super(e,n,r,o,u,!0)}readKeyframes(){const{unresolvedKeyframes:e,element:n,name:r}=this;if(!n||!n.current)return;super.readKeyframes();for(let h=0;h<e.length;h++){let m=e[h];if(typeof m=="string"&&(m=m.trim(),og(m))){const y=f_(m,n.current);y!==void 0&&(e[h]=y),h===e.length-1&&(this.finalKeyframe=m)}}if(this.resolveNoneKeyframes(),!d_.has(r)||e.length!==2)return;const[o,u]=e,c=Ix(o),f=Ix(u);if(c!==f)if(Ux(c)&&Ux(f))for(let h=0;h<e.length;h++){const m=e[h];typeof m=="string"&&(e[h]=parseFloat(m))}else ws[r]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:n}=this,r=[];for(let o=0;o<e.length;o++)(e[o]===null||aK(e[o]))&&r.push(o);r.length&&pK(e,r,n)}measureInitialState(){const{element:e,unresolvedKeyframes:n,name:r}=this;if(!e||!e.current)return;r==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=ws[r](e.measureViewportBox(),window.getComputedStyle(e.current)),n[0]=this.measuredOrigin;const o=n[n.length-1];o!==void 0&&e.getValue(r,o).jump(o,!1)}measureEndState(){const{element:e,name:n,unresolvedKeyframes:r}=this;if(!e||!e.current)return;const o=e.getValue(n);o&&o.jump(this.measuredOrigin,!1);const u=r.length-1,c=r[u];r[u]=ws[n](e.measureViewportBox(),window.getComputedStyle(e.current)),c!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=c),this.removedTransforms?.length&&this.removedTransforms.forEach(([f,h])=>{e.getValue(f).set(h)}),this.resolveNoneKeyframes()}}function yK(t,e,n){if(t instanceof EventTarget)return[t];if(typeof t=="string"){let r=document;const o=n?.[t]??r.querySelectorAll(t);return o?Array.from(o):[]}return Array.from(t)}const g_=(t,e)=>e&&typeof t=="number"?e.transform(t):t;function gK(t){return NO(t)&&"offsetHeight"in t}const Fx=30,vK=t=>!isNaN(parseFloat(t));class bK{constructor(e,n={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=r=>{const o=fn.now();if(this.updatedAt!==o&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(const u of this.dependents)u.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=n.owner}setCurrent(e){this.current=e,this.updatedAt=fn.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=vK(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on("change",e)}on(e,n){this.events[e]||(this.events[e]=new ig);const r=this.events[e].add(n);return e==="change"?()=>{r(),it.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,n){this.passiveEffect=e,this.stopPassiveEffect=n}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,n,r){this.set(n),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-r}jump(e,n=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(e){this.dependents||(this.dependents=new Set),this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const e=fn.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>Fx)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,Fx);return jO(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(e){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=e(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Io(t,e){return new bK(t,e)}const{schedule:gg}=FO(queueMicrotask,!1),Xn={x:!1,y:!1};function v_(){return Xn.x||Xn.y}function SK(t){return t==="x"||t==="y"?Xn[t]?null:(Xn[t]=!0,()=>{Xn[t]=!1}):Xn.x||Xn.y?null:(Xn.x=Xn.y=!0,()=>{Xn.x=Xn.y=!1})}function b_(t,e){const n=yK(t),r=new AbortController,o={passive:!0,...e,signal:r.signal};return[n,o,()=>r.abort()]}function Gx(t){return!(t.pointerType==="touch"||v_())}function wK(t,e,n={}){const[r,o,u]=b_(t,n),c=f=>{if(!Gx(f))return;const{target:h}=f,m=e(h,f);if(typeof m!="function"||!h)return;const y=g=>{Gx(g)&&(m(g),h.removeEventListener("pointerleave",y))};h.addEventListener("pointerleave",y,o)};return r.forEach(f=>{f.addEventListener("pointerenter",c,o)}),u}const S_=(t,e)=>e?t===e?!0:S_(t,e.parentElement):!1,vg=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1,xK=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function TK(t){return xK.has(t.tagName)||t.tabIndex!==-1}const Cc=new WeakSet;function Yx(t){return e=>{e.key==="Enter"&&t(e)}}function $p(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}const AK=(t,e)=>{const n=t.currentTarget;if(!n)return;const r=Yx(()=>{if(Cc.has(n))return;$p(n,"down");const o=Yx(()=>{$p(n,"up")}),u=()=>$p(n,"cancel");n.addEventListener("keyup",o,e),n.addEventListener("blur",u,e)});n.addEventListener("keydown",r,e),n.addEventListener("blur",()=>n.removeEventListener("keydown",r),e)};function Jx(t){return vg(t)&&!v_()}function EK(t,e,n={}){const[r,o,u]=b_(t,n),c=f=>{const h=f.currentTarget;if(!Jx(f))return;Cc.add(h);const m=e(h,f),y=(S,x)=>{window.removeEventListener("pointerup",g),window.removeEventListener("pointercancel",b),Cc.has(h)&&Cc.delete(h),Jx(S)&&typeof m=="function"&&m(S,{success:x})},g=S=>{y(S,h===window||h===document||n.useGlobalTarget||S_(h,S.target))},b=S=>{y(S,!1)};window.addEventListener("pointerup",g,o),window.addEventListener("pointercancel",b,o)};return r.forEach(f=>{(n.useGlobalTarget?window:f).addEventListener("pointerdown",c,o),gK(f)&&(f.addEventListener("focus",m=>AK(m,o)),!TK(f)&&!f.hasAttribute("tabindex")&&(f.tabIndex=0))}),u}function w_(t){return NO(t)&&"ownerSVGElement"in t}function OK(t){return w_(t)&&t.tagName==="svg"}const Jt=t=>!!(t&&t.getVelocity),_K=[...p_,Tt,Ur],RK=t=>_K.find(h_(t)),x_=N.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});function kK(t=!0){const e=N.useContext(Qy);if(e===null)return[!0,null];const{isPresent:n,onExitComplete:r,register:o}=e,u=N.useId();N.useEffect(()=>{if(t)return o(u)},[t]);const c=N.useCallback(()=>t&&r&&r(u),[u,r,t]);return!n&&r?[!1,c]:[!0]}const T_=N.createContext({strict:!1}),Xx={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},Ho={};for(const t in Xx)Ho[t]={isEnabled:e=>Xx[t].some(n=>!!e[n])};function CK(t){for(const e in t)Ho[e]={...Ho[e],...t[e]}}const MK=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function nf(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||MK.has(t)}let A_=t=>!nf(t);function DK(t){typeof t=="function"&&(A_=e=>e.startsWith("on")?!nf(e):t(e))}try{DK(require("@emotion/is-prop-valid").default)}catch{}function NK(t,e,n){const r={};for(const o in t)o==="values"&&typeof t.values=="object"||(A_(o)||n===!0&&nf(o)||!e&&!nf(o)||t.draggable&&o.startsWith("onDrag"))&&(r[o]=t[o]);return r}const jf=N.createContext({});function Bf(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}function wl(t){return typeof t=="string"||Array.isArray(t)}const bg=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Sg=["initial",...bg];function zf(t){return Bf(t.animate)||Sg.some(e=>wl(t[e]))}function E_(t){return!!(zf(t)||t.variants)}function $K(t,e){if(zf(t)){const{initial:n,animate:r}=t;return{initial:n===!1||wl(n)?n:void 0,animate:wl(r)?r:void 0}}return t.inherit!==!1?e:{}}function jK(t){const{initial:e,animate:n}=$K(t,N.useContext(jf));return N.useMemo(()=>({initial:e,animate:n}),[Zx(e),Zx(n)])}function Zx(t){return Array.isArray(t)?t.join(" "):t}function Qx(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const Ja={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(de.test(t))t=parseFloat(t);else return t;const n=Qx(t,e.target.x),r=Qx(t,e.target.y);return`${n}% ${r}%`}},BK={correct:(t,{treeScale:e,projectionDelta:n})=>{const r=t,o=Ur.parse(t);if(o.length>5)return r;const u=Ur.createTransformer(t),c=typeof o[0]!="number"?1:0,f=n.x.scale*e.x,h=n.y.scale*e.y;o[0+c]/=f,o[1+c]/=h;const m=rt(f,h,.5);return typeof o[2+c]=="number"&&(o[2+c]/=m),typeof o[3+c]=="number"&&(o[3+c]/=m),u(o)}},Pm={borderRadius:{...Ja,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Ja,borderTopRightRadius:Ja,borderBottomLeftRadius:Ja,borderBottomRightRadius:Ja,boxShadow:BK};function O_(t,{layout:e,layoutId:n}){return Wo.has(t)||t.startsWith("origin")||(e||n!==void 0)&&(!!Pm[t]||t==="opacity")}const zK={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},LK=Qo.length;function VK(t,e,n){let r="",o=!0;for(let u=0;u<LK;u++){const c=Qo[u],f=t[c];if(f===void 0)continue;let h=!0;if(typeof f=="number"?h=f===(c.startsWith("scale")?1:0):h=parseFloat(f)===0,!h||n){const m=g_(f,yg[c]);if(!h){o=!1;const y=zK[c]||c;r+=`${y}(${m}) `}n&&(e[c]=m)}}return r=r.trim(),n?r=n(e,o?"":r):o&&(r="none"),r}function wg(t,e,n){const{style:r,vars:o,transformOrigin:u}=t;let c=!1,f=!1;for(const h in e){const m=e[h];if(Wo.has(h)){c=!0;continue}else if(YO(h)){o[h]=m;continue}else{const y=g_(m,yg[h]);h.startsWith("origin")?(f=!0,u[h]=y):r[h]=y}}if(e.transform||(c||n?r.transform=VK(e,t.transform,n):r.transform&&(r.transform="none")),f){const{originX:h="50%",originY:m="50%",originZ:y=0}=u;r.transformOrigin=`${h} ${m} ${y}`}}const xg=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function __(t,e,n){for(const r in e)!Jt(e[r])&&!O_(r,n)&&(t[r]=e[r])}function UK({transformTemplate:t},e){return N.useMemo(()=>{const n=xg();return wg(n,e,t),Object.assign({},n.vars,n.style)},[e])}function KK(t,e){const n=t.style||{},r={};return __(r,n,t),Object.assign(r,UK(t,e)),r}function qK(t,e){const n={},r=KK(t,e);return t.drag&&t.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(n.tabIndex=0),n.style=r,n}const PK={offset:"stroke-dashoffset",array:"stroke-dasharray"},IK={offset:"strokeDashoffset",array:"strokeDasharray"};function HK(t,e,n=1,r=0,o=!0){t.pathLength=1;const u=o?PK:IK;t[u.offset]=de.transform(-r);const c=de.transform(e),f=de.transform(n);t[u.array]=`${c} ${f}`}function R_(t,{attrX:e,attrY:n,attrScale:r,pathLength:o,pathSpacing:u=1,pathOffset:c=0,...f},h,m,y){if(wg(t,f,m),h){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:g,style:b}=t;g.transform&&(b.transform=g.transform,delete g.transform),(b.transform||g.transformOrigin)&&(b.transformOrigin=g.transformOrigin??"50% 50%",delete g.transformOrigin),b.transform&&(b.transformBox=y?.transformBox??"fill-box",delete g.transformBox),e!==void 0&&(g.x=e),n!==void 0&&(g.y=n),r!==void 0&&(g.scale=r),o!==void 0&&HK(g,o,u,c,!1)}const k_=()=>({...xg(),attrs:{}}),C_=t=>typeof t=="string"&&t.toLowerCase()==="svg";function FK(t,e,n,r){const o=N.useMemo(()=>{const u=k_();return R_(u,e,C_(r),t.transformTemplate,t.style),{...u.attrs,style:{...u.style}}},[e]);if(t.style){const u={};__(u,t.style,t),o.style={...u,...o.style}}return o}const GK=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function Tg(t){return typeof t!="string"||t.includes("-")?!1:!!(GK.indexOf(t)>-1||/[A-Z]/u.test(t))}function YK(t,e,n,{latestValues:r},o,u=!1){const f=(Tg(t)?FK:qK)(e,r,o,t),h=NK(e,typeof t=="string",u),m=t!==N.Fragment?{...h,...f,ref:n}:{},{children:y}=e,g=N.useMemo(()=>Jt(y)?y.get():y,[y]);return N.createElement(t,{...m,children:g})}function Wx(t){const e=[{},{}];return t?.values.forEach((n,r)=>{e[0][r]=n.get(),e[1][r]=n.getVelocity()}),e}function Ag(t,e,n,r){if(typeof e=="function"){const[o,u]=Wx(r);e=e(n!==void 0?n:t.custom,o,u)}if(typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"){const[o,u]=Wx(r);e=e(n!==void 0?n:t.custom,o,u)}return e}function Mc(t){return Jt(t)?t.get():t}function JK({scrapeMotionValuesFromProps:t,createRenderState:e},n,r,o){return{latestValues:XK(n,r,o,t),renderState:e()}}function XK(t,e,n,r){const o={},u=r(t,{});for(const b in u)o[b]=Mc(u[b]);let{initial:c,animate:f}=t;const h=zf(t),m=E_(t);e&&m&&!h&&t.inherit!==!1&&(c===void 0&&(c=e.initial),f===void 0&&(f=e.animate));let y=n?n.initial===!1:!1;y=y||c===!1;const g=y?f:c;if(g&&typeof g!="boolean"&&!Bf(g)){const b=Array.isArray(g)?g:[g];for(let S=0;S<b.length;S++){const x=Ag(t,b[S]);if(x){const{transitionEnd:T,transition:_,...k}=x;for(const C in k){let M=k[C];if(Array.isArray(M)){const G=y?M.length-1:0;M=M[G]}M!==null&&(o[C]=M)}for(const C in T)o[C]=T[C]}}}return o}const M_=t=>(e,n)=>{const r=N.useContext(jf),o=N.useContext(Qy),u=()=>JK(t,e,r,o);return n?u():C4(u)};function Eg(t,e,n){const{style:r}=t,o={};for(const u in r)(Jt(r[u])||e.style&&Jt(e.style[u])||O_(u,t)||n?.getValue(u)?.liveStyle!==void 0)&&(o[u]=r[u]);return o}const ZK=M_({scrapeMotionValuesFromProps:Eg,createRenderState:xg});function D_(t,e,n){const r=Eg(t,e,n);for(const o in t)if(Jt(t[o])||Jt(e[o])){const u=Qo.indexOf(o)!==-1?"attr"+o.charAt(0).toUpperCase()+o.substring(1):o;r[u]=t[o]}return r}const QK=M_({scrapeMotionValuesFromProps:D_,createRenderState:k_}),WK=Symbol.for("motionComponentSymbol");function Eo(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function eq(t,e,n){return N.useCallback(r=>{r&&t.onMount&&t.onMount(r),e&&(r?e.mount(r):e.unmount()),n&&(typeof n=="function"?n(r):Eo(n)&&(n.current=r))},[e])}const Og=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),tq="framerAppearId",N_="data-"+Og(tq),$_=N.createContext({});function nq(t,e,n,r,o){const{visualElement:u}=N.useContext(jf),c=N.useContext(T_),f=N.useContext(Qy),h=N.useContext(x_).reducedMotion,m=N.useRef(null);r=r||c.renderer,!m.current&&r&&(m.current=r(t,{visualState:e,parent:u,props:n,presenceContext:f,blockInitialAnimation:f?f.initial===!1:!1,reducedMotionConfig:h}));const y=m.current,g=N.useContext($_);y&&!y.projection&&o&&(y.type==="html"||y.type==="svg")&&iq(m.current,n,o,g);const b=N.useRef(!1);N.useInsertionEffect(()=>{y&&b.current&&y.update(n,f)});const S=n[N_],x=N.useRef(!!S&&!window.MotionHandoffIsComplete?.(S)&&window.MotionHasOptimisedAnimation?.(S));return M4(()=>{y&&(b.current=!0,window.MotionIsMounted=!0,y.updateFeatures(),y.scheduleRenderMicrotask(),x.current&&y.animationState&&y.animationState.animateChanges())}),N.useEffect(()=>{y&&(!x.current&&y.animationState&&y.animationState.animateChanges(),x.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(S)}),x.current=!1),y.enteringChildren=void 0)}),y}function iq(t,e,n,r){const{layoutId:o,layout:u,drag:c,dragConstraints:f,layoutScroll:h,layoutRoot:m,layoutCrossfade:y}=e;t.projection=new n(t.latestValues,e["data-framer-portal-id"]?void 0:j_(t.parent)),t.projection.setOptions({layoutId:o,layout:u,alwaysMeasureLayout:!!c||f&&Eo(f),visualElement:t,animationType:typeof u=="string"?u:"both",initialPromotionConfig:r,crossfade:y,layoutScroll:h,layoutRoot:m})}function j_(t){if(t)return t.options.allowProjection!==!1?t.projection:j_(t.parent)}function jp(t,{forwardMotionProps:e=!1}={},n,r){n&&CK(n);const o=Tg(t)?QK:ZK;function u(f,h){let m;const y={...N.useContext(x_),...f,layoutId:rq(f)},{isStatic:g}=y,b=jK(f),S=o(f,g);if(!g&&Zy){sq();const x=oq(y);m=x.MeasureLayout,b.visualElement=nq(t,S,y,r,x.ProjectionNode)}return F.jsxs(jf.Provider,{value:b,children:[m&&b.visualElement?F.jsx(m,{visualElement:b.visualElement,...y}):null,YK(t,f,eq(S,b.visualElement,h),S,g,e)]})}u.displayName=`motion.${typeof t=="string"?t:`create(${t.displayName??t.name??""})`}`;const c=N.forwardRef(u);return c[WK]=t,c}function rq({layoutId:t}){const e=N.useContext(MO).id;return e&&t!==void 0?e+"-"+t:t}function sq(t,e){N.useContext(T_).strict}function oq(t){const{drag:e,layout:n}=Ho;if(!e&&!n)return{};const r={...e,...n};return{MeasureLayout:e?.isEnabled(t)||n?.isEnabled(t)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}function aq(t,e){if(typeof Proxy>"u")return jp;const n=new Map,r=(u,c)=>jp(u,c,t,e),o=(u,c)=>r(u,c);return new Proxy(o,{get:(u,c)=>c==="create"?r:(n.has(c)||n.set(c,jp(c,void 0,t,e)),n.get(c))})}function B_({top:t,left:e,right:n,bottom:r}){return{x:{min:e,max:n},y:{min:t,max:r}}}function lq({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function uq(t,e){if(!e)return t;const n=e({x:t.left,y:t.top}),r=e({x:t.right,y:t.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function Bp(t){return t===void 0||t===1}function Im({scale:t,scaleX:e,scaleY:n}){return!Bp(t)||!Bp(e)||!Bp(n)}function ms(t){return Im(t)||z_(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function z_(t){return e1(t.x)||e1(t.y)}function e1(t){return t&&t!=="0%"}function rf(t,e,n){const r=t-n,o=e*r;return n+o}function t1(t,e,n,r,o){return o!==void 0&&(t=rf(t,o,r)),rf(t,n,r)+e}function Hm(t,e=0,n=1,r,o){t.min=t1(t.min,e,n,r,o),t.max=t1(t.max,e,n,r,o)}function L_(t,{x:e,y:n}){Hm(t.x,e.translate,e.scale,e.originPoint),Hm(t.y,n.translate,n.scale,n.originPoint)}const n1=.999999999999,i1=1.0000000000001;function cq(t,e,n,r=!1){const o=n.length;if(!o)return;e.x=e.y=1;let u,c;for(let f=0;f<o;f++){u=n[f],c=u.projectionDelta;const{visualElement:h}=u.options;h&&h.props.style&&h.props.style.display==="contents"||(r&&u.options.layoutScroll&&u.scroll&&u!==u.root&&_o(t,{x:-u.scroll.offset.x,y:-u.scroll.offset.y}),c&&(e.x*=c.x.scale,e.y*=c.y.scale,L_(t,c)),r&&ms(u.latestValues)&&_o(t,u.latestValues))}e.x<i1&&e.x>n1&&(e.x=1),e.y<i1&&e.y>n1&&(e.y=1)}function Oo(t,e){t.min=t.min+e,t.max=t.max+e}function r1(t,e,n,r,o=.5){const u=rt(t.min,t.max,o);Hm(t,e,n,u,r)}function _o(t,e){r1(t.x,e.x,e.scaleX,e.scale,e.originX),r1(t.y,e.y,e.scaleY,e.scale,e.originY)}function V_(t,e){return B_(uq(t.getBoundingClientRect(),e))}function fq(t,e,n){const r=V_(t,n),{scroll:o}=e;return o&&(Oo(r.x,o.offset.x),Oo(r.y,o.offset.y)),r}const s1=()=>({translate:0,scale:1,origin:0,originPoint:0}),Ro=()=>({x:s1(),y:s1()}),o1=()=>({min:0,max:0}),Ct=()=>({x:o1(),y:o1()}),Fm={current:null},U_={current:!1};function dq(){if(U_.current=!0,!!Zy)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>Fm.current=t.matches;t.addEventListener("change",e),e()}else Fm.current=!1}const hq=new WeakMap;function pq(t,e,n){for(const r in e){const o=e[r],u=n[r];if(Jt(o))t.addValue(r,o);else if(Jt(u))t.addValue(r,Io(o,{owner:t}));else if(u!==o)if(t.hasValue(r)){const c=t.getValue(r);c.liveStyle===!0?c.jump(o):c.hasAnimated||c.set(o)}else{const c=t.getStaticValue(r);t.addValue(r,Io(c!==void 0?c:o,{owner:t}))}}for(const r in n)e[r]===void 0&&t.removeValue(r);return e}const a1=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class mq{scrapeMotionValuesFromProps(e,n,r){return{}}constructor({parent:e,props:n,presenceContext:r,reducedMotionConfig:o,blockInitialAnimation:u,visualState:c},f={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=pg,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const b=fn.now();this.renderScheduledAt<b&&(this.renderScheduledAt=b,it.render(this.render,!1,!0))};const{latestValues:h,renderState:m}=c;this.latestValues=h,this.baseTarget={...h},this.initialValues=n.initial?{...h}:{},this.renderState=m,this.parent=e,this.props=n,this.presenceContext=r,this.depth=e?e.depth+1:0,this.reducedMotionConfig=o,this.options=f,this.blockInitialAnimation=!!u,this.isControllingVariants=zf(n),this.isVariantNode=E_(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:y,...g}=this.scrapeMotionValuesFromProps(n,{},this);for(const b in g){const S=g[b];h[b]!==void 0&&Jt(S)&&S.set(h[b])}}mount(e){this.current=e,hq.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((n,r)=>this.bindToMotionValue(r,n)),U_.current||dq(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:Fm.current,this.parent?.addChild(this),this.update(this.props,this.presenceContext)}unmount(){this.projection&&this.projection.unmount(),Vr(this.notifyUpdate),Vr(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(const e in this.events)this.events[e].clear();for(const e in this.features){const n=this.features[e];n&&(n.unmount(),n.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,n){this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)();const r=Wo.has(e);r&&this.onBindTransform&&this.onBindTransform();const o=n.on("change",c=>{this.latestValues[e]=c,this.props.onUpdate&&it.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let u;window.MotionCheckAppearSync&&(u=window.MotionCheckAppearSync(this,e,n)),this.valueSubscriptions.set(e,()=>{o(),u&&u(),n.owner&&n.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in Ho){const n=Ho[e];if(!n)continue;const{isEnabled:r,Feature:o}=n;if(!this.features[e]&&o&&r(this.props)&&(this.features[e]=new o(this)),this.features[e]){const u=this.features[e];u.isMounted?u.update():(u.mount(),u.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Ct()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,n){this.latestValues[e]=n}update(e,n){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let r=0;r<a1.length;r++){const o=a1[r];this.propEventSubscriptions[o]&&(this.propEventSubscriptions[o](),delete this.propEventSubscriptions[o]);const u="on"+o,c=e[u];c&&(this.propEventSubscriptions[o]=this.on(o,c))}this.prevMotionValues=pq(this,this.scrapeMotionValuesFromProps(e,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){const n=this.getClosestVariantNode();if(n)return n.variantChildren&&n.variantChildren.add(e),()=>n.variantChildren.delete(e)}addValue(e,n){const r=this.values.get(e);n!==r&&(r&&this.removeValue(e),this.bindToMotionValue(e,n),this.values.set(e,n),this.latestValues[e]=n.get())}removeValue(e){this.values.delete(e);const n=this.valueSubscriptions.get(e);n&&(n(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,n){if(this.props.values&&this.props.values[e])return this.props.values[e];let r=this.values.get(e);return r===void 0&&n!==void 0&&(r=Io(n===null?void 0:n,{owner:this}),this.addValue(e,r)),r}readValue(e,n){let r=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options);return r!=null&&(typeof r=="string"&&(DO(r)||$O(r))?r=parseFloat(r):!RK(r)&&Ur.test(n)&&(r=y_(e,n)),this.setBaseTarget(e,Jt(r)?r.get():r)),Jt(r)?r.get():r}setBaseTarget(e,n){this.baseTarget[e]=n}getBaseTarget(e){const{initial:n}=this.props;let r;if(typeof n=="string"||typeof n=="object"){const u=Ag(this.props,n,this.presenceContext?.custom);u&&(r=u[e])}if(n&&r!==void 0)return r;const o=this.getBaseTargetFromProps(this.props,e);return o!==void 0&&!Jt(o)?o:this.initialValues[e]!==void 0&&r===void 0?void 0:this.baseTarget[e]}on(e,n){return this.events[e]||(this.events[e]=new ig),this.events[e].add(n)}notify(e,...n){this.events[e]&&this.events[e].notify(...n)}scheduleRenderMicrotask(){gg.render(this.render)}}class K_ extends mq{constructor(){super(...arguments),this.KeyframeResolver=mK}sortInstanceNodePosition(e,n){return e.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(e,n){return e.style?e.style[n]:void 0}removeValueFromRenderState(e,{vars:n,style:r}){delete n[e],delete r[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;Jt(e)&&(this.childSubscription=e.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}function q_(t,{style:e,vars:n},r,o){const u=t.style;let c;for(c in e)u[c]=e[c];o?.applyProjectionStyles(u,r);for(c in n)u.setProperty(c,n[c])}function yq(t){return window.getComputedStyle(t)}class gq extends K_{constructor(){super(...arguments),this.type="html",this.renderInstance=q_}readValueFromInstance(e,n){if(Wo.has(n))return this.projection?.isProjecting?Bm(n):$U(e,n);{const r=yq(e),o=(YO(n)?r.getPropertyValue(n):r[n])||0;return typeof o=="string"?o.trim():o}}measureInstanceViewportBox(e,{transformPagePoint:n}){return V_(e,n)}build(e,n,r){wg(e,n,r.transformTemplate)}scrapeMotionValuesFromProps(e,n,r){return Eg(e,n,r)}}const P_=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function vq(t,e,n,r){q_(t,e,void 0,r);for(const o in e.attrs)t.setAttribute(P_.has(o)?o:Og(o),e.attrs[o])}class bq extends K_{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Ct}getBaseTargetFromProps(e,n){return e[n]}readValueFromInstance(e,n){if(Wo.has(n)){const r=m_(n);return r&&r.default||0}return n=P_.has(n)?n:Og(n),e.getAttribute(n)}scrapeMotionValuesFromProps(e,n,r){return D_(e,n,r)}build(e,n,r){R_(e,n,this.isSVGTag,r.transformTemplate,r.style)}renderInstance(e,n,r,o){vq(e,n,r,o)}mount(e){this.isSVGTag=C_(e.tagName),super.mount(e)}}const Sq=(t,e)=>Tg(t)?new bq(e):new gq(e,{allowProjection:t!==N.Fragment});function Bo(t,e,n){const r=t.getProps();return Ag(r,e,n!==void 0?n:r.custom,t)}const Gm=t=>Array.isArray(t);function wq(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,Io(n))}function xq(t){return Gm(t)?t[t.length-1]||0:t}function Tq(t,e){const n=Bo(t,e);let{transitionEnd:r={},transition:o={},...u}=n||{};u={...u,...r};for(const c in u){const f=xq(u[c]);wq(t,c,f)}}function Aq(t){return!!(Jt(t)&&t.add)}function Ym(t,e){const n=t.getValue("willChange");if(Aq(n))return n.add(e);if(!n&&er.WillChange){const r=new er.WillChange("auto");t.addValue("willChange",r),r.add(e)}}function I_(t){return t.props[N_]}const Eq=t=>t!==null;function Oq(t,{repeat:e,repeatType:n="loop"},r){const o=t.filter(Eq),u=e&&n!=="loop"&&e%2===1?0:o.length-1;return o[u]}const _q={type:"spring",stiffness:500,damping:25,restSpeed:10},Rq=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),kq={type:"keyframes",duration:.8},Cq={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},Mq=(t,{keyframes:e})=>e.length>2?kq:Wo.has(t)?t.startsWith("scale")?Rq(e[1]):_q:Cq;function Dq({when:t,delay:e,delayChildren:n,staggerChildren:r,staggerDirection:o,repeat:u,repeatType:c,repeatDelay:f,from:h,elapsed:m,...y}){return!!Object.keys(y).length}const _g=(t,e,n,r={},o,u)=>c=>{const f=mg(r,t)||{},h=f.delay||r.delay||0;let{elapsed:m=0}=r;m=m-pi(h);const y={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:e.getVelocity(),...f,delay:-m,onUpdate:b=>{e.set(b),f.onUpdate&&f.onUpdate(b)},onComplete:()=>{c(),f.onComplete&&f.onComplete()},name:t,motionValue:e,element:u?void 0:o};Dq(f)||Object.assign(y,Mq(t,y)),y.duration&&(y.duration=pi(y.duration)),y.repeatDelay&&(y.repeatDelay=pi(y.repeatDelay)),y.from!==void 0&&(y.keyframes[0]=y.from);let g=!1;if((y.type===!1||y.duration===0&&!y.repeatDelay)&&(Km(y),y.delay===0&&(g=!0)),(er.instantAnimations||er.skipAnimations)&&(g=!0,Km(y),y.delay=0),y.allowFlatten=!f.type&&!f.ease,g&&!u&&e.get()!==void 0){const b=Oq(y.keyframes,f);if(b!==void 0){it.update(()=>{y.onUpdate(b),y.onComplete()});return}}return f.isSync?new hg(y):new iK(y)};function Nq({protectedKeys:t,needsAnimating:e},n){const r=t.hasOwnProperty(n)&&e[n]!==!0;return e[n]=!1,r}function H_(t,e,{delay:n=0,transitionOverride:r,type:o}={}){let{transition:u=t.getDefaultTransition(),transitionEnd:c,...f}=e;r&&(u=r);const h=[],m=o&&t.animationState&&t.animationState.getState()[o];for(const y in f){const g=t.getValue(y,t.latestValues[y]??null),b=f[y];if(b===void 0||m&&Nq(m,y))continue;const S={delay:n,...mg(u||{},y)},x=g.get();if(x!==void 0&&!g.isAnimating&&!Array.isArray(b)&&b===x&&!S.velocity)continue;let T=!1;if(window.MotionHandoffAnimation){const k=I_(t);if(k){const C=window.MotionHandoffAnimation(k,y,it);C!==null&&(S.startTime=C,T=!0)}}Ym(t,y),g.start(_g(y,g,b,t.shouldReduceMotion&&d_.has(y)?{type:!1}:S,t,T));const _=g.animation;_&&h.push(_)}return c&&Promise.all(h).then(()=>{it.update(()=>{c&&Tq(t,c)})}),h}function F_(t,e,n,r=0,o=1){const u=Array.from(t).sort((m,y)=>m.sortNodePosition(y)).indexOf(e),c=t.size,f=(c-1)*r;return typeof n=="function"?n(u,c):o===1?u*r:f-u*r}function Jm(t,e,n={}){const r=Bo(t,e,n.type==="exit"?t.presenceContext?.custom:void 0);let{transition:o=t.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(o=n.transitionOverride);const u=r?()=>Promise.all(H_(t,r,n)):()=>Promise.resolve(),c=t.variantChildren&&t.variantChildren.size?(h=0)=>{const{delayChildren:m=0,staggerChildren:y,staggerDirection:g}=o;return $q(t,e,h,m,y,g,n)}:()=>Promise.resolve(),{when:f}=o;if(f){const[h,m]=f==="beforeChildren"?[u,c]:[c,u];return h().then(()=>m())}else return Promise.all([u(),c(n.delay)])}function $q(t,e,n=0,r=0,o=0,u=1,c){const f=[];for(const h of t.variantChildren)h.notify("AnimationStart",e),f.push(Jm(h,e,{...c,delay:n+(typeof r=="function"?0:r)+F_(t.variantChildren,h,r,o,u)}).then(()=>h.notify("AnimationComplete",e)));return Promise.all(f)}function jq(t,e,n={}){t.notify("AnimationStart",e);let r;if(Array.isArray(e)){const o=e.map(u=>Jm(t,u,n));r=Promise.all(o)}else if(typeof e=="string")r=Jm(t,e,n);else{const o=typeof e=="function"?Bo(t,e,n.custom):e;r=Promise.all(H_(t,o,n))}return r.then(()=>{t.notify("AnimationComplete",e)})}function G_(t,e){if(!Array.isArray(e))return!1;const n=e.length;if(n!==t.length)return!1;for(let r=0;r<n;r++)if(e[r]!==t[r])return!1;return!0}const Bq=Sg.length;function Y_(t){if(!t)return;if(!t.isControllingVariants){const n=t.parent?Y_(t.parent)||{}:{};return t.props.initial!==void 0&&(n.initial=t.props.initial),n}const e={};for(let n=0;n<Bq;n++){const r=Sg[n],o=t.props[r];(wl(o)||o===!1)&&(e[r]=o)}return e}const zq=[...bg].reverse(),Lq=bg.length;function Vq(t){return e=>Promise.all(e.map(({animation:n,options:r})=>jq(t,n,r)))}function Uq(t){let e=Vq(t),n=l1(),r=!0;const o=h=>(m,y)=>{const g=Bo(t,y,h==="exit"?t.presenceContext?.custom:void 0);if(g){const{transition:b,transitionEnd:S,...x}=g;m={...m,...x,...S}}return m};function u(h){e=h(t)}function c(h){const{props:m}=t,y=Y_(t.parent)||{},g=[],b=new Set;let S={},x=1/0;for(let _=0;_<Lq;_++){const k=zq[_],C=n[k],M=m[k]!==void 0?m[k]:y[k],G=wl(M),I=k===h?C.isActive:null;I===!1&&(x=_);let ee=M===y[k]&&M!==m[k]&&G;if(ee&&r&&t.manuallyAnimateOnMount&&(ee=!1),C.protectedKeys={...S},!C.isActive&&I===null||!M&&!C.prevProp||Bf(M)||typeof M=="boolean")continue;const J=Kq(C.prevProp,M);let X=J||k===h&&C.isActive&&!ee&&G||_>x&&G,he=!1;const pe=Array.isArray(M)?M:[M];let we=pe.reduce(o(k),{});I===!1&&(we={});const{prevResolvedValues:je={}}=C,be={...je,...we},Z=U=>{X=!0,b.has(U)&&(he=!0,b.delete(U)),C.needsAnimating[U]=!0;const L=t.getValue(U);L&&(L.liveStyle=!1)};for(const U in be){const L=we[U],te=je[U];if(S.hasOwnProperty(U))continue;let oe=!1;Gm(L)&&Gm(te)?oe=!G_(L,te):oe=L!==te,oe?L!=null?Z(U):b.add(U):L!==void 0&&b.has(U)?Z(U):C.protectedKeys[U]=!0}C.prevProp=M,C.prevResolvedValues=we,C.isActive&&(S={...S,...we}),r&&t.blockInitialAnimation&&(X=!1);const ne=ee&&J;X&&(!ne||he)&&g.push(...pe.map(U=>{const L={type:k};if(typeof U=="string"&&r&&!ne&&t.manuallyAnimateOnMount&&t.parent){const{parent:te}=t,oe=Bo(te,U);if(te.enteringChildren&&oe){const{delayChildren:E}=oe.transition||{};L.delay=F_(te.enteringChildren,t,E)}}return{animation:U,options:L}}))}if(b.size){const _={};if(typeof m.initial!="boolean"){const k=Bo(t,Array.isArray(m.initial)?m.initial[0]:m.initial);k&&k.transition&&(_.transition=k.transition)}b.forEach(k=>{const C=t.getBaseTarget(k),M=t.getValue(k);M&&(M.liveStyle=!0),_[k]=C??null}),g.push({animation:_})}let T=!!g.length;return r&&(m.initial===!1||m.initial===m.animate)&&!t.manuallyAnimateOnMount&&(T=!1),r=!1,T?e(g):Promise.resolve()}function f(h,m){if(n[h].isActive===m)return Promise.resolve();t.variantChildren?.forEach(g=>g.animationState?.setActive(h,m)),n[h].isActive=m;const y=c(h);for(const g in n)n[g].protectedKeys={};return y}return{animateChanges:c,setActive:f,setAnimateFunction:u,getState:()=>n,reset:()=>{n=l1()}}}function Kq(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!G_(e,t):!1}function ds(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function l1(){return{animate:ds(!0),whileInView:ds(),whileHover:ds(),whileTap:ds(),whileDrag:ds(),whileFocus:ds(),exit:ds()}}class Gr{constructor(e){this.isMounted=!1,this.node=e}update(){}}class qq extends Gr{constructor(e){super(e),e.animationState||(e.animationState=Uq(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();Bf(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:n}=this.node.prevProps||{};e!==n&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}}let Pq=0;class Iq extends Gr{constructor(){super(...arguments),this.id=Pq++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:n}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===r)return;const o=this.node.animationState.setActive("exit",!e);n&&!e&&o.then(()=>{n(this.id)})}mount(){const{register:e,onExitComplete:n}=this.node.presenceContext||{};n&&n(this.id),e&&(this.unmount=e(this.id))}unmount(){}}const Hq={animation:{Feature:qq},exit:{Feature:Iq}};function xl(t,e,n,r={passive:!0}){return t.addEventListener(e,n,r),()=>t.removeEventListener(e,n)}function Ll(t){return{point:{x:t.pageX,y:t.pageY}}}const Fq=t=>e=>vg(e)&&t(e,Ll(e));function ol(t,e,n,r){return xl(t,e,Fq(n),r)}const J_=1e-4,Gq=1-J_,Yq=1+J_,X_=.01,Jq=0-X_,Xq=0+X_;function Wt(t){return t.max-t.min}function Zq(t,e,n){return Math.abs(t-e)<=n}function u1(t,e,n,r=.5){t.origin=r,t.originPoint=rt(e.min,e.max,t.origin),t.scale=Wt(n)/Wt(e),t.translate=rt(n.min,n.max,t.origin)-t.originPoint,(t.scale>=Gq&&t.scale<=Yq||isNaN(t.scale))&&(t.scale=1),(t.translate>=Jq&&t.translate<=Xq||isNaN(t.translate))&&(t.translate=0)}function al(t,e,n,r){u1(t.x,e.x,n.x,r?r.originX:void 0),u1(t.y,e.y,n.y,r?r.originY:void 0)}function c1(t,e,n){t.min=n.min+e.min,t.max=t.min+Wt(e)}function Qq(t,e,n){c1(t.x,e.x,n.x),c1(t.y,e.y,n.y)}function f1(t,e,n){t.min=e.min-n.min,t.max=t.min+Wt(e)}function sf(t,e,n){f1(t.x,e.x,n.x),f1(t.y,e.y,n.y)}function zn(t){return[t("x"),t("y")]}const Z_=({current:t})=>t?t.ownerDocument.defaultView:null,d1=(t,e)=>Math.abs(t-e);function Wq(t,e){const n=d1(t.x,e.x),r=d1(t.y,e.y);return Math.sqrt(n**2+r**2)}class Q_{constructor(e,n,{transformPagePoint:r,contextWindow:o=window,dragSnapToOrigin:u=!1,distanceThreshold:c=3}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const b=Lp(this.lastMoveEventInfo,this.history),S=this.startEvent!==null,x=Wq(b.offset,{x:0,y:0})>=this.distanceThreshold;if(!S&&!x)return;const{point:T}=b,{timestamp:_}=Ht;this.history.push({...T,timestamp:_});const{onStart:k,onMove:C}=this.handlers;S||(k&&k(this.lastMoveEvent,b),this.startEvent=this.lastMoveEvent),C&&C(this.lastMoveEvent,b)},this.handlePointerMove=(b,S)=>{this.lastMoveEvent=b,this.lastMoveEventInfo=zp(S,this.transformPagePoint),it.update(this.updatePoint,!0)},this.handlePointerUp=(b,S)=>{this.end();const{onEnd:x,onSessionEnd:T,resumeAnimation:_}=this.handlers;if(this.dragSnapToOrigin&&_&&_(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const k=Lp(b.type==="pointercancel"?this.lastMoveEventInfo:zp(S,this.transformPagePoint),this.history);this.startEvent&&x&&x(b,k),T&&T(b,k)},!vg(e))return;this.dragSnapToOrigin=u,this.handlers=n,this.transformPagePoint=r,this.distanceThreshold=c,this.contextWindow=o||window;const f=Ll(e),h=zp(f,this.transformPagePoint),{point:m}=h,{timestamp:y}=Ht;this.history=[{...m,timestamp:y}];const{onSessionStart:g}=n;g&&g(e,Lp(h,this.history)),this.removeListeners=jl(ol(this.contextWindow,"pointermove",this.handlePointerMove),ol(this.contextWindow,"pointerup",this.handlePointerUp),ol(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),Vr(this.updatePoint)}}function zp(t,e){return e?{point:e(t.point)}:t}function h1(t,e){return{x:t.x-e.x,y:t.y-e.y}}function Lp({point:t},e){return{point:t,delta:h1(t,W_(e)),offset:h1(t,e6(e)),velocity:t6(e,.1)}}function e6(t){return t[0]}function W_(t){return t[t.length-1]}function t6(t,e){if(t.length<2)return{x:0,y:0};let n=t.length-1,r=null;const o=W_(t);for(;n>=0&&(r=t[n],!(o.timestamp-r.timestamp>pi(e)));)n--;if(!r)return{x:0,y:0};const u=Un(o.timestamp-r.timestamp);if(u===0)return{x:0,y:0};const c={x:(o.x-r.x)/u,y:(o.y-r.y)/u};return c.x===1/0&&(c.x=0),c.y===1/0&&(c.y=0),c}function n6(t,{min:e,max:n},r){return e!==void 0&&t<e?t=r?rt(e,t,r.min):Math.max(t,e):n!==void 0&&t>n&&(t=r?rt(n,t,r.max):Math.min(t,n)),t}function p1(t,e,n){return{min:e!==void 0?t.min+e:void 0,max:n!==void 0?t.max+n-(t.max-t.min):void 0}}function i6(t,{top:e,left:n,bottom:r,right:o}){return{x:p1(t.x,n,o),y:p1(t.y,e,r)}}function m1(t,e){let n=e.min-t.min,r=e.max-t.max;return e.max-e.min<t.max-t.min&&([n,r]=[r,n]),{min:n,max:r}}function r6(t,e){return{x:m1(t.x,e.x),y:m1(t.y,e.y)}}function s6(t,e){let n=.5;const r=Wt(t),o=Wt(e);return o>r?n=vl(e.min,e.max-r,t.min):r>o&&(n=vl(t.min,t.max-o,e.min)),Wi(0,1,n)}function o6(t,e){const n={};return e.min!==void 0&&(n.min=e.min-t.min),e.max!==void 0&&(n.max=e.max-t.min),n}const Xm=.35;function a6(t=Xm){return t===!1?t=0:t===!0&&(t=Xm),{x:y1(t,"left","right"),y:y1(t,"top","bottom")}}function y1(t,e,n){return{min:g1(t,e),max:g1(t,n)}}function g1(t,e){return typeof t=="number"?t:t[e]||0}const l6=new WeakMap;class u6{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=Ct(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:n=!1,distanceThreshold:r}={}){const{presenceContext:o}=this.visualElement;if(o&&o.isPresent===!1)return;const u=g=>{const{dragSnapToOrigin:b}=this.getProps();b?this.pauseAnimation():this.stopAnimation(),n&&this.snapToCursor(Ll(g).point)},c=(g,b)=>{const{drag:S,dragPropagation:x,onDragStart:T}=this.getProps();if(S&&!x&&(this.openDragLock&&this.openDragLock(),this.openDragLock=SK(S),!this.openDragLock))return;this.latestPointerEvent=g,this.latestPanInfo=b,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),zn(k=>{let C=this.getAxisMotionValue(k).get()||0;if(mi.test(C)){const{projection:M}=this.visualElement;if(M&&M.layout){const G=M.layout.layoutBox[k];G&&(C=Wt(G)*(parseFloat(C)/100))}}this.originPoint[k]=C}),T&&it.postRender(()=>T(g,b)),Ym(this.visualElement,"transform");const{animationState:_}=this.visualElement;_&&_.setActive("whileDrag",!0)},f=(g,b)=>{this.latestPointerEvent=g,this.latestPanInfo=b;const{dragPropagation:S,dragDirectionLock:x,onDirectionLock:T,onDrag:_}=this.getProps();if(!S&&!this.openDragLock)return;const{offset:k}=b;if(x&&this.currentDirection===null){this.currentDirection=c6(k),this.currentDirection!==null&&T&&T(this.currentDirection);return}this.updateAxis("x",b.point,k),this.updateAxis("y",b.point,k),this.visualElement.render(),_&&_(g,b)},h=(g,b)=>{this.latestPointerEvent=g,this.latestPanInfo=b,this.stop(g,b),this.latestPointerEvent=null,this.latestPanInfo=null},m=()=>zn(g=>this.getAnimationState(g)==="paused"&&this.getAxisMotionValue(g).animation?.play()),{dragSnapToOrigin:y}=this.getProps();this.panSession=new Q_(e,{onSessionStart:u,onStart:c,onMove:f,onSessionEnd:h,resumeAnimation:m},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:y,distanceThreshold:r,contextWindow:Z_(this.visualElement)})}stop(e,n){const r=e||this.latestPointerEvent,o=n||this.latestPanInfo,u=this.isDragging;if(this.cancel(),!u||!o||!r)return;const{velocity:c}=o;this.startAnimation(c);const{onDragEnd:f}=this.getProps();f&&it.postRender(()=>f(r,o))}cancel(){this.isDragging=!1;const{projection:e,animationState:n}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(e,n,r){const{drag:o}=this.getProps();if(!r||!gc(e,o,this.currentDirection))return;const u=this.getAxisMotionValue(e);let c=this.originPoint[e]+r[e];this.constraints&&this.constraints[e]&&(c=n6(c,this.constraints[e],this.elastic[e])),u.set(c)}resolveConstraints(){const{dragConstraints:e,dragElastic:n}=this.getProps(),r=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,o=this.constraints;e&&Eo(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&r?this.constraints=i6(r.layoutBox,e):this.constraints=!1,this.elastic=a6(n),o!==this.constraints&&r&&this.constraints&&!this.hasMutatedConstraints&&zn(u=>{this.constraints!==!1&&this.getAxisMotionValue(u)&&(this.constraints[u]=o6(r.layoutBox[u],this.constraints[u]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:n}=this.getProps();if(!e||!Eo(e))return!1;const r=e.current,{projection:o}=this.visualElement;if(!o||!o.layout)return!1;const u=fq(r,o.root,this.visualElement.getTransformPagePoint());let c=r6(o.layout.layoutBox,u);if(n){const f=n(lq(c));this.hasMutatedConstraints=!!f,f&&(c=B_(f))}return c}startAnimation(e){const{drag:n,dragMomentum:r,dragElastic:o,dragTransition:u,dragSnapToOrigin:c,onDragTransitionEnd:f}=this.getProps(),h=this.constraints||{},m=zn(y=>{if(!gc(y,n,this.currentDirection))return;let g=h&&h[y]||{};c&&(g={min:0,max:0});const b=o?200:1e6,S=o?40:1e7,x={type:"inertia",velocity:r?e[y]:0,bounceStiffness:b,bounceDamping:S,timeConstant:750,restDelta:1,restSpeed:10,...u,...g};return this.startAxisValueAnimation(y,x)});return Promise.all(m).then(f)}startAxisValueAnimation(e,n){const r=this.getAxisMotionValue(e);return Ym(this.visualElement,e),r.start(_g(e,r,0,n,this.visualElement,!1))}stopAnimation(){zn(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){zn(e=>this.getAxisMotionValue(e).animation?.pause())}getAnimationState(e){return this.getAxisMotionValue(e).animation?.state}getAxisMotionValue(e){const n=`_drag${e.toUpperCase()}`,r=this.visualElement.getProps(),o=r[n];return o||this.visualElement.getValue(e,(r.initial?r.initial[e]:void 0)||0)}snapToCursor(e){zn(n=>{const{drag:r}=this.getProps();if(!gc(n,r,this.currentDirection))return;const{projection:o}=this.visualElement,u=this.getAxisMotionValue(n);if(o&&o.layout){const{min:c,max:f}=o.layout.layoutBox[n];u.set(e[n]-rt(c,f,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!Eo(n)||!r||!this.constraints)return;this.stopAnimation();const o={x:0,y:0};zn(c=>{const f=this.getAxisMotionValue(c);if(f&&this.constraints!==!1){const h=f.get();o[c]=s6({min:h,max:h},this.constraints[c])}});const{transformTemplate:u}=this.visualElement.getProps();this.visualElement.current.style.transform=u?u({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.resolveConstraints(),zn(c=>{if(!gc(c,e,null))return;const f=this.getAxisMotionValue(c),{min:h,max:m}=this.constraints[c];f.set(rt(h,m,o[c]))})}addListeners(){if(!this.visualElement.current)return;l6.set(this.visualElement,this);const e=this.visualElement.current,n=ol(e,"pointerdown",h=>{const{drag:m,dragListener:y=!0}=this.getProps();m&&y&&this.start(h)}),r=()=>{const{dragConstraints:h}=this.getProps();Eo(h)&&h.current&&(this.constraints=this.resolveRefConstraints())},{projection:o}=this.visualElement,u=o.addEventListener("measure",r);o&&!o.layout&&(o.root&&o.root.updateScroll(),o.updateLayout()),it.read(r);const c=xl(window,"resize",()=>this.scalePositionWithinConstraints()),f=o.addEventListener("didUpdate",(({delta:h,hasLayoutChanged:m})=>{this.isDragging&&m&&(zn(y=>{const g=this.getAxisMotionValue(y);g&&(this.originPoint[y]+=h[y].translate,g.set(g.get()+h[y].translate))}),this.visualElement.render())}));return()=>{c(),n(),u(),f&&f()}}getProps(){const e=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:r=!1,dragPropagation:o=!1,dragConstraints:u=!1,dragElastic:c=Xm,dragMomentum:f=!0}=e;return{...e,drag:n,dragDirectionLock:r,dragPropagation:o,dragConstraints:u,dragElastic:c,dragMomentum:f}}}function gc(t,e,n){return(e===!0||e===t)&&(n===null||n===t)}function c6(t,e=10){let n=null;return Math.abs(t.y)>e?n="y":Math.abs(t.x)>e&&(n="x"),n}class f6 extends Gr{constructor(e){super(e),this.removeGroupControls=Kn,this.removeListeners=Kn,this.controls=new u6(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Kn}unmount(){this.removeGroupControls(),this.removeListeners()}}const v1=t=>(e,n)=>{t&&it.postRender(()=>t(e,n))};class d6 extends Gr{constructor(){super(...arguments),this.removePointerDownListener=Kn}onPointerDown(e){this.session=new Q_(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:Z_(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:n,onPan:r,onPanEnd:o}=this.node.getProps();return{onSessionStart:v1(e),onStart:v1(n),onMove:r,onEnd:(u,c)=>{delete this.session,o&&it.postRender(()=>o(u,c))}}}mount(){this.removePointerDownListener=ol(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const Dc={hasAnimatedSinceResize:!0,hasEverUpdated:!1};let Vp=!1;class h6 extends N.Component{componentDidMount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:r,layoutId:o}=this.props,{projection:u}=e;u&&(n.group&&n.group.add(u),r&&r.register&&o&&r.register(u),Vp&&u.root.didUpdate(),u.addEventListener("animationComplete",()=>{this.safeToRemove()}),u.setOptions({...u.options,onExitComplete:()=>this.safeToRemove()})),Dc.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:n,visualElement:r,drag:o,isPresent:u}=this.props,{projection:c}=r;return c&&(c.isPresent=u,Vp=!0,o||e.layoutDependency!==n||n===void 0||e.isPresent!==u?c.willUpdate():this.safeToRemove(),e.isPresent!==u&&(u?c.promote():c.relegate()||it.postRender(()=>{const f=c.getStack();(!f||!f.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),gg.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:o}=e;Vp=!0,o&&(o.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(o),r&&r.deregister&&r.deregister(o))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function eR(t){const[e,n]=kK(),r=N.useContext(MO);return F.jsx(h6,{...t,layoutGroup:r,switchLayoutGroup:N.useContext($_),isPresent:e,safeToRemove:n})}function p6(t,e,n){const r=Jt(t)?t:Io(t);return r.start(_g("",r,e,n)),r.animation}const m6=(t,e)=>t.depth-e.depth;class y6{constructor(){this.children=[],this.isDirty=!1}add(e){Wy(this.children,e),this.isDirty=!0}remove(e){eg(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(m6),this.isDirty=!1,this.children.forEach(e)}}function g6(t,e){const n=fn.now(),r=({timestamp:o})=>{const u=o-n;u>=e&&(Vr(r),t(u-e))};return it.setup(r,!0),()=>Vr(r)}const tR=["TopLeft","TopRight","BottomLeft","BottomRight"],v6=tR.length,b1=t=>typeof t=="string"?parseFloat(t):t,S1=t=>typeof t=="number"||de.test(t);function b6(t,e,n,r,o,u){o?(t.opacity=rt(0,n.opacity??1,S6(r)),t.opacityExit=rt(e.opacity??1,0,w6(r))):u&&(t.opacity=rt(e.opacity??1,n.opacity??1,r));for(let c=0;c<v6;c++){const f=`border${tR[c]}Radius`;let h=w1(e,f),m=w1(n,f);if(h===void 0&&m===void 0)continue;h||(h=0),m||(m=0),h===0||m===0||S1(h)===S1(m)?(t[f]=Math.max(rt(b1(h),b1(m),r),0),(mi.test(m)||mi.test(h))&&(t[f]+="%")):t[f]=m}(e.rotate||n.rotate)&&(t.rotate=rt(e.rotate||0,n.rotate||0,r))}function w1(t,e){return t[e]!==void 0?t[e]:t.borderRadius}const S6=nR(0,.5,qO),w6=nR(.5,.95,Kn);function nR(t,e,n){return r=>r<t?0:r>e?1:n(vl(t,e,r))}function x1(t,e){t.min=e.min,t.max=e.max}function Yn(t,e){x1(t.x,e.x),x1(t.y,e.y)}function T1(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}function A1(t,e,n,r,o){return t-=e,t=rf(t,1/n,r),o!==void 0&&(t=rf(t,1/o,r)),t}function x6(t,e=0,n=1,r=.5,o,u=t,c=t){if(mi.test(e)&&(e=parseFloat(e),e=rt(c.min,c.max,e/100)-c.min),typeof e!="number")return;let f=rt(u.min,u.max,r);t===u&&(f-=e),t.min=A1(t.min,e,n,f,o),t.max=A1(t.max,e,n,f,o)}function E1(t,e,[n,r,o],u,c){x6(t,e[n],e[r],e[o],e.scale,u,c)}const T6=["x","scaleX","originX"],A6=["y","scaleY","originY"];function O1(t,e,n,r){E1(t.x,e,T6,n?n.x:void 0,r?r.x:void 0),E1(t.y,e,A6,n?n.y:void 0,r?r.y:void 0)}function _1(t){return t.translate===0&&t.scale===1}function iR(t){return _1(t.x)&&_1(t.y)}function R1(t,e){return t.min===e.min&&t.max===e.max}function E6(t,e){return R1(t.x,e.x)&&R1(t.y,e.y)}function k1(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function rR(t,e){return k1(t.x,e.x)&&k1(t.y,e.y)}function C1(t){return Wt(t.x)/Wt(t.y)}function M1(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}class O6{constructor(){this.members=[]}add(e){Wy(this.members,e),e.scheduleRender()}remove(e){if(eg(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(e){const n=this.members.findIndex(o=>e===o);if(n===0)return!1;let r;for(let o=n;o>=0;o--){const u=this.members[o];if(u.isPresent!==!1){r=u;break}}return r?(this.promote(r),!0):!1}promote(e,n){const r=this.lead;if(e!==r&&(this.prevLead=r,this.lead=e,e.show(),r)){r.instance&&r.scheduleRender(),e.scheduleRender(),e.resumeFrom=r,n&&(e.resumeFrom.preserveOpacity=!0),r.snapshot&&(e.snapshot=r.snapshot,e.snapshot.latestValues=r.animationValues||r.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);const{crossfade:o}=e.options;o===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const{options:n,resumingFrom:r}=e;n.onExitComplete&&n.onExitComplete(),r&&r.options.onExitComplete&&r.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function _6(t,e,n){let r="";const o=t.x.translate/e.x,u=t.y.translate/e.y,c=n?.z||0;if((o||u||c)&&(r=`translate3d(${o}px, ${u}px, ${c}px) `),(e.x!==1||e.y!==1)&&(r+=`scale(${1/e.x}, ${1/e.y}) `),n){const{transformPerspective:m,rotate:y,rotateX:g,rotateY:b,skewX:S,skewY:x}=n;m&&(r=`perspective(${m}px) ${r}`),y&&(r+=`rotate(${y}deg) `),g&&(r+=`rotateX(${g}deg) `),b&&(r+=`rotateY(${b}deg) `),S&&(r+=`skewX(${S}deg) `),x&&(r+=`skewY(${x}deg) `)}const f=t.x.scale*e.x,h=t.y.scale*e.y;return(f!==1||h!==1)&&(r+=`scale(${f}, ${h})`),r||"none"}const Up=["","X","Y","Z"],R6=1e3;let k6=0;function Kp(t,e,n,r){const{latestValues:o}=e;o[t]&&(n[t]=o[t],e.setStaticValue(t,0),r&&(r[t]=0))}function sR(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const n=I_(e);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:o,layoutId:u}=t.options;window.MotionCancelOptimisedAnimation(n,"transform",it,!(o||u))}const{parent:r}=t;r&&!r.hasCheckedOptimisedAppear&&sR(r)}function oR({attachResizeListener:t,defaultParent:e,measureScroll:n,checkIsScrollRoot:r,resetTransform:o}){return class{constructor(c={},f=e?.()){this.id=k6++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(D6),this.nodes.forEach(B6),this.nodes.forEach(z6),this.nodes.forEach(N6)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=c,this.root=f?f.root||f:this,this.path=f?[...f.path,f]:[],this.parent=f,this.depth=f?f.depth+1:0;for(let h=0;h<this.path.length;h++)this.path[h].shouldResetTransform=!0;this.root===this&&(this.nodes=new y6)}addEventListener(c,f){return this.eventHandlers.has(c)||this.eventHandlers.set(c,new ig),this.eventHandlers.get(c).add(f)}notifyListeners(c,...f){const h=this.eventHandlers.get(c);h&&h.notify(...f)}hasListeners(c){return this.eventHandlers.has(c)}mount(c){if(this.instance)return;this.isSVG=w_(c)&&!OK(c),this.instance=c;const{layoutId:f,layout:h,visualElement:m}=this.options;if(m&&!m.current&&m.mount(c),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(h||f)&&(this.isLayoutDirty=!0),t){let y,g=0;const b=()=>this.root.updateBlockedByResize=!1;it.read(()=>{g=window.innerWidth}),t(c,()=>{const S=window.innerWidth;S!==g&&(g=S,this.root.updateBlockedByResize=!0,y&&y(),y=g6(b,250),Dc.hasAnimatedSinceResize&&(Dc.hasAnimatedSinceResize=!1,this.nodes.forEach($1)))})}f&&this.root.registerSharedNode(f,this),this.options.animate!==!1&&m&&(f||h)&&this.addEventListener("didUpdate",({delta:y,hasLayoutChanged:g,hasRelativeLayoutChanged:b,layout:S})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const x=this.options.transition||m.getDefaultTransition()||q6,{onLayoutAnimationStart:T,onLayoutAnimationComplete:_}=m.getProps(),k=!this.targetLayout||!rR(this.targetLayout,S),C=!g&&b;if(this.options.layoutRoot||this.resumeFrom||C||g&&(k||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const M={...mg(x,"layout"),onPlay:T,onComplete:_};(m.shouldReduceMotion||this.options.layoutRoot)&&(M.delay=0,M.type=!1),this.startAnimation(M),this.setAnimationOrigin(y,C)}else g||$1(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=S})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const c=this.getStack();c&&c.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),Vr(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(L6),this.animationId++)}getTransformTemplate(){const{visualElement:c}=this.options;return c&&c.getProps().transformTemplate}willUpdate(c=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&sR(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let y=0;y<this.path.length;y++){const g=this.path[y];g.shouldResetTransform=!0,g.updateScroll("snapshot"),g.options.layoutRoot&&g.willUpdate(!1)}const{layoutId:f,layout:h}=this.options;if(f===void 0&&!h)return;const m=this.getTransformTemplate();this.prevTransformTemplateValue=m?m(this.latestValues,""):void 0,this.updateSnapshot(),c&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(D1);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(N1);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(j6),this.nodes.forEach(C6),this.nodes.forEach(M6)):this.nodes.forEach(N1),this.clearAllSnapshots();const f=fn.now();Ht.delta=Wi(0,1e3/60,f-Ht.timestamp),Ht.timestamp=f,Ht.isProcessing=!0,kp.update.process(Ht),kp.preRender.process(Ht),kp.render.process(Ht),Ht.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,gg.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach($6),this.sharedNodes.forEach(V6)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,it.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){it.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!Wt(this.snapshot.measuredBox.x)&&!Wt(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let h=0;h<this.path.length;h++)this.path[h].updateScroll();const c=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected=Ct(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:f}=this.options;f&&f.notify("LayoutMeasure",this.layout.layoutBox,c?c.layoutBox:void 0)}updateScroll(c="measure"){let f=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===c&&(f=!1),f&&this.instance){const h=r(this.instance);this.scroll={animationId:this.root.animationId,phase:c,isRoot:h,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:h}}}resetTransform(){if(!o)return;const c=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,f=this.projectionDelta&&!iR(this.projectionDelta),h=this.getTransformTemplate(),m=h?h(this.latestValues,""):void 0,y=m!==this.prevTransformTemplateValue;c&&this.instance&&(f||ms(this.latestValues)||y)&&(o(this.instance,m),this.shouldResetTransform=!1,this.scheduleRender())}measure(c=!0){const f=this.measurePageBox();let h=this.removeElementScroll(f);return c&&(h=this.removeTransform(h)),P6(h),{animationId:this.root.animationId,measuredBox:f,layoutBox:h,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:c}=this.options;if(!c)return Ct();const f=c.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(I6))){const{scroll:m}=this.root;m&&(Oo(f.x,m.offset.x),Oo(f.y,m.offset.y))}return f}removeElementScroll(c){const f=Ct();if(Yn(f,c),this.scroll?.wasRoot)return f;for(let h=0;h<this.path.length;h++){const m=this.path[h],{scroll:y,options:g}=m;m!==this.root&&y&&g.layoutScroll&&(y.wasRoot&&Yn(f,c),Oo(f.x,y.offset.x),Oo(f.y,y.offset.y))}return f}applyTransform(c,f=!1){const h=Ct();Yn(h,c);for(let m=0;m<this.path.length;m++){const y=this.path[m];!f&&y.options.layoutScroll&&y.scroll&&y!==y.root&&_o(h,{x:-y.scroll.offset.x,y:-y.scroll.offset.y}),ms(y.latestValues)&&_o(h,y.latestValues)}return ms(this.latestValues)&&_o(h,this.latestValues),h}removeTransform(c){const f=Ct();Yn(f,c);for(let h=0;h<this.path.length;h++){const m=this.path[h];if(!m.instance||!ms(m.latestValues))continue;Im(m.latestValues)&&m.updateSnapshot();const y=Ct(),g=m.measurePageBox();Yn(y,g),O1(f,m.latestValues,m.snapshot?m.snapshot.layoutBox:void 0,y)}return ms(this.latestValues)&&O1(f,this.latestValues),f}setTargetDelta(c){this.targetDelta=c,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(c){this.options={...this.options,...c,crossfade:c.crossfade!==void 0?c.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==Ht.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(c=!1){const f=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=f.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=f.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=f.isSharedProjectionDirty);const h=!!this.resumingFrom||this!==f;if(!(c||h&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:y,layoutId:g}=this.options;if(!this.layout||!(y||g))return;this.resolvedRelativeTargetAt=Ht.timestamp;const b=this.getClosestProjectingParent();b&&this.linkedParentVersion!==b.layoutVersion&&!b.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(b&&b.layout?this.createRelativeTarget(b,this.layout.layoutBox,b.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=Ct(),this.targetWithTransforms=Ct()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),Qq(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):Yn(this.target,this.layout.layoutBox),L_(this.target,this.targetDelta)):Yn(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,b&&!!b.resumingFrom==!!this.resumingFrom&&!b.options.layoutScroll&&b.target&&this.animationProgress!==1?this.createRelativeTarget(b,this.target,b.target):this.relativeParent=this.relativeTarget=void 0))}getClosestProjectingParent(){if(!(!this.parent||Im(this.parent.latestValues)||z_(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(c,f,h){this.relativeParent=c,this.linkedParentVersion=c.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Ct(),this.relativeTargetOrigin=Ct(),sf(this.relativeTargetOrigin,f,h),Yn(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){const c=this.getLead(),f=!!this.resumingFrom||this!==c;let h=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(h=!1),f&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(h=!1),this.resolvedRelativeTargetAt===Ht.timestamp&&(h=!1),h)return;const{layout:m,layoutId:y}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(m||y))return;Yn(this.layoutCorrected,this.layout.layoutBox);const g=this.treeScale.x,b=this.treeScale.y;cq(this.layoutCorrected,this.treeScale,this.path,f),c.layout&&!c.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(c.target=c.layout.layoutBox,c.targetWithTransforms=Ct());const{target:S}=c;if(!S){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(T1(this.prevProjectionDelta.x,this.projectionDelta.x),T1(this.prevProjectionDelta.y,this.projectionDelta.y)),al(this.projectionDelta,this.layoutCorrected,S,this.latestValues),(this.treeScale.x!==g||this.treeScale.y!==b||!M1(this.projectionDelta.x,this.prevProjectionDelta.x)||!M1(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",S))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(c=!0){if(this.options.visualElement?.scheduleRender(),c){const f=this.getStack();f&&f.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=Ro(),this.projectionDelta=Ro(),this.projectionDeltaWithTransform=Ro()}setAnimationOrigin(c,f=!1){const h=this.snapshot,m=h?h.latestValues:{},y={...this.latestValues},g=Ro();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!f;const b=Ct(),S=h?h.source:void 0,x=this.layout?this.layout.source:void 0,T=S!==x,_=this.getStack(),k=!_||_.members.length<=1,C=!!(T&&!k&&this.options.crossfade===!0&&!this.path.some(K6));this.animationProgress=0;let M;this.mixTargetDelta=G=>{const I=G/1e3;j1(g.x,c.x,I),j1(g.y,c.y,I),this.setTargetDelta(g),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(sf(b,this.layout.layoutBox,this.relativeParent.layout.layoutBox),U6(this.relativeTarget,this.relativeTargetOrigin,b,I),M&&E6(this.relativeTarget,M)&&(this.isProjectionDirty=!1),M||(M=Ct()),Yn(M,this.relativeTarget)),T&&(this.animationValues=y,b6(y,m,this.latestValues,I,C,k)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=I},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(c){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(Vr(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=it.update(()=>{Dc.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=Io(0)),this.currentAnimation=p6(this.motionValue,[0,1e3],{...c,velocity:0,isSync:!0,onUpdate:f=>{this.mixTargetDelta(f),c.onUpdate&&c.onUpdate(f)},onStop:()=>{},onComplete:()=>{c.onComplete&&c.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const c=this.getStack();c&&c.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(R6),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const c=this.getLead();let{targetWithTransforms:f,target:h,layout:m,latestValues:y}=c;if(!(!f||!h||!m)){if(this!==c&&this.layout&&m&&aR(this.options.animationType,this.layout.layoutBox,m.layoutBox)){h=this.target||Ct();const g=Wt(this.layout.layoutBox.x);h.x.min=c.target.x.min,h.x.max=h.x.min+g;const b=Wt(this.layout.layoutBox.y);h.y.min=c.target.y.min,h.y.max=h.y.min+b}Yn(f,h),_o(f,y),al(this.projectionDeltaWithTransform,this.layoutCorrected,f,y)}}registerSharedNode(c,f){this.sharedNodes.has(c)||this.sharedNodes.set(c,new O6),this.sharedNodes.get(c).add(f);const m=f.options.initialPromotionConfig;f.promote({transition:m?m.transition:void 0,preserveFollowOpacity:m&&m.shouldPreserveFollowOpacity?m.shouldPreserveFollowOpacity(f):void 0})}isLead(){const c=this.getStack();return c?c.lead===this:!0}getLead(){const{layoutId:c}=this.options;return c?this.getStack()?.lead||this:this}getPrevLead(){const{layoutId:c}=this.options;return c?this.getStack()?.prevLead:void 0}getStack(){const{layoutId:c}=this.options;if(c)return this.root.sharedNodes.get(c)}promote({needsReset:c,transition:f,preserveFollowOpacity:h}={}){const m=this.getStack();m&&m.promote(this,h),c&&(this.projectionDelta=void 0,this.needsReset=!0),f&&this.setOptions({transition:f})}relegate(){const c=this.getStack();return c?c.relegate(this):!1}resetSkewAndRotation(){const{visualElement:c}=this.options;if(!c)return;let f=!1;const{latestValues:h}=c;if((h.z||h.rotate||h.rotateX||h.rotateY||h.rotateZ||h.skewX||h.skewY)&&(f=!0),!f)return;const m={};h.z&&Kp("z",c,m,this.animationValues);for(let y=0;y<Up.length;y++)Kp(`rotate${Up[y]}`,c,m,this.animationValues),Kp(`skew${Up[y]}`,c,m,this.animationValues);c.render();for(const y in m)c.setStaticValue(y,m[y]),this.animationValues&&(this.animationValues[y]=m[y]);c.scheduleRender()}applyProjectionStyles(c,f){if(!this.instance||this.isSVG)return;if(!this.isVisible){c.visibility="hidden";return}const h=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,c.visibility="",c.opacity="",c.pointerEvents=Mc(f?.pointerEvents)||"",c.transform=h?h(this.latestValues,""):"none";return}const m=this.getLead();if(!this.projectionDelta||!this.layout||!m.target){this.options.layoutId&&(c.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,c.pointerEvents=Mc(f?.pointerEvents)||""),this.hasProjected&&!ms(this.latestValues)&&(c.transform=h?h({},""):"none",this.hasProjected=!1);return}c.visibility="";const y=m.animationValues||m.latestValues;this.applyTransformsToTarget();let g=_6(this.projectionDeltaWithTransform,this.treeScale,y);h&&(g=h(y,g)),c.transform=g;const{x:b,y:S}=this.projectionDelta;c.transformOrigin=`${b.origin*100}% ${S.origin*100}% 0`,m.animationValues?c.opacity=m===this?y.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:y.opacityExit:c.opacity=m===this?y.opacity!==void 0?y.opacity:"":y.opacityExit!==void 0?y.opacityExit:0;for(const x in Pm){if(y[x]===void 0)continue;const{correct:T,applyTo:_,isCSSVariable:k}=Pm[x],C=g==="none"?y[x]:T(y[x],m);if(_){const M=_.length;for(let G=0;G<M;G++)c[_[G]]=C}else k?this.options.visualElement.renderState.vars[x]=C:c[x]=C}this.options.layoutId&&(c.pointerEvents=m===this?Mc(f?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(c=>c.currentAnimation?.stop()),this.root.nodes.forEach(D1),this.root.sharedNodes.clear()}}}function C6(t){t.updateLayout()}function M6(t){const e=t.resumeFrom?.snapshot||t.snapshot;if(t.isLead()&&t.layout&&e&&t.hasListeners("didUpdate")){const{layoutBox:n,measuredBox:r}=t.layout,{animationType:o}=t.options,u=e.source!==t.layout.source;o==="size"?zn(y=>{const g=u?e.measuredBox[y]:e.layoutBox[y],b=Wt(g);g.min=n[y].min,g.max=g.min+b}):aR(o,e.layoutBox,n)&&zn(y=>{const g=u?e.measuredBox[y]:e.layoutBox[y],b=Wt(n[y]);g.max=g.min+b,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[y].max=t.relativeTarget[y].min+b)});const c=Ro();al(c,n,e.layoutBox);const f=Ro();u?al(f,t.applyTransform(r,!0),e.measuredBox):al(f,n,e.layoutBox);const h=!iR(c);let m=!1;if(!t.resumeFrom){const y=t.getClosestProjectingParent();if(y&&!y.resumeFrom){const{snapshot:g,layout:b}=y;if(g&&b){const S=Ct();sf(S,e.layoutBox,g.layoutBox);const x=Ct();sf(x,n,b.layoutBox),rR(S,x)||(m=!0),y.options.layoutRoot&&(t.relativeTarget=x,t.relativeTargetOrigin=S,t.relativeParent=y)}}}t.notifyListeners("didUpdate",{layout:n,snapshot:e,delta:f,layoutDelta:c,hasLayoutChanged:h,hasRelativeLayoutChanged:m})}else if(t.isLead()){const{onExitComplete:n}=t.options;n&&n()}t.options.transition=void 0}function D6(t){t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=!!(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function N6(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function $6(t){t.clearSnapshot()}function D1(t){t.clearMeasurements()}function N1(t){t.isLayoutDirty=!1}function j6(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function $1(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function B6(t){t.resolveTargetDelta()}function z6(t){t.calcProjection()}function L6(t){t.resetSkewAndRotation()}function V6(t){t.removeLeadSnapshot()}function j1(t,e,n){t.translate=rt(e.translate,0,n),t.scale=rt(e.scale,1,n),t.origin=e.origin,t.originPoint=e.originPoint}function B1(t,e,n,r){t.min=rt(e.min,n.min,r),t.max=rt(e.max,n.max,r)}function U6(t,e,n,r){B1(t.x,e.x,n.x,r),B1(t.y,e.y,n.y,r)}function K6(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const q6={duration:.45,ease:[.4,0,.1,1]},z1=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),L1=z1("applewebkit/")&&!z1("chrome/")?Math.round:Kn;function V1(t){t.min=L1(t.min),t.max=L1(t.max)}function P6(t){V1(t.x),V1(t.y)}function aR(t,e,n){return t==="position"||t==="preserve-aspect"&&!Zq(C1(e),C1(n),.2)}function I6(t){return t!==t.root&&t.scroll?.wasRoot}const H6=oR({attachResizeListener:(t,e)=>xl(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),qp={current:void 0},lR=oR({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!qp.current){const t=new H6({});t.mount(window),t.setOptions({layoutScroll:!0}),qp.current=t}return qp.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),F6={pan:{Feature:d6},drag:{Feature:f6,ProjectionNode:lR,MeasureLayout:eR}};function U1(t,e,n){const{props:r}=t;t.animationState&&r.whileHover&&t.animationState.setActive("whileHover",n==="Start");const o="onHover"+n,u=r[o];u&&it.postRender(()=>u(e,Ll(e)))}class G6 extends Gr{mount(){const{current:e}=this.node;e&&(this.unmount=wK(e,(n,r)=>(U1(this.node,r,"Start"),o=>U1(this.node,o,"End"))))}unmount(){}}class Y6 extends Gr{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=jl(xl(this.node.current,"focus",()=>this.onFocus()),xl(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function K1(t,e,n){const{props:r}=t;if(t.current instanceof HTMLButtonElement&&t.current.disabled)return;t.animationState&&r.whileTap&&t.animationState.setActive("whileTap",n==="Start");const o="onTap"+(n==="End"?"":n),u=r[o];u&&it.postRender(()=>u(e,Ll(e)))}class J6 extends Gr{mount(){const{current:e}=this.node;e&&(this.unmount=EK(e,(n,r)=>(K1(this.node,r,"Start"),(o,{success:u})=>K1(this.node,o,u?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const Zm=new WeakMap,Pp=new WeakMap,X6=t=>{const e=Zm.get(t.target);e&&e(t)},Z6=t=>{t.forEach(X6)};function Q6({root:t,...e}){const n=t||document;Pp.has(n)||Pp.set(n,{});const r=Pp.get(n),o=JSON.stringify(e);return r[o]||(r[o]=new IntersectionObserver(Z6,{root:t,...e})),r[o]}function W6(t,e,n){const r=Q6(e);return Zm.set(t,n),r.observe(t),()=>{Zm.delete(t),r.unobserve(t)}}const e5={some:0,all:1};class t5 extends Gr{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:n,margin:r,amount:o="some",once:u}=e,c={root:n?n.current:void 0,rootMargin:r,threshold:typeof o=="number"?o:e5[o]},f=h=>{const{isIntersecting:m}=h;if(this.isInView===m||(this.isInView=m,u&&!m&&this.hasEnteredView))return;m&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",m);const{onViewportEnter:y,onViewportLeave:g}=this.node.getProps(),b=m?y:g;b&&b(h)};return W6(this.node.current,c,f)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:n}=this.node;["amount","margin","root"].some(n5(e,n))&&this.startObserver()}unmount(){}}function n5({viewport:t={}},{viewport:e={}}={}){return n=>t[n]!==e[n]}const i5={inView:{Feature:t5},tap:{Feature:J6},focus:{Feature:Y6},hover:{Feature:G6}},r5={layout:{ProjectionNode:lR,MeasureLayout:eR}},s5={...Hq,...i5,...F6,...r5},o5=aq(s5,Sq);function a5(){const t=Qn(Po),e=Qn(fi),n=Qn(Gi),r=At(Po),o=At(fi),u=At(Gi),c=`email-${N.useId()}`,f=`password-${N.useId()}`,h=`one-time-code-${N.useId()}`,[m,y]=N.useState(null),[g,b]=N.useState("email"),S=`form-${N.useId()}`;return N.useEffect(()=>{if(u.length===6){const x=document.getElementById(S);x instanceof HTMLFormElement&&x.requestSubmit()}},[u]),F.jsx("form",{id:S,onSubmit:async x=>{x.preventDefault();const T=nt(li);try{switch(g){case"email":{const{nextStep:_,userKey:k}=await cn.declareAuthTarget.query({email:r});switch(De(li,k),_){case"otc_login":case"otc_verify":{b("otc");break}case"password_login":{b("password");break}}break}case"otc":{if(!T){console.error("somehow userKey is null");return}const _=await cn.verifyAccountAction.mutate({oneTimeCode:u,userKey:T});De(ut,_),gi.once("connect",()=>{_s("/game"),t(""),n("")});break}case"password":{const _=await cn.openSession.mutate({email:r,password:o});De(ut,_),gi.once("connect",()=>{_s("/game"),t(""),e("")});break}}}catch(_){_ instanceof gl&&y(_.message)}},children:F.jsxs("main",{children:[m?F.jsx("aside",{children:m}):null,F.jsxs(o5.label,{htmlFor:c,children:[F.jsx("span",{children:"Email"}),F.jsx("input",{id:c,type:"text",value:r,onChange:x=>{t(x.target.value)},autoComplete:"email",autoCapitalize:"none",disabled:g!=="email"})]}),g==="password"?F.jsxs("label",{htmlFor:f,children:[F.jsx("span",{children:"Password"}),F.jsx("input",{id:f,type:"password",value:o,onChange:x=>{e(x.target.value)},autoComplete:"current-password",autoCapitalize:"none",autoFocus:g==="password"})]}):null,g==="otc"?F.jsxs("label",{htmlFor:h,children:[F.jsx("span",{children:"One-time Code"}),F.jsx("input",{id:h,type:"number",inputMode:"numeric",enterKeyHint:"go",value:u,onChange:x=>{n(x.target.value)},autoComplete:"one-time-code",autoCapitalize:"none",autoFocus:g==="otc"})]}):null,F.jsxs("footer",{children:[g==="password"?F.jsx("button",{type:"button",onClick:async()=>{const x=nt(li);if(!x)return new Error("No userKey");await cn.startPasswordReset.mutate({userKey:x}),b("otc")},children:"Forgot Password?"}):null,F.jsx("span",{}),F.jsx("button",{type:"submit",disabled:!r&&g==="email"||!o&&g==="password"||!u&&g==="otc",children:">>->"})]})]})})}function l5({route:[,t]}){const e=At(ut),n=At(Gi),r=Qn(Gi),o=`code-${N.useId()}`;return N.useEffect(()=>{t&&r(t)},[]),e?F.jsx("form",{onSubmit:async u=>{u.preventDefault();try{const c=await cn.verifyAccountAction.mutate({oneTimeCode:n,userKey:"CHANGEME"});De(ut,c),c.action==="resetPassword"?_s("/account"):_s("/game")}catch(c){console.error(c)}},children:F.jsxs("main",{children:[F.jsx("p",{children:"Check your email for a verification code."}),F.jsxs("label",{htmlFor:o,children:[F.jsx("span",{children:"Verification code"}),F.jsx("input",{id:o,type:"text",value:n,onChange:u=>{r(u.target.value)},placeholder:"Verification code",autoComplete:"one-time-code",autoCapitalize:"none"})]})]})}):F.jsx("p",{children:"You must be logged in to verify your account."})}Ft.STORE.loggers[0].logLevel="info";function u5(){const t=At(S4),e=At(ut),[n,r]=N.useState(!1),{refs:o,floatingStyles:u,context:c}=X2({open:n,onOpenChange:r,placement:"bottom-end",middleware:[w2(5),T2(),x2()],whileElementsMounted:h2}),f=H2(c),h=Y2(c),m=W2(c),{getReferenceProps:y,getFloatingProps:g}=Z2([f,h,m]),b=At(lV);return F.jsxs("main",{className:Xz.class,children:[F.jsxs("header",{children:[F.jsxs("main",{children:[F.jsx(Jz,{}),F.jsx("span",{children:F.jsx(Zz,{input:b})})]}),F.jsx("button",{"data-css":"profile",ref:o.setReference,...y(),children:e?.username?e.username.slice(0,2):""}),n&&e&&F.jsx(P2,{context:c,modal:!1,children:F.jsxs("div",{"data-css":"profile-actions",ref:o.setFloating,style:u,...g(),children:[F.jsx("span",{children:e.username}),F.jsx("button",{type:"button",onClick:()=>{_s("/account")},children:"Account"}),F.jsx("button",{type:"button",onClick:async()=>{e&&(await cn.closeSession.mutate({username:e.username}),gi.once("disconnect",()=>{De(ut,null),_s("/")}),gi.disconnect())},children:"Sign out"})]})})]}),F.jsx("main",{children:typeof t=="number"?F.jsxs("article",{children:[F.jsx("h1",{children:t}),F.jsx("h2",{children:JSON.parse(HE[t])}),F.jsx(FE,{href:"/",children:"Return to Home Page"})]}):(()=>{switch(t[0]){case void 0:return F.jsx(a5,{});case"admin":return F.jsx(E4,{});case"game":return F.jsx(_4,{route:t});case"verify":return F.jsx(l5,{route:t});case"account":return F.jsx(A4,{})}})()})]})}GM.createRoot(document.getElementById("root")).render(F.jsx(N.StrictMode,{children:F.jsx(VM,{socket:gi,children:F.jsx(u5,{})})}));
|
|
66
|
+
fn("string", ":", "number")(s => s.length)`;class tB extends Hr{$;constructor(e){super((...n)=>new uc(e)(...n),{bind:e}),this.$=e}in(e){return new uc(this.$,e===void 0?void 0:this.$.parse(e))}at(e,n){return new uc(this.$).at(e,n)}case(e,n){return new uc(this.$).case(e,n)}}class uc extends Hr{$;in;key;branches=[];constructor(e,n){super(r=>this.caseEntries(Object.entries(r).map(([o,u])=>o==="default"?[o,u]:[this.$.parse(o),u]))),this.$=e,this.in=n}at(e,n){return this.key&&Y(iB),this.branches.length&&Y(nB),this.key=e,n?this.match(n):this}case(e,n){return this.caseEntry(this.$.parse(e),n)}caseEntry(e,n){const o=(this.key?this.$.parse({[this.key]:e}):e).pipe(n);return this.branches.push(o),this}match(e){return this(e)}strings(e){return this.caseEntries(Object.entries(e).map(([n,r])=>n==="default"?[n,r]:[this.$.node("unit",{unit:n}),r]))}caseEntries(e){for(let n=0;n<e.length;n++){const[r,o]=e[n];if(r==="default")return n!==e.length-1&&Y("default may only be specified as the last key of a switch definition"),this.default(o);if(typeof o!="function")return Y(`Value for case "${r}" must be a function (was ${ei(o)})`);this.caseEntry(r,o)}return this}default(e){typeof e=="function"&&this.case(me.unknown,e);const n={branches:this.branches,ordered:!0};(e==="never"||e==="assert")&&(n.meta={onFail:ex});const r=this.$.node("union",n);if(!this.in)return this.$.finalize(r);let o=this.in.pipe(r);return(e==="never"||e==="assert")&&(o=o.configureReferences({onFail:ex},"self")),this.$.finalize(o)}}const ex=t=>t.throw(),nB="A key matcher must be specified before the first case i.e. match.at('foo') or match.in<object>().at('bar')",iB="At most one key matcher may be specified per expression",NE=(t,e)=>{if(Xt(t)){if(t[1]==="=")return[e.$.parseOwnDefinitionFormat(t[0],e),"=",t[2]];if(t[1]==="?")return[e.$.parseOwnDefinitionFormat(t[0],e),"?"]}return UE(t,e)},rB="Only required keys may make their values optional, e.g. { [mySymbol]: ['number', '?'] }",sB="Only required keys may specify default values, e.g. { value: 'number = 0' }",oB=(t,e)=>{let n;const r={},o=Ic(t);for(const[c,f]of o){const h=uB(c);if(h.kind==="spread"){if(!Ol(r))return Y(lB);const S=e.$.parseOwnDefinitionFormat(f,e);if(S.equals(me.object))continue;if(!S.hasKind("intersection")||!S.basis?.equals(me.object))return Y(cB(S.expression));n=S.structure;continue}if(h.kind==="undeclared"){f!=="reject"&&f!=="delete"&&f!=="ignore"&&Y(aB(f)),r.undeclared=f;continue}const m=NE(f,e),y=h;if(h.kind==="required"){Xt(m)?vp(r,"optional",m[1]==="="?{key:h.normalized,value:m[0],default:m[2]}:{key:h.normalized,value:m[0]},e):vp(r,"required",{key:h.normalized,value:m},e);continue}if(Xt(m)&&(m[1]==="?"&&Y(rB),m[1]==="="&&Y(sB)),h.kind==="optional"){vp(r,"optional",{key:h.normalized,value:m},e);continue}const g=e.$.parseOwnDefinitionFormat(y.normalized,e),b=pm(g,m,e.$);b.index&&(r.index=Fe(r.index,b.index)),b.required&&(r.required=Fe(r.required,b.required))}const u=e.$.node("structure",r);return e.$.parseSchema({domain:"object",structure:n?.merge(u)??u})},vp=(t,e,n,r)=>{t[e]=Fe(t[e],r.$.node(e,n))},aB=t=>`Value of '+' key must be 'reject', 'delete', or 'ignore' (was ${Ie(t)})`,lB="Spread operator may only be used as the first key in an object",uB=t=>typeof t=="symbol"?{kind:"required",normalized:t}:t[t.length-1]==="?"?t[t.length-2]===tl?{kind:"required",normalized:`${t.slice(0,-2)}?`}:{kind:"optional",normalized:t.slice(0,-1)}:t[0]==="["&&t[t.length-1]==="]"?{kind:"index",normalized:t.slice(1,-1)}:t[0]===tl&&t[1]==="["&&t[t.length-1]==="]"?{kind:"required",normalized:t.slice(1)}:t==="..."?{kind:"spread"}:t==="+"?{kind:"undeclared"}:{kind:"required",normalized:t==="\\..."?"...":t==="\\+"?"+":t},cB=t=>`Spread operand must resolve to an object literal type (was ${t})`,fB=(t,e)=>wB(t)?zE[t[0]](t,e):bB(t)?BE[t[1]](t,e):null,dB=(t,e)=>e.$.parseOwnDefinitionFormat(t[1],e).keyof(),bp=(t,e)=>{if(t[2]===void 0)return Y(kE(t[1],""));const n=e.$.parseOwnDefinitionFormat(t[0],e),r=e.$.parseOwnDefinitionFormat(t[2],e);if(t[1]==="|")return e.$.node("union",{branches:[n,r]});const o=t[1]==="&"?Qi(n,r,e.$):fm(n,r,e.$);return o instanceof ae?o.throw():o},hB=(t,e)=>e.$.parseOwnDefinitionFormat(t[0],e).array(),pB=(t,e)=>typeof t[2]!="function"?Y($E("=>",t[2])):e.$.parseOwnDefinitionFormat(t[0],e).pipe(t[2]),$E=(t,e)=>`${t===":"?"Narrow":"Morph"} expression requires a function following '${t}' (was ${typeof e})`,mB=(t,e)=>typeof t[2]!="function"?Y($E(":",t[2])):e.$.parseOwnDefinitionFormat(t[0],e).constrain("predicate",t[2]),yB=(t,e)=>e.$.parseOwnDefinitionFormat(t[0],e).configure(t[2],t[3]),jE=t=>t,gB=jE({"[]":hB,"?":()=>Y(AE)}),vB=jE({"|":bp,"&":bp,":":mB,"=>":pB,"|>":bp,"@":yB,"=":()=>Y(EE)}),BE={...gB,...vB},bB=t=>BE[t[1]]!==void 0,SB=t=>t,zE=SB({keyof:dB,instanceof:(t,e)=>{if(typeof t[1]!="function")return Y(tx(rm(t[1])));const n=t.slice(1).map(r=>typeof r=="function"?e.$.node("proto",{proto:r}):Y(tx(rm(r))));return n.length===1?n[0]:e.$.node("union",{branches:n})},"===":(t,e)=>e.$.units(t.slice(1))}),wB=t=>zE[t[0]]!==void 0,tx=t=>`Expected a constructor following 'instanceof' operator (was ${t})`,xB=(t,e)=>{let n=[{}],r=0;for(;r<t.length;){let o=!1;t[r]==="..."&&r<t.length-1&&(o=!0,r++);const u=NE(t[r],e),[c,f,h]=Xt(u)?u:[u];if(r++,o){if(!c.extends(W.intrinsic.Array))return Y(EB(c.expression));n=n.flatMap(m=>c.distribute(y=>AB(SA(m),y)))}else n=n.map(m=>f==="?"?LE(m,c):f==="="?TB(m,c,h):bm(m,c))}return e.$.parseSchema(n.map(o=>Ol(o)?{proto:Array,exactLength:0}:{proto:Array,sequence:o}))},bm=(t,e)=>t.defaultables||t.optionals?Y(t.variadic?rE:OB):(t.variadic?t.postfix=Fe(t.postfix,e):t.prefix=Fe(t.prefix,e),t),LE=(t,e)=>t.variadic?Y(VE):(t.optionals=Fe(t.optionals,e),t),TB=(t,e,n)=>t.variadic?Y(VE):t.optionals?Y(_B):(t.defaultables=Fe(t.defaultables,[[e,n]]),t),nx=(t,e)=>(t.postfix&&Y(ix),t.variadic?t.variadic.equals(e)||Y(ix):t.variadic=e.internal,t),AB=(t,e)=>{const n=e.select({method:"find",kind:"sequence"});if(!n)return nx(t,W.intrinsic.unknown);if(n.prefix)for(const r of n.prefix)bm(t,r);if(n.optionals)for(const r of n.optionals)LE(t,r);if(n.variadic&&nx(t,n.variadic),n.postfix)for(const r of n.postfix)bm(t,r);return t},EB=t=>`Spread element must be an array (was ${t})`,ix="A tuple may have at most one variadic element",OB="A required element may not follow an optional element",VE="An optional element may not follow a variadic element",_B="A defaultable element may not follow an optional element without a default",RB={},UE=(t,e)=>{if(typeof t=="string"){if(e.args&&Object.keys(e.args).some(r=>t.includes(r)))return Qw(t,e);const n=RB[e.$.name]??={};return n[t]??=Qw(t,e)}return Cs(t,"object")?kB(t,e):Y(Sm(ei(t)))},kB=(t,e)=>{const n=_y(t);switch(n){case void 0:return fe(t,"root")?t:"~standard"in t?CB(t,e):oB(t,e);case"Array":return MB(t,e);case"RegExp":return e.$.node("intersection",{domain:"string",pattern:t},{prereduced:!0});case"Function":{const r=wf(t)?t():t;return fe(r,"root")?r:Y(Sm("Function"))}default:return Y(Sm(n??Ie(t)))}},CB=(t,e)=>e.$.intrinsic.unknown.pipe((n,r)=>{const o=t["~standard"].validate(n);if(!o.issues)return o.value;for(const{message:u,path:c}of o.issues)c?c.length?r.error({problem:RN(u),relativePath:c.map(f=>typeof f=="object"?f.key:f)}):r.error({message:u}):r.error({message:u})}),MB=(t,e)=>fB(t,e)??xB(t,e),Sm=t=>`Type definitions must be strings or objects (was ${t})`;class DB extends Hr{constructor(e){const n=Object.assign({errors:Lr,hkt:wi,$:e,raw:e.parse,module:e.constructor.module,scope:e.constructor.scope,declare:e.declare,define:e.define,match:e.match,generic:e.generic,schema:e.schema,keywords:e.ambient,unit:e.unit,enumerated:e.enumerated,instanceOf:e.instanceOf,valueOf:e.valueOf,or:e.or,and:e.and,merge:e.merge,pipe:e.pipe,fn:e.fn},e.ambientAttachments);super((...r)=>{if(r.length===1)return e.parse(r[0]);if(r.length===2&&typeof r[0]=="string"&&r[0][0]==="<"&&r[0][r[0].length-1]===">"){const o=r[0].slice(1,-1),u=e.parseGenericParams(o,{});return new Xc(u,r[1],e,e,null)}return e.parse(r)},{attach:n})}}const ml=W;class kf extends fE{get ambientAttachments(){if(ml.typeAttachments)return this.cacheGetter("ambientAttachments",Ge(ml.typeAttachments,(e,n)=>[e,this.bindReference(n)]))}preparseOwnAliasEntry(e,n){const r=e.indexOf("<");if(r===-1){if(fe(n,"module")||fe(n,"generic"))return[e,n];const c=this.name==="ark"?e:e==="root"?this.name:`${this.name}.${e}`,f=this.resolvedConfig.keywords?.[c];return f&&(n=[n,"@",f]),[e,n]}e[e.length-1]!==">"&&Y("'>' must be the last character of a generic declaration in a scope");const o=e.slice(0,r),u=e.slice(r+1,-1);return[o,()=>{const c=this.parseGenericParams(u,{alias:o});return S$(c,n,this)}]}parseGenericParams(e,n){return vm(new pA(e),[],this.createParseContext({...n,def:e,prefix:"generic"}))}normalizeRootScopeValue(e){return wf(e)&&!fe(e,"generic")?e():e}preparseOwnDefinitionFormat(e,n){return{...n,def:e,prefix:n.alias??"type"}}parseOwnDefinitionFormat(e,n){!(n.alias&&n.alias in this.aliases)&&!n.args&&(n.args={this:n.id});const o=UE(e,n);if(Xt(o)){if(o[1]==="=")return Y(EE);if(o[1]==="?")return Y(AE)}return o}unit=e=>this.units([e]);valueOf=e=>this.units(hN(e));enumerated=(...e)=>this.units(e);instanceOf=e=>this.node("proto",{proto:e},{prereduced:!0});or=(...e)=>this.schema(e.map(n=>this.parse(n)));and=(...e)=>e.reduce((n,r)=>n.and(this.parse(r)),this.intrinsic.unknown);merge=(...e)=>e.reduce((n,r)=>n.merge(this.parse(r)),this.intrinsic.object);pipe=(...e)=>this.intrinsic.unknown.pipe(...e);fn=new Q3(this);match=new tB(this);declare=()=>({type:this.type});define(e){return e}type=new DB(this);static scope=((e,n={})=>new kf(e,n));static module=((e,n={})=>this.scope(e,n).export())}const NB=Object.assign(kf.scope,{define:t=>t}),ze=kf;class $B extends wi{description='merge an object\'s properties onto another like `Merge(User, { isAdmin: "true" })`'}const jB=tr(["base",me.object],["props",me.object])(t=>t.base.merge(t.props),$B),BB=ze.module({Key:me.key,Merge:jB});class zB extends wi{}const LB=tr("element")(t=>{const e=t.element.exclude(me.Array),n=e.array();return e.rawOr(n).pipe(El).distribute(r=>r.assertHasKind("morph").declareOut(n),Ye)},zB),VB=ze.module({root:me.Array,readonly:"root",index:me.nonNegativeIntegerString,liftFrom:LB},{name:"Array"}),wm=Ye(["string",_l.FileConstructor]),UB=wm.rawOr(wm.array()),rx=Ye({meta:"an object representing parsed form data",domain:"object",index:{signature:"string",value:UB}}),KB=ze.module({root:["instanceof",FormData],value:wm,parsed:rx,parse:Ye({in:FormData,morphs:t=>{const e={};for(const[n,r]of t)if(n in e){const o=e[n];typeof o=="string"||o instanceof _l.FileConstructor?e[n]=[o,r]:o.push(r)}else e[n]=r;return e},declaredOut:rx})},{name:"FormData"}),qB=ze.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"}),PB={Boolean:1,Number:1,String:1},IB=ze.module({...Ge({...iA,...sA},(t,e)=>t in PB?[]:[t,["instanceof",e]]),Array:VB,TypedArray:qB,FormData:KB}),HB=Ye({domain:{domain:"number",meta:"a number representing a Unix timestamp"},divisor:{rule:1,meta:"an integer representing a Unix timestamp"},min:{rule:-864e13,meta:"a Unix timestamp after -8640000000000000"},max:{rule:864e13,meta:"a Unix timestamp before 8640000000000000"},meta:"an integer representing a safe Unix timestamp"}),FB=Ye({domain:"number",divisor:1}),KE=ze.module({root:me.number,integer:FB,epoch:HB,safe:Ye({domain:{domain:"number",numberAllowsNaN:!1},min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER}),NaN:["===",Number.NaN],Infinity:["===",Number.POSITIVE_INFINITY],NegativeInfinity:["===",Number.NEGATIVE_INFINITY]},{name:"number"}),et=(t,e,n)=>{const r={domain:"string",pattern:{rule:t.source,flags:t.flags,meta:e}};return n&&(r.meta={format:n}),Ky("intersection",r)},sx=et(Hc,"a well-formed integer string"),qE=ze.module({root:sx,parse:Ye({in:sx,morphs:(t,e)=>{const n=Number.parseInt(t);return Number.isSafeInteger(n)?n:e.error("an integer in the range Number.MIN_SAFE_INTEGER to Number.MAX_SAFE_INTEGER")},declaredOut:me.integer})},{name:"string.integer"}),GB=et(/^[\dA-Fa-f]+$/,"hex characters only"),YB=ze.module({root:et(/^(?:[\d+/A-Za-z]{4})*(?:[\d+/A-Za-z]{2}==|[\d+/A-Za-z]{3}=)?$/,"base64-encoded"),url:et(/^(?:[\w-]{4})*(?:[\w-]{2}(?:==|%3D%3D)?|[\w-]{3}(?:=|%3D)?)?$/,"base64url-encoded")},{name:"string.base64"}),ox=et(/^[A-Z].*$/,"capitalized"),JB=ze.module({root:Ye({in:"string",morphs:t=>t.charAt(0).toUpperCase()+t.slice(1),declaredOut:ox}),preformatted:ox},{name:"string.capitalize"}),XB=t=>{const e=t.replace(/[ -]+/g,"");let n=0,r,o,u=!1;for(let c=e.length-1;c>=0;c--)r=e.substring(c,c+1),o=Number.parseInt(r,10),u?(o*=2,n+=o>=10?o%10+1:o):n+=o,u=!u;return!!(n%10===0&&e)},ZB=/^(?:4\d{12}(?:\d{3,6})?|5[1-5]\d{14}|(222[1-9]|22[3-9]\d|2[3-6]\d{2}|27[01]\d|2720)\d{12}|6(?:011|5\d\d)\d{12,15}|3[47]\d{13}|3(?:0[0-5]|[68]\d)\d{11}|(?:2131|1800|35\d{3})\d{11}|6[27]\d{14}|^(81\d{14,17}))$/,QB=Ye({domain:"string",pattern:{meta:"a credit card number",rule:ZB.source},predicate:{meta:"a credit card number",predicate:XB}}),WB=/^([+-]?\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)?)?)?)?$/,ez=t=>!Number.isNaN(new Date(t).valueOf()),ax=Ye({domain:"string",predicate:{meta:"a parsable date",predicate:ez}}).assertHasKind("intersection"),lx=qE.root.internal.narrow((t,e)=>{const n=Number.parseInt(t),r=KE.epoch(n);return r instanceof Lr?(e.errors.merge(r),!1):!0}).configure({description:"an integer string representing a safe Unix timestamp"},"self").assertHasKind("intersection"),tz=ze.module({root:lx,parse:Ye({in:lx,morphs:t=>new Date(t),declaredOut:me.Date})},{name:"string.date.epoch"}),ux=et(WB,"an ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) date").internal.assertHasKind("intersection"),nz=ze.module({root:ux,parse:Ye({in:ux,morphs:t=>new Date(t),declaredOut:me.Date})},{name:"string.date.iso"}),iz=ze.module({root:ax,parse:Ye({declaredIn:ax,in:"string",morphs:(t,e)=>{const n=new Date(t);return Number.isNaN(n.valueOf())?e.error("a parsable date"):n},declaredOut:me.Date}),iso:nz,epoch:tz},{name:"string.date"}),rz=et(/^[\w%+.-]+@[\d.A-Za-z-]+\.[A-Za-z]{2,}$/,"an email address","email"),cx="(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])",_r=`(${cx}[.]){3}${cx}`,sz=new RegExp(`^${_r}$`),xt="(?:[0-9a-fA-F]{1,4})",oz=new RegExp(`^((?:${xt}:){7}(?:${xt}|:)|(?:${xt}:){6}(?:${_r}|:${xt}|:)|(?:${xt}:){5}(?::${_r}|(:${xt}){1,2}|:)|(?:${xt}:){4}(?:(:${xt}){0,1}:${_r}|(:${xt}){1,3}|:)|(?:${xt}:){3}(?:(:${xt}){0,2}:${_r}|(:${xt}){1,4}|:)|(?:${xt}:){2}(?:(:${xt}){0,3}:${_r}|(:${xt}){1,5}|:)|(?:${xt}:){1}(?:(:${xt}){0,4}:${_r}|(:${xt}){1,6}|:)|(?::((?::${xt}){0,5}:${_r}|(?::${xt}){1,7}|:)))(%[0-9a-zA-Z.]{1,})?$`),az=ze.module({root:["v4 | v6","@","an IP address"],v4:et(sz,"an IPv4 address","ipv4"),v6:et(oz,"an IPv6 address","ipv6")},{name:"string.ip"}),No="a JSON string",PE=t=>{if(!(t instanceof SyntaxError))throw t;return`must be ${No} (${t})`},lz=Ye({meta:No,domain:"string",predicate:{meta:No,predicate:(t,e)=>{try{return JSON.parse(t),!0}catch(n){return e.reject({code:"predicate",expected:No,problem:PE(n)})}}}}),uz=(t,e)=>{if(t.length===0)return e.error({code:"predicate",expected:No,actual:"empty"});try{return JSON.parse(t)}catch(n){return e.error({code:"predicate",expected:No,problem:PE(n)})}},cz=ze.module({root:lz,parse:Ye({meta:"safe JSON string parser",in:"string",morphs:uz,declaredOut:me.jsonObject})},{name:"string.json"}),fx=et(/^[a-z]*$/,"only lowercase letters"),fz=ze.module({root:Ye({in:"string",morphs:t=>t.toLowerCase(),declaredOut:fx}),preformatted:fx},{name:"string.lower"}),IE=["NFC","NFD","NFKC","NFKD"],Nl=Ge(IE,(t,e)=>[e,Ye({domain:"string",predicate:n=>n.normalize(e)===n,meta:`${e}-normalized unicode`})]),Cf=Ge(IE,(t,e)=>[e,Ye({in:"string",morphs:n=>n.normalize(e),declaredOut:Nl[e]})]),dz=ze.module({root:Cf.NFC,preformatted:Nl.NFC},{name:"string.normalize.NFC"}),hz=ze.module({root:Cf.NFD,preformatted:Nl.NFD},{name:"string.normalize.NFD"}),pz=ze.module({root:Cf.NFKC,preformatted:Nl.NFKC},{name:"string.normalize.NFKC"}),mz=ze.module({root:Cf.NFKD,preformatted:Nl.NFKD},{name:"string.normalize.NFKD"}),yz=ze.module({root:"NFC",NFC:dz,NFD:hz,NFKC:pz,NFKD:mz},{name:"string.normalize"}),dx=et(sm,"a well-formed numeric string"),gz=ze.module({root:dx,parse:Ye({in:dx,morphs:t=>Number.parseFloat(t),declaredOut:me.number})},{name:"string.numeric"}),hx="a regex pattern",vz=Ye({domain:"string",predicate:{meta:hx,predicate:(t,e)=>{try{return new RegExp(t),!0}catch(n){return e.reject({code:"predicate",expected:hx,problem:String(n)})}}},meta:{format:"regex"}}),bz=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[A-Za-z-][\dA-Za-z-]*)(?:\.(?:0|[1-9]\d*|\d*[A-Za-z-][\dA-Za-z-]*))*))?(?:\+([\dA-Za-z-]+(?:\.[\dA-Za-z-]+)*))?$/,Sz=et(bz,"a semantic version (see https://semver.org/)"),px=et(/^\S.*\S$|^\S?$/,"trimmed"),wz=ze.module({root:Ye({in:"string",morphs:t=>t.trim(),declaredOut:px}),preformatted:px},{name:"string.trim"}),mx=et(/^[A-Z]*$/,"only uppercase letters"),xz=ze.module({root:Ye({in:"string",morphs:t=>t.toUpperCase(),declaredOut:mx}),preformatted:mx},{name:"string.upper"}),Tz=t=>URL.canParse(t),yx=Ye({domain:"string",predicate:{meta:"a URL string",predicate:Tz},meta:{format:"uri"}}),Az=ze.module({root:yx,parse:Ye({declaredIn:yx,in:"string",morphs:(t,e)=>{try{return new URL(t)}catch{return e.error("a URL string")}},declaredOut:Ye(URL)})},{name:"string.url"}),Ez=ze.module({root:["versioned | nil | max","@",{description:"a UUID",format:"uuid"}],"#nil":"'00000000-0000-0000-0000-000000000000'","#max":"'ffffffff-ffff-ffff-ffff-ffffffffffff'","#versioned":/[\da-f]{8}-[\da-f]{4}-[1-8][\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}/i,v1:et(/^[\da-f]{8}-[\da-f]{4}-1[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv1"),v2:et(/^[\da-f]{8}-[\da-f]{4}-2[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv2"),v3:et(/^[\da-f]{8}-[\da-f]{4}-3[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv3"),v4:et(/^[\da-f]{8}-[\da-f]{4}-4[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv4"),v5:et(/^[\da-f]{8}-[\da-f]{4}-5[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv5"),v6:et(/^[\da-f]{8}-[\da-f]{4}-6[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv6"),v7:et(/^[\da-f]{8}-[\da-f]{4}-7[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv7"),v8:et(/^[\da-f]{8}-[\da-f]{4}-8[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv8")},{name:"string.uuid"}),Oz=ze.module({root:me.string,alpha:et(/^[A-Za-z]*$/,"only letters"),alphanumeric:et(/^[\dA-Za-z]*$/,"only letters and digits 0-9"),hex:GB,base64:YB,capitalize:JB,creditCard:QB,date:iz,digits:et(/^\d*$/,"only digits 0-9"),email:rz,integer:qE,ip:az,json:cz,lower:fz,normalize:yz,numeric:gz,regex:vz,semver:Sz,trim:wz,upper:xz,url:Az,uuid:Ez},{name:"string"}),_z=ze.module({bigint:me.bigint,boolean:me.boolean,false:me.false,never:me.never,null:me.null,number:me.number,object:me.object,string:me.string,symbol:me.symbol,true:me.true,unknown:me.unknown,undefined:me.undefined}),Rz=ze.module({root:me.unknown,any:me.unknown},{name:"unknown"}),kz=ze.module({root:me.jsonObject,stringify:Ky("morph",{in:me.jsonObject,morphs:t=>JSON.stringify(t),declaredOut:me.string})},{name:"object.json"}),Cz=ze.module({root:me.object,json:kz},{name:"object"});class Mz extends wi{description='instantiate an object from an index signature and corresponding value type like `Record("string", "number")`'}const Dz=tr(["K",me.key],"V")(t=>({domain:"object",index:{signature:t.K,value:t.V}}),Mz);class Nz extends wi{description='pick a set of properties from an object like `Pick(User, "name | age")`'}const $z=tr(["T",me.object],["K",me.key])(t=>t.T.pick(t.K),Nz);class jz extends wi{description='omit a set of properties from an object like `Omit(User, "age")`'}const Bz=tr(["T",me.object],["K",me.key])(t=>t.T.omit(t.K),jz);class zz extends wi{description="make all named properties of an object optional like `Partial(User)`"}const Lz=tr(["T",me.object])(t=>t.T.partial(),zz);class Vz extends wi{description="make all named properties of an object required like `Required(User)`"}const Uz=tr(["T",me.object])(t=>t.T.required(),Vz);class Kz extends wi{description='exclude branches of a union like `Exclude("boolean", "true")`'}const qz=tr("T","U")(t=>t.T.exclude(t.U),Kz);class Pz extends wi{description='extract branches of a union like `Extract("0 | false | 1", "number")`'}const Iz=tr("T","U")(t=>t.T.extract(t.U),Pz),Hz=ze.module({Exclude:qz,Extract:Iz,Omit:Bz,Partial:Lz,Pick:$z,Record:Dz,Required:Uz}),Fr=NB({..._z,...Hz,...IB,...BB,string:Oz,number:KE,object:Cz,unknown:Rz},{prereducedAliases:!0,name:"ark"}),jt=Fr.export();Object.assign(ml.ambient,jt);ml.typeAttachments={string:jt.string.root,number:jt.number.root,bigint:jt.bigint,boolean:jt.boolean,symbol:jt.symbol,undefined:jt.undefined,null:jt.null,object:jt.object.root,unknown:jt.unknown.root,false:jt.false,true:jt.true,never:jt.never,arrayIndex:jt.Array.index,Key:jt.Key,Record:jt.Record,Array:jt.Array.root,Date:jt.Date};const Et=Object.assign(Fr.type,ml.typeAttachments);Fr.match;Fr.fn;Fr.generic;Fr.schema;Fr.define;Fr.declare;const HE={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 Fz(t){return Number.parseInt(t,10)}const Gz=Et(HE),Yz=Gz.keyof().pipe(t=>Fz(t));Et([Yz,"string"]);function Jz(t){return F.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 500 101",...t,children:[F.jsx("title",{children:"Tempest Games Logo"}),F.jsx("path",{d:"M155.76.93v59.89h-17.11V7.78h-13.69V.93h30.8Z",style:{fill:"var(--logo-color)",strokeWidth:0}}),F.jsx("path",{d:"M202.91,7.86h-13.18v17.03h13.18v6.84h-13.18v22.24h13.18v6.84h-30.29V.93h30.29v6.93Z",style:{fill:"var(--logo-color)",strokeWidth:0}}),F.jsx("path",{d:"M289.49.93v59.89h-17.11V7.78h-.43c-8.21,0-11.21,5.82-11.21,17.03v36.02h-16.25V24.8c0-11.21-2.99-17.03-11.21-17.03h-.43v53.04h-17.11V.93h18.74c9.92,0,15.31,4.96,18.14,11.21,2.82-6.25,8.21-11.21,18.14-11.21h18.73Z",style:{fill:"var(--logo-color)",strokeWidth:0}}),F.jsx("path",{d:"M352.82,29.68c0,11.72-6.42,19.16-24.55,19.16h-4.53v11.98h-17.11V1.1l46.2-.17v28.75ZM323.73,7.78v34.22h2.48c7.36,0,9.5-4.11,9.5-12.15V7.78h-11.98Z",style:{fill:"var(--logo-color)",strokeWidth:0}}),F.jsx("path",{d:"M396.8,7.86h-13.17v17.03h13.17v6.84h-13.17v22.24h13.17v6.84h-30.28V.93h30.28v6.93Z",style:{fill:"var(--logo-color)",strokeWidth:0}}),F.jsx("path",{d:"M425.9,12.57v14.03h27.89v16.94c0,12.75-1.71,18.13-16.43,18.13h-14.54c-9.58,0-14.03-2.74-14.03-11.97v-5.99h15.4v5.13c0,4.53.77,5.99,4.62,5.99h1.71c5.05,0,6.16-1.46,6.16-6.84v-14.54h-27.89v-16.68c0-13.52,3.85-16.68,18.82-16.68h12.83c8.81,0,13.17,1.54,13.17,10.78v7.19h-15.4v-6.5c0-3.42-1.03-4.62-4.45-4.62h-1.45c-4.28,0-6.42,1.46-6.42,5.65Z",style:{fill:"var(--logo-color)",strokeWidth:0}}),F.jsx("path",{d:"M500,7.78h-13.69v53.04h-17.11V.93h30.8v6.84Z",style:{fill:"var(--logo-color)",strokeWidth:0}}),F.jsx("path",{d:"M155.96,93.78v-3.57h-5.58v-7.14h13.39v17.85h-24.76v-28.56h24.76v7.14h-16.96v14.28h9.15Z",style:{fill:"var(--logo-color)",strokeWidth:0}}),F.jsx("path",{d:"M224.26,100.92h-8.25v-10.71h-8.25v3.57h4.68v7.14h-12.94v-17.85h16.51v-3.57h-16.51v-7.14h24.76v28.56Z",style:{fill:"var(--logo-color)",strokeWidth:0}}),F.jsx("path",{d:"M259.99,72.36h30.57v28.56h-7.81v-21.42h-3.57v21.42h-7.81v-21.42h-3.57v21.42h-7.81v-28.56Z",style:{fill:"var(--logo-color)",strokeWidth:0}}),F.jsx("path",{d:"M343.24,83.08v-3.57h-9.14v14.28h16.96v7.14h-24.76v-28.56h24.76v17.85h-13.38v-7.14h5.57Z",style:{fill:"var(--logo-color)",strokeWidth:0}}),F.jsx("path",{d:"M394.59,79.5v3.57h16.96v17.85h-24.76v-7.14h16.96v-3.57h-16.96v-17.85h24.76v7.14h-16.96Z",style:{fill:"var(--logo-color)",strokeWidth:0}}),F.jsx("path",{d:"M0,63.42v-20.84h20.83L0,63.42ZM100,.92v32.29h-35.42v8.33h-8.33V14.46h-22.92l1.04,7.29h9.38v19.79h-8.33v-8.33H0V.92h100ZM0,100.92v-26.04l6.25-1.04,25-26.04,1.04,1.05-10.42,18.75-4.16,7.29h13.54l3.13-3.12,8.33-22.92h1.04v41.66h3.12l9.38-8.33v-33.33h1.04l8.33,22.92,3.12,3.12h13.54l-4.17-7.29-10.42-19.8,1.04-1.04,25,27.09,6.25,1.04v26.04H0ZM100,42.59v20.84l-20.83-20.84h20.83Z",style:{fill:"var(--logo-color)",strokeWidth:0}})]})}function FE(t){return F.jsx("a",{...t})}const Xz={class:"_class_1riwg_1"},Sp=["⠋","⠙","⠸","⠴","⠦","⠇"];function Zz({input:t}){const e=N.useRef(null),[n,r]=N.useState(typeof t=="string"?t:null);return N.useEffect(()=>{let o=!0,u;if(typeof t=="string")r(t);else{let c=0;u=setInterval(()=>{e.current&&(e.current.textContent=Sp[c],c=(c+1)%Sp.length)},100),t.then(f=>{o&&(clearInterval(u),r(f))})}return()=>{o=!1,u&&clearInterval(u)}},[t]),F.jsx("span",{ref:e,children:n??Sp[0]})}const GE=(t,{stringify:e,parse:n},r)=>({setSelf:o,onSet:u})=>{if(!t)return;const c=t.getItem(r);c!=null&&o(n(c)),u(({newValue:f})=>{if(f==null){t.removeItem(r);return}t.setItem(r,e(f))})},Qz=Object.freeze(Object.defineProperty({__proto__:null,storageSync:GE},Symbol.toStringTag,{value:"Module"}));var Wz=Object.create,YE=Object.defineProperty,eL=Object.getOwnPropertyDescriptor,JE=Object.getOwnPropertyNames,tL=Object.getPrototypeOf,nL=Object.prototype.hasOwnProperty,xi=(t,e)=>function(){return e||(0,t[JE(t)[0]])((e={exports:{}}).exports,e),e.exports},iL=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(var o=JE(e),u=0,c=o.length,f;u<c;u++)f=o[u],!nL.call(t,f)&&f!==n&&YE(t,f,{get:(h=>e[h]).bind(null,f),enumerable:!(r=eL(e,f))||r.enumerable});return t},gt=(t,e,n)=>(n=t!=null?Wz(tL(t)):{},iL(YE(n,"default",{value:t,enumerable:!0}),t)),XE=xi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/typeof.js"(t,e){function n(r){"@babel/helpers - typeof";return e.exports=n=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(o){return typeof o}:function(o){return o&&typeof Symbol=="function"&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},e.exports.__esModule=!0,e.exports.default=e.exports,n(r)}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports}}),rL=xi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js"(t,e){var n=XE().default;function r(o,u){if(n(o)!="object"||!o)return o;var c=o[Symbol.toPrimitive];if(c!==void 0){var f=c.call(o,u||"default");if(n(f)!="object")return f;throw new TypeError("@@toPrimitive must return a primitive value.")}return(u==="string"?String:Number)(o)}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}}),sL=xi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js"(t,e){var n=XE().default,r=rL();function o(u){var c=r(u,"string");return n(c)=="symbol"?c:c+""}e.exports=o,e.exports.__esModule=!0,e.exports.default=e.exports}}),Ms=xi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(t,e){var n=sL();function r(o,u,c){return(u=n(u))in o?Object.defineProperty(o,u,{value:c,enumerable:!0,configurable:!0,writable:!0}):o[u]=c,o}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}}),ti=xi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(t,e){var n=Ms();function r(u,c){var f=Object.keys(u);if(Object.getOwnPropertySymbols){var h=Object.getOwnPropertySymbols(u);c&&(h=h.filter(function(m){return Object.getOwnPropertyDescriptor(u,m).enumerable})),f.push.apply(f,h)}return f}function o(u){for(var c=1;c<arguments.length;c++){var f=arguments[c]!=null?arguments[c]:{};c%2?r(Object(f),!0).forEach(function(h){n(u,h,f[h])}):Object.getOwnPropertyDescriptors?Object.defineProperties(u,Object.getOwnPropertyDescriptors(f)):r(Object(f)).forEach(function(h){Object.defineProperty(u,h,Object.getOwnPropertyDescriptor(f,h))})}return u}e.exports=o,e.exports.__esModule=!0,e.exports.default=e.exports}});function Mf(t){const e={subscribe(n){let r=null,o=!1,u=!1,c=!1;function f(){if(r===null){c=!0;return}u||(u=!0,typeof r=="function"?r():r&&r.unsubscribe())}return r=t({next(h){var m;o||(m=n.next)===null||m===void 0||m.call(n,h)},error(h){var m;o||(o=!0,(m=n.error)===null||m===void 0||m.call(n,h),f())},complete(){var h;o||(o=!0,(h=n.complete)===null||h===void 0||h.call(n),f())}}),c&&f(),{unsubscribe:f}},pipe(...n){return n.reduce(oL,e)}};return e}function oL(t,e){return e(t)}function aL(t){const e=new AbortController;return new Promise((r,o)=>{let u=!1;function c(){u||(u=!0,f.unsubscribe())}e.signal.addEventListener("abort",()=>{o(e.signal.reason)});const f=t.subscribe({next(h){u=!0,r(h),c()},error(h){o(h)},complete(){e.abort(),c()}})})}function lL(t){return e=>{let n=0,r=null;const o=[];function u(){r||(r=e.subscribe({next(f){for(const m of o){var h;(h=m.next)===null||h===void 0||h.call(m,f)}},error(f){for(const m of o){var h;(h=m.error)===null||h===void 0||h.call(m,f)}},complete(){for(const h of o){var f;(f=h.complete)===null||f===void 0||f.call(h)}}}))}function c(){if(n===0&&r){const f=r;r=null,f.unsubscribe()}}return Mf(f=>(n++,o.push(f),u(),{unsubscribe(){n--,c();const h=o.findIndex(m=>m===f);h>-1&&o.splice(h,1)}}))}}function uL(t){let e=t;const n=[],r=c=>{e!==void 0&&c.next(e),n.push(c)},o=c=>{n.splice(n.indexOf(c),1)},u=Mf(c=>(r(c),()=>{o(c)}));return u.next=c=>{if(e!==c){e=c;for(const f of n)f.next(c)}},u.get=()=>e,u}function cL(t){return Mf(e=>{function n(o=0,u=t.op){const c=t.links[o];if(!c)throw new Error("No more links to execute - did you forget to add an ending link?");return c({op:u,next(h){return n(o+1,h)}})}return n().subscribe(e)})}function yl(t){return!!t&&!Array.isArray(t)&&typeof t=="object"}function fL(){return Object.create(null)}var dL=Object.create,ZE=Object.defineProperty,hL=Object.getOwnPropertyDescriptor,QE=Object.getOwnPropertyNames,pL=Object.getPrototypeOf,mL=Object.prototype.hasOwnProperty,$l=(t,e)=>function(){return e||(0,t[QE(t)[0]])((e={exports:{}}).exports,e),e.exports},yL=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(var o=QE(e),u=0,c=o.length,f;u<c;u++)f=o[u],!mL.call(t,f)&&f!==n&&ZE(t,f,{get:(h=>e[h]).bind(null,f),enumerable:!(r=hL(e,f))||r.enumerable});return t},Df=(t,e,n)=>(n=t!=null?dL(pL(t)):{},yL(ZE(n,"default",{value:t,enumerable:!0}),t));const WE=()=>{},gx=t=>{Object.freeze&&Object.freeze(t)};function eO(t,e,n){var r;const o=e.join(".");return(r=n[o])!==null&&r!==void 0||(n[o]=new Proxy(WE,{get(u,c){if(!(typeof c!="string"||c==="then"))return eO(t,[...e,c],n)},apply(u,c,f){const h=e[e.length-1];let m={args:f,path:e};return h==="call"?m={args:f.length>=2?[f[1]]:[],path:e.slice(0,-1)}:h==="apply"&&(m={args:f.length>=2?f[1]:[],path:e.slice(0,-1)}),gx(m.args),gx(m.path),t(m)}})),n[o]}const gL=t=>eO(t,[],fL()),vL=t=>new Proxy(WE,{get(e,n){if(n!=="then")return t(n)}});var tO=$l({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/typeof.js"(t,e){function n(r){"@babel/helpers - typeof";return e.exports=n=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(o){return typeof o}:function(o){return o&&typeof Symbol=="function"&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},e.exports.__esModule=!0,e.exports.default=e.exports,n(r)}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports}}),bL=$l({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js"(t,e){var n=tO().default;function r(o,u){if(n(o)!="object"||!o)return o;var c=o[Symbol.toPrimitive];if(c!==void 0){var f=c.call(o,u||"default");if(n(f)!="object")return f;throw new TypeError("@@toPrimitive must return a primitive value.")}return(u==="string"?String:Number)(o)}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}}),SL=$l({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js"(t,e){var n=tO().default,r=bL();function o(u){var c=r(u,"string");return n(c)=="symbol"?c:c+""}e.exports=o,e.exports.__esModule=!0,e.exports.default=e.exports}}),nO=$l({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(t,e){var n=SL();function r(o,u,c){return(u=n(u))in o?Object.defineProperty(o,u,{value:c,enumerable:!0,configurable:!0,writable:!0}):o[u]=c,o}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}}),Iy=$l({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(t,e){var n=nO();function r(u,c){var f=Object.keys(u);if(Object.getOwnPropertySymbols){var h=Object.getOwnPropertySymbols(u);c&&(h=h.filter(function(m){return Object.getOwnPropertyDescriptor(u,m).enumerable})),f.push.apply(f,h)}return f}function o(u){for(var c=1;c<arguments.length;c++){var f=arguments[c]!=null?arguments[c]:{};c%2?r(Object(f),!0).forEach(function(h){n(u,h,f[h])}):Object.getOwnPropertyDescriptors?Object.defineProperties(u,Object.getOwnPropertyDescriptors(f)):r(Object(f)).forEach(function(h){Object.defineProperty(u,h,Object.getOwnPropertyDescriptor(f,h))})}return u}e.exports=o,e.exports.__esModule=!0,e.exports.default=e.exports}});Df(Iy());Df(nO());var cc=Df(Iy());function wL(t,e){if("error"in t){const r=e.deserialize(t.error);return{ok:!1,error:(0,cc.default)((0,cc.default)({},t),{},{error:r})}}return{ok:!0,result:(0,cc.default)((0,cc.default)({},t.result),(!t.result.type||t.result.type==="data")&&{type:"data",data:e.deserialize(t.result.data)})}}var wp=class extends Error{constructor(){super("Unable to transform response from server")}};function xL(t,e){let n;try{n=wL(t,e)}catch{throw new wp}if(!n.ok&&(!yl(n.error.error)||typeof n.error.error.code!="number"))throw new wp;if(n.ok&&!yl(n.result))throw new wp;return n}Df(Iy());var fc=gt(Ms()),So=gt(ti());function TL(t){return t instanceof gl}function AL(t){return yl(t)&&yl(t.error)&&typeof t.error.code=="number"&&typeof t.error.message=="string"}function EL(t,e){return typeof t=="string"?t:yl(t)&&typeof t.message=="string"?t.message:e}var gl=class Tc extends Error{constructor(e,n){var r,o;const u=n?.cause;super(e,{cause:u}),(0,fc.default)(this,"cause",void 0),(0,fc.default)(this,"shape",void 0),(0,fc.default)(this,"data",void 0),(0,fc.default)(this,"meta",void 0),this.meta=n?.meta,this.cause=u,this.shape=n==null||(r=n.result)===null||r===void 0?void 0:r.error,this.data=n==null||(o=n.result)===null||o===void 0?void 0:o.error.data,this.name="TRPCClientError",Object.setPrototypeOf(this,Tc.prototype)}static from(e,n={}){const r=e;return TL(r)?(n.meta&&(r.meta=(0,So.default)((0,So.default)({},r.meta),n.meta)),r):AL(r)?new Tc(r.error.message,(0,So.default)((0,So.default)({},n),{},{result:r})):new Tc(EL(r,"Unknown error"),(0,So.default)((0,So.default)({},n),{},{cause:r}))}};function OL(t){const e=t;return e?"input"in e?e:{input:e,output:e}:{input:{serialize:n=>n,deserialize:n=>n},output:{serialize:n=>n,deserialize:n=>n}}}const vx=t=>typeof t=="function";function _L(t){if(t)return t;if(typeof window<"u"&&vx(window.fetch))return window.fetch;if(typeof globalThis<"u"&&vx(globalThis.fetch))return globalThis.fetch;throw new Error("No fetch implementation found")}var il=gt(ti());function RL(t){return{url:t.url.toString(),fetch:t.fetch,transformer:OL(t.transformer),methodOverride:t.methodOverride}}function kL(t){const e={};for(let n=0;n<t.length;n++){const r=t[n];e[n]=r}return e}const CL={query:"GET",mutation:"POST",subscription:"PATCH"};function iO(t){return"input"in t?t.transformer.input.serialize(t.input):kL(t.inputs.map(e=>t.transformer.input.serialize(e)))}const rO=t=>{const e=t.url.split("?");let r=e[0].replace(/\/$/,"")+"/"+t.path;const o=[];if(e[1]&&o.push(e[1]),"inputs"in t&&o.push("batch=1"),t.type==="query"||t.type==="subscription"){const u=iO(t);u!==void 0&&t.methodOverride!=="POST"&&o.push(`input=${encodeURIComponent(JSON.stringify(u))}`)}return o.length&&(r+="?"+o.join("&")),r},ML=t=>{if(t.type==="query"&&t.methodOverride!=="POST")return;const e=iO(t);return e!==void 0?JSON.stringify(e):void 0},DL=t=>BL((0,il.default)((0,il.default)({},t),{},{contentTypeHeader:"application/json",getUrl:rO,getBody:ML}));var NL=class extends Error{constructor(){const t="AbortError";super(t),this.name=t,this.message=t}};const $L=t=>{var e;if(t?.aborted)throw(e=t.throwIfAborted)===null||e===void 0||e.call(t),typeof DOMException<"u"?new DOMException("AbortError","AbortError"):new NL};async function jL(t){var e;$L(t.signal);const n=t.getUrl(t),r=t.getBody(t),o=(e=t.methodOverride)!==null&&e!==void 0?e:CL[t.type],u=await(async()=>{const f=await t.headers();return Symbol.iterator in f?Object.fromEntries(f):f})(),c=(0,il.default)((0,il.default)((0,il.default)({},t.contentTypeHeader&&o!=="GET"?{"content-type":t.contentTypeHeader}:{}),t.trpcAcceptHeader?{"trpc-accept":t.trpcAcceptHeader}:void 0),u);return _L(t.fetch)(n,{method:o,signal:t.signal,body:r,headers:c})}async function BL(t){const e={},n=await jL(t);e.response=n;const r=await n.json();return e.responseJSON=r,{json:r,meta:e}}gt(ti());const bx=()=>{throw new Error("Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new")};function Sx(t){let e=null,n=null;const r=()=>{clearTimeout(n),n=null,e=null};function o(f){const h=[[]];let m=0;for(;;){const b=f[m];if(!b)break;const S=h[h.length-1];if(b.aborted){var y;(y=b.reject)===null||y===void 0||y.call(b,new Error("Aborted")),m++;continue}if(t.validate(S.concat(b).map(T=>T.key))){S.push(b),m++;continue}if(S.length===0){var g;(g=b.reject)===null||g===void 0||g.call(b,new Error("Input is too big for a single dispatch")),m++;continue}h.push([])}return h}function u(){const f=o(e);r();for(const h of f){if(!h.length)continue;const m={items:h};for(const g of h)g.batch=m;t.fetch(m.items.map(g=>g.key)).then(async g=>{await Promise.all(g.map(async(S,x)=>{const T=m.items[x];try{var _;const C=await Promise.resolve(S);(_=T.resolve)===null||_===void 0||_.call(T,C)}catch(C){var k;(k=T.reject)===null||k===void 0||k.call(T,C)}T.batch=null,T.reject=null,T.resolve=null}));for(const S of m.items){var b;(b=S.reject)===null||b===void 0||b.call(S,new Error("Missing result")),S.batch=null}}).catch(g=>{for(const S of m.items){var b;(b=S.reject)===null||b===void 0||b.call(S,g),S.batch=null}})}}function c(f){var h;const m={aborted:!1,key:f,batch:null,resolve:bx,reject:bx},y=new Promise((g,b)=>{var S;m.reject=b,m.resolve=g,(S=e)!==null&&S!==void 0||(e=[]),e.push(m)});return(h=n)!==null&&h!==void 0||(n=setTimeout(u)),y}return{load:c}}function zL(...t){const e=new AbortController,n=t.length;let r=0;const o=()=>{++r===n&&e.abort()};for(const u of t)u?.aborted?o():u?.addEventListener("abort",o,{once:!0});return e.signal}var dc=gt(ti());function LL(t){var e,n;const r=RL(t),o=(e=t.maxURLLength)!==null&&e!==void 0?e:1/0,u=(n=t.maxItems)!==null&&n!==void 0?n:1/0;return()=>{const c=y=>({validate(g){if(o===1/0&&u===1/0)return!0;if(g.length>u)return!1;const b=g.map(T=>T.path).join(","),S=g.map(T=>T.input);return rO((0,dc.default)((0,dc.default)({},r),{},{type:y,path:b,inputs:S,signal:null})).length<=o},async fetch(g){const b=g.map(C=>C.path).join(","),S=g.map(C=>C.input),x=zL(...g.map(C=>C.signal)),T=await DL((0,dc.default)((0,dc.default)({},r),{},{path:b,inputs:S,type:y,headers(){return t.headers?typeof t.headers=="function"?t.headers({opList:g}):t.headers:{}},signal:x}));return(Array.isArray(T.json)?T.json:g.map(()=>T.json)).map(C=>({meta:T.meta,json:C}))}}),f=Sx(c("query")),h=Sx(c("mutation")),m={query:f,mutation:h};return({op:y})=>Mf(g=>{if(y.type==="subscription")throw new Error("Subscriptions are unsupported by `httpLink` - use `httpSubscriptionLink` or `wsLink`");const S=m[y.type].load(y);let x;return S.then(T=>{x=T;const _=xL(T.json,r.transformer.output);if(!_.ok){g.error(gl.from(_.error,{meta:T.meta}));return}g.next({context:T.meta,result:_.result}),g.complete()}).catch(T=>{g.error(gl.from(T,{meta:x?.meta}))}),()=>{}})}}gt(ti());const sO=(t,...e)=>typeof t=="function"?t(...e):t;gt(Ms());function VL(){let t,e;return{promise:new Promise((r,o)=>{t=r,e=o}),resolve:t,reject:e}}async function UL(t){const e=await sO(t.url);if(!t.connectionParams)return e;const r=`${e.includes("?")?"&":"?"}connectionParams=1`;return e+r}async function KL(t){const e={method:"connectionParams",data:await sO(t)};return JSON.stringify(e)}gt(Ms());var ps=gt(Ms());function qL(t){const{promise:e,resolve:n,reject:r}=VL();return t.addEventListener("open",()=>{t.removeEventListener("error",r),n()}),t.addEventListener("error",r),e}function PL(t,{intervalMs:e,pongTimeoutMs:n}){let r,o;function u(){r=setTimeout(()=>{t.send("PING"),o=setTimeout(()=>{t.close()},n)},e)}function c(){clearTimeout(r),u()}function f(){clearTimeout(o),c()}t.addEventListener("open",u),t.addEventListener("message",({data:h})=>{clearTimeout(r),u(),h==="PONG"&&f()}),t.addEventListener("close",()=>{clearTimeout(r),clearTimeout(o)})}var IL=class xm{constructor(e){var n;if((0,ps.default)(this,"id",++xm.connectCount),(0,ps.default)(this,"WebSocketPonyfill",void 0),(0,ps.default)(this,"urlOptions",void 0),(0,ps.default)(this,"keepAliveOpts",void 0),(0,ps.default)(this,"wsObservable",uL(null)),(0,ps.default)(this,"openPromise",null),this.WebSocketPonyfill=(n=e.WebSocketPonyfill)!==null&&n!==void 0?n:WebSocket,!this.WebSocketPonyfill)throw new Error("No WebSocket implementation found - you probably don't want to use this on the server, but if you do you need to pass a `WebSocket`-ponyfill");this.urlOptions=e.urlOptions,this.keepAliveOpts=e.keepAlive}get ws(){return this.wsObservable.get()}set ws(e){this.wsObservable.next(e)}isOpen(){return!!this.ws&&this.ws.readyState===this.WebSocketPonyfill.OPEN&&!this.openPromise}isClosed(){return!!this.ws&&(this.ws.readyState===this.WebSocketPonyfill.CLOSING||this.ws.readyState===this.WebSocketPonyfill.CLOSED)}async open(){var e=this;if(e.openPromise)return e.openPromise;e.id=++xm.connectCount;const n=UL(e.urlOptions).then(r=>new e.WebSocketPonyfill(r));e.openPromise=n.then(async r=>{e.ws=r,r.addEventListener("message",function({data:o}){o==="PING"&&this.send("PONG")}),e.keepAliveOpts.enabled&&PL(r,e.keepAliveOpts),r.addEventListener("close",()=>{e.ws===r&&(e.ws=null)}),await qL(r),e.urlOptions.connectionParams&&r.send(await KL(e.urlOptions.connectionParams))});try{await e.openPromise}finally{e.openPromise=null}}async close(){var e=this;try{await e.openPromise}finally{var n;(n=e.ws)===null||n===void 0||n.close()}}};(0,ps.default)(IL,"connectCount",0);gt(Ms());gt(ti());var xp=gt(Ms()),wx=gt(ti()),HL=class{constructor(t){(0,xp.default)(this,"links",void 0),(0,xp.default)(this,"runtime",void 0),(0,xp.default)(this,"requestId",void 0),this.requestId=0,this.runtime={},this.links=t.links.map(e=>e(this.runtime))}$request(t){var e;return cL({links:this.links,op:(0,wx.default)((0,wx.default)({},t),{},{context:(e=t.context)!==null&&e!==void 0?e:{},id:++this.requestId})}).pipe(lL())}async requestAsPromise(t){var e=this;try{const n=e.$request(t);return(await aL(n)).result.data}catch(n){throw gl.from(n)}}query(t,e,n){return this.requestAsPromise({type:"query",path:t,input:e,context:n?.context,signal:n?.signal})}mutation(t,e,n){return this.requestAsPromise({type:"mutation",path:t,input:e,context:n?.context,signal:n?.signal})}subscription(t,e,n){return this.$request({type:"subscription",path:t,input:e,context:n.context,signal:n.signal}).subscribe({next(o){switch(o.result.type){case"state":{var u;(u=n.onConnectionStateChange)===null||u===void 0||u.call(n,o.result);break}case"started":{var c;(c=n.onStarted)===null||c===void 0||c.call(n,{context:o.context});break}case"stopped":{var f;(f=n.onStopped)===null||f===void 0||f.call(n);break}case"data":case void 0:{var h;(h=n.onData)===null||h===void 0||h.call(n,o.result.data);break}}},error(o){var u;(u=n.onError)===null||u===void 0||u.call(n,o)},complete(){var o;(o=n.onComplete)===null||o===void 0||o.call(n)}})}};const FL=Symbol.for("trpc_untypedClient"),GL={query:"query",mutate:"mutation",subscribe:"subscription"},YL=t=>GL[t];function JL(t){const e=gL(({path:n,args:r})=>{const o=[...n],u=YL(o.pop()),c=o.join(".");return t[u](c,...r)});return vL(n=>n===FL?t:e[n])}function XL(t){const e=new HL(t);return JL(e)}gt(ti());gt(ti());var ZL=xi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/asyncIterator.js"(t,e){function n(o){var u,c,f,h=2;for(typeof Symbol<"u"&&(c=Symbol.asyncIterator,f=Symbol.iterator);h--;){if(c&&(u=o[c])!=null)return u.call(o);if(f&&(u=o[f])!=null)return new r(u.call(o));c="@@asyncIterator",f="@@iterator"}throw new TypeError("Object is not async iterable")}function r(o){function u(c){if(Object(c)!==c)return Promise.reject(new TypeError(c+" is not an object."));var f=c.done;return Promise.resolve(c.value).then(function(h){return{value:h,done:f}})}return r=function(f){this.s=f,this.n=f.next},r.prototype={s:null,n:null,next:function(){return u(this.n.apply(this.s,arguments))},return:function(f){var h=this.s.return;return h===void 0?Promise.resolve({value:f,done:!0}):u(h.apply(this.s,arguments))},throw:function(f){var h=this.s.return;return h===void 0?Promise.reject(f):u(h.apply(this.s,arguments))}},new r(o)}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports}});gt(ZL());gt(ti());var QL=xi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/usingCtx.js"(t,e){function n(){var r=typeof SuppressedError=="function"?SuppressedError:function(f,h){var m=Error();return m.name="SuppressedError",m.error=f,m.suppressed=h,m},o={},u=[];function c(f,h){if(h!=null){if(Object(h)!==h)throw new TypeError("using declarations can only be used with objects, functions, null, or undefined.");if(f)var m=h[Symbol.asyncDispose||Symbol.for("Symbol.asyncDispose")];if(m===void 0&&(m=h[Symbol.dispose||Symbol.for("Symbol.dispose")],f))var y=m;if(typeof m!="function")throw new TypeError("Object is not disposable.");y&&(m=function(){try{y.call(h)}catch(b){return Promise.reject(b)}}),u.push({v:h,d:m,a:f})}else f&&u.push({d:h,a:f});return h}return{e:o,u:c.bind(null,!1),a:c.bind(null,!0),d:function(){var h,m=this.e,y=0;function g(){for(;h=u.pop();)try{if(!h.a&&y===1)return y=0,u.push(h),Promise.resolve().then(g);if(h.d){var S=h.d.call(h.v);if(h.a)return y|=2,Promise.resolve(S).then(g,b)}else y|=1}catch(x){return b(x)}if(y===1)return m!==o?Promise.reject(m):Promise.resolve();if(m!==o)throw m}function b(S){return m=m!==o?new r(S,m):S,g()}return g()}}}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports}}),oO=xi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/OverloadYield.js"(t,e){function n(r,o){this.v=r,this.k=o}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports}}),WL=xi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/awaitAsyncGenerator.js"(t,e){var n=oO();function r(o){return new n(o,0)}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}}),eV=xi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/wrapAsyncGenerator.js"(t,e){var n=oO();function r(u){return function(){return new o(u.apply(this,arguments))}}function o(u){var c,f;function h(y,g){try{var b=u[y](g),S=b.value,x=S instanceof n;Promise.resolve(x?S.v:S).then(function(T){if(x){var _=y==="return"?"return":"next";if(!S.k||T.done)return h(_,T);T=u[_](T).value}m(b.done?"return":"normal",T)},function(T){h("throw",T)})}catch(T){m("throw",T)}}function m(y,g){switch(y){case"return":c.resolve({value:g,done:!0});break;case"throw":c.reject(g);break;default:c.resolve({value:g,done:!1})}(c=c.next)?h(c.key,c.arg):f=null}this._invoke=function(y,g){return new Promise(function(b,S){var x={key:y,arg:g,resolve:b,reject:S,next:null};f?f=f.next=x:(c=f=x,h(y,g))})},typeof u.return!="function"&&(this.return=void 0)}o.prototype[typeof Symbol=="function"&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},o.prototype.next=function(u){return this._invoke("next",u)},o.prototype.throw=function(u){return this._invoke("throw",u)},o.prototype.return=function(u){return this._invoke("return",u)},e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}});gt(QL());gt(WL());gt(eV());gt(ti());function aO(t,e){if(t instanceof Promise)throw new Error(e)}function tV(t,e){const n={},r=[];for(const o in t){const u=t[o]["~standard"].validate(e[o]);if(aO(u,`Validation must be synchronous, but ${o} returned a Promise.`),u.issues){r.push(...u.issues.map(c=>({...c,message:c.message,path:[o,...c.path??[]]})));continue}n[o]=u.value}return r.length?{issues:r}:{value:n}}var nV={};function iV(t){const e=t.runtimeEnvStrict??t.runtimeEnv??nV;if(t.emptyStringAsUndefined??!1)for(const[T,_]of Object.entries(e))_===""&&delete e[T];if(t.skipValidation){if(t.extends)for(const T of t.extends)T.skipValidation=!0;return e}const n=typeof t.client=="object"?t.client:{},r=typeof t.server=="object"?t.server:{},o=typeof t.shared=="object"?t.shared:{},u=t.isServer??(typeof window>"u"||"Deno"in window),c=u?{...r,...o,...n}:{...n,...o},f=t.createFinalSchema?.(c,u)?.["~standard"].validate(e)??tV(c,e);aO(f,"Validation must be synchronous");const h=t.onValidationError??(T=>{throw console.error("❌ Invalid environment variables:",T),new Error("Invalid environment variables")}),m=t.onInvalidAccess??(()=>{throw new Error("❌ Attempted to access a server-side environment variable on the client")});if(f.issues)return h(f.issues);const y=T=>t.clientPrefix?!T.startsWith(t.clientPrefix)&&!(T in o):!0,g=T=>u||!y(T),b=T=>T==="__esModule"||T==="$$typeof",S=(t.extends??[]).reduce((T,_)=>Object.assign(T,_),{}),x=Object.assign(S,f.value);return new Proxy(x,{get(T,_){if(typeof _=="string"&&!b(_))return g(_)?Reflect.get(T,_):m(_)}})}const rV={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_BACKEND_ORIGIN:"https://realtime.tempest.games"},sV="__vite_start_time"in globalThis,oV=typeof window<"u",qi=Et("string"),xx=Et('"true" | "false" | undefined'),lO=iV({isServer:!sV&&!oV,server:{CI:Et("string | undefined").pipe(Boolean),POSTGRES_USER:qi,POSTGRES_PASSWORD:qi,POSTGRES_DATABASE:qi,POSTGRES_HOST:qi,POSTGRES_PORT:qi.pipe(t=>Number.parseInt(t,10)),BACKEND_PORT:qi.pipe(t=>Number.parseInt(t,10)),RUN_WORKERS_FROM_SOURCE:xx.pipe(t=>t==="true"),FRONTEND_PORT:qi.pipe(t=>Number.parseInt(t,10)),FRONTEND_ORIGINS:qi.pipe.try(t=>JSON.parse(t),Et("string[]")),API_KEY_OPENAI:Et("string | undefined"),API_KEY_RESEND:Et("string | undefined")},clientPrefix:"VITE_",client:{VITE_BACKEND_ORIGIN:qi,VITE_DEV_FRONTEND_HOST:Et("string | undefined"),VITE_DEV_HTTPS:xx.pipe(t=>t==="true")},runtimeEnv:rV,emptyStringAsUndefined:!0}),cn=XL({links:[LL({url:lO.VITE_BACKEND_ORIGIN,fetch(t,e){return e?(Object.assign(e,{credentials:"include"}),fetch(t,e)):fetch(t)}})]}),aV=ft({key:"appVersionQuery",default:cn.version.query});ft({key:"lastKnownVersion",default:null,effects:[GE(localStorage,JSON,"lastKnownVersion")]});const lV=vi({key:"appVersion",get:async({get:t})=>{const e=t(aV),{version:n}=await e;return n}});function Tp(t){return["optional",t]}function uV(t,e){let n=[t];for(const r of e){if(typeof r!="string")return!1;n=n.flatMap(o=>{if(o===null)return[];const u=[],c=o[1],f=c[r];f!==void 0&&u.push(f);const h=Object.keys(c).find(m=>m.startsWith("$"));if(h){const m=c[h];m&&u.push(m)}return u})}for(const r of n)if(r===null||r[0]==="optional")return!0;return!1}const yi=Object.create(null);yi.open="0";yi.close="1";yi.ping="2";yi.pong="3";yi.message="4";yi.upgrade="5";yi.noop="6";const Ac=Object.create(null);Object.keys(yi).forEach(t=>{Ac[yi[t]]=t});const Tm={type:"error",data:"parser error"},uO=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",cO=typeof ArrayBuffer=="function",fO=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t&&t.buffer instanceof ArrayBuffer,Hy=({type:t,data:e},n,r)=>uO&&e instanceof Blob?n?r(e):Tx(e,r):cO&&(e instanceof ArrayBuffer||fO(e))?n?r(e):Tx(new Blob([e]),r):r(yi[t]+(e||"")),Tx=(t,e)=>{const n=new FileReader;return n.onload=function(){const r=n.result.split(",")[1];e("b"+(r||""))},n.readAsDataURL(t)};function Ax(t){return t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}let Ap;function cV(t,e){if(uO&&t.data instanceof Blob)return t.data.arrayBuffer().then(Ax).then(e);if(cO&&(t.data instanceof ArrayBuffer||fO(t.data)))return e(Ax(t.data));Hy(t,!1,n=>{Ap||(Ap=new TextEncoder),e(Ap.encode(n))})}const Ex="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Wa=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let t=0;t<Ex.length;t++)Wa[Ex.charCodeAt(t)]=t;const fV=t=>{let e=t.length*.75,n=t.length,r,o=0,u,c,f,h;t[t.length-1]==="="&&(e--,t[t.length-2]==="="&&e--);const m=new ArrayBuffer(e),y=new Uint8Array(m);for(r=0;r<n;r+=4)u=Wa[t.charCodeAt(r)],c=Wa[t.charCodeAt(r+1)],f=Wa[t.charCodeAt(r+2)],h=Wa[t.charCodeAt(r+3)],y[o++]=u<<2|c>>4,y[o++]=(c&15)<<4|f>>2,y[o++]=(f&3)<<6|h&63;return m},dV=typeof ArrayBuffer=="function",Fy=(t,e)=>{if(typeof t!="string")return{type:"message",data:dO(t,e)};const n=t.charAt(0);return n==="b"?{type:"message",data:hV(t.substring(1),e)}:Ac[n]?t.length>1?{type:Ac[n],data:t.substring(1)}:{type:Ac[n]}:Tm},hV=(t,e)=>{if(dV){const n=fV(t);return dO(n,e)}else return{base64:!0,data:t}},dO=(t,e)=>{switch(e){case"blob":return t instanceof Blob?t:new Blob([t]);case"arraybuffer":default:return t instanceof ArrayBuffer?t:t.buffer}},hO="",pV=(t,e)=>{const n=t.length,r=new Array(n);let o=0;t.forEach((u,c)=>{Hy(u,!1,f=>{r[c]=f,++o===n&&e(r.join(hO))})})},mV=(t,e)=>{const n=t.split(hO),r=[];for(let o=0;o<n.length;o++){const u=Fy(n[o],e);if(r.push(u),u.type==="error")break}return r};function yV(){return new TransformStream({transform(t,e){cV(t,n=>{const r=n.length;let o;if(r<126)o=new Uint8Array(1),new DataView(o.buffer).setUint8(0,r);else if(r<65536){o=new Uint8Array(3);const u=new DataView(o.buffer);u.setUint8(0,126),u.setUint16(1,r)}else{o=new Uint8Array(9);const u=new DataView(o.buffer);u.setUint8(0,127),u.setBigUint64(1,BigInt(r))}t.data&&typeof t.data!="string"&&(o[0]|=128),e.enqueue(o),e.enqueue(n)})}})}let Ep;function hc(t){return t.reduce((e,n)=>e+n.length,0)}function pc(t,e){if(t[0].length===e)return t.shift();const n=new Uint8Array(e);let r=0;for(let o=0;o<e;o++)n[o]=t[0][r++],r===t[0].length&&(t.shift(),r=0);return t.length&&r<t[0].length&&(t[0]=t[0].slice(r)),n}function gV(t,e){Ep||(Ep=new TextDecoder);const n=[];let r=0,o=-1,u=!1;return new TransformStream({transform(c,f){for(n.push(c);;){if(r===0){if(hc(n)<1)break;const h=pc(n,1);u=(h[0]&128)===128,o=h[0]&127,o<126?r=3:o===126?r=1:r=2}else if(r===1){if(hc(n)<2)break;const h=pc(n,2);o=new DataView(h.buffer,h.byteOffset,h.length).getUint16(0),r=3}else if(r===2){if(hc(n)<8)break;const h=pc(n,8),m=new DataView(h.buffer,h.byteOffset,h.length),y=m.getUint32(0);if(y>Math.pow(2,21)-1){f.enqueue(Tm);break}o=y*Math.pow(2,32)+m.getUint32(4),r=3}else{if(hc(n)<o)break;const h=pc(n,o);f.enqueue(Fy(u?h:Ep.decode(h),e)),r=0}if(o===0||o>t){f.enqueue(Tm);break}}}})}const pO=4;function Ot(t){if(t)return vV(t)}function vV(t){for(var e in Ot.prototype)t[e]=Ot.prototype[e];return t}Ot.prototype.on=Ot.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this};Ot.prototype.once=function(t,e){function n(){this.off(t,n),e.apply(this,arguments)}return n.fn=e,this.on(t,n),this};Ot.prototype.off=Ot.prototype.removeListener=Ot.prototype.removeAllListeners=Ot.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks["$"+t];if(!n)return this;if(arguments.length==1)return delete this._callbacks["$"+t],this;for(var r,o=0;o<n.length;o++)if(r=n[o],r===e||r.fn===e){n.splice(o,1);break}return n.length===0&&delete this._callbacks["$"+t],this};Ot.prototype.emit=function(t){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),n=this._callbacks["$"+t],r=1;r<arguments.length;r++)e[r-1]=arguments[r];if(n){n=n.slice(0);for(var r=0,o=n.length;r<o;++r)n[r].apply(this,e)}return this};Ot.prototype.emitReserved=Ot.prototype.emit;Ot.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]};Ot.prototype.hasListeners=function(t){return!!this.listeners(t).length};const Nf=typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,n)=>n(e,0),Vn=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),bV="arraybuffer";function mO(t,...e){return e.reduce((n,r)=>(t.hasOwnProperty(r)&&(n[r]=t[r]),n),{})}const SV=Vn.setTimeout,wV=Vn.clearTimeout;function $f(t,e){e.useNativeTimers?(t.setTimeoutFn=SV.bind(Vn),t.clearTimeoutFn=wV.bind(Vn)):(t.setTimeoutFn=Vn.setTimeout.bind(Vn),t.clearTimeoutFn=Vn.clearTimeout.bind(Vn))}const xV=1.33;function TV(t){return typeof t=="string"?AV(t):Math.ceil((t.byteLength||t.size)*xV)}function AV(t){let e=0,n=0;for(let r=0,o=t.length;r<o;r++)e=t.charCodeAt(r),e<128?n+=1:e<2048?n+=2:e<55296||e>=57344?n+=3:(r++,n+=4);return n}function yO(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function EV(t){let e="";for(let n in t)t.hasOwnProperty(n)&&(e.length&&(e+="&"),e+=encodeURIComponent(n)+"="+encodeURIComponent(t[n]));return e}function OV(t){let e={},n=t.split("&");for(let r=0,o=n.length;r<o;r++){let u=n[r].split("=");e[decodeURIComponent(u[0])]=decodeURIComponent(u[1])}return e}class _V extends Error{constructor(e,n,r){super(e),this.description=n,this.context=r,this.type="TransportError"}}class Gy extends Ot{constructor(e){super(),this.writable=!1,$f(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,n,r){return super.emitReserved("error",new _V(e,n,r)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(e){this.readyState==="open"&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const n=Fy(e,this.socket.binaryType);this.onPacket(n)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,n={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(n)}_hostname(){const e=this.opts.hostname;return e.indexOf(":")===-1?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(e){const n=EV(e);return n.length?"?"+n:""}}class RV extends Gy{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(e){this.readyState="pausing";const n=()=>{this.readyState="paused",e()};if(this._polling||!this.writable){let r=0;this._polling&&(r++,this.once("pollComplete",function(){--r||n()})),this.writable||(r++,this.once("drain",function(){--r||n()}))}else n()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){const n=r=>{if(this.readyState==="opening"&&r.type==="open"&&this.onOpen(),r.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(r)};mV(e,this.socket.binaryType).forEach(n),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const e=()=>{this.write([{type:"close"}])};this.readyState==="open"?e():this.once("open",e)}write(e){this.writable=!1,pV(e,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const e=this.opts.secure?"https":"http",n=this.query||{};return this.opts.timestampRequests!==!1&&(n[this.opts.timestampParam]=yO()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(e,n)}}let gO=!1;try{gO=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const kV=gO;function CV(){}class MV extends RV{constructor(e){if(super(e),typeof location<"u"){const n=location.protocol==="https:";let r=location.port;r||(r=n?"443":"80"),this.xd=typeof location<"u"&&e.hostname!==location.hostname||r!==e.port}}doWrite(e,n){const r=this.request({method:"POST",data:e});r.on("success",n),r.on("error",(o,u)=>{this.onError("xhr post error",o,u)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(n,r)=>{this.onError("xhr poll error",n,r)}),this.pollXhr=e}}let $o=class Ec extends Ot{constructor(e,n,r){super(),this.createRequest=e,$f(this,r),this._opts=r,this._method=r.method||"GET",this._uri=n,this._data=r.data!==void 0?r.data:null,this._create()}_create(){var e;const n=mO(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this._opts.xd;const r=this._xhr=this.createRequest(n);try{r.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let o in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(o)&&r.setRequestHeader(o,this._opts.extraHeaders[o])}}catch{}if(this._method==="POST")try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{r.setRequestHeader("Accept","*/*")}catch{}(e=this._opts.cookieJar)===null||e===void 0||e.addCookies(r),"withCredentials"in r&&(r.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(r.timeout=this._opts.requestTimeout),r.onreadystatechange=()=>{var o;r.readyState===3&&((o=this._opts.cookieJar)===null||o===void 0||o.parseCookies(r.getResponseHeader("set-cookie"))),r.readyState===4&&(r.status===200||r.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof r.status=="number"?r.status:0)},0))},r.send(this._data)}catch(o){this.setTimeoutFn(()=>{this._onError(o)},0);return}typeof document<"u"&&(this._index=Ec.requestsCount++,Ec.requests[this._index]=this)}_onError(e){this.emitReserved("error",e,this._xhr),this._cleanup(!0)}_cleanup(e){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=CV,e)try{this._xhr.abort()}catch{}typeof document<"u"&&delete Ec.requests[this._index],this._xhr=null}}_onLoad(){const e=this._xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}};$o.requestsCount=0;$o.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",Ox);else if(typeof addEventListener=="function"){const t="onpagehide"in Vn?"pagehide":"unload";addEventListener(t,Ox,!1)}}function Ox(){for(let t in $o.requests)$o.requests.hasOwnProperty(t)&&$o.requests[t].abort()}const DV=(function(){const t=vO({xdomain:!1});return t&&t.responseType!==null})();class NV extends MV{constructor(e){super(e);const n=e&&e.forceBase64;this.supportsBinary=DV&&!n}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new $o(vO,this.uri(),e)}}function vO(t){const e=t.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||kV))return new XMLHttpRequest}catch{}if(!e)try{return new Vn[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const bO=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class $V extends Gy{get name(){return"websocket"}doOpen(){const e=this.uri(),n=this.opts.protocols,r=bO?{}:mO(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,n,r)}catch(o){return this.emitReserved("error",o)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let n=0;n<e.length;n++){const r=e[n],o=n===e.length-1;Hy(r,this.supportsBinary,u=>{try{this.doWrite(r,u)}catch{}o&&Nf(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",n=this.query||{};return this.opts.timestampRequests&&(n[this.opts.timestampParam]=yO()),this.supportsBinary||(n.b64=1),this.createUri(e,n)}}const Op=Vn.WebSocket||Vn.MozWebSocket;class jV extends $V{createSocket(e,n,r){return bO?new Op(e,n,r):n?new Op(e,n):new Op(e)}doWrite(e,n){this.ws.send(n)}}class BV extends Gy{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved("error",e)}this._transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{const n=gV(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=e.readable.pipeThrough(n).getReader(),o=yV();o.readable.pipeTo(e.writable),this._writer=o.writable.getWriter();const u=()=>{r.read().then(({done:f,value:h})=>{f||(this.onPacket(h),u())}).catch(f=>{})};u();const c={type:"open"};this.query.sid&&(c.data=`{"sid":"${this.query.sid}"}`),this._writer.write(c).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let n=0;n<e.length;n++){const r=e[n],o=n===e.length-1;this._writer.write(r).then(()=>{o&&Nf(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)===null||e===void 0||e.close()}}const zV={websocket:jV,webtransport:BV,polling:NV},LV=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,VV=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Am(t){if(t.length>8e3)throw"URI too long";const e=t,n=t.indexOf("["),r=t.indexOf("]");n!=-1&&r!=-1&&(t=t.substring(0,n)+t.substring(n,r).replace(/:/g,";")+t.substring(r,t.length));let o=LV.exec(t||""),u={},c=14;for(;c--;)u[VV[c]]=o[c]||"";return n!=-1&&r!=-1&&(u.source=e,u.host=u.host.substring(1,u.host.length-1).replace(/;/g,":"),u.authority=u.authority.replace("[","").replace("]","").replace(/;/g,":"),u.ipv6uri=!0),u.pathNames=UV(u,u.path),u.queryKey=KV(u,u.query),u}function UV(t,e){const n=/\/{2,9}/g,r=e.replace(n,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&r.splice(0,1),e.slice(-1)=="/"&&r.splice(r.length-1,1),r}function KV(t,e){const n={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,o,u){o&&(n[o]=u)}),n}const Em=typeof addEventListener=="function"&&typeof removeEventListener=="function",Oc=[];Em&&addEventListener("offline",()=>{Oc.forEach(t=>t())},!1);class jr extends Ot{constructor(e,n){if(super(),this.binaryType=bV,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&typeof e=="object"&&(n=e,e=null),e){const r=Am(e);n.hostname=r.host,n.secure=r.protocol==="https"||r.protocol==="wss",n.port=r.port,r.query&&(n.query=r.query)}else n.host&&(n.hostname=Am(n.host).host);$f(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=OV(this.opts.query)),Em&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},Oc.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){const n=Object.assign({},this.opts.query);n.EIO=pO,n.transport=e,this.id&&(n.sid=this.id);const r=Object.assign({},this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](r)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const e=this.opts.rememberUpgrade&&jr.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const n=this.createTransport(e);n.open(),this.setTransport(n)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",n=>this._onClose("transport close",n))}onOpen(){this.readyState="open",jr.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const n=new Error("server error");n.code=e.data,this._onError(n);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data);break}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},e),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let n=1;for(let r=0;r<this.writeBuffer.length;r++){const o=this.writeBuffer[r].data;if(o&&(n+=TV(o)),r>0&&n>this._maxPayload)return this.writeBuffer.slice(0,r);n+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,Nf(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}write(e,n,r){return this._sendPacket("message",e,n,r),this}send(e,n,r){return this._sendPacket("message",e,n,r),this}_sendPacket(e,n,r,o){if(typeof n=="function"&&(o=n,n=void 0),typeof r=="function"&&(o=r,r=null),this.readyState==="closing"||this.readyState==="closed")return;r=r||{},r.compress=r.compress!==!1;const u={type:e,data:n,options:r};this.emitReserved("packetCreate",u),this.writeBuffer.push(u),o&&this.once("flush",o),this.flush()}close(){const e=()=>{this._onClose("forced close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),e()},r=()=>{this.once("upgrade",n),this.once("upgradeError",n)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?r():e()}):this.upgrading?r():e()),this}_onError(e){if(jr.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,n){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),Em&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const r=Oc.indexOf(this._offlineEventListener);r!==-1&&Oc.splice(r,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,n),this.writeBuffer=[],this._prevBufferLen=0}}}jr.protocol=pO;class qV extends jr{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let n=this.createTransport(e),r=!1;jr.priorWebsocketSuccess=!1;const o=()=>{r||(n.send([{type:"ping",data:"probe"}]),n.once("packet",g=>{if(!r)if(g.type==="pong"&&g.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;jr.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{r||this.readyState!=="closed"&&(y(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{const b=new Error("probe error");b.transport=n.name,this.emitReserved("upgradeError",b)}}))};function u(){r||(r=!0,y(),n.close(),n=null)}const c=g=>{const b=new Error("probe error: "+g);b.transport=n.name,u(),this.emitReserved("upgradeError",b)};function f(){c("transport closed")}function h(){c("socket closed")}function m(g){n&&g.name!==n.name&&u()}const y=()=>{n.removeListener("open",o),n.removeListener("error",c),n.removeListener("close",f),this.off("close",h),this.off("upgrading",m)};n.once("open",o),n.once("error",c),n.once("close",f),this.once("close",h),this.once("upgrading",m),this._upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{r||n.open()},200):n.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){const n=[];for(let r=0;r<e.length;r++)~this.transports.indexOf(e[r])&&n.push(e[r]);return n}}let PV=class extends qV{constructor(e,n={}){const r=typeof e=="object"?e:n;(!r.transports||r.transports&&typeof r.transports[0]=="string")&&(r.transports=(r.transports||["polling","websocket","webtransport"]).map(o=>zV[o]).filter(o=>!!o)),super(e,r)}};function IV(t,e="",n){let r=t;n=n||typeof location<"u"&&location,t==null&&(t=n.protocol+"//"+n.host),typeof t=="string"&&(t.charAt(0)==="/"&&(t.charAt(1)==="/"?t=n.protocol+t:t=n.host+t),/^(https?|wss?):\/\//.test(t)||(typeof n<"u"?t=n.protocol+"//"+t:t="https://"+t),r=Am(t)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";const u=r.host.indexOf(":")!==-1?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+u+":"+r.port+e,r.href=r.protocol+"://"+u+(n&&n.port===r.port?"":":"+r.port),r}const HV=typeof ArrayBuffer=="function",FV=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t.buffer instanceof ArrayBuffer,SO=Object.prototype.toString,GV=typeof Blob=="function"||typeof Blob<"u"&&SO.call(Blob)==="[object BlobConstructor]",YV=typeof File=="function"||typeof File<"u"&&SO.call(File)==="[object FileConstructor]";function Yy(t){return HV&&(t instanceof ArrayBuffer||FV(t))||GV&&t instanceof Blob||YV&&t instanceof File}function _c(t,e){if(!t||typeof t!="object")return!1;if(Array.isArray(t)){for(let n=0,r=t.length;n<r;n++)if(_c(t[n]))return!0;return!1}if(Yy(t))return!0;if(t.toJSON&&typeof t.toJSON=="function"&&arguments.length===1)return _c(t.toJSON(),!0);for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&_c(t[n]))return!0;return!1}function JV(t){const e=[],n=t.data,r=t;return r.data=Om(n,e),r.attachments=e.length,{packet:r,buffers:e}}function Om(t,e){if(!t)return t;if(Yy(t)){const n={_placeholder:!0,num:e.length};return e.push(t),n}else if(Array.isArray(t)){const n=new Array(t.length);for(let r=0;r<t.length;r++)n[r]=Om(t[r],e);return n}else if(typeof t=="object"&&!(t instanceof Date)){const n={};for(const r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=Om(t[r],e));return n}return t}function XV(t,e){return t.data=_m(t.data,e),delete t.attachments,t}function _m(t,e){if(!t)return t;if(t&&t._placeholder===!0){if(typeof t.num=="number"&&t.num>=0&&t.num<e.length)return e[t.num];throw new Error("illegal attachments")}else if(Array.isArray(t))for(let n=0;n<t.length;n++)t[n]=_m(t[n],e);else if(typeof t=="object")for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(t[n]=_m(t[n],e));return t}const ZV=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],QV=5;var Ce;(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"})(Ce||(Ce={}));class WV{constructor(e){this.replacer=e}encode(e){return(e.type===Ce.EVENT||e.type===Ce.ACK)&&_c(e)?this.encodeAsBinary({type:e.type===Ce.EVENT?Ce.BINARY_EVENT:Ce.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let n=""+e.type;return(e.type===Ce.BINARY_EVENT||e.type===Ce.BINARY_ACK)&&(n+=e.attachments+"-"),e.nsp&&e.nsp!=="/"&&(n+=e.nsp+","),e.id!=null&&(n+=e.id),e.data!=null&&(n+=JSON.stringify(e.data,this.replacer)),n}encodeAsBinary(e){const n=JV(e),r=this.encodeAsString(n.packet),o=n.buffers;return o.unshift(r),o}}function _x(t){return Object.prototype.toString.call(t)==="[object Object]"}class Jy extends Ot{constructor(e){super(),this.reviver=e}add(e){let n;if(typeof e=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");n=this.decodeString(e);const r=n.type===Ce.BINARY_EVENT;r||n.type===Ce.BINARY_ACK?(n.type=r?Ce.EVENT:Ce.ACK,this.reconstructor=new e4(n),n.attachments===0&&super.emitReserved("decoded",n)):super.emitReserved("decoded",n)}else if(Yy(e)||e.base64)if(this.reconstructor)n=this.reconstructor.takeBinaryData(e),n&&(this.reconstructor=null,super.emitReserved("decoded",n));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+e)}decodeString(e){let n=0;const r={type:Number(e.charAt(0))};if(Ce[r.type]===void 0)throw new Error("unknown packet type "+r.type);if(r.type===Ce.BINARY_EVENT||r.type===Ce.BINARY_ACK){const u=n+1;for(;e.charAt(++n)!=="-"&&n!=e.length;);const c=e.substring(u,n);if(c!=Number(c)||e.charAt(n)!=="-")throw new Error("Illegal attachments");r.attachments=Number(c)}if(e.charAt(n+1)==="/"){const u=n+1;for(;++n&&!(e.charAt(n)===","||n===e.length););r.nsp=e.substring(u,n)}else r.nsp="/";const o=e.charAt(n+1);if(o!==""&&Number(o)==o){const u=n+1;for(;++n;){const c=e.charAt(n);if(c==null||Number(c)!=c){--n;break}if(n===e.length)break}r.id=Number(e.substring(u,n+1))}if(e.charAt(++n)){const u=this.tryParse(e.substr(n));if(Jy.isPayloadValid(r.type,u))r.data=u;else throw new Error("invalid payload")}return r}tryParse(e){try{return JSON.parse(e,this.reviver)}catch{return!1}}static isPayloadValid(e,n){switch(e){case Ce.CONNECT:return _x(n);case Ce.DISCONNECT:return n===void 0;case Ce.CONNECT_ERROR:return typeof n=="string"||_x(n);case Ce.EVENT:case Ce.BINARY_EVENT:return Array.isArray(n)&&(typeof n[0]=="number"||typeof n[0]=="string"&&ZV.indexOf(n[0])===-1);case Ce.ACK:case Ce.BINARY_ACK:return Array.isArray(n)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class e4{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const n=XV(this.reconPack,this.buffers);return this.finishedReconstruction(),n}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const t4=Object.freeze(Object.defineProperty({__proto__:null,Decoder:Jy,Encoder:WV,get PacketType(){return Ce},protocol:QV},Symbol.toStringTag,{value:"Module"}));function Zn(t,e,n){return t.on(e,n),function(){t.off(e,n)}}const n4=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class wO extends Ot{constructor(e,n,r){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=n,r&&r.auth&&(this.auth=r.auth),this._opts=Object.assign({},r),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[Zn(e,"open",this.onopen.bind(this)),Zn(e,"packet",this.onpacket.bind(this)),Zn(e,"error",this.onerror.bind(this)),Zn(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...n){var r,o,u;if(n4.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(n.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(n),this;const c={type:Ce.EVENT,data:n};if(c.options={},c.options.compress=this.flags.compress!==!1,typeof n[n.length-1]=="function"){const y=this.ids++,g=n.pop();this._registerAckCallback(y,g),c.id=y}const f=(o=(r=this.io.engine)===null||r===void 0?void 0:r.transport)===null||o===void 0?void 0:o.writable,h=this.connected&&!(!((u=this.io.engine)===null||u===void 0)&&u._hasPingExpired());return this.flags.volatile&&!f||(h?(this.notifyOutgoingListeners(c),this.packet(c)):this.sendBuffer.push(c)),this.flags={},this}_registerAckCallback(e,n){var r;const o=(r=this.flags.timeout)!==null&&r!==void 0?r:this._opts.ackTimeout;if(o===void 0){this.acks[e]=n;return}const u=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let f=0;f<this.sendBuffer.length;f++)this.sendBuffer[f].id===e&&this.sendBuffer.splice(f,1);n.call(this,new Error("operation has timed out"))},o),c=(...f)=>{this.io.clearTimeoutFn(u),n.apply(this,f)};c.withError=!0,this.acks[e]=c}emitWithAck(e,...n){return new Promise((r,o)=>{const u=(c,f)=>c?o(c):r(f);u.withError=!0,n.push(u),this.emit(e,...n)})}_addToQueue(e){let n;typeof e[e.length-1]=="function"&&(n=e.pop());const r={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((o,...u)=>(this._queue[0],o!==null?r.tryCount>this._opts.retries&&(this._queue.shift(),n&&n(o)):(this._queue.shift(),n&&n(null,...u)),r.pending=!1,this._drainQueue())),this._queue.push(r),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;const n=this._queue[0];n.pending&&!e||(n.pending=!0,n.tryCount++,this.flags=n.flags,this.emit.apply(this,n.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:Ce.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,n){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,n),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(r=>String(r.id)===e)){const r=this.acks[e];delete this.acks[e],r.withError&&r.call(this,new Error("socket has been disconnected"))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case Ce.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case Ce.EVENT:case Ce.BINARY_EVENT:this.onevent(e);break;case Ce.ACK:case Ce.BINARY_ACK:this.onack(e);break;case Ce.DISCONNECT:this.ondisconnect();break;case Ce.CONNECT_ERROR:this.destroy();const r=new Error(e.data.message);r.data=e.data.data,this.emitReserved("connect_error",r);break}}onevent(e){const n=e.data||[];e.id!=null&&n.push(this.ack(e.id)),this.connected?this.emitEvent(n):this.receiveBuffer.push(Object.freeze(n))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const n=this._anyListeners.slice();for(const r of n)r.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]=="string"&&(this._lastOffset=e[e.length-1])}ack(e){const n=this;let r=!1;return function(...o){r||(r=!0,n.packet({type:Ce.ACK,id:e,data:o}))}}onack(e){const n=this.acks[e.id];typeof n=="function"&&(delete this.acks[e.id],n.withError&&e.data.unshift(null),n.apply(this,e.data))}onconnect(e,n){this.id=e,this.recovered=n&&this._pid===n,this._pid=n,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Ce.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const n=this._anyListeners;for(let r=0;r<n.length;r++)if(e===n[r])return n.splice(r,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){const n=this._anyOutgoingListeners;for(let r=0;r<n.length;r++)if(e===n[r])return n.splice(r,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const n=this._anyOutgoingListeners.slice();for(const r of n)r.apply(this,e.data)}}}function Xo(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}Xo.prototype.duration=function(){var t=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),n=Math.floor(e*this.jitter*t);t=(Math.floor(e*10)&1)==0?t-n:t+n}return Math.min(t,this.max)|0};Xo.prototype.reset=function(){this.attempts=0};Xo.prototype.setMin=function(t){this.ms=t};Xo.prototype.setMax=function(t){this.max=t};Xo.prototype.setJitter=function(t){this.jitter=t};class Rm extends Ot{constructor(e,n){var r;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(n=e,e=void 0),n=n||{},n.path=n.path||"/socket.io",this.opts=n,$f(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 Xo({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=e;const o=n.parser||t4;this.encoder=new o.Encoder,this.decoder=new o.Decoder,this._autoConnect=n.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var n;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(n=this.backoff)===null||n===void 0||n.setMin(e),this)}randomizationFactor(e){var n;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(n=this.backoff)===null||n===void 0||n.setJitter(e),this)}reconnectionDelayMax(e){var n;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(n=this.backoff)===null||n===void 0||n.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new PV(this.uri,this.opts);const n=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const o=Zn(n,"open",function(){r.onopen(),e&&e()}),u=f=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",f),e?e(f):this.maybeReconnectOnOpen()},c=Zn(n,"error",u);if(this._timeout!==!1){const f=this._timeout,h=this.setTimeoutFn(()=>{o(),u(new Error("timeout")),n.close()},f);this.opts.autoUnref&&h.unref(),this.subs.push(()=>{this.clearTimeoutFn(h)})}return this.subs.push(o),this.subs.push(c),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(Zn(e,"ping",this.onping.bind(this)),Zn(e,"data",this.ondata.bind(this)),Zn(e,"error",this.onerror.bind(this)),Zn(e,"close",this.onclose.bind(this)),Zn(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(n){this.onclose("parse error",n)}}ondecoded(e){Nf(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,n){let r=this.nsps[e];return r?this._autoConnect&&!r.active&&r.connect():(r=new wO(this,e,n),this.nsps[e]=r),r}_destroy(e){const n=Object.keys(this.nsps);for(const r of n)if(this.nsps[r].active)return;this._close()}_packet(e){const n=this.encoder.encode(e);for(let r=0;r<n.length;r++)this.engine.write(n[r],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(e,n){var r;this.cleanup(),(r=this.engine)===null||r===void 0||r.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,n),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const n=this.backoff.duration();this._reconnecting=!0;const r=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(o=>{o?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",o)):e.onreconnect()}))},n);this.opts.autoUnref&&r.unref(),this.subs.push(()=>{this.clearTimeoutFn(r)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const Ya={};function Rc(t,e){typeof t=="object"&&(e=t,t=void 0),e=e||{};const n=IV(t,e.path||"/socket.io"),r=n.source,o=n.id,u=n.path,c=Ya[o]&&u in Ya[o].nsps,f=e.forceNew||e["force new connection"]||e.multiplex===!1||c;let h;return f?h=new Rm(r,e):(Ya[o]||(Ya[o]=new Rm(r,e)),h=Ya[o]),n.query&&!e.query&&(e.query=n.queryKey),h.socket(n.path,e)}Object.assign(Rc,{Manager:Rm,Socket:wO,io:Rc,connect:Rc});const i4=["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"],r4=3,s4=15,o4=/^[a-zA-Z0-9_-]+$/,a4=Et(o4).pipe(Et(`string > ${r4} & string < ${s4}`)).brand("username"),Rx=20,kx={0:"o",1:"l",3:"e",4:"a",5:"s",7:"t","@":"a",$:"s","!":"i"};function l4(t){let e="";for(const n of t)n in kx?e+=kx[n]:e+=n;return e}function u4(t){const e=t.toLocaleLowerCase(),n=l4(e);for(const r of i4)if(n.includes(r)||e.includes(r))return!0;return!1}function c4(t){const e=new Set(t).size;return t.length*Math.log2(e)}function f4(t){let e=0;return u4(t)&&(e-=100),e+=c4(t)*.5,Math.max(e,0)}const d4=Et("string").narrow((t,e)=>{const n=f4(t);return n>=Rx?!0:e.mustBe(`Of complexity ${Rx} or more. Was ${n.toFixed(2)}.`)}).brand("password");Et({"+":"delete",email:"string",password:"string"});const h4=Et("string").brand("email");Et({"+":"delete",username:"string",password:"string",email:"string"});const p4=Et({email:"string",userId:"string",username:"string",password:"boolean",verification:"'unverified' | 'verified'"}),gi=Rc(lO.VITE_BACKEND_ORIGIN,{auth:t=>{const e=nt(ut);e&&t(e)},withCredentials:!0,autoConnect:!1});gi.on("connect",()=>{console.log("connected")}).on("connect_error",()=>{console.log("connect_error"),De(ut,null)}).on("usernameChanged",t=>{De(ut,e=>e===null?null:{...e,username:t})});const ut=ft({key:"auth",default:function(){const e=localStorage.getItem("auth");if(e)try{const n=qr(e),r=p4(n);return r instanceof Et.errors?(console.error("failed to parse auth data",r),null):(r.verification==="verified"&&(console.log("connecting..."),gi.connect()),r)}catch(n){return console.error("failed to parse auth data",n),null}return null},effects:[function({onSet:e}){e(({newValue:n})=>{console.log("setting auth",n),n?(console.log("setting auth",n),De(jo,n.username),localStorage.setItem("auth",zt(n)),n.verification==="verified"?(console.log("connecting..."),gi.connect()):_s("/verify")):(console.log("clearing session..."),localStorage.removeItem("auth"))})}]}),jo=ft({key:"username",default:nt(ut)?.username??""}),_p=ft({key:"usernameDebounce",default:!0}),m4=ft({key:"usernameDebounced100ms",default:window.localStorage.getItem("username")??"",effects:[({setSelf:t})=>{zC(jo,()=>{nt(_p)&&(t(nt(jo)),De(_p,!1),setTimeout(()=>{De(_p,!0),t(nt(jo))},2e3))})}]}),y4=vi({key:"isUsernameTakenQuery",get:({get:t})=>{const e=t(m4);if(!e)return!1;const n=nt(ut);return e===n?.username?!1:cn.isUsernameTaken.query({username:e})}}),xO=vi({key:"usernameIssues",get:({get:t})=>{const e=t(jo),n=a4(e);return n instanceof Et.errors?n:null}}),fi=ft({key:"password0",default:""}),TO=vi({key:"password0Issues",get:({get:t})=>{const e=t(fi),n=d4(e);return n instanceof Et.errors?n:null}}),Po=ft({key:"email",default:""}),AO=vi({key:"emailIssues",get:({get:t})=>{const e=t(Po),n=h4(e);return n instanceof Et.errors?n:null}});vi({key:"signupReady",get:({get:t})=>{const e=t(xO),n=t(TO),r=t(AO);return!(e??n??r)}});const Gi=ft({key:"oneTimeCode",default:""}),km=ft({key:"oneTimeCodeNewEmail",default:""}),li=ft({key:"authTarget",default:null}),EO=Tp({verify:Tp({$token:null}),game:Tp({clicker:null}),account:null,admin:null});function g4(t){return uV(EO,t)}const v4=[[]];function b4(t){return v4.some(e=>e.join("/")===t.join("/"))}function _s(t){history.pushState(null,"",t),De(OO,t)}const OO=ft({key:"pathName",default:window.location.pathname,effects:[({onSet:t,setSelf:e})=>{const n=o=>{history.replaceState(null,"",o),e(o)},r=o=>{switch(o){case"/":{const u=nt(ut);switch(console.log("/","auth",u),u?.verification){case"verified":n("/game");break;case"unverified":n("/verify");break}break}case"/verify":{nt(ut)?.verification==="verified"&&n("/game");break}case"/game":case"/game/clicker":{nt(ut)?.verification==="unverified"&&n("/verify");break}case"/admin":break;case"/account":{const u=nt(ut);if(!u){n("/");break}u.verification==="unverified"&&n("/verify");break}}};r(window.location.pathname),t(({newValue:o})=>{r(o)})},({setSelf:t})=>{document.addEventListener("click",e=>{const n=e.target.closest("a");if(n&&n instanceof HTMLAnchorElement){const r=n.getAttribute("href");r?.startsWith("/")&&(e.preventDefault(),history.pushState(null,"",r),t(r))}}),window.addEventListener("popstate",()=>{t(window.location.pathname)})}]}),S4=vi({key:"route",get:({get:t})=>{const n=t(OO).split("/").slice(1).filter(Boolean);return g4(n)?b4(n)||t(ut)?n:401:404}}),Cx=ft({key:"buttonBlockActive",default:!1}),Bn=ft({key:"editing",default:[],effects:[({onSet:t})=>{t(({newValue:e})=>{switch(e[0]){case"email":{nt(_O)?.focus();break}case"new-password":{nt(RO)?.focus();break}case"username":{nt(kO)?.focus();break}}})}]}),_O=ft({key:"emailInputElement",default:null}),RO=ft({key:"password0InputElement",default:null}),kO=ft({key:"usernameInputElement",default:null});function w4(t){const e=N.useRef(null);return N.useEffect(()=>{De(t,e.current)},[t]),e}const x4=vi({key:"otcLoginFieldLabel",get:({get:t})=>{const e=t(ut);return e?`Code sent to ${e.email}`:""}}),T4=vi({key:"otcVerifyFieldLabel",get:({get:t})=>{const e=t(Po);return e?`Code sent to ${e}`:""}});function Rp({label:t,inputToken:e,issuesToken:n,inputElementToken:r,initialState:o,onSubmit:u,onOpen:c,onCancel:f,extraIssues:h}){const m=At(e),y=Qn(e),g=At(Gi),b=Qn(Gi),S=At(km),x=Qn(km),T=At(fi),_=Qn(fi),k=At(Cx),C=Qn(Cx),M=At(Bn),G=Qn(Bn),I=At(n),ee=At(x4),J=At(T4),X=w4(r),he=M[0]===t,pe=M.at(-1),[we,...je]=M;return F.jsxs("form",{onSubmit:async be=>{if(be.preventDefault(),k){C(!1);return}console.log(`submitted! changing ${t} to`,m);const Z=await u(m);Error.isError(Z)&&console.error(Z)},children:[he?F.jsx("button",{type:"button",onClick:async()=>{await f?.(),G([])},children:"x"}):null,F.jsxs("main",{children:[F.jsxs("label",{htmlFor:t,children:[I||h?F.jsxs("aside",{children:[h,I?.map(be=>F.jsx("span",{children:be.message},be.path.join(".")))]}):null,F.jsx("span",{children:t==="new-password"?"Password":hs(t)}),F.jsx("input",{id:t,type:t==="new-password"?"password":"text",ref:X,value:m,onChange:be=>{y(be.target.value)},autoComplete:t,autoCapitalize:"none",disabled:pe!==t})]}),he?je.map(be=>F.jsxs("label",{htmlFor:`${t}-${be}`,children:[F.jsx("span",{children:(()=>{switch(be){case"otcLogin":return ee;case"otcVerify":return J;case"passwordLogin":return"Password"}})()}),F.jsx("input",{id:`${t}-otc`,type:"text",ref:X,value:(()=>{switch(be){case"otcLogin":return g;case"otcVerify":return t==="email"?S:g;case"passwordLogin":return T}})(),onChange:Z=>{switch(be){case"otcLogin":b(Z.target.value);break;case"otcVerify":if(t==="email"){x(Z.target.value);break}b(Z.target.value);break;case"passwordLogin":_(Z.target.value)}},autoComplete:t.includes("otc")?"one-time-code":t.includes("password")?"password":"",autoCapitalize:"none",disabled:be!==pe})]},`${t}-${be}`)):null]}),M[0]===t?F.jsx("button",{type:"submit",children:"->"}):F.jsx("button",{type:"button",onMouseDown:async()=>{C(!0),await c?.(),G(o)},onMouseUp:()=>{C(!1)},children:"/"})]})}function A4(){const t=At(ut),e=At(y4);return N.useEffect(()=>{t&&De(Po,t.email),t?.password&&De(fi,"••••••••••••")},[]),t?F.jsxs("article",{"data-css":"editor",children:[F.jsx(Rp,{label:"username",inputToken:jo,issuesToken:xO,inputElementToken:kO,initialState:["username"],onSubmit:async n=>(await new Promise(r=>{gi.once("usernameChanged",r),gi.emit("changeUsername",n)}),De(Bn,[]),n),extraIssues:e?F.jsx("span",{children:"This username is taken."}):null}),F.jsx(Rp,{label:"email",inputToken:Po,issuesToken:AO,inputElementToken:_O,initialState:["email"],onSubmit:async n=>{const r=nt(Bn);if(r[0]!=="email")return new Error("field not email");switch(r.length){case 1:{const{userKey:o,nextStep:u}=await cn.offerNewEmail.mutate({emailOffered:n});switch(console.log({authTarget:o,nextStep:u}),u){case"otc_login":{De(li,o),De(Bn,["email","otcLogin"]);break}case"password_login":{De(li,o),De(Bn,["email","passwordLogin"]);break}case"otc_verify":{De(li,o),De(Gi,"not needed"),De(Bn,["email","otcLogin","otcVerify"]);break}}return o}case 2:switch(console.log("case 2"),r[1]){case"otcLogin":{console.log("case 2.1");const o=nt(li);if(!o)return new Error("No auth target");const u=nt(Gi),c=await cn.verifyAccountAction.mutate({oneTimeCode:u,userKey:o});return De(ut,c),De(Bn,["email","otcLogin","otcVerify"]),o}case"passwordLogin":return new Error("not implemented")}break;case 3:{const o=nt(li);if(!o)return new Error("No auth target");const u=nt(km),c=await cn.verifyAccountAction.mutate({oneTimeCode:u,userKey:o});return De(ut,c),De(Bn,[]),c.email}}}}),F.jsx(Rp,{label:"new-password",inputToken:fi,issuesToken:TO,inputElementToken:RO,initialState:t.password?["new-password","otcVerify"]:["new-password"],onSubmit:async n=>{const r=nt(Bn);if(r[0]!=="new-password")return new Error("field not new-password");switch(r.length){case 1:return await cn.setPassword.mutate({password:n}),De(fi,"••••••••••••"),De(ut,o=>o&&{...o,password:!0}),De(Bn,[]),"done";case 2:{const o=nt(li);return o?(await cn.verifyAccountAction.mutate({oneTimeCode:nt(Gi),userKey:o}),De(ut,u=>u&&{...u,password:!1}),De(fi,""),De(Bn,["new-password"]),"done"):new Error("No userKey")}}},onCancel:()=>{t.password&&De(fi,"••••••••••••")},onOpen:async()=>{if(t.password){const n=nt(li);if(!n)return new Error("No userKey");await cn.startPasswordReset.mutate({userKey:n})}}})]}):F.jsx("p",{children:"You must be logged in to verify your account."})}function E4(){return F.jsx("article",{children:F.jsx("h1",{children:"admin"})})}const Xy=ft({key:"count",default:0}),CO=LC({key:"incrementTX",do:({set:t})=>{t(Xy,e=>e+1)}}),O4=kM({key:"countContinuity",config:t=>t.add(Xy).add(CO)});function _4({route:[,t]}){return F.jsx("article",{children:t?F.jsx(k4,{gameId:t}):F.jsx(R4,{})})}function R4(){return F.jsx("nav",{children:F.jsx(FE,{href:"/game/clicker",children:"Clicker"})})}UC(EO[1].game[1]);function k4({gameId:t}){console.log(t);const e=At(Xy),n=VC(CO);return KM(O4),F.jsxs("article",{children:[F.jsxs("button",{type:"button",onClick:()=>{n()},children:["count is ",e]}),F.jsx("p",{children:"Let's see how high we can count!"})]})}const MO=N.createContext({});function C4(t){const e=N.useRef(null);return e.current===null&&(e.current=t()),e.current}const Zy=typeof window<"u",M4=Zy?N.useLayoutEffect:N.useEffect,Qy=N.createContext(null);function Wy(t,e){t.indexOf(e)===-1&&t.push(e)}function eg(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}const Wi=(t,e,n)=>n>e?e:n<t?t:n;let tg=()=>{};const er={},DO=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t);function NO(t){return typeof t=="object"&&t!==null}const $O=t=>/^0[^.\s]+$/u.test(t);function ng(t){let e;return()=>(e===void 0&&(e=t()),e)}const Kn=t=>t,D4=(t,e)=>n=>e(t(n)),jl=(...t)=>t.reduce(D4),vl=(t,e,n)=>{const r=e-t;return r===0?1:(n-t)/r};class ig{constructor(){this.subscriptions=[]}add(e){return Wy(this.subscriptions,e),()=>eg(this.subscriptions,e)}notify(e,n,r){const o=this.subscriptions.length;if(o)if(o===1)this.subscriptions[0](e,n,r);else for(let u=0;u<o;u++){const c=this.subscriptions[u];c&&c(e,n,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const pi=t=>t*1e3,Un=t=>t/1e3;function jO(t,e){return e?t*(1e3/e):0}const BO=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t,N4=1e-7,$4=12;function j4(t,e,n,r,o){let u,c,f=0;do c=e+(n-e)/2,u=BO(c,r,o)-t,u>0?n=c:e=c;while(Math.abs(u)>N4&&++f<$4);return c}function Bl(t,e,n,r){if(t===e&&n===r)return Kn;const o=u=>j4(u,0,1,t,n);return u=>u===0||u===1?u:BO(o(u),e,r)}const zO=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,LO=t=>e=>1-t(1-e),VO=Bl(.33,1.53,.69,.99),rg=LO(VO),UO=zO(rg),KO=t=>(t*=2)<1?.5*rg(t):.5*(2-Math.pow(2,-10*(t-1))),sg=t=>1-Math.sin(Math.acos(t)),qO=LO(sg),PO=zO(sg),B4=Bl(.42,0,1,1),z4=Bl(0,0,.58,1),IO=Bl(.42,0,.58,1),L4=t=>Array.isArray(t)&&typeof t[0]!="number",HO=t=>Array.isArray(t)&&typeof t[0]=="number",V4={linear:Kn,easeIn:B4,easeInOut:IO,easeOut:z4,circIn:sg,circInOut:PO,circOut:qO,backIn:rg,backInOut:UO,backOut:VO,anticipate:KO},U4=t=>typeof t=="string",Mx=t=>{if(HO(t)){tg(t.length===4);const[e,n,r,o]=t;return Bl(e,n,r,o)}else if(U4(t))return V4[t];return t},mc=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function K4(t,e){let n=new Set,r=new Set,o=!1,u=!1;const c=new WeakSet;let f={delta:0,timestamp:0,isProcessing:!1};function h(y){c.has(y)&&(m.schedule(y),t()),y(f)}const m={schedule:(y,g=!1,b=!1)=>{const x=b&&o?n:r;return g&&c.add(y),x.has(y)||x.add(y),y},cancel:y=>{r.delete(y),c.delete(y)},process:y=>{if(f=y,o){u=!0;return}o=!0,[n,r]=[r,n],n.forEach(h),n.clear(),o=!1,u&&(u=!1,m.process(y))}};return m}const q4=40;function FO(t,e){let n=!1,r=!0;const o={delta:0,timestamp:0,isProcessing:!1},u=()=>n=!0,c=mc.reduce((M,G)=>(M[G]=K4(u),M),{}),{setup:f,read:h,resolveKeyframes:m,preUpdate:y,update:g,preRender:b,render:S,postRender:x}=c,T=()=>{const M=er.useManualTiming?o.timestamp:performance.now();n=!1,er.useManualTiming||(o.delta=r?1e3/60:Math.max(Math.min(M-o.timestamp,q4),1)),o.timestamp=M,o.isProcessing=!0,f.process(o),h.process(o),m.process(o),y.process(o),g.process(o),b.process(o),S.process(o),x.process(o),o.isProcessing=!1,n&&e&&(r=!1,t(T))},_=()=>{n=!0,r=!0,o.isProcessing||t(T)};return{schedule:mc.reduce((M,G)=>{const I=c[G];return M[G]=(ee,J=!1,X=!1)=>(n||_(),I.schedule(ee,J,X)),M},{}),cancel:M=>{for(let G=0;G<mc.length;G++)c[mc[G]].cancel(M)},state:o,steps:c}}const{schedule:it,cancel:Vr,state:Ht,steps:kp}=FO(typeof requestAnimationFrame<"u"?requestAnimationFrame:Kn,!0);let kc;function P4(){kc=void 0}const fn={now:()=>(kc===void 0&&fn.set(Ht.isProcessing||er.useManualTiming?Ht.timestamp:performance.now()),kc),set:t=>{kc=t,queueMicrotask(P4)}},GO=t=>e=>typeof e=="string"&&e.startsWith(t),YO=GO("--"),I4=GO("var(--"),og=t=>I4(t)?H4.test(t.split("/*")[0].trim()):!1,H4=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,Zo={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},bl={...Zo,transform:t=>Wi(0,1,t)},yc={...Zo,default:1},rl=t=>Math.round(t*1e5)/1e5,ag=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function F4(t){return t==null}const G4=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,lg=(t,e)=>n=>!!(typeof n=="string"&&G4.test(n)&&n.startsWith(t)||e&&!F4(n)&&Object.prototype.hasOwnProperty.call(n,e)),JO=(t,e,n)=>r=>{if(typeof r!="string")return r;const[o,u,c,f]=r.match(ag);return{[t]:parseFloat(o),[e]:parseFloat(u),[n]:parseFloat(c),alpha:f!==void 0?parseFloat(f):1}},Y4=t=>Wi(0,255,t),Cp={...Zo,transform:t=>Math.round(Y4(t))},gs={test:lg("rgb","red"),parse:JO("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:r=1})=>"rgba("+Cp.transform(t)+", "+Cp.transform(e)+", "+Cp.transform(n)+", "+rl(bl.transform(r))+")"};function J4(t){let e="",n="",r="",o="";return t.length>5?(e=t.substring(1,3),n=t.substring(3,5),r=t.substring(5,7),o=t.substring(7,9)):(e=t.substring(1,2),n=t.substring(2,3),r=t.substring(3,4),o=t.substring(4,5),e+=e,n+=n,r+=r,o+=o),{red:parseInt(e,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:o?parseInt(o,16)/255:1}}const Cm={test:lg("#"),parse:J4,transform:gs.transform},zl=t=>({test:e=>typeof e=="string"&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),Rr=zl("deg"),mi=zl("%"),de=zl("px"),X4=zl("vh"),Z4=zl("vw"),Dx={...mi,parse:t=>mi.parse(t)/100,transform:t=>mi.transform(t*100)},Ao={test:lg("hsl","hue"),parse:JO("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:r=1})=>"hsla("+Math.round(t)+", "+mi.transform(rl(e))+", "+mi.transform(rl(n))+", "+rl(bl.transform(r))+")"},Tt={test:t=>gs.test(t)||Cm.test(t)||Ao.test(t),parse:t=>gs.test(t)?gs.parse(t):Ao.test(t)?Ao.parse(t):Cm.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?gs.transform(t):Ao.transform(t),getAnimatableNone:t=>{const e=Tt.parse(t);return e.alpha=0,Tt.transform(e)}},Q4=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function W4(t){return isNaN(t)&&typeof t=="string"&&(t.match(ag)?.length||0)+(t.match(Q4)?.length||0)>0}const XO="number",ZO="color",eU="var",tU="var(",Nx="${}",nU=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Sl(t){const e=t.toString(),n=[],r={color:[],number:[],var:[]},o=[];let u=0;const f=e.replace(nU,h=>(Tt.test(h)?(r.color.push(u),o.push(ZO),n.push(Tt.parse(h))):h.startsWith(tU)?(r.var.push(u),o.push(eU),n.push(h)):(r.number.push(u),o.push(XO),n.push(parseFloat(h))),++u,Nx)).split(Nx);return{values:n,split:f,indexes:r,types:o}}function QO(t){return Sl(t).values}function WO(t){const{split:e,types:n}=Sl(t),r=e.length;return o=>{let u="";for(let c=0;c<r;c++)if(u+=e[c],o[c]!==void 0){const f=n[c];f===XO?u+=rl(o[c]):f===ZO?u+=Tt.transform(o[c]):u+=o[c]}return u}}const iU=t=>typeof t=="number"?0:Tt.test(t)?Tt.getAnimatableNone(t):t;function rU(t){const e=QO(t);return WO(t)(e.map(iU))}const Ur={test:W4,parse:QO,createTransformer:WO,getAnimatableNone:rU};function Mp(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+(e-t)*6*n:n<1/2?e:n<2/3?t+(e-t)*(2/3-n)*6:t}function sU({hue:t,saturation:e,lightness:n,alpha:r}){t/=360,e/=100,n/=100;let o=0,u=0,c=0;if(!e)o=u=c=n;else{const f=n<.5?n*(1+e):n+e-n*e,h=2*n-f;o=Mp(h,f,t+1/3),u=Mp(h,f,t),c=Mp(h,f,t-1/3)}return{red:Math.round(o*255),green:Math.round(u*255),blue:Math.round(c*255),alpha:r}}function Wc(t,e){return n=>n>0?e:t}const rt=(t,e,n)=>t+(e-t)*n,Dp=(t,e,n)=>{const r=t*t,o=n*(e*e-r)+r;return o<0?0:Math.sqrt(o)},oU=[Cm,gs,Ao],aU=t=>oU.find(e=>e.test(t));function $x(t){const e=aU(t);if(!e)return!1;let n=e.parse(t);return e===Ao&&(n=sU(n)),n}const jx=(t,e)=>{const n=$x(t),r=$x(e);if(!n||!r)return Wc(t,e);const o={...n};return u=>(o.red=Dp(n.red,r.red,u),o.green=Dp(n.green,r.green,u),o.blue=Dp(n.blue,r.blue,u),o.alpha=rt(n.alpha,r.alpha,u),gs.transform(o))},Mm=new Set(["none","hidden"]);function lU(t,e){return Mm.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}function uU(t,e){return n=>rt(t,e,n)}function ug(t){return typeof t=="number"?uU:typeof t=="string"?og(t)?Wc:Tt.test(t)?jx:dU:Array.isArray(t)?e_:typeof t=="object"?Tt.test(t)?jx:cU:Wc}function e_(t,e){const n=[...t],r=n.length,o=t.map((u,c)=>ug(u)(u,e[c]));return u=>{for(let c=0;c<r;c++)n[c]=o[c](u);return n}}function cU(t,e){const n={...t,...e},r={};for(const o in n)t[o]!==void 0&&e[o]!==void 0&&(r[o]=ug(t[o])(t[o],e[o]));return o=>{for(const u in r)n[u]=r[u](o);return n}}function fU(t,e){const n=[],r={color:0,var:0,number:0};for(let o=0;o<e.values.length;o++){const u=e.types[o],c=t.indexes[u][r[u]],f=t.values[c]??0;n[o]=f,r[u]++}return n}const dU=(t,e)=>{const n=Ur.createTransformer(e),r=Sl(t),o=Sl(e);return r.indexes.var.length===o.indexes.var.length&&r.indexes.color.length===o.indexes.color.length&&r.indexes.number.length>=o.indexes.number.length?Mm.has(t)&&!o.values.length||Mm.has(e)&&!r.values.length?lU(t,e):jl(e_(fU(r,o),o.values),n):Wc(t,e)};function t_(t,e,n){return typeof t=="number"&&typeof e=="number"&&typeof n=="number"?rt(t,e,n):ug(t)(t,e)}const hU=t=>{const e=({timestamp:n})=>t(n);return{start:(n=!0)=>it.update(e,n),stop:()=>Vr(e),now:()=>Ht.isProcessing?Ht.timestamp:fn.now()}},n_=(t,e,n=10)=>{let r="";const o=Math.max(Math.round(e/n),2);for(let u=0;u<o;u++)r+=Math.round(t(u/(o-1))*1e4)/1e4+", ";return`linear(${r.substring(0,r.length-2)})`},ef=2e4;function cg(t){let e=0;const n=50;let r=t.next(e);for(;!r.done&&e<ef;)e+=n,r=t.next(e);return e>=ef?1/0:e}function pU(t,e=100,n){const r=n({...t,keyframes:[0,e]}),o=Math.min(cg(r),ef);return{type:"keyframes",ease:u=>r.next(o*u).value/e,duration:Un(o)}}const mU=5;function i_(t,e,n){const r=Math.max(e-mU,0);return jO(n-t(r),e-r)}const lt={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},Np=.001;function yU({duration:t=lt.duration,bounce:e=lt.bounce,velocity:n=lt.velocity,mass:r=lt.mass}){let o,u,c=1-e;c=Wi(lt.minDamping,lt.maxDamping,c),t=Wi(lt.minDuration,lt.maxDuration,Un(t)),c<1?(o=m=>{const y=m*c,g=y*t,b=y-n,S=Dm(m,c),x=Math.exp(-g);return Np-b/S*x},u=m=>{const g=m*c*t,b=g*n+n,S=Math.pow(c,2)*Math.pow(m,2)*t,x=Math.exp(-g),T=Dm(Math.pow(m,2),c);return(-o(m)+Np>0?-1:1)*((b-S)*x)/T}):(o=m=>{const y=Math.exp(-m*t),g=(m-n)*t+1;return-Np+y*g},u=m=>{const y=Math.exp(-m*t),g=(n-m)*(t*t);return y*g});const f=5/t,h=vU(o,u,f);if(t=pi(t),isNaN(h))return{stiffness:lt.stiffness,damping:lt.damping,duration:t};{const m=Math.pow(h,2)*r;return{stiffness:m,damping:c*2*Math.sqrt(r*m),duration:t}}}const gU=12;function vU(t,e,n){let r=n;for(let o=1;o<gU;o++)r=r-t(r)/e(r);return r}function Dm(t,e){return t*Math.sqrt(1-e*e)}const bU=["duration","bounce"],SU=["stiffness","damping","mass"];function Bx(t,e){return e.some(n=>t[n]!==void 0)}function wU(t){let e={velocity:lt.velocity,stiffness:lt.stiffness,damping:lt.damping,mass:lt.mass,isResolvedFromDuration:!1,...t};if(!Bx(t,SU)&&Bx(t,bU))if(t.visualDuration){const n=t.visualDuration,r=2*Math.PI/(n*1.2),o=r*r,u=2*Wi(.05,1,1-(t.bounce||0))*Math.sqrt(o);e={...e,mass:lt.mass,stiffness:o,damping:u}}else{const n=yU(t);e={...e,...n,mass:lt.mass},e.isResolvedFromDuration=!0}return e}function tf(t=lt.visualDuration,e=lt.bounce){const n=typeof t!="object"?{visualDuration:t,keyframes:[0,1],bounce:e}:t;let{restSpeed:r,restDelta:o}=n;const u=n.keyframes[0],c=n.keyframes[n.keyframes.length-1],f={done:!1,value:u},{stiffness:h,damping:m,mass:y,duration:g,velocity:b,isResolvedFromDuration:S}=wU({...n,velocity:-Un(n.velocity||0)}),x=b||0,T=m/(2*Math.sqrt(h*y)),_=c-u,k=Un(Math.sqrt(h/y)),C=Math.abs(_)<5;r||(r=C?lt.restSpeed.granular:lt.restSpeed.default),o||(o=C?lt.restDelta.granular:lt.restDelta.default);let M;if(T<1){const I=Dm(k,T);M=ee=>{const J=Math.exp(-T*k*ee);return c-J*((x+T*k*_)/I*Math.sin(I*ee)+_*Math.cos(I*ee))}}else if(T===1)M=I=>c-Math.exp(-k*I)*(_+(x+k*_)*I);else{const I=k*Math.sqrt(T*T-1);M=ee=>{const J=Math.exp(-T*k*ee),X=Math.min(I*ee,300);return c-J*((x+T*k*_)*Math.sinh(X)+I*_*Math.cosh(X))/I}}const G={calculatedDuration:S&&g||null,next:I=>{const ee=M(I);if(S)f.done=I>=g;else{let J=I===0?x:0;T<1&&(J=I===0?pi(x):i_(M,I,ee));const X=Math.abs(J)<=r,he=Math.abs(c-ee)<=o;f.done=X&&he}return f.value=f.done?c:ee,f},toString:()=>{const I=Math.min(cg(G),ef),ee=n_(J=>G.next(I*J).value,I,30);return I+"ms "+ee},toTransition:()=>{}};return G}tf.applyToOptions=t=>{const e=pU(t,100,tf);return t.ease=e.ease,t.duration=pi(e.duration),t.type="keyframes",t};function Nm({keyframes:t,velocity:e=0,power:n=.8,timeConstant:r=325,bounceDamping:o=10,bounceStiffness:u=500,modifyTarget:c,min:f,max:h,restDelta:m=.5,restSpeed:y}){const g=t[0],b={done:!1,value:g},S=X=>f!==void 0&&X<f||h!==void 0&&X>h,x=X=>f===void 0?h:h===void 0||Math.abs(f-X)<Math.abs(h-X)?f:h;let T=n*e;const _=g+T,k=c===void 0?_:c(_);k!==_&&(T=k-g);const C=X=>-T*Math.exp(-X/r),M=X=>k+C(X),G=X=>{const he=C(X),pe=M(X);b.done=Math.abs(he)<=m,b.value=b.done?k:pe};let I,ee;const J=X=>{S(b.value)&&(I=X,ee=tf({keyframes:[b.value,x(b.value)],velocity:i_(M,X,b.value),damping:o,stiffness:u,restDelta:m,restSpeed:y}))};return J(0),{calculatedDuration:null,next:X=>{let he=!1;return!ee&&I===void 0&&(he=!0,G(X),J(X)),I!==void 0&&X>=I?ee.next(X-I):(!he&&G(X),b)}}}function xU(t,e,n){const r=[],o=n||er.mix||t_,u=t.length-1;for(let c=0;c<u;c++){let f=o(t[c],t[c+1]);if(e){const h=Array.isArray(e)?e[c]||Kn:e;f=jl(h,f)}r.push(f)}return r}function TU(t,e,{clamp:n=!0,ease:r,mixer:o}={}){const u=t.length;if(tg(u===e.length),u===1)return()=>e[0];if(u===2&&e[0]===e[1])return()=>e[1];const c=t[0]===t[1];t[0]>t[u-1]&&(t=[...t].reverse(),e=[...e].reverse());const f=xU(e,r,o),h=f.length,m=y=>{if(c&&y<t[0])return e[0];let g=0;if(h>1)for(;g<t.length-2&&!(y<t[g+1]);g++);const b=vl(t[g],t[g+1],y);return f[g](b)};return n?y=>m(Wi(t[0],t[u-1],y)):m}function AU(t,e){const n=t[t.length-1];for(let r=1;r<=e;r++){const o=vl(0,e,r);t.push(rt(n,1,o))}}function EU(t){const e=[0];return AU(e,t.length-1),e}function OU(t,e){return t.map(n=>n*e)}function _U(t,e){return t.map(()=>e||IO).splice(0,t.length-1)}function sl({duration:t=300,keyframes:e,times:n,ease:r="easeInOut"}){const o=L4(r)?r.map(Mx):Mx(r),u={done:!1,value:e[0]},c=OU(n&&n.length===e.length?n:EU(e),t),f=TU(c,e,{ease:Array.isArray(o)?o:_U(e,o)});return{calculatedDuration:t,next:h=>(u.value=f(h),u.done=h>=t,u)}}const RU=t=>t!==null;function fg(t,{repeat:e,repeatType:n="loop"},r,o=1){const u=t.filter(RU),f=o<0||e&&n!=="loop"&&e%2===1?0:u.length-1;return!f||r===void 0?u[f]:r}const kU={decay:Nm,inertia:Nm,tween:sl,keyframes:sl,spring:tf};function r_(t){typeof t.type=="string"&&(t.type=kU[t.type])}class dg{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,n){return this.finished.then(e,n)}}const CU=t=>t/100;class hg extends dg{constructor(e){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{const{motionValue:n}=this.options;n&&n.updatedAt!==fn.now()&&this.tick(fn.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),this.options.onStop?.())},this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){const{options:e}=this;r_(e);const{type:n=sl,repeat:r=0,repeatDelay:o=0,repeatType:u,velocity:c=0}=e;let{keyframes:f}=e;const h=n||sl;h!==sl&&typeof f[0]!="number"&&(this.mixKeyframes=jl(CU,t_(f[0],f[1])),f=[0,100]);const m=h({...e,keyframes:f});u==="mirror"&&(this.mirroredGenerator=h({...e,keyframes:[...f].reverse(),velocity:-c})),m.calculatedDuration===null&&(m.calculatedDuration=cg(m));const{calculatedDuration:y}=m;this.calculatedDuration=y,this.resolvedDuration=y+o,this.totalDuration=this.resolvedDuration*(r+1)-o,this.generator=m}updateTime(e){const n=Math.round(e-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=n}tick(e,n=!1){const{generator:r,totalDuration:o,mixKeyframes:u,mirroredGenerator:c,resolvedDuration:f,calculatedDuration:h}=this;if(this.startTime===null)return r.next(0);const{delay:m=0,keyframes:y,repeat:g,repeatType:b,repeatDelay:S,type:x,onUpdate:T,finalKeyframe:_}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-o/this.speed,this.startTime)),n?this.currentTime=e:this.updateTime(e);const k=this.currentTime-m*(this.playbackSpeed>=0?1:-1),C=this.playbackSpeed>=0?k<0:k>o;this.currentTime=Math.max(k,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=o);let M=this.currentTime,G=r;if(g){const X=Math.min(this.currentTime,o)/f;let he=Math.floor(X),pe=X%1;!pe&&X>=1&&(pe=1),pe===1&&he--,he=Math.min(he,g+1),he%2&&(b==="reverse"?(pe=1-pe,S&&(pe-=S/f)):b==="mirror"&&(G=c)),M=Wi(0,1,pe)*f}const I=C?{done:!1,value:y[0]}:G.next(M);u&&(I.value=u(I.value));let{done:ee}=I;!C&&h!==null&&(ee=this.playbackSpeed>=0?this.currentTime>=o:this.currentTime<=0);const J=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&ee);return J&&x!==Nm&&(I.value=fg(y,this.options,_,this.speed)),T&&T(I.value),J&&this.finish(),I}then(e,n){return this.finished.then(e,n)}get duration(){return Un(this.calculatedDuration)}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+Un(e)}get time(){return Un(this.currentTime)}set time(e){e=pi(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?.start(!1)}get speed(){return this.playbackSpeed}set speed(e){this.updateTime(fn.now());const n=this.playbackSpeed!==e;this.playbackSpeed=e,n&&(this.time=Un(this.currentTime))}play(){if(this.isStopped)return;const{driver:e=hU,startTime:n}=this.options;this.driver||(this.driver=e(o=>this.tick(o))),this.options.onPlay?.();const r=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=r):this.holdTime!==null?this.startTime=r-this.holdTime:this.startTime||(this.startTime=n??r),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(fn.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state="finished",this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),e.observe(this)}}function MU(t){for(let e=1;e<t.length;e++)t[e]??(t[e]=t[e-1])}const vs=t=>t*180/Math.PI,$m=t=>{const e=vs(Math.atan2(t[1],t[0]));return jm(e)},DU={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:t=>(Math.abs(t[0])+Math.abs(t[3]))/2,rotate:$m,rotateZ:$m,skewX:t=>vs(Math.atan(t[1])),skewY:t=>vs(Math.atan(t[2])),skew:t=>(Math.abs(t[1])+Math.abs(t[2]))/2},jm=t=>(t=t%360,t<0&&(t+=360),t),zx=$m,Lx=t=>Math.sqrt(t[0]*t[0]+t[1]*t[1]),Vx=t=>Math.sqrt(t[4]*t[4]+t[5]*t[5]),NU={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:Lx,scaleY:Vx,scale:t=>(Lx(t)+Vx(t))/2,rotateX:t=>jm(vs(Math.atan2(t[6],t[5]))),rotateY:t=>jm(vs(Math.atan2(-t[2],t[0]))),rotateZ:zx,rotate:zx,skewX:t=>vs(Math.atan(t[4])),skewY:t=>vs(Math.atan(t[1])),skew:t=>(Math.abs(t[1])+Math.abs(t[4]))/2};function Bm(t){return t.includes("scale")?1:0}function zm(t,e){if(!t||t==="none")return Bm(e);const n=t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let r,o;if(n)r=NU,o=n;else{const f=t.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=DU,o=f}if(!o)return Bm(e);const u=r[e],c=o[1].split(",").map(jU);return typeof u=="function"?u(c):c[u]}const $U=(t,e)=>{const{transform:n="none"}=getComputedStyle(t);return zm(n,e)};function jU(t){return parseFloat(t.trim())}const Qo=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Wo=new Set(Qo),Ux=t=>t===Zo||t===de,BU=new Set(["x","y","z"]),zU=Qo.filter(t=>!BU.has(t));function LU(t){const e=[];return zU.forEach(n=>{const r=t.getValue(n);r!==void 0&&(e.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),e}const ws={width:({x:t},{paddingLeft:e="0",paddingRight:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),height:({y:t},{paddingTop:e="0",paddingBottom:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:(t,{transform:e})=>zm(e,"x"),y:(t,{transform:e})=>zm(e,"y")};ws.translateX=ws.x;ws.translateY=ws.y;const xs=new Set;let Lm=!1,Vm=!1,Um=!1;function s_(){if(Vm){const t=Array.from(xs).filter(r=>r.needsMeasurement),e=new Set(t.map(r=>r.element)),n=new Map;e.forEach(r=>{const o=LU(r);o.length&&(n.set(r,o),r.render())}),t.forEach(r=>r.measureInitialState()),e.forEach(r=>{r.render();const o=n.get(r);o&&o.forEach(([u,c])=>{r.getValue(u)?.set(c)})}),t.forEach(r=>r.measureEndState()),t.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}Vm=!1,Lm=!1,xs.forEach(t=>t.complete(Um)),xs.clear()}function o_(){xs.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(Vm=!0)})}function VU(){Um=!0,o_(),s_(),Um=!1}class pg{constructor(e,n,r,o,u,c=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=n,this.name=r,this.motionValue=o,this.element=u,this.isAsync=c}scheduleResolve(){this.state="scheduled",this.isAsync?(xs.add(this),Lm||(Lm=!0,it.read(o_),it.resolveKeyframes(s_))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:n,element:r,motionValue:o}=this;if(e[0]===null){const u=o?.get(),c=e[e.length-1];if(u!==void 0)e[0]=u;else if(r&&n){const f=r.readValue(n,c);f!=null&&(e[0]=f)}e[0]===void 0&&(e[0]=c),o&&u===void 0&&o.set(e[0])}MU(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),xs.delete(this)}cancel(){this.state==="scheduled"&&(xs.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const UU=t=>t.startsWith("--");function KU(t,e,n){UU(e)?t.style.setProperty(e,n):t.style[e]=n}const qU=ng(()=>window.ScrollTimeline!==void 0),PU={};function IU(t,e){const n=ng(t);return()=>PU[e]??n()}const a_=IU(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),el=([t,e,n,r])=>`cubic-bezier(${t}, ${e}, ${n}, ${r})`,Kx={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:el([0,.65,.55,1]),circOut:el([.55,0,1,.45]),backIn:el([.31,.01,.66,-.59]),backOut:el([.33,1.53,.69,.99])};function l_(t,e){if(t)return typeof t=="function"?a_()?n_(t,e):"ease-out":HO(t)?el(t):Array.isArray(t)?t.map(n=>l_(n,e)||Kx.easeOut):Kx[t]}function HU(t,e,n,{delay:r=0,duration:o=300,repeat:u=0,repeatType:c="loop",ease:f="easeOut",times:h}={},m=void 0){const y={[e]:n};h&&(y.offset=h);const g=l_(f,o);Array.isArray(g)&&(y.easing=g);const b={delay:r,duration:o,easing:Array.isArray(g)?"linear":g,fill:"both",iterations:u+1,direction:c==="reverse"?"alternate":"normal"};return m&&(b.pseudoElement=m),t.animate(y,b)}function u_(t){return typeof t=="function"&&"applyToOptions"in t}function FU({type:t,...e}){return u_(t)&&a_()?t.applyToOptions(e):(e.duration??(e.duration=300),e.ease??(e.ease="easeOut"),e)}class GU extends dg{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,!e)return;const{element:n,name:r,keyframes:o,pseudoElement:u,allowFlatten:c=!1,finalKeyframe:f,onComplete:h}=e;this.isPseudoElement=!!u,this.allowFlatten=c,this.options=e,tg(typeof e.type!="string");const m=FU(e);this.animation=HU(n,r,o,m,u),m.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!u){const y=fg(o,this.options,f,this.speed);this.updateMotionValue?this.updateMotionValue(y):KU(n,r,y),this.animation.cancel()}h?.(),this.notifyFinished()}}play(){this.isStopped||(this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:e}=this;e==="idle"||e==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){this.isPseudoElement||this.animation.commitStyles?.()}get duration(){const e=this.animation.effect?.getComputedTiming?.().duration||0;return Un(Number(e))}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+Un(e)}get time(){return Un(Number(this.animation.currentTime)||0)}set time(e){this.finishedTime=null,this.animation.currentTime=pi(e)}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return Number(this.animation.startTime)}set startTime(e){this.animation.startTime=e}attachTimeline({timeline:e,observe:n}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,e&&qU()?(this.animation.timeline=e,Kn):n(this)}}const c_={anticipate:KO,backInOut:UO,circInOut:PO};function YU(t){return t in c_}function JU(t){typeof t.ease=="string"&&YU(t.ease)&&(t.ease=c_[t.ease])}const qx=10;class XU extends GU{constructor(e){JU(e),r_(e),super(e),e.startTime&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){const{motionValue:n,onUpdate:r,onComplete:o,element:u,...c}=this.options;if(!n)return;if(e!==void 0){n.set(e);return}const f=new hg({...c,autoplay:!1}),h=pi(this.finishedTime??this.time);n.setWithVelocity(f.sample(h-qx).value,f.sample(h).value,qx),f.stop()}}const Px=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(Ur.test(t)||t==="0")&&!t.startsWith("url("));function ZU(t){const e=t[0];if(t.length===1)return!0;for(let n=0;n<t.length;n++)if(t[n]!==e)return!0}function QU(t,e,n,r){const o=t[0];if(o===null)return!1;if(e==="display"||e==="visibility")return!0;const u=t[t.length-1],c=Px(o,e),f=Px(u,e);return!c||!f?!1:ZU(t)||(n==="spring"||u_(n))&&r}function Km(t){t.duration=0,t.type="keyframes"}const WU=new Set(["opacity","clipPath","filter","transform"]),eK=ng(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function tK(t){const{motionValue:e,name:n,repeatDelay:r,repeatType:o,damping:u,type:c}=t;if(!(e?.owner?.current instanceof HTMLElement))return!1;const{onUpdate:h,transformTemplate:m}=e.owner.getProps();return eK()&&n&&WU.has(n)&&(n!=="transform"||!m)&&!h&&!r&&o!=="mirror"&&u!==0&&c!=="inertia"}const nK=40;class iK extends dg{constructor({autoplay:e=!0,delay:n=0,type:r="keyframes",repeat:o=0,repeatDelay:u=0,repeatType:c="loop",keyframes:f,name:h,motionValue:m,element:y,...g}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=fn.now();const b={autoplay:e,delay:n,type:r,repeat:o,repeatDelay:u,repeatType:c,name:h,motionValue:m,element:y,...g},S=y?.KeyframeResolver||pg;this.keyframeResolver=new S(f,(x,T,_)=>this.onKeyframesResolved(x,T,b,!_),h,m,y),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,n,r,o){this.keyframeResolver=void 0;const{name:u,type:c,velocity:f,delay:h,isHandoff:m,onUpdate:y}=r;this.resolvedAt=fn.now(),QU(e,u,c,f)||((er.instantAnimations||!h)&&y?.(fg(e,r,n)),e[0]=e[e.length-1],Km(r),r.repeat=0);const b={startTime:o?this.resolvedAt?this.resolvedAt-this.createdAt>nK?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:n,...r,keyframes:e},S=!m&&tK(b)?new XU({...b,element:b.motionValue.owner.current}):new hg(b);S.finished.then(()=>this.notifyFinished()).catch(Kn),this.pendingTimeline&&(this.stopTimeline=S.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=S}get finished(){return this._animation?this.animation.finished:this._finished}then(e,n){return this.finished.finally(e).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),VU()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}}const rK=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function sK(t){const e=rK.exec(t);if(!e)return[,];const[,n,r,o]=e;return[`--${n??r}`,o]}function f_(t,e,n=1){const[r,o]=sK(t);if(!r)return;const u=window.getComputedStyle(e).getPropertyValue(r);if(u){const c=u.trim();return DO(c)?parseFloat(c):c}return og(o)?f_(o,e,n+1):o}function mg(t,e){return t?.[e]??t?.default??t}const d_=new Set(["width","height","top","left","right","bottom",...Qo]),oK={test:t=>t==="auto",parse:t=>t},h_=t=>e=>e.test(t),p_=[Zo,de,mi,Rr,Z4,X4,oK],Ix=t=>p_.find(h_(t));function aK(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||$O(t):!0}const lK=new Set(["brightness","contrast","saturate","opacity"]);function uK(t){const[e,n]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[r]=n.match(ag)||[];if(!r)return t;const o=n.replace(r,"");let u=lK.has(e)?1:0;return r!==n&&(u*=100),e+"("+u+o+")"}const cK=/\b([a-z-]*)\(.*?\)/gu,qm={...Ur,getAnimatableNone:t=>{const e=t.match(cK);return e?e.map(uK).join(" "):t}},Hx={...Zo,transform:Math.round},fK={rotate:Rr,rotateX:Rr,rotateY:Rr,rotateZ:Rr,scale:yc,scaleX:yc,scaleY:yc,scaleZ:yc,skew:Rr,skewX:Rr,skewY:Rr,distance:de,translateX:de,translateY:de,translateZ:de,x:de,y:de,z:de,perspective:de,transformPerspective:de,opacity:bl,originX:Dx,originY:Dx,originZ:de},yg={borderWidth:de,borderTopWidth:de,borderRightWidth:de,borderBottomWidth:de,borderLeftWidth:de,borderRadius:de,radius:de,borderTopLeftRadius:de,borderTopRightRadius:de,borderBottomRightRadius:de,borderBottomLeftRadius:de,width:de,maxWidth:de,height:de,maxHeight:de,top:de,right:de,bottom:de,left:de,padding:de,paddingTop:de,paddingRight:de,paddingBottom:de,paddingLeft:de,margin:de,marginTop:de,marginRight:de,marginBottom:de,marginLeft:de,backgroundPositionX:de,backgroundPositionY:de,...fK,zIndex:Hx,fillOpacity:bl,strokeOpacity:bl,numOctaves:Hx},dK={...yg,color:Tt,backgroundColor:Tt,outlineColor:Tt,fill:Tt,stroke:Tt,borderColor:Tt,borderTopColor:Tt,borderRightColor:Tt,borderBottomColor:Tt,borderLeftColor:Tt,filter:qm,WebkitFilter:qm},m_=t=>dK[t];function y_(t,e){let n=m_(t);return n!==qm&&(n=Ur),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const hK=new Set(["auto","none","0"]);function pK(t,e,n){let r=0,o;for(;r<t.length&&!o;){const u=t[r];typeof u=="string"&&!hK.has(u)&&Sl(u).values.length&&(o=t[r]),r++}if(o&&n)for(const u of e)t[u]=y_(n,o)}class mK extends pg{constructor(e,n,r,o,u){super(e,n,r,o,u,!0)}readKeyframes(){const{unresolvedKeyframes:e,element:n,name:r}=this;if(!n||!n.current)return;super.readKeyframes();for(let h=0;h<e.length;h++){let m=e[h];if(typeof m=="string"&&(m=m.trim(),og(m))){const y=f_(m,n.current);y!==void 0&&(e[h]=y),h===e.length-1&&(this.finalKeyframe=m)}}if(this.resolveNoneKeyframes(),!d_.has(r)||e.length!==2)return;const[o,u]=e,c=Ix(o),f=Ix(u);if(c!==f)if(Ux(c)&&Ux(f))for(let h=0;h<e.length;h++){const m=e[h];typeof m=="string"&&(e[h]=parseFloat(m))}else ws[r]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:n}=this,r=[];for(let o=0;o<e.length;o++)(e[o]===null||aK(e[o]))&&r.push(o);r.length&&pK(e,r,n)}measureInitialState(){const{element:e,unresolvedKeyframes:n,name:r}=this;if(!e||!e.current)return;r==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=ws[r](e.measureViewportBox(),window.getComputedStyle(e.current)),n[0]=this.measuredOrigin;const o=n[n.length-1];o!==void 0&&e.getValue(r,o).jump(o,!1)}measureEndState(){const{element:e,name:n,unresolvedKeyframes:r}=this;if(!e||!e.current)return;const o=e.getValue(n);o&&o.jump(this.measuredOrigin,!1);const u=r.length-1,c=r[u];r[u]=ws[n](e.measureViewportBox(),window.getComputedStyle(e.current)),c!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=c),this.removedTransforms?.length&&this.removedTransforms.forEach(([f,h])=>{e.getValue(f).set(h)}),this.resolveNoneKeyframes()}}function yK(t,e,n){if(t instanceof EventTarget)return[t];if(typeof t=="string"){let r=document;const o=n?.[t]??r.querySelectorAll(t);return o?Array.from(o):[]}return Array.from(t)}const g_=(t,e)=>e&&typeof t=="number"?e.transform(t):t;function gK(t){return NO(t)&&"offsetHeight"in t}const Fx=30,vK=t=>!isNaN(parseFloat(t));class bK{constructor(e,n={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=r=>{const o=fn.now();if(this.updatedAt!==o&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(const u of this.dependents)u.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=n.owner}setCurrent(e){this.current=e,this.updatedAt=fn.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=vK(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on("change",e)}on(e,n){this.events[e]||(this.events[e]=new ig);const r=this.events[e].add(n);return e==="change"?()=>{r(),it.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,n){this.passiveEffect=e,this.stopPassiveEffect=n}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,n,r){this.set(n),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-r}jump(e,n=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(e){this.dependents||(this.dependents=new Set),this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const e=fn.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>Fx)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,Fx);return jO(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(e){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=e(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Io(t,e){return new bK(t,e)}const{schedule:gg}=FO(queueMicrotask,!1),Xn={x:!1,y:!1};function v_(){return Xn.x||Xn.y}function SK(t){return t==="x"||t==="y"?Xn[t]?null:(Xn[t]=!0,()=>{Xn[t]=!1}):Xn.x||Xn.y?null:(Xn.x=Xn.y=!0,()=>{Xn.x=Xn.y=!1})}function b_(t,e){const n=yK(t),r=new AbortController,o={passive:!0,...e,signal:r.signal};return[n,o,()=>r.abort()]}function Gx(t){return!(t.pointerType==="touch"||v_())}function wK(t,e,n={}){const[r,o,u]=b_(t,n),c=f=>{if(!Gx(f))return;const{target:h}=f,m=e(h,f);if(typeof m!="function"||!h)return;const y=g=>{Gx(g)&&(m(g),h.removeEventListener("pointerleave",y))};h.addEventListener("pointerleave",y,o)};return r.forEach(f=>{f.addEventListener("pointerenter",c,o)}),u}const S_=(t,e)=>e?t===e?!0:S_(t,e.parentElement):!1,vg=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1,xK=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function TK(t){return xK.has(t.tagName)||t.tabIndex!==-1}const Cc=new WeakSet;function Yx(t){return e=>{e.key==="Enter"&&t(e)}}function $p(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}const AK=(t,e)=>{const n=t.currentTarget;if(!n)return;const r=Yx(()=>{if(Cc.has(n))return;$p(n,"down");const o=Yx(()=>{$p(n,"up")}),u=()=>$p(n,"cancel");n.addEventListener("keyup",o,e),n.addEventListener("blur",u,e)});n.addEventListener("keydown",r,e),n.addEventListener("blur",()=>n.removeEventListener("keydown",r),e)};function Jx(t){return vg(t)&&!v_()}function EK(t,e,n={}){const[r,o,u]=b_(t,n),c=f=>{const h=f.currentTarget;if(!Jx(f))return;Cc.add(h);const m=e(h,f),y=(S,x)=>{window.removeEventListener("pointerup",g),window.removeEventListener("pointercancel",b),Cc.has(h)&&Cc.delete(h),Jx(S)&&typeof m=="function"&&m(S,{success:x})},g=S=>{y(S,h===window||h===document||n.useGlobalTarget||S_(h,S.target))},b=S=>{y(S,!1)};window.addEventListener("pointerup",g,o),window.addEventListener("pointercancel",b,o)};return r.forEach(f=>{(n.useGlobalTarget?window:f).addEventListener("pointerdown",c,o),gK(f)&&(f.addEventListener("focus",m=>AK(m,o)),!TK(f)&&!f.hasAttribute("tabindex")&&(f.tabIndex=0))}),u}function w_(t){return NO(t)&&"ownerSVGElement"in t}function OK(t){return w_(t)&&t.tagName==="svg"}const Jt=t=>!!(t&&t.getVelocity),_K=[...p_,Tt,Ur],RK=t=>_K.find(h_(t)),x_=N.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});function kK(t=!0){const e=N.useContext(Qy);if(e===null)return[!0,null];const{isPresent:n,onExitComplete:r,register:o}=e,u=N.useId();N.useEffect(()=>{if(t)return o(u)},[t]);const c=N.useCallback(()=>t&&r&&r(u),[u,r,t]);return!n&&r?[!1,c]:[!0]}const T_=N.createContext({strict:!1}),Xx={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},Ho={};for(const t in Xx)Ho[t]={isEnabled:e=>Xx[t].some(n=>!!e[n])};function CK(t){for(const e in t)Ho[e]={...Ho[e],...t[e]}}const MK=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function nf(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||MK.has(t)}let A_=t=>!nf(t);function DK(t){typeof t=="function"&&(A_=e=>e.startsWith("on")?!nf(e):t(e))}try{DK(require("@emotion/is-prop-valid").default)}catch{}function NK(t,e,n){const r={};for(const o in t)o==="values"&&typeof t.values=="object"||(A_(o)||n===!0&&nf(o)||!e&&!nf(o)||t.draggable&&o.startsWith("onDrag"))&&(r[o]=t[o]);return r}const jf=N.createContext({});function Bf(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}function wl(t){return typeof t=="string"||Array.isArray(t)}const bg=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Sg=["initial",...bg];function zf(t){return Bf(t.animate)||Sg.some(e=>wl(t[e]))}function E_(t){return!!(zf(t)||t.variants)}function $K(t,e){if(zf(t)){const{initial:n,animate:r}=t;return{initial:n===!1||wl(n)?n:void 0,animate:wl(r)?r:void 0}}return t.inherit!==!1?e:{}}function jK(t){const{initial:e,animate:n}=$K(t,N.useContext(jf));return N.useMemo(()=>({initial:e,animate:n}),[Zx(e),Zx(n)])}function Zx(t){return Array.isArray(t)?t.join(" "):t}function Qx(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const Ja={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(de.test(t))t=parseFloat(t);else return t;const n=Qx(t,e.target.x),r=Qx(t,e.target.y);return`${n}% ${r}%`}},BK={correct:(t,{treeScale:e,projectionDelta:n})=>{const r=t,o=Ur.parse(t);if(o.length>5)return r;const u=Ur.createTransformer(t),c=typeof o[0]!="number"?1:0,f=n.x.scale*e.x,h=n.y.scale*e.y;o[0+c]/=f,o[1+c]/=h;const m=rt(f,h,.5);return typeof o[2+c]=="number"&&(o[2+c]/=m),typeof o[3+c]=="number"&&(o[3+c]/=m),u(o)}},Pm={borderRadius:{...Ja,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Ja,borderTopRightRadius:Ja,borderBottomLeftRadius:Ja,borderBottomRightRadius:Ja,boxShadow:BK};function O_(t,{layout:e,layoutId:n}){return Wo.has(t)||t.startsWith("origin")||(e||n!==void 0)&&(!!Pm[t]||t==="opacity")}const zK={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},LK=Qo.length;function VK(t,e,n){let r="",o=!0;for(let u=0;u<LK;u++){const c=Qo[u],f=t[c];if(f===void 0)continue;let h=!0;if(typeof f=="number"?h=f===(c.startsWith("scale")?1:0):h=parseFloat(f)===0,!h||n){const m=g_(f,yg[c]);if(!h){o=!1;const y=zK[c]||c;r+=`${y}(${m}) `}n&&(e[c]=m)}}return r=r.trim(),n?r=n(e,o?"":r):o&&(r="none"),r}function wg(t,e,n){const{style:r,vars:o,transformOrigin:u}=t;let c=!1,f=!1;for(const h in e){const m=e[h];if(Wo.has(h)){c=!0;continue}else if(YO(h)){o[h]=m;continue}else{const y=g_(m,yg[h]);h.startsWith("origin")?(f=!0,u[h]=y):r[h]=y}}if(e.transform||(c||n?r.transform=VK(e,t.transform,n):r.transform&&(r.transform="none")),f){const{originX:h="50%",originY:m="50%",originZ:y=0}=u;r.transformOrigin=`${h} ${m} ${y}`}}const xg=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function __(t,e,n){for(const r in e)!Jt(e[r])&&!O_(r,n)&&(t[r]=e[r])}function UK({transformTemplate:t},e){return N.useMemo(()=>{const n=xg();return wg(n,e,t),Object.assign({},n.vars,n.style)},[e])}function KK(t,e){const n=t.style||{},r={};return __(r,n,t),Object.assign(r,UK(t,e)),r}function qK(t,e){const n={},r=KK(t,e);return t.drag&&t.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(n.tabIndex=0),n.style=r,n}const PK={offset:"stroke-dashoffset",array:"stroke-dasharray"},IK={offset:"strokeDashoffset",array:"strokeDasharray"};function HK(t,e,n=1,r=0,o=!0){t.pathLength=1;const u=o?PK:IK;t[u.offset]=de.transform(-r);const c=de.transform(e),f=de.transform(n);t[u.array]=`${c} ${f}`}function R_(t,{attrX:e,attrY:n,attrScale:r,pathLength:o,pathSpacing:u=1,pathOffset:c=0,...f},h,m,y){if(wg(t,f,m),h){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:g,style:b}=t;g.transform&&(b.transform=g.transform,delete g.transform),(b.transform||g.transformOrigin)&&(b.transformOrigin=g.transformOrigin??"50% 50%",delete g.transformOrigin),b.transform&&(b.transformBox=y?.transformBox??"fill-box",delete g.transformBox),e!==void 0&&(g.x=e),n!==void 0&&(g.y=n),r!==void 0&&(g.scale=r),o!==void 0&&HK(g,o,u,c,!1)}const k_=()=>({...xg(),attrs:{}}),C_=t=>typeof t=="string"&&t.toLowerCase()==="svg";function FK(t,e,n,r){const o=N.useMemo(()=>{const u=k_();return R_(u,e,C_(r),t.transformTemplate,t.style),{...u.attrs,style:{...u.style}}},[e]);if(t.style){const u={};__(u,t.style,t),o.style={...u,...o.style}}return o}const GK=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function Tg(t){return typeof t!="string"||t.includes("-")?!1:!!(GK.indexOf(t)>-1||/[A-Z]/u.test(t))}function YK(t,e,n,{latestValues:r},o,u=!1){const f=(Tg(t)?FK:qK)(e,r,o,t),h=NK(e,typeof t=="string",u),m=t!==N.Fragment?{...h,...f,ref:n}:{},{children:y}=e,g=N.useMemo(()=>Jt(y)?y.get():y,[y]);return N.createElement(t,{...m,children:g})}function Wx(t){const e=[{},{}];return t?.values.forEach((n,r)=>{e[0][r]=n.get(),e[1][r]=n.getVelocity()}),e}function Ag(t,e,n,r){if(typeof e=="function"){const[o,u]=Wx(r);e=e(n!==void 0?n:t.custom,o,u)}if(typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"){const[o,u]=Wx(r);e=e(n!==void 0?n:t.custom,o,u)}return e}function Mc(t){return Jt(t)?t.get():t}function JK({scrapeMotionValuesFromProps:t,createRenderState:e},n,r,o){return{latestValues:XK(n,r,o,t),renderState:e()}}function XK(t,e,n,r){const o={},u=r(t,{});for(const b in u)o[b]=Mc(u[b]);let{initial:c,animate:f}=t;const h=zf(t),m=E_(t);e&&m&&!h&&t.inherit!==!1&&(c===void 0&&(c=e.initial),f===void 0&&(f=e.animate));let y=n?n.initial===!1:!1;y=y||c===!1;const g=y?f:c;if(g&&typeof g!="boolean"&&!Bf(g)){const b=Array.isArray(g)?g:[g];for(let S=0;S<b.length;S++){const x=Ag(t,b[S]);if(x){const{transitionEnd:T,transition:_,...k}=x;for(const C in k){let M=k[C];if(Array.isArray(M)){const G=y?M.length-1:0;M=M[G]}M!==null&&(o[C]=M)}for(const C in T)o[C]=T[C]}}}return o}const M_=t=>(e,n)=>{const r=N.useContext(jf),o=N.useContext(Qy),u=()=>JK(t,e,r,o);return n?u():C4(u)};function Eg(t,e,n){const{style:r}=t,o={};for(const u in r)(Jt(r[u])||e.style&&Jt(e.style[u])||O_(u,t)||n?.getValue(u)?.liveStyle!==void 0)&&(o[u]=r[u]);return o}const ZK=M_({scrapeMotionValuesFromProps:Eg,createRenderState:xg});function D_(t,e,n){const r=Eg(t,e,n);for(const o in t)if(Jt(t[o])||Jt(e[o])){const u=Qo.indexOf(o)!==-1?"attr"+o.charAt(0).toUpperCase()+o.substring(1):o;r[u]=t[o]}return r}const QK=M_({scrapeMotionValuesFromProps:D_,createRenderState:k_}),WK=Symbol.for("motionComponentSymbol");function Eo(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function eq(t,e,n){return N.useCallback(r=>{r&&t.onMount&&t.onMount(r),e&&(r?e.mount(r):e.unmount()),n&&(typeof n=="function"?n(r):Eo(n)&&(n.current=r))},[e])}const Og=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),tq="framerAppearId",N_="data-"+Og(tq),$_=N.createContext({});function nq(t,e,n,r,o){const{visualElement:u}=N.useContext(jf),c=N.useContext(T_),f=N.useContext(Qy),h=N.useContext(x_).reducedMotion,m=N.useRef(null);r=r||c.renderer,!m.current&&r&&(m.current=r(t,{visualState:e,parent:u,props:n,presenceContext:f,blockInitialAnimation:f?f.initial===!1:!1,reducedMotionConfig:h}));const y=m.current,g=N.useContext($_);y&&!y.projection&&o&&(y.type==="html"||y.type==="svg")&&iq(m.current,n,o,g);const b=N.useRef(!1);N.useInsertionEffect(()=>{y&&b.current&&y.update(n,f)});const S=n[N_],x=N.useRef(!!S&&!window.MotionHandoffIsComplete?.(S)&&window.MotionHasOptimisedAnimation?.(S));return M4(()=>{y&&(b.current=!0,window.MotionIsMounted=!0,y.updateFeatures(),y.scheduleRenderMicrotask(),x.current&&y.animationState&&y.animationState.animateChanges())}),N.useEffect(()=>{y&&(!x.current&&y.animationState&&y.animationState.animateChanges(),x.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(S)}),x.current=!1),y.enteringChildren=void 0)}),y}function iq(t,e,n,r){const{layoutId:o,layout:u,drag:c,dragConstraints:f,layoutScroll:h,layoutRoot:m,layoutCrossfade:y}=e;t.projection=new n(t.latestValues,e["data-framer-portal-id"]?void 0:j_(t.parent)),t.projection.setOptions({layoutId:o,layout:u,alwaysMeasureLayout:!!c||f&&Eo(f),visualElement:t,animationType:typeof u=="string"?u:"both",initialPromotionConfig:r,crossfade:y,layoutScroll:h,layoutRoot:m})}function j_(t){if(t)return t.options.allowProjection!==!1?t.projection:j_(t.parent)}function jp(t,{forwardMotionProps:e=!1}={},n,r){n&&CK(n);const o=Tg(t)?QK:ZK;function u(f,h){let m;const y={...N.useContext(x_),...f,layoutId:rq(f)},{isStatic:g}=y,b=jK(f),S=o(f,g);if(!g&&Zy){sq();const x=oq(y);m=x.MeasureLayout,b.visualElement=nq(t,S,y,r,x.ProjectionNode)}return F.jsxs(jf.Provider,{value:b,children:[m&&b.visualElement?F.jsx(m,{visualElement:b.visualElement,...y}):null,YK(t,f,eq(S,b.visualElement,h),S,g,e)]})}u.displayName=`motion.${typeof t=="string"?t:`create(${t.displayName??t.name??""})`}`;const c=N.forwardRef(u);return c[WK]=t,c}function rq({layoutId:t}){const e=N.useContext(MO).id;return e&&t!==void 0?e+"-"+t:t}function sq(t,e){N.useContext(T_).strict}function oq(t){const{drag:e,layout:n}=Ho;if(!e&&!n)return{};const r={...e,...n};return{MeasureLayout:e?.isEnabled(t)||n?.isEnabled(t)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}function aq(t,e){if(typeof Proxy>"u")return jp;const n=new Map,r=(u,c)=>jp(u,c,t,e),o=(u,c)=>r(u,c);return new Proxy(o,{get:(u,c)=>c==="create"?r:(n.has(c)||n.set(c,jp(c,void 0,t,e)),n.get(c))})}function B_({top:t,left:e,right:n,bottom:r}){return{x:{min:e,max:n},y:{min:t,max:r}}}function lq({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function uq(t,e){if(!e)return t;const n=e({x:t.left,y:t.top}),r=e({x:t.right,y:t.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function Bp(t){return t===void 0||t===1}function Im({scale:t,scaleX:e,scaleY:n}){return!Bp(t)||!Bp(e)||!Bp(n)}function ms(t){return Im(t)||z_(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function z_(t){return e1(t.x)||e1(t.y)}function e1(t){return t&&t!=="0%"}function rf(t,e,n){const r=t-n,o=e*r;return n+o}function t1(t,e,n,r,o){return o!==void 0&&(t=rf(t,o,r)),rf(t,n,r)+e}function Hm(t,e=0,n=1,r,o){t.min=t1(t.min,e,n,r,o),t.max=t1(t.max,e,n,r,o)}function L_(t,{x:e,y:n}){Hm(t.x,e.translate,e.scale,e.originPoint),Hm(t.y,n.translate,n.scale,n.originPoint)}const n1=.999999999999,i1=1.0000000000001;function cq(t,e,n,r=!1){const o=n.length;if(!o)return;e.x=e.y=1;let u,c;for(let f=0;f<o;f++){u=n[f],c=u.projectionDelta;const{visualElement:h}=u.options;h&&h.props.style&&h.props.style.display==="contents"||(r&&u.options.layoutScroll&&u.scroll&&u!==u.root&&_o(t,{x:-u.scroll.offset.x,y:-u.scroll.offset.y}),c&&(e.x*=c.x.scale,e.y*=c.y.scale,L_(t,c)),r&&ms(u.latestValues)&&_o(t,u.latestValues))}e.x<i1&&e.x>n1&&(e.x=1),e.y<i1&&e.y>n1&&(e.y=1)}function Oo(t,e){t.min=t.min+e,t.max=t.max+e}function r1(t,e,n,r,o=.5){const u=rt(t.min,t.max,o);Hm(t,e,n,u,r)}function _o(t,e){r1(t.x,e.x,e.scaleX,e.scale,e.originX),r1(t.y,e.y,e.scaleY,e.scale,e.originY)}function V_(t,e){return B_(uq(t.getBoundingClientRect(),e))}function fq(t,e,n){const r=V_(t,n),{scroll:o}=e;return o&&(Oo(r.x,o.offset.x),Oo(r.y,o.offset.y)),r}const s1=()=>({translate:0,scale:1,origin:0,originPoint:0}),Ro=()=>({x:s1(),y:s1()}),o1=()=>({min:0,max:0}),Ct=()=>({x:o1(),y:o1()}),Fm={current:null},U_={current:!1};function dq(){if(U_.current=!0,!!Zy)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>Fm.current=t.matches;t.addEventListener("change",e),e()}else Fm.current=!1}const hq=new WeakMap;function pq(t,e,n){for(const r in e){const o=e[r],u=n[r];if(Jt(o))t.addValue(r,o);else if(Jt(u))t.addValue(r,Io(o,{owner:t}));else if(u!==o)if(t.hasValue(r)){const c=t.getValue(r);c.liveStyle===!0?c.jump(o):c.hasAnimated||c.set(o)}else{const c=t.getStaticValue(r);t.addValue(r,Io(c!==void 0?c:o,{owner:t}))}}for(const r in n)e[r]===void 0&&t.removeValue(r);return e}const a1=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class mq{scrapeMotionValuesFromProps(e,n,r){return{}}constructor({parent:e,props:n,presenceContext:r,reducedMotionConfig:o,blockInitialAnimation:u,visualState:c},f={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=pg,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const b=fn.now();this.renderScheduledAt<b&&(this.renderScheduledAt=b,it.render(this.render,!1,!0))};const{latestValues:h,renderState:m}=c;this.latestValues=h,this.baseTarget={...h},this.initialValues=n.initial?{...h}:{},this.renderState=m,this.parent=e,this.props=n,this.presenceContext=r,this.depth=e?e.depth+1:0,this.reducedMotionConfig=o,this.options=f,this.blockInitialAnimation=!!u,this.isControllingVariants=zf(n),this.isVariantNode=E_(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:y,...g}=this.scrapeMotionValuesFromProps(n,{},this);for(const b in g){const S=g[b];h[b]!==void 0&&Jt(S)&&S.set(h[b])}}mount(e){this.current=e,hq.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((n,r)=>this.bindToMotionValue(r,n)),U_.current||dq(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:Fm.current,this.parent?.addChild(this),this.update(this.props,this.presenceContext)}unmount(){this.projection&&this.projection.unmount(),Vr(this.notifyUpdate),Vr(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(const e in this.events)this.events[e].clear();for(const e in this.features){const n=this.features[e];n&&(n.unmount(),n.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,n){this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)();const r=Wo.has(e);r&&this.onBindTransform&&this.onBindTransform();const o=n.on("change",c=>{this.latestValues[e]=c,this.props.onUpdate&&it.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let u;window.MotionCheckAppearSync&&(u=window.MotionCheckAppearSync(this,e,n)),this.valueSubscriptions.set(e,()=>{o(),u&&u(),n.owner&&n.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in Ho){const n=Ho[e];if(!n)continue;const{isEnabled:r,Feature:o}=n;if(!this.features[e]&&o&&r(this.props)&&(this.features[e]=new o(this)),this.features[e]){const u=this.features[e];u.isMounted?u.update():(u.mount(),u.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Ct()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,n){this.latestValues[e]=n}update(e,n){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let r=0;r<a1.length;r++){const o=a1[r];this.propEventSubscriptions[o]&&(this.propEventSubscriptions[o](),delete this.propEventSubscriptions[o]);const u="on"+o,c=e[u];c&&(this.propEventSubscriptions[o]=this.on(o,c))}this.prevMotionValues=pq(this,this.scrapeMotionValuesFromProps(e,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){const n=this.getClosestVariantNode();if(n)return n.variantChildren&&n.variantChildren.add(e),()=>n.variantChildren.delete(e)}addValue(e,n){const r=this.values.get(e);n!==r&&(r&&this.removeValue(e),this.bindToMotionValue(e,n),this.values.set(e,n),this.latestValues[e]=n.get())}removeValue(e){this.values.delete(e);const n=this.valueSubscriptions.get(e);n&&(n(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,n){if(this.props.values&&this.props.values[e])return this.props.values[e];let r=this.values.get(e);return r===void 0&&n!==void 0&&(r=Io(n===null?void 0:n,{owner:this}),this.addValue(e,r)),r}readValue(e,n){let r=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options);return r!=null&&(typeof r=="string"&&(DO(r)||$O(r))?r=parseFloat(r):!RK(r)&&Ur.test(n)&&(r=y_(e,n)),this.setBaseTarget(e,Jt(r)?r.get():r)),Jt(r)?r.get():r}setBaseTarget(e,n){this.baseTarget[e]=n}getBaseTarget(e){const{initial:n}=this.props;let r;if(typeof n=="string"||typeof n=="object"){const u=Ag(this.props,n,this.presenceContext?.custom);u&&(r=u[e])}if(n&&r!==void 0)return r;const o=this.getBaseTargetFromProps(this.props,e);return o!==void 0&&!Jt(o)?o:this.initialValues[e]!==void 0&&r===void 0?void 0:this.baseTarget[e]}on(e,n){return this.events[e]||(this.events[e]=new ig),this.events[e].add(n)}notify(e,...n){this.events[e]&&this.events[e].notify(...n)}scheduleRenderMicrotask(){gg.render(this.render)}}class K_ extends mq{constructor(){super(...arguments),this.KeyframeResolver=mK}sortInstanceNodePosition(e,n){return e.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(e,n){return e.style?e.style[n]:void 0}removeValueFromRenderState(e,{vars:n,style:r}){delete n[e],delete r[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;Jt(e)&&(this.childSubscription=e.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}function q_(t,{style:e,vars:n},r,o){const u=t.style;let c;for(c in e)u[c]=e[c];o?.applyProjectionStyles(u,r);for(c in n)u.setProperty(c,n[c])}function yq(t){return window.getComputedStyle(t)}class gq extends K_{constructor(){super(...arguments),this.type="html",this.renderInstance=q_}readValueFromInstance(e,n){if(Wo.has(n))return this.projection?.isProjecting?Bm(n):$U(e,n);{const r=yq(e),o=(YO(n)?r.getPropertyValue(n):r[n])||0;return typeof o=="string"?o.trim():o}}measureInstanceViewportBox(e,{transformPagePoint:n}){return V_(e,n)}build(e,n,r){wg(e,n,r.transformTemplate)}scrapeMotionValuesFromProps(e,n,r){return Eg(e,n,r)}}const P_=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function vq(t,e,n,r){q_(t,e,void 0,r);for(const o in e.attrs)t.setAttribute(P_.has(o)?o:Og(o),e.attrs[o])}class bq extends K_{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Ct}getBaseTargetFromProps(e,n){return e[n]}readValueFromInstance(e,n){if(Wo.has(n)){const r=m_(n);return r&&r.default||0}return n=P_.has(n)?n:Og(n),e.getAttribute(n)}scrapeMotionValuesFromProps(e,n,r){return D_(e,n,r)}build(e,n,r){R_(e,n,this.isSVGTag,r.transformTemplate,r.style)}renderInstance(e,n,r,o){vq(e,n,r,o)}mount(e){this.isSVGTag=C_(e.tagName),super.mount(e)}}const Sq=(t,e)=>Tg(t)?new bq(e):new gq(e,{allowProjection:t!==N.Fragment});function Bo(t,e,n){const r=t.getProps();return Ag(r,e,n!==void 0?n:r.custom,t)}const Gm=t=>Array.isArray(t);function wq(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,Io(n))}function xq(t){return Gm(t)?t[t.length-1]||0:t}function Tq(t,e){const n=Bo(t,e);let{transitionEnd:r={},transition:o={},...u}=n||{};u={...u,...r};for(const c in u){const f=xq(u[c]);wq(t,c,f)}}function Aq(t){return!!(Jt(t)&&t.add)}function Ym(t,e){const n=t.getValue("willChange");if(Aq(n))return n.add(e);if(!n&&er.WillChange){const r=new er.WillChange("auto");t.addValue("willChange",r),r.add(e)}}function I_(t){return t.props[N_]}const Eq=t=>t!==null;function Oq(t,{repeat:e,repeatType:n="loop"},r){const o=t.filter(Eq),u=e&&n!=="loop"&&e%2===1?0:o.length-1;return o[u]}const _q={type:"spring",stiffness:500,damping:25,restSpeed:10},Rq=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),kq={type:"keyframes",duration:.8},Cq={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},Mq=(t,{keyframes:e})=>e.length>2?kq:Wo.has(t)?t.startsWith("scale")?Rq(e[1]):_q:Cq;function Dq({when:t,delay:e,delayChildren:n,staggerChildren:r,staggerDirection:o,repeat:u,repeatType:c,repeatDelay:f,from:h,elapsed:m,...y}){return!!Object.keys(y).length}const _g=(t,e,n,r={},o,u)=>c=>{const f=mg(r,t)||{},h=f.delay||r.delay||0;let{elapsed:m=0}=r;m=m-pi(h);const y={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:e.getVelocity(),...f,delay:-m,onUpdate:b=>{e.set(b),f.onUpdate&&f.onUpdate(b)},onComplete:()=>{c(),f.onComplete&&f.onComplete()},name:t,motionValue:e,element:u?void 0:o};Dq(f)||Object.assign(y,Mq(t,y)),y.duration&&(y.duration=pi(y.duration)),y.repeatDelay&&(y.repeatDelay=pi(y.repeatDelay)),y.from!==void 0&&(y.keyframes[0]=y.from);let g=!1;if((y.type===!1||y.duration===0&&!y.repeatDelay)&&(Km(y),y.delay===0&&(g=!0)),(er.instantAnimations||er.skipAnimations)&&(g=!0,Km(y),y.delay=0),y.allowFlatten=!f.type&&!f.ease,g&&!u&&e.get()!==void 0){const b=Oq(y.keyframes,f);if(b!==void 0){it.update(()=>{y.onUpdate(b),y.onComplete()});return}}return f.isSync?new hg(y):new iK(y)};function Nq({protectedKeys:t,needsAnimating:e},n){const r=t.hasOwnProperty(n)&&e[n]!==!0;return e[n]=!1,r}function H_(t,e,{delay:n=0,transitionOverride:r,type:o}={}){let{transition:u=t.getDefaultTransition(),transitionEnd:c,...f}=e;r&&(u=r);const h=[],m=o&&t.animationState&&t.animationState.getState()[o];for(const y in f){const g=t.getValue(y,t.latestValues[y]??null),b=f[y];if(b===void 0||m&&Nq(m,y))continue;const S={delay:n,...mg(u||{},y)},x=g.get();if(x!==void 0&&!g.isAnimating&&!Array.isArray(b)&&b===x&&!S.velocity)continue;let T=!1;if(window.MotionHandoffAnimation){const k=I_(t);if(k){const C=window.MotionHandoffAnimation(k,y,it);C!==null&&(S.startTime=C,T=!0)}}Ym(t,y),g.start(_g(y,g,b,t.shouldReduceMotion&&d_.has(y)?{type:!1}:S,t,T));const _=g.animation;_&&h.push(_)}return c&&Promise.all(h).then(()=>{it.update(()=>{c&&Tq(t,c)})}),h}function F_(t,e,n,r=0,o=1){const u=Array.from(t).sort((m,y)=>m.sortNodePosition(y)).indexOf(e),c=t.size,f=(c-1)*r;return typeof n=="function"?n(u,c):o===1?u*r:f-u*r}function Jm(t,e,n={}){const r=Bo(t,e,n.type==="exit"?t.presenceContext?.custom:void 0);let{transition:o=t.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(o=n.transitionOverride);const u=r?()=>Promise.all(H_(t,r,n)):()=>Promise.resolve(),c=t.variantChildren&&t.variantChildren.size?(h=0)=>{const{delayChildren:m=0,staggerChildren:y,staggerDirection:g}=o;return $q(t,e,h,m,y,g,n)}:()=>Promise.resolve(),{when:f}=o;if(f){const[h,m]=f==="beforeChildren"?[u,c]:[c,u];return h().then(()=>m())}else return Promise.all([u(),c(n.delay)])}function $q(t,e,n=0,r=0,o=0,u=1,c){const f=[];for(const h of t.variantChildren)h.notify("AnimationStart",e),f.push(Jm(h,e,{...c,delay:n+(typeof r=="function"?0:r)+F_(t.variantChildren,h,r,o,u)}).then(()=>h.notify("AnimationComplete",e)));return Promise.all(f)}function jq(t,e,n={}){t.notify("AnimationStart",e);let r;if(Array.isArray(e)){const o=e.map(u=>Jm(t,u,n));r=Promise.all(o)}else if(typeof e=="string")r=Jm(t,e,n);else{const o=typeof e=="function"?Bo(t,e,n.custom):e;r=Promise.all(H_(t,o,n))}return r.then(()=>{t.notify("AnimationComplete",e)})}function G_(t,e){if(!Array.isArray(e))return!1;const n=e.length;if(n!==t.length)return!1;for(let r=0;r<n;r++)if(e[r]!==t[r])return!1;return!0}const Bq=Sg.length;function Y_(t){if(!t)return;if(!t.isControllingVariants){const n=t.parent?Y_(t.parent)||{}:{};return t.props.initial!==void 0&&(n.initial=t.props.initial),n}const e={};for(let n=0;n<Bq;n++){const r=Sg[n],o=t.props[r];(wl(o)||o===!1)&&(e[r]=o)}return e}const zq=[...bg].reverse(),Lq=bg.length;function Vq(t){return e=>Promise.all(e.map(({animation:n,options:r})=>jq(t,n,r)))}function Uq(t){let e=Vq(t),n=l1(),r=!0;const o=h=>(m,y)=>{const g=Bo(t,y,h==="exit"?t.presenceContext?.custom:void 0);if(g){const{transition:b,transitionEnd:S,...x}=g;m={...m,...x,...S}}return m};function u(h){e=h(t)}function c(h){const{props:m}=t,y=Y_(t.parent)||{},g=[],b=new Set;let S={},x=1/0;for(let _=0;_<Lq;_++){const k=zq[_],C=n[k],M=m[k]!==void 0?m[k]:y[k],G=wl(M),I=k===h?C.isActive:null;I===!1&&(x=_);let ee=M===y[k]&&M!==m[k]&&G;if(ee&&r&&t.manuallyAnimateOnMount&&(ee=!1),C.protectedKeys={...S},!C.isActive&&I===null||!M&&!C.prevProp||Bf(M)||typeof M=="boolean")continue;const J=Kq(C.prevProp,M);let X=J||k===h&&C.isActive&&!ee&&G||_>x&&G,he=!1;const pe=Array.isArray(M)?M:[M];let we=pe.reduce(o(k),{});I===!1&&(we={});const{prevResolvedValues:je={}}=C,be={...je,...we},Z=U=>{X=!0,b.has(U)&&(he=!0,b.delete(U)),C.needsAnimating[U]=!0;const L=t.getValue(U);L&&(L.liveStyle=!1)};for(const U in be){const L=we[U],te=je[U];if(S.hasOwnProperty(U))continue;let oe=!1;Gm(L)&&Gm(te)?oe=!G_(L,te):oe=L!==te,oe?L!=null?Z(U):b.add(U):L!==void 0&&b.has(U)?Z(U):C.protectedKeys[U]=!0}C.prevProp=M,C.prevResolvedValues=we,C.isActive&&(S={...S,...we}),r&&t.blockInitialAnimation&&(X=!1);const ne=ee&&J;X&&(!ne||he)&&g.push(...pe.map(U=>{const L={type:k};if(typeof U=="string"&&r&&!ne&&t.manuallyAnimateOnMount&&t.parent){const{parent:te}=t,oe=Bo(te,U);if(te.enteringChildren&&oe){const{delayChildren:E}=oe.transition||{};L.delay=F_(te.enteringChildren,t,E)}}return{animation:U,options:L}}))}if(b.size){const _={};if(typeof m.initial!="boolean"){const k=Bo(t,Array.isArray(m.initial)?m.initial[0]:m.initial);k&&k.transition&&(_.transition=k.transition)}b.forEach(k=>{const C=t.getBaseTarget(k),M=t.getValue(k);M&&(M.liveStyle=!0),_[k]=C??null}),g.push({animation:_})}let T=!!g.length;return r&&(m.initial===!1||m.initial===m.animate)&&!t.manuallyAnimateOnMount&&(T=!1),r=!1,T?e(g):Promise.resolve()}function f(h,m){if(n[h].isActive===m)return Promise.resolve();t.variantChildren?.forEach(g=>g.animationState?.setActive(h,m)),n[h].isActive=m;const y=c(h);for(const g in n)n[g].protectedKeys={};return y}return{animateChanges:c,setActive:f,setAnimateFunction:u,getState:()=>n,reset:()=>{n=l1()}}}function Kq(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!G_(e,t):!1}function ds(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function l1(){return{animate:ds(!0),whileInView:ds(),whileHover:ds(),whileTap:ds(),whileDrag:ds(),whileFocus:ds(),exit:ds()}}class Gr{constructor(e){this.isMounted=!1,this.node=e}update(){}}class qq extends Gr{constructor(e){super(e),e.animationState||(e.animationState=Uq(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();Bf(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:n}=this.node.prevProps||{};e!==n&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}}let Pq=0;class Iq extends Gr{constructor(){super(...arguments),this.id=Pq++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:n}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===r)return;const o=this.node.animationState.setActive("exit",!e);n&&!e&&o.then(()=>{n(this.id)})}mount(){const{register:e,onExitComplete:n}=this.node.presenceContext||{};n&&n(this.id),e&&(this.unmount=e(this.id))}unmount(){}}const Hq={animation:{Feature:qq},exit:{Feature:Iq}};function xl(t,e,n,r={passive:!0}){return t.addEventListener(e,n,r),()=>t.removeEventListener(e,n)}function Ll(t){return{point:{x:t.pageX,y:t.pageY}}}const Fq=t=>e=>vg(e)&&t(e,Ll(e));function ol(t,e,n,r){return xl(t,e,Fq(n),r)}const J_=1e-4,Gq=1-J_,Yq=1+J_,X_=.01,Jq=0-X_,Xq=0+X_;function Wt(t){return t.max-t.min}function Zq(t,e,n){return Math.abs(t-e)<=n}function u1(t,e,n,r=.5){t.origin=r,t.originPoint=rt(e.min,e.max,t.origin),t.scale=Wt(n)/Wt(e),t.translate=rt(n.min,n.max,t.origin)-t.originPoint,(t.scale>=Gq&&t.scale<=Yq||isNaN(t.scale))&&(t.scale=1),(t.translate>=Jq&&t.translate<=Xq||isNaN(t.translate))&&(t.translate=0)}function al(t,e,n,r){u1(t.x,e.x,n.x,r?r.originX:void 0),u1(t.y,e.y,n.y,r?r.originY:void 0)}function c1(t,e,n){t.min=n.min+e.min,t.max=t.min+Wt(e)}function Qq(t,e,n){c1(t.x,e.x,n.x),c1(t.y,e.y,n.y)}function f1(t,e,n){t.min=e.min-n.min,t.max=t.min+Wt(e)}function sf(t,e,n){f1(t.x,e.x,n.x),f1(t.y,e.y,n.y)}function zn(t){return[t("x"),t("y")]}const Z_=({current:t})=>t?t.ownerDocument.defaultView:null,d1=(t,e)=>Math.abs(t-e);function Wq(t,e){const n=d1(t.x,e.x),r=d1(t.y,e.y);return Math.sqrt(n**2+r**2)}class Q_{constructor(e,n,{transformPagePoint:r,contextWindow:o=window,dragSnapToOrigin:u=!1,distanceThreshold:c=3}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const b=Lp(this.lastMoveEventInfo,this.history),S=this.startEvent!==null,x=Wq(b.offset,{x:0,y:0})>=this.distanceThreshold;if(!S&&!x)return;const{point:T}=b,{timestamp:_}=Ht;this.history.push({...T,timestamp:_});const{onStart:k,onMove:C}=this.handlers;S||(k&&k(this.lastMoveEvent,b),this.startEvent=this.lastMoveEvent),C&&C(this.lastMoveEvent,b)},this.handlePointerMove=(b,S)=>{this.lastMoveEvent=b,this.lastMoveEventInfo=zp(S,this.transformPagePoint),it.update(this.updatePoint,!0)},this.handlePointerUp=(b,S)=>{this.end();const{onEnd:x,onSessionEnd:T,resumeAnimation:_}=this.handlers;if(this.dragSnapToOrigin&&_&&_(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const k=Lp(b.type==="pointercancel"?this.lastMoveEventInfo:zp(S,this.transformPagePoint),this.history);this.startEvent&&x&&x(b,k),T&&T(b,k)},!vg(e))return;this.dragSnapToOrigin=u,this.handlers=n,this.transformPagePoint=r,this.distanceThreshold=c,this.contextWindow=o||window;const f=Ll(e),h=zp(f,this.transformPagePoint),{point:m}=h,{timestamp:y}=Ht;this.history=[{...m,timestamp:y}];const{onSessionStart:g}=n;g&&g(e,Lp(h,this.history)),this.removeListeners=jl(ol(this.contextWindow,"pointermove",this.handlePointerMove),ol(this.contextWindow,"pointerup",this.handlePointerUp),ol(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),Vr(this.updatePoint)}}function zp(t,e){return e?{point:e(t.point)}:t}function h1(t,e){return{x:t.x-e.x,y:t.y-e.y}}function Lp({point:t},e){return{point:t,delta:h1(t,W_(e)),offset:h1(t,e6(e)),velocity:t6(e,.1)}}function e6(t){return t[0]}function W_(t){return t[t.length-1]}function t6(t,e){if(t.length<2)return{x:0,y:0};let n=t.length-1,r=null;const o=W_(t);for(;n>=0&&(r=t[n],!(o.timestamp-r.timestamp>pi(e)));)n--;if(!r)return{x:0,y:0};const u=Un(o.timestamp-r.timestamp);if(u===0)return{x:0,y:0};const c={x:(o.x-r.x)/u,y:(o.y-r.y)/u};return c.x===1/0&&(c.x=0),c.y===1/0&&(c.y=0),c}function n6(t,{min:e,max:n},r){return e!==void 0&&t<e?t=r?rt(e,t,r.min):Math.max(t,e):n!==void 0&&t>n&&(t=r?rt(n,t,r.max):Math.min(t,n)),t}function p1(t,e,n){return{min:e!==void 0?t.min+e:void 0,max:n!==void 0?t.max+n-(t.max-t.min):void 0}}function i6(t,{top:e,left:n,bottom:r,right:o}){return{x:p1(t.x,n,o),y:p1(t.y,e,r)}}function m1(t,e){let n=e.min-t.min,r=e.max-t.max;return e.max-e.min<t.max-t.min&&([n,r]=[r,n]),{min:n,max:r}}function r6(t,e){return{x:m1(t.x,e.x),y:m1(t.y,e.y)}}function s6(t,e){let n=.5;const r=Wt(t),o=Wt(e);return o>r?n=vl(e.min,e.max-r,t.min):r>o&&(n=vl(t.min,t.max-o,e.min)),Wi(0,1,n)}function o6(t,e){const n={};return e.min!==void 0&&(n.min=e.min-t.min),e.max!==void 0&&(n.max=e.max-t.min),n}const Xm=.35;function a6(t=Xm){return t===!1?t=0:t===!0&&(t=Xm),{x:y1(t,"left","right"),y:y1(t,"top","bottom")}}function y1(t,e,n){return{min:g1(t,e),max:g1(t,n)}}function g1(t,e){return typeof t=="number"?t:t[e]||0}const l6=new WeakMap;class u6{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=Ct(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:n=!1,distanceThreshold:r}={}){const{presenceContext:o}=this.visualElement;if(o&&o.isPresent===!1)return;const u=g=>{const{dragSnapToOrigin:b}=this.getProps();b?this.pauseAnimation():this.stopAnimation(),n&&this.snapToCursor(Ll(g).point)},c=(g,b)=>{const{drag:S,dragPropagation:x,onDragStart:T}=this.getProps();if(S&&!x&&(this.openDragLock&&this.openDragLock(),this.openDragLock=SK(S),!this.openDragLock))return;this.latestPointerEvent=g,this.latestPanInfo=b,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),zn(k=>{let C=this.getAxisMotionValue(k).get()||0;if(mi.test(C)){const{projection:M}=this.visualElement;if(M&&M.layout){const G=M.layout.layoutBox[k];G&&(C=Wt(G)*(parseFloat(C)/100))}}this.originPoint[k]=C}),T&&it.postRender(()=>T(g,b)),Ym(this.visualElement,"transform");const{animationState:_}=this.visualElement;_&&_.setActive("whileDrag",!0)},f=(g,b)=>{this.latestPointerEvent=g,this.latestPanInfo=b;const{dragPropagation:S,dragDirectionLock:x,onDirectionLock:T,onDrag:_}=this.getProps();if(!S&&!this.openDragLock)return;const{offset:k}=b;if(x&&this.currentDirection===null){this.currentDirection=c6(k),this.currentDirection!==null&&T&&T(this.currentDirection);return}this.updateAxis("x",b.point,k),this.updateAxis("y",b.point,k),this.visualElement.render(),_&&_(g,b)},h=(g,b)=>{this.latestPointerEvent=g,this.latestPanInfo=b,this.stop(g,b),this.latestPointerEvent=null,this.latestPanInfo=null},m=()=>zn(g=>this.getAnimationState(g)==="paused"&&this.getAxisMotionValue(g).animation?.play()),{dragSnapToOrigin:y}=this.getProps();this.panSession=new Q_(e,{onSessionStart:u,onStart:c,onMove:f,onSessionEnd:h,resumeAnimation:m},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:y,distanceThreshold:r,contextWindow:Z_(this.visualElement)})}stop(e,n){const r=e||this.latestPointerEvent,o=n||this.latestPanInfo,u=this.isDragging;if(this.cancel(),!u||!o||!r)return;const{velocity:c}=o;this.startAnimation(c);const{onDragEnd:f}=this.getProps();f&&it.postRender(()=>f(r,o))}cancel(){this.isDragging=!1;const{projection:e,animationState:n}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(e,n,r){const{drag:o}=this.getProps();if(!r||!gc(e,o,this.currentDirection))return;const u=this.getAxisMotionValue(e);let c=this.originPoint[e]+r[e];this.constraints&&this.constraints[e]&&(c=n6(c,this.constraints[e],this.elastic[e])),u.set(c)}resolveConstraints(){const{dragConstraints:e,dragElastic:n}=this.getProps(),r=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,o=this.constraints;e&&Eo(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&r?this.constraints=i6(r.layoutBox,e):this.constraints=!1,this.elastic=a6(n),o!==this.constraints&&r&&this.constraints&&!this.hasMutatedConstraints&&zn(u=>{this.constraints!==!1&&this.getAxisMotionValue(u)&&(this.constraints[u]=o6(r.layoutBox[u],this.constraints[u]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:n}=this.getProps();if(!e||!Eo(e))return!1;const r=e.current,{projection:o}=this.visualElement;if(!o||!o.layout)return!1;const u=fq(r,o.root,this.visualElement.getTransformPagePoint());let c=r6(o.layout.layoutBox,u);if(n){const f=n(lq(c));this.hasMutatedConstraints=!!f,f&&(c=B_(f))}return c}startAnimation(e){const{drag:n,dragMomentum:r,dragElastic:o,dragTransition:u,dragSnapToOrigin:c,onDragTransitionEnd:f}=this.getProps(),h=this.constraints||{},m=zn(y=>{if(!gc(y,n,this.currentDirection))return;let g=h&&h[y]||{};c&&(g={min:0,max:0});const b=o?200:1e6,S=o?40:1e7,x={type:"inertia",velocity:r?e[y]:0,bounceStiffness:b,bounceDamping:S,timeConstant:750,restDelta:1,restSpeed:10,...u,...g};return this.startAxisValueAnimation(y,x)});return Promise.all(m).then(f)}startAxisValueAnimation(e,n){const r=this.getAxisMotionValue(e);return Ym(this.visualElement,e),r.start(_g(e,r,0,n,this.visualElement,!1))}stopAnimation(){zn(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){zn(e=>this.getAxisMotionValue(e).animation?.pause())}getAnimationState(e){return this.getAxisMotionValue(e).animation?.state}getAxisMotionValue(e){const n=`_drag${e.toUpperCase()}`,r=this.visualElement.getProps(),o=r[n];return o||this.visualElement.getValue(e,(r.initial?r.initial[e]:void 0)||0)}snapToCursor(e){zn(n=>{const{drag:r}=this.getProps();if(!gc(n,r,this.currentDirection))return;const{projection:o}=this.visualElement,u=this.getAxisMotionValue(n);if(o&&o.layout){const{min:c,max:f}=o.layout.layoutBox[n];u.set(e[n]-rt(c,f,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!Eo(n)||!r||!this.constraints)return;this.stopAnimation();const o={x:0,y:0};zn(c=>{const f=this.getAxisMotionValue(c);if(f&&this.constraints!==!1){const h=f.get();o[c]=s6({min:h,max:h},this.constraints[c])}});const{transformTemplate:u}=this.visualElement.getProps();this.visualElement.current.style.transform=u?u({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.resolveConstraints(),zn(c=>{if(!gc(c,e,null))return;const f=this.getAxisMotionValue(c),{min:h,max:m}=this.constraints[c];f.set(rt(h,m,o[c]))})}addListeners(){if(!this.visualElement.current)return;l6.set(this.visualElement,this);const e=this.visualElement.current,n=ol(e,"pointerdown",h=>{const{drag:m,dragListener:y=!0}=this.getProps();m&&y&&this.start(h)}),r=()=>{const{dragConstraints:h}=this.getProps();Eo(h)&&h.current&&(this.constraints=this.resolveRefConstraints())},{projection:o}=this.visualElement,u=o.addEventListener("measure",r);o&&!o.layout&&(o.root&&o.root.updateScroll(),o.updateLayout()),it.read(r);const c=xl(window,"resize",()=>this.scalePositionWithinConstraints()),f=o.addEventListener("didUpdate",(({delta:h,hasLayoutChanged:m})=>{this.isDragging&&m&&(zn(y=>{const g=this.getAxisMotionValue(y);g&&(this.originPoint[y]+=h[y].translate,g.set(g.get()+h[y].translate))}),this.visualElement.render())}));return()=>{c(),n(),u(),f&&f()}}getProps(){const e=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:r=!1,dragPropagation:o=!1,dragConstraints:u=!1,dragElastic:c=Xm,dragMomentum:f=!0}=e;return{...e,drag:n,dragDirectionLock:r,dragPropagation:o,dragConstraints:u,dragElastic:c,dragMomentum:f}}}function gc(t,e,n){return(e===!0||e===t)&&(n===null||n===t)}function c6(t,e=10){let n=null;return Math.abs(t.y)>e?n="y":Math.abs(t.x)>e&&(n="x"),n}class f6 extends Gr{constructor(e){super(e),this.removeGroupControls=Kn,this.removeListeners=Kn,this.controls=new u6(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Kn}unmount(){this.removeGroupControls(),this.removeListeners()}}const v1=t=>(e,n)=>{t&&it.postRender(()=>t(e,n))};class d6 extends Gr{constructor(){super(...arguments),this.removePointerDownListener=Kn}onPointerDown(e){this.session=new Q_(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:Z_(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:n,onPan:r,onPanEnd:o}=this.node.getProps();return{onSessionStart:v1(e),onStart:v1(n),onMove:r,onEnd:(u,c)=>{delete this.session,o&&it.postRender(()=>o(u,c))}}}mount(){this.removePointerDownListener=ol(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const Dc={hasAnimatedSinceResize:!0,hasEverUpdated:!1};let Vp=!1;class h6 extends N.Component{componentDidMount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:r,layoutId:o}=this.props,{projection:u}=e;u&&(n.group&&n.group.add(u),r&&r.register&&o&&r.register(u),Vp&&u.root.didUpdate(),u.addEventListener("animationComplete",()=>{this.safeToRemove()}),u.setOptions({...u.options,onExitComplete:()=>this.safeToRemove()})),Dc.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:n,visualElement:r,drag:o,isPresent:u}=this.props,{projection:c}=r;return c&&(c.isPresent=u,Vp=!0,o||e.layoutDependency!==n||n===void 0||e.isPresent!==u?c.willUpdate():this.safeToRemove(),e.isPresent!==u&&(u?c.promote():c.relegate()||it.postRender(()=>{const f=c.getStack();(!f||!f.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),gg.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:o}=e;Vp=!0,o&&(o.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(o),r&&r.deregister&&r.deregister(o))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function eR(t){const[e,n]=kK(),r=N.useContext(MO);return F.jsx(h6,{...t,layoutGroup:r,switchLayoutGroup:N.useContext($_),isPresent:e,safeToRemove:n})}function p6(t,e,n){const r=Jt(t)?t:Io(t);return r.start(_g("",r,e,n)),r.animation}const m6=(t,e)=>t.depth-e.depth;class y6{constructor(){this.children=[],this.isDirty=!1}add(e){Wy(this.children,e),this.isDirty=!0}remove(e){eg(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(m6),this.isDirty=!1,this.children.forEach(e)}}function g6(t,e){const n=fn.now(),r=({timestamp:o})=>{const u=o-n;u>=e&&(Vr(r),t(u-e))};return it.setup(r,!0),()=>Vr(r)}const tR=["TopLeft","TopRight","BottomLeft","BottomRight"],v6=tR.length,b1=t=>typeof t=="string"?parseFloat(t):t,S1=t=>typeof t=="number"||de.test(t);function b6(t,e,n,r,o,u){o?(t.opacity=rt(0,n.opacity??1,S6(r)),t.opacityExit=rt(e.opacity??1,0,w6(r))):u&&(t.opacity=rt(e.opacity??1,n.opacity??1,r));for(let c=0;c<v6;c++){const f=`border${tR[c]}Radius`;let h=w1(e,f),m=w1(n,f);if(h===void 0&&m===void 0)continue;h||(h=0),m||(m=0),h===0||m===0||S1(h)===S1(m)?(t[f]=Math.max(rt(b1(h),b1(m),r),0),(mi.test(m)||mi.test(h))&&(t[f]+="%")):t[f]=m}(e.rotate||n.rotate)&&(t.rotate=rt(e.rotate||0,n.rotate||0,r))}function w1(t,e){return t[e]!==void 0?t[e]:t.borderRadius}const S6=nR(0,.5,qO),w6=nR(.5,.95,Kn);function nR(t,e,n){return r=>r<t?0:r>e?1:n(vl(t,e,r))}function x1(t,e){t.min=e.min,t.max=e.max}function Yn(t,e){x1(t.x,e.x),x1(t.y,e.y)}function T1(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}function A1(t,e,n,r,o){return t-=e,t=rf(t,1/n,r),o!==void 0&&(t=rf(t,1/o,r)),t}function x6(t,e=0,n=1,r=.5,o,u=t,c=t){if(mi.test(e)&&(e=parseFloat(e),e=rt(c.min,c.max,e/100)-c.min),typeof e!="number")return;let f=rt(u.min,u.max,r);t===u&&(f-=e),t.min=A1(t.min,e,n,f,o),t.max=A1(t.max,e,n,f,o)}function E1(t,e,[n,r,o],u,c){x6(t,e[n],e[r],e[o],e.scale,u,c)}const T6=["x","scaleX","originX"],A6=["y","scaleY","originY"];function O1(t,e,n,r){E1(t.x,e,T6,n?n.x:void 0,r?r.x:void 0),E1(t.y,e,A6,n?n.y:void 0,r?r.y:void 0)}function _1(t){return t.translate===0&&t.scale===1}function iR(t){return _1(t.x)&&_1(t.y)}function R1(t,e){return t.min===e.min&&t.max===e.max}function E6(t,e){return R1(t.x,e.x)&&R1(t.y,e.y)}function k1(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function rR(t,e){return k1(t.x,e.x)&&k1(t.y,e.y)}function C1(t){return Wt(t.x)/Wt(t.y)}function M1(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}class O6{constructor(){this.members=[]}add(e){Wy(this.members,e),e.scheduleRender()}remove(e){if(eg(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(e){const n=this.members.findIndex(o=>e===o);if(n===0)return!1;let r;for(let o=n;o>=0;o--){const u=this.members[o];if(u.isPresent!==!1){r=u;break}}return r?(this.promote(r),!0):!1}promote(e,n){const r=this.lead;if(e!==r&&(this.prevLead=r,this.lead=e,e.show(),r)){r.instance&&r.scheduleRender(),e.scheduleRender(),e.resumeFrom=r,n&&(e.resumeFrom.preserveOpacity=!0),r.snapshot&&(e.snapshot=r.snapshot,e.snapshot.latestValues=r.animationValues||r.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);const{crossfade:o}=e.options;o===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const{options:n,resumingFrom:r}=e;n.onExitComplete&&n.onExitComplete(),r&&r.options.onExitComplete&&r.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function _6(t,e,n){let r="";const o=t.x.translate/e.x,u=t.y.translate/e.y,c=n?.z||0;if((o||u||c)&&(r=`translate3d(${o}px, ${u}px, ${c}px) `),(e.x!==1||e.y!==1)&&(r+=`scale(${1/e.x}, ${1/e.y}) `),n){const{transformPerspective:m,rotate:y,rotateX:g,rotateY:b,skewX:S,skewY:x}=n;m&&(r=`perspective(${m}px) ${r}`),y&&(r+=`rotate(${y}deg) `),g&&(r+=`rotateX(${g}deg) `),b&&(r+=`rotateY(${b}deg) `),S&&(r+=`skewX(${S}deg) `),x&&(r+=`skewY(${x}deg) `)}const f=t.x.scale*e.x,h=t.y.scale*e.y;return(f!==1||h!==1)&&(r+=`scale(${f}, ${h})`),r||"none"}const Up=["","X","Y","Z"],R6=1e3;let k6=0;function Kp(t,e,n,r){const{latestValues:o}=e;o[t]&&(n[t]=o[t],e.setStaticValue(t,0),r&&(r[t]=0))}function sR(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const n=I_(e);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:o,layoutId:u}=t.options;window.MotionCancelOptimisedAnimation(n,"transform",it,!(o||u))}const{parent:r}=t;r&&!r.hasCheckedOptimisedAppear&&sR(r)}function oR({attachResizeListener:t,defaultParent:e,measureScroll:n,checkIsScrollRoot:r,resetTransform:o}){return class{constructor(c={},f=e?.()){this.id=k6++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(D6),this.nodes.forEach(B6),this.nodes.forEach(z6),this.nodes.forEach(N6)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=c,this.root=f?f.root||f:this,this.path=f?[...f.path,f]:[],this.parent=f,this.depth=f?f.depth+1:0;for(let h=0;h<this.path.length;h++)this.path[h].shouldResetTransform=!0;this.root===this&&(this.nodes=new y6)}addEventListener(c,f){return this.eventHandlers.has(c)||this.eventHandlers.set(c,new ig),this.eventHandlers.get(c).add(f)}notifyListeners(c,...f){const h=this.eventHandlers.get(c);h&&h.notify(...f)}hasListeners(c){return this.eventHandlers.has(c)}mount(c){if(this.instance)return;this.isSVG=w_(c)&&!OK(c),this.instance=c;const{layoutId:f,layout:h,visualElement:m}=this.options;if(m&&!m.current&&m.mount(c),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(h||f)&&(this.isLayoutDirty=!0),t){let y,g=0;const b=()=>this.root.updateBlockedByResize=!1;it.read(()=>{g=window.innerWidth}),t(c,()=>{const S=window.innerWidth;S!==g&&(g=S,this.root.updateBlockedByResize=!0,y&&y(),y=g6(b,250),Dc.hasAnimatedSinceResize&&(Dc.hasAnimatedSinceResize=!1,this.nodes.forEach($1)))})}f&&this.root.registerSharedNode(f,this),this.options.animate!==!1&&m&&(f||h)&&this.addEventListener("didUpdate",({delta:y,hasLayoutChanged:g,hasRelativeLayoutChanged:b,layout:S})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const x=this.options.transition||m.getDefaultTransition()||q6,{onLayoutAnimationStart:T,onLayoutAnimationComplete:_}=m.getProps(),k=!this.targetLayout||!rR(this.targetLayout,S),C=!g&&b;if(this.options.layoutRoot||this.resumeFrom||C||g&&(k||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const M={...mg(x,"layout"),onPlay:T,onComplete:_};(m.shouldReduceMotion||this.options.layoutRoot)&&(M.delay=0,M.type=!1),this.startAnimation(M),this.setAnimationOrigin(y,C)}else g||$1(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=S})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const c=this.getStack();c&&c.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),Vr(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(L6),this.animationId++)}getTransformTemplate(){const{visualElement:c}=this.options;return c&&c.getProps().transformTemplate}willUpdate(c=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&sR(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let y=0;y<this.path.length;y++){const g=this.path[y];g.shouldResetTransform=!0,g.updateScroll("snapshot"),g.options.layoutRoot&&g.willUpdate(!1)}const{layoutId:f,layout:h}=this.options;if(f===void 0&&!h)return;const m=this.getTransformTemplate();this.prevTransformTemplateValue=m?m(this.latestValues,""):void 0,this.updateSnapshot(),c&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(D1);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(N1);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(j6),this.nodes.forEach(C6),this.nodes.forEach(M6)):this.nodes.forEach(N1),this.clearAllSnapshots();const f=fn.now();Ht.delta=Wi(0,1e3/60,f-Ht.timestamp),Ht.timestamp=f,Ht.isProcessing=!0,kp.update.process(Ht),kp.preRender.process(Ht),kp.render.process(Ht),Ht.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,gg.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach($6),this.sharedNodes.forEach(V6)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,it.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){it.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!Wt(this.snapshot.measuredBox.x)&&!Wt(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let h=0;h<this.path.length;h++)this.path[h].updateScroll();const c=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected=Ct(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:f}=this.options;f&&f.notify("LayoutMeasure",this.layout.layoutBox,c?c.layoutBox:void 0)}updateScroll(c="measure"){let f=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===c&&(f=!1),f&&this.instance){const h=r(this.instance);this.scroll={animationId:this.root.animationId,phase:c,isRoot:h,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:h}}}resetTransform(){if(!o)return;const c=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,f=this.projectionDelta&&!iR(this.projectionDelta),h=this.getTransformTemplate(),m=h?h(this.latestValues,""):void 0,y=m!==this.prevTransformTemplateValue;c&&this.instance&&(f||ms(this.latestValues)||y)&&(o(this.instance,m),this.shouldResetTransform=!1,this.scheduleRender())}measure(c=!0){const f=this.measurePageBox();let h=this.removeElementScroll(f);return c&&(h=this.removeTransform(h)),P6(h),{animationId:this.root.animationId,measuredBox:f,layoutBox:h,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:c}=this.options;if(!c)return Ct();const f=c.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(I6))){const{scroll:m}=this.root;m&&(Oo(f.x,m.offset.x),Oo(f.y,m.offset.y))}return f}removeElementScroll(c){const f=Ct();if(Yn(f,c),this.scroll?.wasRoot)return f;for(let h=0;h<this.path.length;h++){const m=this.path[h],{scroll:y,options:g}=m;m!==this.root&&y&&g.layoutScroll&&(y.wasRoot&&Yn(f,c),Oo(f.x,y.offset.x),Oo(f.y,y.offset.y))}return f}applyTransform(c,f=!1){const h=Ct();Yn(h,c);for(let m=0;m<this.path.length;m++){const y=this.path[m];!f&&y.options.layoutScroll&&y.scroll&&y!==y.root&&_o(h,{x:-y.scroll.offset.x,y:-y.scroll.offset.y}),ms(y.latestValues)&&_o(h,y.latestValues)}return ms(this.latestValues)&&_o(h,this.latestValues),h}removeTransform(c){const f=Ct();Yn(f,c);for(let h=0;h<this.path.length;h++){const m=this.path[h];if(!m.instance||!ms(m.latestValues))continue;Im(m.latestValues)&&m.updateSnapshot();const y=Ct(),g=m.measurePageBox();Yn(y,g),O1(f,m.latestValues,m.snapshot?m.snapshot.layoutBox:void 0,y)}return ms(this.latestValues)&&O1(f,this.latestValues),f}setTargetDelta(c){this.targetDelta=c,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(c){this.options={...this.options,...c,crossfade:c.crossfade!==void 0?c.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==Ht.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(c=!1){const f=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=f.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=f.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=f.isSharedProjectionDirty);const h=!!this.resumingFrom||this!==f;if(!(c||h&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:y,layoutId:g}=this.options;if(!this.layout||!(y||g))return;this.resolvedRelativeTargetAt=Ht.timestamp;const b=this.getClosestProjectingParent();b&&this.linkedParentVersion!==b.layoutVersion&&!b.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(b&&b.layout?this.createRelativeTarget(b,this.layout.layoutBox,b.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=Ct(),this.targetWithTransforms=Ct()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),Qq(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):Yn(this.target,this.layout.layoutBox),L_(this.target,this.targetDelta)):Yn(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,b&&!!b.resumingFrom==!!this.resumingFrom&&!b.options.layoutScroll&&b.target&&this.animationProgress!==1?this.createRelativeTarget(b,this.target,b.target):this.relativeParent=this.relativeTarget=void 0))}getClosestProjectingParent(){if(!(!this.parent||Im(this.parent.latestValues)||z_(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(c,f,h){this.relativeParent=c,this.linkedParentVersion=c.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Ct(),this.relativeTargetOrigin=Ct(),sf(this.relativeTargetOrigin,f,h),Yn(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){const c=this.getLead(),f=!!this.resumingFrom||this!==c;let h=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(h=!1),f&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(h=!1),this.resolvedRelativeTargetAt===Ht.timestamp&&(h=!1),h)return;const{layout:m,layoutId:y}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(m||y))return;Yn(this.layoutCorrected,this.layout.layoutBox);const g=this.treeScale.x,b=this.treeScale.y;cq(this.layoutCorrected,this.treeScale,this.path,f),c.layout&&!c.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(c.target=c.layout.layoutBox,c.targetWithTransforms=Ct());const{target:S}=c;if(!S){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(T1(this.prevProjectionDelta.x,this.projectionDelta.x),T1(this.prevProjectionDelta.y,this.projectionDelta.y)),al(this.projectionDelta,this.layoutCorrected,S,this.latestValues),(this.treeScale.x!==g||this.treeScale.y!==b||!M1(this.projectionDelta.x,this.prevProjectionDelta.x)||!M1(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",S))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(c=!0){if(this.options.visualElement?.scheduleRender(),c){const f=this.getStack();f&&f.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=Ro(),this.projectionDelta=Ro(),this.projectionDeltaWithTransform=Ro()}setAnimationOrigin(c,f=!1){const h=this.snapshot,m=h?h.latestValues:{},y={...this.latestValues},g=Ro();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!f;const b=Ct(),S=h?h.source:void 0,x=this.layout?this.layout.source:void 0,T=S!==x,_=this.getStack(),k=!_||_.members.length<=1,C=!!(T&&!k&&this.options.crossfade===!0&&!this.path.some(K6));this.animationProgress=0;let M;this.mixTargetDelta=G=>{const I=G/1e3;j1(g.x,c.x,I),j1(g.y,c.y,I),this.setTargetDelta(g),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(sf(b,this.layout.layoutBox,this.relativeParent.layout.layoutBox),U6(this.relativeTarget,this.relativeTargetOrigin,b,I),M&&E6(this.relativeTarget,M)&&(this.isProjectionDirty=!1),M||(M=Ct()),Yn(M,this.relativeTarget)),T&&(this.animationValues=y,b6(y,m,this.latestValues,I,C,k)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=I},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(c){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(Vr(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=it.update(()=>{Dc.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=Io(0)),this.currentAnimation=p6(this.motionValue,[0,1e3],{...c,velocity:0,isSync:!0,onUpdate:f=>{this.mixTargetDelta(f),c.onUpdate&&c.onUpdate(f)},onStop:()=>{},onComplete:()=>{c.onComplete&&c.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const c=this.getStack();c&&c.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(R6),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const c=this.getLead();let{targetWithTransforms:f,target:h,layout:m,latestValues:y}=c;if(!(!f||!h||!m)){if(this!==c&&this.layout&&m&&aR(this.options.animationType,this.layout.layoutBox,m.layoutBox)){h=this.target||Ct();const g=Wt(this.layout.layoutBox.x);h.x.min=c.target.x.min,h.x.max=h.x.min+g;const b=Wt(this.layout.layoutBox.y);h.y.min=c.target.y.min,h.y.max=h.y.min+b}Yn(f,h),_o(f,y),al(this.projectionDeltaWithTransform,this.layoutCorrected,f,y)}}registerSharedNode(c,f){this.sharedNodes.has(c)||this.sharedNodes.set(c,new O6),this.sharedNodes.get(c).add(f);const m=f.options.initialPromotionConfig;f.promote({transition:m?m.transition:void 0,preserveFollowOpacity:m&&m.shouldPreserveFollowOpacity?m.shouldPreserveFollowOpacity(f):void 0})}isLead(){const c=this.getStack();return c?c.lead===this:!0}getLead(){const{layoutId:c}=this.options;return c?this.getStack()?.lead||this:this}getPrevLead(){const{layoutId:c}=this.options;return c?this.getStack()?.prevLead:void 0}getStack(){const{layoutId:c}=this.options;if(c)return this.root.sharedNodes.get(c)}promote({needsReset:c,transition:f,preserveFollowOpacity:h}={}){const m=this.getStack();m&&m.promote(this,h),c&&(this.projectionDelta=void 0,this.needsReset=!0),f&&this.setOptions({transition:f})}relegate(){const c=this.getStack();return c?c.relegate(this):!1}resetSkewAndRotation(){const{visualElement:c}=this.options;if(!c)return;let f=!1;const{latestValues:h}=c;if((h.z||h.rotate||h.rotateX||h.rotateY||h.rotateZ||h.skewX||h.skewY)&&(f=!0),!f)return;const m={};h.z&&Kp("z",c,m,this.animationValues);for(let y=0;y<Up.length;y++)Kp(`rotate${Up[y]}`,c,m,this.animationValues),Kp(`skew${Up[y]}`,c,m,this.animationValues);c.render();for(const y in m)c.setStaticValue(y,m[y]),this.animationValues&&(this.animationValues[y]=m[y]);c.scheduleRender()}applyProjectionStyles(c,f){if(!this.instance||this.isSVG)return;if(!this.isVisible){c.visibility="hidden";return}const h=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,c.visibility="",c.opacity="",c.pointerEvents=Mc(f?.pointerEvents)||"",c.transform=h?h(this.latestValues,""):"none";return}const m=this.getLead();if(!this.projectionDelta||!this.layout||!m.target){this.options.layoutId&&(c.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,c.pointerEvents=Mc(f?.pointerEvents)||""),this.hasProjected&&!ms(this.latestValues)&&(c.transform=h?h({},""):"none",this.hasProjected=!1);return}c.visibility="";const y=m.animationValues||m.latestValues;this.applyTransformsToTarget();let g=_6(this.projectionDeltaWithTransform,this.treeScale,y);h&&(g=h(y,g)),c.transform=g;const{x:b,y:S}=this.projectionDelta;c.transformOrigin=`${b.origin*100}% ${S.origin*100}% 0`,m.animationValues?c.opacity=m===this?y.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:y.opacityExit:c.opacity=m===this?y.opacity!==void 0?y.opacity:"":y.opacityExit!==void 0?y.opacityExit:0;for(const x in Pm){if(y[x]===void 0)continue;const{correct:T,applyTo:_,isCSSVariable:k}=Pm[x],C=g==="none"?y[x]:T(y[x],m);if(_){const M=_.length;for(let G=0;G<M;G++)c[_[G]]=C}else k?this.options.visualElement.renderState.vars[x]=C:c[x]=C}this.options.layoutId&&(c.pointerEvents=m===this?Mc(f?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(c=>c.currentAnimation?.stop()),this.root.nodes.forEach(D1),this.root.sharedNodes.clear()}}}function C6(t){t.updateLayout()}function M6(t){const e=t.resumeFrom?.snapshot||t.snapshot;if(t.isLead()&&t.layout&&e&&t.hasListeners("didUpdate")){const{layoutBox:n,measuredBox:r}=t.layout,{animationType:o}=t.options,u=e.source!==t.layout.source;o==="size"?zn(y=>{const g=u?e.measuredBox[y]:e.layoutBox[y],b=Wt(g);g.min=n[y].min,g.max=g.min+b}):aR(o,e.layoutBox,n)&&zn(y=>{const g=u?e.measuredBox[y]:e.layoutBox[y],b=Wt(n[y]);g.max=g.min+b,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[y].max=t.relativeTarget[y].min+b)});const c=Ro();al(c,n,e.layoutBox);const f=Ro();u?al(f,t.applyTransform(r,!0),e.measuredBox):al(f,n,e.layoutBox);const h=!iR(c);let m=!1;if(!t.resumeFrom){const y=t.getClosestProjectingParent();if(y&&!y.resumeFrom){const{snapshot:g,layout:b}=y;if(g&&b){const S=Ct();sf(S,e.layoutBox,g.layoutBox);const x=Ct();sf(x,n,b.layoutBox),rR(S,x)||(m=!0),y.options.layoutRoot&&(t.relativeTarget=x,t.relativeTargetOrigin=S,t.relativeParent=y)}}}t.notifyListeners("didUpdate",{layout:n,snapshot:e,delta:f,layoutDelta:c,hasLayoutChanged:h,hasRelativeLayoutChanged:m})}else if(t.isLead()){const{onExitComplete:n}=t.options;n&&n()}t.options.transition=void 0}function D6(t){t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=!!(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function N6(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function $6(t){t.clearSnapshot()}function D1(t){t.clearMeasurements()}function N1(t){t.isLayoutDirty=!1}function j6(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function $1(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function B6(t){t.resolveTargetDelta()}function z6(t){t.calcProjection()}function L6(t){t.resetSkewAndRotation()}function V6(t){t.removeLeadSnapshot()}function j1(t,e,n){t.translate=rt(e.translate,0,n),t.scale=rt(e.scale,1,n),t.origin=e.origin,t.originPoint=e.originPoint}function B1(t,e,n,r){t.min=rt(e.min,n.min,r),t.max=rt(e.max,n.max,r)}function U6(t,e,n,r){B1(t.x,e.x,n.x,r),B1(t.y,e.y,n.y,r)}function K6(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const q6={duration:.45,ease:[.4,0,.1,1]},z1=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),L1=z1("applewebkit/")&&!z1("chrome/")?Math.round:Kn;function V1(t){t.min=L1(t.min),t.max=L1(t.max)}function P6(t){V1(t.x),V1(t.y)}function aR(t,e,n){return t==="position"||t==="preserve-aspect"&&!Zq(C1(e),C1(n),.2)}function I6(t){return t!==t.root&&t.scroll?.wasRoot}const H6=oR({attachResizeListener:(t,e)=>xl(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),qp={current:void 0},lR=oR({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!qp.current){const t=new H6({});t.mount(window),t.setOptions({layoutScroll:!0}),qp.current=t}return qp.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),F6={pan:{Feature:d6},drag:{Feature:f6,ProjectionNode:lR,MeasureLayout:eR}};function U1(t,e,n){const{props:r}=t;t.animationState&&r.whileHover&&t.animationState.setActive("whileHover",n==="Start");const o="onHover"+n,u=r[o];u&&it.postRender(()=>u(e,Ll(e)))}class G6 extends Gr{mount(){const{current:e}=this.node;e&&(this.unmount=wK(e,(n,r)=>(U1(this.node,r,"Start"),o=>U1(this.node,o,"End"))))}unmount(){}}class Y6 extends Gr{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=jl(xl(this.node.current,"focus",()=>this.onFocus()),xl(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function K1(t,e,n){const{props:r}=t;if(t.current instanceof HTMLButtonElement&&t.current.disabled)return;t.animationState&&r.whileTap&&t.animationState.setActive("whileTap",n==="Start");const o="onTap"+(n==="End"?"":n),u=r[o];u&&it.postRender(()=>u(e,Ll(e)))}class J6 extends Gr{mount(){const{current:e}=this.node;e&&(this.unmount=EK(e,(n,r)=>(K1(this.node,r,"Start"),(o,{success:u})=>K1(this.node,o,u?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const Zm=new WeakMap,Pp=new WeakMap,X6=t=>{const e=Zm.get(t.target);e&&e(t)},Z6=t=>{t.forEach(X6)};function Q6({root:t,...e}){const n=t||document;Pp.has(n)||Pp.set(n,{});const r=Pp.get(n),o=JSON.stringify(e);return r[o]||(r[o]=new IntersectionObserver(Z6,{root:t,...e})),r[o]}function W6(t,e,n){const r=Q6(e);return Zm.set(t,n),r.observe(t),()=>{Zm.delete(t),r.unobserve(t)}}const e5={some:0,all:1};class t5 extends Gr{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:n,margin:r,amount:o="some",once:u}=e,c={root:n?n.current:void 0,rootMargin:r,threshold:typeof o=="number"?o:e5[o]},f=h=>{const{isIntersecting:m}=h;if(this.isInView===m||(this.isInView=m,u&&!m&&this.hasEnteredView))return;m&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",m);const{onViewportEnter:y,onViewportLeave:g}=this.node.getProps(),b=m?y:g;b&&b(h)};return W6(this.node.current,c,f)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:n}=this.node;["amount","margin","root"].some(n5(e,n))&&this.startObserver()}unmount(){}}function n5({viewport:t={}},{viewport:e={}}={}){return n=>t[n]!==e[n]}const i5={inView:{Feature:t5},tap:{Feature:J6},focus:{Feature:Y6},hover:{Feature:G6}},r5={layout:{ProjectionNode:lR,MeasureLayout:eR}},s5={...Hq,...i5,...F6,...r5},o5=aq(s5,Sq);function a5(){const t=Qn(Po),e=Qn(fi),n=Qn(Gi),r=At(Po),o=At(fi),u=At(Gi),c=`email-${N.useId()}`,f=`password-${N.useId()}`,h=`one-time-code-${N.useId()}`,[m,y]=N.useState(null),[g,b]=N.useState("email"),S=`form-${N.useId()}`;return N.useEffect(()=>{if(u.length===6){const x=document.getElementById(S);x instanceof HTMLFormElement&&x.requestSubmit()}},[u]),F.jsx("form",{id:S,onSubmit:async x=>{x.preventDefault();const T=nt(li);try{switch(g){case"email":{const{nextStep:_,userKey:k}=await cn.declareAuthTarget.query({email:r});switch(De(li,k),_){case"otc_login":case"otc_verify":{b("otc");break}case"password_login":{b("password");break}}break}case"otc":{if(!T){console.error("somehow userKey is null");return}const _=await cn.verifyAccountAction.mutate({oneTimeCode:u,userKey:T});De(ut,_),gi.once("connect",()=>{_s("/game"),t(""),n("")});break}case"password":{const _=await cn.openSession.mutate({email:r,password:o});De(ut,_),gi.once("connect",()=>{_s("/game"),t(""),e("")});break}}}catch(_){_ instanceof gl&&y(_.message)}},children:F.jsxs("main",{children:[m?F.jsx("aside",{children:m}):null,F.jsxs(o5.label,{htmlFor:c,children:[F.jsx("span",{children:"Email"}),F.jsx("input",{id:c,type:"text",value:r,onChange:x=>{t(x.target.value)},autoComplete:"email",autoCapitalize:"none",disabled:g!=="email"})]}),g==="password"?F.jsxs("label",{htmlFor:f,children:[F.jsx("span",{children:"Password"}),F.jsx("input",{id:f,type:"password",value:o,onChange:x=>{e(x.target.value)},autoComplete:"current-password",autoCapitalize:"none",autoFocus:g==="password"})]}):null,g==="otc"?F.jsxs("label",{htmlFor:h,children:[F.jsx("span",{children:"One-time Code"}),F.jsx("input",{id:h,type:"number",inputMode:"numeric",enterKeyHint:"go",value:u,onChange:x=>{n(x.target.value)},autoComplete:"one-time-code",autoCapitalize:"none",autoFocus:g==="otc"})]}):null,F.jsxs("footer",{children:[g==="password"?F.jsx("button",{type:"button",onClick:async()=>{const x=nt(li);if(!x)return new Error("No userKey");await cn.startPasswordReset.mutate({userKey:x}),b("otc")},children:"Forgot Password?"}):null,F.jsx("span",{}),F.jsx("button",{type:"submit",disabled:!r&&g==="email"||!o&&g==="password"||!u&&g==="otc",children:">>->"})]})]})})}function l5({route:[,t]}){const e=At(ut),n=At(Gi),r=Qn(Gi),o=`code-${N.useId()}`;return N.useEffect(()=>{t&&r(t)},[]),e?F.jsx("form",{onSubmit:async u=>{u.preventDefault();try{const c=await cn.verifyAccountAction.mutate({oneTimeCode:n,userKey:"CHANGEME"});De(ut,c),c.action==="resetPassword"?_s("/account"):_s("/game")}catch(c){console.error(c)}},children:F.jsxs("main",{children:[F.jsx("p",{children:"Check your email for a verification code."}),F.jsxs("label",{htmlFor:o,children:[F.jsx("span",{children:"Verification code"}),F.jsx("input",{id:o,type:"text",value:n,onChange:u=>{r(u.target.value)},placeholder:"Verification code",autoComplete:"one-time-code",autoCapitalize:"none"})]})]})}):F.jsx("p",{children:"You must be logged in to verify your account."})}Ft.STORE.loggers[0].logLevel="info";function u5(){const t=At(S4),e=At(ut),[n,r]=N.useState(!1),{refs:o,floatingStyles:u,context:c}=X2({open:n,onOpenChange:r,placement:"bottom-end",middleware:[w2(5),T2(),x2()],whileElementsMounted:h2}),f=H2(c),h=Y2(c),m=W2(c),{getReferenceProps:y,getFloatingProps:g}=Z2([f,h,m]),b=At(lV);return F.jsxs("main",{className:Xz.class,children:[F.jsxs("header",{children:[F.jsxs("main",{children:[F.jsx(Jz,{}),F.jsx("span",{children:F.jsx(Zz,{input:b})})]}),F.jsx("button",{"data-css":"profile",ref:o.setReference,...y(),children:e?.username?e.username.slice(0,2):""}),n&&e&&F.jsx(P2,{context:c,modal:!1,children:F.jsxs("div",{"data-css":"profile-actions",ref:o.setFloating,style:u,...g(),children:[F.jsx("span",{children:e.username}),F.jsx("button",{type:"button",onClick:()=>{_s("/account")},children:"Account"}),F.jsx("button",{type:"button",onClick:async()=>{e&&(await cn.closeSession.mutate({username:e.username}),gi.once("disconnect",()=>{De(ut,null),_s("/")}),gi.disconnect())},children:"Sign out"})]})})]}),F.jsx("main",{children:typeof t=="number"?F.jsxs("article",{children:[F.jsx("h1",{children:t}),F.jsx("h2",{children:JSON.parse(HE[t])}),F.jsx(FE,{href:"/",children:"Return to Home Page"})]}):(()=>{switch(t[0]){case void 0:return F.jsx(a5,{});case"admin":return F.jsx(E4,{});case"game":return F.jsx(_4,{route:t});case"verify":return F.jsx(l5,{route:t});case"account":return F.jsx(A4,{})}})()})]})}GM.createRoot(document.getElementById("root")).render(F.jsx(N.StrictMode,{children:F.jsx(VM,{socket:gi,children:F.jsx(u5,{})})}));
|