hytopia 0.10.24 → 0.10.25

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/server.mjs +2 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hytopia",
3
- "version": "0.10.24",
3
+ "version": "0.10.25",
4
4
  "description": "The HYTOPIA SDK makes it easy for developers to create massively multiplayer games using JavaScript or TypeScript.",
5
5
  "type": "module",
6
6
  "main": "./server.mjs",
package/server.mjs CHANGED
@@ -25,7 +25,7 @@ import{createRequire as NG1}from"node:module";var DG1=Object.create;var{getProto
25
25
  || ${K} === "boolean" || ${Y} === null`).assign(W,d0._`[${Y}]`)}}}function BN1({gen:Z,parentData:J,parentDataProperty:X},$){Z.if(d0._`${J} !== undefined`,()=>Z.assign(d0._`${J}[${X}]`,$))}function KN(Z,J,X,$=C3.Correct){let Y=$===C3.Correct?d0.operators.EQ:d0.operators.NEQ,Q;switch(Z){case"null":return d0._`${J} ${Y} null`;case"array":Q=d0._`Array.isArray(${J})`;break;case"object":Q=d0._`${J} && typeof ${J} == "object" && !Array.isArray(${J})`;break;case"integer":Q=K(d0._`!(${J} % 1) && !isNaN(${J})`);break;case"number":Q=K();break;default:return d0._`typeof ${J} ${Y} ${Z}`}return $===C3.Correct?Q:(0,d0.not)(Q);function K(W=d0.nil){return(0,d0.and)(d0._`typeof ${J} == "number"`,W,X?d0._`isFinite(${J})`:d0.nil)}}Xr.checkDataType=KN;function WN(Z,J,X,$){if(Z.length===1)return KN(Z[0],J,X,$);let Y,Q=(0,eo.toHash)(Z);if(Q.array&&Q.object){let K=d0._`typeof ${J} != "object"`;Y=Q.null?K:d0._`!${J} || ${K}`,delete Q.null,delete Q.array,delete Q.object}else Y=d0.nil;if(Q.number)delete Q.integer;for(let K in Q)Y=(0,d0.and)(Y,KN(K,J,X,$));return Y}Xr.checkDataTypes=WN;var LN1={message:({schema:Z})=>`must be ${Z}`,params:({schema:Z,schemaValue:J})=>typeof Z=="string"?d0._`{type: ${Z}}`:d0._`{type: ${J}}`};function GN(Z){let J=DN1(Z);(0,cN1.reportError)(J,LN1)}Xr.reportTypeError=GN;function DN1(Z){let{gen:J,data:X,schema:$}=Z,Y=(0,eo.schemaRefOrVal)(Z,$,"type");return{gen:J,keyword:"type",data:X,schema:$.type,schemaCode:Y,schemaValue:Y,parentSchema:$,params:{},it:Z}}});var Wr=U((Qr)=>{Object.defineProperty(Qr,"__esModule",{value:!0});Qr.assignDefaults=void 0;var f3=o0(),CN1=V1();function fN1(Z,J){let{properties:X,items:$}=Z.schema;if(J==="object"&&X)for(let Y in X)Yr(Z,Y,X[Y].default);else if(J==="array"&&Array.isArray($))$.forEach((Y,Q)=>Yr(Z,Q,Y.default))}Qr.assignDefaults=fN1;function Yr(Z,J,X){let{gen:$,compositeRule:Y,data:Q,opts:K}=Z;if(X===void 0)return;let W=f3._`${Q}${(0,f3.getProperty)(J)}`;if(Y){(0,CN1.checkStrictMode)(Z,`default is ignored for: ${W}`);return}let G=f3._`${W} === undefined`;if(K.useDefaults==="empty")G=f3._`${G} || ${W} === null || ${W} === ""`;$.if(G,f3._`${W} = ${(0,f3.stringify)(X)}`)}});var R4=U((Vr)=>{Object.defineProperty(Vr,"__esModule",{value:!0});Vr.validateUnion=Vr.validateArray=Vr.usePattern=Vr.callValidateCode=Vr.schemaProperties=Vr.allSchemaProperties=Vr.noPropertyInData=Vr.propertyInData=Vr.isOwnProperty=Vr.hasPropFunc=Vr.reportMissingProp=Vr.checkMissingProp=Vr.checkReportMissingProp=void 0;var m1=o0(),zN=V1(),rJ=TZ(),kN1=V1();function EN1(Z,J){let{gen:X,data:$,it:Y}=Z;X.if(vN(X,$,J,Y.opts.ownProperties),()=>{Z.setParams({missingProperty:m1._`${J}`},!0),Z.error()})}Vr.checkReportMissingProp=EN1;function IN1({gen:Z,data:J,it:{opts:X}},$,Y){return(0,m1.or)(...$.map((Q)=>(0,m1.and)(vN(Z,J,Q,X.ownProperties),m1._`${Y} = ${Q}`)))}Vr.checkMissingProp=IN1;function _N1(Z,J){Z.setParams({missingProperty:J},!0),Z.error()}Vr.reportMissingProp=_N1;function Gr(Z){return Z.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:m1._`Object.prototype.hasOwnProperty`})}Vr.hasPropFunc=Gr;function VN(Z,J,X){return m1._`${Gr(Z)}.call(${J}, ${X})`}Vr.isOwnProperty=VN;function bN1(Z,J,X,$){let Y=m1._`${J}${(0,m1.getProperty)(X)} !== undefined`;return $?m1._`${Y} && ${VN(Z,J,X)}`:Y}Vr.propertyInData=bN1;function vN(Z,J,X,$){let Y=m1._`${J}${(0,m1.getProperty)(X)} === undefined`;return $?(0,m1.or)(Y,(0,m1.not)(VN(Z,J,X))):Y}Vr.noPropertyInData=vN;function zr(Z){return Z?Object.keys(Z).filter((J)=>J!=="__proto__"):[]}Vr.allSchemaProperties=zr;function hN1(Z,J){return zr(J).filter((X)=>!(0,zN.alwaysValidSchema)(Z,J[X]))}Vr.schemaProperties=hN1;function SN1({schemaCode:Z,data:J,it:{gen:X,topSchemaRef:$,schemaPath:Y,errorPath:Q},it:K},W,G,z){let V=z?m1._`${Z}, ${J}, ${$}${Y}`:J,H=[[rJ.default.instancePath,(0,m1.strConcat)(rJ.default.instancePath,Q)],[rJ.default.parentData,K.parentData],[rJ.default.parentDataProperty,K.parentDataProperty],[rJ.default.rootData,rJ.default.rootData]];if(K.opts.dynamicRef)H.push([rJ.default.dynamicAnchors,rJ.default.dynamicAnchors]);let v=m1._`${V}, ${X.object(...H)}`;return G!==m1.nil?m1._`${W}.call(${G}, ${v})`:m1._`${W}(${v})`}Vr.callValidateCode=SN1;var AN1=m1._`new RegExp`;function mN1({gen:Z,it:{opts:J}},X){let $=J.unicodeRegExp?"u":"",{regExp:Y}=J.code,Q=Y(X,$);return Z.scopeValue("pattern",{key:Q.toString(),ref:Q,code:m1._`${Y.code==="new RegExp"?AN1:(0,kN1.useFunc)(Z,Y)}(${X}, ${$})`})}Vr.usePattern=mN1;function uN1(Z){let{gen:J,data:X,keyword:$,it:Y}=Z,Q=J.name("valid");if(Y.allErrors){let W=J.let("valid",!0);return K(()=>J.assign(W,!1)),W}return J.var(Q,!0),K(()=>J.break()),Q;function K(W){let G=J.const("len",m1._`${X}.length`);J.forRange("i",0,G,(z)=>{Z.subschema({keyword:$,dataProp:z,dataPropType:zN.Type.Num},Q),J.if((0,m1.not)(Q),W)})}}Vr.validateArray=uN1;function lN1(Z){let{gen:J,schema:X,keyword:$,it:Y}=Z;if(!Array.isArray(X))throw new Error("ajv implementation error");if(X.some((G)=>(0,zN.alwaysValidSchema)(Y,G))&&!Y.opts.unevaluated)return;let K=J.let("valid",!1),W=J.name("_valid");J.block(()=>X.forEach((G,z)=>{let V=Z.subschema({keyword:$,schemaProp:z,compositeRule:!0},W);if(J.assign(K,m1._`${K} || ${W}`),!Z.mergeValidEvaluated(V,W))J.if((0,m1.not)(K))})),Z.result(K,()=>Z.reset(),()=>Z.error(!0))}Vr.validateUnion=lN1});var wr=U((Fr)=>{Object.defineProperty(Fr,"__esModule",{value:!0});Fr.validateKeywordUsage=Fr.validSchemaType=Fr.funcKeywordCode=Fr.macroKeywordCode=void 0;var g6=o0(),i$=TZ(),ZP1=R4(),JP1=Xz();function XP1(Z,J){let{gen:X,keyword:$,schema:Y,parentSchema:Q,it:K}=Z,W=J.macro.call(K.self,Y,Q,K),G=qr(X,$,W);if(K.opts.validateSchema!==!1)K.self.validateSchema(W,!0);let z=X.name("valid");Z.subschema({schema:W,schemaPath:g6.nil,errSchemaPath:`${K.errSchemaPath}/${$}`,topSchemaRef:G,compositeRule:!0},z),Z.pass(z,()=>Z.error(!0))}Fr.macroKeywordCode=XP1;function $P1(Z,J){var X;let{gen:$,keyword:Y,schema:Q,parentSchema:K,$data:W,it:G}=Z;QP1(G,J);let z=!W&&J.compile?J.compile.call(G.self,Q,K,G):J.validate,V=qr($,Y,z),H=$.let("valid");Z.block$data(H,v),Z.ok((X=J.valid)!==null&&X!==void 0?X:H);function v(){if(J.errors===!1){if(c(),J.modifying)Hr(Z);w(()=>Z.error())}else{let x=J.async?q():F();if(J.modifying)Hr(Z);w(()=>YP1(Z,x))}}function q(){let x=$.let("ruleErrs",null);return $.try(()=>c(g6._`await `),(j)=>$.assign(H,!1).if(g6._`${j} instanceof ${G.ValidationError}`,()=>$.assign(x,g6._`${j}.errors`),()=>$.throw(j))),x}function F(){let x=g6._`${V}.errors`;return $.assign(x,null),c(g6.nil),x}function c(x=J.async?g6._`await `:g6.nil){let j=G.opts.passContext?i$.default.this:i$.default.self,B=!(("compile"in J)&&!W||J.schema===!1);$.assign(H,g6._`${x}${(0,ZP1.callValidateCode)(Z,V,j,B)}`,J.modifying)}function w(x){var j;$.if((0,g6.not)((j=J.valid)!==null&&j!==void 0?j:H),x)}}Fr.funcKeywordCode=$P1;function Hr(Z){let{gen:J,data:X,it:$}=Z;J.if($.parentData,()=>J.assign(X,g6._`${$.parentData}[${$.parentDataProperty}]`))}function YP1(Z,J){let{gen:X}=Z;X.if(g6._`Array.isArray(${J})`,()=>{X.assign(i$.default.vErrors,g6._`${i$.default.vErrors} === null ? ${J} : ${i$.default.vErrors}.concat(${J})`).assign(i$.default.errors,g6._`${i$.default.vErrors}.length`),(0,JP1.extendErrors)(Z)},()=>Z.error())}function QP1({schemaEnv:Z},J){if(J.async&&!Z.$async)throw new Error("async keyword in sync schema")}function qr(Z,J,X){if(X===void 0)throw new Error(`keyword "${J}" failed to compile`);return Z.scopeValue("keyword",typeof X=="function"?{ref:X}:{ref:X,code:(0,g6.stringify)(X)})}function KP1(Z,J,X=!1){return!J.length||J.some(($)=>$==="array"?Array.isArray(Z):$==="object"?Z&&typeof Z=="object"&&!Array.isArray(Z):typeof Z==$||X&&typeof Z=="undefined")}Fr.validSchemaType=KP1;function WP1({schema:Z,opts:J,self:X,errSchemaPath:$},Y,Q){if(Array.isArray(Y.keyword)?!Y.keyword.includes(Q):Y.keyword!==Q)throw new Error("ajv implementation error");let K=Y.dependencies;if(K===null||K===void 0?void 0:K.some((W)=>!Object.prototype.hasOwnProperty.call(Z,W)))throw new Error(`parent schema must have dependencies of ${Q}: ${K.join(",")}`);if(Y.validateSchema){if(!Y.validateSchema(Z[Q])){let G=`keyword "${Q}" value is invalid at path "${$}": `+X.errorsText(Y.validateSchema.errors);if(J.validateSchema==="log")X.logger.error(G);else throw new Error(G)}}}Fr.validateKeywordUsage=WP1});var Br=U((Ur)=>{Object.defineProperty(Ur,"__esModule",{value:!0});Ur.extendSubschemaMode=Ur.extendSubschemaData=Ur.getSubschema=void 0;var v7=o0(),xr=V1();function vP1(Z,{keyword:J,schemaProp:X,schema:$,schemaPath:Y,errSchemaPath:Q,topSchemaRef:K}){if(J!==void 0&&$!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(J!==void 0){let W=Z.schema[J];return X===void 0?{schema:W,schemaPath:v7._`${Z.schemaPath}${(0,v7.getProperty)(J)}`,errSchemaPath:`${Z.errSchemaPath}/${J}`}:{schema:W[X],schemaPath:v7._`${Z.schemaPath}${(0,v7.getProperty)(J)}${(0,v7.getProperty)(X)}`,errSchemaPath:`${Z.errSchemaPath}/${J}/${(0,xr.escapeFragment)(X)}`}}if($!==void 0){if(Y===void 0||Q===void 0||K===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:$,schemaPath:Y,topSchemaRef:K,errSchemaPath:Q}}throw new Error('either "keyword" or "schema" must be passed')}Ur.getSubschema=vP1;function HP1(Z,J,{dataProp:X,dataPropType:$,data:Y,dataTypes:Q,propertyName:K}){if(Y!==void 0&&X!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:W}=J;if(X!==void 0){let{errorPath:z,dataPathArr:V,opts:H}=J,v=W.let("data",v7._`${J.data}${(0,v7.getProperty)(X)}`,!0);G(v),Z.errorPath=v7.str`${z}${(0,xr.getErrorPath)(X,$,H.jsPropertySyntax)}`,Z.parentDataProperty=v7._`${X}`,Z.dataPathArr=[...V,Z.parentDataProperty]}if(Y!==void 0){let z=Y instanceof v7.Name?Y:W.let("data",Y,!0);if(G(z),K!==void 0)Z.propertyName=K}if(Q)Z.dataTypes=Q;function G(z){Z.data=z,Z.dataLevel=J.dataLevel+1,Z.dataTypes=[],J.definedProperties=new Set,Z.parentData=J.data,Z.dataNames=[...J.dataNames,z]}}Ur.extendSubschemaData=HP1;function qP1(Z,{jtdDiscriminator:J,jtdMetadata:X,compositeRule:$,createErrors:Y,allErrors:Q}){if($!==void 0)Z.compositeRule=$;if(Y!==void 0)Z.createErrors=Y;if(Q!==void 0)Z.allErrors=Q;Z.jtdDiscriminator=J,Z.jtdMetadata=X}Ur.extendSubschemaMode=qP1});var HN=U((DT6,Lr)=>{Lr.exports=function Z(J,X){if(J===X)return!0;if(J&&X&&typeof J=="object"&&typeof X=="object"){if(J.constructor!==X.constructor)return!1;var $,Y,Q;if(Array.isArray(J)){if($=J.length,$!=X.length)return!1;for(Y=$;Y--!==0;)if(!Z(J[Y],X[Y]))return!1;return!0}if(J.constructor===RegExp)return J.source===X.source&&J.flags===X.flags;if(J.valueOf!==Object.prototype.valueOf)return J.valueOf()===X.valueOf();if(J.toString!==Object.prototype.toString)return J.toString()===X.toString();if(Q=Object.keys(J),$=Q.length,$!==Object.keys(X).length)return!1;for(Y=$;Y--!==0;)if(!Object.prototype.hasOwnProperty.call(X,Q[Y]))return!1;for(Y=$;Y--!==0;){var K=Q[Y];if(!Z(J[K],X[K]))return!1}return!0}return J!==J&&X!==X}});var Mr=U((MT6,Dr)=>{var tJ=Dr.exports=function(Z,J,X){if(typeof J=="function")X=J,J={};X=J.cb||X;var $=typeof X=="function"?X:X.pre||function(){},Y=X.post||function(){};Yw(J,$,Y,Z,"",Z)};tJ.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};tJ.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};tJ.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};tJ.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function Yw(Z,J,X,$,Y,Q,K,W,G,z){if($&&typeof $=="object"&&!Array.isArray($)){J($,Y,Q,K,W,G,z);for(var V in $){var H=$[V];if(Array.isArray(H)){if(V in tJ.arrayKeywords)for(var v=0;v<H.length;v++)Yw(Z,J,X,H[v],Y+"/"+V+"/"+v,Q,Y,V,$,v)}else if(V in tJ.propsKeywords){if(H&&typeof H=="object")for(var q in H)Yw(Z,J,X,H[q],Y+"/"+V+"/"+wP1(q),Q,Y,V,$,q)}else if(V in tJ.keywords||Z.allKeys&&!(V in tJ.skipKeywords))Yw(Z,J,X,H,Y+"/"+V,Q,Y,V,$)}X($,Y,Q,K,W,G,z)}}function wP1(Z){return Z.replace(/~/g,"~0").replace(/\//g,"~1")}});var Yz=U((Pr)=>{Object.defineProperty(Pr,"__esModule",{value:!0});Pr.getSchemaRefs=Pr.resolveUrl=Pr.normalizeId=Pr._getFullPath=Pr.getFullPath=Pr.inlineRef=void 0;var xP1=V1(),UP1=HN(),jP1=Mr(),BP1=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function LP1(Z,J=!0){if(typeof Z=="boolean")return!0;if(J===!0)return!qN(Z);if(!J)return!1;return Rr(Z)<=J}Pr.inlineRef=LP1;var DP1=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function qN(Z){for(let J in Z){if(DP1.has(J))return!0;let X=Z[J];if(Array.isArray(X)&&X.some(qN))return!0;if(typeof X=="object"&&qN(X))return!0}return!1}function Rr(Z){let J=0;for(let X in Z){if(X==="$ref")return 1/0;if(J++,BP1.has(X))continue;if(typeof Z[X]=="object")(0,xP1.eachItem)(Z[X],($)=>J+=Rr($));if(J===1/0)return 1/0}return J}function Or(Z,J="",X){if(X!==!1)J=k3(J);let $=Z.parse(J);return Nr(Z,$)}Pr.getFullPath=Or;function Nr(Z,J){return Z.serialize(J).split("#")[0]+"#"}Pr._getFullPath=Nr;var MP1=/#\/?$/;function k3(Z){return Z?Z.replace(MP1,""):""}Pr.normalizeId=k3;function RP1(Z,J,X){return X=k3(X),Z.resolve(J,X)}Pr.resolveUrl=RP1;var OP1=/^[a-z_][-a-z0-9._]*$/i;function NP1(Z,J){if(typeof Z=="boolean")return{};let{schemaId:X,uriResolver:$}=this.opts,Y=k3(Z[X]||J),Q={"":Y},K=Or($,Y,!1),W={},G=new Set;return jP1(Z,{allKeys:!0},(H,v,q,F)=>{if(F===void 0)return;let c=K+v,w=Q[F];if(typeof H[X]=="string")w=x.call(this,H[X]);j.call(this,H.$anchor),j.call(this,H.$dynamicAnchor),Q[v]=w;function x(B){let L=this.opts.uriResolver.resolve;if(B=k3(w?L(w,B):B),G.has(B))throw V(B);G.add(B);let R=this.refs[B];if(typeof R=="string")R=this.refs[R];if(typeof R=="object")z(H,R.schema,B);else if(B!==k3(c))if(B[0]==="#")z(H,W[B],B),W[B]=H;else this.refs[B]=c;return B}function j(B){if(typeof B=="string"){if(!OP1.test(B))throw new Error(`invalid anchor "${B}"`);x.call(this,`#${B}`)}}}),W;function z(H,v,q){if(v!==void 0&&!UP1(H,v))throw V(q)}function V(H){return new Error(`reference "${H}" resolves to more than one schema`)}}Pr.getSchemaRefs=NP1});var Wz=U((pr)=>{Object.defineProperty(pr,"__esModule",{value:!0});pr.getData=pr.KeywordCxt=pr.validateFunctionCode=void 0;var Ir=go(),Cr=$z(),cN=QN(),Qw=$z(),EP1=Wr(),Kz=wr(),FN=Br(),D0=o0(),b0=TZ(),IP1=Yz(),CZ=V1(),Qz=Xz();function _P1(Z){if(hr(Z)){if(Sr(Z),br(Z)){SP1(Z);return}}_r(Z,()=>(0,Ir.topBoolOrEmptySchema)(Z))}pr.validateFunctionCode=_P1;function _r({gen:Z,validateName:J,schema:X,schemaEnv:$,opts:Y},Q){if(Y.code.es5)Z.func(J,D0._`${b0.default.data}, ${b0.default.valCxt}`,$.$async,()=>{Z.code(D0._`"use strict"; ${fr(X,Y)}`),hP1(Z,Y),Z.code(Q)});else Z.func(J,D0._`${b0.default.data}, ${bP1(Y)}`,$.$async,()=>Z.code(fr(X,Y)).code(Q))}function bP1(Z){return D0._`{${b0.default.instancePath}="", ${b0.default.parentData}, ${b0.default.parentDataProperty}, ${b0.default.rootData}=${b0.default.data}${Z.dynamicRef?D0._`, ${b0.default.dynamicAnchors}={}`:D0.nil}}={}`}function hP1(Z,J){Z.if(b0.default.valCxt,()=>{if(Z.var(b0.default.instancePath,D0._`${b0.default.valCxt}.${b0.default.instancePath}`),Z.var(b0.default.parentData,D0._`${b0.default.valCxt}.${b0.default.parentData}`),Z.var(b0.default.parentDataProperty,D0._`${b0.default.valCxt}.${b0.default.parentDataProperty}`),Z.var(b0.default.rootData,D0._`${b0.default.valCxt}.${b0.default.rootData}`),J.dynamicRef)Z.var(b0.default.dynamicAnchors,D0._`${b0.default.valCxt}.${b0.default.dynamicAnchors}`)},()=>{if(Z.var(b0.default.instancePath,D0._`""`),Z.var(b0.default.parentData,D0._`undefined`),Z.var(b0.default.parentDataProperty,D0._`undefined`),Z.var(b0.default.rootData,b0.default.data),J.dynamicRef)Z.var(b0.default.dynamicAnchors,D0._`{}`)})}function SP1(Z){let{schema:J,opts:X,gen:$}=Z;_r(Z,()=>{if(X.$comment&&J.$comment)mr(Z);if(yP1(Z),$.let(b0.default.vErrors,null),$.let(b0.default.errors,0),X.unevaluated)AP1(Z);Ar(Z),gP1(Z)});return}function AP1(Z){let{gen:J,validateName:X}=Z;Z.evaluated=J.const("evaluated",D0._`${X}.evaluated`),J.if(D0._`${Z.evaluated}.dynamicProps`,()=>J.assign(D0._`${Z.evaluated}.props`,D0._`undefined`)),J.if(D0._`${Z.evaluated}.dynamicItems`,()=>J.assign(D0._`${Z.evaluated}.items`,D0._`undefined`))}function fr(Z,J){let X=typeof Z=="object"&&Z[J.schemaId];return X&&(J.code.source||J.code.process)?D0._`/*# sourceURL=${X} */`:D0.nil}function mP1(Z,J){if(hr(Z)){if(Sr(Z),br(Z)){uP1(Z,J);return}}(0,Ir.boolOrEmptySchema)(Z,J)}function br({schema:Z,self:J}){if(typeof Z=="boolean")return!Z;for(let X in Z)if(J.RULES.all[X])return!0;return!1}function hr(Z){return typeof Z.schema!="boolean"}function uP1(Z,J){let{schema:X,gen:$,opts:Y}=Z;if(Y.$comment&&X.$comment)mr(Z);pP1(Z),iP1(Z);let Q=$.const("_errs",b0.default.errors);Ar(Z,Q),$.var(J,D0._`${Q} === ${b0.default.errors}`)}function Sr(Z){(0,CZ.checkUnknownRules)(Z),lP1(Z)}function Ar(Z,J){if(Z.opts.jtd)return kr(Z,[],!1,J);let X=(0,Cr.getSchemaTypes)(Z.schema),$=(0,Cr.coerceAndCheckDataType)(Z,X);kr(Z,X,!$,J)}function lP1(Z){let{schema:J,errSchemaPath:X,opts:$,self:Y}=Z;if(J.$ref&&$.ignoreKeywordsWithRef&&(0,CZ.schemaHasRulesButRef)(J,Y.RULES))Y.logger.warn(`$ref: keywords ignored in schema at path "${X}"`)}function yP1(Z){let{schema:J,opts:X}=Z;if(J.default!==void 0&&X.useDefaults&&X.strictSchema)(0,CZ.checkStrictMode)(Z,"default is ignored in the schema root")}function pP1(Z){let J=Z.schema[Z.opts.schemaId];if(J)Z.baseId=(0,IP1.resolveUrl)(Z.opts.uriResolver,Z.baseId,J)}function iP1(Z){if(Z.schema.$async&&!Z.schemaEnv.$async)throw new Error("async schema in sync schema")}function mr({gen:Z,schemaEnv:J,schema:X,errSchemaPath:$,opts:Y}){let Q=X.$comment;if(Y.$comment===!0)Z.code(D0._`${b0.default.self}.logger.log(${Q})`);else if(typeof Y.$comment=="function"){let K=D0.str`${$}/$comment`,W=Z.scopeValue("root",{ref:J.root});Z.code(D0._`${b0.default.self}.opts.$comment(${Q}, ${K}, ${W}.schema)`)}}function gP1(Z){let{gen:J,schemaEnv:X,validateName:$,ValidationError:Y,opts:Q}=Z;if(X.$async)J.if(D0._`${b0.default.errors} === 0`,()=>J.return(b0.default.data),()=>J.throw(D0._`new ${Y}(${b0.default.vErrors})`));else{if(J.assign(D0._`${$}.errors`,b0.default.vErrors),Q.unevaluated)dP1(Z);J.return(D0._`${b0.default.errors} === 0`)}}function dP1({gen:Z,evaluated:J,props:X,items:$}){if(X instanceof D0.Name)Z.assign(D0._`${J}.props`,X);if($ instanceof D0.Name)Z.assign(D0._`${J}.items`,$)}function kr(Z,J,X,$){let{gen:Y,schema:Q,data:K,allErrors:W,opts:G,self:z}=Z,{RULES:V}=z;if(Q.$ref&&(G.ignoreKeywordsWithRef||!(0,CZ.schemaHasRulesButRef)(Q,V))){Y.block(()=>lr(Z,"$ref",V.all.$ref.definition));return}if(!G.jtd)aP1(Z,J);Y.block(()=>{for(let v of V.rules)H(v);H(V.post)});function H(v){if(!(0,cN.shouldUseGroup)(Q,v))return;if(v.type){if(Y.if((0,Qw.checkDataType)(v.type,K,G.strictNumbers)),Er(Z,v),J.length===1&&J[0]===v.type&&X)Y.else(),(0,Qw.reportTypeError)(Z);Y.endIf()}else Er(Z,v);if(!W)Y.if(D0._`${b0.default.errors} === ${$||0}`)}}function Er(Z,J){let{gen:X,schema:$,opts:{useDefaults:Y}}=Z;if(Y)(0,EP1.assignDefaults)(Z,J.type);X.block(()=>{for(let Q of J.rules)if((0,cN.shouldUseRule)($,Q))lr(Z,Q.keyword,Q.definition,J.type)})}function aP1(Z,J){if(Z.schemaEnv.meta||!Z.opts.strictTypes)return;if(nP1(Z,J),!Z.opts.allowUnionTypes)sP1(Z,J);oP1(Z,Z.dataTypes)}function nP1(Z,J){if(!J.length)return;if(!Z.dataTypes.length){Z.dataTypes=J;return}J.forEach((X)=>{if(!ur(Z.dataTypes,X))wN(Z,`type "${X}" not allowed by context "${Z.dataTypes.join(",")}"`)}),tP1(Z,J)}function sP1(Z,J){if(J.length>1&&!(J.length===2&&J.includes("null")))wN(Z,"use allowUnionTypes to allow union type keyword")}function oP1(Z,J){let X=Z.self.RULES.all;for(let $ in X){let Y=X[$];if(typeof Y=="object"&&(0,cN.shouldUseRule)(Z.schema,Y)){let{type:Q}=Y.definition;if(Q.length&&!Q.some((K)=>rP1(J,K)))wN(Z,`missing type "${Q.join(",")}" for keyword "${$}"`)}}}function rP1(Z,J){return Z.includes(J)||J==="number"&&Z.includes("integer")}function ur(Z,J){return Z.includes(J)||J==="integer"&&Z.includes("number")}function tP1(Z,J){let X=[];for(let $ of Z.dataTypes)if(ur(J,$))X.push($);else if(J.includes("integer")&&$==="number")X.push("integer");Z.dataTypes=X}function wN(Z,J){let X=Z.schemaEnv.baseId+Z.errSchemaPath;J+=` at "${X}" (strictTypes)`,(0,CZ.checkStrictMode)(Z,J,Z.opts.strictTypes)}class xN{constructor(Z,J,X){if((0,Kz.validateKeywordUsage)(Z,J,X),this.gen=Z.gen,this.allErrors=Z.allErrors,this.keyword=X,this.data=Z.data,this.schema=Z.schema[X],this.$data=J.$data&&Z.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,CZ.schemaRefOrVal)(Z,this.schema,X,this.$data),this.schemaType=J.schemaType,this.parentSchema=Z.schema,this.params={},this.it=Z,this.def=J,this.$data)this.schemaCode=Z.gen.const("vSchema",yr(this.$data,Z));else if(this.schemaCode=this.schemaValue,!(0,Kz.validSchemaType)(this.schema,J.schemaType,J.allowUndefined))throw new Error(`${X} value must be ${JSON.stringify(J.schemaType)}`);if("code"in J?J.trackErrors:J.errors!==!1)this.errsCount=Z.gen.const("_errs",b0.default.errors)}result(Z,J,X){this.failResult((0,D0.not)(Z),J,X)}failResult(Z,J,X){if(this.gen.if(Z),X)X();else this.error();if(J){if(this.gen.else(),J(),this.allErrors)this.gen.endIf()}else if(this.allErrors)this.gen.endIf();else this.gen.else()}pass(Z,J){this.failResult((0,D0.not)(Z),void 0,J)}fail(Z){if(Z===void 0){if(this.error(),!this.allErrors)this.gen.if(!1);return}if(this.gen.if(Z),this.error(),this.allErrors)this.gen.endIf();else this.gen.else()}fail$data(Z){if(!this.$data)return this.fail(Z);let{schemaCode:J}=this;this.fail(D0._`${J} !== undefined && (${(0,D0.or)(this.invalid$data(),Z)})`)}error(Z,J,X){if(J){this.setParams(J),this._error(Z,X),this.setParams({});return}this._error(Z,X)}_error(Z,J){(Z?Qz.reportExtraError:Qz.reportError)(this,this.def.error,J)}$dataError(){(0,Qz.reportError)(this,this.def.$dataError||Qz.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,Qz.resetErrorsCount)(this.gen,this.errsCount)}ok(Z){if(!this.allErrors)this.gen.if(Z)}setParams(Z,J){if(J)Object.assign(this.params,Z);else this.params=Z}block$data(Z,J,X=D0.nil){this.gen.block(()=>{this.check$data(Z,X),J()})}check$data(Z=D0.nil,J=D0.nil){if(!this.$data)return;let{gen:X,schemaCode:$,schemaType:Y,def:Q}=this;if(X.if((0,D0.or)(D0._`${$} === undefined`,J)),Z!==D0.nil)X.assign(Z,!0);if(Y.length||Q.validateSchema){if(X.elseIf(this.invalid$data()),this.$dataError(),Z!==D0.nil)X.assign(Z,!1)}X.else()}invalid$data(){let{gen:Z,schemaCode:J,schemaType:X,def:$,it:Y}=this;return(0,D0.or)(Q(),K());function Q(){if(X.length){if(!(J instanceof D0.Name))throw new Error("ajv implementation error");let W=Array.isArray(X)?X:[X];return D0._`${(0,Qw.checkDataTypes)(W,J,Y.opts.strictNumbers,Qw.DataType.Wrong)}`}return D0.nil}function K(){if($.validateSchema){let W=Z.scopeValue("validate$data",{ref:$.validateSchema});return D0._`!${W}(${J})`}return D0.nil}}subschema(Z,J){let X=(0,FN.getSubschema)(this.it,Z);(0,FN.extendSubschemaData)(X,this.it,Z),(0,FN.extendSubschemaMode)(X,Z);let $={...this.it,...X,items:void 0,props:void 0};return mP1($,J),$}mergeEvaluated(Z,J){let{it:X,gen:$}=this;if(!X.opts.unevaluated)return;if(X.props!==!0&&Z.props!==void 0)X.props=CZ.mergeEvaluated.props($,Z.props,X.props,J);if(X.items!==!0&&Z.items!==void 0)X.items=CZ.mergeEvaluated.items($,Z.items,X.items,J)}mergeValidEvaluated(Z,J){let{it:X,gen:$}=this;if(X.opts.unevaluated&&(X.props!==!0||X.items!==!0))return $.if(J,()=>this.mergeEvaluated(Z,D0.Name)),!0}}pr.KeywordCxt=xN;function lr(Z,J,X,$){let Y=new xN(Z,X,J);if("code"in X)X.code(Y,$);else if(Y.$data&&X.validate)(0,Kz.funcKeywordCode)(Y,X);else if("macro"in X)(0,Kz.macroKeywordCode)(Y,X);else if(X.compile||X.validate)(0,Kz.funcKeywordCode)(Y,X)}var eP1=/^\/(?:[^~]|~0|~1)*$/,ZT1=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function yr(Z,{dataLevel:J,dataNames:X,dataPathArr:$}){let Y,Q;if(Z==="")return b0.default.rootData;if(Z[0]==="/"){if(!eP1.test(Z))throw new Error(`Invalid JSON-pointer: ${Z}`);Y=Z,Q=b0.default.rootData}else{let z=ZT1.exec(Z);if(!z)throw new Error(`Invalid JSON-pointer: ${Z}`);let V=+z[1];if(Y=z[2],Y==="#"){if(V>=J)throw new Error(G("property/index",V));return $[J-V]}if(V>J)throw new Error(G("data",V));if(Q=X[J-V],!Y)return Q}let K=Q,W=Y.split("/");for(let z of W)if(z)Q=D0._`${Q}${(0,D0.getProperty)((0,CZ.unescapeJsonPointer)(z))}`,K=D0._`${K} && ${Q}`;return K;function G(z,V){return`Cannot access ${z} ${V} levels up, current level is ${J}`}}pr.getData=yr});var Kw=U((dr)=>{Object.defineProperty(dr,"__esModule",{value:!0});class gr extends Error{constructor(Z){super("validation failed");this.errors=Z,this.ajv=this.validation=!0}}dr.default=gr});var Gz=U((nr)=>{Object.defineProperty(nr,"__esModule",{value:!0});var UN=Yz();class ar extends Error{constructor(Z,J,X,$){super($||`can't resolve reference ${X} from id ${J}`);this.missingRef=(0,UN.resolveUrl)(Z,J,X),this.missingSchema=(0,UN.normalizeId)((0,UN.getFullPath)(Z,this.missingRef))}}nr.default=ar});var Gw=U((rr)=>{Object.defineProperty(rr,"__esModule",{value:!0});rr.resolveSchema=rr.getCompilingSchema=rr.resolveRef=rr.compileSchema=rr.SchemaEnv=void 0;var L9=o0(),QT1=Kw(),g$=TZ(),D9=Yz(),sr=V1(),KT1=Wz();class zz{constructor(Z){var J;this.refs={},this.dynamicAnchors={};let X;if(typeof Z.schema=="object")X=Z.schema;this.schema=Z.schema,this.schemaId=Z.schemaId,this.root=Z.root||this,this.baseId=(J=Z.baseId)!==null&&J!==void 0?J:(0,D9.normalizeId)(X===null||X===void 0?void 0:X[Z.schemaId||"$id"]),this.schemaPath=Z.schemaPath,this.localRefs=Z.localRefs,this.meta=Z.meta,this.$async=X===null||X===void 0?void 0:X.$async,this.refs={}}}rr.SchemaEnv=zz;function BN(Z){let J=or.call(this,Z);if(J)return J;let X=(0,D9.getFullPath)(this.opts.uriResolver,Z.root.baseId),{es5:$,lines:Y}=this.opts.code,{ownProperties:Q}=this.opts,K=new L9.CodeGen(this.scope,{es5:$,lines:Y,ownProperties:Q}),W;if(Z.$async)W=K.scopeValue("Error",{ref:QT1.default,code:L9._`require("ajv/dist/runtime/validation_error").default`});let G=K.scopeName("validate");Z.validateName=G;let z={gen:K,allErrors:this.opts.allErrors,data:g$.default.data,parentData:g$.default.parentData,parentDataProperty:g$.default.parentDataProperty,dataNames:[g$.default.data],dataPathArr:[L9.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:K.scopeValue("schema",this.opts.code.source===!0?{ref:Z.schema,code:(0,L9.stringify)(Z.schema)}:{ref:Z.schema}),validateName:G,ValidationError:W,schema:Z.schema,schemaEnv:Z,rootId:X,baseId:Z.baseId||X,schemaPath:L9.nil,errSchemaPath:Z.schemaPath||(this.opts.jtd?"":"#"),errorPath:L9._`""`,opts:this.opts,self:this},V;try{this._compilations.add(Z),(0,KT1.validateFunctionCode)(z),K.optimize(this.opts.code.optimize);let H=K.toString();if(V=`${K.scopeRefs(g$.default.scope)}return ${H}`,this.opts.code.process)V=this.opts.code.process(V,Z);let q=new Function(`${g$.default.self}`,`${g$.default.scope}`,V)(this,this.scope.get());if(this.scope.value(G,{ref:q}),q.errors=null,q.schema=Z.schema,q.schemaEnv=Z,Z.$async)q.$async=!0;if(this.opts.code.source===!0)q.source={validateName:G,validateCode:H,scopeValues:K._values};if(this.opts.unevaluated){let{props:F,items:c}=z;if(q.evaluated={props:F instanceof L9.Name?void 0:F,items:c instanceof L9.Name?void 0:c,dynamicProps:F instanceof L9.Name,dynamicItems:c instanceof L9.Name},q.source)q.source.evaluated=(0,L9.stringify)(q.evaluated)}return Z.validate=q,Z}catch(H){if(delete Z.validate,delete Z.validateName,V)this.logger.error("Error compiling schema, function code:",V);throw H}finally{this._compilations.delete(Z)}}rr.compileSchema=BN;function WT1(Z,J,X){var $;X=(0,D9.resolveUrl)(this.opts.uriResolver,J,X);let Y=Z.refs[X];if(Y)return Y;let Q=VT1.call(this,Z,X);if(Q===void 0){let K=($=Z.localRefs)===null||$===void 0?void 0:$[X],{schemaId:W}=this.opts;if(K)Q=new zz({schema:K,schemaId:W,root:Z,baseId:J})}if(Q===void 0)return;return Z.refs[X]=GT1.call(this,Q)}rr.resolveRef=WT1;function GT1(Z){if((0,D9.inlineRef)(Z.schema,this.opts.inlineRefs))return Z.schema;return Z.validate?Z:BN.call(this,Z)}function or(Z){for(let J of this._compilations)if(zT1(J,Z))return J}rr.getCompilingSchema=or;function zT1(Z,J){return Z.schema===J.schema&&Z.root===J.root&&Z.baseId===J.baseId}function VT1(Z,J){let X;while(typeof(X=this.refs[J])=="string")J=X;return X||this.schemas[J]||Ww.call(this,Z,J)}function Ww(Z,J){let X=this.opts.uriResolver.parse(J),$=(0,D9._getFullPath)(this.opts.uriResolver,X),Y=(0,D9.getFullPath)(this.opts.uriResolver,Z.baseId,void 0);if(Object.keys(Z.schema).length>0&&$===Y)return jN.call(this,X,Z);let Q=(0,D9.normalizeId)($),K=this.refs[Q]||this.schemas[Q];if(typeof K=="string"){let W=Ww.call(this,Z,K);if(typeof(W===null||W===void 0?void 0:W.schema)!=="object")return;return jN.call(this,X,W)}if(typeof(K===null||K===void 0?void 0:K.schema)!=="object")return;if(!K.validate)BN.call(this,K);if(Q===(0,D9.normalizeId)(J)){let{schema:W}=K,{schemaId:G}=this.opts,z=W[G];if(z)Y=(0,D9.resolveUrl)(this.opts.uriResolver,Y,z);return new zz({schema:W,schemaId:G,root:Z,baseId:Y})}return jN.call(this,X,K)}rr.resolveSchema=Ww;var vT1=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function jN(Z,{baseId:J,schema:X,root:$}){var Y;if(((Y=Z.fragment)===null||Y===void 0?void 0:Y[0])!=="/")return;for(let W of Z.fragment.slice(1).split("/")){if(typeof X==="boolean")return;let G=X[(0,sr.unescapeFragment)(W)];if(G===void 0)return;X=G;let z=typeof X==="object"&&X[this.opts.schemaId];if(!vT1.has(W)&&z)J=(0,D9.resolveUrl)(this.opts.uriResolver,J,z)}let Q;if(typeof X!="boolean"&&X.$ref&&!(0,sr.schemaHasRulesButRef)(X,this.RULES)){let W=(0,D9.resolveUrl)(this.opts.uriResolver,J,X.$ref);Q=Ww.call(this,$,W)}let{schemaId:K}=this.opts;if(Q=Q||new zz({schema:X,schemaId:K,root:$,baseId:J}),Q.schema!==Q.root.schema)return Q;return}});var er=U((CT6,wT1)=>{wT1.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var Jt=U((fT6,Zt)=>{var xT1={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};Zt.exports={HEX:xT1}});var zt=U((kT6,Gt)=>{var{HEX:UT1}=Jt(),jT1=/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u;function Qt(Z){if(Wt(Z,".")<3)return{host:Z,isIPV4:!1};let J=Z.match(jT1)||[],[X]=J;if(X)return{host:LT1(X,"."),isIPV4:!0};else return{host:Z,isIPV4:!1}}function LN(Z,J=!1){let X="",$=!0;for(let Y of Z){if(UT1[Y]===void 0)return;if(Y!=="0"&&$===!0)$=!1;if(!$)X+=Y}if(J&&X.length===0)X="0";return X}function BT1(Z){let J=0,X={error:!1,address:"",zone:""},$=[],Y=[],Q=!1,K=!1,W=!1;function G(){if(Y.length){if(Q===!1){let z=LN(Y);if(z!==void 0)$.push(z);else return X.error=!0,!1}Y.length=0}return!0}for(let z=0;z<Z.length;z++){let V=Z[z];if(V==="["||V==="]")continue;if(V===":"){if(K===!0)W=!0;if(!G())break;if(J++,$.push(":"),J>7){X.error=!0;break}if(z-1>=0&&Z[z-1]===":")K=!0;continue}else if(V==="%"){if(!G())break;Q=!0}else{Y.push(V);continue}}if(Y.length)if(Q)X.zone=Y.join("");else if(W)$.push(Y.join(""));else $.push(LN(Y));return X.address=$.join(""),X}function Kt(Z){if(Wt(Z,":")<2)return{host:Z,isIPV6:!1};let J=BT1(Z);if(!J.error){let{address:X,address:$}=J;if(J.zone)X+="%"+J.zone,$+="%25"+J.zone;return{host:X,escapedHost:$,isIPV6:!0}}else return{host:Z,isIPV6:!1}}function LT1(Z,J){let X="",$=!0,Y=Z.length;for(let Q=0;Q<Y;Q++){let K=Z[Q];if(K==="0"&&$){if(Q+1<=Y&&Z[Q+1]===J||Q+1===Y)X+=K,$=!1}else{if(K===J)$=!0;else $=!1;X+=K}}return X}function Wt(Z,J){let X=0;for(let $=0;$<Z.length;$++)if(Z[$]===J)X++;return X}var Xt=/^\.\.?\//u,$t=/^\/\.(?:\/|$)/u,Yt=/^\/\.\.(?:\/|$)/u,DT1=/^\/?(?:.|\n)*?(?=\/|$)/u;function MT1(Z){let J=[];while(Z.length)if(Z.match(Xt))Z=Z.replace(Xt,"");else if(Z.match($t))Z=Z.replace($t,"/");else if(Z.match(Yt))Z=Z.replace(Yt,"/"),J.pop();else if(Z==="."||Z==="..")Z="";else{let X=Z.match(DT1);if(X){let $=X[0];Z=Z.slice($.length),J.push($)}else throw new Error("Unexpected dot segment condition")}return J.join("")}function RT1(Z,J){let X=J!==!0?escape:unescape;if(Z.scheme!==void 0)Z.scheme=X(Z.scheme);if(Z.userinfo!==void 0)Z.userinfo=X(Z.userinfo);if(Z.host!==void 0)Z.host=X(Z.host);if(Z.path!==void 0)Z.path=X(Z.path);if(Z.query!==void 0)Z.query=X(Z.query);if(Z.fragment!==void 0)Z.fragment=X(Z.fragment);return Z}function OT1(Z){let J=[];if(Z.userinfo!==void 0)J.push(Z.userinfo),J.push("@");if(Z.host!==void 0){let X=unescape(Z.host),$=Qt(X);if($.isIPV4)X=$.host;else{let Y=Kt($.host);if(Y.isIPV6===!0)X=`[${Y.escapedHost}]`;else X=Z.host}J.push(X)}if(typeof Z.port==="number"||typeof Z.port==="string")J.push(":"),J.push(String(Z.port));return J.length?J.join(""):void 0}Gt.exports={recomposeAuthority:OT1,normalizeComponentEncoding:RT1,removeDotSegments:MT1,normalizeIPv4:Qt,normalizeIPv6:Kt,stringArrayToHexStripped:LN}});var ct=U((ET6,Ft)=>{var NT1=/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu,PT1=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu;function Vt(Z){return typeof Z.secure==="boolean"?Z.secure:String(Z.scheme).toLowerCase()==="wss"}function vt(Z){if(!Z.host)Z.error=Z.error||"HTTP URIs must have a host.";return Z}function Ht(Z){let J=String(Z.scheme).toLowerCase()==="https";if(Z.port===(J?443:80)||Z.port==="")Z.port=void 0;if(!Z.path)Z.path="/";return Z}function TT1(Z){return Z.secure=Vt(Z),Z.resourceName=(Z.path||"/")+(Z.query?"?"+Z.query:""),Z.path=void 0,Z.query=void 0,Z}function CT1(Z){if(Z.port===(Vt(Z)?443:80)||Z.port==="")Z.port=void 0;if(typeof Z.secure==="boolean")Z.scheme=Z.secure?"wss":"ws",Z.secure=void 0;if(Z.resourceName){let[J,X]=Z.resourceName.split("?");Z.path=J&&J!=="/"?J:void 0,Z.query=X,Z.resourceName=void 0}return Z.fragment=void 0,Z}function fT1(Z,J){if(!Z.path)return Z.error="URN can not be parsed",Z;let X=Z.path.match(PT1);if(X){let $=J.scheme||Z.scheme||"urn";Z.nid=X[1].toLowerCase(),Z.nss=X[2];let Y=`${$}:${J.nid||Z.nid}`,Q=DN[Y];if(Z.path=void 0,Q)Z=Q.parse(Z,J)}else Z.error=Z.error||"URN can not be parsed.";return Z}function kT1(Z,J){let X=J.scheme||Z.scheme||"urn",$=Z.nid.toLowerCase(),Y=`${X}:${J.nid||$}`,Q=DN[Y];if(Q)Z=Q.serialize(Z,J);let K=Z,W=Z.nss;return K.path=`${$||J.nid}:${W}`,J.skipEscape=!0,K}function ET1(Z,J){let X=Z;if(X.uuid=X.nss,X.nss=void 0,!J.tolerant&&(!X.uuid||!NT1.test(X.uuid)))X.error=X.error||"UUID is not valid.";return X}function IT1(Z){let J=Z;return J.nss=(Z.uuid||"").toLowerCase(),J}var qt={scheme:"http",domainHost:!0,parse:vt,serialize:Ht},_T1={scheme:"https",domainHost:qt.domainHost,parse:vt,serialize:Ht},zw={scheme:"ws",domainHost:!0,parse:TT1,serialize:CT1},bT1={scheme:"wss",domainHost:zw.domainHost,parse:zw.parse,serialize:zw.serialize},hT1={scheme:"urn",parse:fT1,serialize:kT1,skipNormalize:!0},ST1={scheme:"urn:uuid",parse:ET1,serialize:IT1,skipNormalize:!0},DN={http:qt,https:_T1,ws:zw,wss:bT1,urn:hT1,"urn:uuid":ST1};Ft.exports=DN});var xt=U((IT6,vw)=>{var{normalizeIPv6:AT1,normalizeIPv4:mT1,removeDotSegments:Vz,recomposeAuthority:uT1,normalizeComponentEncoding:Vw}=zt(),MN=ct();function lT1(Z,J){if(typeof Z==="string")Z=H7(fZ(Z,J),J);else if(typeof Z==="object")Z=fZ(H7(Z,J),J);return Z}function yT1(Z,J,X){let $=Object.assign({scheme:"null"},X),Y=wt(fZ(Z,$),fZ(J,$),$,!0);return H7(Y,{...$,skipEscape:!0})}function wt(Z,J,X,$){let Y={};if(!$)Z=fZ(H7(Z,X),X),J=fZ(H7(J,X),X);if(X=X||{},!X.tolerant&&J.scheme)Y.scheme=J.scheme,Y.userinfo=J.userinfo,Y.host=J.host,Y.port=J.port,Y.path=Vz(J.path||""),Y.query=J.query;else{if(J.userinfo!==void 0||J.host!==void 0||J.port!==void 0)Y.userinfo=J.userinfo,Y.host=J.host,Y.port=J.port,Y.path=Vz(J.path||""),Y.query=J.query;else{if(!J.path)if(Y.path=Z.path,J.query!==void 0)Y.query=J.query;else Y.query=Z.query;else{if(J.path.charAt(0)==="/")Y.path=Vz(J.path);else{if((Z.userinfo!==void 0||Z.host!==void 0||Z.port!==void 0)&&!Z.path)Y.path="/"+J.path;else if(!Z.path)Y.path=J.path;else Y.path=Z.path.slice(0,Z.path.lastIndexOf("/")+1)+J.path;Y.path=Vz(Y.path)}Y.query=J.query}Y.userinfo=Z.userinfo,Y.host=Z.host,Y.port=Z.port}Y.scheme=Z.scheme}return Y.fragment=J.fragment,Y}function pT1(Z,J,X){if(typeof Z==="string")Z=unescape(Z),Z=H7(Vw(fZ(Z,X),!0),{...X,skipEscape:!0});else if(typeof Z==="object")Z=H7(Vw(Z,!0),{...X,skipEscape:!0});if(typeof J==="string")J=unescape(J),J=H7(Vw(fZ(J,X),!0),{...X,skipEscape:!0});else if(typeof J==="object")J=H7(Vw(J,!0),{...X,skipEscape:!0});return Z.toLowerCase()===J.toLowerCase()}function H7(Z,J){let X={host:Z.host,scheme:Z.scheme,userinfo:Z.userinfo,port:Z.port,path:Z.path,query:Z.query,nid:Z.nid,nss:Z.nss,uuid:Z.uuid,fragment:Z.fragment,reference:Z.reference,resourceName:Z.resourceName,secure:Z.secure,error:""},$=Object.assign({},J),Y=[],Q=MN[($.scheme||X.scheme||"").toLowerCase()];if(Q&&Q.serialize)Q.serialize(X,$);if(X.path!==void 0)if(!$.skipEscape){if(X.path=escape(X.path),X.scheme!==void 0)X.path=X.path.split("%3A").join(":")}else X.path=unescape(X.path);if($.reference!=="suffix"&&X.scheme)Y.push(X.scheme,":");let K=uT1(X);if(K!==void 0){if($.reference!=="suffix")Y.push("//");if(Y.push(K),X.path&&X.path.charAt(0)!=="/")Y.push("/")}if(X.path!==void 0){let W=X.path;if(!$.absolutePath&&(!Q||!Q.absolutePath))W=Vz(W);if(K===void 0)W=W.replace(/^\/\//u,"/%2F");Y.push(W)}if(X.query!==void 0)Y.push("?",X.query);if(X.fragment!==void 0)Y.push("#",X.fragment);return Y.join("")}var iT1=Array.from({length:127},(Z,J)=>/[^!"$&'()*+,\-.;=_`a-z{}~]/u.test(String.fromCharCode(J)));function gT1(Z){let J=0;for(let X=0,$=Z.length;X<$;++X)if(J=Z.charCodeAt(X),J>126||iT1[J])return!0;return!1}var dT1=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function fZ(Z,J){let X=Object.assign({},J),$={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},Y=Z.indexOf("%")!==-1,Q=!1;if(X.reference==="suffix")Z=(X.scheme?X.scheme+":":"")+"//"+Z;let K=Z.match(dT1);if(K){if($.scheme=K[1],$.userinfo=K[3],$.host=K[4],$.port=parseInt(K[5],10),$.path=K[6]||"",$.query=K[7],$.fragment=K[8],isNaN($.port))$.port=K[5];if($.host){let G=mT1($.host);if(G.isIPV4===!1){let z=AT1(G.host);$.host=z.host.toLowerCase(),Q=z.isIPV6}else $.host=G.host,Q=!0}if($.scheme===void 0&&$.userinfo===void 0&&$.host===void 0&&$.port===void 0&&$.query===void 0&&!$.path)$.reference="same-document";else if($.scheme===void 0)$.reference="relative";else if($.fragment===void 0)$.reference="absolute";else $.reference="uri";if(X.reference&&X.reference!=="suffix"&&X.reference!==$.reference)$.error=$.error||"URI is not a "+X.reference+" reference.";let W=MN[(X.scheme||$.scheme||"").toLowerCase()];if(!X.unicodeSupport&&(!W||!W.unicodeSupport)){if($.host&&(X.domainHost||W&&W.domainHost)&&Q===!1&&gT1($.host))try{$.host=URL.domainToASCII($.host.toLowerCase())}catch(G){$.error=$.error||"Host's domain name can not be converted to ASCII: "+G}}if(!W||W&&!W.skipNormalize){if(Y&&$.scheme!==void 0)$.scheme=unescape($.scheme);if(Y&&$.host!==void 0)$.host=unescape($.host);if($.path)$.path=escape(unescape($.path));if($.fragment)$.fragment=encodeURI(decodeURIComponent($.fragment))}if(W&&W.parse)W.parse($,X)}else $.error=$.error||"URI can not be parsed.";return $}var RN={SCHEMES:MN,normalize:lT1,resolve:yT1,resolveComponents:wt,equal:pT1,serialize:H7,parse:fZ};vw.exports=RN;vw.exports.default=RN;vw.exports.fastUri=RN});var Bt=U((jt)=>{Object.defineProperty(jt,"__esModule",{value:!0});var Ut=xt();Ut.code='require("ajv/dist/runtime/uri").default';jt.default=Ut});var Tt=U((kZ)=>{Object.defineProperty(kZ,"__esModule",{value:!0});kZ.CodeGen=kZ.Name=kZ.nil=kZ.stringify=kZ.str=kZ._=kZ.KeywordCxt=void 0;var nT1=Wz();Object.defineProperty(kZ,"KeywordCxt",{enumerable:!0,get:function(){return nT1.KeywordCxt}});var E3=o0();Object.defineProperty(kZ,"_",{enumerable:!0,get:function(){return E3._}});Object.defineProperty(kZ,"str",{enumerable:!0,get:function(){return E3.str}});Object.defineProperty(kZ,"stringify",{enumerable:!0,get:function(){return E3.stringify}});Object.defineProperty(kZ,"nil",{enumerable:!0,get:function(){return E3.nil}});Object.defineProperty(kZ,"Name",{enumerable:!0,get:function(){return E3.Name}});Object.defineProperty(kZ,"CodeGen",{enumerable:!0,get:function(){return E3.CodeGen}});var sT1=Kw(),Ot=Gz(),oT1=YN(),vz=Gw(),rT1=o0(),Hz=Yz(),Hw=$z(),NN=V1(),Lt=er(),tT1=Bt(),Nt=(Z,J)=>new RegExp(Z,J);Nt.code="new RegExp";var eT1=["removeAdditional","useDefaults","coerceTypes"],ZC1=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),JC1={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},XC1={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},Dt=200;function $C1(Z){var J,X,$,Y,Q,K,W,G,z,V,H,v,q,F,c,w,x,j,B,L,R,M,O,P,N;let _=Z.strict,k=(J=Z.code)===null||J===void 0?void 0:J.optimize,h=k===!0||k===void 0?1:k||0,f=($=(X=Z.code)===null||X===void 0?void 0:X.regExp)!==null&&$!==void 0?$:Nt,C=(Y=Z.uriResolver)!==null&&Y!==void 0?Y:tT1.default;return{strictSchema:(K=(Q=Z.strictSchema)!==null&&Q!==void 0?Q:_)!==null&&K!==void 0?K:!0,strictNumbers:(G=(W=Z.strictNumbers)!==null&&W!==void 0?W:_)!==null&&G!==void 0?G:!0,strictTypes:(V=(z=Z.strictTypes)!==null&&z!==void 0?z:_)!==null&&V!==void 0?V:"log",strictTuples:(v=(H=Z.strictTuples)!==null&&H!==void 0?H:_)!==null&&v!==void 0?v:"log",strictRequired:(F=(q=Z.strictRequired)!==null&&q!==void 0?q:_)!==null&&F!==void 0?F:!1,code:Z.code?{...Z.code,optimize:h,regExp:f}:{optimize:h,regExp:f},loopRequired:(c=Z.loopRequired)!==null&&c!==void 0?c:Dt,loopEnum:(w=Z.loopEnum)!==null&&w!==void 0?w:Dt,meta:(x=Z.meta)!==null&&x!==void 0?x:!0,messages:(j=Z.messages)!==null&&j!==void 0?j:!0,inlineRefs:(B=Z.inlineRefs)!==null&&B!==void 0?B:!0,schemaId:(L=Z.schemaId)!==null&&L!==void 0?L:"$id",addUsedSchema:(R=Z.addUsedSchema)!==null&&R!==void 0?R:!0,validateSchema:(M=Z.validateSchema)!==null&&M!==void 0?M:!0,validateFormats:(O=Z.validateFormats)!==null&&O!==void 0?O:!0,unicodeRegExp:(P=Z.unicodeRegExp)!==null&&P!==void 0?P:!0,int32range:(N=Z.int32range)!==null&&N!==void 0?N:!0,uriResolver:C}}class qw{constructor(Z={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,Z=this.opts={...Z,...$C1(Z)};let{es5:J,lines:X}=this.opts.code;this.scope=new rT1.ValueScope({scope:{},prefixes:ZC1,es5:J,lines:X}),this.logger=zC1(Z.logger);let $=Z.validateFormats;if(Z.validateFormats=!1,this.RULES=(0,oT1.getRules)(),Mt.call(this,JC1,Z,"NOT SUPPORTED"),Mt.call(this,XC1,Z,"DEPRECATED","warn"),this._metaOpts=WC1.call(this),Z.formats)QC1.call(this);if(this._addVocabularies(),this._addDefaultMetaSchema(),Z.keywords)KC1.call(this,Z.keywords);if(typeof Z.meta=="object")this.addMetaSchema(Z.meta);YC1.call(this),Z.validateFormats=$}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:Z,meta:J,schemaId:X}=this.opts,$=Lt;if(X==="id")$={...Lt},$.id=$.$id,delete $.$id;if(J&&Z)this.addMetaSchema($,$[X],!1)}defaultMeta(){let{meta:Z,schemaId:J}=this.opts;return this.opts.defaultMeta=typeof Z=="object"?Z[J]||Z:void 0}validate(Z,J){let X;if(typeof Z=="string"){if(X=this.getSchema(Z),!X)throw new Error(`no schema with key or ref "${Z}"`)}else X=this.compile(Z);let $=X(J);if(!("$async"in X))this.errors=X.errors;return $}compile(Z,J){let X=this._addSchema(Z,J);return X.validate||this._compileSchemaEnv(X)}compileAsync(Z,J){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:X}=this.opts;return $.call(this,Z,J);async function $(z,V){await Y.call(this,z.$schema);let H=this._addSchema(z,V);return H.validate||Q.call(this,H)}async function Y(z){if(z&&!this.getSchema(z))await $.call(this,{$ref:z},!0)}async function Q(z){try{return this._compileSchemaEnv(z)}catch(V){if(!(V instanceof Ot.default))throw V;return K.call(this,V),await W.call(this,V.missingSchema),Q.call(this,z)}}function K({missingSchema:z,missingRef:V}){if(this.refs[z])throw new Error(`AnySchema ${z} is loaded but ${V} cannot be resolved`)}async function W(z){let V=await G.call(this,z);if(!this.refs[z])await Y.call(this,V.$schema);if(!this.refs[z])this.addSchema(V,z,J)}async function G(z){let V=this._loading[z];if(V)return V;try{return await(this._loading[z]=X(z))}finally{delete this._loading[z]}}}addSchema(Z,J,X,$=this.opts.validateSchema){if(Array.isArray(Z)){for(let Q of Z)this.addSchema(Q,void 0,X,$);return this}let Y;if(typeof Z==="object"){let{schemaId:Q}=this.opts;if(Y=Z[Q],Y!==void 0&&typeof Y!="string")throw new Error(`schema ${Q} must be string`)}return J=(0,Hz.normalizeId)(J||Y),this._checkUnique(J),this.schemas[J]=this._addSchema(Z,X,J,$,!0),this}addMetaSchema(Z,J,X=this.opts.validateSchema){return this.addSchema(Z,J,!0,X),this}validateSchema(Z,J){if(typeof Z=="boolean")return!0;let X;if(X=Z.$schema,X!==void 0&&typeof X!="string")throw new Error("$schema must be a string");if(X=X||this.opts.defaultMeta||this.defaultMeta(),!X)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let $=this.validate(X,Z);if(!$&&J){let Y="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(Y);else throw new Error(Y)}return $}getSchema(Z){let J;while(typeof(J=Rt.call(this,Z))=="string")Z=J;if(J===void 0){let{schemaId:X}=this.opts,$=new vz.SchemaEnv({schema:{},schemaId:X});if(J=vz.resolveSchema.call(this,$,Z),!J)return;this.refs[Z]=J}return J.validate||this._compileSchemaEnv(J)}removeSchema(Z){if(Z instanceof RegExp)return this._removeAllSchemas(this.schemas,Z),this._removeAllSchemas(this.refs,Z),this;switch(typeof Z){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let J=Rt.call(this,Z);if(typeof J=="object")this._cache.delete(J.schema);return delete this.schemas[Z],delete this.refs[Z],this}case"object":{let J=Z;this._cache.delete(J);let X=Z[this.opts.schemaId];if(X)X=(0,Hz.normalizeId)(X),delete this.schemas[X],delete this.refs[X];return this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(Z){for(let J of Z)this.addKeyword(J);return this}addKeyword(Z,J){let X;if(typeof Z=="string"){if(X=Z,typeof J=="object")this.logger.warn("these parameters are deprecated, see docs for addKeyword"),J.keyword=X}else if(typeof Z=="object"&&J===void 0){if(J=Z,X=J.keyword,Array.isArray(X)&&!X.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(vC1.call(this,X,J),!J)return(0,NN.eachItem)(X,(Y)=>ON.call(this,Y)),this;qC1.call(this,J);let $={...J,type:(0,Hw.getJSONTypes)(J.type),schemaType:(0,Hw.getJSONTypes)(J.schemaType)};return(0,NN.eachItem)(X,$.type.length===0?(Y)=>ON.call(this,Y,$):(Y)=>$.type.forEach((Q)=>ON.call(this,Y,$,Q))),this}getKeyword(Z){let J=this.RULES.all[Z];return typeof J=="object"?J.definition:!!J}removeKeyword(Z){let{RULES:J}=this;delete J.keywords[Z],delete J.all[Z];for(let X of J.rules){let $=X.rules.findIndex((Y)=>Y.keyword===Z);if($>=0)X.rules.splice($,1)}return this}addFormat(Z,J){if(typeof J=="string")J=new RegExp(J);return this.formats[Z]=J,this}errorsText(Z=this.errors,{separator:J=", ",dataVar:X="data"}={}){if(!Z||Z.length===0)return"No errors";return Z.map(($)=>`${X}${$.instancePath} ${$.message}`).reduce(($,Y)=>$+J+Y)}$dataMetaSchema(Z,J){let X=this.RULES.all;Z=JSON.parse(JSON.stringify(Z));for(let $ of J){let Y=$.split("/").slice(1),Q=Z;for(let K of Y)Q=Q[K];for(let K in X){let W=X[K];if(typeof W!="object")continue;let{$data:G}=W.definition,z=Q[K];if(G&&z)Q[K]=Pt(z)}}return Z}_removeAllSchemas(Z,J){for(let X in Z){let $=Z[X];if(!J||J.test(X)){if(typeof $=="string")delete Z[X];else if($&&!$.meta)this._cache.delete($.schema),delete Z[X]}}}_addSchema(Z,J,X,$=this.opts.validateSchema,Y=this.opts.addUsedSchema){let Q,{schemaId:K}=this.opts;if(typeof Z=="object")Q=Z[K];else if(this.opts.jtd)throw new Error("schema must be object");else if(typeof Z!="boolean")throw new Error("schema must be object or boolean");let W=this._cache.get(Z);if(W!==void 0)return W;X=(0,Hz.normalizeId)(Q||X);let G=Hz.getSchemaRefs.call(this,Z,X);if(W=new vz.SchemaEnv({schema:Z,schemaId:K,meta:J,baseId:X,localRefs:G}),this._cache.set(W.schema,W),Y&&!X.startsWith("#")){if(X)this._checkUnique(X);this.refs[X]=W}if($)this.validateSchema(Z,!0);return W}_checkUnique(Z){if(this.schemas[Z]||this.refs[Z])throw new Error(`schema with key or id "${Z}" already exists`)}_compileSchemaEnv(Z){if(Z.meta)this._compileMetaSchema(Z);else vz.compileSchema.call(this,Z);if(!Z.validate)throw new Error("ajv implementation error");return Z.validate}_compileMetaSchema(Z){let J=this.opts;this.opts=this._metaOpts;try{vz.compileSchema.call(this,Z)}finally{this.opts=J}}}qw.ValidationError=sT1.default;qw.MissingRefError=Ot.default;kZ.default=qw;function Mt(Z,J,X,$="error"){for(let Y in Z){let Q=Y;if(Q in J)this.logger[$](`${X}: option ${Y}. ${Z[Q]}`)}}function Rt(Z){return Z=(0,Hz.normalizeId)(Z),this.schemas[Z]||this.refs[Z]}function YC1(){let Z=this.opts.schemas;if(!Z)return;if(Array.isArray(Z))this.addSchema(Z);else for(let J in Z)this.addSchema(Z[J],J)}function QC1(){for(let Z in this.opts.formats){let J=this.opts.formats[Z];if(J)this.addFormat(Z,J)}}function KC1(Z){if(Array.isArray(Z)){this.addVocabulary(Z);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let J in Z){let X=Z[J];if(!X.keyword)X.keyword=J;this.addKeyword(X)}}function WC1(){let Z={...this.opts};for(let J of eT1)delete Z[J];return Z}var GC1={log(){},warn(){},error(){}};function zC1(Z){if(Z===!1)return GC1;if(Z===void 0)return console;if(Z.log&&Z.warn&&Z.error)return Z;throw new Error("logger must implement log, warn and error methods")}var VC1=/^[a-z_$][a-z0-9_$:-]*$/i;function vC1(Z,J){let{RULES:X}=this;if((0,NN.eachItem)(Z,($)=>{if(X.keywords[$])throw new Error(`Keyword ${$} is already defined`);if(!VC1.test($))throw new Error(`Keyword ${$} has invalid name`)}),!J)return;if(J.$data&&!(("code"in J)||("validate"in J)))throw new Error('$data keyword must have "code" or "validate" function')}function ON(Z,J,X){var $;let Y=J===null||J===void 0?void 0:J.post;if(X&&Y)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:Q}=this,K=Y?Q.post:Q.rules.find(({type:G})=>G===X);if(!K)K={type:X,rules:[]},Q.rules.push(K);if(Q.keywords[Z]=!0,!J)return;let W={keyword:Z,definition:{...J,type:(0,Hw.getJSONTypes)(J.type),schemaType:(0,Hw.getJSONTypes)(J.schemaType)}};if(J.before)HC1.call(this,K,W,J.before);else K.rules.push(W);Q.all[Z]=W,($=J.implements)===null||$===void 0||$.forEach((G)=>this.addKeyword(G))}function HC1(Z,J,X){let $=Z.rules.findIndex((Y)=>Y.keyword===X);if($>=0)Z.rules.splice($,0,J);else Z.rules.push(J),this.logger.warn(`rule ${X} is not defined`)}function qC1(Z){let{metaSchema:J}=Z;if(J===void 0)return;if(Z.$data&&this.opts.$data)J=Pt(J);Z.validateSchema=this.compile(J,!0)}var FC1={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function Pt(Z){return{anyOf:[Z,FC1]}}});var ft=U((Ct)=>{Object.defineProperty(Ct,"__esModule",{value:!0});var xC1={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};Ct.default=xC1});var ht=U((_t)=>{Object.defineProperty(_t,"__esModule",{value:!0});_t.callRef=_t.getValidate=void 0;var jC1=Gz(),kt=R4(),w5=o0(),I3=TZ(),Et=Gw(),Fw=V1(),BC1={keyword:"$ref",schemaType:"string",code(Z){let{gen:J,schema:X,it:$}=Z,{baseId:Y,schemaEnv:Q,validateName:K,opts:W,self:G}=$,{root:z}=Q;if((X==="#"||X==="#/")&&Y===z.baseId)return H();let V=Et.resolveRef.call(G,z,Y,X);if(V===void 0)throw new jC1.default($.opts.uriResolver,Y,X);if(V instanceof Et.SchemaEnv)return v(V);return q(V);function H(){if(Q===z)return cw(Z,K,Q,Q.$async);let F=J.scopeValue("root",{ref:z});return cw(Z,w5._`${F}.validate`,z,z.$async)}function v(F){let c=It(Z,F);cw(Z,c,F,F.$async)}function q(F){let c=J.scopeValue("schema",W.code.source===!0?{ref:F,code:(0,w5.stringify)(F)}:{ref:F}),w=J.name("valid"),x=Z.subschema({schema:F,dataTypes:[],schemaPath:w5.nil,topSchemaRef:c,errSchemaPath:X},w);Z.mergeEvaluated(x),Z.ok(w)}}};function It(Z,J){let{gen:X}=Z;return J.validate?X.scopeValue("validate",{ref:J.validate}):w5._`${X.scopeValue("wrapper",{ref:J})}.validate`}_t.getValidate=It;function cw(Z,J,X,$){let{gen:Y,it:Q}=Z,{allErrors:K,schemaEnv:W,opts:G}=Q,z=G.passContext?I3.default.this:w5.nil;if($)V();else H();function V(){if(!W.$async)throw new Error("async schema referenced by sync schema");let F=Y.let("valid");Y.try(()=>{if(Y.code(w5._`await ${(0,kt.callValidateCode)(Z,J,z)}`),q(J),!K)Y.assign(F,!0)},(c)=>{if(Y.if(w5._`!(${c} instanceof ${Q.ValidationError})`,()=>Y.throw(c)),v(c),!K)Y.assign(F,!1)}),Z.ok(F)}function H(){Z.result((0,kt.callValidateCode)(Z,J,z),()=>q(J),()=>v(J))}function v(F){let c=w5._`${F}.errors`;Y.assign(I3.default.vErrors,w5._`${I3.default.vErrors} === null ? ${c} : ${I3.default.vErrors}.concat(${c})`),Y.assign(I3.default.errors,w5._`${I3.default.vErrors}.length`)}function q(F){var c;if(!Q.opts.unevaluated)return;let w=(c=X===null||X===void 0?void 0:X.validate)===null||c===void 0?void 0:c.evaluated;if(Q.props!==!0)if(w&&!w.dynamicProps){if(w.props!==void 0)Q.props=Fw.mergeEvaluated.props(Y,w.props,Q.props)}else{let x=Y.var("props",w5._`${F}.evaluated.props`);Q.props=Fw.mergeEvaluated.props(Y,x,Q.props,w5.Name)}if(Q.items!==!0)if(w&&!w.dynamicItems){if(w.items!==void 0)Q.items=Fw.mergeEvaluated.items(Y,w.items,Q.items)}else{let x=Y.var("items",w5._`${F}.evaluated.items`);Q.items=Fw.mergeEvaluated.items(Y,x,Q.items,w5.Name)}}}_t.callRef=cw;_t.default=BC1});var At=U((St)=>{Object.defineProperty(St,"__esModule",{value:!0});var MC1=ft(),RC1=ht(),OC1=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",MC1.default,RC1.default];St.default=OC1});var ut=U((mt)=>{Object.defineProperty(mt,"__esModule",{value:!0});var ww=o0(),eJ=ww.operators,xw={maximum:{okStr:"<=",ok:eJ.LTE,fail:eJ.GT},minimum:{okStr:">=",ok:eJ.GTE,fail:eJ.LT},exclusiveMaximum:{okStr:"<",ok:eJ.LT,fail:eJ.GTE},exclusiveMinimum:{okStr:">",ok:eJ.GT,fail:eJ.LTE}},PC1={message:({keyword:Z,schemaCode:J})=>ww.str`must be ${xw[Z].okStr} ${J}`,params:({keyword:Z,schemaCode:J})=>ww._`{comparison: ${xw[Z].okStr}, limit: ${J}}`},TC1={keyword:Object.keys(xw),type:"number",schemaType:"number",$data:!0,error:PC1,code(Z){let{keyword:J,data:X,schemaCode:$}=Z;Z.fail$data(ww._`${X} ${xw[J].fail} ${$} || isNaN(${X})`)}};mt.default=TC1});var yt=U((lt)=>{Object.defineProperty(lt,"__esModule",{value:!0});var qz=o0(),fC1={message:({schemaCode:Z})=>qz.str`must be multiple of ${Z}`,params:({schemaCode:Z})=>qz._`{multipleOf: ${Z}}`},kC1={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:fC1,code(Z){let{gen:J,data:X,schemaCode:$,it:Y}=Z,Q=Y.opts.multipleOfPrecision,K=J.let("res"),W=Q?qz._`Math.abs(Math.round(${K}) - ${K}) > 1e-${Q}`:qz._`${K} !== parseInt(${K})`;Z.fail$data(qz._`(${$} === 0 || (${K} = ${X}/${$}, ${W}))`)}};lt.default=kC1});var gt=U((it)=>{Object.defineProperty(it,"__esModule",{value:!0});function pt(Z){let J=Z.length,X=0,$=0,Y;while($<J)if(X++,Y=Z.charCodeAt($++),Y>=55296&&Y<=56319&&$<J){if(Y=Z.charCodeAt($),(Y&64512)===56320)$++}return X}it.default=pt;pt.code='require("ajv/dist/runtime/ucs2length").default'});var at=U((dt)=>{Object.defineProperty(dt,"__esModule",{value:!0});var d$=o0(),_C1=V1(),bC1=gt(),hC1={message({keyword:Z,schemaCode:J}){let X=Z==="maxLength"?"more":"fewer";return d$.str`must NOT have ${X} than ${J} characters`},params:({schemaCode:Z})=>d$._`{limit: ${Z}}`},SC1={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:hC1,code(Z){let{keyword:J,data:X,schemaCode:$,it:Y}=Z,Q=J==="maxLength"?d$.operators.GT:d$.operators.LT,K=Y.opts.unicode===!1?d$._`${X}.length`:d$._`${(0,_C1.useFunc)(Z.gen,bC1.default)}(${X})`;Z.fail$data(d$._`${K} ${Q} ${$}`)}};dt.default=SC1});var st=U((nt)=>{Object.defineProperty(nt,"__esModule",{value:!0});var mC1=R4(),Uw=o0(),uC1={message:({schemaCode:Z})=>Uw.str`must match pattern "${Z}"`,params:({schemaCode:Z})=>Uw._`{pattern: ${Z}}`},lC1={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:uC1,code(Z){let{data:J,$data:X,schema:$,schemaCode:Y,it:Q}=Z,K=Q.opts.unicodeRegExp?"u":"",W=X?Uw._`(new RegExp(${Y}, ${K}))`:(0,mC1.usePattern)(Z,$);Z.fail$data(Uw._`!${W}.test(${J})`)}};nt.default=lC1});var rt=U((ot)=>{Object.defineProperty(ot,"__esModule",{value:!0});var Fz=o0(),pC1={message({keyword:Z,schemaCode:J}){let X=Z==="maxProperties"?"more":"fewer";return Fz.str`must NOT have ${X} than ${J} properties`},params:({schemaCode:Z})=>Fz._`{limit: ${Z}}`},iC1={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:pC1,code(Z){let{keyword:J,data:X,schemaCode:$}=Z,Y=J==="maxProperties"?Fz.operators.GT:Fz.operators.LT;Z.fail$data(Fz._`Object.keys(${X}).length ${Y} ${$}`)}};ot.default=iC1});var et=U((tt)=>{Object.defineProperty(tt,"__esModule",{value:!0});var cz=R4(),wz=o0(),dC1=V1(),aC1={message:({params:{missingProperty:Z}})=>wz.str`must have required property '${Z}'`,params:({params:{missingProperty:Z}})=>wz._`{missingProperty: ${Z}}`},nC1={keyword:"required",type:"object",schemaType:"array",$data:!0,error:aC1,code(Z){let{gen:J,schema:X,schemaCode:$,data:Y,$data:Q,it:K}=Z,{opts:W}=K;if(!Q&&X.length===0)return;let G=X.length>=W.loopRequired;if(K.allErrors)z();else V();if(W.strictRequired){let q=Z.parentSchema.properties,{definedProperties:F}=Z.it;for(let c of X)if((q===null||q===void 0?void 0:q[c])===void 0&&!F.has(c)){let w=K.schemaEnv.baseId+K.errSchemaPath,x=`required property "${c}" is not defined at "${w}" (strictRequired)`;(0,dC1.checkStrictMode)(K,x,K.opts.strictRequired)}}function z(){if(G||Q)Z.block$data(wz.nil,H);else for(let q of X)(0,cz.checkReportMissingProp)(Z,q)}function V(){let q=J.let("missing");if(G||Q){let F=J.let("valid",!0);Z.block$data(F,()=>v(q,F)),Z.ok(F)}else J.if((0,cz.checkMissingProp)(Z,X,q)),(0,cz.reportMissingProp)(Z,q),J.else()}function H(){J.forOf("prop",$,(q)=>{Z.setParams({missingProperty:q}),J.if((0,cz.noPropertyInData)(J,Y,q,W.ownProperties),()=>Z.error())})}function v(q,F){Z.setParams({missingProperty:q}),J.forOf(q,$,()=>{J.assign(F,(0,cz.propertyInData)(J,Y,q,W.ownProperties)),J.if((0,wz.not)(F),()=>{Z.error(),J.break()})},wz.nil)}}};tt.default=nC1});var Je=U((Ze)=>{Object.defineProperty(Ze,"__esModule",{value:!0});var xz=o0(),oC1={message({keyword:Z,schemaCode:J}){let X=Z==="maxItems"?"more":"fewer";return xz.str`must NOT have ${X} than ${J} items`},params:({schemaCode:Z})=>xz._`{limit: ${Z}}`},rC1={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:oC1,code(Z){let{keyword:J,data:X,schemaCode:$}=Z,Y=J==="maxItems"?xz.operators.GT:xz.operators.LT;Z.fail$data(xz._`${X}.length ${Y} ${$}`)}};Ze.default=rC1});var jw=U(($e)=>{Object.defineProperty($e,"__esModule",{value:!0});var Xe=HN();Xe.code='require("ajv/dist/runtime/equal").default';$e.default=Xe});var Qe=U((Ye)=>{Object.defineProperty(Ye,"__esModule",{value:!0});var PN=$z(),$6=o0(),Zf1=V1(),Jf1=jw(),Xf1={message:({params:{i:Z,j:J}})=>$6.str`must NOT have duplicate items (items ## ${J} and ${Z} are identical)`,params:({params:{i:Z,j:J}})=>$6._`{i: ${Z}, j: ${J}}`},$f1={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:Xf1,code(Z){let{gen:J,data:X,$data:$,schema:Y,parentSchema:Q,schemaCode:K,it:W}=Z;if(!$&&!Y)return;let G=J.let("valid"),z=Q.items?(0,PN.getSchemaTypes)(Q.items):[];Z.block$data(G,V,$6._`${K} === false`),Z.ok(G);function V(){let F=J.let("i",$6._`${X}.length`),c=J.let("j");Z.setParams({i:F,j:c}),J.assign(G,!0),J.if($6._`${F} > 1`,()=>(H()?v:q)(F,c))}function H(){return z.length>0&&!z.some((F)=>F==="object"||F==="array")}function v(F,c){let w=J.name("item"),x=(0,PN.checkDataTypes)(z,w,W.opts.strictNumbers,PN.DataType.Wrong),j=J.const("indices",$6._`{}`);J.for($6._`;${F}--;`,()=>{if(J.let(w,$6._`${X}[${F}]`),J.if(x,$6._`continue`),z.length>1)J.if($6._`typeof ${w} == "string"`,$6._`${w} += "_"`);J.if($6._`typeof ${j}[${w}] == "number"`,()=>{J.assign(c,$6._`${j}[${w}]`),Z.error(),J.assign(G,!1).break()}).code($6._`${j}[${w}] = ${F}`)})}function q(F,c){let w=(0,Zf1.useFunc)(J,Jf1.default),x=J.name("outer");J.label(x).for($6._`;${F}--;`,()=>J.for($6._`${c} = ${F}; ${c}--;`,()=>J.if($6._`${w}(${X}[${F}], ${X}[${c}])`,()=>{Z.error(),J.assign(G,!1).break(x)})))}}};Ye.default=$f1});var We=U((Ke)=>{Object.defineProperty(Ke,"__esModule",{value:!0});var TN=o0(),Qf1=V1(),Kf1=jw(),Wf1={message:"must be equal to constant",params:({schemaCode:Z})=>TN._`{allowedValue: ${Z}}`},Gf1={keyword:"const",$data:!0,error:Wf1,code(Z){let{gen:J,data:X,$data:$,schemaCode:Y,schema:Q}=Z;if($||Q&&typeof Q=="object")Z.fail$data(TN._`!${(0,Qf1.useFunc)(J,Kf1.default)}(${X}, ${Y})`);else Z.fail(TN._`${Q} !== ${X}`)}};Ke.default=Gf1});var ze=U((Ge)=>{Object.defineProperty(Ge,"__esModule",{value:!0});var Uz=o0(),Vf1=V1(),vf1=jw(),Hf1={message:"must be equal to one of the allowed values",params:({schemaCode:Z})=>Uz._`{allowedValues: ${Z}}`},qf1={keyword:"enum",schemaType:"array",$data:!0,error:Hf1,code(Z){let{gen:J,data:X,$data:$,schema:Y,schemaCode:Q,it:K}=Z;if(!$&&Y.length===0)throw new Error("enum must have non-empty array");let W=Y.length>=K.opts.loopEnum,G,z=()=>G!==null&&G!==void 0?G:G=(0,Vf1.useFunc)(J,vf1.default),V;if(W||$)V=J.let("valid"),Z.block$data(V,H);else{if(!Array.isArray(Y))throw new Error("ajv implementation error");let q=J.const("vSchema",Q);V=(0,Uz.or)(...Y.map((F,c)=>v(q,c)))}Z.pass(V);function H(){J.assign(V,!1),J.forOf("v",Q,(q)=>J.if(Uz._`${z()}(${X}, ${q})`,()=>J.assign(V,!0).break()))}function v(q,F){let c=Y[F];return typeof c==="object"&&c!==null?Uz._`${z()}(${X}, ${q}[${F}])`:Uz._`${X} === ${c}`}}};Ge.default=qf1});var ve=U((Ve)=>{Object.defineProperty(Ve,"__esModule",{value:!0});var cf1=ut(),wf1=yt(),xf1=at(),Uf1=st(),jf1=rt(),Bf1=et(),Lf1=Je(),Df1=Qe(),Mf1=We(),Rf1=ze(),Of1=[cf1.default,wf1.default,xf1.default,Uf1.default,jf1.default,Bf1.default,Lf1.default,Df1.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},Mf1.default,Rf1.default];Ve.default=Of1});var fN=U((qe)=>{Object.defineProperty(qe,"__esModule",{value:!0});qe.validateAdditionalItems=void 0;var a$=o0(),CN=V1(),Pf1={message:({params:{len:Z}})=>a$.str`must NOT have more than ${Z} items`,params:({params:{len:Z}})=>a$._`{limit: ${Z}}`},Tf1={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:Pf1,code(Z){let{parentSchema:J,it:X}=Z,{items:$}=J;if(!Array.isArray($)){(0,CN.checkStrictMode)(X,'"additionalItems" is ignored when "items" is not an array of schemas');return}He(Z,$)}};function He(Z,J){let{gen:X,schema:$,data:Y,keyword:Q,it:K}=Z;K.items=!0;let W=X.const("len",a$._`${Y}.length`);if($===!1)Z.setParams({len:J.length}),Z.pass(a$._`${W} <= ${J.length}`);else if(typeof $=="object"&&!(0,CN.alwaysValidSchema)(K,$)){let z=X.var("valid",a$._`${W} <= ${J.length}`);X.if((0,a$.not)(z),()=>G(z)),Z.ok(z)}function G(z){X.forRange("i",J.length,W,(V)=>{if(Z.subschema({keyword:Q,dataProp:V,dataPropType:CN.Type.Num},z),!K.allErrors)X.if((0,a$.not)(z),()=>X.break())})}}qe.validateAdditionalItems=He;qe.default=Tf1});var kN=U((xe)=>{Object.defineProperty(xe,"__esModule",{value:!0});xe.validateTuple=void 0;var ce=o0(),Bw=V1(),ff1=R4(),kf1={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(Z){let{schema:J,it:X}=Z;if(Array.isArray(J))return we(Z,"additionalItems",J);if(X.items=!0,(0,Bw.alwaysValidSchema)(X,J))return;Z.ok((0,ff1.validateArray)(Z))}};function we(Z,J,X=Z.schema){let{gen:$,parentSchema:Y,data:Q,keyword:K,it:W}=Z;if(V(Y),W.opts.unevaluated&&X.length&&W.items!==!0)W.items=Bw.mergeEvaluated.items($,X.length,W.items);let G=$.name("valid"),z=$.const("len",ce._`${Q}.length`);X.forEach((H,v)=>{if((0,Bw.alwaysValidSchema)(W,H))return;$.if(ce._`${z} > ${v}`,()=>Z.subschema({keyword:K,schemaProp:v,dataProp:v},G)),Z.ok(G)});function V(H){let{opts:v,errSchemaPath:q}=W,F=X.length,c=F===H.minItems&&(F===H.maxItems||H[J]===!1);if(v.strictTuples&&!c){let w=`"${K}" is ${F}-tuple, but minItems or maxItems/${J} are not specified or different at path "${q}"`;(0,Bw.checkStrictMode)(W,w,v.strictTuples)}}}xe.validateTuple=we;xe.default=kf1});var Be=U((je)=>{Object.defineProperty(je,"__esModule",{value:!0});var If1=kN(),_f1={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:(Z)=>(0,If1.validateTuple)(Z,"items")};je.default=_f1});var Me=U((De)=>{Object.defineProperty(De,"__esModule",{value:!0});var Le=o0(),hf1=V1(),Sf1=R4(),Af1=fN(),mf1={message:({params:{len:Z}})=>Le.str`must NOT have more than ${Z} items`,params:({params:{len:Z}})=>Le._`{limit: ${Z}}`},uf1={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:mf1,code(Z){let{schema:J,parentSchema:X,it:$}=Z,{prefixItems:Y}=X;if($.items=!0,(0,hf1.alwaysValidSchema)($,J))return;if(Y)(0,Af1.validateAdditionalItems)(Z,Y);else Z.ok((0,Sf1.validateArray)(Z))}};De.default=uf1});var Oe=U((Re)=>{Object.defineProperty(Re,"__esModule",{value:!0});var O4=o0(),Lw=V1(),yf1={message:({params:{min:Z,max:J}})=>J===void 0?O4.str`must contain at least ${Z} valid item(s)`:O4.str`must contain at least ${Z} and no more than ${J} valid item(s)`,params:({params:{min:Z,max:J}})=>J===void 0?O4._`{minContains: ${Z}}`:O4._`{minContains: ${Z}, maxContains: ${J}}`},pf1={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:yf1,code(Z){let{gen:J,schema:X,parentSchema:$,data:Y,it:Q}=Z,K,W,{minContains:G,maxContains:z}=$;if(Q.opts.next)K=G===void 0?1:G,W=z;else K=1;let V=J.const("len",O4._`${Y}.length`);if(Z.setParams({min:K,max:W}),W===void 0&&K===0){(0,Lw.checkStrictMode)(Q,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(W!==void 0&&K>W){(0,Lw.checkStrictMode)(Q,'"minContains" > "maxContains" is always invalid'),Z.fail();return}if((0,Lw.alwaysValidSchema)(Q,X)){let c=O4._`${V} >= ${K}`;if(W!==void 0)c=O4._`${c} && ${V} <= ${W}`;Z.pass(c);return}Q.items=!0;let H=J.name("valid");if(W===void 0&&K===1)q(H,()=>J.if(H,()=>J.break()));else if(K===0){if(J.let(H,!0),W!==void 0)J.if(O4._`${Y}.length > 0`,v)}else J.let(H,!1),v();Z.result(H,()=>Z.reset());function v(){let c=J.name("_valid"),w=J.let("count",0);q(c,()=>J.if(c,()=>F(w)))}function q(c,w){J.forRange("i",0,V,(x)=>{Z.subschema({keyword:"contains",dataProp:x,dataPropType:Lw.Type.Num,compositeRule:!0},c),w()})}function F(c){if(J.code(O4._`${c}++`),W===void 0)J.if(O4._`${c} >= ${K}`,()=>J.assign(H,!0).break());else if(J.if(O4._`${c} > ${W}`,()=>J.assign(H,!1).break()),K===1)J.assign(H,!0);else J.if(O4._`${c} >= ${K}`,()=>J.assign(H,!0))}}};Re.default=pf1});var ke=U((Te)=>{Object.defineProperty(Te,"__esModule",{value:!0});Te.validateSchemaDeps=Te.validatePropertyDeps=Te.error=void 0;var EN=o0(),gf1=V1(),jz=R4();Te.error={message:({params:{property:Z,depsCount:J,deps:X}})=>{let $=J===1?"property":"properties";return EN.str`must have ${$} ${X} when property ${Z} is present`},params:({params:{property:Z,depsCount:J,deps:X,missingProperty:$}})=>EN._`{property: ${Z},
26
26
  missingProperty: ${$},
27
27
  depsCount: ${J},
28
- deps: ${X}}`};var df1={keyword:"dependencies",type:"object",schemaType:"object",error:Te.error,code(Z){let[J,X]=af1(Z);Ne(Z,J),Pe(Z,X)}};function af1({schema:Z}){let J={},X={};for(let $ in Z){if($==="__proto__")continue;let Y=Array.isArray(Z[$])?J:X;Y[$]=Z[$]}return[J,X]}function Ne(Z,J=Z.schema){let{gen:X,data:$,it:Y}=Z;if(Object.keys(J).length===0)return;let Q=X.let("missing");for(let K in J){let W=J[K];if(W.length===0)continue;let G=(0,jz.propertyInData)(X,$,K,Y.opts.ownProperties);if(Z.setParams({property:K,depsCount:W.length,deps:W.join(", ")}),Y.allErrors)X.if(G,()=>{for(let z of W)(0,jz.checkReportMissingProp)(Z,z)});else X.if(EN._`${G} && (${(0,jz.checkMissingProp)(Z,W,Q)})`),(0,jz.reportMissingProp)(Z,Q),X.else()}}Te.validatePropertyDeps=Ne;function Pe(Z,J=Z.schema){let{gen:X,data:$,keyword:Y,it:Q}=Z,K=X.name("valid");for(let W in J){if((0,gf1.alwaysValidSchema)(Q,J[W]))continue;X.if((0,jz.propertyInData)(X,$,W,Q.opts.ownProperties),()=>{let G=Z.subschema({keyword:Y,schemaProp:W},K);Z.mergeValidEvaluated(G,K)},()=>X.var(K,!0)),Z.ok(K)}}Te.validateSchemaDeps=Pe;Te.default=df1});var _e=U((Ie)=>{Object.defineProperty(Ie,"__esModule",{value:!0});var Ee=o0(),of1=V1(),rf1={message:"property name must be valid",params:({params:Z})=>Ee._`{propertyName: ${Z.propertyName}}`},tf1={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:rf1,code(Z){let{gen:J,schema:X,data:$,it:Y}=Z;if((0,of1.alwaysValidSchema)(Y,X))return;let Q=J.name("valid");J.forIn("key",$,(K)=>{Z.setParams({propertyName:K}),Z.subschema({keyword:"propertyNames",data:K,dataTypes:["string"],propertyName:K,compositeRule:!0},Q),J.if((0,Ee.not)(Q),()=>{if(Z.error(!0),!Y.allErrors)J.break()})}),Z.ok(Q)}};Ie.default=tf1});var IN=U((be)=>{Object.defineProperty(be,"__esModule",{value:!0});var Dw=R4(),M9=o0(),Zk1=TZ(),Mw=V1(),Jk1={message:"must NOT have additional properties",params:({params:Z})=>M9._`{additionalProperty: ${Z.additionalProperty}}`},Xk1={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:Jk1,code(Z){let{gen:J,schema:X,parentSchema:$,data:Y,errsCount:Q,it:K}=Z;if(!Q)throw new Error("ajv implementation error");let{allErrors:W,opts:G}=K;if(K.props=!0,G.removeAdditional!=="all"&&(0,Mw.alwaysValidSchema)(K,X))return;let z=(0,Dw.allSchemaProperties)($.properties),V=(0,Dw.allSchemaProperties)($.patternProperties);H(),Z.ok(M9._`${Q} === ${Zk1.default.errors}`);function H(){J.forIn("key",Y,(w)=>{if(!z.length&&!V.length)F(w);else J.if(v(w),()=>F(w))})}function v(w){let x;if(z.length>8){let j=(0,Mw.schemaRefOrVal)(K,$.properties,"properties");x=(0,Dw.isOwnProperty)(J,j,w)}else if(z.length)x=(0,M9.or)(...z.map((j)=>M9._`${w} === ${j}`));else x=M9.nil;if(V.length)x=(0,M9.or)(x,...V.map((j)=>M9._`${(0,Dw.usePattern)(Z,j)}.test(${w})`));return(0,M9.not)(x)}function q(w){J.code(M9._`delete ${Y}[${w}]`)}function F(w){if(G.removeAdditional==="all"||G.removeAdditional&&X===!1){q(w);return}if(X===!1){if(Z.setParams({additionalProperty:w}),Z.error(),!W)J.break();return}if(typeof X=="object"&&!(0,Mw.alwaysValidSchema)(K,X)){let x=J.name("valid");if(G.removeAdditional==="failing")c(w,x,!1),J.if((0,M9.not)(x),()=>{Z.reset(),q(w)});else if(c(w,x),!W)J.if((0,M9.not)(x),()=>J.break())}}function c(w,x,j){let B={keyword:"additionalProperties",dataProp:w,dataPropType:Mw.Type.Str};if(j===!1)Object.assign(B,{compositeRule:!0,createErrors:!1,allErrors:!1});Z.subschema(B,x)}}};be.default=Xk1});var me=U((Ae)=>{Object.defineProperty(Ae,"__esModule",{value:!0});var Yk1=Wz(),he=R4(),_N=V1(),Se=IN(),Qk1={keyword:"properties",type:"object",schemaType:"object",code(Z){let{gen:J,schema:X,parentSchema:$,data:Y,it:Q}=Z;if(Q.opts.removeAdditional==="all"&&$.additionalProperties===void 0)Se.default.code(new Yk1.KeywordCxt(Q,Se.default,"additionalProperties"));let K=(0,he.allSchemaProperties)(X);for(let H of K)Q.definedProperties.add(H);if(Q.opts.unevaluated&&K.length&&Q.props!==!0)Q.props=_N.mergeEvaluated.props(J,(0,_N.toHash)(K),Q.props);let W=K.filter((H)=>!(0,_N.alwaysValidSchema)(Q,X[H]));if(W.length===0)return;let G=J.name("valid");for(let H of W){if(z(H))V(H);else{if(J.if((0,he.propertyInData)(J,Y,H,Q.opts.ownProperties)),V(H),!Q.allErrors)J.else().var(G,!0);J.endIf()}Z.it.definedProperties.add(H),Z.ok(G)}function z(H){return Q.opts.useDefaults&&!Q.compositeRule&&X[H].default!==void 0}function V(H){Z.subschema({keyword:"properties",schemaProp:H,dataProp:H},G)}}};Ae.default=Qk1});var ie=U((pe)=>{Object.defineProperty(pe,"__esModule",{value:!0});var ue=R4(),Rw=o0(),le=V1(),ye=V1(),Wk1={keyword:"patternProperties",type:"object",schemaType:"object",code(Z){let{gen:J,schema:X,data:$,parentSchema:Y,it:Q}=Z,{opts:K}=Q,W=(0,ue.allSchemaProperties)(X),G=W.filter((c)=>(0,le.alwaysValidSchema)(Q,X[c]));if(W.length===0||G.length===W.length&&(!Q.opts.unevaluated||Q.props===!0))return;let z=K.strictSchema&&!K.allowMatchingProperties&&Y.properties,V=J.name("valid");if(Q.props!==!0&&!(Q.props instanceof Rw.Name))Q.props=(0,ye.evaluatedPropsToName)(J,Q.props);let{props:H}=Q;v();function v(){for(let c of W){if(z)q(c);if(Q.allErrors)F(c);else J.var(V,!0),F(c),J.if(V)}}function q(c){for(let w in z)if(new RegExp(c).test(w))(0,le.checkStrictMode)(Q,`property ${w} matches pattern ${c} (use allowMatchingProperties)`)}function F(c){J.forIn("key",$,(w)=>{J.if(Rw._`${(0,ue.usePattern)(Z,c)}.test(${w})`,()=>{let x=G.includes(c);if(!x)Z.subschema({keyword:"patternProperties",schemaProp:c,dataProp:w,dataPropType:ye.Type.Str},V);if(Q.opts.unevaluated&&H!==!0)J.assign(Rw._`${H}[${w}]`,!0);else if(!x&&!Q.allErrors)J.if((0,Rw.not)(V),()=>J.break())})})}}};pe.default=Wk1});var de=U((ge)=>{Object.defineProperty(ge,"__esModule",{value:!0});var zk1=V1(),Vk1={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(Z){let{gen:J,schema:X,it:$}=Z;if((0,zk1.alwaysValidSchema)($,X)){Z.fail();return}let Y=J.name("valid");Z.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},Y),Z.failResult(Y,()=>Z.reset(),()=>Z.error())},error:{message:"must NOT be valid"}};ge.default=Vk1});var ne=U((ae)=>{Object.defineProperty(ae,"__esModule",{value:!0});var Hk1=R4(),qk1={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:Hk1.validateUnion,error:{message:"must match a schema in anyOf"}};ae.default=qk1});var oe=U((se)=>{Object.defineProperty(se,"__esModule",{value:!0});var Ow=o0(),ck1=V1(),wk1={message:"must match exactly one schema in oneOf",params:({params:Z})=>Ow._`{passingSchemas: ${Z.passing}}`},xk1={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:wk1,code(Z){let{gen:J,schema:X,parentSchema:$,it:Y}=Z;if(!Array.isArray(X))throw new Error("ajv implementation error");if(Y.opts.discriminator&&$.discriminator)return;let Q=X,K=J.let("valid",!1),W=J.let("passing",null),G=J.name("_valid");Z.setParams({passing:W}),J.block(z),Z.result(K,()=>Z.reset(),()=>Z.error(!0));function z(){Q.forEach((V,H)=>{let v;if((0,ck1.alwaysValidSchema)(Y,V))J.var(G,!0);else v=Z.subschema({keyword:"oneOf",schemaProp:H,compositeRule:!0},G);if(H>0)J.if(Ow._`${G} && ${K}`).assign(K,!1).assign(W,Ow._`[${W}, ${H}]`).else();J.if(G,()=>{if(J.assign(K,!0),J.assign(W,H),v)Z.mergeEvaluated(v,Ow.Name)})})}}};se.default=xk1});var te=U((re)=>{Object.defineProperty(re,"__esModule",{value:!0});var jk1=V1(),Bk1={keyword:"allOf",schemaType:"array",code(Z){let{gen:J,schema:X,it:$}=Z;if(!Array.isArray(X))throw new Error("ajv implementation error");let Y=J.name("valid");X.forEach((Q,K)=>{if((0,jk1.alwaysValidSchema)($,Q))return;let W=Z.subschema({keyword:"allOf",schemaProp:K},Y);Z.ok(Y),Z.mergeEvaluated(W)})}};re.default=Bk1});var X00=U((J00)=>{Object.defineProperty(J00,"__esModule",{value:!0});var Nw=o0(),Z00=V1(),Dk1={message:({params:Z})=>Nw.str`must match "${Z.ifClause}" schema`,params:({params:Z})=>Nw._`{failingKeyword: ${Z.ifClause}}`},Mk1={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:Dk1,code(Z){let{gen:J,parentSchema:X,it:$}=Z;if(X.then===void 0&&X.else===void 0)(0,Z00.checkStrictMode)($,'"if" without "then" and "else" is ignored');let Y=ee($,"then"),Q=ee($,"else");if(!Y&&!Q)return;let K=J.let("valid",!0),W=J.name("_valid");if(G(),Z.reset(),Y&&Q){let V=J.let("ifClause");Z.setParams({ifClause:V}),J.if(W,z("then",V),z("else",V))}else if(Y)J.if(W,z("then"));else J.if((0,Nw.not)(W),z("else"));Z.pass(K,()=>Z.error(!0));function G(){let V=Z.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},W);Z.mergeEvaluated(V)}function z(V,H){return()=>{let v=Z.subschema({keyword:V},W);if(J.assign(K,W),Z.mergeValidEvaluated(v,K),H)J.assign(H,Nw._`${V}`);else Z.setParams({ifClause:V})}}}};function ee(Z,J){let X=Z.schema[J];return X!==void 0&&!(0,Z00.alwaysValidSchema)(Z,X)}J00.default=Mk1});var Y00=U(($00)=>{Object.defineProperty($00,"__esModule",{value:!0});var Ok1=V1(),Nk1={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:Z,parentSchema:J,it:X}){if(J.if===void 0)(0,Ok1.checkStrictMode)(X,`"${Z}" without "if" is ignored`)}};$00.default=Nk1});var K00=U((Q00)=>{Object.defineProperty(Q00,"__esModule",{value:!0});var Tk1=fN(),Ck1=Be(),fk1=kN(),kk1=Me(),Ek1=Oe(),Ik1=ke(),_k1=_e(),bk1=IN(),hk1=me(),Sk1=ie(),Ak1=de(),mk1=ne(),uk1=oe(),lk1=te(),yk1=X00(),pk1=Y00();function ik1(Z=!1){let J=[Ak1.default,mk1.default,uk1.default,lk1.default,yk1.default,pk1.default,_k1.default,bk1.default,Ik1.default,hk1.default,Sk1.default];if(Z)J.push(Ck1.default,kk1.default);else J.push(Tk1.default,fk1.default);return J.push(Ek1.default),J}Q00.default=ik1});var G00=U((W00)=>{Object.defineProperty(W00,"__esModule",{value:!0});var j8=o0(),dk1={message:({schemaCode:Z})=>j8.str`must match format "${Z}"`,params:({schemaCode:Z})=>j8._`{format: ${Z}}`},ak1={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:dk1,code(Z,J){let{gen:X,data:$,$data:Y,schema:Q,schemaCode:K,it:W}=Z,{opts:G,errSchemaPath:z,schemaEnv:V,self:H}=W;if(!G.validateFormats)return;if(Y)v();else q();function v(){let F=X.scopeValue("formats",{ref:H.formats,code:G.code.formats}),c=X.const("fDef",j8._`${F}[${K}]`),w=X.let("fType"),x=X.let("format");X.if(j8._`typeof ${c} == "object" && !(${c} instanceof RegExp)`,()=>X.assign(w,j8._`${c}.type || "string"`).assign(x,j8._`${c}.validate`),()=>X.assign(w,j8._`"string"`).assign(x,c)),Z.fail$data((0,j8.or)(j(),B()));function j(){if(G.strictSchema===!1)return j8.nil;return j8._`${K} && !${x}`}function B(){let L=V.$async?j8._`(${c}.async ? await ${x}(${$}) : ${x}(${$}))`:j8._`${x}(${$})`,R=j8._`(typeof ${x} == "function" ? ${L} : ${x}.test(${$}))`;return j8._`${x} && ${x} !== true && ${w} === ${J} && !${R}`}}function q(){let F=H.formats[Q];if(!F){j();return}if(F===!0)return;let[c,w,x]=B(F);if(c===J)Z.pass(L());function j(){if(G.strictSchema===!1){H.logger.warn(R());return}throw new Error(R());function R(){return`unknown format "${Q}" ignored in schema at path "${z}"`}}function B(R){let M=R instanceof RegExp?(0,j8.regexpCode)(R):G.code.formats?j8._`${G.code.formats}${(0,j8.getProperty)(Q)}`:void 0,O=X.scopeValue("formats",{key:Q,ref:R,code:M});if(typeof R=="object"&&!(R instanceof RegExp))return[R.type||"string",R.validate,j8._`${O}.validate`];return["string",R,O]}function L(){if(typeof F=="object"&&!(F instanceof RegExp)&&F.async){if(!V.$async)throw new Error("async format in sync schema");return j8._`await ${x}(${$})`}return typeof w=="function"?j8._`${x}(${$})`:j8._`${x}.test(${$})`}}}};W00.default=ak1});var V00=U((z00)=>{Object.defineProperty(z00,"__esModule",{value:!0});var sk1=G00(),ok1=[sk1.default];z00.default=ok1});var q00=U((v00)=>{Object.defineProperty(v00,"__esModule",{value:!0});v00.contentVocabulary=v00.metadataVocabulary=void 0;v00.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];v00.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var w00=U((c00)=>{Object.defineProperty(c00,"__esModule",{value:!0});var ek1=At(),ZE1=ve(),JE1=K00(),XE1=V00(),F00=q00(),$E1=[ek1.default,ZE1.default,(0,JE1.default)(),XE1.default,F00.metadataVocabulary,F00.contentVocabulary];c00.default=$E1});var B00=U((U00)=>{Object.defineProperty(U00,"__esModule",{value:!0});U00.DiscrError=void 0;var x00;(function(Z){Z.Tag="tag",Z.Mapping="mapping"})(x00||(U00.DiscrError=x00={}))});var M00=U((D00)=>{Object.defineProperty(D00,"__esModule",{value:!0});var _3=o0(),bN=B00(),L00=Gw(),QE1=Gz(),KE1=V1(),WE1={message:({params:{discrError:Z,tagName:J}})=>Z===bN.DiscrError.Tag?`tag "${J}" must be string`:`value of tag "${J}" must be in oneOf`,params:({params:{discrError:Z,tag:J,tagName:X}})=>_3._`{error: ${Z}, tag: ${X}, tagValue: ${J}}`},GE1={keyword:"discriminator",type:"object",schemaType:"object",error:WE1,code(Z){let{gen:J,data:X,schema:$,parentSchema:Y,it:Q}=Z,{oneOf:K}=Y;if(!Q.opts.discriminator)throw new Error("discriminator: requires discriminator option");let W=$.propertyName;if(typeof W!="string")throw new Error("discriminator: requires propertyName");if($.mapping)throw new Error("discriminator: mapping is not supported");if(!K)throw new Error("discriminator: requires oneOf keyword");let G=J.let("valid",!1),z=J.const("tag",_3._`${X}${(0,_3.getProperty)(W)}`);J.if(_3._`typeof ${z} == "string"`,()=>V(),()=>Z.error(!1,{discrError:bN.DiscrError.Tag,tag:z,tagName:W})),Z.ok(G);function V(){let q=v();J.if(!1);for(let F in q)J.elseIf(_3._`${z} === ${F}`),J.assign(G,H(q[F]));J.else(),Z.error(!1,{discrError:bN.DiscrError.Mapping,tag:z,tagName:W}),J.endIf()}function H(q){let F=J.name("valid"),c=Z.subschema({keyword:"oneOf",schemaProp:q},F);return Z.mergeEvaluated(c,_3.Name),F}function v(){var q;let F={},c=x(Y),w=!0;for(let L=0;L<K.length;L++){let R=K[L];if((R===null||R===void 0?void 0:R.$ref)&&!(0,KE1.schemaHasRulesButRef)(R,Q.self.RULES)){let O=R.$ref;if(R=L00.resolveRef.call(Q.self,Q.schemaEnv.root,Q.baseId,O),R instanceof L00.SchemaEnv)R=R.schema;if(R===void 0)throw new QE1.default(Q.opts.uriResolver,Q.baseId,O)}let M=(q=R===null||R===void 0?void 0:R.properties)===null||q===void 0?void 0:q[W];if(typeof M!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${W}"`);w=w&&(c||x(R)),j(M,L)}if(!w)throw new Error(`discriminator: "${W}" must be required`);return F;function x({required:L}){return Array.isArray(L)&&L.includes(W)}function j(L,R){if(L.const)B(L.const,R);else if(L.enum)for(let M of L.enum)B(M,R);else throw new Error(`discriminator: "properties/${W}" must have "const" or "enum"`)}function B(L,R){if(typeof L!="string"||L in F)throw new Error(`discriminator: "${W}" values must be unique strings`);F[L]=R}}}};D00.default=GE1});var R00=U((PC6,VE1)=>{VE1.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}});var N00=U((x5,hN)=>{Object.defineProperty(x5,"__esModule",{value:!0});x5.MissingRefError=x5.ValidationError=x5.CodeGen=x5.Name=x5.nil=x5.stringify=x5.str=x5._=x5.KeywordCxt=x5.Ajv=void 0;var vE1=Tt(),HE1=w00(),qE1=M00(),O00=R00(),FE1=["/properties"],Pw="http://json-schema.org/draft-07/schema";class Bz extends vE1.default{_addVocabularies(){if(super._addVocabularies(),HE1.default.forEach((Z)=>this.addVocabulary(Z)),this.opts.discriminator)this.addKeyword(qE1.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let Z=this.opts.$data?this.$dataMetaSchema(O00,FE1):O00;this.addMetaSchema(Z,Pw,!1),this.refs["http://json-schema.org/schema"]=Pw}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Pw)?Pw:void 0)}}x5.Ajv=Bz;hN.exports=x5=Bz;hN.exports.Ajv=Bz;Object.defineProperty(x5,"__esModule",{value:!0});x5.default=Bz;var cE1=Wz();Object.defineProperty(x5,"KeywordCxt",{enumerable:!0,get:function(){return cE1.KeywordCxt}});var b3=o0();Object.defineProperty(x5,"_",{enumerable:!0,get:function(){return b3._}});Object.defineProperty(x5,"str",{enumerable:!0,get:function(){return b3.str}});Object.defineProperty(x5,"stringify",{enumerable:!0,get:function(){return b3.stringify}});Object.defineProperty(x5,"nil",{enumerable:!0,get:function(){return b3.nil}});Object.defineProperty(x5,"Name",{enumerable:!0,get:function(){return b3.Name}});Object.defineProperty(x5,"CodeGen",{enumerable:!0,get:function(){return b3.CodeGen}});var wE1=Kw();Object.defineProperty(x5,"ValidationError",{enumerable:!0,get:function(){return wE1.default}});var xE1=Gz();Object.defineProperty(x5,"MissingRefError",{enumerable:!0,get:function(){return xE1.default}})});var J10=U((Z10)=>{Object.defineProperty(Z10,"__esModule",{value:!0});Z10.fromEnv=_E1;var e00="HYTOPIA_API_KEY";function IE1(Z){let J=process.env[e00];if(!J)throw new Error(`Missing environment variable ${Z}`);return J}function _E1(){return{apiKey:IE1(e00)}}});var X10=U((DP)=>{Object.defineProperty(DP,"__esModule",{value:!0});DP.fromEnv=void 0;var hE1=J10();Object.defineProperty(DP,"fromEnv",{enumerable:!0,get:function(){return hE1.fromEnv}})});var Y10=U((h3)=>{var MP=h3&&h3.__importDefault||function(Z){return Z&&Z.__esModule?Z:{default:Z}};Object.defineProperty(h3,"__esModule",{value:!0});h3.LocalBackend=void 0;var RP=MP(i("fs")),AE1=MP(i("path")),OP=MP(i("util")),mE1=OP.default.promisify(RP.default.mkdir),uE1=OP.default.promisify(RP.default.readFile),lE1=OP.default.promisify(RP.default.writeFile);class $10{dataDir;constructor(Z){this.dataDir=Z}calculatePath(Z,J){return`${this.dataDir}/${Z}/${J}.json`}async load(Z,J){try{let X=await uE1(this.calculatePath(Z,J),"utf8");return JSON.parse(X)}catch(X){return{__version:1}}}async upload(Z,J){await mE1(AE1.default.join(this.dataDir,Z),{recursive:!0});var X=[];for(var[$,Y]of Object.entries(J))X.push(lE1(this.calculatePath(Z,$),JSON.stringify(Y)));await Promise.all(X)}}h3.LocalBackend=$10});var NP=U((K10)=>{Object.defineProperty(K10,"__esModule",{value:!0});K10.proxifyObject=Q10;function Q10(Z,J){for(let[X,$]of Object.entries(Z))if($ instanceof Object)Z[X]=Q10($,J);return new Proxy(Z,J)}});var z10=U((G10)=>{Object.defineProperty(G10,"__esModule",{value:!0});G10.load=pE1;var W10=NP();async function pE1(Z){let J=await this.backend.load(this.gameId,Z),X=this.saveStatesManager,$={set(Q,K,W){if(typeof W==="function")return!1;if(W instanceof Object)Q[K]=(0,W10.proxifyObject)(W,$);else Q[K]=W;if(K!=="__version")X.incrementVersion(Z);return!0},deleteProperty(Q,K){if(K in Q)delete Q[K];return X.incrementVersion(Z),!0}},Y=(0,W10.proxifyObject)(J,$);return X.setReference(Z,Y),Y}});var F10=U((H10)=>{Object.defineProperty(H10,"__esModule",{value:!0});H10.SaveStatesManager=void 0;var V10=NP();class v10{_stateReferences={};_pendingSaveQueue={};_hasQueuedSaves=!1;setReference(Z,J){this._stateReferences[Z]=J}getReference(Z){return this._stateReferences[Z]??null}dropReference(Z){if(!this._stateReferences)return;delete this._stateReferences[Z]}incrementVersion(Z){if(!this._stateReferences[Z])return;this._hasQueuedSaves=!0;let J=this._stateReferences[Z];J.__version+=1,this._pendingSaveQueue[Z]=J}getPendingSaves(){if(!this._hasQueuedSaves)return null;let Z=JSON.parse(JSON.stringify(this._pendingSaveQueue));return this._pendingSaveQueue={},this._hasQueuedSaves=!1,Z}load(Z,J){let X=this.getReference(Z);if(X)return{value:X.value};let $=this,Y={set(K,W,G){if(typeof G==="function")return!1;if(G instanceof Object)K[W]=(0,V10.proxifyObject)(G,Y);else K[W]=G;if(W!=="__version")$.incrementVersion(Z);return!0},deleteProperty(K,W){if(W in K)delete K[W];return $.incrementVersion(Z),!0}},Q=(0,V10.proxifyObject)(J.value,Y);return $.setReference(Z,Q),{error:void 0,value:Q}}}H10.SaveStatesManager=v10});var w10=U((c10)=>{Object.defineProperty(c10,"__esModule",{value:!0});c10.flush=gE1;async function gE1(){let Z=this.saveStatesManager.getPendingSaves();if(!Z)return;await this.backend.upload(this.gameId,Z)}});var B10=U((U10)=>{Object.defineProperty(U10,"__esModule",{value:!0});U10.RemoteBackend=void 0;class x10{baseUrl;credentials;constructor(Z,J,X){this.baseUrl=Z,this.credentials=J}async load(Z,J){while(!0){try{let X=await fetch(`${this.baseUrl}/play/kv/get/${Z}/${J}`,{headers:{"X-Api-Key":this.credentials.apiKey}}),$=await X.json();if(X.ok){if(!$.value.__version)$.value.__version=1;return $.value}if($&&$.error){if($.error.code==="keyNotFound")return{__version:1};console.warn(`[SaveStates] Got an error loading remote state for key ${J}: ${$.error.code}, retrying in 1s...`),await new Promise((Y)=>setTimeout(Y,1000));continue}throw new Error("Unexpected error body")}catch(X){console.warn(`[SaveStates] Could not load remote state for key ${J} due to a connection issue, retrying in 1s...`)}await new Promise((X)=>setTimeout(X,1000))}}async upload(Z,J){while(!0){try{let X=await fetch(`${this.baseUrl}/play/kv/setbulk/${Z}`,{method:"POST",headers:{"Content-Type":"application/json","X-Api-Key":this.credentials.apiKey},body:JSON.stringify(J)}),$=await X.json();if(X.ok)return;if($&&$.error){console.warn(`[SaveStates] Could not upload state to remote due to an error (code '${$.error.code}'), retrying in 1s...`),await new Promise((Y)=>setTimeout(Y,1000));continue}throw new Error("Unexpected error body")}catch(X){console.warn("[SaveStates] Could not upload state to remote due to a connection issue, retrying in 1s...")}await new Promise((X)=>setTimeout(X,1000))}}}U10.RemoteBackend=x10});var D10=U((L10)=>{Object.defineProperty(L10,"__esModule",{value:!0});L10.unload=aE1;async function aE1(Z){this.saveStatesManager.dropReference(Z),await this.flush()}});var N10=U((R10)=>{Object.defineProperty(R10,"__esModule",{value:!0});R10.SaveStatesClient=void 0;var sE1=X10(),oE1=Y10(),rE1=z10(),tE1=F10(),eE1=w10(),ZI1=B10(),JI1=D10();function XI1(Z){if(Z)return Z;try{let J=(0,sE1.fromEnv)(),X=process.env.HYTOPIA_PERSUADE_CREATIVE_GATEWAY_BASE_URL??"https://prod.persuade-creative.hytopia.com",$=process.env.HYTOPIA_GAME_ID;if(!$)throw new Error("Missing HYTOPIA_GAME_ID environment variable");return new ZI1.RemoteBackend(X,J,$)}catch{return console.warn("[SaveStates] Couldn't load credentials from environment variables, defaulting to local backend"),new oE1.LocalBackend("dev")}}class M10{backend;gameId;saveStatesManager;constructor(Z){this.backend=XI1(Z?.backend),this.gameId=Z?.gameId??process.env.HYTOPIA_GAME_ID??"persistence",this.saveStatesManager=new tE1.SaveStatesManager;async function J(X){while(!0)await X.flush(),await new Promise(($)=>{setTimeout($,1000).unref()})}J(this)}load=rE1.load;unload=JI1.unload;flush=eE1.flush}R10.SaveStatesClient=M10});var EZ=U((X_6,C10)=>{var P10=["nodebuffer","arraybuffer","fragments"],T10=typeof Blob!=="undefined";if(T10)P10.push("blob");C10.exports={BINARY_TYPES:P10,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:T10,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}});var Mz=U(($_6,Ew)=>{var{EMPTY_BUFFER:$I1}=EZ(),PP=Buffer[Symbol.species];function YI1(Z,J){if(Z.length===0)return $I1;if(Z.length===1)return Z[0];let X=Buffer.allocUnsafe(J),$=0;for(let Y=0;Y<Z.length;Y++){let Q=Z[Y];X.set(Q,$),$+=Q.length}if($<J)return new PP(X.buffer,X.byteOffset,$);return X}function f10(Z,J,X,$,Y){for(let Q=0;Q<Y;Q++)X[$+Q]=Z[Q]^J[Q&3]}function k10(Z,J){for(let X=0;X<Z.length;X++)Z[X]^=J[X&3]}function QI1(Z){if(Z.length===Z.buffer.byteLength)return Z.buffer;return Z.buffer.slice(Z.byteOffset,Z.byteOffset+Z.length)}function TP(Z){if(TP.readOnly=!0,Buffer.isBuffer(Z))return Z;let J;if(Z instanceof ArrayBuffer)J=new PP(Z);else if(ArrayBuffer.isView(Z))J=new PP(Z.buffer,Z.byteOffset,Z.byteLength);else J=Buffer.from(Z),TP.readOnly=!1;return J}Ew.exports={concat:YI1,mask:f10,toArrayBuffer:QI1,toBuffer:TP,unmask:k10};if(!process.env.WS_NO_BUFFER_UTIL)try{let Z=(()=>{throw new Error("Cannot require module "+"bufferutil");})();Ew.exports.mask=function(J,X,$,Y,Q){if(Q<48)f10(J,X,$,Y,Q);else Z.mask(J,X,$,Y,Q)},Ew.exports.unmask=function(J,X){if(J.length<32)k10(J,X);else Z.unmask(J,X)}}catch(Z){}});var b10=U((Y_6,_10)=>{var E10=Symbol("kDone"),CP=Symbol("kRun");class I10{constructor(Z){this[E10]=()=>{this.pending--,this[CP]()},this.concurrency=Z||1/0,this.jobs=[],this.pending=0}add(Z){this.jobs.push(Z),this[CP]()}[CP](){if(this.pending===this.concurrency)return;if(this.jobs.length){let Z=this.jobs.shift();this.pending++,Z(this[E10])}}}_10.exports=I10});var Oz=U((Q_6,u10)=>{var Rz=i("zlib"),h10=Mz(),KI1=b10(),{kStatusCode:S10}=EZ(),WI1=Buffer[Symbol.species],GI1=Buffer.from([0,0,255,255]),_w=Symbol("permessage-deflate"),IZ=Symbol("total-length"),S3=Symbol("callback"),ZX=Symbol("buffers"),A3=Symbol("error"),Iw;class A10{constructor(Z,J,X){if(this._maxPayload=X|0,this._options=Z||{},this._threshold=this._options.threshold!==void 0?this._options.threshold:1024,this._isServer=!!J,this._deflate=null,this._inflate=null,this.params=null,!Iw){let $=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;Iw=new KI1($)}}static get extensionName(){return"permessage-deflate"}offer(){let Z={};if(this._options.serverNoContextTakeover)Z.server_no_context_takeover=!0;if(this._options.clientNoContextTakeover)Z.client_no_context_takeover=!0;if(this._options.serverMaxWindowBits)Z.server_max_window_bits=this._options.serverMaxWindowBits;if(this._options.clientMaxWindowBits)Z.client_max_window_bits=this._options.clientMaxWindowBits;else if(this._options.clientMaxWindowBits==null)Z.client_max_window_bits=!0;return Z}accept(Z){return Z=this.normalizeParams(Z),this.params=this._isServer?this.acceptAsServer(Z):this.acceptAsClient(Z),this.params}cleanup(){if(this._inflate)this._inflate.close(),this._inflate=null;if(this._deflate){let Z=this._deflate[S3];if(this._deflate.close(),this._deflate=null,Z)Z(new Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(Z){let J=this._options,X=Z.find(($)=>{if(J.serverNoContextTakeover===!1&&$.server_no_context_takeover||$.server_max_window_bits&&(J.serverMaxWindowBits===!1||typeof J.serverMaxWindowBits==="number"&&J.serverMaxWindowBits>$.server_max_window_bits)||typeof J.clientMaxWindowBits==="number"&&!$.client_max_window_bits)return!1;return!0});if(!X)throw new Error("None of the extension offers can be accepted");if(J.serverNoContextTakeover)X.server_no_context_takeover=!0;if(J.clientNoContextTakeover)X.client_no_context_takeover=!0;if(typeof J.serverMaxWindowBits==="number")X.server_max_window_bits=J.serverMaxWindowBits;if(typeof J.clientMaxWindowBits==="number")X.client_max_window_bits=J.clientMaxWindowBits;else if(X.client_max_window_bits===!0||J.clientMaxWindowBits===!1)delete X.client_max_window_bits;return X}acceptAsClient(Z){let J=Z[0];if(this._options.clientNoContextTakeover===!1&&J.client_no_context_takeover)throw new Error('Unexpected parameter "client_no_context_takeover"');if(!J.client_max_window_bits){if(typeof this._options.clientMaxWindowBits==="number")J.client_max_window_bits=this._options.clientMaxWindowBits}else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits==="number"&&J.client_max_window_bits>this._options.clientMaxWindowBits)throw new Error('Unexpected or invalid parameter "client_max_window_bits"');return J}normalizeParams(Z){return Z.forEach((J)=>{Object.keys(J).forEach((X)=>{let $=J[X];if($.length>1)throw new Error(`Parameter "${X}" must have only a single value`);if($=$[0],X==="client_max_window_bits"){if($!==!0){let Y=+$;if(!Number.isInteger(Y)||Y<8||Y>15)throw new TypeError(`Invalid value for parameter "${X}": ${$}`);$=Y}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${X}": ${$}`)}else if(X==="server_max_window_bits"){let Y=+$;if(!Number.isInteger(Y)||Y<8||Y>15)throw new TypeError(`Invalid value for parameter "${X}": ${$}`);$=Y}else if(X==="client_no_context_takeover"||X==="server_no_context_takeover"){if($!==!0)throw new TypeError(`Invalid value for parameter "${X}": ${$}`)}else throw new Error(`Unknown parameter "${X}"`);J[X]=$})}),Z}decompress(Z,J,X){Iw.add(($)=>{this._decompress(Z,J,(Y,Q)=>{$(),X(Y,Q)})})}compress(Z,J,X){Iw.add(($)=>{this._compress(Z,J,(Y,Q)=>{$(),X(Y,Q)})})}_decompress(Z,J,X){let $=this._isServer?"client":"server";if(!this._inflate){let Y=`${$}_max_window_bits`,Q=typeof this.params[Y]!=="number"?Rz.Z_DEFAULT_WINDOWBITS:this.params[Y];this._inflate=Rz.createInflateRaw({...this._options.zlibInflateOptions,windowBits:Q}),this._inflate[_w]=this,this._inflate[IZ]=0,this._inflate[ZX]=[],this._inflate.on("error",VI1),this._inflate.on("data",m10)}if(this._inflate[S3]=X,this._inflate.write(Z),J)this._inflate.write(GI1);this._inflate.flush(()=>{let Y=this._inflate[A3];if(Y){this._inflate.close(),this._inflate=null,X(Y);return}let Q=h10.concat(this._inflate[ZX],this._inflate[IZ]);if(this._inflate._readableState.endEmitted)this._inflate.close(),this._inflate=null;else if(this._inflate[IZ]=0,this._inflate[ZX]=[],J&&this.params[`${$}_no_context_takeover`])this._inflate.reset();X(null,Q)})}_compress(Z,J,X){let $=this._isServer?"server":"client";if(!this._deflate){let Y=`${$}_max_window_bits`,Q=typeof this.params[Y]!=="number"?Rz.Z_DEFAULT_WINDOWBITS:this.params[Y];this._deflate=Rz.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:Q}),this._deflate[IZ]=0,this._deflate[ZX]=[],this._deflate.on("data",zI1)}this._deflate[S3]=X,this._deflate.write(Z),this._deflate.flush(Rz.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let Y=h10.concat(this._deflate[ZX],this._deflate[IZ]);if(J)Y=new WI1(Y.buffer,Y.byteOffset,Y.length-4);if(this._deflate[S3]=null,this._deflate[IZ]=0,this._deflate[ZX]=[],J&&this.params[`${$}_no_context_takeover`])this._deflate.reset();X(null,Y)})}}u10.exports=A10;function zI1(Z){this[ZX].push(Z),this[IZ]+=Z.length}function m10(Z){if(this[IZ]+=Z.length,this[_w]._maxPayload<1||this[IZ]<=this[_w]._maxPayload){this[ZX].push(Z);return}this[A3]=new RangeError("Max payload size exceeded"),this[A3].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[A3][S10]=1009,this.removeListener("data",m10),this.reset()}function VI1(Z){if(this[_w]._inflate=null,this[A3]){this[S3](this[A3]);return}Z[S10]=1007,this[S3](Z)}});var m3=U((K_6,bw)=>{var{isUtf8:l10}=i("buffer"),{hasBlob:vI1}=EZ(),HI1=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0];function qI1(Z){return Z>=1000&&Z<=1014&&Z!==1004&&Z!==1005&&Z!==1006||Z>=3000&&Z<=4999}function fP(Z){let J=Z.length,X=0;while(X<J)if((Z[X]&128)===0)X++;else if((Z[X]&224)===192){if(X+1===J||(Z[X+1]&192)!==128||(Z[X]&254)===192)return!1;X+=2}else if((Z[X]&240)===224){if(X+2>=J||(Z[X+1]&192)!==128||(Z[X+2]&192)!==128||Z[X]===224&&(Z[X+1]&224)===128||Z[X]===237&&(Z[X+1]&224)===160)return!1;X+=3}else if((Z[X]&248)===240){if(X+3>=J||(Z[X+1]&192)!==128||(Z[X+2]&192)!==128||(Z[X+3]&192)!==128||Z[X]===240&&(Z[X+1]&240)===128||Z[X]===244&&Z[X+1]>143||Z[X]>244)return!1;X+=4}else return!1;return!0}function FI1(Z){return vI1&&typeof Z==="object"&&typeof Z.arrayBuffer==="function"&&typeof Z.type==="string"&&typeof Z.stream==="function"&&(Z[Symbol.toStringTag]==="Blob"||Z[Symbol.toStringTag]==="File")}bw.exports={isBlob:FI1,isValidStatusCode:qI1,isValidUTF8:fP,tokenChars:HI1};if(l10)bw.exports.isValidUTF8=function(Z){return Z.length<24?fP(Z):l10(Z)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let Z=(()=>{throw new Error("Cannot require module "+"utf-8-validate");})();bw.exports.isValidUTF8=function(J){return J.length<32?fP(J):Z(J)}}catch(Z){}});var EP=U((W_6,d10)=>{var{Writable:cI1}=i("stream"),y10=Oz(),{BINARY_TYPES:wI1,EMPTY_BUFFER:p10,kStatusCode:xI1,kWebSocket:UI1}=EZ(),{concat:kP,toArrayBuffer:jI1,unmask:BI1}=Mz(),{isValidStatusCode:LI1,isValidUTF8:i10}=m3(),hw=Buffer[Symbol.species];class g10 extends cI1{constructor(Z={}){super();this._allowSynchronousEvents=Z.allowSynchronousEvents!==void 0?Z.allowSynchronousEvents:!0,this._binaryType=Z.binaryType||wI1[0],this._extensions=Z.extensions||{},this._isServer=!!Z.isServer,this._maxPayload=Z.maxPayload|0,this._skipUTF8Validation=!!Z.skipUTF8Validation,this[UI1]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._errored=!1,this._loop=!1,this._state=0}_write(Z,J,X){if(this._opcode===8&&this._state==0)return X();this._bufferedBytes+=Z.length,this._buffers.push(Z),this.startLoop(X)}consume(Z){if(this._bufferedBytes-=Z,Z===this._buffers[0].length)return this._buffers.shift();if(Z<this._buffers[0].length){let X=this._buffers[0];return this._buffers[0]=new hw(X.buffer,X.byteOffset+Z,X.length-Z),new hw(X.buffer,X.byteOffset,Z)}let J=Buffer.allocUnsafe(Z);do{let X=this._buffers[0],$=J.length-Z;if(Z>=X.length)J.set(this._buffers.shift(),$);else J.set(new Uint8Array(X.buffer,X.byteOffset,Z),$),this._buffers[0]=new hw(X.buffer,X.byteOffset+Z,X.length-Z);Z-=X.length}while(Z>0);return J}startLoop(Z){this._loop=!0;do switch(this._state){case 0:this.getInfo(Z);break;case 1:this.getPayloadLength16(Z);break;case 2:this.getPayloadLength64(Z);break;case 3:this.getMask();break;case 4:this.getData(Z);break;case 5:case 6:this._loop=!1;return}while(this._loop);if(!this._errored)Z()}getInfo(Z){if(this._bufferedBytes<2){this._loop=!1;return}let J=this.consume(2);if((J[0]&48)!==0){let $=this.createError(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");Z($);return}let X=(J[0]&64)===64;if(X&&!this._extensions[y10.extensionName]){let $=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");Z($);return}if(this._fin=(J[0]&128)===128,this._opcode=J[0]&15,this._payloadLength=J[1]&127,this._opcode===0){if(X){let $=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");Z($);return}if(!this._fragmented){let $=this.createError(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");Z($);return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){let $=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");Z($);return}this._compressed=X}else if(this._opcode>7&&this._opcode<11){if(!this._fin){let $=this.createError(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");Z($);return}if(X){let $=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");Z($);return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){let $=this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");Z($);return}}else{let $=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");Z($);return}if(!this._fin&&!this._fragmented)this._fragmented=this._opcode;if(this._masked=(J[1]&128)===128,this._isServer){if(!this._masked){let $=this.createError(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK");Z($);return}}else if(this._masked){let $=this.createError(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");Z($);return}if(this._payloadLength===126)this._state=1;else if(this._payloadLength===127)this._state=2;else this.haveLength(Z)}getPayloadLength16(Z){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(Z)}getPayloadLength64(Z){if(this._bufferedBytes<8){this._loop=!1;return}let J=this.consume(8),X=J.readUInt32BE(0);if(X>Math.pow(2,21)-1){let $=this.createError(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH");Z($);return}this._payloadLength=X*Math.pow(2,32)+J.readUInt32BE(4),this.haveLength(Z)}haveLength(Z){if(this._payloadLength&&this._opcode<8){if(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0){let J=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");Z(J);return}}if(this._masked)this._state=3;else this._state=4}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=4}getData(Z){let J=p10;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}if(J=this.consume(this._payloadLength),this._masked&&(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])!==0)BI1(J,this._mask)}if(this._opcode>7){this.controlMessage(J,Z);return}if(this._compressed){this._state=5,this.decompress(J,Z);return}if(J.length)this._messageLength=this._totalPayloadLength,this._fragments.push(J);this.dataMessage(Z)}decompress(Z,J){this._extensions[y10.extensionName].decompress(Z,this._fin,($,Y)=>{if($)return J($);if(Y.length){if(this._messageLength+=Y.length,this._messageLength>this._maxPayload&&this._maxPayload>0){let Q=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");J(Q);return}this._fragments.push(Y)}if(this.dataMessage(J),this._state===0)this.startLoop(J)})}dataMessage(Z){if(!this._fin){this._state=0;return}let J=this._messageLength,X=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],this._opcode===2){let $;if(this._binaryType==="nodebuffer")$=kP(X,J);else if(this._binaryType==="arraybuffer")$=jI1(kP(X,J));else if(this._binaryType==="blob")$=new Blob(X);else $=X;if(this._allowSynchronousEvents)this.emit("message",$,!0),this._state=0;else this._state=6,setImmediate(()=>{this.emit("message",$,!0),this._state=0,this.startLoop(Z)})}else{let $=kP(X,J);if(!this._skipUTF8Validation&&!i10($)){let Y=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");Z(Y);return}if(this._state===5||this._allowSynchronousEvents)this.emit("message",$,!1),this._state=0;else this._state=6,setImmediate(()=>{this.emit("message",$,!1),this._state=0,this.startLoop(Z)})}}controlMessage(Z,J){if(this._opcode===8){if(Z.length===0)this._loop=!1,this.emit("conclude",1005,p10),this.end();else{let X=Z.readUInt16BE(0);if(!LI1(X)){let Y=this.createError(RangeError,`invalid status code ${X}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");J(Y);return}let $=new hw(Z.buffer,Z.byteOffset+2,Z.length-2);if(!this._skipUTF8Validation&&!i10($)){let Y=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");J(Y);return}this._loop=!1,this.emit("conclude",X,$),this.end()}this._state=0;return}if(this._allowSynchronousEvents)this.emit(this._opcode===9?"ping":"pong",Z),this._state=0;else this._state=6,setImmediate(()=>{this.emit(this._opcode===9?"ping":"pong",Z),this._state=0,this.startLoop(J)})}createError(Z,J,X,$,Y){this._loop=!1,this._errored=!0;let Q=new Z(X?`Invalid WebSocket frame: ${J}`:J);return Error.captureStackTrace(Q,this.createError),Q.code=Y,Q[xI1]=$,Q}}d10.exports=g10});var _P=U((z_6,s10)=>{var{Duplex:G_6}=i("stream"),{randomFillSync:DI1}=i("crypto"),a10=Oz(),{EMPTY_BUFFER:MI1,kWebSocket:RI1,NOOP:OI1}=EZ(),{isBlob:u3,isValidStatusCode:NI1}=m3(),{mask:n10,toBuffer:n$}=Mz(),N4=Symbol("kByteLength"),PI1=Buffer.alloc(4),s$,l3=8192,R9=0,TI1=1,CI1=2;class JX{constructor(Z,J,X){if(this._extensions=J||{},X)this._generateMask=X,this._maskBuffer=Buffer.alloc(4);this._socket=Z,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=R9,this.onerror=OI1,this[RI1]=void 0}static frame(Z,J){let X,$=!1,Y=2,Q=!1;if(J.mask){if(X=J.maskBuffer||PI1,J.generateMask)J.generateMask(X);else{if(l3===8192){if(s$===void 0)s$=Buffer.alloc(8192);DI1(s$,0,8192),l3=0}X[0]=s$[l3++],X[1]=s$[l3++],X[2]=s$[l3++],X[3]=s$[l3++]}Q=(X[0]|X[1]|X[2]|X[3])===0,Y=6}let K;if(typeof Z==="string")if((!J.mask||Q)&&J[N4]!==void 0)K=J[N4];else Z=Buffer.from(Z),K=Z.length;else K=Z.length,$=J.mask&&J.readOnly&&!Q;let W=K;if(K>=65536)Y+=8,W=127;else if(K>125)Y+=2,W=126;let G=Buffer.allocUnsafe($?K+Y:Y);if(G[0]=J.fin?J.opcode|128:J.opcode,J.rsv1)G[0]|=64;if(G[1]=W,W===126)G.writeUInt16BE(K,2);else if(W===127)G[2]=G[3]=0,G.writeUIntBE(K,4,6);if(!J.mask)return[G,Z];if(G[1]|=128,G[Y-4]=X[0],G[Y-3]=X[1],G[Y-2]=X[2],G[Y-1]=X[3],Q)return[G,Z];if($)return n10(Z,X,G,Y,K),[G];return n10(Z,X,Z,0,K),[G,Z]}close(Z,J,X,$){let Y;if(Z===void 0)Y=MI1;else if(typeof Z!=="number"||!NI1(Z))throw new TypeError("First argument must be a valid error code number");else if(J===void 0||!J.length)Y=Buffer.allocUnsafe(2),Y.writeUInt16BE(Z,0);else{let K=Buffer.byteLength(J);if(K>123)throw new RangeError("The message must not be greater than 123 bytes");if(Y=Buffer.allocUnsafe(2+K),Y.writeUInt16BE(Z,0),typeof J==="string")Y.write(J,2);else Y.set(J,2)}let Q={[N4]:Y.length,fin:!0,generateMask:this._generateMask,mask:X,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};if(this._state!==R9)this.enqueue([this.dispatch,Y,!1,Q,$]);else this.sendFrame(JX.frame(Y,Q),$)}ping(Z,J,X){let $,Y;if(typeof Z==="string")$=Buffer.byteLength(Z),Y=!1;else if(u3(Z))$=Z.size,Y=!1;else Z=n$(Z),$=Z.length,Y=n$.readOnly;if($>125)throw new RangeError("The data size must not be greater than 125 bytes");let Q={[N4]:$,fin:!0,generateMask:this._generateMask,mask:J,maskBuffer:this._maskBuffer,opcode:9,readOnly:Y,rsv1:!1};if(u3(Z))if(this._state!==R9)this.enqueue([this.getBlobData,Z,!1,Q,X]);else this.getBlobData(Z,!1,Q,X);else if(this._state!==R9)this.enqueue([this.dispatch,Z,!1,Q,X]);else this.sendFrame(JX.frame(Z,Q),X)}pong(Z,J,X){let $,Y;if(typeof Z==="string")$=Buffer.byteLength(Z),Y=!1;else if(u3(Z))$=Z.size,Y=!1;else Z=n$(Z),$=Z.length,Y=n$.readOnly;if($>125)throw new RangeError("The data size must not be greater than 125 bytes");let Q={[N4]:$,fin:!0,generateMask:this._generateMask,mask:J,maskBuffer:this._maskBuffer,opcode:10,readOnly:Y,rsv1:!1};if(u3(Z))if(this._state!==R9)this.enqueue([this.getBlobData,Z,!1,Q,X]);else this.getBlobData(Z,!1,Q,X);else if(this._state!==R9)this.enqueue([this.dispatch,Z,!1,Q,X]);else this.sendFrame(JX.frame(Z,Q),X)}send(Z,J,X){let $=this._extensions[a10.extensionName],Y=J.binary?2:1,Q=J.compress,K,W;if(typeof Z==="string")K=Buffer.byteLength(Z),W=!1;else if(u3(Z))K=Z.size,W=!1;else Z=n$(Z),K=Z.length,W=n$.readOnly;if(this._firstFragment){if(this._firstFragment=!1,Q&&$&&$.params[$._isServer?"server_no_context_takeover":"client_no_context_takeover"])Q=K>=$._threshold;this._compress=Q}else Q=!1,Y=0;if(J.fin)this._firstFragment=!0;let G={[N4]:K,fin:J.fin,generateMask:this._generateMask,mask:J.mask,maskBuffer:this._maskBuffer,opcode:Y,readOnly:W,rsv1:Q};if(u3(Z))if(this._state!==R9)this.enqueue([this.getBlobData,Z,this._compress,G,X]);else this.getBlobData(Z,this._compress,G,X);else if(this._state!==R9)this.enqueue([this.dispatch,Z,this._compress,G,X]);else this.dispatch(Z,this._compress,G,X)}getBlobData(Z,J,X,$){this._bufferedBytes+=X[N4],this._state=CI1,Z.arrayBuffer().then((Y)=>{if(this._socket.destroyed){let K=new Error("The socket was closed while the blob was being read");process.nextTick(IP,this,K,$);return}this._bufferedBytes-=X[N4];let Q=n$(Y);if(!J)this._state=R9,this.sendFrame(JX.frame(Q,X),$),this.dequeue();else this.dispatch(Q,J,X,$)}).catch((Y)=>{process.nextTick(fI1,this,Y,$)})}dispatch(Z,J,X,$){if(!J){this.sendFrame(JX.frame(Z,X),$);return}let Y=this._extensions[a10.extensionName];this._bufferedBytes+=X[N4],this._state=TI1,Y.compress(Z,X.fin,(Q,K)=>{if(this._socket.destroyed){let W=new Error("The socket was closed while data was being compressed");IP(this,W,$);return}this._bufferedBytes-=X[N4],this._state=R9,X.readOnly=!1,this.sendFrame(JX.frame(K,X),$),this.dequeue()})}dequeue(){while(this._state===R9&&this._queue.length){let Z=this._queue.shift();this._bufferedBytes-=Z[3][N4],Reflect.apply(Z[0],this,Z.slice(1))}}enqueue(Z){this._bufferedBytes+=Z[3][N4],this._queue.push(Z)}sendFrame(Z,J){if(Z.length===2)this._socket.cork(),this._socket.write(Z[0]),this._socket.write(Z[1],J),this._socket.uncork();else this._socket.write(Z[0],J)}}s10.exports=JX;function IP(Z,J,X){if(typeof X==="function")X(J);for(let $=0;$<Z._queue.length;$++){let Y=Z._queue[$],Q=Y[Y.length-1];if(typeof Q==="function")Q(J)}}function fI1(Z,J,X){IP(Z,J,X),Z.onerror(J)}});var Y80=U((V_6,$80)=>{var{kForOnEventAttribute:Nz,kListener:bP}=EZ(),o10=Symbol("kCode"),r10=Symbol("kData"),t10=Symbol("kError"),e10=Symbol("kMessage"),Z80=Symbol("kReason"),y3=Symbol("kTarget"),J80=Symbol("kType"),X80=Symbol("kWasClean");class XX{constructor(Z){this[y3]=null,this[J80]=Z}get target(){return this[y3]}get type(){return this[J80]}}Object.defineProperty(XX.prototype,"target",{enumerable:!0});Object.defineProperty(XX.prototype,"type",{enumerable:!0});class p3 extends XX{constructor(Z,J={}){super(Z);this[o10]=J.code===void 0?0:J.code,this[Z80]=J.reason===void 0?"":J.reason,this[X80]=J.wasClean===void 0?!1:J.wasClean}get code(){return this[o10]}get reason(){return this[Z80]}get wasClean(){return this[X80]}}Object.defineProperty(p3.prototype,"code",{enumerable:!0});Object.defineProperty(p3.prototype,"reason",{enumerable:!0});Object.defineProperty(p3.prototype,"wasClean",{enumerable:!0});class Pz extends XX{constructor(Z,J={}){super(Z);this[t10]=J.error===void 0?null:J.error,this[e10]=J.message===void 0?"":J.message}get error(){return this[t10]}get message(){return this[e10]}}Object.defineProperty(Pz.prototype,"error",{enumerable:!0});Object.defineProperty(Pz.prototype,"message",{enumerable:!0});class Aw extends XX{constructor(Z,J={}){super(Z);this[r10]=J.data===void 0?null:J.data}get data(){return this[r10]}}Object.defineProperty(Aw.prototype,"data",{enumerable:!0});var kI1={addEventListener(Z,J,X={}){for(let Y of this.listeners(Z))if(!X[Nz]&&Y[bP]===J&&!Y[Nz])return;let $;if(Z==="message")$=function Y(Q,K){let W=new Aw("message",{data:K?Q:Q.toString()});W[y3]=this,Sw(J,this,W)};else if(Z==="close")$=function Y(Q,K){let W=new p3("close",{code:Q,reason:K.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});W[y3]=this,Sw(J,this,W)};else if(Z==="error")$=function Y(Q){let K=new Pz("error",{error:Q,message:Q.message});K[y3]=this,Sw(J,this,K)};else if(Z==="open")$=function Y(){let Q=new XX("open");Q[y3]=this,Sw(J,this,Q)};else return;if($[Nz]=!!X[Nz],$[bP]=J,X.once)this.once(Z,$);else this.on(Z,$)},removeEventListener(Z,J){for(let X of this.listeners(Z))if(X[bP]===J&&!X[Nz]){this.removeListener(Z,X);break}}};$80.exports={CloseEvent:p3,ErrorEvent:Pz,Event:XX,EventTarget:kI1,MessageEvent:Aw};function Sw(Z,J,X){if(typeof Z==="object"&&Z.handleEvent)Z.handleEvent.call(Z,X);else Z.call(J,X)}});var hP=U((v_6,Q80)=>{var{tokenChars:Tz}=m3();function q7(Z,J,X){if(Z[J]===void 0)Z[J]=[X];else Z[J].push(X)}function EI1(Z){let J=Object.create(null),X=Object.create(null),$=!1,Y=!1,Q=!1,K,W,G=-1,z=-1,V=-1,H=0;for(;H<Z.length;H++)if(z=Z.charCodeAt(H),K===void 0)if(V===-1&&Tz[z]===1){if(G===-1)G=H}else if(H!==0&&(z===32||z===9)){if(V===-1&&G!==-1)V=H}else if(z===59||z===44){if(G===-1)throw new SyntaxError(`Unexpected character at index ${H}`);if(V===-1)V=H;let q=Z.slice(G,V);if(z===44)q7(J,q,X),X=Object.create(null);else K=q;G=V=-1}else throw new SyntaxError(`Unexpected character at index ${H}`);else if(W===void 0)if(V===-1&&Tz[z]===1){if(G===-1)G=H}else if(z===32||z===9){if(V===-1&&G!==-1)V=H}else if(z===59||z===44){if(G===-1)throw new SyntaxError(`Unexpected character at index ${H}`);if(V===-1)V=H;if(q7(X,Z.slice(G,V),!0),z===44)q7(J,K,X),X=Object.create(null),K=void 0;G=V=-1}else if(z===61&&G!==-1&&V===-1)W=Z.slice(G,H),G=V=-1;else throw new SyntaxError(`Unexpected character at index ${H}`);else if(Y){if(Tz[z]!==1)throw new SyntaxError(`Unexpected character at index ${H}`);if(G===-1)G=H;else if(!$)$=!0;Y=!1}else if(Q)if(Tz[z]===1){if(G===-1)G=H}else if(z===34&&G!==-1)Q=!1,V=H;else if(z===92)Y=!0;else throw new SyntaxError(`Unexpected character at index ${H}`);else if(z===34&&Z.charCodeAt(H-1)===61)Q=!0;else if(V===-1&&Tz[z]===1){if(G===-1)G=H}else if(G!==-1&&(z===32||z===9)){if(V===-1)V=H}else if(z===59||z===44){if(G===-1)throw new SyntaxError(`Unexpected character at index ${H}`);if(V===-1)V=H;let q=Z.slice(G,V);if($)q=q.replace(/\\/g,""),$=!1;if(q7(X,W,q),z===44)q7(J,K,X),X=Object.create(null),K=void 0;W=void 0,G=V=-1}else throw new SyntaxError(`Unexpected character at index ${H}`);if(G===-1||Q||z===32||z===9)throw new SyntaxError("Unexpected end of input");if(V===-1)V=H;let v=Z.slice(G,V);if(K===void 0)q7(J,v,X);else{if(W===void 0)q7(X,v,!0);else if($)q7(X,W,v.replace(/\\/g,""));else q7(X,W,v);q7(J,K,X)}return J}function II1(Z){return Object.keys(Z).map((J)=>{let X=Z[J];if(!Array.isArray(X))X=[X];return X.map(($)=>{return[J].concat(Object.keys($).map((Y)=>{let Q=$[Y];if(!Array.isArray(Q))Q=[Q];return Q.map((K)=>K===!0?Y:`${Y}=${K}`).join("; ")})).join("; ")}).join(", ")}).join(", ")}Q80.exports={format:II1,parse:EI1}});var yw=U((F_6,x80)=>{var _I1=i("events"),bI1=i("https"),hI1=i("http"),G80=i("net"),SI1=i("tls"),{randomBytes:AI1,createHash:mI1}=i("crypto"),{Duplex:H_6,Readable:q_6}=i("stream"),{URL:SP}=i("url"),$X=Oz(),uI1=EP(),lI1=_P(),{isBlob:yI1}=m3(),{BINARY_TYPES:K80,EMPTY_BUFFER:mw,GUID:pI1,kForOnEventAttribute:AP,kListener:iI1,kStatusCode:gI1,kWebSocket:d8,NOOP:z80}=EZ(),{EventTarget:{addEventListener:dI1,removeEventListener:aI1}}=Y80(),{format:nI1,parse:sI1}=hP(),{toBuffer:oI1}=Mz(),V80=Symbol("kAborted"),mP=[8,13],_Z=["CONNECTING","OPEN","CLOSING","CLOSED"],rI1=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/;class S0 extends _I1{constructor(Z,J,X){super();if(this._binaryType=K80[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=mw,this._closeTimer=null,this._errorEmitted=!1,this._extensions={},this._paused=!1,this._protocol="",this._readyState=S0.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,Z!==null){if(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,J===void 0)J=[];else if(!Array.isArray(J))if(typeof J==="object"&&J!==null)X=J,J=[];else J=[J];v80(this,Z,J,X)}else this._autoPong=X.autoPong,this._isServer=!0}get binaryType(){return this._binaryType}set binaryType(Z){if(!K80.includes(Z))return;if(this._binaryType=Z,this._receiver)this._receiver._binaryType=Z}get bufferedAmount(){if(!this._socket)return this._bufferedAmount;return this._socket._writableState.length+this._sender._bufferedBytes}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(Z,J,X){let $=new uI1({allowSynchronousEvents:X.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:X.maxPayload,skipUTF8Validation:X.skipUTF8Validation}),Y=new lI1(Z,this._extensions,X.generateMask);if(this._receiver=$,this._sender=Y,this._socket=Z,$[d8]=this,Y[d8]=this,Z[d8]=this,$.on("conclude",Z_1),$.on("drain",J_1),$.on("error",X_1),$.on("message",$_1),$.on("ping",Y_1),$.on("pong",Q_1),Y.onerror=K_1,Z.setTimeout)Z.setTimeout(0);if(Z.setNoDelay)Z.setNoDelay();if(J.length>0)Z.unshift(J);Z.on("close",F80),Z.on("data",lw),Z.on("end",c80),Z.on("error",w80),this._readyState=S0.OPEN,this.emit("open")}emitClose(){if(!this._socket){this._readyState=S0.CLOSED,this.emit("close",this._closeCode,this._closeMessage);return}if(this._extensions[$X.extensionName])this._extensions[$X.extensionName].cleanup();this._receiver.removeAllListeners(),this._readyState=S0.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(Z,J){if(this.readyState===S0.CLOSED)return;if(this.readyState===S0.CONNECTING){u5(this,this._req,"WebSocket was closed before the connection was established");return}if(this.readyState===S0.CLOSING){if(this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted))this._socket.end();return}this._readyState=S0.CLOSING,this._sender.close(Z,J,!this._isServer,(X)=>{if(X)return;if(this._closeFrameSent=!0,this._closeFrameReceived||this._receiver._writableState.errorEmitted)this._socket.end()}),q80(this)}pause(){if(this.readyState===S0.CONNECTING||this.readyState===S0.CLOSED)return;this._paused=!0,this._socket.pause()}ping(Z,J,X){if(this.readyState===S0.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof Z==="function")X=Z,Z=J=void 0;else if(typeof J==="function")X=J,J=void 0;if(typeof Z==="number")Z=Z.toString();if(this.readyState!==S0.OPEN){uP(this,Z,X);return}if(J===void 0)J=!this._isServer;this._sender.ping(Z||mw,J,X)}pong(Z,J,X){if(this.readyState===S0.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof Z==="function")X=Z,Z=J=void 0;else if(typeof J==="function")X=J,J=void 0;if(typeof Z==="number")Z=Z.toString();if(this.readyState!==S0.OPEN){uP(this,Z,X);return}if(J===void 0)J=!this._isServer;this._sender.pong(Z||mw,J,X)}resume(){if(this.readyState===S0.CONNECTING||this.readyState===S0.CLOSED)return;if(this._paused=!1,!this._receiver._writableState.needDrain)this._socket.resume()}send(Z,J,X){if(this.readyState===S0.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof J==="function")X=J,J={};if(typeof Z==="number")Z=Z.toString();if(this.readyState!==S0.OPEN){uP(this,Z,X);return}let $={binary:typeof Z!=="string",mask:!this._isServer,compress:!0,fin:!0,...J};if(!this._extensions[$X.extensionName])$.compress=!1;this._sender.send(Z||mw,$,X)}terminate(){if(this.readyState===S0.CLOSED)return;if(this.readyState===S0.CONNECTING){u5(this,this._req,"WebSocket was closed before the connection was established");return}if(this._socket)this._readyState=S0.CLOSING,this._socket.destroy()}}Object.defineProperty(S0,"CONNECTING",{enumerable:!0,value:_Z.indexOf("CONNECTING")});Object.defineProperty(S0.prototype,"CONNECTING",{enumerable:!0,value:_Z.indexOf("CONNECTING")});Object.defineProperty(S0,"OPEN",{enumerable:!0,value:_Z.indexOf("OPEN")});Object.defineProperty(S0.prototype,"OPEN",{enumerable:!0,value:_Z.indexOf("OPEN")});Object.defineProperty(S0,"CLOSING",{enumerable:!0,value:_Z.indexOf("CLOSING")});Object.defineProperty(S0.prototype,"CLOSING",{enumerable:!0,value:_Z.indexOf("CLOSING")});Object.defineProperty(S0,"CLOSED",{enumerable:!0,value:_Z.indexOf("CLOSED")});Object.defineProperty(S0.prototype,"CLOSED",{enumerable:!0,value:_Z.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach((Z)=>{Object.defineProperty(S0.prototype,Z,{enumerable:!0})});["open","error","close","message"].forEach((Z)=>{Object.defineProperty(S0.prototype,`on${Z}`,{enumerable:!0,get(){for(let J of this.listeners(Z))if(J[AP])return J[iI1];return null},set(J){for(let X of this.listeners(Z))if(X[AP]){this.removeListener(Z,X);break}if(typeof J!=="function")return;this.addEventListener(Z,J,{[AP]:!0})}})});S0.prototype.addEventListener=dI1;S0.prototype.removeEventListener=aI1;x80.exports=S0;function v80(Z,J,X,$){let Y={allowSynchronousEvents:!0,autoPong:!0,protocolVersion:mP[1],maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...$,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:"GET",host:void 0,path:void 0,port:void 0};if(Z._autoPong=Y.autoPong,!mP.includes(Y.protocolVersion))throw new RangeError(`Unsupported protocol version: ${Y.protocolVersion} (supported versions: ${mP.join(", ")})`);let Q;if(J instanceof SP)Q=J;else try{Q=new SP(J)}catch(c){throw new SyntaxError(`Invalid URL: ${J}`)}if(Q.protocol==="http:")Q.protocol="ws:";else if(Q.protocol==="https:")Q.protocol="wss:";Z._url=Q.href;let K=Q.protocol==="wss:",W=Q.protocol==="ws+unix:",G;if(Q.protocol!=="ws:"&&!K&&!W)G=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`;else if(W&&!Q.pathname)G="The URL's pathname is empty";else if(Q.hash)G="The URL contains a fragment identifier";if(G){let c=new SyntaxError(G);if(Z._redirects===0)throw c;else{uw(Z,c);return}}let z=K?443:80,V=AI1(16).toString("base64"),H=K?bI1.request:hI1.request,v=new Set,q;if(Y.createConnection=Y.createConnection||(K?eI1:tI1),Y.defaultPort=Y.defaultPort||z,Y.port=Q.port||z,Y.host=Q.hostname.startsWith("[")?Q.hostname.slice(1,-1):Q.hostname,Y.headers={...Y.headers,"Sec-WebSocket-Version":Y.protocolVersion,"Sec-WebSocket-Key":V,Connection:"Upgrade",Upgrade:"websocket"},Y.path=Q.pathname+Q.search,Y.timeout=Y.handshakeTimeout,Y.perMessageDeflate)q=new $X(Y.perMessageDeflate!==!0?Y.perMessageDeflate:{},!1,Y.maxPayload),Y.headers["Sec-WebSocket-Extensions"]=nI1({[$X.extensionName]:q.offer()});if(X.length){for(let c of X){if(typeof c!=="string"||!rI1.test(c)||v.has(c))throw new SyntaxError("An invalid or duplicated subprotocol was specified");v.add(c)}Y.headers["Sec-WebSocket-Protocol"]=X.join(",")}if(Y.origin)if(Y.protocolVersion<13)Y.headers["Sec-WebSocket-Origin"]=Y.origin;else Y.headers.Origin=Y.origin;if(Q.username||Q.password)Y.auth=`${Q.username}:${Q.password}`;if(W){let c=Y.path.split(":");Y.socketPath=c[0],Y.path=c[1]}let F;if(Y.followRedirects){if(Z._redirects===0){Z._originalIpc=W,Z._originalSecure=K,Z._originalHostOrSocketPath=W?Y.socketPath:Q.host;let c=$&&$.headers;if($={...$,headers:{}},c)for(let[w,x]of Object.entries(c))$.headers[w.toLowerCase()]=x}else if(Z.listenerCount("redirect")===0){let c=W?Z._originalIpc?Y.socketPath===Z._originalHostOrSocketPath:!1:Z._originalIpc?!1:Q.host===Z._originalHostOrSocketPath;if(!c||Z._originalSecure&&!K){if(delete Y.headers.authorization,delete Y.headers.cookie,!c)delete Y.headers.host;Y.auth=void 0}}if(Y.auth&&!$.headers.authorization)$.headers.authorization="Basic "+Buffer.from(Y.auth).toString("base64");if(F=Z._req=H(Y),Z._redirects)Z.emit("redirect",Z.url,F)}else F=Z._req=H(Y);if(Y.timeout)F.on("timeout",()=>{u5(Z,F,"Opening handshake has timed out")});if(F.on("error",(c)=>{if(F===null||F[V80])return;F=Z._req=null,uw(Z,c)}),F.on("response",(c)=>{let w=c.headers.location,x=c.statusCode;if(w&&Y.followRedirects&&x>=300&&x<400){if(++Z._redirects>Y.maxRedirects){u5(Z,F,"Maximum redirects exceeded");return}F.abort();let j;try{j=new SP(w,J)}catch(B){let L=new SyntaxError(`Invalid URL: ${w}`);uw(Z,L);return}v80(Z,j,X,$)}else if(!Z.emit("unexpected-response",F,c))u5(Z,F,`Unexpected server response: ${c.statusCode}`)}),F.on("upgrade",(c,w,x)=>{if(Z.emit("upgrade",c),Z.readyState!==S0.CONNECTING)return;F=Z._req=null;let j=c.headers.upgrade;if(j===void 0||j.toLowerCase()!=="websocket"){u5(Z,w,"Invalid Upgrade header");return}let B=mI1("sha1").update(V+pI1).digest("base64");if(c.headers["sec-websocket-accept"]!==B){u5(Z,w,"Invalid Sec-WebSocket-Accept header");return}let L=c.headers["sec-websocket-protocol"],R;if(L!==void 0){if(!v.size)R="Server sent a subprotocol but none was requested";else if(!v.has(L))R="Server sent an invalid subprotocol"}else if(v.size)R="Server sent no subprotocol";if(R){u5(Z,w,R);return}if(L)Z._protocol=L;let M=c.headers["sec-websocket-extensions"];if(M!==void 0){if(!q){u5(Z,w,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let O;try{O=sI1(M)}catch(N){u5(Z,w,"Invalid Sec-WebSocket-Extensions header");return}let P=Object.keys(O);if(P.length!==1||P[0]!==$X.extensionName){u5(Z,w,"Server indicated an extension that was not requested");return}try{q.accept(O[$X.extensionName])}catch(N){u5(Z,w,"Invalid Sec-WebSocket-Extensions header");return}Z._extensions[$X.extensionName]=q}Z.setSocket(w,x,{allowSynchronousEvents:Y.allowSynchronousEvents,generateMask:Y.generateMask,maxPayload:Y.maxPayload,skipUTF8Validation:Y.skipUTF8Validation})}),Y.finishRequest)Y.finishRequest(F,Z);else F.end()}function uw(Z,J){Z._readyState=S0.CLOSING,Z._errorEmitted=!0,Z.emit("error",J),Z.emitClose()}function tI1(Z){return Z.path=Z.socketPath,G80.connect(Z)}function eI1(Z){if(Z.path=void 0,!Z.servername&&Z.servername!=="")Z.servername=G80.isIP(Z.host)?"":Z.host;return SI1.connect(Z)}function u5(Z,J,X){Z._readyState=S0.CLOSING;let $=new Error(X);if(Error.captureStackTrace($,u5),J.setHeader){if(J[V80]=!0,J.abort(),J.socket&&!J.socket.destroyed)J.socket.destroy();process.nextTick(uw,Z,$)}else J.destroy($),J.once("error",Z.emit.bind(Z,"error")),J.once("close",Z.emitClose.bind(Z))}function uP(Z,J,X){if(J){let $=yI1(J)?J.size:oI1(J).length;if(Z._socket)Z._sender._bufferedBytes+=$;else Z._bufferedAmount+=$}if(X){let $=new Error(`WebSocket is not open: readyState ${Z.readyState} (${_Z[Z.readyState]})`);process.nextTick(X,$)}}function Z_1(Z,J){let X=this[d8];if(X._closeFrameReceived=!0,X._closeMessage=J,X._closeCode=Z,X._socket[d8]===void 0)return;if(X._socket.removeListener("data",lw),process.nextTick(H80,X._socket),Z===1005)X.close();else X.close(Z,J)}function J_1(){let Z=this[d8];if(!Z.isPaused)Z._socket.resume()}function X_1(Z){let J=this[d8];if(J._socket[d8]!==void 0)J._socket.removeListener("data",lw),process.nextTick(H80,J._socket),J.close(Z[gI1]);if(!J._errorEmitted)J._errorEmitted=!0,J.emit("error",Z)}function W80(){this[d8].emitClose()}function $_1(Z,J){this[d8].emit("message",Z,J)}function Y_1(Z){let J=this[d8];if(J._autoPong)J.pong(Z,!this._isServer,z80);J.emit("ping",Z)}function Q_1(Z){this[d8].emit("pong",Z)}function H80(Z){Z.resume()}function K_1(Z){let J=this[d8];if(J.readyState===S0.CLOSED)return;if(J.readyState===S0.OPEN)J._readyState=S0.CLOSING,q80(J);if(this._socket.end(),!J._errorEmitted)J._errorEmitted=!0,J.emit("error",Z)}function q80(Z){Z._closeTimer=setTimeout(Z._socket.destroy.bind(Z._socket),30000)}function F80(){let Z=this[d8];this.removeListener("close",F80),this.removeListener("data",lw),this.removeListener("end",c80),Z._readyState=S0.CLOSING;let J;if(!this._readableState.endEmitted&&!Z._closeFrameReceived&&!Z._receiver._writableState.errorEmitted&&(J=Z._socket.read())!==null)Z._receiver.write(J);if(Z._receiver.end(),this[d8]=void 0,clearTimeout(Z._closeTimer),Z._receiver._writableState.finished||Z._receiver._writableState.errorEmitted)Z.emitClose();else Z._receiver.on("error",W80),Z._receiver.on("finish",W80)}function lw(Z){if(!this[d8]._receiver.write(Z))this.pause()}function c80(){let Z=this[d8];Z._readyState=S0.CLOSING,Z._receiver.end(),this.end()}function w80(){let Z=this[d8];if(this.removeListener("error",w80),this.on("error",z80),Z)Z._readyState=S0.CLOSING,this.destroy()}});var L80=U((w_6,B80)=>{var c_6=yw(),{Duplex:W_1}=i("stream");function U80(Z){Z.emit("close")}function G_1(){if(!this.destroyed&&this._writableState.finished)this.destroy()}function j80(Z){if(this.removeListener("error",j80),this.destroy(),this.listenerCount("error")===0)this.emit("error",Z)}function z_1(Z,J){let X=!0,$=new W_1({...J,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return Z.on("message",function Y(Q,K){let W=!K&&$._readableState.objectMode?Q.toString():Q;if(!$.push(W))Z.pause()}),Z.once("error",function Y(Q){if($.destroyed)return;X=!1,$.destroy(Q)}),Z.once("close",function Y(){if($.destroyed)return;$.push(null)}),$._destroy=function(Y,Q){if(Z.readyState===Z.CLOSED){Q(Y),process.nextTick(U80,$);return}let K=!1;if(Z.once("error",function W(G){K=!0,Q(G)}),Z.once("close",function W(){if(!K)Q(Y);process.nextTick(U80,$)}),X)Z.terminate()},$._final=function(Y){if(Z.readyState===Z.CONNECTING){Z.once("open",function Q(){$._final(Y)});return}if(Z._socket===null)return;if(Z._socket._writableState.finished){if(Y(),$._readableState.endEmitted)$.destroy()}else Z._socket.once("finish",function Q(){Y()}),Z.close()},$._read=function(){if(Z.isPaused)Z.resume()},$._write=function(Y,Q,K){if(Z.readyState===Z.CONNECTING){Z.once("open",function W(){$._write(Y,Q,K)});return}Z.send(Y,K)},$.on("end",G_1),$.on("error",j80),$}B80.exports=z_1});var M80=U((x_6,D80)=>{var{tokenChars:V_1}=m3();function v_1(Z){let J=new Set,X=-1,$=-1,Y=0;for(Y;Y<Z.length;Y++){let K=Z.charCodeAt(Y);if($===-1&&V_1[K]===1){if(X===-1)X=Y}else if(Y!==0&&(K===32||K===9)){if($===-1&&X!==-1)$=Y}else if(K===44){if(X===-1)throw new SyntaxError(`Unexpected character at index ${Y}`);if($===-1)$=Y;let W=Z.slice(X,$);if(J.has(W))throw new SyntaxError(`The "${W}" subprotocol is duplicated`);J.add(W),X=$=-1}else throw new SyntaxError(`Unexpected character at index ${Y}`)}if(X===-1||$!==-1)throw new SyntaxError("Unexpected end of input");let Q=Z.slice(X,Y);if(J.has(Q))throw new SyntaxError(`The "${Q}" subprotocol is duplicated`);return J.add(Q),J}D80.exports={parse:v_1}});var T80=U((j_6,P80)=>{var H_1=i("events"),pw=i("http"),{Duplex:U_6}=i("stream"),{createHash:q_1}=i("crypto"),R80=hP(),o$=Oz(),F_1=M80(),c_1=yw(),{GUID:w_1,kWebSocket:x_1}=EZ(),U_1=/^[+/0-9A-Za-z]{22}==$/;class N80 extends H_1{constructor(Z,J){super();if(Z={allowSynchronousEvents:!0,autoPong:!0,maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:c_1,...Z},Z.port==null&&!Z.server&&!Z.noServer||Z.port!=null&&(Z.server||Z.noServer)||Z.server&&Z.noServer)throw new TypeError('One and only one of the "port", "server", or "noServer" options must be specified');if(Z.port!=null)this._server=pw.createServer((X,$)=>{let Y=pw.STATUS_CODES[426];$.writeHead(426,{"Content-Length":Y.length,"Content-Type":"text/plain"}),$.end(Y)}),this._server.listen(Z.port,Z.host,Z.backlog,J);else if(Z.server)this._server=Z.server;if(this._server){let X=this.emit.bind(this,"connection");this._removeListeners=j_1(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:($,Y,Q)=>{this.handleUpgrade($,Y,Q,X)}})}if(Z.perMessageDeflate===!0)Z.perMessageDeflate={};if(Z.clientTracking)this.clients=new Set,this._shouldEmitClose=!1;this.options=Z,this._state=0}address(){if(this.options.noServer)throw new Error('The server is operating in "noServer" mode');if(!this._server)return null;return this._server.address()}close(Z){if(this._state===2){if(Z)this.once("close",()=>{Z(new Error("The server is not running"))});process.nextTick(Cz,this);return}if(Z)this.once("close",Z);if(this._state===1)return;if(this._state=1,this.options.noServer||this.options.server){if(this._server)this._removeListeners(),this._removeListeners=this._server=null;if(this.clients)if(!this.clients.size)process.nextTick(Cz,this);else this._shouldEmitClose=!0;else process.nextTick(Cz,this)}else{let J=this._server;this._removeListeners(),this._removeListeners=this._server=null,J.close(()=>{Cz(this)})}}shouldHandle(Z){if(this.options.path){let J=Z.url.indexOf("?");if((J!==-1?Z.url.slice(0,J):Z.url)!==this.options.path)return!1}return!0}handleUpgrade(Z,J,X,$){J.on("error",O80);let Y=Z.headers["sec-websocket-key"],Q=Z.headers.upgrade,K=+Z.headers["sec-websocket-version"];if(Z.method!=="GET"){r$(this,Z,J,405,"Invalid HTTP method");return}if(Q===void 0||Q.toLowerCase()!=="websocket"){r$(this,Z,J,400,"Invalid Upgrade header");return}if(Y===void 0||!U_1.test(Y)){r$(this,Z,J,400,"Missing or invalid Sec-WebSocket-Key header");return}if(K!==13&&K!==8){r$(this,Z,J,400,"Missing or invalid Sec-WebSocket-Version header",{"Sec-WebSocket-Version":"13, 8"});return}if(!this.shouldHandle(Z)){fz(J,400);return}let W=Z.headers["sec-websocket-protocol"],G=new Set;if(W!==void 0)try{G=F_1.parse(W)}catch(H){r$(this,Z,J,400,"Invalid Sec-WebSocket-Protocol header");return}let z=Z.headers["sec-websocket-extensions"],V={};if(this.options.perMessageDeflate&&z!==void 0){let H=new o$(this.options.perMessageDeflate,!0,this.options.maxPayload);try{let v=R80.parse(z);if(v[o$.extensionName])H.accept(v[o$.extensionName]),V[o$.extensionName]=H}catch(v){r$(this,Z,J,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let H={origin:Z.headers[`${K===8?"sec-websocket-origin":"origin"}`],secure:!!(Z.socket.authorized||Z.socket.encrypted),req:Z};if(this.options.verifyClient.length===2){this.options.verifyClient(H,(v,q,F,c)=>{if(!v)return fz(J,q||401,F,c);this.completeUpgrade(V,Y,G,Z,J,X,$)});return}if(!this.options.verifyClient(H))return fz(J,401)}this.completeUpgrade(V,Y,G,Z,J,X,$)}completeUpgrade(Z,J,X,$,Y,Q,K){if(!Y.readable||!Y.writable)return Y.destroy();if(Y[x_1])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>0)return fz(Y,503);let G=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${q_1("sha1").update(J+w_1).digest("base64")}`],z=new this.options.WebSocket(null,void 0,this.options);if(X.size){let V=this.options.handleProtocols?this.options.handleProtocols(X,$):X.values().next().value;if(V)G.push(`Sec-WebSocket-Protocol: ${V}`),z._protocol=V}if(Z[o$.extensionName]){let V=Z[o$.extensionName].params,H=R80.format({[o$.extensionName]:[V]});G.push(`Sec-WebSocket-Extensions: ${H}`),z._extensions=Z}if(this.emit("headers",G,$),Y.write(G.concat(`\r
28
+ deps: ${X}}`};var df1={keyword:"dependencies",type:"object",schemaType:"object",error:Te.error,code(Z){let[J,X]=af1(Z);Ne(Z,J),Pe(Z,X)}};function af1({schema:Z}){let J={},X={};for(let $ in Z){if($==="__proto__")continue;let Y=Array.isArray(Z[$])?J:X;Y[$]=Z[$]}return[J,X]}function Ne(Z,J=Z.schema){let{gen:X,data:$,it:Y}=Z;if(Object.keys(J).length===0)return;let Q=X.let("missing");for(let K in J){let W=J[K];if(W.length===0)continue;let G=(0,jz.propertyInData)(X,$,K,Y.opts.ownProperties);if(Z.setParams({property:K,depsCount:W.length,deps:W.join(", ")}),Y.allErrors)X.if(G,()=>{for(let z of W)(0,jz.checkReportMissingProp)(Z,z)});else X.if(EN._`${G} && (${(0,jz.checkMissingProp)(Z,W,Q)})`),(0,jz.reportMissingProp)(Z,Q),X.else()}}Te.validatePropertyDeps=Ne;function Pe(Z,J=Z.schema){let{gen:X,data:$,keyword:Y,it:Q}=Z,K=X.name("valid");for(let W in J){if((0,gf1.alwaysValidSchema)(Q,J[W]))continue;X.if((0,jz.propertyInData)(X,$,W,Q.opts.ownProperties),()=>{let G=Z.subschema({keyword:Y,schemaProp:W},K);Z.mergeValidEvaluated(G,K)},()=>X.var(K,!0)),Z.ok(K)}}Te.validateSchemaDeps=Pe;Te.default=df1});var _e=U((Ie)=>{Object.defineProperty(Ie,"__esModule",{value:!0});var Ee=o0(),of1=V1(),rf1={message:"property name must be valid",params:({params:Z})=>Ee._`{propertyName: ${Z.propertyName}}`},tf1={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:rf1,code(Z){let{gen:J,schema:X,data:$,it:Y}=Z;if((0,of1.alwaysValidSchema)(Y,X))return;let Q=J.name("valid");J.forIn("key",$,(K)=>{Z.setParams({propertyName:K}),Z.subschema({keyword:"propertyNames",data:K,dataTypes:["string"],propertyName:K,compositeRule:!0},Q),J.if((0,Ee.not)(Q),()=>{if(Z.error(!0),!Y.allErrors)J.break()})}),Z.ok(Q)}};Ie.default=tf1});var IN=U((be)=>{Object.defineProperty(be,"__esModule",{value:!0});var Dw=R4(),M9=o0(),Zk1=TZ(),Mw=V1(),Jk1={message:"must NOT have additional properties",params:({params:Z})=>M9._`{additionalProperty: ${Z.additionalProperty}}`},Xk1={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:Jk1,code(Z){let{gen:J,schema:X,parentSchema:$,data:Y,errsCount:Q,it:K}=Z;if(!Q)throw new Error("ajv implementation error");let{allErrors:W,opts:G}=K;if(K.props=!0,G.removeAdditional!=="all"&&(0,Mw.alwaysValidSchema)(K,X))return;let z=(0,Dw.allSchemaProperties)($.properties),V=(0,Dw.allSchemaProperties)($.patternProperties);H(),Z.ok(M9._`${Q} === ${Zk1.default.errors}`);function H(){J.forIn("key",Y,(w)=>{if(!z.length&&!V.length)F(w);else J.if(v(w),()=>F(w))})}function v(w){let x;if(z.length>8){let j=(0,Mw.schemaRefOrVal)(K,$.properties,"properties");x=(0,Dw.isOwnProperty)(J,j,w)}else if(z.length)x=(0,M9.or)(...z.map((j)=>M9._`${w} === ${j}`));else x=M9.nil;if(V.length)x=(0,M9.or)(x,...V.map((j)=>M9._`${(0,Dw.usePattern)(Z,j)}.test(${w})`));return(0,M9.not)(x)}function q(w){J.code(M9._`delete ${Y}[${w}]`)}function F(w){if(G.removeAdditional==="all"||G.removeAdditional&&X===!1){q(w);return}if(X===!1){if(Z.setParams({additionalProperty:w}),Z.error(),!W)J.break();return}if(typeof X=="object"&&!(0,Mw.alwaysValidSchema)(K,X)){let x=J.name("valid");if(G.removeAdditional==="failing")c(w,x,!1),J.if((0,M9.not)(x),()=>{Z.reset(),q(w)});else if(c(w,x),!W)J.if((0,M9.not)(x),()=>J.break())}}function c(w,x,j){let B={keyword:"additionalProperties",dataProp:w,dataPropType:Mw.Type.Str};if(j===!1)Object.assign(B,{compositeRule:!0,createErrors:!1,allErrors:!1});Z.subschema(B,x)}}};be.default=Xk1});var me=U((Ae)=>{Object.defineProperty(Ae,"__esModule",{value:!0});var Yk1=Wz(),he=R4(),_N=V1(),Se=IN(),Qk1={keyword:"properties",type:"object",schemaType:"object",code(Z){let{gen:J,schema:X,parentSchema:$,data:Y,it:Q}=Z;if(Q.opts.removeAdditional==="all"&&$.additionalProperties===void 0)Se.default.code(new Yk1.KeywordCxt(Q,Se.default,"additionalProperties"));let K=(0,he.allSchemaProperties)(X);for(let H of K)Q.definedProperties.add(H);if(Q.opts.unevaluated&&K.length&&Q.props!==!0)Q.props=_N.mergeEvaluated.props(J,(0,_N.toHash)(K),Q.props);let W=K.filter((H)=>!(0,_N.alwaysValidSchema)(Q,X[H]));if(W.length===0)return;let G=J.name("valid");for(let H of W){if(z(H))V(H);else{if(J.if((0,he.propertyInData)(J,Y,H,Q.opts.ownProperties)),V(H),!Q.allErrors)J.else().var(G,!0);J.endIf()}Z.it.definedProperties.add(H),Z.ok(G)}function z(H){return Q.opts.useDefaults&&!Q.compositeRule&&X[H].default!==void 0}function V(H){Z.subschema({keyword:"properties",schemaProp:H,dataProp:H},G)}}};Ae.default=Qk1});var ie=U((pe)=>{Object.defineProperty(pe,"__esModule",{value:!0});var ue=R4(),Rw=o0(),le=V1(),ye=V1(),Wk1={keyword:"patternProperties",type:"object",schemaType:"object",code(Z){let{gen:J,schema:X,data:$,parentSchema:Y,it:Q}=Z,{opts:K}=Q,W=(0,ue.allSchemaProperties)(X),G=W.filter((c)=>(0,le.alwaysValidSchema)(Q,X[c]));if(W.length===0||G.length===W.length&&(!Q.opts.unevaluated||Q.props===!0))return;let z=K.strictSchema&&!K.allowMatchingProperties&&Y.properties,V=J.name("valid");if(Q.props!==!0&&!(Q.props instanceof Rw.Name))Q.props=(0,ye.evaluatedPropsToName)(J,Q.props);let{props:H}=Q;v();function v(){for(let c of W){if(z)q(c);if(Q.allErrors)F(c);else J.var(V,!0),F(c),J.if(V)}}function q(c){for(let w in z)if(new RegExp(c).test(w))(0,le.checkStrictMode)(Q,`property ${w} matches pattern ${c} (use allowMatchingProperties)`)}function F(c){J.forIn("key",$,(w)=>{J.if(Rw._`${(0,ue.usePattern)(Z,c)}.test(${w})`,()=>{let x=G.includes(c);if(!x)Z.subschema({keyword:"patternProperties",schemaProp:c,dataProp:w,dataPropType:ye.Type.Str},V);if(Q.opts.unevaluated&&H!==!0)J.assign(Rw._`${H}[${w}]`,!0);else if(!x&&!Q.allErrors)J.if((0,Rw.not)(V),()=>J.break())})})}}};pe.default=Wk1});var de=U((ge)=>{Object.defineProperty(ge,"__esModule",{value:!0});var zk1=V1(),Vk1={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(Z){let{gen:J,schema:X,it:$}=Z;if((0,zk1.alwaysValidSchema)($,X)){Z.fail();return}let Y=J.name("valid");Z.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},Y),Z.failResult(Y,()=>Z.reset(),()=>Z.error())},error:{message:"must NOT be valid"}};ge.default=Vk1});var ne=U((ae)=>{Object.defineProperty(ae,"__esModule",{value:!0});var Hk1=R4(),qk1={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:Hk1.validateUnion,error:{message:"must match a schema in anyOf"}};ae.default=qk1});var oe=U((se)=>{Object.defineProperty(se,"__esModule",{value:!0});var Ow=o0(),ck1=V1(),wk1={message:"must match exactly one schema in oneOf",params:({params:Z})=>Ow._`{passingSchemas: ${Z.passing}}`},xk1={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:wk1,code(Z){let{gen:J,schema:X,parentSchema:$,it:Y}=Z;if(!Array.isArray(X))throw new Error("ajv implementation error");if(Y.opts.discriminator&&$.discriminator)return;let Q=X,K=J.let("valid",!1),W=J.let("passing",null),G=J.name("_valid");Z.setParams({passing:W}),J.block(z),Z.result(K,()=>Z.reset(),()=>Z.error(!0));function z(){Q.forEach((V,H)=>{let v;if((0,ck1.alwaysValidSchema)(Y,V))J.var(G,!0);else v=Z.subschema({keyword:"oneOf",schemaProp:H,compositeRule:!0},G);if(H>0)J.if(Ow._`${G} && ${K}`).assign(K,!1).assign(W,Ow._`[${W}, ${H}]`).else();J.if(G,()=>{if(J.assign(K,!0),J.assign(W,H),v)Z.mergeEvaluated(v,Ow.Name)})})}}};se.default=xk1});var te=U((re)=>{Object.defineProperty(re,"__esModule",{value:!0});var jk1=V1(),Bk1={keyword:"allOf",schemaType:"array",code(Z){let{gen:J,schema:X,it:$}=Z;if(!Array.isArray(X))throw new Error("ajv implementation error");let Y=J.name("valid");X.forEach((Q,K)=>{if((0,jk1.alwaysValidSchema)($,Q))return;let W=Z.subschema({keyword:"allOf",schemaProp:K},Y);Z.ok(Y),Z.mergeEvaluated(W)})}};re.default=Bk1});var X00=U((J00)=>{Object.defineProperty(J00,"__esModule",{value:!0});var Nw=o0(),Z00=V1(),Dk1={message:({params:Z})=>Nw.str`must match "${Z.ifClause}" schema`,params:({params:Z})=>Nw._`{failingKeyword: ${Z.ifClause}}`},Mk1={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:Dk1,code(Z){let{gen:J,parentSchema:X,it:$}=Z;if(X.then===void 0&&X.else===void 0)(0,Z00.checkStrictMode)($,'"if" without "then" and "else" is ignored');let Y=ee($,"then"),Q=ee($,"else");if(!Y&&!Q)return;let K=J.let("valid",!0),W=J.name("_valid");if(G(),Z.reset(),Y&&Q){let V=J.let("ifClause");Z.setParams({ifClause:V}),J.if(W,z("then",V),z("else",V))}else if(Y)J.if(W,z("then"));else J.if((0,Nw.not)(W),z("else"));Z.pass(K,()=>Z.error(!0));function G(){let V=Z.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},W);Z.mergeEvaluated(V)}function z(V,H){return()=>{let v=Z.subschema({keyword:V},W);if(J.assign(K,W),Z.mergeValidEvaluated(v,K),H)J.assign(H,Nw._`${V}`);else Z.setParams({ifClause:V})}}}};function ee(Z,J){let X=Z.schema[J];return X!==void 0&&!(0,Z00.alwaysValidSchema)(Z,X)}J00.default=Mk1});var Y00=U(($00)=>{Object.defineProperty($00,"__esModule",{value:!0});var Ok1=V1(),Nk1={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:Z,parentSchema:J,it:X}){if(J.if===void 0)(0,Ok1.checkStrictMode)(X,`"${Z}" without "if" is ignored`)}};$00.default=Nk1});var K00=U((Q00)=>{Object.defineProperty(Q00,"__esModule",{value:!0});var Tk1=fN(),Ck1=Be(),fk1=kN(),kk1=Me(),Ek1=Oe(),Ik1=ke(),_k1=_e(),bk1=IN(),hk1=me(),Sk1=ie(),Ak1=de(),mk1=ne(),uk1=oe(),lk1=te(),yk1=X00(),pk1=Y00();function ik1(Z=!1){let J=[Ak1.default,mk1.default,uk1.default,lk1.default,yk1.default,pk1.default,_k1.default,bk1.default,Ik1.default,hk1.default,Sk1.default];if(Z)J.push(Ck1.default,kk1.default);else J.push(Tk1.default,fk1.default);return J.push(Ek1.default),J}Q00.default=ik1});var G00=U((W00)=>{Object.defineProperty(W00,"__esModule",{value:!0});var j8=o0(),dk1={message:({schemaCode:Z})=>j8.str`must match format "${Z}"`,params:({schemaCode:Z})=>j8._`{format: ${Z}}`},ak1={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:dk1,code(Z,J){let{gen:X,data:$,$data:Y,schema:Q,schemaCode:K,it:W}=Z,{opts:G,errSchemaPath:z,schemaEnv:V,self:H}=W;if(!G.validateFormats)return;if(Y)v();else q();function v(){let F=X.scopeValue("formats",{ref:H.formats,code:G.code.formats}),c=X.const("fDef",j8._`${F}[${K}]`),w=X.let("fType"),x=X.let("format");X.if(j8._`typeof ${c} == "object" && !(${c} instanceof RegExp)`,()=>X.assign(w,j8._`${c}.type || "string"`).assign(x,j8._`${c}.validate`),()=>X.assign(w,j8._`"string"`).assign(x,c)),Z.fail$data((0,j8.or)(j(),B()));function j(){if(G.strictSchema===!1)return j8.nil;return j8._`${K} && !${x}`}function B(){let L=V.$async?j8._`(${c}.async ? await ${x}(${$}) : ${x}(${$}))`:j8._`${x}(${$})`,R=j8._`(typeof ${x} == "function" ? ${L} : ${x}.test(${$}))`;return j8._`${x} && ${x} !== true && ${w} === ${J} && !${R}`}}function q(){let F=H.formats[Q];if(!F){j();return}if(F===!0)return;let[c,w,x]=B(F);if(c===J)Z.pass(L());function j(){if(G.strictSchema===!1){H.logger.warn(R());return}throw new Error(R());function R(){return`unknown format "${Q}" ignored in schema at path "${z}"`}}function B(R){let M=R instanceof RegExp?(0,j8.regexpCode)(R):G.code.formats?j8._`${G.code.formats}${(0,j8.getProperty)(Q)}`:void 0,O=X.scopeValue("formats",{key:Q,ref:R,code:M});if(typeof R=="object"&&!(R instanceof RegExp))return[R.type||"string",R.validate,j8._`${O}.validate`];return["string",R,O]}function L(){if(typeof F=="object"&&!(F instanceof RegExp)&&F.async){if(!V.$async)throw new Error("async format in sync schema");return j8._`await ${x}(${$})`}return typeof w=="function"?j8._`${x}(${$})`:j8._`${x}.test(${$})`}}}};W00.default=ak1});var V00=U((z00)=>{Object.defineProperty(z00,"__esModule",{value:!0});var sk1=G00(),ok1=[sk1.default];z00.default=ok1});var q00=U((v00)=>{Object.defineProperty(v00,"__esModule",{value:!0});v00.contentVocabulary=v00.metadataVocabulary=void 0;v00.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];v00.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var w00=U((c00)=>{Object.defineProperty(c00,"__esModule",{value:!0});var ek1=At(),ZE1=ve(),JE1=K00(),XE1=V00(),F00=q00(),$E1=[ek1.default,ZE1.default,(0,JE1.default)(),XE1.default,F00.metadataVocabulary,F00.contentVocabulary];c00.default=$E1});var B00=U((U00)=>{Object.defineProperty(U00,"__esModule",{value:!0});U00.DiscrError=void 0;var x00;(function(Z){Z.Tag="tag",Z.Mapping="mapping"})(x00||(U00.DiscrError=x00={}))});var M00=U((D00)=>{Object.defineProperty(D00,"__esModule",{value:!0});var _3=o0(),bN=B00(),L00=Gw(),QE1=Gz(),KE1=V1(),WE1={message:({params:{discrError:Z,tagName:J}})=>Z===bN.DiscrError.Tag?`tag "${J}" must be string`:`value of tag "${J}" must be in oneOf`,params:({params:{discrError:Z,tag:J,tagName:X}})=>_3._`{error: ${Z}, tag: ${X}, tagValue: ${J}}`},GE1={keyword:"discriminator",type:"object",schemaType:"object",error:WE1,code(Z){let{gen:J,data:X,schema:$,parentSchema:Y,it:Q}=Z,{oneOf:K}=Y;if(!Q.opts.discriminator)throw new Error("discriminator: requires discriminator option");let W=$.propertyName;if(typeof W!="string")throw new Error("discriminator: requires propertyName");if($.mapping)throw new Error("discriminator: mapping is not supported");if(!K)throw new Error("discriminator: requires oneOf keyword");let G=J.let("valid",!1),z=J.const("tag",_3._`${X}${(0,_3.getProperty)(W)}`);J.if(_3._`typeof ${z} == "string"`,()=>V(),()=>Z.error(!1,{discrError:bN.DiscrError.Tag,tag:z,tagName:W})),Z.ok(G);function V(){let q=v();J.if(!1);for(let F in q)J.elseIf(_3._`${z} === ${F}`),J.assign(G,H(q[F]));J.else(),Z.error(!1,{discrError:bN.DiscrError.Mapping,tag:z,tagName:W}),J.endIf()}function H(q){let F=J.name("valid"),c=Z.subschema({keyword:"oneOf",schemaProp:q},F);return Z.mergeEvaluated(c,_3.Name),F}function v(){var q;let F={},c=x(Y),w=!0;for(let L=0;L<K.length;L++){let R=K[L];if((R===null||R===void 0?void 0:R.$ref)&&!(0,KE1.schemaHasRulesButRef)(R,Q.self.RULES)){let O=R.$ref;if(R=L00.resolveRef.call(Q.self,Q.schemaEnv.root,Q.baseId,O),R instanceof L00.SchemaEnv)R=R.schema;if(R===void 0)throw new QE1.default(Q.opts.uriResolver,Q.baseId,O)}let M=(q=R===null||R===void 0?void 0:R.properties)===null||q===void 0?void 0:q[W];if(typeof M!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${W}"`);w=w&&(c||x(R)),j(M,L)}if(!w)throw new Error(`discriminator: "${W}" must be required`);return F;function x({required:L}){return Array.isArray(L)&&L.includes(W)}function j(L,R){if(L.const)B(L.const,R);else if(L.enum)for(let M of L.enum)B(M,R);else throw new Error(`discriminator: "properties/${W}" must have "const" or "enum"`)}function B(L,R){if(typeof L!="string"||L in F)throw new Error(`discriminator: "${W}" values must be unique strings`);F[L]=R}}}};D00.default=GE1});var R00=U((PC6,VE1)=>{VE1.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}});var N00=U((x5,hN)=>{Object.defineProperty(x5,"__esModule",{value:!0});x5.MissingRefError=x5.ValidationError=x5.CodeGen=x5.Name=x5.nil=x5.stringify=x5.str=x5._=x5.KeywordCxt=x5.Ajv=void 0;var vE1=Tt(),HE1=w00(),qE1=M00(),O00=R00(),FE1=["/properties"],Pw="http://json-schema.org/draft-07/schema";class Bz extends vE1.default{_addVocabularies(){if(super._addVocabularies(),HE1.default.forEach((Z)=>this.addVocabulary(Z)),this.opts.discriminator)this.addKeyword(qE1.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let Z=this.opts.$data?this.$dataMetaSchema(O00,FE1):O00;this.addMetaSchema(Z,Pw,!1),this.refs["http://json-schema.org/schema"]=Pw}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Pw)?Pw:void 0)}}x5.Ajv=Bz;hN.exports=x5=Bz;hN.exports.Ajv=Bz;Object.defineProperty(x5,"__esModule",{value:!0});x5.default=Bz;var cE1=Wz();Object.defineProperty(x5,"KeywordCxt",{enumerable:!0,get:function(){return cE1.KeywordCxt}});var b3=o0();Object.defineProperty(x5,"_",{enumerable:!0,get:function(){return b3._}});Object.defineProperty(x5,"str",{enumerable:!0,get:function(){return b3.str}});Object.defineProperty(x5,"stringify",{enumerable:!0,get:function(){return b3.stringify}});Object.defineProperty(x5,"nil",{enumerable:!0,get:function(){return b3.nil}});Object.defineProperty(x5,"Name",{enumerable:!0,get:function(){return b3.Name}});Object.defineProperty(x5,"CodeGen",{enumerable:!0,get:function(){return b3.CodeGen}});var wE1=Kw();Object.defineProperty(x5,"ValidationError",{enumerable:!0,get:function(){return wE1.default}});var xE1=Gz();Object.defineProperty(x5,"MissingRefError",{enumerable:!0,get:function(){return xE1.default}})});var J10=U((Z10)=>{Object.defineProperty(Z10,"__esModule",{value:!0});Z10.fromEnv=_E1;var e00="HYTOPIA_API_KEY";function IE1(Z){let J=process.env[e00];if(!J)throw new Error(`Missing environment variable ${Z}`);return J}function _E1(){return{apiKey:IE1(e00)}}});var X10=U((DP)=>{Object.defineProperty(DP,"__esModule",{value:!0});DP.fromEnv=void 0;var hE1=J10();Object.defineProperty(DP,"fromEnv",{enumerable:!0,get:function(){return hE1.fromEnv}})});var Y10=U((h3)=>{var MP=h3&&h3.__importDefault||function(Z){return Z&&Z.__esModule?Z:{default:Z}};Object.defineProperty(h3,"__esModule",{value:!0});h3.LocalBackend=void 0;var RP=MP(i("fs")),AE1=MP(i("path")),OP=MP(i("util")),mE1=OP.default.promisify(RP.default.mkdir),uE1=OP.default.promisify(RP.default.readFile),lE1=OP.default.promisify(RP.default.writeFile);class $10{dataDir;constructor(Z){this.dataDir=Z}calculatePath(Z,J){return`${this.dataDir}/${Z}/${J}.json`}async load(Z,J){try{let X=await uE1(this.calculatePath(Z,J),"utf8"),$=JSON.parse(X);if(!$.__version)$.__version=1;return $}catch(X){return{__version:1}}}async upload(Z,J){await mE1(AE1.default.join(this.dataDir,Z),{recursive:!0});var X=[];for(var[$,Y]of Object.entries(J))X.push(lE1(this.calculatePath(Z,$),JSON.stringify(Y)));await Promise.all(X)}}h3.LocalBackend=$10});var NP=U((K10)=>{Object.defineProperty(K10,"__esModule",{value:!0});K10.proxifyObject=Q10;function Q10(Z,J){for(let[X,$]of Object.entries(Z))if($ instanceof Object)Z[X]=Q10($,J);return new Proxy(Z,J)}});var z10=U((G10)=>{Object.defineProperty(G10,"__esModule",{value:!0});G10.load=pE1;var W10=NP();async function pE1(Z){let J=await this.backend.load(this.gameId,Z),X=this.saveStatesManager,$={set(Q,K,W){if(typeof W==="function")return!1;if(W instanceof Object)Q[K]=(0,W10.proxifyObject)(W,$);else Q[K]=W;if(K!=="__version")X.incrementVersion(Z);return!0},deleteProperty(Q,K){if(K in Q)delete Q[K];return X.incrementVersion(Z),!0}},Y=(0,W10.proxifyObject)(J,$);return X.setReference(Z,Y),Y}});var F10=U((H10)=>{Object.defineProperty(H10,"__esModule",{value:!0});H10.SaveStatesManager=void 0;var V10=NP();class v10{_stateReferences={};_pendingSaveQueue={};_hasQueuedSaves=!1;setReference(Z,J){this._stateReferences[Z]=J}getReference(Z){return this._stateReferences[Z]??null}dropReference(Z){if(!this._stateReferences)return;delete this._stateReferences[Z]}incrementVersion(Z){if(!this._stateReferences[Z])return;this._hasQueuedSaves=!0;let J=this._stateReferences[Z];J.__version+=1,this._pendingSaveQueue[Z]=J}getPendingSaves(){if(!this._hasQueuedSaves)return null;let Z=JSON.parse(JSON.stringify(this._pendingSaveQueue));return this._pendingSaveQueue={},this._hasQueuedSaves=!1,Z}load(Z,J){let X=this.getReference(Z);if(X)return{value:X.value};let $=this,Y={set(K,W,G){if(typeof G==="function")return!1;if(G instanceof Object)K[W]=(0,V10.proxifyObject)(G,Y);else K[W]=G;if(W!=="__version")$.incrementVersion(Z);return!0},deleteProperty(K,W){if(W in K)delete K[W];return $.incrementVersion(Z),!0}},Q=(0,V10.proxifyObject)(J.value,Y);return $.setReference(Z,Q),{error:void 0,value:Q}}}H10.SaveStatesManager=v10});var w10=U((c10)=>{Object.defineProperty(c10,"__esModule",{value:!0});c10.flush=gE1;async function gE1(){let Z=this.saveStatesManager.getPendingSaves();if(!Z)return;await this.backend.upload(this.gameId,Z)}});var B10=U((U10)=>{Object.defineProperty(U10,"__esModule",{value:!0});U10.RemoteBackend=void 0;class x10{baseUrl;credentials;constructor(Z,J,X){this.baseUrl=Z,this.credentials=J}async load(Z,J){while(!0){try{let X=await fetch(`${this.baseUrl}/play/kv/get/${Z}/${J}`,{headers:{"X-Api-Key":this.credentials.apiKey}}),$=await X.json();if(X.ok){if(!$.value.__version)$.value.__version=1;return $.value}if($&&$.error){if($.error.code==="keyNotFound")return{__version:1};console.warn(`[SaveStates] Got an error loading remote state for key ${J}: ${$.error.code}, retrying in 1s...`),await new Promise((Y)=>setTimeout(Y,1000));continue}throw new Error("Unexpected error body")}catch(X){console.warn(`[SaveStates] Could not load remote state for key ${J} due to a connection issue, retrying in 1s...`)}await new Promise((X)=>setTimeout(X,1000))}}async upload(Z,J){while(!0){try{let X=await fetch(`${this.baseUrl}/play/kv/setbulk/${Z}`,{method:"POST",headers:{"Content-Type":"application/json","X-Api-Key":this.credentials.apiKey},body:JSON.stringify(J)}),$=await X.json();if(X.ok)return;if($&&$.error){console.warn(`[SaveStates] Could not upload state to remote due to an error (code '${$.error.code}'), retrying in 1s...`),await new Promise((Y)=>setTimeout(Y,1000));continue}throw new Error("Unexpected error body")}catch(X){console.warn("[SaveStates] Could not upload state to remote due to a connection issue, retrying in 1s...")}await new Promise((X)=>setTimeout(X,1000))}}}U10.RemoteBackend=x10});var D10=U((L10)=>{Object.defineProperty(L10,"__esModule",{value:!0});L10.unload=aE1;async function aE1(Z){this.saveStatesManager.dropReference(Z),await this.flush()}});var N10=U((R10)=>{Object.defineProperty(R10,"__esModule",{value:!0});R10.SaveStatesClient=void 0;var sE1=X10(),oE1=Y10(),rE1=z10(),tE1=F10(),eE1=w10(),ZI1=B10(),JI1=D10();function XI1(Z){if(Z)return Z;try{let J=(0,sE1.fromEnv)(),X=process.env.HYTOPIA_PERSUADE_CREATIVE_GATEWAY_BASE_URL??"https://prod.persuade-creative.hytopia.com",$=process.env.HYTOPIA_GAME_ID;if(!$)throw new Error("Missing HYTOPIA_GAME_ID environment variable");return new ZI1.RemoteBackend(X,J,$)}catch{return console.warn("[SaveStates] Couldn't load credentials from environment variables, defaulting to local backend"),new oE1.LocalBackend("dev")}}class M10{backend;gameId;saveStatesManager;constructor(Z){this.backend=XI1(Z?.backend),this.gameId=Z?.gameId??process.env.HYTOPIA_GAME_ID??"persistence",this.saveStatesManager=new tE1.SaveStatesManager;async function J(X){while(!0)await X.flush(),await new Promise(($)=>{setTimeout($,1000).unref()})}J(this)}load=rE1.load;unload=JI1.unload;flush=eE1.flush}R10.SaveStatesClient=M10});var EZ=U((X_6,C10)=>{var P10=["nodebuffer","arraybuffer","fragments"],T10=typeof Blob!=="undefined";if(T10)P10.push("blob");C10.exports={BINARY_TYPES:P10,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:T10,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}});var Mz=U(($_6,Ew)=>{var{EMPTY_BUFFER:$I1}=EZ(),PP=Buffer[Symbol.species];function YI1(Z,J){if(Z.length===0)return $I1;if(Z.length===1)return Z[0];let X=Buffer.allocUnsafe(J),$=0;for(let Y=0;Y<Z.length;Y++){let Q=Z[Y];X.set(Q,$),$+=Q.length}if($<J)return new PP(X.buffer,X.byteOffset,$);return X}function f10(Z,J,X,$,Y){for(let Q=0;Q<Y;Q++)X[$+Q]=Z[Q]^J[Q&3]}function k10(Z,J){for(let X=0;X<Z.length;X++)Z[X]^=J[X&3]}function QI1(Z){if(Z.length===Z.buffer.byteLength)return Z.buffer;return Z.buffer.slice(Z.byteOffset,Z.byteOffset+Z.length)}function TP(Z){if(TP.readOnly=!0,Buffer.isBuffer(Z))return Z;let J;if(Z instanceof ArrayBuffer)J=new PP(Z);else if(ArrayBuffer.isView(Z))J=new PP(Z.buffer,Z.byteOffset,Z.byteLength);else J=Buffer.from(Z),TP.readOnly=!1;return J}Ew.exports={concat:YI1,mask:f10,toArrayBuffer:QI1,toBuffer:TP,unmask:k10};if(!process.env.WS_NO_BUFFER_UTIL)try{let Z=(()=>{throw new Error("Cannot require module "+"bufferutil");})();Ew.exports.mask=function(J,X,$,Y,Q){if(Q<48)f10(J,X,$,Y,Q);else Z.mask(J,X,$,Y,Q)},Ew.exports.unmask=function(J,X){if(J.length<32)k10(J,X);else Z.unmask(J,X)}}catch(Z){}});var b10=U((Y_6,_10)=>{var E10=Symbol("kDone"),CP=Symbol("kRun");class I10{constructor(Z){this[E10]=()=>{this.pending--,this[CP]()},this.concurrency=Z||1/0,this.jobs=[],this.pending=0}add(Z){this.jobs.push(Z),this[CP]()}[CP](){if(this.pending===this.concurrency)return;if(this.jobs.length){let Z=this.jobs.shift();this.pending++,Z(this[E10])}}}_10.exports=I10});var Oz=U((Q_6,u10)=>{var Rz=i("zlib"),h10=Mz(),KI1=b10(),{kStatusCode:S10}=EZ(),WI1=Buffer[Symbol.species],GI1=Buffer.from([0,0,255,255]),_w=Symbol("permessage-deflate"),IZ=Symbol("total-length"),S3=Symbol("callback"),ZX=Symbol("buffers"),A3=Symbol("error"),Iw;class A10{constructor(Z,J,X){if(this._maxPayload=X|0,this._options=Z||{},this._threshold=this._options.threshold!==void 0?this._options.threshold:1024,this._isServer=!!J,this._deflate=null,this._inflate=null,this.params=null,!Iw){let $=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;Iw=new KI1($)}}static get extensionName(){return"permessage-deflate"}offer(){let Z={};if(this._options.serverNoContextTakeover)Z.server_no_context_takeover=!0;if(this._options.clientNoContextTakeover)Z.client_no_context_takeover=!0;if(this._options.serverMaxWindowBits)Z.server_max_window_bits=this._options.serverMaxWindowBits;if(this._options.clientMaxWindowBits)Z.client_max_window_bits=this._options.clientMaxWindowBits;else if(this._options.clientMaxWindowBits==null)Z.client_max_window_bits=!0;return Z}accept(Z){return Z=this.normalizeParams(Z),this.params=this._isServer?this.acceptAsServer(Z):this.acceptAsClient(Z),this.params}cleanup(){if(this._inflate)this._inflate.close(),this._inflate=null;if(this._deflate){let Z=this._deflate[S3];if(this._deflate.close(),this._deflate=null,Z)Z(new Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(Z){let J=this._options,X=Z.find(($)=>{if(J.serverNoContextTakeover===!1&&$.server_no_context_takeover||$.server_max_window_bits&&(J.serverMaxWindowBits===!1||typeof J.serverMaxWindowBits==="number"&&J.serverMaxWindowBits>$.server_max_window_bits)||typeof J.clientMaxWindowBits==="number"&&!$.client_max_window_bits)return!1;return!0});if(!X)throw new Error("None of the extension offers can be accepted");if(J.serverNoContextTakeover)X.server_no_context_takeover=!0;if(J.clientNoContextTakeover)X.client_no_context_takeover=!0;if(typeof J.serverMaxWindowBits==="number")X.server_max_window_bits=J.serverMaxWindowBits;if(typeof J.clientMaxWindowBits==="number")X.client_max_window_bits=J.clientMaxWindowBits;else if(X.client_max_window_bits===!0||J.clientMaxWindowBits===!1)delete X.client_max_window_bits;return X}acceptAsClient(Z){let J=Z[0];if(this._options.clientNoContextTakeover===!1&&J.client_no_context_takeover)throw new Error('Unexpected parameter "client_no_context_takeover"');if(!J.client_max_window_bits){if(typeof this._options.clientMaxWindowBits==="number")J.client_max_window_bits=this._options.clientMaxWindowBits}else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits==="number"&&J.client_max_window_bits>this._options.clientMaxWindowBits)throw new Error('Unexpected or invalid parameter "client_max_window_bits"');return J}normalizeParams(Z){return Z.forEach((J)=>{Object.keys(J).forEach((X)=>{let $=J[X];if($.length>1)throw new Error(`Parameter "${X}" must have only a single value`);if($=$[0],X==="client_max_window_bits"){if($!==!0){let Y=+$;if(!Number.isInteger(Y)||Y<8||Y>15)throw new TypeError(`Invalid value for parameter "${X}": ${$}`);$=Y}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${X}": ${$}`)}else if(X==="server_max_window_bits"){let Y=+$;if(!Number.isInteger(Y)||Y<8||Y>15)throw new TypeError(`Invalid value for parameter "${X}": ${$}`);$=Y}else if(X==="client_no_context_takeover"||X==="server_no_context_takeover"){if($!==!0)throw new TypeError(`Invalid value for parameter "${X}": ${$}`)}else throw new Error(`Unknown parameter "${X}"`);J[X]=$})}),Z}decompress(Z,J,X){Iw.add(($)=>{this._decompress(Z,J,(Y,Q)=>{$(),X(Y,Q)})})}compress(Z,J,X){Iw.add(($)=>{this._compress(Z,J,(Y,Q)=>{$(),X(Y,Q)})})}_decompress(Z,J,X){let $=this._isServer?"client":"server";if(!this._inflate){let Y=`${$}_max_window_bits`,Q=typeof this.params[Y]!=="number"?Rz.Z_DEFAULT_WINDOWBITS:this.params[Y];this._inflate=Rz.createInflateRaw({...this._options.zlibInflateOptions,windowBits:Q}),this._inflate[_w]=this,this._inflate[IZ]=0,this._inflate[ZX]=[],this._inflate.on("error",VI1),this._inflate.on("data",m10)}if(this._inflate[S3]=X,this._inflate.write(Z),J)this._inflate.write(GI1);this._inflate.flush(()=>{let Y=this._inflate[A3];if(Y){this._inflate.close(),this._inflate=null,X(Y);return}let Q=h10.concat(this._inflate[ZX],this._inflate[IZ]);if(this._inflate._readableState.endEmitted)this._inflate.close(),this._inflate=null;else if(this._inflate[IZ]=0,this._inflate[ZX]=[],J&&this.params[`${$}_no_context_takeover`])this._inflate.reset();X(null,Q)})}_compress(Z,J,X){let $=this._isServer?"server":"client";if(!this._deflate){let Y=`${$}_max_window_bits`,Q=typeof this.params[Y]!=="number"?Rz.Z_DEFAULT_WINDOWBITS:this.params[Y];this._deflate=Rz.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:Q}),this._deflate[IZ]=0,this._deflate[ZX]=[],this._deflate.on("data",zI1)}this._deflate[S3]=X,this._deflate.write(Z),this._deflate.flush(Rz.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let Y=h10.concat(this._deflate[ZX],this._deflate[IZ]);if(J)Y=new WI1(Y.buffer,Y.byteOffset,Y.length-4);if(this._deflate[S3]=null,this._deflate[IZ]=0,this._deflate[ZX]=[],J&&this.params[`${$}_no_context_takeover`])this._deflate.reset();X(null,Y)})}}u10.exports=A10;function zI1(Z){this[ZX].push(Z),this[IZ]+=Z.length}function m10(Z){if(this[IZ]+=Z.length,this[_w]._maxPayload<1||this[IZ]<=this[_w]._maxPayload){this[ZX].push(Z);return}this[A3]=new RangeError("Max payload size exceeded"),this[A3].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[A3][S10]=1009,this.removeListener("data",m10),this.reset()}function VI1(Z){if(this[_w]._inflate=null,this[A3]){this[S3](this[A3]);return}Z[S10]=1007,this[S3](Z)}});var m3=U((K_6,bw)=>{var{isUtf8:l10}=i("buffer"),{hasBlob:vI1}=EZ(),HI1=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0];function qI1(Z){return Z>=1000&&Z<=1014&&Z!==1004&&Z!==1005&&Z!==1006||Z>=3000&&Z<=4999}function fP(Z){let J=Z.length,X=0;while(X<J)if((Z[X]&128)===0)X++;else if((Z[X]&224)===192){if(X+1===J||(Z[X+1]&192)!==128||(Z[X]&254)===192)return!1;X+=2}else if((Z[X]&240)===224){if(X+2>=J||(Z[X+1]&192)!==128||(Z[X+2]&192)!==128||Z[X]===224&&(Z[X+1]&224)===128||Z[X]===237&&(Z[X+1]&224)===160)return!1;X+=3}else if((Z[X]&248)===240){if(X+3>=J||(Z[X+1]&192)!==128||(Z[X+2]&192)!==128||(Z[X+3]&192)!==128||Z[X]===240&&(Z[X+1]&240)===128||Z[X]===244&&Z[X+1]>143||Z[X]>244)return!1;X+=4}else return!1;return!0}function FI1(Z){return vI1&&typeof Z==="object"&&typeof Z.arrayBuffer==="function"&&typeof Z.type==="string"&&typeof Z.stream==="function"&&(Z[Symbol.toStringTag]==="Blob"||Z[Symbol.toStringTag]==="File")}bw.exports={isBlob:FI1,isValidStatusCode:qI1,isValidUTF8:fP,tokenChars:HI1};if(l10)bw.exports.isValidUTF8=function(Z){return Z.length<24?fP(Z):l10(Z)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let Z=(()=>{throw new Error("Cannot require module "+"utf-8-validate");})();bw.exports.isValidUTF8=function(J){return J.length<32?fP(J):Z(J)}}catch(Z){}});var EP=U((W_6,d10)=>{var{Writable:cI1}=i("stream"),y10=Oz(),{BINARY_TYPES:wI1,EMPTY_BUFFER:p10,kStatusCode:xI1,kWebSocket:UI1}=EZ(),{concat:kP,toArrayBuffer:jI1,unmask:BI1}=Mz(),{isValidStatusCode:LI1,isValidUTF8:i10}=m3(),hw=Buffer[Symbol.species];class g10 extends cI1{constructor(Z={}){super();this._allowSynchronousEvents=Z.allowSynchronousEvents!==void 0?Z.allowSynchronousEvents:!0,this._binaryType=Z.binaryType||wI1[0],this._extensions=Z.extensions||{},this._isServer=!!Z.isServer,this._maxPayload=Z.maxPayload|0,this._skipUTF8Validation=!!Z.skipUTF8Validation,this[UI1]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._errored=!1,this._loop=!1,this._state=0}_write(Z,J,X){if(this._opcode===8&&this._state==0)return X();this._bufferedBytes+=Z.length,this._buffers.push(Z),this.startLoop(X)}consume(Z){if(this._bufferedBytes-=Z,Z===this._buffers[0].length)return this._buffers.shift();if(Z<this._buffers[0].length){let X=this._buffers[0];return this._buffers[0]=new hw(X.buffer,X.byteOffset+Z,X.length-Z),new hw(X.buffer,X.byteOffset,Z)}let J=Buffer.allocUnsafe(Z);do{let X=this._buffers[0],$=J.length-Z;if(Z>=X.length)J.set(this._buffers.shift(),$);else J.set(new Uint8Array(X.buffer,X.byteOffset,Z),$),this._buffers[0]=new hw(X.buffer,X.byteOffset+Z,X.length-Z);Z-=X.length}while(Z>0);return J}startLoop(Z){this._loop=!0;do switch(this._state){case 0:this.getInfo(Z);break;case 1:this.getPayloadLength16(Z);break;case 2:this.getPayloadLength64(Z);break;case 3:this.getMask();break;case 4:this.getData(Z);break;case 5:case 6:this._loop=!1;return}while(this._loop);if(!this._errored)Z()}getInfo(Z){if(this._bufferedBytes<2){this._loop=!1;return}let J=this.consume(2);if((J[0]&48)!==0){let $=this.createError(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");Z($);return}let X=(J[0]&64)===64;if(X&&!this._extensions[y10.extensionName]){let $=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");Z($);return}if(this._fin=(J[0]&128)===128,this._opcode=J[0]&15,this._payloadLength=J[1]&127,this._opcode===0){if(X){let $=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");Z($);return}if(!this._fragmented){let $=this.createError(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");Z($);return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){let $=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");Z($);return}this._compressed=X}else if(this._opcode>7&&this._opcode<11){if(!this._fin){let $=this.createError(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");Z($);return}if(X){let $=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");Z($);return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){let $=this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");Z($);return}}else{let $=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");Z($);return}if(!this._fin&&!this._fragmented)this._fragmented=this._opcode;if(this._masked=(J[1]&128)===128,this._isServer){if(!this._masked){let $=this.createError(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK");Z($);return}}else if(this._masked){let $=this.createError(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");Z($);return}if(this._payloadLength===126)this._state=1;else if(this._payloadLength===127)this._state=2;else this.haveLength(Z)}getPayloadLength16(Z){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(Z)}getPayloadLength64(Z){if(this._bufferedBytes<8){this._loop=!1;return}let J=this.consume(8),X=J.readUInt32BE(0);if(X>Math.pow(2,21)-1){let $=this.createError(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH");Z($);return}this._payloadLength=X*Math.pow(2,32)+J.readUInt32BE(4),this.haveLength(Z)}haveLength(Z){if(this._payloadLength&&this._opcode<8){if(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0){let J=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");Z(J);return}}if(this._masked)this._state=3;else this._state=4}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=4}getData(Z){let J=p10;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}if(J=this.consume(this._payloadLength),this._masked&&(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])!==0)BI1(J,this._mask)}if(this._opcode>7){this.controlMessage(J,Z);return}if(this._compressed){this._state=5,this.decompress(J,Z);return}if(J.length)this._messageLength=this._totalPayloadLength,this._fragments.push(J);this.dataMessage(Z)}decompress(Z,J){this._extensions[y10.extensionName].decompress(Z,this._fin,($,Y)=>{if($)return J($);if(Y.length){if(this._messageLength+=Y.length,this._messageLength>this._maxPayload&&this._maxPayload>0){let Q=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");J(Q);return}this._fragments.push(Y)}if(this.dataMessage(J),this._state===0)this.startLoop(J)})}dataMessage(Z){if(!this._fin){this._state=0;return}let J=this._messageLength,X=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],this._opcode===2){let $;if(this._binaryType==="nodebuffer")$=kP(X,J);else if(this._binaryType==="arraybuffer")$=jI1(kP(X,J));else if(this._binaryType==="blob")$=new Blob(X);else $=X;if(this._allowSynchronousEvents)this.emit("message",$,!0),this._state=0;else this._state=6,setImmediate(()=>{this.emit("message",$,!0),this._state=0,this.startLoop(Z)})}else{let $=kP(X,J);if(!this._skipUTF8Validation&&!i10($)){let Y=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");Z(Y);return}if(this._state===5||this._allowSynchronousEvents)this.emit("message",$,!1),this._state=0;else this._state=6,setImmediate(()=>{this.emit("message",$,!1),this._state=0,this.startLoop(Z)})}}controlMessage(Z,J){if(this._opcode===8){if(Z.length===0)this._loop=!1,this.emit("conclude",1005,p10),this.end();else{let X=Z.readUInt16BE(0);if(!LI1(X)){let Y=this.createError(RangeError,`invalid status code ${X}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");J(Y);return}let $=new hw(Z.buffer,Z.byteOffset+2,Z.length-2);if(!this._skipUTF8Validation&&!i10($)){let Y=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");J(Y);return}this._loop=!1,this.emit("conclude",X,$),this.end()}this._state=0;return}if(this._allowSynchronousEvents)this.emit(this._opcode===9?"ping":"pong",Z),this._state=0;else this._state=6,setImmediate(()=>{this.emit(this._opcode===9?"ping":"pong",Z),this._state=0,this.startLoop(J)})}createError(Z,J,X,$,Y){this._loop=!1,this._errored=!0;let Q=new Z(X?`Invalid WebSocket frame: ${J}`:J);return Error.captureStackTrace(Q,this.createError),Q.code=Y,Q[xI1]=$,Q}}d10.exports=g10});var _P=U((z_6,s10)=>{var{Duplex:G_6}=i("stream"),{randomFillSync:DI1}=i("crypto"),a10=Oz(),{EMPTY_BUFFER:MI1,kWebSocket:RI1,NOOP:OI1}=EZ(),{isBlob:u3,isValidStatusCode:NI1}=m3(),{mask:n10,toBuffer:n$}=Mz(),N4=Symbol("kByteLength"),PI1=Buffer.alloc(4),s$,l3=8192,R9=0,TI1=1,CI1=2;class JX{constructor(Z,J,X){if(this._extensions=J||{},X)this._generateMask=X,this._maskBuffer=Buffer.alloc(4);this._socket=Z,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=R9,this.onerror=OI1,this[RI1]=void 0}static frame(Z,J){let X,$=!1,Y=2,Q=!1;if(J.mask){if(X=J.maskBuffer||PI1,J.generateMask)J.generateMask(X);else{if(l3===8192){if(s$===void 0)s$=Buffer.alloc(8192);DI1(s$,0,8192),l3=0}X[0]=s$[l3++],X[1]=s$[l3++],X[2]=s$[l3++],X[3]=s$[l3++]}Q=(X[0]|X[1]|X[2]|X[3])===0,Y=6}let K;if(typeof Z==="string")if((!J.mask||Q)&&J[N4]!==void 0)K=J[N4];else Z=Buffer.from(Z),K=Z.length;else K=Z.length,$=J.mask&&J.readOnly&&!Q;let W=K;if(K>=65536)Y+=8,W=127;else if(K>125)Y+=2,W=126;let G=Buffer.allocUnsafe($?K+Y:Y);if(G[0]=J.fin?J.opcode|128:J.opcode,J.rsv1)G[0]|=64;if(G[1]=W,W===126)G.writeUInt16BE(K,2);else if(W===127)G[2]=G[3]=0,G.writeUIntBE(K,4,6);if(!J.mask)return[G,Z];if(G[1]|=128,G[Y-4]=X[0],G[Y-3]=X[1],G[Y-2]=X[2],G[Y-1]=X[3],Q)return[G,Z];if($)return n10(Z,X,G,Y,K),[G];return n10(Z,X,Z,0,K),[G,Z]}close(Z,J,X,$){let Y;if(Z===void 0)Y=MI1;else if(typeof Z!=="number"||!NI1(Z))throw new TypeError("First argument must be a valid error code number");else if(J===void 0||!J.length)Y=Buffer.allocUnsafe(2),Y.writeUInt16BE(Z,0);else{let K=Buffer.byteLength(J);if(K>123)throw new RangeError("The message must not be greater than 123 bytes");if(Y=Buffer.allocUnsafe(2+K),Y.writeUInt16BE(Z,0),typeof J==="string")Y.write(J,2);else Y.set(J,2)}let Q={[N4]:Y.length,fin:!0,generateMask:this._generateMask,mask:X,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};if(this._state!==R9)this.enqueue([this.dispatch,Y,!1,Q,$]);else this.sendFrame(JX.frame(Y,Q),$)}ping(Z,J,X){let $,Y;if(typeof Z==="string")$=Buffer.byteLength(Z),Y=!1;else if(u3(Z))$=Z.size,Y=!1;else Z=n$(Z),$=Z.length,Y=n$.readOnly;if($>125)throw new RangeError("The data size must not be greater than 125 bytes");let Q={[N4]:$,fin:!0,generateMask:this._generateMask,mask:J,maskBuffer:this._maskBuffer,opcode:9,readOnly:Y,rsv1:!1};if(u3(Z))if(this._state!==R9)this.enqueue([this.getBlobData,Z,!1,Q,X]);else this.getBlobData(Z,!1,Q,X);else if(this._state!==R9)this.enqueue([this.dispatch,Z,!1,Q,X]);else this.sendFrame(JX.frame(Z,Q),X)}pong(Z,J,X){let $,Y;if(typeof Z==="string")$=Buffer.byteLength(Z),Y=!1;else if(u3(Z))$=Z.size,Y=!1;else Z=n$(Z),$=Z.length,Y=n$.readOnly;if($>125)throw new RangeError("The data size must not be greater than 125 bytes");let Q={[N4]:$,fin:!0,generateMask:this._generateMask,mask:J,maskBuffer:this._maskBuffer,opcode:10,readOnly:Y,rsv1:!1};if(u3(Z))if(this._state!==R9)this.enqueue([this.getBlobData,Z,!1,Q,X]);else this.getBlobData(Z,!1,Q,X);else if(this._state!==R9)this.enqueue([this.dispatch,Z,!1,Q,X]);else this.sendFrame(JX.frame(Z,Q),X)}send(Z,J,X){let $=this._extensions[a10.extensionName],Y=J.binary?2:1,Q=J.compress,K,W;if(typeof Z==="string")K=Buffer.byteLength(Z),W=!1;else if(u3(Z))K=Z.size,W=!1;else Z=n$(Z),K=Z.length,W=n$.readOnly;if(this._firstFragment){if(this._firstFragment=!1,Q&&$&&$.params[$._isServer?"server_no_context_takeover":"client_no_context_takeover"])Q=K>=$._threshold;this._compress=Q}else Q=!1,Y=0;if(J.fin)this._firstFragment=!0;let G={[N4]:K,fin:J.fin,generateMask:this._generateMask,mask:J.mask,maskBuffer:this._maskBuffer,opcode:Y,readOnly:W,rsv1:Q};if(u3(Z))if(this._state!==R9)this.enqueue([this.getBlobData,Z,this._compress,G,X]);else this.getBlobData(Z,this._compress,G,X);else if(this._state!==R9)this.enqueue([this.dispatch,Z,this._compress,G,X]);else this.dispatch(Z,this._compress,G,X)}getBlobData(Z,J,X,$){this._bufferedBytes+=X[N4],this._state=CI1,Z.arrayBuffer().then((Y)=>{if(this._socket.destroyed){let K=new Error("The socket was closed while the blob was being read");process.nextTick(IP,this,K,$);return}this._bufferedBytes-=X[N4];let Q=n$(Y);if(!J)this._state=R9,this.sendFrame(JX.frame(Q,X),$),this.dequeue();else this.dispatch(Q,J,X,$)}).catch((Y)=>{process.nextTick(fI1,this,Y,$)})}dispatch(Z,J,X,$){if(!J){this.sendFrame(JX.frame(Z,X),$);return}let Y=this._extensions[a10.extensionName];this._bufferedBytes+=X[N4],this._state=TI1,Y.compress(Z,X.fin,(Q,K)=>{if(this._socket.destroyed){let W=new Error("The socket was closed while data was being compressed");IP(this,W,$);return}this._bufferedBytes-=X[N4],this._state=R9,X.readOnly=!1,this.sendFrame(JX.frame(K,X),$),this.dequeue()})}dequeue(){while(this._state===R9&&this._queue.length){let Z=this._queue.shift();this._bufferedBytes-=Z[3][N4],Reflect.apply(Z[0],this,Z.slice(1))}}enqueue(Z){this._bufferedBytes+=Z[3][N4],this._queue.push(Z)}sendFrame(Z,J){if(Z.length===2)this._socket.cork(),this._socket.write(Z[0]),this._socket.write(Z[1],J),this._socket.uncork();else this._socket.write(Z[0],J)}}s10.exports=JX;function IP(Z,J,X){if(typeof X==="function")X(J);for(let $=0;$<Z._queue.length;$++){let Y=Z._queue[$],Q=Y[Y.length-1];if(typeof Q==="function")Q(J)}}function fI1(Z,J,X){IP(Z,J,X),Z.onerror(J)}});var Y80=U((V_6,$80)=>{var{kForOnEventAttribute:Nz,kListener:bP}=EZ(),o10=Symbol("kCode"),r10=Symbol("kData"),t10=Symbol("kError"),e10=Symbol("kMessage"),Z80=Symbol("kReason"),y3=Symbol("kTarget"),J80=Symbol("kType"),X80=Symbol("kWasClean");class XX{constructor(Z){this[y3]=null,this[J80]=Z}get target(){return this[y3]}get type(){return this[J80]}}Object.defineProperty(XX.prototype,"target",{enumerable:!0});Object.defineProperty(XX.prototype,"type",{enumerable:!0});class p3 extends XX{constructor(Z,J={}){super(Z);this[o10]=J.code===void 0?0:J.code,this[Z80]=J.reason===void 0?"":J.reason,this[X80]=J.wasClean===void 0?!1:J.wasClean}get code(){return this[o10]}get reason(){return this[Z80]}get wasClean(){return this[X80]}}Object.defineProperty(p3.prototype,"code",{enumerable:!0});Object.defineProperty(p3.prototype,"reason",{enumerable:!0});Object.defineProperty(p3.prototype,"wasClean",{enumerable:!0});class Pz extends XX{constructor(Z,J={}){super(Z);this[t10]=J.error===void 0?null:J.error,this[e10]=J.message===void 0?"":J.message}get error(){return this[t10]}get message(){return this[e10]}}Object.defineProperty(Pz.prototype,"error",{enumerable:!0});Object.defineProperty(Pz.prototype,"message",{enumerable:!0});class Aw extends XX{constructor(Z,J={}){super(Z);this[r10]=J.data===void 0?null:J.data}get data(){return this[r10]}}Object.defineProperty(Aw.prototype,"data",{enumerable:!0});var kI1={addEventListener(Z,J,X={}){for(let Y of this.listeners(Z))if(!X[Nz]&&Y[bP]===J&&!Y[Nz])return;let $;if(Z==="message")$=function Y(Q,K){let W=new Aw("message",{data:K?Q:Q.toString()});W[y3]=this,Sw(J,this,W)};else if(Z==="close")$=function Y(Q,K){let W=new p3("close",{code:Q,reason:K.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});W[y3]=this,Sw(J,this,W)};else if(Z==="error")$=function Y(Q){let K=new Pz("error",{error:Q,message:Q.message});K[y3]=this,Sw(J,this,K)};else if(Z==="open")$=function Y(){let Q=new XX("open");Q[y3]=this,Sw(J,this,Q)};else return;if($[Nz]=!!X[Nz],$[bP]=J,X.once)this.once(Z,$);else this.on(Z,$)},removeEventListener(Z,J){for(let X of this.listeners(Z))if(X[bP]===J&&!X[Nz]){this.removeListener(Z,X);break}}};$80.exports={CloseEvent:p3,ErrorEvent:Pz,Event:XX,EventTarget:kI1,MessageEvent:Aw};function Sw(Z,J,X){if(typeof Z==="object"&&Z.handleEvent)Z.handleEvent.call(Z,X);else Z.call(J,X)}});var hP=U((v_6,Q80)=>{var{tokenChars:Tz}=m3();function q7(Z,J,X){if(Z[J]===void 0)Z[J]=[X];else Z[J].push(X)}function EI1(Z){let J=Object.create(null),X=Object.create(null),$=!1,Y=!1,Q=!1,K,W,G=-1,z=-1,V=-1,H=0;for(;H<Z.length;H++)if(z=Z.charCodeAt(H),K===void 0)if(V===-1&&Tz[z]===1){if(G===-1)G=H}else if(H!==0&&(z===32||z===9)){if(V===-1&&G!==-1)V=H}else if(z===59||z===44){if(G===-1)throw new SyntaxError(`Unexpected character at index ${H}`);if(V===-1)V=H;let q=Z.slice(G,V);if(z===44)q7(J,q,X),X=Object.create(null);else K=q;G=V=-1}else throw new SyntaxError(`Unexpected character at index ${H}`);else if(W===void 0)if(V===-1&&Tz[z]===1){if(G===-1)G=H}else if(z===32||z===9){if(V===-1&&G!==-1)V=H}else if(z===59||z===44){if(G===-1)throw new SyntaxError(`Unexpected character at index ${H}`);if(V===-1)V=H;if(q7(X,Z.slice(G,V),!0),z===44)q7(J,K,X),X=Object.create(null),K=void 0;G=V=-1}else if(z===61&&G!==-1&&V===-1)W=Z.slice(G,H),G=V=-1;else throw new SyntaxError(`Unexpected character at index ${H}`);else if(Y){if(Tz[z]!==1)throw new SyntaxError(`Unexpected character at index ${H}`);if(G===-1)G=H;else if(!$)$=!0;Y=!1}else if(Q)if(Tz[z]===1){if(G===-1)G=H}else if(z===34&&G!==-1)Q=!1,V=H;else if(z===92)Y=!0;else throw new SyntaxError(`Unexpected character at index ${H}`);else if(z===34&&Z.charCodeAt(H-1)===61)Q=!0;else if(V===-1&&Tz[z]===1){if(G===-1)G=H}else if(G!==-1&&(z===32||z===9)){if(V===-1)V=H}else if(z===59||z===44){if(G===-1)throw new SyntaxError(`Unexpected character at index ${H}`);if(V===-1)V=H;let q=Z.slice(G,V);if($)q=q.replace(/\\/g,""),$=!1;if(q7(X,W,q),z===44)q7(J,K,X),X=Object.create(null),K=void 0;W=void 0,G=V=-1}else throw new SyntaxError(`Unexpected character at index ${H}`);if(G===-1||Q||z===32||z===9)throw new SyntaxError("Unexpected end of input");if(V===-1)V=H;let v=Z.slice(G,V);if(K===void 0)q7(J,v,X);else{if(W===void 0)q7(X,v,!0);else if($)q7(X,W,v.replace(/\\/g,""));else q7(X,W,v);q7(J,K,X)}return J}function II1(Z){return Object.keys(Z).map((J)=>{let X=Z[J];if(!Array.isArray(X))X=[X];return X.map(($)=>{return[J].concat(Object.keys($).map((Y)=>{let Q=$[Y];if(!Array.isArray(Q))Q=[Q];return Q.map((K)=>K===!0?Y:`${Y}=${K}`).join("; ")})).join("; ")}).join(", ")}).join(", ")}Q80.exports={format:II1,parse:EI1}});var yw=U((F_6,x80)=>{var _I1=i("events"),bI1=i("https"),hI1=i("http"),G80=i("net"),SI1=i("tls"),{randomBytes:AI1,createHash:mI1}=i("crypto"),{Duplex:H_6,Readable:q_6}=i("stream"),{URL:SP}=i("url"),$X=Oz(),uI1=EP(),lI1=_P(),{isBlob:yI1}=m3(),{BINARY_TYPES:K80,EMPTY_BUFFER:mw,GUID:pI1,kForOnEventAttribute:AP,kListener:iI1,kStatusCode:gI1,kWebSocket:d8,NOOP:z80}=EZ(),{EventTarget:{addEventListener:dI1,removeEventListener:aI1}}=Y80(),{format:nI1,parse:sI1}=hP(),{toBuffer:oI1}=Mz(),V80=Symbol("kAborted"),mP=[8,13],_Z=["CONNECTING","OPEN","CLOSING","CLOSED"],rI1=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/;class S0 extends _I1{constructor(Z,J,X){super();if(this._binaryType=K80[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=mw,this._closeTimer=null,this._errorEmitted=!1,this._extensions={},this._paused=!1,this._protocol="",this._readyState=S0.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,Z!==null){if(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,J===void 0)J=[];else if(!Array.isArray(J))if(typeof J==="object"&&J!==null)X=J,J=[];else J=[J];v80(this,Z,J,X)}else this._autoPong=X.autoPong,this._isServer=!0}get binaryType(){return this._binaryType}set binaryType(Z){if(!K80.includes(Z))return;if(this._binaryType=Z,this._receiver)this._receiver._binaryType=Z}get bufferedAmount(){if(!this._socket)return this._bufferedAmount;return this._socket._writableState.length+this._sender._bufferedBytes}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(Z,J,X){let $=new uI1({allowSynchronousEvents:X.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:X.maxPayload,skipUTF8Validation:X.skipUTF8Validation}),Y=new lI1(Z,this._extensions,X.generateMask);if(this._receiver=$,this._sender=Y,this._socket=Z,$[d8]=this,Y[d8]=this,Z[d8]=this,$.on("conclude",Z_1),$.on("drain",J_1),$.on("error",X_1),$.on("message",$_1),$.on("ping",Y_1),$.on("pong",Q_1),Y.onerror=K_1,Z.setTimeout)Z.setTimeout(0);if(Z.setNoDelay)Z.setNoDelay();if(J.length>0)Z.unshift(J);Z.on("close",F80),Z.on("data",lw),Z.on("end",c80),Z.on("error",w80),this._readyState=S0.OPEN,this.emit("open")}emitClose(){if(!this._socket){this._readyState=S0.CLOSED,this.emit("close",this._closeCode,this._closeMessage);return}if(this._extensions[$X.extensionName])this._extensions[$X.extensionName].cleanup();this._receiver.removeAllListeners(),this._readyState=S0.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(Z,J){if(this.readyState===S0.CLOSED)return;if(this.readyState===S0.CONNECTING){u5(this,this._req,"WebSocket was closed before the connection was established");return}if(this.readyState===S0.CLOSING){if(this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted))this._socket.end();return}this._readyState=S0.CLOSING,this._sender.close(Z,J,!this._isServer,(X)=>{if(X)return;if(this._closeFrameSent=!0,this._closeFrameReceived||this._receiver._writableState.errorEmitted)this._socket.end()}),q80(this)}pause(){if(this.readyState===S0.CONNECTING||this.readyState===S0.CLOSED)return;this._paused=!0,this._socket.pause()}ping(Z,J,X){if(this.readyState===S0.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof Z==="function")X=Z,Z=J=void 0;else if(typeof J==="function")X=J,J=void 0;if(typeof Z==="number")Z=Z.toString();if(this.readyState!==S0.OPEN){uP(this,Z,X);return}if(J===void 0)J=!this._isServer;this._sender.ping(Z||mw,J,X)}pong(Z,J,X){if(this.readyState===S0.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof Z==="function")X=Z,Z=J=void 0;else if(typeof J==="function")X=J,J=void 0;if(typeof Z==="number")Z=Z.toString();if(this.readyState!==S0.OPEN){uP(this,Z,X);return}if(J===void 0)J=!this._isServer;this._sender.pong(Z||mw,J,X)}resume(){if(this.readyState===S0.CONNECTING||this.readyState===S0.CLOSED)return;if(this._paused=!1,!this._receiver._writableState.needDrain)this._socket.resume()}send(Z,J,X){if(this.readyState===S0.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof J==="function")X=J,J={};if(typeof Z==="number")Z=Z.toString();if(this.readyState!==S0.OPEN){uP(this,Z,X);return}let $={binary:typeof Z!=="string",mask:!this._isServer,compress:!0,fin:!0,...J};if(!this._extensions[$X.extensionName])$.compress=!1;this._sender.send(Z||mw,$,X)}terminate(){if(this.readyState===S0.CLOSED)return;if(this.readyState===S0.CONNECTING){u5(this,this._req,"WebSocket was closed before the connection was established");return}if(this._socket)this._readyState=S0.CLOSING,this._socket.destroy()}}Object.defineProperty(S0,"CONNECTING",{enumerable:!0,value:_Z.indexOf("CONNECTING")});Object.defineProperty(S0.prototype,"CONNECTING",{enumerable:!0,value:_Z.indexOf("CONNECTING")});Object.defineProperty(S0,"OPEN",{enumerable:!0,value:_Z.indexOf("OPEN")});Object.defineProperty(S0.prototype,"OPEN",{enumerable:!0,value:_Z.indexOf("OPEN")});Object.defineProperty(S0,"CLOSING",{enumerable:!0,value:_Z.indexOf("CLOSING")});Object.defineProperty(S0.prototype,"CLOSING",{enumerable:!0,value:_Z.indexOf("CLOSING")});Object.defineProperty(S0,"CLOSED",{enumerable:!0,value:_Z.indexOf("CLOSED")});Object.defineProperty(S0.prototype,"CLOSED",{enumerable:!0,value:_Z.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach((Z)=>{Object.defineProperty(S0.prototype,Z,{enumerable:!0})});["open","error","close","message"].forEach((Z)=>{Object.defineProperty(S0.prototype,`on${Z}`,{enumerable:!0,get(){for(let J of this.listeners(Z))if(J[AP])return J[iI1];return null},set(J){for(let X of this.listeners(Z))if(X[AP]){this.removeListener(Z,X);break}if(typeof J!=="function")return;this.addEventListener(Z,J,{[AP]:!0})}})});S0.prototype.addEventListener=dI1;S0.prototype.removeEventListener=aI1;x80.exports=S0;function v80(Z,J,X,$){let Y={allowSynchronousEvents:!0,autoPong:!0,protocolVersion:mP[1],maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...$,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:"GET",host:void 0,path:void 0,port:void 0};if(Z._autoPong=Y.autoPong,!mP.includes(Y.protocolVersion))throw new RangeError(`Unsupported protocol version: ${Y.protocolVersion} (supported versions: ${mP.join(", ")})`);let Q;if(J instanceof SP)Q=J;else try{Q=new SP(J)}catch(c){throw new SyntaxError(`Invalid URL: ${J}`)}if(Q.protocol==="http:")Q.protocol="ws:";else if(Q.protocol==="https:")Q.protocol="wss:";Z._url=Q.href;let K=Q.protocol==="wss:",W=Q.protocol==="ws+unix:",G;if(Q.protocol!=="ws:"&&!K&&!W)G=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`;else if(W&&!Q.pathname)G="The URL's pathname is empty";else if(Q.hash)G="The URL contains a fragment identifier";if(G){let c=new SyntaxError(G);if(Z._redirects===0)throw c;else{uw(Z,c);return}}let z=K?443:80,V=AI1(16).toString("base64"),H=K?bI1.request:hI1.request,v=new Set,q;if(Y.createConnection=Y.createConnection||(K?eI1:tI1),Y.defaultPort=Y.defaultPort||z,Y.port=Q.port||z,Y.host=Q.hostname.startsWith("[")?Q.hostname.slice(1,-1):Q.hostname,Y.headers={...Y.headers,"Sec-WebSocket-Version":Y.protocolVersion,"Sec-WebSocket-Key":V,Connection:"Upgrade",Upgrade:"websocket"},Y.path=Q.pathname+Q.search,Y.timeout=Y.handshakeTimeout,Y.perMessageDeflate)q=new $X(Y.perMessageDeflate!==!0?Y.perMessageDeflate:{},!1,Y.maxPayload),Y.headers["Sec-WebSocket-Extensions"]=nI1({[$X.extensionName]:q.offer()});if(X.length){for(let c of X){if(typeof c!=="string"||!rI1.test(c)||v.has(c))throw new SyntaxError("An invalid or duplicated subprotocol was specified");v.add(c)}Y.headers["Sec-WebSocket-Protocol"]=X.join(",")}if(Y.origin)if(Y.protocolVersion<13)Y.headers["Sec-WebSocket-Origin"]=Y.origin;else Y.headers.Origin=Y.origin;if(Q.username||Q.password)Y.auth=`${Q.username}:${Q.password}`;if(W){let c=Y.path.split(":");Y.socketPath=c[0],Y.path=c[1]}let F;if(Y.followRedirects){if(Z._redirects===0){Z._originalIpc=W,Z._originalSecure=K,Z._originalHostOrSocketPath=W?Y.socketPath:Q.host;let c=$&&$.headers;if($={...$,headers:{}},c)for(let[w,x]of Object.entries(c))$.headers[w.toLowerCase()]=x}else if(Z.listenerCount("redirect")===0){let c=W?Z._originalIpc?Y.socketPath===Z._originalHostOrSocketPath:!1:Z._originalIpc?!1:Q.host===Z._originalHostOrSocketPath;if(!c||Z._originalSecure&&!K){if(delete Y.headers.authorization,delete Y.headers.cookie,!c)delete Y.headers.host;Y.auth=void 0}}if(Y.auth&&!$.headers.authorization)$.headers.authorization="Basic "+Buffer.from(Y.auth).toString("base64");if(F=Z._req=H(Y),Z._redirects)Z.emit("redirect",Z.url,F)}else F=Z._req=H(Y);if(Y.timeout)F.on("timeout",()=>{u5(Z,F,"Opening handshake has timed out")});if(F.on("error",(c)=>{if(F===null||F[V80])return;F=Z._req=null,uw(Z,c)}),F.on("response",(c)=>{let w=c.headers.location,x=c.statusCode;if(w&&Y.followRedirects&&x>=300&&x<400){if(++Z._redirects>Y.maxRedirects){u5(Z,F,"Maximum redirects exceeded");return}F.abort();let j;try{j=new SP(w,J)}catch(B){let L=new SyntaxError(`Invalid URL: ${w}`);uw(Z,L);return}v80(Z,j,X,$)}else if(!Z.emit("unexpected-response",F,c))u5(Z,F,`Unexpected server response: ${c.statusCode}`)}),F.on("upgrade",(c,w,x)=>{if(Z.emit("upgrade",c),Z.readyState!==S0.CONNECTING)return;F=Z._req=null;let j=c.headers.upgrade;if(j===void 0||j.toLowerCase()!=="websocket"){u5(Z,w,"Invalid Upgrade header");return}let B=mI1("sha1").update(V+pI1).digest("base64");if(c.headers["sec-websocket-accept"]!==B){u5(Z,w,"Invalid Sec-WebSocket-Accept header");return}let L=c.headers["sec-websocket-protocol"],R;if(L!==void 0){if(!v.size)R="Server sent a subprotocol but none was requested";else if(!v.has(L))R="Server sent an invalid subprotocol"}else if(v.size)R="Server sent no subprotocol";if(R){u5(Z,w,R);return}if(L)Z._protocol=L;let M=c.headers["sec-websocket-extensions"];if(M!==void 0){if(!q){u5(Z,w,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let O;try{O=sI1(M)}catch(N){u5(Z,w,"Invalid Sec-WebSocket-Extensions header");return}let P=Object.keys(O);if(P.length!==1||P[0]!==$X.extensionName){u5(Z,w,"Server indicated an extension that was not requested");return}try{q.accept(O[$X.extensionName])}catch(N){u5(Z,w,"Invalid Sec-WebSocket-Extensions header");return}Z._extensions[$X.extensionName]=q}Z.setSocket(w,x,{allowSynchronousEvents:Y.allowSynchronousEvents,generateMask:Y.generateMask,maxPayload:Y.maxPayload,skipUTF8Validation:Y.skipUTF8Validation})}),Y.finishRequest)Y.finishRequest(F,Z);else F.end()}function uw(Z,J){Z._readyState=S0.CLOSING,Z._errorEmitted=!0,Z.emit("error",J),Z.emitClose()}function tI1(Z){return Z.path=Z.socketPath,G80.connect(Z)}function eI1(Z){if(Z.path=void 0,!Z.servername&&Z.servername!=="")Z.servername=G80.isIP(Z.host)?"":Z.host;return SI1.connect(Z)}function u5(Z,J,X){Z._readyState=S0.CLOSING;let $=new Error(X);if(Error.captureStackTrace($,u5),J.setHeader){if(J[V80]=!0,J.abort(),J.socket&&!J.socket.destroyed)J.socket.destroy();process.nextTick(uw,Z,$)}else J.destroy($),J.once("error",Z.emit.bind(Z,"error")),J.once("close",Z.emitClose.bind(Z))}function uP(Z,J,X){if(J){let $=yI1(J)?J.size:oI1(J).length;if(Z._socket)Z._sender._bufferedBytes+=$;else Z._bufferedAmount+=$}if(X){let $=new Error(`WebSocket is not open: readyState ${Z.readyState} (${_Z[Z.readyState]})`);process.nextTick(X,$)}}function Z_1(Z,J){let X=this[d8];if(X._closeFrameReceived=!0,X._closeMessage=J,X._closeCode=Z,X._socket[d8]===void 0)return;if(X._socket.removeListener("data",lw),process.nextTick(H80,X._socket),Z===1005)X.close();else X.close(Z,J)}function J_1(){let Z=this[d8];if(!Z.isPaused)Z._socket.resume()}function X_1(Z){let J=this[d8];if(J._socket[d8]!==void 0)J._socket.removeListener("data",lw),process.nextTick(H80,J._socket),J.close(Z[gI1]);if(!J._errorEmitted)J._errorEmitted=!0,J.emit("error",Z)}function W80(){this[d8].emitClose()}function $_1(Z,J){this[d8].emit("message",Z,J)}function Y_1(Z){let J=this[d8];if(J._autoPong)J.pong(Z,!this._isServer,z80);J.emit("ping",Z)}function Q_1(Z){this[d8].emit("pong",Z)}function H80(Z){Z.resume()}function K_1(Z){let J=this[d8];if(J.readyState===S0.CLOSED)return;if(J.readyState===S0.OPEN)J._readyState=S0.CLOSING,q80(J);if(this._socket.end(),!J._errorEmitted)J._errorEmitted=!0,J.emit("error",Z)}function q80(Z){Z._closeTimer=setTimeout(Z._socket.destroy.bind(Z._socket),30000)}function F80(){let Z=this[d8];this.removeListener("close",F80),this.removeListener("data",lw),this.removeListener("end",c80),Z._readyState=S0.CLOSING;let J;if(!this._readableState.endEmitted&&!Z._closeFrameReceived&&!Z._receiver._writableState.errorEmitted&&(J=Z._socket.read())!==null)Z._receiver.write(J);if(Z._receiver.end(),this[d8]=void 0,clearTimeout(Z._closeTimer),Z._receiver._writableState.finished||Z._receiver._writableState.errorEmitted)Z.emitClose();else Z._receiver.on("error",W80),Z._receiver.on("finish",W80)}function lw(Z){if(!this[d8]._receiver.write(Z))this.pause()}function c80(){let Z=this[d8];Z._readyState=S0.CLOSING,Z._receiver.end(),this.end()}function w80(){let Z=this[d8];if(this.removeListener("error",w80),this.on("error",z80),Z)Z._readyState=S0.CLOSING,this.destroy()}});var L80=U((w_6,B80)=>{var c_6=yw(),{Duplex:W_1}=i("stream");function U80(Z){Z.emit("close")}function G_1(){if(!this.destroyed&&this._writableState.finished)this.destroy()}function j80(Z){if(this.removeListener("error",j80),this.destroy(),this.listenerCount("error")===0)this.emit("error",Z)}function z_1(Z,J){let X=!0,$=new W_1({...J,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return Z.on("message",function Y(Q,K){let W=!K&&$._readableState.objectMode?Q.toString():Q;if(!$.push(W))Z.pause()}),Z.once("error",function Y(Q){if($.destroyed)return;X=!1,$.destroy(Q)}),Z.once("close",function Y(){if($.destroyed)return;$.push(null)}),$._destroy=function(Y,Q){if(Z.readyState===Z.CLOSED){Q(Y),process.nextTick(U80,$);return}let K=!1;if(Z.once("error",function W(G){K=!0,Q(G)}),Z.once("close",function W(){if(!K)Q(Y);process.nextTick(U80,$)}),X)Z.terminate()},$._final=function(Y){if(Z.readyState===Z.CONNECTING){Z.once("open",function Q(){$._final(Y)});return}if(Z._socket===null)return;if(Z._socket._writableState.finished){if(Y(),$._readableState.endEmitted)$.destroy()}else Z._socket.once("finish",function Q(){Y()}),Z.close()},$._read=function(){if(Z.isPaused)Z.resume()},$._write=function(Y,Q,K){if(Z.readyState===Z.CONNECTING){Z.once("open",function W(){$._write(Y,Q,K)});return}Z.send(Y,K)},$.on("end",G_1),$.on("error",j80),$}B80.exports=z_1});var M80=U((x_6,D80)=>{var{tokenChars:V_1}=m3();function v_1(Z){let J=new Set,X=-1,$=-1,Y=0;for(Y;Y<Z.length;Y++){let K=Z.charCodeAt(Y);if($===-1&&V_1[K]===1){if(X===-1)X=Y}else if(Y!==0&&(K===32||K===9)){if($===-1&&X!==-1)$=Y}else if(K===44){if(X===-1)throw new SyntaxError(`Unexpected character at index ${Y}`);if($===-1)$=Y;let W=Z.slice(X,$);if(J.has(W))throw new SyntaxError(`The "${W}" subprotocol is duplicated`);J.add(W),X=$=-1}else throw new SyntaxError(`Unexpected character at index ${Y}`)}if(X===-1||$!==-1)throw new SyntaxError("Unexpected end of input");let Q=Z.slice(X,Y);if(J.has(Q))throw new SyntaxError(`The "${Q}" subprotocol is duplicated`);return J.add(Q),J}D80.exports={parse:v_1}});var T80=U((j_6,P80)=>{var H_1=i("events"),pw=i("http"),{Duplex:U_6}=i("stream"),{createHash:q_1}=i("crypto"),R80=hP(),o$=Oz(),F_1=M80(),c_1=yw(),{GUID:w_1,kWebSocket:x_1}=EZ(),U_1=/^[+/0-9A-Za-z]{22}==$/;class N80 extends H_1{constructor(Z,J){super();if(Z={allowSynchronousEvents:!0,autoPong:!0,maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:c_1,...Z},Z.port==null&&!Z.server&&!Z.noServer||Z.port!=null&&(Z.server||Z.noServer)||Z.server&&Z.noServer)throw new TypeError('One and only one of the "port", "server", or "noServer" options must be specified');if(Z.port!=null)this._server=pw.createServer((X,$)=>{let Y=pw.STATUS_CODES[426];$.writeHead(426,{"Content-Length":Y.length,"Content-Type":"text/plain"}),$.end(Y)}),this._server.listen(Z.port,Z.host,Z.backlog,J);else if(Z.server)this._server=Z.server;if(this._server){let X=this.emit.bind(this,"connection");this._removeListeners=j_1(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:($,Y,Q)=>{this.handleUpgrade($,Y,Q,X)}})}if(Z.perMessageDeflate===!0)Z.perMessageDeflate={};if(Z.clientTracking)this.clients=new Set,this._shouldEmitClose=!1;this.options=Z,this._state=0}address(){if(this.options.noServer)throw new Error('The server is operating in "noServer" mode');if(!this._server)return null;return this._server.address()}close(Z){if(this._state===2){if(Z)this.once("close",()=>{Z(new Error("The server is not running"))});process.nextTick(Cz,this);return}if(Z)this.once("close",Z);if(this._state===1)return;if(this._state=1,this.options.noServer||this.options.server){if(this._server)this._removeListeners(),this._removeListeners=this._server=null;if(this.clients)if(!this.clients.size)process.nextTick(Cz,this);else this._shouldEmitClose=!0;else process.nextTick(Cz,this)}else{let J=this._server;this._removeListeners(),this._removeListeners=this._server=null,J.close(()=>{Cz(this)})}}shouldHandle(Z){if(this.options.path){let J=Z.url.indexOf("?");if((J!==-1?Z.url.slice(0,J):Z.url)!==this.options.path)return!1}return!0}handleUpgrade(Z,J,X,$){J.on("error",O80);let Y=Z.headers["sec-websocket-key"],Q=Z.headers.upgrade,K=+Z.headers["sec-websocket-version"];if(Z.method!=="GET"){r$(this,Z,J,405,"Invalid HTTP method");return}if(Q===void 0||Q.toLowerCase()!=="websocket"){r$(this,Z,J,400,"Invalid Upgrade header");return}if(Y===void 0||!U_1.test(Y)){r$(this,Z,J,400,"Missing or invalid Sec-WebSocket-Key header");return}if(K!==13&&K!==8){r$(this,Z,J,400,"Missing or invalid Sec-WebSocket-Version header",{"Sec-WebSocket-Version":"13, 8"});return}if(!this.shouldHandle(Z)){fz(J,400);return}let W=Z.headers["sec-websocket-protocol"],G=new Set;if(W!==void 0)try{G=F_1.parse(W)}catch(H){r$(this,Z,J,400,"Invalid Sec-WebSocket-Protocol header");return}let z=Z.headers["sec-websocket-extensions"],V={};if(this.options.perMessageDeflate&&z!==void 0){let H=new o$(this.options.perMessageDeflate,!0,this.options.maxPayload);try{let v=R80.parse(z);if(v[o$.extensionName])H.accept(v[o$.extensionName]),V[o$.extensionName]=H}catch(v){r$(this,Z,J,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let H={origin:Z.headers[`${K===8?"sec-websocket-origin":"origin"}`],secure:!!(Z.socket.authorized||Z.socket.encrypted),req:Z};if(this.options.verifyClient.length===2){this.options.verifyClient(H,(v,q,F,c)=>{if(!v)return fz(J,q||401,F,c);this.completeUpgrade(V,Y,G,Z,J,X,$)});return}if(!this.options.verifyClient(H))return fz(J,401)}this.completeUpgrade(V,Y,G,Z,J,X,$)}completeUpgrade(Z,J,X,$,Y,Q,K){if(!Y.readable||!Y.writable)return Y.destroy();if(Y[x_1])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>0)return fz(Y,503);let G=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${q_1("sha1").update(J+w_1).digest("base64")}`],z=new this.options.WebSocket(null,void 0,this.options);if(X.size){let V=this.options.handleProtocols?this.options.handleProtocols(X,$):X.values().next().value;if(V)G.push(`Sec-WebSocket-Protocol: ${V}`),z._protocol=V}if(Z[o$.extensionName]){let V=Z[o$.extensionName].params,H=R80.format({[o$.extensionName]:[V]});G.push(`Sec-WebSocket-Extensions: ${H}`),z._extensions=Z}if(this.emit("headers",G,$),Y.write(G.concat(`\r
29
29
  `).join(`\r
30
30
  `)),Y.removeListener("error",O80),z.setSocket(Y,Q,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients)this.clients.add(z),z.on("close",()=>{if(this.clients.delete(z),this._shouldEmitClose&&!this.clients.size)process.nextTick(Cz,this)});K(z,$)}}P80.exports=N80;function j_1(Z,J){for(let X of Object.keys(J))Z.on(X,J[X]);return function X(){for(let $ of Object.keys(J))Z.removeListener($,J[$])}}function Cz(Z){Z._state=2,Z.emit("close")}function O80(){this.destroy()}function fz(Z,J,X,$){X=X||pw.STATUS_CODES[J],$={Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(X),...$},Z.once("finish",Z.destroy),Z.end(`HTTP/1.1 ${J} ${pw.STATUS_CODES[J]}\r
31
31
  `+Object.keys($).map((Y)=>`${Y}: ${$[Y]}`).join(`\r
@@ -447,7 +447,7 @@ qYGMwU/HBVHkLAn5XvT2a9xM0mzZ558d+ahbw8qAgRxg7BZ+2PW/bf7F2WRBUk1f
447
447
  xauhAoGBALEspoxQozwohGQnP7EMF0/0JoKNpdNv0b0qCVvNiMo0+N297lI2mFQp
448
448
  6xYlW/1l9afLokklF/J2IsyBrTCZoY7SaEk/lMMrQSyra+y0z71ogZ8A4ny9fxsj
449
449
  0dDYJZGllL+3E/MQfd7k+KnOM/+A+cPoAnci76+L3vdkUb2P8SJk
450
- -----END RSA PRIVATE KEY-----`;var bf=process.env.PORT??8080,hf="0.10.24",Sf;((Y)=>{Y.READY="WEBSERVER.READY";Y.STOPPED="WEBSERVER.STOPPED";Y.ERROR="WEBSERVER.ERROR";Y.UPGRADE="WEBSERVER.UPGRADE"})(Sf||={});class cK extends j0{static instance=new cK;_webserver=QU.default();_internalHttpServer;constructor(){super();this._webserver.use((Z,J,X)=>{J.header("Access-Control-Allow-Origin","*"),X()}),this._webserver.get("/",(Z,J)=>{J.json({status:"OK",version:hf,runtime:"node"})}),this._webserver.use(QU.default.static("assets",{dotfiles:"allow"}));try{this._webserver.use(QU.default.static(On1.dirname(i.resolve("/Users/arkdev/Desktop/HYTOPIA/hytopia/assets/release/index.js")),{dotfiles:"allow"}))}catch{}}start(){if(!this._internalHttpServer)this._internalHttpServer=process.env.NODE_ENV==="production"?Mn1.createServer(this._webserver):Rn1.createServer({key:YU.existsSync("assets/certs/localhost.key")?YU.readFileSync("assets/certs/localhost.key"):iY0,cert:YU.existsSync("assets/certs/localhost.crt")?YU.readFileSync("assets/certs/localhost.crt"):pY0},this._webserver),this._internalHttpServer.on("upgrade",this._onUpgrade),this._internalHttpServer.on("error",this._onError),this._internalHttpServer.on("close",this._onStopped);else p.warning("WebServer.start(): server already started!");this._internalHttpServer.listen(bf,this._onStarted),console.info(`WebServer.start(): Server running on port ${bf}.`)}stop(){if(this._internalHttpServer)return new Promise((Z,J)=>{this._internalHttpServer.close((X)=>{if(X)J(X);else Z(!0)})});else return p.warning("WebServer.stop(): server not started."),Promise.resolve(!1)}_onStarted=()=>{this.emitWithGlobal("WEBSERVER.READY",{})};_onUpgrade=async(Z,J,X)=>{let $=Nn1.parse(Z.url??"",!0).query,Y=$.connectionId?.toString(),Q=$.sessionToken?.toString()??"";if(Y&&R7.instance.isValidConnectionId(Y))Z.connectionId=Y;else{let K=await F7.instance.getPlayerSession(Q);if(K?.error){let W=`${K.error.code}: ${K.error.message}`;J.write(`HTTP/1.1 401 Unauthorized\r
450
+ -----END RSA PRIVATE KEY-----`;var bf=process.env.PORT??8080,hf="0.10.25",Sf;((Y)=>{Y.READY="WEBSERVER.READY";Y.STOPPED="WEBSERVER.STOPPED";Y.ERROR="WEBSERVER.ERROR";Y.UPGRADE="WEBSERVER.UPGRADE"})(Sf||={});class cK extends j0{static instance=new cK;_webserver=QU.default();_internalHttpServer;constructor(){super();this._webserver.use((Z,J,X)=>{J.header("Access-Control-Allow-Origin","*"),X()}),this._webserver.get("/",(Z,J)=>{J.json({status:"OK",version:hf,runtime:"node"})}),this._webserver.use(QU.default.static("assets",{dotfiles:"allow"}));try{this._webserver.use(QU.default.static(On1.dirname(i.resolve("/Users/arkdev/Desktop/HYTOPIA/hytopia/assets/release/index.js")),{dotfiles:"allow"}))}catch{}}start(){if(!this._internalHttpServer)this._internalHttpServer=process.env.NODE_ENV==="production"?Mn1.createServer(this._webserver):Rn1.createServer({key:YU.existsSync("assets/certs/localhost.key")?YU.readFileSync("assets/certs/localhost.key"):iY0,cert:YU.existsSync("assets/certs/localhost.crt")?YU.readFileSync("assets/certs/localhost.crt"):pY0},this._webserver),this._internalHttpServer.on("upgrade",this._onUpgrade),this._internalHttpServer.on("error",this._onError),this._internalHttpServer.on("close",this._onStopped);else p.warning("WebServer.start(): server already started!");this._internalHttpServer.listen(bf,this._onStarted),console.info(`WebServer.start(): Server running on port ${bf}.`)}stop(){if(this._internalHttpServer)return new Promise((Z,J)=>{this._internalHttpServer.close((X)=>{if(X)J(X);else Z(!0)})});else return p.warning("WebServer.stop(): server not started."),Promise.resolve(!1)}_onStarted=()=>{this.emitWithGlobal("WEBSERVER.READY",{})};_onUpgrade=async(Z,J,X)=>{let $=Nn1.parse(Z.url??"",!0).query,Y=$.connectionId?.toString(),Q=$.sessionToken?.toString()??"";if(Y&&R7.instance.isValidConnectionId(Y))Z.connectionId=Y;else{let K=await F7.instance.getPlayerSession(Q);if(K?.error){let W=`${K.error.code}: ${K.error.message}`;J.write(`HTTP/1.1 401 Unauthorized\r
451
451
  Content-Type: text/plain\r
452
452
  Content-Length: ${W.length}\r
453
453
  Connection: close\r